Posted September 27, 20196 yr I am trying to make termite nests and when the nests are a certain age you can click them with a hoe to get termites. so I tried doing this: Spoiler 0 Advanced issues found ▲ Spoiler public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { ItemStack itemstack = player.getHeldItem(handIn); if (itemstack.isEmpty()) { return true; } else { int i = state.get(AGE); Item item = itemstack.getItem(); if (item == Items.WOODEN_HOE || item == Items.STONE_HOE || item == Items.IRON_HOE || item == Items.GOLDEN_HOE || item == Items.DIAMOND_HOE) { if (i > 0 && !worldIn.isRemote) { if (!player.abilities.isCreativeMode) { itemstack.shrink(1); if (itemstack.isEmpty()) { player.setHeldItem(handIn, new ItemStack(ModItems.TERMITE)); } else if (!player.inventory.addItemStackToInventory(new ItemStack(ModItems.TERMITE))) { player.dropItem(new ItemStack(ModItems.TERMITE), false); } } this.setAgeLevel(worldIn, pos, state, 0); worldIn.playSound((PlayerEntity)null, pos, SoundEvents.ITEM_AXE_STRIP, SoundCategory.BLOCKS, 1.0F, 1.0F); } return true; } else { return false; } } } but that didn't seem to work. as you can see I am getting the termites from a ModItems class that looks like this Spoiler 0 Advanced issues found ▲ Spoiler @ObjectHolder("extrablocks:termite") public static Termite TERMITE; witch is from the Termite class: Spoiler 0 Advanced issues found ▲ Spoiler import net.minecraft.item.Item; public class Termite extends Item { public Termite() { super(new Properties() .group(ExtraBlocks.setup.itemGroup2) .maxStackSize(16) ); setRegistryName("termite"); } } and then I create the item in my Main Mod Class here: Spoiler 0 Advanced issues found ▲ Spoiler event.getRegistry().register(new Termite()); but the block never drops the item. Edited September 27, 20196 yr by MrNoodles75
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.