diff --git a/src/main/java/de/jottyfan/quickiemod/Quickiemod.java b/src/main/java/de/jottyfan/quickiemod/Quickiemod.java index 4205e9d..360075c 100644 --- a/src/main/java/de/jottyfan/quickiemod/Quickiemod.java +++ b/src/main/java/de/jottyfan/quickiemod/Quickiemod.java @@ -7,9 +7,11 @@ import org.slf4j.LoggerFactory; import de.jottyfan.quickiemod.block.ModBlocks; import de.jottyfan.quickiemod.blockentity.ModBlockentity; +import de.jottyfan.quickiemod.event.EventBlockBreak; import de.jottyfan.quickiemod.item.ModItems; import de.jottyfan.quickiemod.itemgroup.ModItemGroup; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -24,9 +26,14 @@ public class Quickiemod implements ModInitializer { @Override public void onInitialize() { + ModBlockentity.registerModBlockentities(); List items = ModItems.registerModItems(); List blocks = ModBlocks.registerModBlocks(); - ModBlockentity.registerModBlockentities(); ModItemGroup.registerItemGroup(items, blocks); + + PlayerBlockBreakEvents.AFTER.register((world, player, pos, state, blockEntity) -> { + Block oldBlock = state.getBlock(); + new EventBlockBreak().doBreakBlock(world, pos, state, player, oldBlock); + }); } } \ No newline at end of file diff --git a/src/main/java/de/jottyfan/quickiemod/block/BlockItemhoarder.java b/src/main/java/de/jottyfan/quickiemod/block/BlockItemhoarder.java index f2ddd14..7e88b4e 100644 --- a/src/main/java/de/jottyfan/quickiemod/block/BlockItemhoarder.java +++ b/src/main/java/de/jottyfan/quickiemod/block/BlockItemhoarder.java @@ -5,7 +5,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; -import de.jottyfan.quickiemod.blockentity.ModBlockentity; +import de.jottyfan.quickiemod.blockentity.ItemHoarderBlockEntity; import net.minecraft.block.AbstractBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; @@ -42,7 +42,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider { @Override public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) { - return ModBlockentity.ITEM_HOARDER_BLOCKENTITY.instantiate(pos, blockState); + return new ItemHoarderBlockEntity(pos, blockState); } @Override diff --git a/src/main/java/de/jottyfan/quickiemod/block/ItemHoarderBlockEntity.java b/src/main/java/de/jottyfan/quickiemod/blockentity/ItemHoarderBlockEntity.java similarity index 97% rename from src/main/java/de/jottyfan/quickiemod/block/ItemHoarderBlockEntity.java rename to src/main/java/de/jottyfan/quickiemod/blockentity/ItemHoarderBlockEntity.java index b38969b..6376f66 100644 --- a/src/main/java/de/jottyfan/quickiemod/block/ItemHoarderBlockEntity.java +++ b/src/main/java/de/jottyfan/quickiemod/blockentity/ItemHoarderBlockEntity.java @@ -1,9 +1,8 @@ -package de.jottyfan.quickiemod.block; +package de.jottyfan.quickiemod.blockentity; import java.util.ArrayList; import java.util.List; -import de.jottyfan.quickiemod.blockentity.ModBlockentity; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.block.entity.LootableContainerBlockEntity; diff --git a/src/main/java/de/jottyfan/quickiemod/blockentity/ModBlockentity.java b/src/main/java/de/jottyfan/quickiemod/blockentity/ModBlockentity.java index 24b5663..0df2f70 100644 --- a/src/main/java/de/jottyfan/quickiemod/blockentity/ModBlockentity.java +++ b/src/main/java/de/jottyfan/quickiemod/blockentity/ModBlockentity.java @@ -1,13 +1,11 @@ package de.jottyfan.quickiemod.blockentity; -import de.jottyfan.quickiemod.Quickiemod; -import de.jottyfan.quickiemod.block.ItemHoarderBlockEntity; import de.jottyfan.quickiemod.block.ModBlocks; +import de.jottyfan.quickiemod.identifier.ModIdentifiers; import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; import net.minecraft.block.entity.BlockEntityType; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; -import net.minecraft.util.Identifier; /** * @@ -16,7 +14,7 @@ import net.minecraft.util.Identifier; */ public class ModBlockentity { public static final BlockEntityType ITEM_HOARDER_BLOCKENTITY = Registry.register( - Registries.BLOCK_ENTITY_TYPE, Identifier.of(Quickiemod.MOD_ID, "itemhoarderblockentity"), + Registries.BLOCK_ENTITY_TYPE, ModIdentifiers.BLOCKENTITY_ITEMHOARDER, FabricBlockEntityTypeBuilder.create(ItemHoarderBlockEntity::new, ModBlocks.BLOCK_ITEMHOARDER).build()); public static final void registerModBlockentities() { diff --git a/src/main/java/de/jottyfan/quickiemod/event/EventBlockBreak.java b/src/main/java/de/jottyfan/quickiemod/event/EventBlockBreak.java new file mode 100644 index 0000000..e0de73e --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/event/EventBlockBreak.java @@ -0,0 +1,192 @@ +package de.jottyfan.quickiemod.event; + +import java.util.ArrayList; +import java.util.List; + +import de.jottyfan.quickiemod.item.HarvestRange; +import de.jottyfan.quickiemod.item.ModItems; +import de.jottyfan.quickiemod.item.ToolRangeable; +import de.jottyfan.quickiemod.item.ToolSpeedpowderAxe; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.ExperienceOrbEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public class EventBlockBreak { + private enum BlockBreakDirection { + UPWARDS, ALL; + } + + public void doBreakBlock(World world, BlockPos blockPos, BlockState blockState, PlayerEntity playerEntity, Block oldBlock) { + ItemStack mainHandItemStack = playerEntity.getEquippedStack(EquipmentSlot.MAINHAND); + if (mainHandItemStack != null) { + Item item = mainHandItemStack.getItem(); + if (item instanceof ToolRangeable) { + ToolRangeable tool = (ToolRangeable) item; + if (!world.getBlockState(blockPos).getBlock().equals(oldBlock)) { + // recreate old block to make it breakable; otherwise, the recursive algorithm stops directly + world.setBlockState(blockPos, oldBlock.getDefaultState()); + } + int handled = handleRangeableTools(tool, mainHandItemStack, world, oldBlock, blockPos, playerEntity); + if (handled >= 255) { + // reward for using rangeable tool very successful + world.spawnEntity( + new ExperienceOrbEntity(world, blockPos.getX(), blockPos.getY(), blockPos.getZ(), handled / 255)); + } + } + } + } + + /** + * handle the rangeable tools break event + * + * @param tool the tool that has been used + * @param itemStack the item stack + * @param world the world + * @param block the block to break + * @param pos the position of the current block + * @param player the current player + * @return number of affected blocks + */ + private int handleRangeableTools(ToolRangeable tool, ItemStack itemStack, World world, Block currentBlock, + BlockPos pos, PlayerEntity player) { + List validBlocks = tool.getBlockList(currentBlock); + HarvestRange range = tool.getRange(itemStack); + List visitedBlocks = new ArrayList<>(); + if (tool instanceof ToolSpeedpowderAxe) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, + player, true); + } else if (ModItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (ModItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (ModItems.TOOL_SPEEDPOWDERHOE.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (ModItems.TOOL_QUICKIEPOWDERAXE.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, + player, true); + } else if (ModItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (ModItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (ModItems.TOOL_QUICKIEPOWDERHOE.getName().equals(tool.getName())) { + return breakBlockRecursive(visitedBlocks, world, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else { + return 0; + } + } + + /** + * break block recursively; + * + * @param visitedBlocks the positions of visited blocks + * @param world the world + * @param validBlocks the blocks to break + * @param tool the tool used + * @param range the range left over + * @param pos the position + * @param blockBreakDirection the direction for the recursive call + * @param player the player + * @return number of affected blocks + */ + private int breakBlockRecursive(List visitedBlocks, World world, List validBlocks, BlockPos pos, + ToolRangeable tool, HarvestRange range, BlockBreakDirection blockBreakDirection, PlayerEntity player, + boolean breakLeaves) { + boolean ignoreSpawn = visitedBlocks.size() < 1; // with this, the already broken block can be omitted to spawn + if (visitedBlocks.contains(pos.toString())) { + return 0; + } else if (validBlocks == null) { + return 0; + } else { + visitedBlocks.add(pos.toString()); + } + Integer affected = 0; + BlockState blockState = world.getBlockState(pos); + if (tool.canBreakNeighbors(blockState)) { + Block currentBlock = blockState.getBlock(); + if (validBlocks.contains(currentBlock)) { + if (!ignoreSpawn) { + Block.dropStacks(blockState, world, pos); // includes xorbs + } + affected += 1; + world.setBlockState(pos, Blocks.AIR.getDefaultState()); + if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) { + HarvestRange nextRadius = range == null ? null : range.addXYZ(-1); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.north().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.south().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().north().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.up().south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + + if (BlockBreakDirection.ALL.equals(blockBreakDirection)) { + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().east(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().north().west(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().east(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, world, validBlocks, pos.down().south().west(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + } + } + } + } + return affected; + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/identifier/ModIdentifiers.java b/src/main/java/de/jottyfan/quickiemod/identifier/ModIdentifiers.java index 7907fd5..2fb98ac 100644 --- a/src/main/java/de/jottyfan/quickiemod/identifier/ModIdentifiers.java +++ b/src/main/java/de/jottyfan/quickiemod/identifier/ModIdentifiers.java @@ -20,12 +20,27 @@ public class ModIdentifiers { public static final Identifier ITEM_CARROTSTACK = Identifier.of(Quickiemod.MOD_ID, "carrotstack"); public static final Identifier ITEM_ROTTENFLESHSTRIPES = Identifier.of(Quickiemod.MOD_ID, "rotten_flesh_stripes"); + public static final Identifier TOOL_SPEEDPOWDERAXE = Identifier.of(Quickiemod.MOD_ID, "speedpowderaxe"); + public static final Identifier TOOL_SPEEDPOWDERHOE = Identifier.of(Quickiemod.MOD_ID, "speedpowderhoe"); + public static final Identifier TOOL_SPEEDPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "speedpowderpickaxe"); + public static final Identifier TOOL_SPEEDPOWDERSHEARS = Identifier.of(Quickiemod.MOD_ID, "speedpowdershears"); + public static final Identifier TOOL_SPEEDPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "speedpowdershovel"); + public static final Identifier TOOL_SPEEDPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "speedpowderwaterhoe"); + public static final Identifier TOOL_QUICKIEPOWDERAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderaxe"); + public static final Identifier TOOL_QUICKIEPOWDERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderhoe"); + public static final Identifier TOOL_QUICKIEPOWDERPICKAXE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderpickaxe"); + public static final Identifier TOOL_QUICKIEPOWDERSHOVEL = Identifier.of(Quickiemod.MOD_ID, "quickiepowdershovel"); + public static final Identifier TOOL_QUICKIEPOWDERWATERHOE = Identifier.of(Quickiemod.MOD_ID, "quickiepowderwaterhoe"); + public static final Identifier BLOCK_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockquickiepowder"); public static final Identifier BLOCK_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockspeedpowder"); public static final Identifier BLOCK_SALPETER = Identifier.of(Quickiemod.MOD_ID, "blocksalpeter"); public static final Identifier BLOCK_SULFOR = Identifier.of(Quickiemod.MOD_ID, "blocksulphor"); public static final Identifier BLOCK_MONSTERHOARDER = Identifier.of(Quickiemod.MOD_ID, "monsterhoarder"); - public static final Identifier BLOCK_LAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "lavahoarder");; - public static final Identifier BLOCK_EMPTYLAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "emptylavahoarder");; - public static final Identifier BLOCK_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarder");; + public static final Identifier BLOCK_LAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "lavahoarder"); + public static final Identifier BLOCK_EMPTYLAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "emptylavahoarder"); + public static final Identifier BLOCK_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarder"); + + public static final Identifier BLOCKENTITY_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarderblockentity"); + public static final Identifier BLOCKENTITY_BLOCKSTACKER = Identifier.of(Quickiemod.MOD_ID, "blockstackerblockentity"); } diff --git a/src/main/java/de/jottyfan/quickiemod/item/HarvestRange.java b/src/main/java/de/jottyfan/quickiemod/item/HarvestRange.java new file mode 100644 index 0000000..5cc17e1 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/HarvestRange.java @@ -0,0 +1,110 @@ +package de.jottyfan.quickiemod.item; + +import java.io.Serializable; + +/** + * + * @author jotty + * + */ +public class HarvestRange implements Serializable { + private static final long serialVersionUID = 1L; + private int xRange; + private int yRange; + private int zRange; + + public HarvestRange(int xyzRange) { + super(); + this.xRange = xyzRange; + this.yRange = xyzRange; + this.zRange = xyzRange; + } + + public HarvestRange(int[] xyzRange) { + super(); + this.xRange = xyzRange[0]; + this.yRange = xyzRange[1]; + this.zRange = xyzRange[2]; + } + + public HarvestRange(int xRange, int yRange, int zRange) { + super(); + this.xRange = xRange; + this.yRange = yRange; + this.zRange = zRange; + } + + @Override + public String toString() { + StringBuilder buf = new StringBuilder(); + buf.append(xRange).append(":"); + buf.append(yRange).append(":"); + buf.append(zRange).append(":"); + return buf.toString(); + } + + /** + * add i to x, y and z and return the resulting class as a new one + * + * @param i + * the summand + * @return the new class + */ + public HarvestRange addXYZ(int i) { + return new HarvestRange(xRange + i, yRange + i, zRange + i); + } + + /** + * get range as int array + * + * @return the int array + */ + public int[] getRangeAsArray() { + return new int[] {xRange, yRange, zRange}; + } + + /** + * @return the xRange + */ + public int getxRange() { + return xRange; + } + + /** + * @param xRange + * the xRange to set + */ + public void setxRange(int xRange) { + this.xRange = xRange; + } + + /** + * @return the yRange + */ + public int getyRange() { + return yRange; + } + + /** + * @param yRange + * the yRange to set + */ + public void setyRange(int yRange) { + this.yRange = yRange; + } + + /** + * @return the zRange + */ + public int getzRange() { + return zRange; + } + + /** + * @param zRange + * the zRange to set + */ + public void setzRange(int zRange) { + this.zRange = zRange; + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ModItems.java b/src/main/java/de/jottyfan/quickiemod/item/ModItems.java index 346a075..197ca6e 100644 --- a/src/main/java/de/jottyfan/quickiemod/item/ModItems.java +++ b/src/main/java/de/jottyfan/quickiemod/item/ModItems.java @@ -27,6 +27,18 @@ public class ModItems { public static final Item ITEM_CARROTSTACK = registerItem(ModIdentifiers.ITEM_CARROTSTACK, new Item64Stack(ModIdentifiers.ITEM_CARROTSTACK)); public static final Item ITEM_ROTTENFLESHSTRIPES = registerItem(ModIdentifiers.ITEM_ROTTENFLESHSTRIPES, new Item64Stack(ModIdentifiers.ITEM_ROTTENFLESHSTRIPES)); + public static final Item TOOL_SPEEDPOWDERAXE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERAXE, new ToolSpeedpowderAxe(ModIdentifiers.TOOL_SPEEDPOWDERAXE)); + public static final Item TOOL_SPEEDPOWDERHOE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERHOE, new ToolSpeedpowderHoe(ModIdentifiers.TOOL_SPEEDPOWDERHOE)); + public static final Item TOOL_SPEEDPOWDERPICKAXE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERPICKAXE, new ToolSpeedpowderPickaxe(ModIdentifiers.TOOL_SPEEDPOWDERPICKAXE)); + public static final Item TOOL_SPEEDPOWDERSHEARS = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERSHEARS, new ToolSpeedpowderShears(ModIdentifiers.TOOL_SPEEDPOWDERSHEARS)); + public static final Item TOOL_SPEEDPOWDERSHOVEL = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERSHOVEL, new ToolSpeedpowderShovel(ModIdentifiers.TOOL_SPEEDPOWDERSHOVEL)); + public static final Item TOOL_SPEEDPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_SPEEDPOWDERWATERHOE, new ToolSpeedpowderWaterHoe(ModIdentifiers.TOOL_SPEEDPOWDERWATERHOE)); + public static final Item TOOL_QUICKIEPOWDERAXE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERAXE, new ToolQuickiepowderAxe(ModIdentifiers.TOOL_QUICKIEPOWDERAXE)); + public static final Item TOOL_QUICKIEPOWDERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERHOE, new ToolQuickiepowderHoe(ModIdentifiers.TOOL_QUICKIEPOWDERHOE)); + public static final Item TOOL_QUICKIEPOWDERPICKAXE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERPICKAXE, new ToolQuickiepowderPickaxe(ModIdentifiers.TOOL_QUICKIEPOWDERPICKAXE)); + public static final Item TOOL_QUICKIEPOWDERSHOVEL = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL, new ToolQuickiepowderShovel(ModIdentifiers.TOOL_QUICKIEPOWDERSHOVEL)); + public static final Item TOOL_QUICKIEPOWDERWATERHOE = registerItem(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE, new ToolQuickiepowderWaterHoe(ModIdentifiers.TOOL_QUICKIEPOWDERWATERHOE)); + private static final Item registerItem(Identifier identifier, Item item) { return Registry.register(Registries.ITEM, identifier, item); } @@ -45,6 +57,18 @@ public class ModItems { items.add(ITEM_QUICKIEINGOT); items.add(ITEM_CARROTSTACK); items.add(ITEM_ROTTENFLESHSTRIPES); + + items.add(TOOL_SPEEDPOWDERPICKAXE); + items.add(TOOL_SPEEDPOWDERAXE); + items.add(TOOL_SPEEDPOWDERSHOVEL); + items.add(TOOL_SPEEDPOWDERHOE); + items.add(TOOL_SPEEDPOWDERWATERHOE); + items.add(TOOL_SPEEDPOWDERSHEARS); + items.add(TOOL_QUICKIEPOWDERPICKAXE); + items.add(TOOL_QUICKIEPOWDERAXE); + items.add(TOOL_QUICKIEPOWDERSHOVEL); + items.add(TOOL_QUICKIEPOWDERHOE); + items.add(TOOL_QUICKIEPOWDERWATERHOE); return items; } } diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderAxe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderAxe.java new file mode 100644 index 0000000..a4ca1d3 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderAxe.java @@ -0,0 +1,30 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderAxe extends ToolRangeableAxe { + + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolQuickiepowderAxe(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get the range from the stack + return new HarvestRange(64, 128, 64); // trees bigger than that are too heavy for one small axe... + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderHoe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderHoe.java new file mode 100644 index 0000000..d1ef870 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderHoe.java @@ -0,0 +1,24 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderHoe extends ToolRangeableHoe { + + public static final Integer DEFAULT_PLOW_RANGE = 4; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolQuickiepowderHoe(Identifier identifier) { + super(MATERIAL, 7F, -3.1f, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), new HarvestRange(DEFAULT_PLOW_RANGE)); + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderPickaxe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderPickaxe.java new file mode 100644 index 0000000..2054ece --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderPickaxe.java @@ -0,0 +1,64 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.PickaxeItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderPickaxe extends PickaxeItem implements ToolRangeable { + + public static final int[] DEFAULT_HARVEST_RANGE = new int[] { 6, 6, 6 }; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolQuickiepowderPickaxe(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + } + + @Override + public boolean isCorrectForDrops(ItemStack stack, BlockState state) { + return super.isCorrectForDrops(stack, state); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + return new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack(this).isSuitableFor(blockIn); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } + +// @Override +// public ActionResult 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 tooltip, ITooltipFlag flagIn) { +// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); +// super.addInformation(stack, worldIn, tooltip, flagIn); +// } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderShovel.java b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderShovel.java new file mode 100644 index 0000000..83232bf --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderShovel.java @@ -0,0 +1,102 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.ShovelItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderShovel extends ShovelItem implements ToolRangeable { + public static final Integer DEFAULT_HARVEST_RANGE = 6; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 2400, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + public HarvestRange range; + + public ToolQuickiepowderShovel(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + this.range = new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + private void createPathOnGrass(World world, BlockPos pos, Direction side) { + BlockState blockState = world.getBlockState(pos); + if (blockState.isAir()) { + // try to find one underneath + pos = pos.down(); + blockState = world.getBlockState(pos); + } else if (!world.getBlockState(pos.up()).isAir()) { + pos = pos.up(); + blockState = world.getBlockState(pos); + } + if (side != Direction.DOWN) { + BlockState blockState2 = (BlockState) PATH_STATES.get(blockState.getBlock()); + if (blockState2 != null && world.getBlockState(pos.up()).isAir()) { + if (!world.isClient) { + world.setBlockState(pos, blockState2, 11); + } + } + } + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + World world = context.getWorld(); + BlockPos pos = context.getBlockPos(); + BlockPos[] positions = new BlockPos[] { pos.north().north().west().west(), pos.north().north().west(), + pos.north().north(), pos.north().north().east(), pos.north().north().east().east(), pos.north().west().west(), + pos.north().west(), pos.north(), pos.north().east(), pos.north().east().east(), pos.west().west(), pos.west(), + pos, pos.east(), pos.east().east(), pos.south().west().west(), pos.south().west(), pos.south(), + pos.south().east(), pos.south().east().east(), pos.south().south().west().west(), pos.south().south().west(), + pos.south().south(), pos.south().south().east(), pos.south().south().east().east() }; + for (BlockPos p : positions) { + createPathOnGrass(world, p, context.getSide()); + } + return super.useOnBlock(context); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isSuitableFor(blockState); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } + +// @Override +// public ActionResult 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 tooltip, ITooltipFlag flagIn) { +// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); +// super.addInformation(stack, worldIn, tooltip, flagIn); +// } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderWaterHoe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderWaterHoe.java new file mode 100644 index 0000000..36245a9 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolQuickiepowderWaterHoe.java @@ -0,0 +1,43 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderWaterHoe extends ToolQuickiepowderHoe { + public ToolQuickiepowderWaterHoe(Identifier identifier) { + super(identifier); + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ActionResult res = super.useOnBlock(context); + if (!ActionResult.PASS.equals(res)) { + BlockPos pos = context.getBlockPos(); + World world = context.getWorld(); + BlockState oldBlockState = world.getBlockState(pos); + world.setBlockState(pos, Blocks.WATER.getDefaultState()); + Hand hand = context.getHand(); + PlayerEntity player = context.getPlayer(); + ItemStack oldTool = player.getStackInHand(hand); + ItemStack newTool = new ItemStack(ModItems.TOOL_QUICKIEPOWDERHOE); + newTool.setDamage(oldTool.getDamage()); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock()))); + player.setStackInHand(hand, newTool); + } + return res; + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolRangeable.java b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeable.java new file mode 100644 index 0000000..48e2937 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeable.java @@ -0,0 +1,46 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; + +/** + * + * @author jotty + * + */ +public interface ToolRangeable { + + /** + * dummy to have a getName method that comes with the item + * + * @return the name + */ + public Text getName(); + + /** + * @param stack the item stack that keeps the range + * @return range of blocks to be harvested + */ + public HarvestRange getRange(ItemStack stack); + + /** + * check if this block state is one that affects the neighbor blocks to break + * also if they are from the same type + * + * @param blockState the block state of the current block + * @return true or false + */ + public boolean canBreakNeighbors(BlockState blockState); + + /** + * get list of blocks that belong together (could be useful for stripped logs) + * + * @param block of the set + * @return the list of blocks or null if not found + */ + public List getBlockList(Block block); +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableAxe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableAxe.java new file mode 100644 index 0000000..bdaa856 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableAxe.java @@ -0,0 +1,63 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.LeavesBlock; +import net.minecraft.item.AxeItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.tag.BlockTags; + +/** + * + * @author jotty + * + */ +public abstract class ToolRangeableAxe extends AxeItem implements ToolRangeable { + + protected ToolRangeableAxe(ToolMaterial material, float attackDamage, float attackSpeed, Item.Settings settings) { + super(material, attackDamage, attackSpeed, settings); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get the range from the stack + return new HarvestRange(16, 32, 16); + } + + /** + * check if the block is a leaves block + * + * @param blockIn the block + * @return true or false + */ + private boolean isLeavesBlock(BlockState blockIn) { + boolean vanillaLeaves = blockIn.getBlock() instanceof LeavesBlock; + boolean terrestriaLeaves = false; + try { + Class extendedLeavesBlock = Class.forName("com.terraformersmc.terraform.leaves.block.ExtendedLeavesBlock"); + terrestriaLeaves = extendedLeavesBlock.isInstance(blockIn.getBlock()); + } catch (ClassNotFoundException e) { + // no terrestria mod available, so ignore this + // using this approach instead of the instanceof functionality, we don't need to refer to terrestria + // and omit a crash on installations that do not have or want terrestria available + } + boolean blockTagLeaves = blockIn.isIn(BlockTags.LEAVES); + return vanillaLeaves || terrestriaLeaves || blockTagLeaves; + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack(this).isSuitableFor(blockIn) || isLeavesBlock(blockIn) || blockIn.isIn(BlockTags.LOGS); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableHoe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableHoe.java new file mode 100644 index 0000000..ad84ed8 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolRangeableHoe.java @@ -0,0 +1,97 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.CropBlock; +import net.minecraft.item.HoeItem; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.ToolMaterial; +import net.minecraft.util.ActionResult; +import net.minecraft.util.hit.BlockHitResult; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.util.math.Vec3i; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public abstract class ToolRangeableHoe extends HoeItem implements ToolRangeable { + + public HarvestRange range; + + public ToolRangeableHoe(ToolMaterial material, float attackDamage, float attackSpeed, Settings settings, HarvestRange range) { + super(material, attackDamage, attackSpeed, settings); + this.range = range; + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ActionResult res = super.useOnBlock(context); + boolean isCrop = context.getWorld().getBlockState(context.getBlockPos()).getBlock() instanceof CropBlock; + if (!ActionResult.PASS.equals(res) || isCrop) { + for (int x = -this.range.getxRange(); x <= this.range.getxRange(); x++) { + for (int y = -this.range.getyRange(); y <= this.range.getyRange(); y++) { + for (int z = -this.range.getzRange(); z <= this.range.getzRange(); z++) { + if (!isCrop) { + removePossibleGrass(context.getWorld(), new BlockPos(x, y, z)); + BlockHitResult bhr = new BlockHitResult(context.getHitPos(), Direction.UP, + context.getBlockPos().add(new Vec3i(x, y, z)), false); + ItemUsageContext ctx = new ItemUsageContext(context.getPlayer(), context.getHand(), bhr); + super.useOnBlock(ctx); + } else { + harvestIfPossible(context.getBlockPos().add(x, y, z), context.getWorld()); + } + } + } + } + } + return res; + } + + private void removePossibleGrass(World world, BlockPos pos) { + Block block = world.getBlockState(pos).getBlock(); + Boolean grassFound = Blocks.FERN.equals(block) || Blocks.LARGE_FERN.equals(block) + || Blocks.SHORT_GRASS.equals(block) || Blocks.TALL_GRASS.equals(block); + if (grassFound) { + world.breakBlock(pos, true); + } + } + + private void harvestIfPossible(BlockPos pos, World world) { + BlockState blockState = world.getBlockState(pos); + Block block = blockState.getBlock(); + if (block instanceof CropBlock) { + CropBlock cBlock = (CropBlock) block; + if (cBlock.isMature(blockState)) { + Block.dropStacks(blockState, world, pos); + world.setBlockState(pos, cBlock.withAge(0)); + } + } + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isSuitableFor(blockState) || Blocks.TALL_GRASS.equals(blockState.getBlock()) + || Blocks.FERN.equals(blockState.getBlock()) || Blocks.LARGE_FERN.equals(blockState.getBlock()); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderAxe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderAxe.java new file mode 100644 index 0000000..cd70e76 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderAxe.java @@ -0,0 +1,30 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderAxe extends ToolRangeableAxe { + + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolSpeedpowderAxe(Identifier identifier) { + super(MATERIAL, 7f, -3.1f, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get the range from the stack + return new HarvestRange(32, 64, 32); + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderHoe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderHoe.java new file mode 100644 index 0000000..9970559 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderHoe.java @@ -0,0 +1,24 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.item.Item; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderHoe extends ToolRangeableHoe { + + public static final Integer DEFAULT_PLOW_RANGE = 2; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolSpeedpowderHoe(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier)), new HarvestRange(DEFAULT_PLOW_RANGE)); + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderPickaxe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderPickaxe.java new file mode 100644 index 0000000..04691cb --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderPickaxe.java @@ -0,0 +1,59 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.PickaxeItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderPickaxe extends PickaxeItem implements ToolRangeable { + + public static final int[] DEFAULT_HARVEST_RANGE = new int[] { 3, 3, 3 }; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7.0F, 1.0F, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + + public ToolSpeedpowderPickaxe(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + return new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack(this).isSuitableFor(blockIn); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } + +// @Override +// public ActionResult 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 tooltip, ITooltipFlag flagIn) { +// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); +// super.addInformation(stack, worldIn, tooltip, flagIn); +// } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShears.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShears.java new file mode 100644 index 0000000..170c56a --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShears.java @@ -0,0 +1,99 @@ +package de.jottyfan.quickiemod.item; + +import java.util.Random; + +import net.minecraft.component.DataComponentTypes; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.passive.ChickenEntity; +import net.minecraft.entity.passive.CowEntity; +import net.minecraft.entity.passive.HorseEntity; +import net.minecraft.entity.passive.SheepEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.item.ShearsItem; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.util.ActionResult; +import net.minecraft.util.DyeColor; +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.Vec3d; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderShears extends ShearsItem { + + public ToolSpeedpowderShears(Identifier identifier) { + super(new Item.Settings().component(DataComponentTypes.TOOL, ShearsItem.createToolComponent()).useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + } + + @Override + public ActionResult useOnEntity(ItemStack stack, PlayerEntity user, LivingEntity entity, Hand hand) { + Vec3d pos = entity.getPos(); + Integer amount = 3 + new Random().nextInt(4); + if (entity instanceof SheepEntity) { + SheepEntity sheep = (SheepEntity) entity; + if (sheep.isShearable()) { + sheep.setSheared(true); + sheep.playAmbientSound(); + DyeColor color = sheep.getColor(); + Item item = Items.WHITE_WOOL; + if (color.equals(DyeColor.BLACK)) { + item = Items.BLACK_WOOL; + } else if (color.equals(DyeColor.GRAY)) { + item = Items.GRAY_WOOL; + } else if (color.equals(DyeColor.LIGHT_GRAY)) { + item = Items.LIGHT_GRAY_WOOL; + } else if (color.equals(DyeColor.BROWN)) { + item = Items.BROWN_WOOL; + } else if (color.equals(DyeColor.BLUE)) { + item = Items.BLUE_WOOL; + } else if (color.equals(DyeColor.LIGHT_BLUE)) { + item = Items.LIGHT_BLUE_WOOL; + } else if (color.equals(DyeColor.GREEN)) { + item = Items.GREEN_WOOL; + } else if (color.equals(DyeColor.LIME)) { + item = Items.LIME_WOOL; + } else if (color.equals(DyeColor.CYAN)) { + item = Items.CYAN_WOOL; + } else if (color.equals(DyeColor.MAGENTA)) { + item = Items.MAGENTA_WOOL; + } else if (color.equals(DyeColor.ORANGE)) { + item = Items.ORANGE_WOOL; + } else if (color.equals(DyeColor.PINK)) { + item = Items.PINK_WOOL; + } else if (color.equals(DyeColor.PURPLE)) { + item = Items.PURPLE_WOOL; + } else if (color.equals(DyeColor.RED)) { + item = Items.RED_WOOL; + } else if (color.equals(DyeColor.YELLOW)) { + item = Items.YELLOW_WOOL; + } + user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(item, amount))); + return ActionResult.SUCCESS; + } + } else if (entity instanceof HorseEntity) { + HorseEntity horse = (HorseEntity) entity; + horse.playAmbientSound(); + user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); + return ActionResult.SUCCESS; + } else if (entity instanceof CowEntity) { + CowEntity cow = (CowEntity) entity; + cow.playAmbientSound(); + user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.LEATHER, amount))); + return ActionResult.SUCCESS; + } else if (entity instanceof ChickenEntity) { + ChickenEntity cow = (ChickenEntity) entity; + cow.playAmbientSound(); + user.getWorld().spawnEntity(new ItemEntity(user.getWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.FEATHER, amount))); + return ActionResult.SUCCESS; + } + return ActionResult.PASS; + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShovel.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShovel.java new file mode 100644 index 0000000..a6e17d1 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderShovel.java @@ -0,0 +1,101 @@ +package de.jottyfan.quickiemod.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.item.ShovelItem; +import net.minecraft.item.ToolMaterial; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.BlockTags; +import net.minecraft.registry.tag.ItemTags; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Direction; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderShovel extends ShovelItem implements ToolRangeable { + public static final Integer DEFAULT_HARVEST_RANGE = 3; + private final static ToolMaterial MATERIAL = new ToolMaterial(BlockTags.INCORRECT_FOR_DIAMOND_TOOL, 800, 7f, 1f, 15, ItemTags.DIAMOND_TOOL_MATERIALS); + public HarvestRange range; + + public ToolSpeedpowderShovel(Identifier identifier) { + super(MATERIAL, 7F, -3.1F, new Item.Settings().useItemPrefixedTranslationKey().registryKey(RegistryKey.of(RegistryKeys.ITEM, identifier))); + this.range = new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + private void createPathOnGrass(World world, BlockPos pos, Direction side) { + BlockState blockState = world.getBlockState(pos); + if (blockState.isAir()) { + // try to find one underneath + pos = pos.down(); + blockState = world.getBlockState(pos); + } else if (!world.getBlockState(pos.up()).isAir()) { + pos = pos.up(); + blockState = world.getBlockState(pos); + } + if (side != Direction.DOWN) { + BlockState blockState2 = (BlockState) PATH_STATES.get(blockState.getBlock()); + if (blockState2 != null && world.getBlockState(pos.up()).isAir()) { + if (!world.isClient) { + world.setBlockState(pos, blockState2, 11); + } + } + } + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + World world = context.getWorld(); + BlockPos pos = context.getBlockPos(); + createPathOnGrass(world, pos.north(), context.getSide()); + createPathOnGrass(world, pos.north().east(), context.getSide()); + createPathOnGrass(world, pos.north().west(), context.getSide()); + createPathOnGrass(world, pos.east(), context.getSide()); + createPathOnGrass(world, pos.west(), context.getSide()); + createPathOnGrass(world, pos.south(), context.getSide()); + createPathOnGrass(world, pos.south().east(), context.getSide()); + createPathOnGrass(world, pos.south().west(), context.getSide()); + return super.useOnBlock(context); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isSuitableFor(blockState); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } + +// @Override +// public ActionResult 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 tooltip, ITooltipFlag flagIn) { +// CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); +// super.addInformation(stack, worldIn, tooltip, flagIn); +// } +} diff --git a/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderWaterHoe.java b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderWaterHoe.java new file mode 100644 index 0000000..ca0b714 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/item/ToolSpeedpowderWaterHoe.java @@ -0,0 +1,43 @@ +package de.jottyfan.quickiemod.item; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.entity.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUsageContext; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderWaterHoe extends ToolSpeedpowderHoe { + public ToolSpeedpowderWaterHoe(Identifier identifier) { + super(identifier); + } + + @Override + public ActionResult useOnBlock(ItemUsageContext context) { + ActionResult res = super.useOnBlock(context); + if (!ActionResult.PASS.equals(res)) { + BlockPos pos = context.getBlockPos(); + World world = context.getWorld(); + BlockState oldBlockState = world.getBlockState(pos); + world.setBlockState(pos, Blocks.WATER.getDefaultState()); + Hand hand = context.getHand(); + PlayerEntity player = context.getPlayer(); + ItemStack oldTool = player.getStackInHand(hand); + ItemStack newTool = new ItemStack(ModItems.TOOL_SPEEDPOWDERHOE); + newTool.setDamage(oldTool.getDamage()); + world.spawnEntity(new ItemEntity(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock()))); + player.setStackInHand(hand, newTool); + } + return res; + } +} diff --git a/src/main/java/de/jottyfan/quickiemod/mixin/ExampleMixin.java b/src/main/java/de/jottyfan/quickiemod/mixin/ExampleMixin.java deleted file mode 100644 index 2586ee1..0000000 --- a/src/main/java/de/jottyfan/quickiemod/mixin/ExampleMixin.java +++ /dev/null @@ -1,15 +0,0 @@ -package de.jottyfan.quickiemod.mixin; - -import net.minecraft.server.MinecraftServer; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - -@Mixin(MinecraftServer.class) -public class ExampleMixin { - @Inject(at = @At("HEAD"), method = "loadWorld") - private void init(CallbackInfo info) { - // This code is injected into the start of MinecraftServer.loadWorld()V - } -} \ No newline at end of file diff --git a/src/main/java/de/jottyfan/quickiemod/util/ModTags.java b/src/main/java/de/jottyfan/quickiemod/util/ModTags.java new file mode 100644 index 0000000..8a17ec4 --- /dev/null +++ b/src/main/java/de/jottyfan/quickiemod/util/ModTags.java @@ -0,0 +1,28 @@ +package de.jottyfan.quickiemod.util; + +import de.jottyfan.quickiemod.Quickiemod; +import net.minecraft.block.Block; +import net.minecraft.registry.RegistryKeys; +import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; + +/** + * + * @author jotty + * + */ +public class ModTags { + + public static final class Blocks { + public static final TagKey SPEEDPOWDER_TOOL = createTag("speedpowder_tool"); + public static final TagKey QUICKIEPOWDER_TOOL = createTag("quickiepowder_tool"); + + private static final TagKey createTag(String name) { + return TagKey.of(RegistryKeys.BLOCK, Identifier.of(Quickiemod.MOD_ID, name)); + } + } + + public static final class Items { + + } +} diff --git a/src/main/resources/assets/quickiemod/models/item/quickiepowderaxe.json b/src/main/resources/assets/quickiemod/models/item/quickiepowderaxe.json new file mode 100644 index 0000000..0cea2f2 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/quickiepowderaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "quickiemod:item/quickiepowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/quickiepowderhoe.json b/src/main/resources/assets/quickiemod/models/item/quickiepowderhoe.json new file mode 100644 index 0000000..ead1c19 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/quickiepowderhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/quickiepowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/quickiepowderpickaxe.json b/src/main/resources/assets/quickiemod/models/item/quickiepowderpickaxe.json new file mode 100644 index 0000000..1f56799 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/quickiepowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/quickiepowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/quickiepowdershovel.json b/src/main/resources/assets/quickiemod/models/item/quickiepowdershovel.json new file mode 100644 index 0000000..a4d63b1 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/quickiepowdershovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/quickiepowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/quickiepowderwaterhoe.json b/src/main/resources/assets/quickiemod/models/item/quickiepowderwaterhoe.json new file mode 100644 index 0000000..e64a3ba --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/quickiepowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/quickiepowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowderaxe.json b/src/main/resources/assets/quickiemod/models/item/speedpowderaxe.json new file mode 100644 index 0000000..60144a3 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowderaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowderhoe.json b/src/main/resources/assets/quickiemod/models/item/speedpowderhoe.json new file mode 100644 index 0000000..9a41b20 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowderhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowderpickaxe.json b/src/main/resources/assets/quickiemod/models/item/speedpowderpickaxe.json new file mode 100644 index 0000000..3e7d09b --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowdershears.json b/src/main/resources/assets/quickiemod/models/item/speedpowdershears.json new file mode 100644 index 0000000..41c3f15 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowdershears.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowdershovel.json b/src/main/resources/assets/quickiemod/models/item/speedpowdershovel.json new file mode 100644 index 0000000..a99ff48 --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowdershovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickiemod/models/item/speedpowderwaterhoe.json b/src/main/resources/assets/quickiemod/models/item/speedpowderwaterhoe.json new file mode 100644 index 0000000..37507fc --- /dev/null +++ b/src/main/resources/assets/quickiemod/models/item/speedpowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickiemod:item/speedpowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/item/axes.json b/src/main/resources/data/c/tags/item/axes.json new file mode 100644 index 0000000..de1bbae --- /dev/null +++ b/src/main/resources/data/c/tags/item/axes.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickiemod:speedpowderaxe", + "quickiemod:quickiepowderaxe" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/item/hoes.json b/src/main/resources/data/c/tags/item/hoes.json new file mode 100644 index 0000000..1bceade --- /dev/null +++ b/src/main/resources/data/c/tags/item/hoes.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "quickiemod:speedpowderhoe", + "quickiemod:speedpowderwaterhoe", + "quickiemod:quickiepowderhoe", + "quickiemod:quickiepowderwaterhoe" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/item/pickaxes.json b/src/main/resources/data/c/tags/item/pickaxes.json new file mode 100644 index 0000000..9bbc032 --- /dev/null +++ b/src/main/resources/data/c/tags/item/pickaxes.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickiemod:speedpowderpickaxe", + "quickiemod:quickiepowderpickaxe" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/c/tags/item/shovels.json b/src/main/resources/data/c/tags/item/shovels.json new file mode 100644 index 0000000..bc7e63b --- /dev/null +++ b/src/main/resources/data/c/tags/item/shovels.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickiemod:speedpowdershovel", + "quickiemod:quickiepowdershovel" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_barrel.json b/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_barrel.json index e497221..252da90 100644 --- a/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_barrel.json +++ b/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_barrel.json @@ -2,12 +2,12 @@ "type": "minecraft:crafting_shaped", "pattern": [ "ooo", - "oso", + "obo", "ooo" ], "key": { "o": "quickiemod:speedingot", - "s": "minecraft:barrel" + "b": "minecraft:barrel" }, "result": { "id": "quickiemod:itemhoarder", diff --git a/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_chest.json b/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_chest.json index ebc5525..d6ddc24 100644 --- a/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_chest.json +++ b/src/main/resources/data/quickiemod/recipe/shaped_itemhoarder_from_chest.json @@ -2,12 +2,12 @@ "type": "minecraft:crafting_shaped", "pattern": [ "ooo", - "oso", + "oco", "ooo" ], "key": { "o": "quickiemod:speedingot", - "s": "c:chests" + "c": "minecraft:chest" }, "result": { "id": "quickiemod:itemhoarder", diff --git a/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderaxe.json b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderaxe.json new file mode 100644 index 0000000..2de441b --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + "s|", + " |" + ], + "key": { + "s": "quickiemod:quickieingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:quickiepowderaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderhoe.json b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderhoe.json new file mode 100644 index 0000000..defdd14 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderhoe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + " |", + " |" + ], + "key": { + "s": "quickiemod:quickieingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:quickiepowderhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderpickaxe.json b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderpickaxe.json new file mode 100644 index 0000000..99c0879 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowderpickaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "sss", + " | ", + " | " + ], + "key": { + "s": "quickiemod:quickieingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:quickiepowderpickaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_quickiepowdershovel.json b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowdershovel.json new file mode 100644 index 0000000..6e4a73d --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_quickiepowdershovel.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "s", + "|", + "|" + ], + "key": { + "s": "quickiemod:quickieingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:quickiepowdershovel", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_speedpowder_shears.json b/src/main/resources/data/quickiemod/recipe/shaped_speedpowder_shears.json new file mode 100644 index 0000000..e440505 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_speedpowder_shears.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + " #", + "# " + ], + "key": { + "#": "quickiemod:speedingot" + }, + "result": { + "id": "quickiemod:speedpowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_speedpowderaxe.json b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderaxe.json new file mode 100644 index 0000000..cd9cf5d --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + "s|", + " |" + ], + "key": { + "s": "quickiemod:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:speedpowderaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_speedpowderhoe.json b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderhoe.json new file mode 100644 index 0000000..9f7ea07 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderhoe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + " |", + " |" + ], + "key": { + "s": "quickiemod:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:speedpowderhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_speedpowderpickaxe.json b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderpickaxe.json new file mode 100644 index 0000000..9e8dd92 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_speedpowderpickaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "sss", + " | ", + " | " + ], + "key": { + "s": "quickiemod:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:speedpowderpickaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shaped_speedpowdershovel.json b/src/main/resources/data/quickiemod/recipe/shaped_speedpowdershovel.json new file mode 100644 index 0000000..0e62864 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shaped_speedpowdershovel.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "s", + "|", + "|" + ], + "key": { + "s": "quickiemod:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickiemod:speedpowdershovel", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shapeless_quickiepowderwaterhoe.json b/src/main/resources/data/quickiemod/recipe/shapeless_quickiepowderwaterhoe.json new file mode 100644 index 0000000..abf4445 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shapeless_quickiepowderwaterhoe.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + "minecraft:water_bucket", + "quickiemod:quickiepowderhoe" + ], + "result": { + "id": "quickiemod:quickiepowderwaterhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickiemod/recipe/shapeless_speedpowderwaterhoe.json b/src/main/resources/data/quickiemod/recipe/shapeless_speedpowderwaterhoe.json new file mode 100644 index 0000000..b20a1d3 --- /dev/null +++ b/src/main/resources/data/quickiemod/recipe/shapeless_speedpowderwaterhoe.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + "minecraft:water_bucket", + "quickiemod:speedpowderhoe" + ], + "result": { + "id": "quickiemod:speedpowderwaterhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 5de6673..0467c03 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,7 +26,6 @@ ] }, "mixins": [ - "quickiemod.mixins.json" ], "depends": { "fabricloader": ">=0.16.9", diff --git a/src/main/resources/quickiemod.mixins.json b/src/main/resources/quickiemod.mixins.json deleted file mode 100644 index af97a1e..0000000 --- a/src/main/resources/quickiemod.mixins.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "required": true, - "package": "de.jottyfan.quickiemod.mixin", - "compatibilityLevel": "JAVA_21", - "mixins": [ - "ExampleMixin" - ], - "injectors": { - "defaultRequire": 1 - } -} \ No newline at end of file