diff --git a/src/main/java/de/jottyfan/minecraft/Quickly.java b/src/main/java/de/jottyfan/minecraft/Quickly.java index 7714249..f786a90 100644 --- a/src/main/java/de/jottyfan/minecraft/Quickly.java +++ b/src/main/java/de/jottyfan/minecraft/Quickly.java @@ -6,6 +6,7 @@ import org.apache.logging.log4j.Logger; import de.jottyfan.minecraft.block.QuicklyBlocks; import de.jottyfan.minecraft.blockentity.QuicklyBlockEntity; import de.jottyfan.minecraft.composter.QuicklyComposter; +import de.jottyfan.minecraft.event.QuicklyEvents; import de.jottyfan.minecraft.feature.QuicklyFeatures; import de.jottyfan.minecraft.item.QuicklyItems; import de.jottyfan.minecraft.loot.QuicklyLootTables; @@ -32,5 +33,6 @@ public class Quickly implements ModInitializer { QuicklyFeatures.registerFeatures(); QuicklyComposter.registerComposterItems(); QuicklyLootTables.registerChanges(); + QuicklyEvents.registerBlockBreak(); } } \ No newline at end of file diff --git a/src/main/java/de/jottyfan/minecraft/event/EventBlockBreak.java b/src/main/java/de/jottyfan/minecraft/event/EventBlockBreak.java new file mode 100644 index 0000000..2a66774 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/event/EventBlockBreak.java @@ -0,0 +1,215 @@ +package de.jottyfan.minecraft.event; + +import java.util.ArrayList; +import java.util.List; + +import de.jottyfan.minecraft.Quickly; +import de.jottyfan.minecraft.item.HarvestRange; +import de.jottyfan.minecraft.item.QuicklyItems; +import de.jottyfan.minecraft.item.ToolRangeable; +import net.minecraft.core.BlockPos; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.ExperienceOrb; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public class EventBlockBreak { + private enum BlockBreakDirection { + UPWARDS, ALL; + } + + /** + * break surrounding block if item is of ToolRangeable + * + * @param level + * @param blockPos + * @param blockState + * @param player + * @param oldBlock + * @return true if this range breaking routine has been used, false otherwise + */ + public boolean doBreakBlock(Level level, BlockPos blockPos, BlockState blockState, Player player, Block oldBlock) { + ItemStack mainHandItemStack = player.getMainHandItem(); + if (mainHandItemStack != null) { + Item item = mainHandItemStack.getItem(); + if (item instanceof ToolRangeable) { + ToolRangeable tool = (ToolRangeable) item; + // not needed when added to before block break +// if (!world.getBlockState(blockPos).getBlock().equals(oldBlock)) { +// // recreate old block to make it breakable; otherwise, the recursive algorithm stops directly +// // this leads to the BUG that blocks with no neighbour will respawn and drop -> unlimited items. +// world.setBlockState(blockPos, oldBlock.getDefaultState()); +// } + int handled = handleRangeableTools(tool, mainHandItemStack, level, oldBlock, blockPos, player); + if (handled >= 255) { + // reward for using rangeable tool very successful + level.addFreshEntity( + new ExperienceOrb(level, blockPos.getX(), blockPos.getY(), blockPos.getZ(), handled / 255)); + } + return handled > 0; // this way, a rangeable pickaxe can break a dirt block + } else { + return false; + } + } else { + return false; + } + } + + /** + * handle the rangeable tools break event + * + * @param tool the tool that has been used + * @param itemStack the item stack + * @param level 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, Level level, Block currentBlock, + BlockPos pos, Player player) { + List validBlocks = tool.getBlockList(currentBlock); + HarvestRange range = tool.getRange(itemStack); + if (tool instanceof Item) { + Item toolItem = (Item) tool; // a rangeable tool should always be an item + List visitedBlocks = new ArrayList<>(); + if (QuicklyItems.TOOL_SPEEDPOWDERAXE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, + player, true); + } else if (QuicklyItems.TOOL_SPEEDPOWDERPICKAXE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (QuicklyItems.TOOL_SPEEDPOWDERSHOVEL.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (QuicklyItems.TOOL_SPEEDPOWDERHOE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (QuicklyItems.TOOL_QUICKIEPOWDERAXE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.UPWARDS, + player, true); + } else if (QuicklyItems.TOOL_QUICKIEPOWDERPICKAXE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (QuicklyItems.TOOL_QUICKIEPOWDERSHOVEL.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else if (QuicklyItems.TOOL_QUICKIEPOWDERHOE.getName().equals(toolItem.getName())) { + return breakBlockRecursive(visitedBlocks, level, validBlocks, pos, tool, range, BlockBreakDirection.ALL, + player, false); + } else { + return 0; + } + } else { + Quickly.LOGGER.warn("using a tool that is not an item - no rangeable operations are possible."); + return 0; + } + } + + /** + * break block recursively; + * + * @param visitedBlocks the positions of visited blocks + * @param level 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, Level level, List validBlocks, BlockPos pos, + ToolRangeable tool, HarvestRange range, BlockBreakDirection blockBreakDirection, Player 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 = level.getBlockState(pos); + if (tool.canBreakNeighbors(blockState)) { + Block currentBlock = blockState.getBlock(); + if (validBlocks.contains(currentBlock)) { +// if (!ignoreSpawn) { + Block.dropResources(blockState, level, pos); // includes xorbs +// } + affected += 1; + level.setBlockAndUpdate(pos, Blocks.AIR.defaultBlockState()); + if (range == null || range.getxRange() > 1 || range.getyRange() > 1 || range.getzRange() > 1) { + HarvestRange nextRadius = range == null ? null : range.addXYZ(-1); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.north().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.north().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.south().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.south().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().north().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().north().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().south().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().south().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.above().south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + + if (BlockBreakDirection.ALL.equals(blockBreakDirection)) { + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().north(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().south(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().east(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().west(), tool, nextRadius, + blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().north().east(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().north().west(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().south().east(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + affected += breakBlockRecursive(visitedBlocks, level, validBlocks, pos.below().south().west(), tool, + nextRadius, blockBreakDirection, player, breakLeaves); + } + } + } + } + return affected; + } +} diff --git a/src/main/java/de/jottyfan/minecraft/event/QuicklyEvents.java b/src/main/java/de/jottyfan/minecraft/event/QuicklyEvents.java new file mode 100644 index 0000000..db09e12 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/event/QuicklyEvents.java @@ -0,0 +1,20 @@ +package de.jottyfan.minecraft.event; + +import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; + +/** + * + * @author jotty + * + */ +public class QuicklyEvents { + public static final void registerBlockBreak() { + PlayerBlockBreakEvents.BEFORE.register((world, player, pos, state, blockEntity) -> { + if (new EventBlockBreak().doBreakBlock(world, pos, state, player, state.getBlock())) { + return false; + } else { + return true; + } + }); + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/HarvestRange.java b/src/main/java/de/jottyfan/minecraft/item/HarvestRange.java new file mode 100644 index 0000000..69468cc --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/HarvestRange.java @@ -0,0 +1,110 @@ +package de.jottyfan.minecraft.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/minecraft/item/QuicklyItems.java b/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java index e971191..b7e2650 100644 --- a/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java +++ b/src/main/java/de/jottyfan/minecraft/item/QuicklyItems.java @@ -48,7 +48,33 @@ public class QuicklyItems { public static final Item SULFOR = registerItem("sulfor"); public static final Item CARROTSTACK = registerItem("carrotstack"); - // TODO: tools + // TODO: normalize classes and try to summarize tools (such as ToolShovel for both speed and quickie) + // TODO: rename tools to speedaxe and quickaxe instead of the powder version + + public static final Item TOOL_SPEEDPOWDERAXE = registerItem("speedpowderaxe", + properties -> new ToolSpeedpowderAxe(properties)); + public static final Item TOOL_SPEEDPOWDERHOE = registerItem("speedpowderhoe", + properties -> new ToolSpeedpowderHoe(properties)); + public static final Item TOOL_SPEEDPOWDERPICKAXE = registerItem("speedpowderpickaxe", + properties -> new ToolSpeedpowderPickaxe(properties)); + public static final Item TOOL_SPEEDPOWDERSHEARS = registerItem("speedpowdershears", + properties -> new ToolSpeedpowderShears(properties)); + public static final Item TOOL_SPEEDPOWDERSHOVEL = registerItem("speedpowdershovel", + properties -> new ToolSpeedpowderShovel(properties)); + public static final Item TOOL_SPEEDPOWDERWATERHOE = registerItem("speedpowderwaterhoe", + properties -> new ToolSpeedpowderWaterHoe(properties, QuicklyItems.TOOL_SPEEDPOWDERHOE)); + public static final Item TOOL_QUICKIEPOWDERAXE = registerItem("quickiepowderaxe", + properties -> new ToolQuickiepowderAxe(properties)); + public static final Item TOOL_QUICKIEPOWDERHOE = registerItem("quickiepowderhoe", + properties -> new ToolQuickiepowderHoe(properties)); + public static final Item TOOL_QUICKIEPOWDERPICKAXE = registerItem("quickiepowderpickaxe", + properties -> new ToolQuickiepowderPickaxe(properties)); + public static final Item TOOL_QUICKIEPOWDERSHOVEL = registerItem("quickiepowdershovel", + properties -> new ToolQuickiepowderShovel(properties)); + public static final Item TOOL_QUICKIEPOWDERWATERHOE = registerItem("quickiepowderwaterhoe", + properties -> new ToolQuickiepowderWaterHoe(properties, QuicklyItems.TOOL_QUICKIEPOWDERHOE)); + public static final Item TOOL_QUICKIEPOWDERSHEARS = registerItem("quickiepowdershears", + properties -> new ToolSpeedpowderShears(properties)); public static final Item ARMOR_TURQUOISE_BOOTS = registerItem("turquoise_boots", ArmorType.BOOTS); public static final Item ARMOR_TURQUOISE_HELMET = registerItem("turquoise_helmet", ArmorType.HELMET); @@ -108,6 +134,18 @@ public class QuicklyItems { item.accept(ARMOR_TURQUOISE_CHESTPLATE); item.accept(ARMOR_TURQUOISE_LEGGINGS); item.accept(ARMOR_TURQUOISE_BOOTS); + item.accept(TOOL_QUICKIEPOWDERPICKAXE); + item.accept(TOOL_QUICKIEPOWDERAXE); + item.accept(TOOL_QUICKIEPOWDERSHOVEL); + item.accept(TOOL_QUICKIEPOWDERSHEARS); + item.accept(TOOL_QUICKIEPOWDERHOE); + item.accept(TOOL_QUICKIEPOWDERWATERHOE); + item.accept(TOOL_SPEEDPOWDERPICKAXE); + item.accept(TOOL_SPEEDPOWDERAXE); + item.accept(TOOL_SPEEDPOWDERSHOVEL); + item.accept(TOOL_SPEEDPOWDERSHEARS); + item.accept(TOOL_SPEEDPOWDERHOE); + item.accept(TOOL_SPEEDPOWDERWATERHOE); }); } } diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderAxe.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderAxe.java new file mode 100644 index 0000000..00a4463 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderAxe.java @@ -0,0 +1,26 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7F, -3.1F, properties); + } + + @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/minecraft/item/ToolQuickiepowderHoe.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderHoe.java new file mode 100644 index 0000000..09adf75 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderHoe.java @@ -0,0 +1,20 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.ToolMaterial; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7F, -3.1f, properties, new HarvestRange(DEFAULT_PLOW_RANGE)); + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderPickaxe.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderPickaxe.java new file mode 100644 index 0000000..da52ad4 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderPickaxe.java @@ -0,0 +1,55 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderPickaxe extends Item 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(Properties properties) { + super(properties.pickaxe(MATERIAL, 7F, -3.1F)); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + return new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack(this).isCorrectToolForDrops(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/minecraft/item/ToolQuickiepowderShears.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderShears.java new file mode 100644 index 0000000..085ac04 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderShears.java @@ -0,0 +1,100 @@ +package de.jottyfan.minecraft.item; + +import java.util.Random; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.chicken.Chicken; +import net.minecraft.world.entity.animal.cow.Cow; +import net.minecraft.world.entity.animal.equine.Horse; +import net.minecraft.world.entity.animal.sheep.Sheep; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.ShearsItem; +import net.minecraft.world.phys.Vec3; + + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderShears extends ShearsItem { + + public ToolQuickiepowderShears(Properties properties) { + super(properties.component(DataComponents.TOOL, ShearsItem.createToolProperties())); + } + + @Override + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, + InteractionHand hand) { + Vec3 pos = entity.position(); + Integer amount = 3 + new Random().nextInt(4); + if (entity instanceof Sheep sheep) { + if (!sheep.isSheared()) { + 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.level().addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(item, amount))); + return InteractionResult.SUCCESS; + } + } else if (entity instanceof Horse horse) { + horse.playAmbientSound(); + horse.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.LEATHER, amount))); + return InteractionResult.SUCCESS; + } else if (entity instanceof Cow cow) { + cow.playAmbientSound(); + cow.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.LEATHER, amount))); + return InteractionResult.SUCCESS; + } else if (entity instanceof Chicken chicken) { + chicken.playAmbientSound(); + chicken.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.FEATHER, amount))); + return InteractionResult.SUCCESS; + } + return InteractionResult.PASS; + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderShovel.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderShovel.java new file mode 100644 index 0000000..0df3be6 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderShovel.java @@ -0,0 +1,97 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ShovelItem; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7F, -3.1F, properties); + this.range = new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + private void createPathOnGrass(Level level, BlockPos pos, Direction side) { + BlockState blockState = level.getBlockState(pos); + if (blockState.isAir()) { + // try to find one underneath + pos = pos.below(); + blockState = level.getBlockState(pos); + } else if (!level.getBlockState(pos.above()).isAir()) { + pos = pos.above(); + blockState = level.getBlockState(pos); + } + if (side != Direction.DOWN) { + if (blockState != null && level.getBlockState(pos.above()).isAir()) { + if (!level.isClientSide()) { + level.setBlock(pos, blockState, 11); + } + } + } + } + + @Override + public InteractionResult useOn(UseOnContext context) { + Level level = context.getLevel(); + BlockPos pos = context.getClickedPos(); + 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(level, p, context.getClickedFace()); + } + return super.useOn(context); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isCorrectToolForDrops(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/minecraft/item/ToolQuickiepowderWaterHoe.java b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderWaterHoe.java new file mode 100644 index 0000000..794279f --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolQuickiepowderWaterHoe.java @@ -0,0 +1,47 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public class ToolQuickiepowderWaterHoe extends ToolQuickiepowderHoe { + private Item fallbackHoe; + + public ToolQuickiepowderWaterHoe(Properties properties, Item fallbackHoe) { + super(properties); + this.fallbackHoe = fallbackHoe; + } + + @Override + public InteractionResult useOn(UseOnContext context) { + InteractionResult res = super.useOn(context); + if (!InteractionResult.PASS.equals(res)) { + BlockPos pos = context.getClickedPos(); + Level level = context.getLevel(); + BlockState oldBlockState = level.getBlockState(pos); + level.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState()); + InteractionHand hand = context.getHand(); + Player player = context.getPlayer(); + ItemStack oldTool = player.getItemInHand(hand); + ItemStack newTool = new ItemStack(fallbackHoe); + newTool.setDamageValue(oldTool.getDamageValue()); + level.addFreshEntity( + new ItemEntity(level, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock()))); + player.setItemInHand(hand, newTool); + } + return res; + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolRangeable.java b/src/main/java/de/jottyfan/minecraft/item/ToolRangeable.java new file mode 100644 index 0000000..57b48ed --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolRangeable.java @@ -0,0 +1,39 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + + +/** + * + * @author jotty + * + */ +public interface ToolRangeable { + + /** + * @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/minecraft/item/ToolRangeableAxe.java b/src/main/java/de/jottyfan/minecraft/item/ToolRangeableAxe.java new file mode 100644 index 0000000..353c748 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolRangeableAxe.java @@ -0,0 +1,63 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.tags.BlockTags; +import net.minecraft.world.item.AxeItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.level.ItemLike; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.LeavesBlock; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public abstract class ToolRangeableAxe extends AxeItem implements ToolRangeable { + + protected ToolRangeableAxe(ToolMaterial material, float attackDamage, float attackSpeed, Properties properties) { + super(material, attackDamage, attackSpeed, properties); + } + + @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.is(BlockTags.LEAVES); + return vanillaLeaves || terrestriaLeaves || blockTagLeaves; + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack((ItemLike) this).isCorrectToolForDrops(blockIn) || isLeavesBlock(blockIn) || blockIn.is(BlockTags.LOGS); + } + + @Override + public List getBlockList(Block block) { + return Lists.newArrayList(block); + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolRangeableHoe.java b/src/main/java/de/jottyfan/minecraft/item/ToolRangeableHoe.java new file mode 100644 index 0000000..24c33a5 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolRangeableHoe.java @@ -0,0 +1,96 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.HoeItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.CropBlock; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.BlockHitResult; + +/** + * + * @author jotty + * + */ +public abstract class ToolRangeableHoe extends HoeItem implements ToolRangeable { + + public HarvestRange range; + + public ToolRangeableHoe(ToolMaterial material, float attackDamage, float attackSpeed, Properties properties, HarvestRange range) { + super(material, attackDamage, attackSpeed, properties); + this.range = range; + } + + @Override + public InteractionResult useOn(UseOnContext context) { + InteractionResult res = super.useOn(context); + boolean isCrop = context.getLevel().getBlockState(context.getClickedPos()).getBlock() instanceof CropBlock; + if (!InteractionResult.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.getLevel(), new BlockPos(x, y, z)); + BlockHitResult bhr = new BlockHitResult(context.getClickedPos().getCenter(), Direction.UP, + context.getClickedPos().offset(x, y, z), false); + UseOnContext ctx = new UseOnContext(context.getPlayer(), context.getHand(), bhr); + super.useOn(ctx); + } else { + harvestIfPossible(context.getClickedPos().offset(x, y, z), context.getLevel()); + } + } + } + } + } + return res; + } + + private void removePossibleGrass(Level level, BlockPos pos) { + Block block = level.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) { + level.destroyBlock(pos, true); + } + } + + private void harvestIfPossible(BlockPos pos, Level level) { + BlockState blockState = level.getBlockState(pos); + Block block = blockState.getBlock(); + if (block instanceof CropBlock) { + CropBlock cBlock = (CropBlock) block; + if (cBlock.isMaxAge(blockState)) { + Block.dropResources(blockState, level, pos); + level.setBlockAndUpdate(pos, cBlock.defaultBlockState().setValue(CropBlock.AGE, 0)); + } + } + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isCorrectToolForDrops(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/minecraft/item/ToolSpeedpowderAxe.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderAxe.java new file mode 100644 index 0000000..d32db79 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderAxe.java @@ -0,0 +1,26 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7f, -3.1f, properties); + } + + @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/minecraft/item/ToolSpeedpowderHoe.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderHoe.java new file mode 100644 index 0000000..383443d --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderHoe.java @@ -0,0 +1,20 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.ToolMaterial; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7F, -3.1F, properties, new HarvestRange(DEFAULT_PLOW_RANGE)); + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderPickaxe.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderPickaxe.java new file mode 100644 index 0000000..8073ed5 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderPickaxe.java @@ -0,0 +1,55 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderPickaxe extends Item 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(Properties properties) { + super(properties.pickaxe(MATERIAL, 7F, -3.1F)); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + return new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + @Override + public boolean canBreakNeighbors(BlockState blockIn) { + return new ItemStack(this).isCorrectToolForDrops(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/minecraft/item/ToolSpeedpowderShears.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderShears.java new file mode 100644 index 0000000..2e002d9 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderShears.java @@ -0,0 +1,105 @@ +package de.jottyfan.minecraft.item; + +import java.util.Random; + +import net.minecraft.core.component.DataComponents; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.animal.chicken.Chicken; +import net.minecraft.world.entity.animal.cow.Cow; +import net.minecraft.world.entity.animal.equine.Horse; +import net.minecraft.world.entity.animal.sheep.Sheep; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.ShearsItem; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.phys.Vec3; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderShears extends ShearsItem { + + public ToolSpeedpowderShears(Properties properties) { + super(properties.component(DataComponents.TOOL, ShearsItem.createToolProperties())); + } + + @Override + public InteractionResult useOn(UseOnContext context) { + return super.useOn(context); + } + + @Override + public InteractionResult interactLivingEntity(ItemStack stack, Player user, LivingEntity entity, + InteractionHand hand) { + Vec3 pos = entity.position(); + Integer amount = 1 + new Random().nextInt(4); + if (entity instanceof Sheep sheep) { + if (!sheep.isSheared()) { + 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.level().addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(item, amount))); + return InteractionResult.SUCCESS; + } + } else if (entity instanceof Horse horse) { + horse.playAmbientSound(); + horse.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.LEATHER, amount))); + return InteractionResult.SUCCESS; + } else if (entity instanceof Cow cow) { + cow.playAmbientSound(); + cow.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.LEATHER, amount))); + return InteractionResult.SUCCESS; + } else if (entity instanceof Chicken chicken) { + chicken.playAmbientSound(); + chicken.setBaby(true); + user.level() + .addFreshEntity(new ItemEntity(user.level(), pos.x, pos.y, pos.z, new ItemStack(Items.FEATHER, amount))); + return InteractionResult.SUCCESS; + } + return InteractionResult.PASS; + } +} diff --git a/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderShovel.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderShovel.java new file mode 100644 index 0000000..ecb4868 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderShovel.java @@ -0,0 +1,96 @@ +package de.jottyfan.minecraft.item; + +import java.util.List; + +import com.google.common.collect.Lists; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.ShovelItem; +import net.minecraft.world.item.ToolMaterial; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @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(Properties properties) { + super(MATERIAL, 7F, -3.1F, properties); + this.range = new HarvestRange(DEFAULT_HARVEST_RANGE); + } + + private void createPathOnGrass(Level level, BlockPos pos, Direction side) { + BlockState blockState = level.getBlockState(pos); + if (blockState.isAir()) { + // try to find one underneath + pos = pos.below(); + blockState = level.getBlockState(pos); + } else if (!level.getBlockState(pos.above()).isAir()) { + pos = pos.above(); + blockState = level.getBlockState(pos); + } + if (side != Direction.DOWN) { + if (blockState != null && level.getBlockState(pos.above()).isAir()) { + if (!level.isClientSide()) { + level.setBlock(pos, blockState, 11); + } + } + } + } + + @Override + public InteractionResult useOn(UseOnContext context) { + Level level = context.getLevel(); + BlockPos pos = context.getClickedPos(); + createPathOnGrass(level, pos.north(), context.getClickedFace()); + createPathOnGrass(level, pos.north().east(), context.getClickedFace()); + createPathOnGrass(level, pos.north().west(), context.getClickedFace()); + createPathOnGrass(level, pos.east(), context.getClickedFace()); + createPathOnGrass(level, pos.west(), context.getClickedFace()); + createPathOnGrass(level, pos.south(), context.getClickedFace()); + createPathOnGrass(level, pos.south().east(), context.getClickedFace()); + createPathOnGrass(level, pos.south().west(), context.getClickedFace()); + return super.useOn(context); + } + + @Override + public HarvestRange getRange(ItemStack stack) { + // TODO: get range from stack + return range; + } + + @Override + public boolean canBreakNeighbors(BlockState blockState) { + return new ItemStack(this).isCorrectToolForDrops(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/minecraft/item/ToolSpeedpowderWaterHoe.java b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderWaterHoe.java new file mode 100644 index 0000000..17c0065 --- /dev/null +++ b/src/main/java/de/jottyfan/minecraft/item/ToolSpeedpowderWaterHoe.java @@ -0,0 +1,47 @@ +package de.jottyfan.minecraft.item; + +import net.minecraft.core.BlockPos; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.item.ItemEntity; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.state.BlockState; + +/** + * + * @author jotty + * + */ +public class ToolSpeedpowderWaterHoe extends ToolSpeedpowderHoe { + private Item fallbackHoe; + + public ToolSpeedpowderWaterHoe(Properties properties, Item fallbackHoe) { + super(properties); + this.fallbackHoe = fallbackHoe; + } + + @Override + public InteractionResult useOn(UseOnContext context) { + InteractionResult res = super.useOn(context); + if (!InteractionResult.PASS.equals(res)) { + BlockPos pos = context.getClickedPos(); + Level level = context.getLevel(); + BlockState oldBlockState = level.getBlockState(pos); + level.setBlockAndUpdate(pos, Blocks.WATER.defaultBlockState()); + InteractionHand hand = context.getHand(); + Player player = context.getPlayer(); + ItemStack oldTool = player.getItemInHand(hand); + ItemStack newTool = new ItemStack(fallbackHoe); + newTool.setDamageValue(oldTool.getDamageValue()); + level.addFreshEntity( + new ItemEntity(level, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(oldBlockState.getBlock()))); + player.setItemInHand(hand, newTool); + } + return res; + } +} diff --git a/src/main/resources/assets/quickly/items/quickiepowderaxe.json b/src/main/resources/assets/quickly/items/quickiepowderaxe.json new file mode 100644 index 0000000..106004d --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowderaxe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/quickiepowderhoe.json b/src/main/resources/assets/quickly/items/quickiepowderhoe.json new file mode 100644 index 0000000..be9c7fc --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowderhoe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/quickiepowderpickaxe.json b/src/main/resources/assets/quickly/items/quickiepowderpickaxe.json new file mode 100644 index 0000000..74bd4bc --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/quickiepowdershears.json b/src/main/resources/assets/quickly/items/quickiepowdershears.json new file mode 100644 index 0000000..51a2b9f --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowdershears.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/quickiepowdershovel.json b/src/main/resources/assets/quickly/items/quickiepowdershovel.json new file mode 100644 index 0000000..1bf2ab6 --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowdershovel.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/quickiepowderwaterhoe.json b/src/main/resources/assets/quickly/items/quickiepowderwaterhoe.json new file mode 100644 index 0000000..b56c3b9 --- /dev/null +++ b/src/main/resources/assets/quickly/items/quickiepowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/quickiepowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowderaxe.json b/src/main/resources/assets/quickly/items/speedpowderaxe.json new file mode 100644 index 0000000..b17572e --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowderaxe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowderhoe.json b/src/main/resources/assets/quickly/items/speedpowderhoe.json new file mode 100644 index 0000000..ff1de1c --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowderhoe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowderpickaxe.json b/src/main/resources/assets/quickly/items/speedpowderpickaxe.json new file mode 100644 index 0000000..6e8b992 --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowdershears.json b/src/main/resources/assets/quickly/items/speedpowdershears.json new file mode 100644 index 0000000..eecb506 --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowdershears.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowdershovel.json b/src/main/resources/assets/quickly/items/speedpowdershovel.json new file mode 100644 index 0000000..7898517 --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowdershovel.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/items/speedpowderwaterhoe.json b/src/main/resources/assets/quickly/items/speedpowderwaterhoe.json new file mode 100644 index 0000000..6d94c4b --- /dev/null +++ b/src/main/resources/assets/quickly/items/speedpowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "model": { + "type": "minecraft:model", + "model": "quickly:item/speedpowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/lang/de_de.json b/src/main/resources/assets/quickly/lang/de_de.json index b15d0b6..58467e4 100644 --- a/src/main/resources/assets/quickly/lang/de_de.json +++ b/src/main/resources/assets/quickly/lang/de_de.json @@ -1,4 +1,17 @@ { + "item.quickly.speedpowderaxe": "Fluchtpulveraxt", + "item.quickly.speedpowderpickaxe": "Fluchtpulverspitzhacke", + "item.quickly.speedpowdershovel": "Fluchtpulverschaufel", + "item.quickly.speedpowderhoe": "Fluchtpulverfeldhacke", + "item.quickly.speedpowderwaterhoe": "bewässerte Fluchtpulverfeldhacke", + "item.quickly.speedpowdershears": "Fluchtpulverschere", + "item.quickly.quickiepowderaxe": "Eilpulveraxt", + "item.quickly.quickiepowderpickaxe": "Eilpulverspitzhacke", + "item.quickly.quickiepowdershovel": "Eilpulverschaufel", + "item.quickly.quickiepowderhoe": "Eilpulverfeldhacke", + "item.quickly.quickiepowderwaterhoe": "bewässerte Eilpulverfeldhacke", + "item.quickly.quickiepowdershears": "Eilpulverschere", + "info.block.drillfuel": "Ladung: %s Bohrungen", "info.block.itemhoarder": "enthält: %s", "info.block.monsterhoarder": "Radius: %s, Brenndauer: %s Ticks", diff --git a/src/main/resources/assets/quickly/lang/en_us.json b/src/main/resources/assets/quickly/lang/en_us.json index fe3bbdf..fcb62bb 100644 --- a/src/main/resources/assets/quickly/lang/en_us.json +++ b/src/main/resources/assets/quickly/lang/en_us.json @@ -1,4 +1,17 @@ { + "item.quickly.speedpowderaxe": "speedpowder axe", + "item.quickly.speedpowderpickaxe": "speedpowder pickaxe", + "item.quickly.speedpowdershovel": "speedpowder shovel", + "item.quickly.speedpowderhoe": "speedpowder hoe", + "item.quickly.speedpowderwaterhoe": "watered speedpowder hoe", + "item.quickly.speedpowdershears": "speedpowder shears", + "item.quickly.quickiepowderaxe": "hurrypowder axe", + "item.quickly.quickiepowderpickaxe": "hurrypowder pickaxe", + "item.quickly.quickiepowdershovel": "hurrypowder shovel", + "item.quickly.quickiepowderhoe": "hurrypowder hoe", + "item.quickly.quickiepowderwaterhoe": "watered hurrypowder hoe", + "item.quickly.quickiepowdershears": "hurrypowder shears", + "info.block.drillfuel": "Load: %s drills", "info.block.itemhoarder": "contains: %s", "info.block.monsterhoarder": "radius: %s, burn ticks: %s", diff --git a/src/main/resources/assets/quickly/models/item/quickiepowderaxe.json b/src/main/resources/assets/quickly/models/item/quickiepowderaxe.json new file mode 100644 index 0000000..ce29cb7 --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowderaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "quickly:item/quickiepowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/quickiepowderhoe.json b/src/main/resources/assets/quickly/models/item/quickiepowderhoe.json new file mode 100644 index 0000000..41c8884 --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowderhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/quickiepowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/quickiepowderpickaxe.json b/src/main/resources/assets/quickly/models/item/quickiepowderpickaxe.json new file mode 100644 index 0000000..0aa1f69 --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/quickiepowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/quickiepowdershears.json b/src/main/resources/assets/quickly/models/item/quickiepowdershears.json new file mode 100644 index 0000000..9259e8f --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowdershears.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/quickiepowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/quickiepowdershovel.json b/src/main/resources/assets/quickly/models/item/quickiepowdershovel.json new file mode 100644 index 0000000..7a5e5d5 --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowdershovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/quickiepowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/quickiepowderwaterhoe.json b/src/main/resources/assets/quickly/models/item/quickiepowderwaterhoe.json new file mode 100644 index 0000000..baf865e --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/quickiepowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/quickiepowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowderaxe.json b/src/main/resources/assets/quickly/models/item/speedpowderaxe.json new file mode 100644 index 0000000..f36839f --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowderaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowderaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowderhoe.json b/src/main/resources/assets/quickly/models/item/speedpowderhoe.json new file mode 100644 index 0000000..af2019d --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowderhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowderhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowderpickaxe.json b/src/main/resources/assets/quickly/models/item/speedpowderpickaxe.json new file mode 100644 index 0000000..34015fd --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowderpickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowderpickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowdershears.json b/src/main/resources/assets/quickly/models/item/speedpowdershears.json new file mode 100644 index 0000000..28126cb --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowdershears.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowdershovel.json b/src/main/resources/assets/quickly/models/item/speedpowdershovel.json new file mode 100644 index 0000000..e76e6de --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowdershovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowdershovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/models/item/speedpowderwaterhoe.json b/src/main/resources/assets/quickly/models/item/speedpowderwaterhoe.json new file mode 100644 index 0000000..f10b42e --- /dev/null +++ b/src/main/resources/assets/quickly/models/item/speedpowderwaterhoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "quickly:item/speedpowderwaterhoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowderaxe.png b/src/main/resources/assets/quickly/textures/item/quickiepowderaxe.png new file mode 100644 index 0000000..0aa56aa Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowderaxe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowderhoe.png b/src/main/resources/assets/quickly/textures/item/quickiepowderhoe.png new file mode 100644 index 0000000..f8f9f0b Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowderhoe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowderpickaxe.png b/src/main/resources/assets/quickly/textures/item/quickiepowderpickaxe.png new file mode 100644 index 0000000..3b8146b Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowderpickaxe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowdershears.png b/src/main/resources/assets/quickly/textures/item/quickiepowdershears.png new file mode 100644 index 0000000..cf0a275 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowdershears.png differ diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowdershovel.png b/src/main/resources/assets/quickly/textures/item/quickiepowdershovel.png new file mode 100644 index 0000000..56d2b5d Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowdershovel.png differ diff --git a/src/main/resources/assets/quickly/textures/item/quickiepowderwaterhoe.png b/src/main/resources/assets/quickly/textures/item/quickiepowderwaterhoe.png new file mode 100644 index 0000000..52cc760 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/quickiepowderwaterhoe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowderaxe.png b/src/main/resources/assets/quickly/textures/item/speedpowderaxe.png new file mode 100644 index 0000000..c933955 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowderaxe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowderhoe.png b/src/main/resources/assets/quickly/textures/item/speedpowderhoe.png new file mode 100644 index 0000000..87e0627 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowderhoe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowderpickaxe.png b/src/main/resources/assets/quickly/textures/item/speedpowderpickaxe.png new file mode 100644 index 0000000..6a7a71d Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowderpickaxe.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowdershears.png b/src/main/resources/assets/quickly/textures/item/speedpowdershears.png new file mode 100644 index 0000000..11ecda3 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowdershears.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowdershovel.png b/src/main/resources/assets/quickly/textures/item/speedpowdershovel.png new file mode 100644 index 0000000..b1a4458 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowdershovel.png differ diff --git a/src/main/resources/assets/quickly/textures/item/speedpowderwaterhoe.png b/src/main/resources/assets/quickly/textures/item/speedpowderwaterhoe.png new file mode 100644 index 0000000..0966368 Binary files /dev/null and b/src/main/resources/assets/quickly/textures/item/speedpowderwaterhoe.png differ 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..7d50f47 --- /dev/null +++ b/src/main/resources/data/c/tags/item/axes.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickly:speedpowderaxe", + "quickly: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..fceeb36 --- /dev/null +++ b/src/main/resources/data/c/tags/item/hoes.json @@ -0,0 +1,9 @@ +{ + "replace": false, + "values": [ + "quickly:speedpowderhoe", + "quickly:speedpowderwaterhoe", + "quickly:quickiepowderhoe", + "quickly: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..6ea10ae --- /dev/null +++ b/src/main/resources/data/c/tags/item/pickaxes.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickly:speedpowderpickaxe", + "quickly: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..a44f2e5 --- /dev/null +++ b/src/main/resources/data/c/tags/item/shovels.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "quickly:speedpowdershovel", + "quickly:quickiepowdershovel" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_quickiepowder_shears.json b/src/main/resources/data/quickly/recipe/shaped_quickiepowder_shears.json new file mode 100644 index 0000000..2bdc844 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_quickiepowder_shears.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + " #", + "# " + ], + "key": { + "#": "quickly:quickieingot" + }, + "result": { + "id": "quickly:quickiepowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_quickiepowderaxe.json b/src/main/resources/data/quickly/recipe/shaped_quickiepowderaxe.json new file mode 100644 index 0000000..770ebf6 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_quickiepowderaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + "s|", + " |" + ], + "key": { + "s": "quickly:quickieingot", + "|": "quickly:copperstick" + }, + "result": { + "id": "quickly:quickiepowderaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_quickiepowderhoe.json b/src/main/resources/data/quickly/recipe/shaped_quickiepowderhoe.json new file mode 100644 index 0000000..20cad3a --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_quickiepowderhoe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + " |", + " |" + ], + "key": { + "s": "quickly:quickieingot", + "|": "quickly:copperstick" + }, + "result": { + "id": "quickly:quickiepowderhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_quickiepowderpickaxe.json b/src/main/resources/data/quickly/recipe/shaped_quickiepowderpickaxe.json new file mode 100644 index 0000000..1483c1f --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_quickiepowderpickaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "sss", + " | ", + " | " + ], + "key": { + "s": "quickly:quickieingot", + "|": "quickly:copperstick" + }, + "result": { + "id": "quickly:quickiepowderpickaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_quickiepowdershovel.json b/src/main/resources/data/quickly/recipe/shaped_quickiepowdershovel.json new file mode 100644 index 0000000..831bba9 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_quickiepowdershovel.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "s", + "|", + "|" + ], + "key": { + "s": "quickly:quickieingot", + "|": "quickly:copperstick" + }, + "result": { + "id": "quickly:quickiepowdershovel", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_speedpowder_shears.json b/src/main/resources/data/quickly/recipe/shaped_speedpowder_shears.json new file mode 100644 index 0000000..2e20382 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_speedpowder_shears.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + " #", + "# " + ], + "key": { + "#": "quickly:speedingot" + }, + "result": { + "id": "quickly:speedpowdershears" + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_speedpowderaxe.json b/src/main/resources/data/quickly/recipe/shaped_speedpowderaxe.json new file mode 100644 index 0000000..ea47473 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_speedpowderaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + "s|", + " |" + ], + "key": { + "s": "quickly:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickly:speedpowderaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_speedpowderhoe.json b/src/main/resources/data/quickly/recipe/shaped_speedpowderhoe.json new file mode 100644 index 0000000..c3421e7 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_speedpowderhoe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "ss", + " |", + " |" + ], + "key": { + "s": "quickly:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickly:speedpowderhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_speedpowderpickaxe.json b/src/main/resources/data/quickly/recipe/shaped_speedpowderpickaxe.json new file mode 100644 index 0000000..441abbe --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_speedpowderpickaxe.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "sss", + " | ", + " | " + ], + "key": { + "s": "quickly:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickly:speedpowderpickaxe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shaped_speedpowdershovel.json b/src/main/resources/data/quickly/recipe/shaped_speedpowdershovel.json new file mode 100644 index 0000000..fae8c14 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shaped_speedpowdershovel.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "tools", + "pattern": [ + "s", + "|", + "|" + ], + "key": { + "s": "quickly:speedingot", + "|": "minecraft:stick" + }, + "result": { + "id": "quickly:speedpowdershovel", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shapeless_quickiepowderwaterhoe.json b/src/main/resources/data/quickly/recipe/shapeless_quickiepowderwaterhoe.json new file mode 100644 index 0000000..e31c9b1 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shapeless_quickiepowderwaterhoe.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + "minecraft:water_bucket", + "quickly:quickiepowderhoe" + ], + "result": { + "id": "quickly:quickiepowderwaterhoe", + "count": 1 + } +} \ No newline at end of file diff --git a/src/main/resources/data/quickly/recipe/shapeless_speedpowderwaterhoe.json b/src/main/resources/data/quickly/recipe/shapeless_speedpowderwaterhoe.json new file mode 100644 index 0000000..e1602e7 --- /dev/null +++ b/src/main/resources/data/quickly/recipe/shapeless_speedpowderwaterhoe.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + "minecraft:water_bucket", + "quickly:speedpowderhoe" + ], + "result": { + "id": "quickly:speedpowderwaterhoe", + "count": 1 + } +} \ No newline at end of file