Posted February 14, 201510 yr Hello Guys, I want to change the Harvestlevel from Certus Quartz Ore and Charges Certus Quartz Ore, which are implemented in AE2. But I could need some hints on that. I think i will need the dev environment from AE2. Greets, xXxKanemanxXx
February 14, 201510 yr Author But for what would i need the HarvestDropsEvent ? I want to change the HarvestLevel of Certus Quartz Ore so I would be able to mine it only with a Diamond Pickaxe or even higher tier Tools.
February 14, 201510 yr Author So when the Event is fired i am supposed to check for the Block that is currently harvested right ?
February 14, 201510 yr Author could need some more hints. So i can use GameRegistry.findBlock to get the block. But how do i check now it its the Block i am currently harvesting ?
February 14, 201510 yr Author Okay i really don't know how to start... I know you gave me the start already but to be honest... i don't know...
February 14, 201510 yr You now you need to use an event, so look up how to do events. You know you need to use GameRegistry.findBlock . You need to specify it with the modid of the mod, and the name the block is registered with. Store that block somewhere in a static variable. In the HarvestCheck event, you can get the block, compare it wil the block in that variable, and check if the tool the player (get the player from the event) is holding has the harvest level you want it to have, and then set success to true , else you set it to false . Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
February 15, 201510 yr Author My question now is how will i check for the tool the player is holding ? Can i use the EntityPlayer.getItemInUse Method or is it another method ? Edit: I've tried it like this. Could this work ? @SubscribeEvent public void onHarvestCheck(PlayerEvent.HarvestCheck check){ if(this.quartzOre == check.block){ if(this.heldItem.getItem() == Items.diamond_pickaxe){ check.success = true; }else{ check.success = false; } } }
February 15, 201510 yr Player's held item can be obtained from: (PlayerEvent.HarvestCheck) check.entityPlayer.inventory.getCurrentItem(); Check out my mods: BTAM Armor sets Avoid Exploding Creepers Tools compressor Anti Id Conflict Key bindings overhaul Colourfull blocks Invisi Zones
February 15, 201510 yr Author my entire class: public class HarvestEventHandler { public static Block quartzOre = GameRegistry.findBlock("appliedenergistics2", "oreCertusQuartz"); public static ItemStack heldItem; @SubscribeEvent public void onHarvestCheck(PlayerEvent.HarvestCheck check){ if(this.quartzOre == check.block){ if(this.heldItem.getItem() == Items.diamond_pickaxe){ check.success = true; }else{ check.success = false; } } } }
February 15, 201510 yr Author i've casted the heldItem variable now. Now i need to cast the findBlock in a static field right ? but which static field and how ? public void postInit(FMLPostInitializationEvent e){ GameRegistry.findBlock("appliedenergistics2", "oreCertusQuartz"); } @SubscribeEvent public void onHarvestCheck(PlayerEvent.HarvestCheck check){ ItemStack heldItem = check.entityPlayer.inventory.getCurrentItem(); if(this.quartzOre == check.block){ if(heldItem.getItem() == Items.diamond_pickaxe){ } } } i know quartzOre is an undefined variable atm
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.