mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 04:02:06 -07:00
track block for lava/conduit damage
dropped diff
This commit is contained in:
@@ -48,7 +48,7 @@ public interface PersistentDataContainer extends io.papermc.paper.persistence.Pe
|
||||
// Paper start - byte array serialization
|
||||
// Paper - move to PersistentDataContainerView
|
||||
/**
|
||||
* Read values from a serialised byte array into this
|
||||
* Read values from a serialized byte array into this
|
||||
* {@link PersistentDataContainer} instance.
|
||||
*
|
||||
* @param bytes the byte array to read from
|
||||
@@ -59,7 +59,7 @@ public interface PersistentDataContainer extends io.papermc.paper.persistence.Pe
|
||||
void readFromBytes(byte @NotNull [] bytes, boolean clear) throws java.io.IOException;
|
||||
|
||||
/**
|
||||
* Read values from a serialised byte array into this
|
||||
* Read values from a serialized byte array into this
|
||||
* {@link PersistentDataContainer} instance.
|
||||
* This method has the same effect as
|
||||
* <code>PersistentDataContainer#readFromBytes(bytes, true)</code>
|
||||
|
@@ -354,7 +354,7 @@ index 0000000000000000000000000000000000000000..ae2bb9a73106febfe5f0d090abd4252b
|
||||
+ }
|
||||
+}
|
||||
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
|
||||
index a0eec03c9e710f871413f2052e9d2839d6bb0c54..f517b0d9d5ad5176f641ac61e2bef3a456b41e57 100644
|
||||
index 7b5ed00c9b2f22af5cbc44171192d674936dc7d7..5fe3c9a159908785e08fa874982bc1a82283bb1d 100644
|
||||
--- a/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -4,7 +4,6 @@ import com.google.common.collect.ImmutableList;
|
||||
@@ -484,10 +484,10 @@ index c70a58f5f633fa8e255f74c42f5e87c96b7b013a..ec20a5a6d7c8f65abda528fec36bec7b
|
||||
public void tick() {
|
||||
super.tick();
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index 86ddf5f7fb586c2ce951953f96ad800dfbab3662..e5fd79bba597b6463a050b68e11dc9b5bcb836b0 100644
|
||||
index f961540a00bfb5e1c8eb0e739f8ae535e9eee8f3..7453ddb09f349b7836f966573e4933646a75cba6 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -408,6 +408,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -409,6 +409,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private final int despawnTime; // Paper - entity despawn time limit
|
||||
public int totalEntityAge; // Paper - age-like counter for all entities
|
||||
public final io.papermc.paper.entity.activation.ActivationType activationType = io.papermc.paper.entity.activation.ActivationType.activationTypeFor(this); // Paper - EAR 2/tracking ranges
|
||||
@@ -503,7 +503,7 @@ index 86ddf5f7fb586c2ce951953f96ad800dfbab3662..e5fd79bba597b6463a050b68e11dc9b5
|
||||
// CraftBukkit end
|
||||
|
||||
// Paper start
|
||||
@@ -423,6 +432,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -424,6 +433,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.position = Vec3.ZERO;
|
||||
this.blockPosition = BlockPos.ZERO;
|
||||
this.chunkPosition = ChunkPos.ZERO;
|
||||
@@ -517,7 +517,7 @@ index 86ddf5f7fb586c2ce951953f96ad800dfbab3662..e5fd79bba597b6463a050b68e11dc9b5
|
||||
SynchedEntityData.Builder builder = new SynchedEntityData.Builder(this);
|
||||
builder.define(DATA_SHARED_FLAGS_ID, (byte)0);
|
||||
builder.define(DATA_AIR_SUPPLY_ID, this.getMaxAirSupply());
|
||||
@@ -983,6 +999,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -984,6 +1000,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
if (type == MoverType.PISTON) {
|
||||
@@ -528,7 +528,7 @@ index 86ddf5f7fb586c2ce951953f96ad800dfbab3662..e5fd79bba597b6463a050b68e11dc9b5
|
||||
movement = this.limitPistonMovement(movement);
|
||||
if (movement.equals(Vec3.ZERO)) {
|
||||
return;
|
||||
@@ -996,6 +1016,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -997,6 +1017,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.setDeltaMovement(Vec3.ZERO);
|
||||
}
|
||||
|
@@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading
|
||||
massive amounts of surrounding chunks due to large AABB lookups.
|
||||
|
||||
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
|
||||
index e5fd79bba597b6463a050b68e11dc9b5bcb836b0..6c41a4771ece889ebf4328d273f39bdf09c299ba 100644
|
||||
index 7453ddb09f349b7836f966573e4933646a75cba6..58eda0d6426f30cda604f4120f1ddb012316c108 100644
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -228,6 +228,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -229,6 +229,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// Paper end - Share random for entities to make them more random
|
||||
public @Nullable org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||
|
||||
|
@@ -6,22 +6,22 @@
|
||||
private static final RegistryOps<JsonElement> OPS = RegistryAccess.EMPTY.createSerializationContext(JsonOps.INSTANCE);
|
||||
- public static final StreamCodec<ByteBuf, ClientboundLoginDisconnectPacket> STREAM_CODEC = StreamCodec.composite(
|
||||
- ByteBufCodecs.lenientJson(262144).apply(ByteBufCodecs.fromCodec(OPS, ComponentSerialization.CODEC)),
|
||||
+ // Paper start - localized codec
|
||||
+ // Paper start - localized codec
|
||||
+ // In the login phase, buffer.adventure$locale field is most likely null, but plugins may use internals to set it via the channel attribute
|
||||
+ public static final StreamCodec<net.minecraft.network.FriendlyByteBuf, ClientboundLoginDisconnectPacket> STREAM_CODEC = StreamCodec.composite(
|
||||
+ new net.minecraft.network.codec.StreamCodec<>() {
|
||||
+ new StreamCodec<>() {
|
||||
+
|
||||
+ private static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, com.google.gson.JsonElement> LENIENT_JSON = net.minecraft.network.codec.ByteBufCodecs.lenientJson(net.minecraft.network.FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
|
||||
+ private static final net.minecraft.network.codec.StreamCodec<ByteBuf, JsonElement> LENIENT_JSON = ByteBufCodecs.lenientJson(net.minecraft.network.FriendlyByteBuf.MAX_COMPONENT_STRING_LENGTH);
|
||||
+ @Override
|
||||
+ public net.minecraft.network.chat.Component decode(final net.minecraft.network.FriendlyByteBuf buffer) {
|
||||
+ public Component decode(final net.minecraft.network.FriendlyByteBuf buffer) {
|
||||
+ java.util.Locale bufLocale = buffer.adventure$locale;
|
||||
+ return LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).decode(buffer);
|
||||
+ return LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).decode(buffer);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void encode(final net.minecraft.network.FriendlyByteBuf buffer, final net.minecraft.network.chat.Component value) {
|
||||
+ public void encode(final net.minecraft.network.FriendlyByteBuf buffer, final Component value) {
|
||||
+ java.util.Locale bufLocale = buffer.adventure$locale;
|
||||
+ LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, net.minecraft.network.chat.ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).encode(buffer, value);
|
||||
+ LENIENT_JSON.apply(ByteBufCodecs.fromCodec(OPS, ComponentSerialization.localizedCodec(bufLocale == null ? java.util.Locale.US : bufLocale))).encode(buffer, value);
|
||||
+ }
|
||||
+ },
|
||||
+ // Paper end - localized codec
|
||||
|
@@ -1359,7 +1359,7 @@
|
||||
+ if (new org.bukkit.event.player.PlayerGameModeChangeEvent(this.getBukkitEntity(), org.bukkit.GameMode.getByValue(this.server.getDefaultGameType().getId()), org.bukkit.event.player.PlayerGameModeChangeEvent.Cause.DEFAULT_GAMEMODE, null).callEvent()) {
|
||||
+ this.gameMode.setGameModeForPlayer(this.server.getForcedGameType(), GameType.DEFAULT_MODE);
|
||||
+ } else {
|
||||
+ this.gameMode.setGameModeForPlayer(readPlayerMode(input,"playerGameType"), readPlayerMode(input, "previousPlayerGameType"));
|
||||
+ this.gameMode.setGameModeForPlayer(readPlayerMode(input, "playerGameType"), readPlayerMode(input, "previousPlayerGameType"));
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
|
@@ -2543,7 +2543,7 @@
|
||||
);
|
||||
} else {
|
||||
- this.server.setDifficulty(packet.difficulty(), false);
|
||||
+ // this.server.setDifficulty(packet.getDifficulty(), false); // Paper - per level difficulty; don't allow clients to change this
|
||||
+ // this.server.setDifficulty(packet.difficulty(), false); // Paper - per level difficulty; don't allow clients to change this
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -165,8 +165,8 @@
|
||||
this.getMaxPlayers(),
|
||||
- this.viewDistance,
|
||||
- this.simulationDistance,
|
||||
+ serverLevel.spigotConfig.viewDistance,// Spigot - view distance
|
||||
+ serverLevel.spigotConfig.simulationDistance,
|
||||
+ serverLevel.spigotConfig.viewDistance, // Spigot - view distance
|
||||
+ serverLevel.spigotConfig.simulationDistance, // Spigot - simulation distance
|
||||
_boolean1,
|
||||
!_boolean,
|
||||
_boolean2,
|
||||
|
@@ -1,13 +1,5 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -2,7 +_,6 @@
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
-import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.ImmutableList.Builder;
|
||||
import com.mojang.logging.LogUtils;
|
||||
import com.mojang.serialization.Codec;
|
||||
@@ -148,6 +_,106 @@
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
+ public java.util.UUID triggerEntityId;
|
||||
+ public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN;
|
||||
|
||||
+ private void loadPaperNBT(ValueInput valueInput) {
|
||||
+ valueInput.read("Paper.ExpData", net.minecraft.nbt.CompoundTag.CODEC).ifPresent(expData -> {
|
||||
+ private void loadPaperNBT(ValueInput input) {
|
||||
+ input.read("Paper.ExpData", net.minecraft.nbt.CompoundTag.CODEC).ifPresent(expData -> {
|
||||
+ this.sourceEntityId = expData.read("source", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
|
||||
+ this.triggerEntityId = expData.read("trigger", net.minecraft.core.UUIDUtil.CODEC).orElse(null);
|
||||
+ expData.getString("reason").ifPresent(reason -> {
|
||||
@@ -24,14 +24,14 @@
|
||||
+ });
|
||||
+ });
|
||||
+ }
|
||||
+ private void savePaperNBT(ValueOutput tag) {
|
||||
+ private void savePaperNBT(ValueOutput output) {
|
||||
+ net.minecraft.nbt.CompoundTag expData = new net.minecraft.nbt.CompoundTag();
|
||||
+ expData.storeNullable("source", net.minecraft.core.UUIDUtil.CODEC, this.sourceEntityId);
|
||||
+ expData.storeNullable("trigger", net.minecraft.core.UUIDUtil.CODEC, this.triggerEntityId);
|
||||
+ if (this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
||||
+ expData.putString("reason", this.spawnReason.name());
|
||||
+ }
|
||||
+ tag.store("Paper.ExpData", net.minecraft.nbt.CompoundTag.CODEC, expData);
|
||||
+ output.store("Paper.ExpData", net.minecraft.nbt.CompoundTag.CODEC, expData);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - overload ctor
|
||||
|
@@ -89,7 +89,7 @@
|
||||
+ continue;
|
||||
+ }
|
||||
+ if (!serverLevel.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER)) {
|
||||
+ // Paprt end
|
||||
+ // Paper end
|
||||
this.delay(serverLevel, pos);
|
||||
return;
|
||||
}
|
||||
|
@@ -1,10 +1,14 @@
|
||||
--- a/net/minecraft/world/level/block/LavaCauldronBlock.java
|
||||
+++ b/net/minecraft/world/level/block/LavaCauldronBlock.java
|
||||
@@ -44,6 +_,7 @@
|
||||
@@ -44,8 +_,10 @@
|
||||
|
||||
@Override
|
||||
protected void entityInside(BlockState state, Level level, BlockPos pos, Entity entity, InsideBlockEffectApplier effectApplier) {
|
||||
+ if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(level, pos)).callEvent()) { return; } // Paper - Add EntityInsideBlockEvent
|
||||
+ BlockPos savedPos = pos.immutable(); // Paper - track lava contact
|
||||
effectApplier.apply(InsideBlockEffectType.LAVA_IGNITE);
|
||||
effectApplier.runAfter(InsideBlockEffectType.LAVA_IGNITE, Entity::lavaHurt);
|
||||
- effectApplier.runAfter(InsideBlockEffectType.LAVA_IGNITE, Entity::lavaHurt);
|
||||
+ effectApplier.runAfter(InsideBlockEffectType.LAVA_IGNITE, ignitedEntity -> ignitedEntity.lavaHurt(savedPos)); // Paper - track lava contact
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -42,7 +42,7 @@
|
||||
LivingEntity livingEntity = EntityReference.get(entityReference, level, LivingEntity.class);
|
||||
- if (livingEntity != null) {
|
||||
+ if (damageTarget && livingEntity != null) { // CraftBukkit
|
||||
+ if (livingEntity.hurtServer(level, level.damageSources().magic(), 4.0F)) // CraftBukkit - move up
|
||||
+ if (livingEntity.hurtServer(level, level.damageSources().magic().eventBlockDamager(level, pos), 4.0F)) // CraftBukkit - move up
|
||||
level.playSound(
|
||||
null, livingEntity.getX(), livingEntity.getY(), livingEntity.getZ(), SoundEvents.CONDUIT_ATTACK_TARGET, SoundSource.BLOCKS, 1.0F, 1.0F
|
||||
);
|
||||
|
Reference in New Issue
Block a user