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

The title almost says everything: If the player shoots an arrow i want to test, if the bow has a specific enchantment & if the player is sneaking, i want to teleport the player to the arrow when it hits the ground.

 

Thanks in advance

D:

1. Look with something like JDecompiler at the EnderPearl

2. If you wan't to make this you may have to make a new Arrow and/or Bow

Here's my arrow: Already made it. But it gets through every block and teleports me into the void;

 

public class EntityEnderArrow extends EntityThrowable {

public EntityEnderArrow(World world){
	super(world);
}

public EntityEnderArrow(World world, EntityLivingBase entityliving){
	super(world, entityliving);
}

@SideOnly(Side.CLIENT)
public EntityEnderArrow(World world, double d1, double d2, double d3){
	super(world, d1, d2, d3);
}

@Override
public void onImpact(MovingObjectPosition pos){
	if(pos.entityHit != null){
		pos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
	}

	for(int i = 0; i < 32; ++i){
		this.worldObj.spawnParticle("portal", this.posX, this.posY + this.rand.nextDouble() * 2.0D, this.posZ, this.rand.nextGaussian(),  0.0D, this.rand.nextGaussian());
	}

	if(!this.worldObj.isRemote){
		if(this.getThrower() != null && this.getThrower() instanceof EntityPlayerMP){
			EntityPlayerMP player = (EntityPlayerMP)this.getThrower();

			if(player.playerNetServerHandler.func_147362_b().isChannelOpen() && player.worldObj == this.worldObj){
				EnderTeleportEvent event = new EnderTeleportEvent(player, this.posX, this.posY, this.posZ, 5.0F);
				if(!MinecraftForge.EVENT_BUS.post(event)){
					if(this.getThrower().isRiding()){
						this.getThrower().mountEntity((Entity)null);
					}

					this.getThrower().setPositionAndUpdate(event.targetX, event.targetY, event.targetZ);
					this.getThrower().fallDistance = 0.0F;
				}
			}
		}
	}
}
}

ok i got it; i forgot the line

this.setDead();

 

But how do i check if the bow has the right enchantment and the player is sneaking and spawn it instead of the message?

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.