added tools
This commit is contained in:
		| @@ -7,9 +7,11 @@ import org.slf4j.LoggerFactory; | |||||||
|  |  | ||||||
| import de.jottyfan.quickiemod.block.ModBlocks; | import de.jottyfan.quickiemod.block.ModBlocks; | ||||||
| import de.jottyfan.quickiemod.blockentity.ModBlockentity; | import de.jottyfan.quickiemod.blockentity.ModBlockentity; | ||||||
|  | import de.jottyfan.quickiemod.event.EventBlockBreak; | ||||||
| import de.jottyfan.quickiemod.item.ModItems; | import de.jottyfan.quickiemod.item.ModItems; | ||||||
| import de.jottyfan.quickiemod.itemgroup.ModItemGroup; | import de.jottyfan.quickiemod.itemgroup.ModItemGroup; | ||||||
| import net.fabricmc.api.ModInitializer; | import net.fabricmc.api.ModInitializer; | ||||||
|  | import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; | ||||||
| import net.minecraft.block.Block; | import net.minecraft.block.Block; | ||||||
| import net.minecraft.item.Item; | import net.minecraft.item.Item; | ||||||
|  |  | ||||||
| @@ -24,9 +26,14 @@ public class Quickiemod implements ModInitializer { | |||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
| 	public void onInitialize() { | 	public void onInitialize() { | ||||||
|  | 		ModBlockentity.registerModBlockentities(); | ||||||
| 		List<Item> items = ModItems.registerModItems(); | 		List<Item> items = ModItems.registerModItems(); | ||||||
| 		List<Block> blocks = ModBlocks.registerModBlocks(); | 		List<Block> blocks = ModBlocks.registerModBlocks(); | ||||||
| 		ModBlockentity.registerModBlockentities(); |  | ||||||
| 		ModItemGroup.registerItemGroup(items, blocks); | 		ModItemGroup.registerItemGroup(items, blocks); | ||||||
|  |  | ||||||
|  | 		PlayerBlockBreakEvents.AFTER.register((world, player, pos, state, blockEntity) -> { | ||||||
|  | 			Block oldBlock = state.getBlock(); | ||||||
|  | 			new EventBlockBreak().doBreakBlock(world, pos, state, player, oldBlock); | ||||||
|  | 		}); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| @@ -5,7 +5,7 @@ import java.util.ArrayList; | |||||||
| import java.util.Date; | import java.util.Date; | ||||||
| import java.util.List; | 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.AbstractBlock; | ||||||
| import net.minecraft.block.Block; | import net.minecraft.block.Block; | ||||||
| import net.minecraft.block.BlockEntityProvider; | import net.minecraft.block.BlockEntityProvider; | ||||||
| @@ -42,7 +42,7 @@ public class BlockItemhoarder extends Block implements BlockEntityProvider { | |||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
| 	public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) { | 	public BlockEntity createBlockEntity(BlockPos pos, BlockState blockState) { | ||||||
| 		return ModBlockentity.ITEM_HOARDER_BLOCKENTITY.instantiate(pos, blockState); | 		return new ItemHoarderBlockEntity(pos, blockState); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	@Override | 	@Override | ||||||
|   | |||||||
| @@ -1,9 +1,8 @@ | |||||||
| package de.jottyfan.quickiemod.block; | package de.jottyfan.quickiemod.blockentity; | ||||||
| 
 | 
 | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| 
 | 
 | ||||||
| import de.jottyfan.quickiemod.blockentity.ModBlockentity; |  | ||||||
| import net.minecraft.block.BlockState; | import net.minecraft.block.BlockState; | ||||||
| import net.minecraft.block.entity.BlockEntity; | import net.minecraft.block.entity.BlockEntity; | ||||||
| import net.minecraft.block.entity.LootableContainerBlockEntity; | import net.minecraft.block.entity.LootableContainerBlockEntity; | ||||||
| @@ -1,13 +1,11 @@ | |||||||
| package de.jottyfan.quickiemod.blockentity; | 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.block.ModBlocks; | ||||||
|  | import de.jottyfan.quickiemod.identifier.ModIdentifiers; | ||||||
| import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; | import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder; | ||||||
| import net.minecraft.block.entity.BlockEntityType; | import net.minecraft.block.entity.BlockEntityType; | ||||||
| import net.minecraft.registry.Registries; | import net.minecraft.registry.Registries; | ||||||
| import net.minecraft.registry.Registry; | import net.minecraft.registry.Registry; | ||||||
| import net.minecraft.util.Identifier; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * |  * | ||||||
| @@ -16,7 +14,7 @@ import net.minecraft.util.Identifier; | |||||||
|  */ |  */ | ||||||
| public class ModBlockentity { | public class ModBlockentity { | ||||||
| 	public static final BlockEntityType<ItemHoarderBlockEntity> ITEM_HOARDER_BLOCKENTITY = Registry.register( | 	public static final BlockEntityType<ItemHoarderBlockEntity> 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()); | 			FabricBlockEntityTypeBuilder.create(ItemHoarderBlockEntity::new, ModBlocks.BLOCK_ITEMHOARDER).build()); | ||||||
|  |  | ||||||
| 	public static final void registerModBlockentities() { | 	public static final void registerModBlockentities() { | ||||||
|   | |||||||
							
								
								
									
										192
									
								
								src/main/java/de/jottyfan/quickiemod/event/EventBlockBreak.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										192
									
								
								src/main/java/de/jottyfan/quickiemod/event/EventBlockBreak.java
									
									
									
									
									
										Normal file
									
								
							| @@ -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<Block> validBlocks = tool.getBlockList(currentBlock); | ||||||
|  | 		HarvestRange range = tool.getRange(itemStack); | ||||||
|  | 		List<String> 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<String> visitedBlocks, World world, List<Block> 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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -20,12 +20,27 @@ public class ModIdentifiers { | |||||||
| 	public static final Identifier ITEM_CARROTSTACK = Identifier.of(Quickiemod.MOD_ID, "carrotstack"); | 	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 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_QUICKIEPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockquickiepowder"); | ||||||
| 	public static final Identifier BLOCK_SPEEDPOWDER = Identifier.of(Quickiemod.MOD_ID, "blockspeedpowder"); | 	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_SALPETER = Identifier.of(Quickiemod.MOD_ID, "blocksalpeter"); | ||||||
| 	public static final Identifier BLOCK_SULFOR = Identifier.of(Quickiemod.MOD_ID, "blocksulphor"); | 	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_MONSTERHOARDER = Identifier.of(Quickiemod.MOD_ID, "monsterhoarder"); | ||||||
| 	public static final Identifier BLOCK_LAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "lavahoarder");; | 	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_EMPTYLAVAHOARDER = Identifier.of(Quickiemod.MOD_ID, "emptylavahoarder"); | ||||||
| 	public static final Identifier BLOCK_ITEMHOARDER = Identifier.of(Quickiemod.MOD_ID, "itemhoarder");; | 	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"); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										110
									
								
								src/main/java/de/jottyfan/quickiemod/item/HarvestRange.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								src/main/java/de/jottyfan/quickiemod/item/HarvestRange.java
									
									
									
									
									
										Normal file
									
								
							| @@ -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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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_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 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) { | 	private static final Item registerItem(Identifier identifier, Item item) { | ||||||
| 		return Registry.register(Registries.ITEM, identifier, item); | 		return Registry.register(Registries.ITEM, identifier, item); | ||||||
| 	} | 	} | ||||||
| @@ -45,6 +57,18 @@ public class ModItems { | |||||||
| 		items.add(ITEM_QUICKIEINGOT); | 		items.add(ITEM_QUICKIEINGOT); | ||||||
| 		items.add(ITEM_CARROTSTACK); | 		items.add(ITEM_CARROTSTACK); | ||||||
| 		items.add(ITEM_ROTTENFLESHSTRIPES); | 		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; | 		return items; | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -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... | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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)); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | //	@Override | ||||||
|  | //	public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { | ||||||
|  | //		CommonToolCode.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //		return super.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //	} | ||||||
|  | // | ||||||
|  | //	@Override | ||||||
|  | //	public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { | ||||||
|  | //		CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //		super.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //	} | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | //	@Override | ||||||
|  | //	public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { | ||||||
|  | //		CommonToolCode.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //		return super.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //	} | ||||||
|  | // | ||||||
|  | //	@Override | ||||||
|  | //	public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { | ||||||
|  | //		CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //		super.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //	} | ||||||
|  | } | ||||||
| @@ -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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
							
								
								
									
										46
									
								
								src/main/java/de/jottyfan/quickiemod/item/ToolRangeable.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								src/main/java/de/jottyfan/quickiemod/item/ToolRangeable.java
									
									
									
									
									
										Normal file
									
								
							| @@ -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<Block> getBlockList(Block block); | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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)); | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | //	@Override | ||||||
|  | //	public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { | ||||||
|  | //		CommonToolCode.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //		return super.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //	} | ||||||
|  | // | ||||||
|  | //	@Override | ||||||
|  | //	public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { | ||||||
|  | //		CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //		super.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //	} | ||||||
|  | } | ||||||
| @@ -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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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<Block> getBlockList(Block block) { | ||||||
|  | 		return Lists.newArrayList(block); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | //	@Override | ||||||
|  | //	public ActionResult<ItemStack> onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { | ||||||
|  | //		CommonToolCode.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //		return super.onItemRightClick(worldIn, playerIn, handIn); | ||||||
|  | //	} | ||||||
|  | // | ||||||
|  | //	@Override | ||||||
|  | //	public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) { | ||||||
|  | //		CommonToolCode.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //		super.addInformation(stack, worldIn, tooltip, flagIn); | ||||||
|  | //	} | ||||||
|  | } | ||||||
| @@ -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; | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -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 |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
							
								
								
									
										28
									
								
								src/main/java/de/jottyfan/quickiemod/util/ModTags.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								src/main/java/de/jottyfan/quickiemod/util/ModTags.java
									
									
									
									
									
										Normal file
									
								
							| @@ -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<Block> SPEEDPOWDER_TOOL = createTag("speedpowder_tool"); | ||||||
|  | 		public static final TagKey<Block> QUICKIEPOWDER_TOOL = createTag("quickiepowder_tool"); | ||||||
|  |  | ||||||
|  | 		private static final TagKey<Block> createTag(String name) { | ||||||
|  | 			return TagKey.of(RegistryKeys.BLOCK, Identifier.of(Quickiemod.MOD_ID, name)); | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	public static final class Items { | ||||||
|  |  | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "minecraft:item/handheld", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/quickiepowderaxe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/quickiepowderhoe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/quickiepowderpickaxe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/quickiepowdershovel" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/quickiepowderwaterhoe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/speedpowderaxe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/speedpowderhoe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/speedpowderpickaxe" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |   "parent": "item/generated", | ||||||
|  |   "textures": { | ||||||
|  |     "layer0": "quickiemod:item/speedpowdershears" | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/speedpowdershovel" | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | { | ||||||
|  |     "parent": "item/generated", | ||||||
|  |     "textures": { | ||||||
|  |         "layer0": "quickiemod:item/speedpowderwaterhoe" | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								src/main/resources/data/c/tags/item/axes.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/main/resources/data/c/tags/item/axes.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "replace": false, | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowderaxe", | ||||||
|  |     "quickiemod:quickiepowderaxe" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										9
									
								
								src/main/resources/data/c/tags/item/hoes.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/main/resources/data/c/tags/item/hoes.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | { | ||||||
|  |   "replace": false, | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowderhoe", | ||||||
|  |     "quickiemod:speedpowderwaterhoe", | ||||||
|  |     "quickiemod:quickiepowderhoe", | ||||||
|  |     "quickiemod:quickiepowderwaterhoe" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								src/main/resources/data/c/tags/item/pickaxes.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/main/resources/data/c/tags/item/pickaxes.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "replace": false, | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowderpickaxe", | ||||||
|  |     "quickiemod:quickiepowderpickaxe" | ||||||
|  |   ] | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								src/main/resources/data/c/tags/item/shovels.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								src/main/resources/data/c/tags/item/shovels.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "replace": false, | ||||||
|  |   "values": [ | ||||||
|  |     "quickiemod:speedpowdershovel", | ||||||
|  |     "quickiemod:quickiepowdershovel" | ||||||
|  |   ] | ||||||
|  | } | ||||||
| @@ -2,12 +2,12 @@ | |||||||
| 	"type": "minecraft:crafting_shaped", | 	"type": "minecraft:crafting_shaped", | ||||||
| 	"pattern": [ | 	"pattern": [ | ||||||
| 		"ooo", | 		"ooo", | ||||||
| 		"oso", | 		"obo", | ||||||
| 		"ooo" | 		"ooo" | ||||||
| 	], | 	], | ||||||
| 	"key": { | 	"key": { | ||||||
| 		"o": "quickiemod:speedingot", | 		"o": "quickiemod:speedingot", | ||||||
| 		"s": "minecraft:barrel" | 		"b": "minecraft:barrel" | ||||||
| 	}, | 	}, | ||||||
| 	"result": { | 	"result": { | ||||||
| 		"id": "quickiemod:itemhoarder", | 		"id": "quickiemod:itemhoarder", | ||||||
|   | |||||||
| @@ -2,12 +2,12 @@ | |||||||
| 	"type": "minecraft:crafting_shaped", | 	"type": "minecraft:crafting_shaped", | ||||||
| 	"pattern": [ | 	"pattern": [ | ||||||
| 		"ooo", | 		"ooo", | ||||||
| 		"oso", | 		"oco", | ||||||
| 		"ooo" | 		"ooo" | ||||||
| 	], | 	], | ||||||
| 	"key": { | 	"key": { | ||||||
| 		"o": "quickiemod:speedingot", | 		"o": "quickiemod:speedingot", | ||||||
| 		"s": "c:chests" | 		"c": "minecraft:chest" | ||||||
| 	}, | 	}, | ||||||
| 	"result": { | 	"result": { | ||||||
| 		"id": "quickiemod:itemhoarder", | 		"id": "quickiemod:itemhoarder", | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"ss", | ||||||
|  | 		" |", | ||||||
|  | 		" |" | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:quickieingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:quickiepowderhoe", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"sss", | ||||||
|  | 		" | ", | ||||||
|  | 		" | " | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:quickieingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:quickiepowderpickaxe", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"s", | ||||||
|  | 		"|", | ||||||
|  | 		"|" | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:quickieingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:quickiepowdershovel", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | { | ||||||
|  |   "type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  |   "pattern": [ | ||||||
|  |     " #", | ||||||
|  |     "# " | ||||||
|  |   ], | ||||||
|  |   "key": { | ||||||
|  |     "#": "quickiemod:speedingot" | ||||||
|  |   }, | ||||||
|  |   "result": { | ||||||
|  |     "id": "quickiemod:speedpowdershears" | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -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 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"ss", | ||||||
|  | 		" |", | ||||||
|  | 		" |" | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:speedingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:speedpowderhoe", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"sss", | ||||||
|  | 		" | ", | ||||||
|  | 		" | " | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:speedingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:speedpowderpickaxe", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,17 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shaped", | ||||||
|  |   "category": "tools", | ||||||
|  | 	"pattern": [ | ||||||
|  | 		"s", | ||||||
|  | 		"|", | ||||||
|  | 		"|" | ||||||
|  | 	], | ||||||
|  | 	"key": { | ||||||
|  | 		"s": "quickiemod:speedingot", | ||||||
|  | 		"|": "minecraft:stick" | ||||||
|  | 	}, | ||||||
|  | 	"result": { | ||||||
|  | 		"id": "quickiemod:speedpowdershovel", | ||||||
|  | 		"count": 1 | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shapeless", | ||||||
|  |   "ingredients": [ | ||||||
|  |     "minecraft:water_bucket", | ||||||
|  |     "quickiemod:quickiepowderhoe" | ||||||
|  |   ], | ||||||
|  |   "result": { | ||||||
|  |     "id": "quickiemod:quickiepowderwaterhoe", | ||||||
|  |     "count": 1 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -0,0 +1,11 @@ | |||||||
|  | { | ||||||
|  | 	"type": "minecraft:crafting_shapeless", | ||||||
|  |   "ingredients": [ | ||||||
|  |     "minecraft:water_bucket", | ||||||
|  |     "quickiemod:speedpowderhoe" | ||||||
|  |   ], | ||||||
|  |   "result": { | ||||||
|  |     "id": "quickiemod:speedpowderwaterhoe", | ||||||
|  |     "count": 1 | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -26,7 +26,6 @@ | |||||||
| 		] | 		] | ||||||
| 	}, | 	}, | ||||||
| 	"mixins": [ | 	"mixins": [ | ||||||
| 		"quickiemod.mixins.json" |  | ||||||
| 	], | 	], | ||||||
| 	"depends": { | 	"depends": { | ||||||
| 		"fabricloader": ">=0.16.9", | 		"fabricloader": ">=0.16.9", | ||||||
|   | |||||||
| @@ -1,11 +0,0 @@ | |||||||
| { |  | ||||||
| 	"required": true, |  | ||||||
| 	"package": "de.jottyfan.quickiemod.mixin", |  | ||||||
| 	"compatibilityLevel": "JAVA_21", |  | ||||||
| 	"mixins": [ |  | ||||||
| 		"ExampleMixin" |  | ||||||
| 	], |  | ||||||
| 	"injectors": { |  | ||||||
| 		"defaultRequire": 1 |  | ||||||
| 	} |  | ||||||
| } |  | ||||||
		Reference in New Issue
	
	Block a user