Jump to content

[1.7.10] Changing Mod Recipes and Ore Harvestlevels


xXxKanemanxXx

Recommended Posts

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/

Link to comment
Share on other sites

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;

}

}

}

 

 

Link to comment
Share on other sites

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;

}

}

}

}

 

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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