Updated Upstream (CraftBukkit/Spigot)
Doesn't compile yet. CraftBukkit Changes: 90d6905b Repackage NMS 69cf961d Repackage patches Spigot Changes: 79d53c28 Repackage NMS
This commit is contained in:
@@ -4,11 +4,35 @@ Date: Mon, 16 Jul 2018 00:05:05 +0300
|
||||
Subject: [PATCH] Add TNTPrimeEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockFire.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockFire.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.server;
|
||||
--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
// CraftBukkit end
|
||||
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
|
||||
|
||||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
});
|
||||
craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b);
|
||||
}
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent())
|
||||
+ continue;
|
||||
+ // Paper end
|
||||
nmsBlock.wasExploded(world, blockposition, explosionSource);
|
||||
|
||||
this.world.a(blockposition, false);
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java
|
||||
@@ -0,0 +0,0 @@ package net.minecraft.world.level.block;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
||||
@@ -39,14 +63,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
BlockTNT.a(world, blockposition);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BlockTNT.java b/src/main/java/net/minecraft/world/level/block/BlockTNT.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockTNT.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BlockTNT.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/BlockTNT.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.block.state.properties.BlockProperties;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateBoolean;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
|
||||
|
||||
public class BlockTNT extends Block {
|
||||
@@ -56,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!iblockdata1.a(iblockdata.getBlock())) {
|
||||
if (world.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
|
||||
+ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);;
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent())
|
||||
+ return;
|
||||
+ // Paper end
|
||||
@@ -68,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) {
|
||||
if (world.isBlockIndirectlyPowered(blockposition)) {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);;
|
||||
+ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);;
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent())
|
||||
+ return;
|
||||
+ // Paper end
|
||||
@@ -80,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) {
|
||||
if (!world.isClientSide) {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null;
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent())
|
||||
+ return;
|
||||
@@ -93,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return super.interact(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock);
|
||||
} else {
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.ITEM, entityhuman.getBukkitEntity()).callEvent())
|
||||
+ return EnumInteractionResult.FAIL;
|
||||
+ // Paper end
|
||||
@@ -105,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit end
|
||||
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);
|
||||
+ if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
@@ -114,27 +138,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null);
|
||||
world.a(blockposition, false);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
// CraftBukkit end
|
||||
+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent
|
||||
|
||||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
});
|
||||
craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b);
|
||||
}
|
||||
+ // Paper start - TNTPrimeEvent
|
||||
+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent())
|
||||
+ continue;
|
||||
+ // Paper end
|
||||
nmsBlock.wasExploded(world, blockposition, explosionSource);
|
||||
|
||||
this.world.a(blockposition, false);
|
||||
|
||||
Reference in New Issue
Block a user