Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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]

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

  • 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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.