Jump to content

WaffleKing26

Members
  • Posts

    13
  • Joined

  • Last visited

WaffleKing26's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. ok will do once i get the chance a little busy atm but ill get back once i do
  2. still unsolved! Someone, please help.
  3. here is item java file and where I register the item. package com.posidon.startertech.items; import net.minecraft.world.World; import net.minecraftforge.fluids.Fluid; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumActionResult; import net.minecraft.item.ItemStack; import net.minecraft.item.Item; import net.minecraft.init.Blocks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.block.state.IBlockState; import com.posidon.startertech.init.ModItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class WoodBucketEmpty extends ItemBase { public WoodBucketEmpty(String name) { super(name); setMaxDamage(1); maxStackSize = 16; } @Override public float getDestroySpeed(ItemStack par1ItemStack, IBlockState par2Block) { return 0.5F; } @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ){ BlockPos hitLocation = new BlockPos(hitX, hitY, hitZ); if (worldIn.getBlockState(new BlockPos(hitLocation)).getBlock() == Blocks.WATER) { worldIn.setBlockToAir(new BlockPos(hitLocation)); player.inventory.deleteStack(player.inventory.getCurrentItem()); player.inventory.add(player.inventory.currentItem, new ItemStack(ModItems.WOOD_BUCKET_FULL_ITEM)); } return EnumActionResult.PASS; } } package com.posidon.startertech.util.handlers; import com.posidon.startertech.init.ModBlocks; import com.posidon.startertech.init.ModItems; import com.posidon.startertech.util.IHasModel; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @EventBusSubscriber public class RegistryHandler { @SubscribeEvent public static void onItemRegister(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0])); } @SubscribeEvent public static void onBlockRegister(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0])); } @SubscribeEvent public static void onModelRegister(ModelRegistryEvent event) { for (Item item : ModItems.ITEMS) { if (item instanceof IHasModel) { ((IHasModel)item).registerModels(); } } for (Block block : ModBlocks.BLOCKS) { if (block instanceof IHasModel) { ((IHasModel)block).registerModels(); } } } } package com.posidon.startertech.items; import com.posidon.startertech.Main; import com.posidon.startertech.init.ModItems; import com.posidon.startertech.util.IHasModel; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemBase extends Item implements IHasModel { public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MATERIALS); ModItems.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } }
  4. I'm starting to think that it was just the way I called the java file wrong cause i changed all the things you said to didnt work so i changed the water to stone and still didnt work. here is the code where i create the item: package com.posidon.startertech.init; import java.util.ArrayList; import java.util.List; import com.posidon.startertech.items.ItemBase; import com.posidon.startertech.items.WoodBucketEmpty; import net.minecraft.item.Item; public class ModItems { public static final List<Item> ITEMS = new ArrayList<Item>(); public static final Item SULFUR = new ItemBase("sulfur"); public static final Item CINNABAR = new ItemBase("cinnabar"); public static final Item SULFUR_CRYSTAL = new ItemBase("sulfur_crystal"); public static final Item WOOD_BUCKET_ITEM = new WoodBucketEmpty("wood_bucket_item"); public static final Item WOOD_BUCKET_FULL_ITEM = new ItemBase("wood_bucket_full_item"); }
  5. i have 2 custom buckets and in the empty one it has the code i talked about above. im doing empty before i code the full one so i know it works first
  6. I meant the picking up water in the bucket
  7. package com.posidon.startertech.items; import net.minecraft.world.World; import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumHand; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumActionResult; import net.minecraft.item.ItemStack; import net.minecraft.item.Item; import net.minecraft.init.Blocks; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.block.state.IBlockState; import com.posidon.startertech.init.ModItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; public class WoodBucketEmpty extends ItemBase { public WoodBucketEmpty(String name) { super(name); setMaxDamage(1); maxStackSize = 16; } @Override public float getDestroySpeed(ItemStack par1ItemStack, IBlockState par2Block) { return 0.5F; } @Override public EnumActionResult onItemUseFirst(EntityPlayer entity, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) { float var4 = 1.0F; int i = pos.getX(); int j = pos.getY(); int k = pos.getZ(); if (world.getBlockState(new BlockPos(i, j, k)).getBlock() == Blocks.WATER) { world.setBlockToAir(new BlockPos(i, j, k)); if (entity instanceof EntityPlayer) { ((EntityPlayer) entity).inventory.addItemStackToInventory(new ItemStack(ModItems.WOOD_BUCKET_FULL_ITEM, 1)); ((EntityPlayer) entity).inventory.clearMatchingItems(ModItems.WOOD_BUCKET_ITEM, -1, 1, null); } } return EnumActionResult.PASS; } } that's the code in my items java file, here is where I put them into an array to be registered: package com.posidon.startertech.init; import java.util.ArrayList; import java.util.List; import com.posidon.startertech.items.ItemBase; import com.posidon.startertech.items.WoodBucketEmpty; import net.minecraft.item.Item; public class ModItems { public static final List<Item> ITEMS = new ArrayList<Item>(); public static final Item SULFUR = new ItemBase("sulfur"); public static final Item CINNABAR = new ItemBase("cinnabar"); public static final Item SULFUR_CRYSTAL = new ItemBase("sulfur_crystal"); public static final Item WOOD_BUCKET_ITEM = new WoodBucketEmpty("wood_bucket_item"); public static final Item WOOD_BUCKET_FULL_ITEM = new ItemBase("wood_bucket_full_item"); } Here is where I take the Item list and register it package com.posidon.startertech.items; import com.posidon.startertech.Main; import com.posidon.startertech.init.ModItems; import com.posidon.startertech.util.IHasModel; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; public class ItemBase extends Item implements IHasModel { public ItemBase(String name) { setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.MATERIALS); ModItems.ITEMS.add(this); } @Override public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } If you need any other information tell me.
  8. also just out of curiosity, is there any way I could allow the player to put the empty bucket item on his head? I have the model and thing set up I just don't know how to program that in.
  9. I looked through the code and that picks up any fluid and changes the type, I am using a custom model for my item and I want the bucket to only pick up water, also I have 2 items so I just need to check to see if the water is the block clicked with the empty bucket and then remove it then switch the item, my code is not working, I am doing the picking up fluids first. I will post the java file I have for the item once I get the chance. The code you sent picks up any fluid and changes the texture but that wouldn't work because I want to use my custom model.
  10. If you want me to tell you any information about the code of my mod, I will just tell me.
  11. Hello, I am fairly new to modding I am following someone's tutorial series but I am now ahead of where he is. I am trying to create a custom bucket I have the items all set up i just do not know how to make them function as a normal bucket. I want to be able to only pick up water with it and nothing else. I will and another bucket soon that will be the same but can pick up lava although I can just copy/paste and change the code to lava. I have done a few attempts but to no avail any ideas? Also, i am wanting to have sticks have a 50% chance of dropping from trees, unable to break logs with hand, and wood/stone tools disabled. 2nd to the last thing is only having something spawn only near a waterbed on the surface like sugar cane as a singular block, not in a cluster. The last thing is that I have a crafting table set up I just don't know how to make it a crafting table because at the moment it is just a block. If you can solve any of these things please respond. Thanks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.