Jump to content

Spawning a ThowableEntity memory overburdened


Recommended Posts

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))



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)));




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)
	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))
	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();
	// }

Link to comment
Share on other sites

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

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.

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.


  • Create New...

Important Information

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