|
87 | 87 | double d11;
|
88 | 88 | if (entity instanceof LivingEntity) {
|
89 | 89 | LivingEntity livingentity = (LivingEntity)entity;
|
90 |
| -@@ -239,20 +_,76 @@ |
| 90 | +@@ -220,6 +_,21 @@ |
| 91 | + |
| 92 | + } |
| 93 | + |
| 94 | ++ private org.bukkit.World ketting$bworld; |
| 95 | ++ private org.bukkit.entity.Entity ketting$explode; |
| 96 | ++ private org.bukkit.Location ketting$location; |
| 97 | ++ private List<org.bukkit.block.Block> ketting$blockList; |
| 98 | ++ private BlockPos ketting$cpos; |
| 99 | ++ private org.bukkit.block.Block ketting$bblock; |
| 100 | ++ private boolean ketting$cancelled; |
| 101 | ++ private float ketting$yield; |
| 102 | ++ private List<org.bukkit.block.Block> ketting$bukkitBlocks; |
| 103 | ++ private BlockPos ketting$coords; |
| 104 | ++ private org.bukkit.event.entity.EntityExplodeEvent ketting$event$0; |
| 105 | ++ private org.bukkit.event.block.BlockExplodeEvent ketting$event$1; |
| 106 | ++ private Entity ketting$sourceEntity; |
| 107 | ++ private BlockPos ketting$sourceBlock; |
| 108 | ++ |
| 109 | + public void finalizeExplosion(boolean p_46076_) { |
| 110 | + if (this.level.isClientSide) { |
| 111 | + this.level.playLocalSound(this.x, this.y, this.z, SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 4.0F, (1.0F + (this.level.random.nextFloat() - this.level.random.nextFloat()) * 0.2F) * 0.7F, false); |
| 112 | +@@ -239,20 +_,72 @@ |
91 | 113 | boolean flag1 = this.getIndirectSourceEntity() instanceof Player;
|
92 | 114 | Util.shuffle(this.toBlow, this.level.random);
|
93 | 115 |
|
94 | 116 | + // CraftBukkit start
|
95 |
| -+ org.bukkit.World bworld = this.level.getWorld(); |
96 |
| -+ org.bukkit.entity.Entity explode = this.source == null ? null : this.source.getBukkitEntity(); |
97 |
| -+ org.bukkit.Location location = new org.bukkit.Location(bworld, this.x, this.y, this.z); |
| 117 | ++ ketting$bworld = this.level.getWorld(); |
| 118 | ++ ketting$explode = this.source == null ? null : this.source.getBukkitEntity(); |
| 119 | ++ ketting$location = new org.bukkit.Location(ketting$bworld, this.x, this.y, this.z); |
98 | 120 | +
|
99 |
| -+ List<org.bukkit.block.Block> blockList = new ObjectArrayList<>(); |
| 121 | ++ ketting$blockList = new ObjectArrayList<>(); |
100 | 122 | + for (int i1 = this.toBlow.size() - 1; i1 >= 0; i1--) {
|
101 |
| -+ BlockPos cpos = this.toBlow.get(i1); |
102 |
| -+ org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ()); |
103 |
| -+ if (!bblock.getType().isAir()) { |
104 |
| -+ blockList.add(bblock); |
| 123 | ++ ketting$cpos = this.toBlow.get(i1); |
| 124 | ++ ketting$bblock = ketting$bworld.getBlockAt(ketting$cpos.getX(), ketting$cpos.getY(), ketting$cpos.getZ()); |
| 125 | ++ if (!ketting$bblock.getType().isAir()) { |
| 126 | ++ ketting$blockList.add(ketting$bblock); |
105 | 127 | + }
|
106 | 128 | + }
|
107 | 129 | +
|
108 |
| -+ boolean cancelled; |
109 |
| -+ List<org.bukkit.block.Block> bukkitBlocks; |
110 |
| -+ float yield; |
111 |
| -+ |
112 |
| -+ if (explode != null) { |
113 |
| -+ org.bukkit.event.entity.EntityExplodeEvent event = new org.bukkit.event.entity.EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); |
114 |
| -+ this.level.getCraftServer().getPluginManager().callEvent(event); |
115 |
| -+ cancelled = event.isCancelled(); |
116 |
| -+ bukkitBlocks = event.blockList(); |
117 |
| -+ yield = event.getYield(); |
| 130 | ++ if (ketting$explode != null) { |
| 131 | ++ ketting$event$0 = new org.bukkit.event.entity.EntityExplodeEvent(ketting$explode, ketting$location, ketting$blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); |
| 132 | ++ this.level.getCraftServer().getPluginManager().callEvent(ketting$event$0); |
| 133 | ++ ketting$cancelled = ketting$event$0.isCancelled(); |
| 134 | ++ ketting$bukkitBlocks = ketting$event$0.blockList(); |
| 135 | ++ ketting$yield = ketting$event$0.getYield(); |
118 | 136 | + } else {
|
119 |
| -+ org.bukkit.event.block.BlockExplodeEvent event = new org.bukkit.event.block.BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); |
120 |
| -+ this.level.getCraftServer().getPluginManager().callEvent(event); |
121 |
| -+ cancelled = event.isCancelled(); |
122 |
| -+ bukkitBlocks = event.blockList(); |
123 |
| -+ yield = event.getYield(); |
| 137 | ++ ketting$event$1 = new org.bukkit.event.block.BlockExplodeEvent(ketting$location.getBlock(), ketting$blockList, this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F); |
| 138 | ++ this.level.getCraftServer().getPluginManager().callEvent(ketting$event$1); |
| 139 | ++ ketting$cancelled = ketting$event$1.isCancelled(); |
| 140 | ++ ketting$bukkitBlocks = ketting$event$1.blockList(); |
| 141 | ++ ketting$yield = ketting$event$1.getYield(); |
124 | 142 | + }
|
125 | 143 | +
|
126 | 144 | + this.toBlow.clear();
|
127 | 145 | +
|
128 |
| -+ for (org.bukkit.block.Block bblock : bukkitBlocks) { |
129 |
| -+ BlockPos coords = new BlockPos(bblock.getX(), bblock.getY(), bblock.getZ()); |
130 |
| -+ toBlow.add(coords); |
| 146 | ++ for (org.bukkit.block.Block bblock : ketting$bukkitBlocks) { |
| 147 | ++ ketting$coords = new BlockPos(bblock.getX(), bblock.getY(), bblock.getZ()); |
| 148 | ++ toBlow.add(ketting$coords); |
131 | 149 | + }
|
132 | 150 | +
|
133 |
| -+ if (cancelled) { |
| 151 | ++ if (ketting$cancelled) { |
134 | 152 | + this.wasCanceled = true;
|
135 | 153 | + return;
|
136 | 154 | + }
|
|
140 | 158 | Block block = blockstate.getBlock();
|
141 | 159 | + // CraftBukkit start - TNTPrimeEvent
|
142 | 160 | + if (block instanceof net.minecraft.world.level.block.TntBlock) {
|
143 |
| -+ Entity sourceEntity = source == null ? null : source; |
144 |
| -+ BlockPos sourceBlock = sourceEntity == null ? BlockPos.containing(this.x, this.y, this.z) : null; |
145 |
| -+ if (!org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory.callTNTPrimeEvent(this.level, blockpos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.EXPLOSION, sourceEntity, sourceBlock)) { |
| 161 | ++ ketting$sourceEntity = source == null ? null : source; |
| 162 | ++ ketting$sourceBlock = ketting$sourceEntity == null ? BlockPos.containing(this.x, this.y, this.z) : null; |
| 163 | ++ if (!org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory.callTNTPrimeEvent(this.level, blockpos, org.bukkit.event.block.TNTPrimeEvent.PrimeCause.EXPLOSION, ketting$sourceEntity, ketting$sourceBlock)) { |
146 | 164 | + this.level.sendBlockUpdated(blockpos, Blocks.AIR.defaultBlockState(), blockstate, 3); // Update the block on the client
|
147 | 165 | + continue;
|
148 | 166 | + }
|
|
162 | 180 | - if (this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY) {
|
163 | 181 | - lootparams$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, this.radius);
|
164 | 182 | +
|
165 |
| -+ if (yield < 1.0F) { // CraftBukkit - add yield |
166 |
| -+ lootparams$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield |
| 183 | ++ if (ketting$yield < 1.0F) { // CraftBukkit - add yield |
| 184 | ++ lootparams$builder.withParameter(LootContextParams.EXPLOSION_RADIUS, 1.0F / ketting$yield); // CraftBukkit - add yield |
167 | 185 | }
|
168 | 186 |
|
169 | 187 | blockstate.spawnAfterBreak(serverlevel, blockpos, ItemStack.EMPTY, flag1);
|
|
0 commit comments