Jump to content

Mufark

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by Mufark

  1. Thanks Heaps. That is really helpful. Good to know that the second part would have an overall effect on the item drop for the block too. I'll change it and see how I go. EDIT: I'll just add an if statement that will create a random number that will give me a chance to drop.
  2. Hey Guys, I Have created a custom loot drop table and its working for entities but when I try and add drops to vanilla blocks it doesn't seem to be working. Keep in mind that I am a complete Java noob. I usually program in C and C++. Similar but different. Anyways. My code I am using is below. I know the top part is right. But I cant work out a way to ID the block I want the drop to be added to. @SubscribeEvent public void onHarvestEvent(HarvestDropsEvent event) { if (event.getHarvester() != null) //Checks to make sure player is harvesting. { if(event.equals(Blocks.STONE)) //Is meant to confirm which block is being broken. { //This will add my item to the block as it drops with 100% drop rate while I am testing. event.setDropChance((float) 1.0F); event.getDrops().add(new ItemStack(ModItems.DOLLAR_BILL,1)); } } } Not sure if the second half works yet but I am 100% certain that the if(event.equals(Blocks.STONE) is incorrect. Someone with some knowledge on working with Forge 1.12.2 would be much appreciated.
×
×
  • Create New...

Important Information

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