speedpowder tools work

This commit is contained in:
Jörg Henke 2020-07-30 23:42:55 +02:00
parent 95c662386a
commit 581ba151e3
18 changed files with 272 additions and 0 deletions

View File

@ -0,0 +1,39 @@
package de.jottyfan.minecraft.quickiefabric.blocks;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import de.jottyfan.minecraft.quickiefabric.items.QuickieItems;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.GravelBlock;
import net.minecraft.block.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.loot.context.LootContext.Builder;
/**
*
* @author jotty
*
*/
public class BlockDirtSalpeter extends GravelBlock {
public BlockDirtSalpeter() {
super(FabricBlockSettings.of(Material.STONE).hardness(3.1f));
}
@Override
public List<ItemStack> getDroppedStacks(BlockState blockState, Builder builder) {
Integer count = (Double.valueOf(new Random().nextDouble() * 10).intValue() / 4) + 1;
boolean spawnBoneMeal = new Random().nextDouble() > 0.5f;
ItemStack boneMealStack = new ItemStack(Items.BONE_MEAL);
ItemStack salpeterStack = new ItemStack(QuickieItems.SALPETER, count);
ItemStack dirtStack = new ItemStack(Blocks.DIRT);
ItemStack[] spawnies = spawnBoneMeal ? new ItemStack[] { boneMealStack, salpeterStack, dirtStack }
: new ItemStack[] { salpeterStack, dirtStack };
return Arrays.asList(spawnies);
}
}

View File

@ -0,0 +1,54 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.List;
import com.google.common.collect.Lists;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ToolMaterials;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable {
private HarvestRange range;
public ToolSpeedpowderPickaxe() {
super(ToolMaterials.DIAMOND, 4, 2.0f, new Item.Settings().group(RegistryManager.QUICKIEFABRIC_GROUP));
this.range = new HarvestRange(2);
}
@Override
public HarvestRange getRange() {
return range;
}
@Override
public boolean canBreakNeigbbors(BlockState blockIn) {
return super.isEffectiveOn(blockIn) || PICKAXE_EFFECTIVE_ON.contains(blockIn.getBlock());
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@ -0,0 +1,54 @@
package de.jottyfan.minecraft.quickiefabric.tools;
import java.util.List;
import com.google.common.collect.Lists;
import de.jottyfan.minecraft.quickiefabric.init.RegistryManager;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ShovelItem;
import net.minecraft.item.ToolMaterials;
/**
*
* @author jotty
*
*/
public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable {
public HarvestRange range;
public ToolSpeedpowderShovel() {
super(ToolMaterials.DIAMOND, 4, 2.0f, new Item.Settings().group(RegistryManager.QUICKIEFABRIC_GROUP));
this.range = new HarvestRange(2);
}
@Override
public HarvestRange getRange() {
return range;
}
@Override
public boolean canBreakNeigbbors(BlockState blockIn) {
return SHOVEL_EFFECTIVE_ON.contains(blockIn.getBlock());
}
@Override
public List<Block> getBlockList(Block block) {
return Lists.newArrayList(block);
}
// @Override
// public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) {
// CommonToolCode.onItemRightClick(worldIn, playerIn, handIn);
// return super.onItemRightClick(worldIn, playerIn, handIn);
// }
//
// @Override
// public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn);
// super.addInformation(stack, worldIn, tooltip, flagIn);
// }
}

View File

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "quickiefabric:block/dirtsalpeter"
}
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "block/cube_all",
"textures": {
"all": "quickiefabric:block/dirtsalpeter"
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/dirtsalpeter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/orenethersulphor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/oresalpeter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/oresandsalpeter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/oresulphor",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,10 @@
{
"parent": "quickiefabric:block/sandsalpeter",
"display": {
"thirdperson": {
"rotation": [ 10, -45, 170 ],
"translation": [ 0, 1.5, -2.75 ],
"scale": [ 0.375, 0.375, 0.375 ]
}
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/wooden_pickaxe",
"textures": {
"layer0": "quickiefabric:item/speedpowderpickaxe"
}
}

View File

@ -0,0 +1,6 @@
{
"parent": "item/wooden_shovel",
"textures": {
"layer0": "quickiefabric:item/speedpowdershovel"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 743 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"sss",
" | ",
" | "
],
"key": {
"s": {
"item": "quickiefabric:speedpowder"
},
"|": {
"item": "minecraft:stick"
}
},
"result": {
"item": "quickiefabric:speedpowderpickaxe",
"count": 1
}
}

View File

@ -0,0 +1,20 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
" s ",
" | ",
" | "
],
"key": {
"s": {
"item": "quickiefabric:speedpowder"
},
"|": {
"item": "minecraft:stick"
}
},
"result": {
"item": "quickiefabric:speedpowdershovel",
"count": 1
}
}