Files
CatServer/patches/net/minecraft/item/ItemEnderPearl.java.patch
2019-02-24 22:29:41 +08:00

46 lines
2.0 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemEnderPearl.java
+++ ../src-work/minecraft/net/minecraft/item/ItemEnderPearl.java
@@ -3,6 +3,7 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityEnderPearl;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
import net.minecraft.stats.StatList;
import net.minecraft.util.ActionResult;
@@ -23,6 +24,19 @@
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
+ // CraftBukkit start - change order
+ if (!worldIn.isRemote) {
+ EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn);
+
+ entityenderpearl.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
+ if (!worldIn.spawnEntity(entityenderpearl)) {
+ if (playerIn instanceof EntityPlayerMP) {
+ ((EntityPlayerMP) playerIn).getBukkitEntity().updateInventory();
+ }
+ return new ActionResult<>(EnumActionResult.FAIL, itemstack);
+ }
+ }
+
if (!playerIn.capabilities.isCreativeMode)
{
itemstack.shrink(1);
@@ -31,12 +45,14 @@
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
playerIn.getCooldownTracker().setCooldown(this, 20);
+ /*
if (!worldIn.isRemote)
{
EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn);
entityenderpearl.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
worldIn.spawnEntity(entityenderpearl);
}
+ */
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);