diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/EnderEyeItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/item/EnderEyeItem.java.patch | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderEyeItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderEyeItem.java.patch new file mode 100644 index 0000000000..43ff750020 --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/EnderEyeItem.java.patch @@ -0,0 +1,136 @@ +--- a/net/minecraft/world/item/EnderEyeItem.java ++++ b/net/minecraft/world/item/EnderEyeItem.java +@@ -8,7 +8,7 @@ + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; + import net.minecraft.tags.StructureTags; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResult; + import net.minecraft.world.InteractionResultHolder; + import net.minecraft.world.entity.Entity; +@@ -20,7 +20,7 @@ + import net.minecraft.world.level.block.Block; + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.EndPortalFrameBlock; +-import net.minecraft.world.level.block.state.BlockState; ++import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.pattern.BlockPattern; + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.phys.BlockHitResult; +@@ -28,40 +28,39 @@ + + public class EnderEyeItem extends Item { + +- public EnderEyeItem(Item.Properties item_properties) { +- super(item_properties); ++ public EnderEyeItem(Item.Properties properties) { ++ super(properties); + } + + @Override +- @Override +- public InteractionResult useOn(UseOnContext useoncontext) { +- Level level = useoncontext.getLevel(); +- BlockPos blockpos = useoncontext.getClickedPos(); +- BlockState blockstate = level.getBlockState(blockpos); ++ public InteractionResult useOn(UseOnContext context) { ++ Level world = context.getLevel(); ++ BlockPos blockposition = context.getClickedPos(); ++ IBlockData iblockdata = world.getBlockState(blockposition); + +- if (blockstate.is(Blocks.END_PORTAL_FRAME) && !(Boolean) blockstate.getValue(EndPortalFrameBlock.HAS_EYE)) { +- if (level.isClientSide) { ++ if (iblockdata.is(Blocks.END_PORTAL_FRAME) && !(Boolean) iblockdata.getValue(EndPortalFrameBlock.HAS_EYE)) { ++ if (world.isClientSide) { + return InteractionResult.SUCCESS; + } else { +- BlockState blockstate1 = (BlockState) blockstate.setValue(EndPortalFrameBlock.HAS_EYE, true); ++ IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(EndPortalFrameBlock.HAS_EYE, true); + +- Block.pushEntitiesUp(blockstate, blockstate1, level, blockpos); +- level.setBlock(blockpos, blockstate1, 2); +- level.updateNeighbourForOutputSignal(blockpos, Blocks.END_PORTAL_FRAME); +- useoncontext.getItemInHand().shrink(1); +- level.levelEvent(1503, blockpos, 0); +- BlockPattern.BlockPatternMatch blockpattern_blockpatternmatch = EndPortalFrameBlock.getOrCreatePortalShape().find(level, blockpos); ++ Block.pushEntitiesUp(iblockdata, iblockdata1, world, blockposition); ++ world.setBlock(blockposition, iblockdata1, 2); ++ world.updateNeighbourForOutputSignal(blockposition, Blocks.END_PORTAL_FRAME); ++ context.getItemInHand().shrink(1); ++ world.levelEvent(1503, blockposition, 0); ++ BlockPattern.BlockPatternMatch shapedetector_shapedetectorcollection = EndPortalFrameBlock.getOrCreatePortalShape().find(world, blockposition); + +- if (blockpattern_blockpatternmatch != null) { +- BlockPos blockpos1 = blockpattern_blockpatternmatch.getFrontTopLeft().offset(-3, 0, -3); ++ if (shapedetector_shapedetectorcollection != null) { ++ BlockPos blockposition1 = shapedetector_shapedetectorcollection.getFrontTopLeft().offset(-3, 0, -3); + + for (int i = 0; i < 3; ++i) { + for (int j = 0; j < 3; ++j) { +- level.setBlock(blockpos1.offset(i, 0, j), Blocks.END_PORTAL.defaultBlockState(), 2); ++ world.setBlock(blockposition1.offset(i, 0, j), Blocks.END_PORTAL.defaultBlockState(), 2); + } + } + +- level.globalLevelEvent(1038, blockpos1.offset(1, 0, 1), 0); ++ world.globalLevelEvent(1038, blockposition1.offset(1, 0, 1), 0); + } + + return InteractionResult.CONSUME; +@@ -72,28 +71,31 @@ + } + + @Override +- @Override +- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) { +- ItemStack itemstack = player.getItemInHand(interactionhand); +- BlockHitResult blockhitresult = getPlayerPOVHitResult(level, player, ClipContext.Fluid.NONE); ++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); ++ BlockHitResult movingobjectpositionblock = getPlayerPOVHitResult(level, player, ClipContext.Fluid.NONE); + +- if (blockhitresult.getType() == HitResult.Type.BLOCK && level.getBlockState(blockhitresult.getBlockPos()).is(Blocks.END_PORTAL_FRAME)) { ++ if (movingobjectpositionblock.getType() == HitResult.EnumMovingObjectType.BLOCK && level.getBlockState(movingobjectpositionblock.getBlockPos()).is(Blocks.END_PORTAL_FRAME)) { + return InteractionResultHolder.pass(itemstack); + } else { +- player.startUsingItem(interactionhand); ++ player.startUsingItem(hand); + if (level instanceof ServerLevel) { +- ServerLevel serverlevel = (ServerLevel) level; +- BlockPos blockpos = serverlevel.findNearestMapStructure(StructureTags.EYE_OF_ENDER_LOCATED, player.blockPosition(), 100, false); ++ ServerLevel worldserver = (ServerLevel) level; ++ BlockPos blockposition = worldserver.findNearestMapStructure(StructureTags.EYE_OF_ENDER_LOCATED, player.blockPosition(), 100, false); + +- if (blockpos != null) { +- EyeOfEnder eyeofender = new EyeOfEnder(level, player.getX(), player.getY(0.5D), player.getZ()); ++ if (blockposition != null) { ++ EyeOfEnder entityendersignal = new EyeOfEnder(level, player.getX(), player.getY(0.5D), player.getZ()); + +- eyeofender.setItem(itemstack); +- eyeofender.signalTo(blockpos); +- level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeofender.position(), GameEvent.Context.of((Entity) player)); +- level.addFreshEntity(eyeofender); ++ entityendersignal.setItem(itemstack); ++ entityendersignal.signalTo(blockposition); ++ level.gameEvent(GameEvent.PROJECTILE_SHOOT, entityendersignal.position(), GameEvent.Context.of((Entity) player)); ++ // CraftBukkit start ++ if (!level.addFreshEntity(entityendersignal)) { ++ return new InteractionResultHolder(InteractionResult.FAIL, itemstack); ++ } ++ // CraftBukkit end + if (player instanceof ServerPlayer) { +- CriteriaTriggers.USED_ENDER_EYE.trigger((ServerPlayer) player, blockpos); ++ CriteriaTriggers.USED_ENDER_EYE.trigger((ServerPlayer) player, blockposition); + } + + level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); +@@ -103,7 +105,7 @@ + } + + player.awardStat(Stats.ITEM_USED.get(this)); +- player.swing(interactionhand, true); ++ player.swing(hand, true); + return InteractionResultHolder.success(itemstack); + } + } |