geforkt von Mirrors/Paper
Optional TNT doesn't move in water
Dieser Commit ist enthalten in:
Ursprung
cda878cf64
Commit
bdd96190e0
@ -54,7 +54,31 @@
|
|||||||
} else {
|
} else {
|
||||||
this.updateInWaterStateAndDoFluidPushing();
|
this.updateInWaterStateAndDoFluidPushing();
|
||||||
if (this.level().isClientSide) {
|
if (this.level().isClientSide) {
|
||||||
@@ -121,7 +138,13 @@
|
@@ -118,10 +135,37 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+ // Paper start - Option to prevent TNT from moving in water
|
||||||
|
+ if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) {
|
||||||
|
+ /*
|
||||||
|
+ * Author: Jedediah Smith <jedediah@silencegreys.com>
|
||||||
|
+ */
|
||||||
|
+ // Send position and velocity updates to nearby players on every tick while the TNT is in water.
|
||||||
|
+ // This does pretty well at keeping their clients in sync with the server.
|
||||||
|
+ net.minecraft.server.level.ChunkMap.TrackedEntity ete = ((net.minecraft.server.level.ServerLevel) this.level()).getChunkSource().chunkMap.entityMap.get(this.getId());
|
||||||
|
+ if (ete != null) {
|
||||||
|
+ net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket velocityPacket = new net.minecraft.network.protocol.game.ClientboundSetEntityMotionPacket(this);
|
||||||
|
+ net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket positionPacket = net.minecraft.network.protocol.game.ClientboundTeleportEntityPacket.teleport(this.getId(), net.minecraft.world.entity.PositionMoveRotation.of(this), java.util.Set.of(), this.onGround);
|
||||||
|
+
|
||||||
|
+ ete.seenBy.stream()
|
||||||
|
+ .filter(viewer -> (viewer.getPlayer().getX() - this.getX()) * (viewer.getPlayer().getY() - this.getY()) * (viewer.getPlayer().getZ() - this.getZ()) < 16 * 16)
|
||||||
|
+ .forEach(viewer -> {
|
||||||
|
+ viewer.send(velocityPacket);
|
||||||
|
+ viewer.send(positionPacket);
|
||||||
|
+ });
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ // Paper end - Option to prevent TNT from moving in water
|
||||||
}
|
}
|
||||||
|
|
||||||
private void explode() {
|
private void explode() {
|
||||||
@ -69,3 +93,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -198,4 +242,11 @@
|
||||||
|
public final boolean hurtServer(ServerLevel world, DamageSource source, float amount) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+ // Paper start - Option to prevent TNT from moving in water
|
||||||
|
+ @Override
|
||||||
|
+ public boolean isPushedByFluid() {
|
||||||
|
+ return !level().paperConfig().fixes.preventTntFromMovingInWater && super.isPushedByFluid();
|
||||||
|
+ }
|
||||||
|
+ // Paper end - Option to prevent TNT from moving in water
|
||||||
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren