Jump to content

Risks of editing EntityLiving class <updated>


acecase

Recommended Posts

I have another topic up currently concerning suppressing xp orbs from mobs (without supressing them from potions, mining, smelting, etc), without core mods. That isn't looking promising, so my next question is, if I do end up modifying EntityLiving.java from the net.minecraft.entity package (as below), what are the risks (or the downsides)? I assume that coremods replace core files with their own. If that is the case, I assume that any other mods that modify EntityLiving.java will be incompatible, and it will also be effecting any mods that inherit from EntityLiving.

 

I hate the idea of making my mod a core, but the xp orb suppression is a pretty big part of the mod.

 

EDIT: Sorry. I forgot to add the code. Probably not necessary for some of you guys, but this is it.

 

The code that I may have to modify is around line 690 of the net.minecraft.entity.EntityLiving class, in the onDeathUpdate Method.

Originally it was...

 

 

while (var1 > 0)
                    {
                        int var2 = EntityXPOrb.getXPSplit(var1);
                        var1 -= var2;
                        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var2));
                    }

 

 

 

I am basically testing with pigs, so I am just wrapping the loop with a conditional if(!(this.getEntityName().equals("Pig") so that pigs will not drop xp orbs.

 

 

 

if(!(this.getEntityName().equals("Pig"))){
                	while (var1 > 0)
                    {
                        int var2 = EntityXPOrb.getXPSplit(var1);
                        var1 -= var2;
                        this.worldObj.spawnEntityInWorld(new EntityXPOrb(this.worldObj, this.posX, this.posY, this.posZ, var2));
                    }
                }

 

 

Link to comment
Share on other sites

Thank you both. It looks like turning my mod into a coremod for this one simple function is a bit much (not that I know what is required), so I'm going to look into some more round-about ways to achieve this.

 

And thanks for the pointer. I hadn't considered my mods being public, but that is a better way to do the check anyway. Java and Strings are not the best company as resources go.

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.