aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch83
1 files changed, 83 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch
new file mode 100644
index 0000000000..dbe8d5b5fc
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/item/EndCrystalItem.java.patch
@@ -0,0 +1,83 @@
+--- a/net/minecraft/world/item/EndCrystalItem.java
++++ b/net/minecraft/world/item/EndCrystalItem.java
+@@ -9,48 +9,59 @@
+ import net.minecraft.world.item.context.UseOnContext;
+ import net.minecraft.world.level.Level;
+ import net.minecraft.world.level.block.Blocks;
+-import net.minecraft.world.level.block.state.BlockState;
++import net.minecraft.world.level.block.state.IBlockData;
+ import net.minecraft.world.level.dimension.end.EndDragonFight;
+ import net.minecraft.world.level.gameevent.GameEvent;
+ import net.minecraft.world.phys.AABB;
+
+ public class EndCrystalItem extends Item {
++
+ public EndCrystalItem(Item.Properties properties) {
+ super(properties);
+ }
+
+ @Override
+ public InteractionResult useOn(UseOnContext context) {
+- Level level = context.getLevel();
+- BlockPos clickedPos = context.getClickedPos();
+- BlockState blockState = level.getBlockState(clickedPos);
+- if (!blockState.is(Blocks.OBSIDIAN) && !blockState.is(Blocks.BEDROCK)) {
++ Level world = context.getLevel();
++ BlockPos blockposition = context.getClickedPos();
++ IBlockData iblockdata = world.getBlockState(blockposition);
++
++ if (!iblockdata.is(Blocks.OBSIDIAN) && !iblockdata.is(Blocks.BEDROCK)) {
+ return InteractionResult.FAIL;
+ } else {
+- BlockPos blockPos = clickedPos.above();
+- if (!level.isEmptyBlock(blockPos)) {
++ BlockPos blockposition1 = blockposition.above();
++
++ if (!world.isEmptyBlock(blockposition1)) {
+ return InteractionResult.FAIL;
+ } else {
+- double d = (double)blockPos.getX();
+- double d1 = (double)blockPos.getY();
+- double d2 = (double)blockPos.getZ();
+- List<Entity> entities = level.getEntities(null, new AABB(d, d1, d2, d + 1.0, d1 + 2.0, d2 + 1.0));
+- if (!entities.isEmpty()) {
++ double d0 = (double) blockposition1.getX();
++ double d1 = (double) blockposition1.getY();
++ double d2 = (double) blockposition1.getZ();
++ List<Entity> list = world.getEntities((Entity) null, new AABB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));
++
++ if (!list.isEmpty()) {
+ return InteractionResult.FAIL;
+ } else {
+- if (level instanceof ServerLevel) {
+- EndCrystal endCrystal = new EndCrystal(level, d + 0.5, d1, d2 + 0.5);
+- endCrystal.setShowBottom(false);
+- level.addFreshEntity(endCrystal);
+- level.gameEvent(context.getPlayer(), GameEvent.ENTITY_PLACE, blockPos);
+- EndDragonFight dragonFight = ((ServerLevel)level).getDragonFight();
+- if (dragonFight != null) {
+- dragonFight.tryRespawn();
++ if (world instanceof ServerLevel) {
++ EndCrystal entityendercrystal = new EndCrystal(world, d0 + 0.5D, d1, d2 + 0.5D);
++
++ entityendercrystal.setShowBottom(false);
++ // CraftBukkit start
++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(context, entityendercrystal).isCancelled()) {
++ return InteractionResult.FAIL;
+ }
++ // CraftBukkit end
++ world.addFreshEntity(entityendercrystal);
++ world.gameEvent((Entity) context.getPlayer(), GameEvent.ENTITY_PLACE, blockposition1);
++ EndDragonFight enderdragonbattle = ((ServerLevel) world).getDragonFight();
++
++ if (enderdragonbattle != null) {
++ enderdragonbattle.tryRespawn();
++ }
+ }
+
+ context.getItemInHand().shrink(1);
+- return InteractionResult.sidedSuccess(level.isClientSide);
++ return InteractionResult.sidedSuccess(world.isClientSide);
+ }
+ }
+ }