Posted March 9, 201312 yr I have a new ItemThrowable but when I spawn it and it hits the ground it doest destroy itself and for some reason forge spews out Memory Overburdened messages. sword onUse() w.spawnEntityInWorld(New EntityEnergySpell(w, p)) Main @init InitMod() { EntityRegistry.registerModEntity(EntityEnergySpell.class, "Lightning Bolt", 1, this, 250, 5, false); } public void AddRenderer(Map map) { map.put(EntityEnergySpell.class, new RenderEnergySpell(Item.snowball.getIconFromDamage(0))); } EntityEnerySpell package jordan30001.testMod.common.item.tools.generic.tools.entitys; import net.minecraft.client.Minecraft; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.DamageSource; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityEnergySpell extends EntityThrowable { public EntityEnergySpell(World w) { super(w); World thisWorld = w; } public EntityEnergySpell(World w, EntityLiving e) { super(w, e); } public EntityEnergySpell(World w, double x, double y, double z) { super(w, x, y, z); } /** * Called when the throwable hits a block or entity. */ protected void onImpact(MovingObjectPosition par1MovingObjectPosition) { if (par1MovingObjectPosition.entityHit != null) { byte byte0 = 0; if (!par1MovingObjectPosition.entityHit.attackEntityFrom( DamageSource.causeThrownDamage(this, this.getThrower()), byte0)) ; } if (par1MovingObjectPosition.typeOfHit.equals(par1MovingObjectPosition.typeOfHit.TILE)) { setDead(); } for (int i = 0; i < 8; i++) { int B, N, M; B = (int) posX; N = (int) posY; M = (int) posZ; worldObj.spawnParticle("heart", posX, posY, posZ, 0.0D, 0.0D, 0.0D); worldObj.spawnEntityInWorld(new EntityEnergySpell(this.worldObj, posX, posY, posZ)); } // if // (Minecraft.getMinecraft().getIntegratedServer().isDedicatedServer()) // { // setDead(); // } } } [code][/spoiler]
March 9, 201312 yr Look at the arrow class, It should have segments of code that tick when the arrow hits the ground. Use this to make a tick counter, and when it reaches one, .setdead(); This is the creator of the Rareores mod! Be sure to check it out at
March 9, 201312 yr Author Look at the arrow class, It should have segments of code that tick when the arrow hits the ground. Use this to make a tick counter, and when it reaches one, .setdead(); I have read it but still don't completely understand what's happening. if only things were not named par1,par2,par3.....par999999999 I could probably read it more easily and understand what its doing
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.