mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-01 05:47:45 +01:00
[ci skip] Add more identifying patch comments
This commit is contained in:
parent
0571a6438e
commit
db4ed47134
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
From: Mark Vainomaa <mikroskeem@mikroskeem.eu>
|
||||||
Date: Wed, 12 Sep 2018 18:53:55 +0300
|
Date: Wed, 12 Sep 2018 18:53:55 +0300
|
||||||
Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values
|
Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
||||||
@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Specific(Specific.To.NBT)
|
@Specific(Specific.To.NBT)
|
||||||
static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag");
|
static final ItemMetaKey BLOCK_DATA = new ItemMetaKey("BlockStateTag");
|
||||||
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
|
static final ItemMetaKey BUKKIT_CUSTOM_TAG = new ItemMetaKey("PublicBukkitValues");
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy");
|
+ static final ItemMetaKey CAN_DESTROY = new ItemMetaKey("CanDestroy");
|
||||||
+ static final ItemMetaKey CAN_PLACE_ON = new ItemMetaKey("CanPlaceOn");
|
+ static final ItemMetaKey CAN_PLACE_ON = new ItemMetaKey("CanPlaceOn");
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
|
|
||||||
// We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304
|
// We store the raw original JSON representation of all text data. See SPIGOT-5063, SPIGOT-5656, SPIGOT-5304
|
||||||
private String displayName;
|
private String displayName;
|
||||||
@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private int hideFlag;
|
private int hideFlag;
|
||||||
private boolean unbreakable;
|
private boolean unbreakable;
|
||||||
private int damage;
|
private int damage;
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ private Set<Namespaced> placeableKeys = Sets.newHashSet();
|
+ private Set<Namespaced> placeableKeys = Sets.newHashSet();
|
||||||
+ private Set<Namespaced> destroyableKeys = Sets.newHashSet();
|
+ private Set<Namespaced> destroyableKeys = Sets.newHashSet();
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
|
|
||||||
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
|
private static final Set<String> HANDLED_TAGS = Sets.newHashSet();
|
||||||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||||
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.hideFlag = meta.hideFlag;
|
this.hideFlag = meta.hideFlag;
|
||||||
this.unbreakable = meta.unbreakable;
|
this.unbreakable = meta.unbreakable;
|
||||||
this.damage = meta.damage;
|
this.damage = meta.damage;
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ if (meta.hasPlaceableKeys()) {
|
+ if (meta.hasPlaceableKeys()) {
|
||||||
+ this.placeableKeys = new java.util.HashSet<>(meta.placeableKeys);
|
+ this.placeableKeys = new java.util.HashSet<>(meta.placeableKeys);
|
||||||
+ }
|
+ }
|
||||||
@ -55,7 +55,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (meta.hasDestroyableKeys()) {
|
+ if (meta.hasDestroyableKeys()) {
|
||||||
+ this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
|
+ this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
this.unhandledTags.putAll(meta.unhandledTags);
|
this.unhandledTags.putAll(meta.unhandledTags);
|
||||||
this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.persistentDataContainer.put(key, compound.get(key).copy());
|
this.persistentDataContainer.put(key, compound.get(key).copy());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ if (tag.contains(CAN_DESTROY.NBT)) {
|
+ if (tag.contains(CAN_DESTROY.NBT)) {
|
||||||
+ ListTag list = tag.getList(CAN_DESTROY.NBT, CraftMagicNumbers.NBT.TAG_STRING);
|
+ ListTag list = tag.getList(CAN_DESTROY.NBT, CraftMagicNumbers.NBT.TAG_STRING);
|
||||||
+ for (int i = 0; i < list.size(); i++) {
|
+ for (int i = 0; i < list.size(); i++) {
|
||||||
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.placeableKeys.add(namespaced);
|
+ this.placeableKeys.add(namespaced);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
|
|
||||||
Set<String> keys = tag.getAllKeys();
|
Set<String> keys = tag.getAllKeys();
|
||||||
for (String key : keys) {
|
for (String key : keys) {
|
||||||
@ -95,7 +95,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.setDamage(damage);
|
this.setDamage(damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ Iterable<?> canPlaceOnSerialized = SerializableMeta.getObject(Iterable.class, map, CAN_PLACE_ON.BUKKIT, true);
|
+ Iterable<?> canPlaceOnSerialized = SerializableMeta.getObject(Iterable.class, map, CAN_PLACE_ON.BUKKIT, true);
|
||||||
+ if (canPlaceOnSerialized != null) {
|
+ if (canPlaceOnSerialized != null) {
|
||||||
+ for (Object canPlaceOnElement : canPlaceOnSerialized) {
|
+ for (Object canPlaceOnElement : canPlaceOnSerialized) {
|
||||||
@ -121,7 +121,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.destroyableKeys.add(value);
|
+ this.destroyableKeys.add(value);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+
|
+
|
||||||
String internal = SerializableMeta.getString(map, "internal", true);
|
String internal = SerializableMeta.getString(map, "internal", true);
|
||||||
if (internal != null) {
|
if (internal != null) {
|
||||||
@ -130,7 +130,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (this.hasDamage()) {
|
if (this.hasDamage()) {
|
||||||
itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage);
|
itemTag.putInt(CraftMetaItem.DAMAGE.NBT, this.damage);
|
||||||
}
|
}
|
||||||
+ // Paper start - Implement an API for CanPlaceOn and CanDestroy NBT values
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ if (hasPlaceableKeys()) {
|
+ if (hasPlaceableKeys()) {
|
||||||
+ List<String> items = this.placeableKeys.stream()
|
+ List<String> items = this.placeableKeys.stream()
|
||||||
+ .map(this::serializeNamespaced)
|
+ .map(this::serializeNamespaced)
|
||||||
@ -146,7 +146,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ itemTag.put(CAN_DESTROY.NBT, createNonComponentStringList(items));
|
+ itemTag.put(CAN_DESTROY.NBT, createNonComponentStringList(items));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
|
|
||||||
for (Map.Entry<String, Tag> e : this.unhandledTags.entrySet()) {
|
for (Map.Entry<String, Tag> e : this.unhandledTags.entrySet()) {
|
||||||
itemTag.put(e.getKey(), e.getValue());
|
itemTag.put(e.getKey(), e.getValue());
|
||||||
@ -154,7 +154,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+ static ListTag createNonComponentStringList(List<String> list) {
|
+ static ListTag createNonComponentStringList(List<String> list) {
|
||||||
+ if (list == null || list.isEmpty()) {
|
+ if (list == null || list.isEmpty()) {
|
||||||
+ return null;
|
+ return null;
|
||||||
@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
+ return tagList;
|
+ return tagList;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
+
|
+
|
||||||
ListTag createStringList(List<String> list) {
|
ListTag createStringList(List<String> list) {
|
||||||
if (list == null) {
|
if (list == null) {
|
@ -64,7 +64,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
|
+ ((java.net.InetSocketAddress)address).getAddress(), false).callEvent();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add PlayerConnectionCloseEvent
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Book size limits
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
||||||
- this.disconnect("Book edited too quickly!");
|
- this.disconnect("Book edited too quickly!");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: MisterVector <whizkid3000@hotmail.com>
|
From: MisterVector <whizkid3000@hotmail.com>
|
||||||
Date: Fri, 26 Oct 2018 21:31:00 -0700
|
Date: Fri, 26 Oct 2018 21:31:00 -0700
|
||||||
Subject: [PATCH] Implement PlayerPostRespawnEvent
|
Subject: [PATCH] Add PlayerPostRespawnEvent
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@ -12,15 +12,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
boolean flag2 = false;
|
boolean flag2 = false;
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Add PlayerPostRespawnEvent
|
||||||
+ boolean isBedSpawn = false;
|
+ boolean isBedSpawn = false;
|
||||||
+ boolean isRespawn = false;
|
+ boolean isRespawn = false;
|
||||||
+ // Paper end
|
+ // Paper end - Add PlayerPostRespawnEvent
|
||||||
+
|
+
|
||||||
// CraftBukkit start - fire PlayerRespawnEvent
|
// CraftBukkit start - fire PlayerRespawnEvent
|
||||||
if (location == null) {
|
if (location == null) {
|
||||||
- boolean isBedSpawn = false;
|
- boolean isBedSpawn = false;
|
||||||
+ // boolean isBedSpawn = false; // Paper - moved up
|
+ // boolean isBedSpawn = false; // Paper - Add PlayerPostRespawnEvent; moved up
|
||||||
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
ServerLevel worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||||
if (worldserver1 != null) {
|
if (worldserver1 != null) {
|
||||||
Optional optional;
|
Optional optional;
|
||||||
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
location = respawnEvent.getRespawnLocation();
|
location = respawnEvent.getRespawnLocation();
|
||||||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||||
+ isRespawn = true; // Paper
|
+ isRespawn = true; // Paper - Add PlayerPostRespawnEvent
|
||||||
} else {
|
} else {
|
||||||
location.setWorld(worldserver.getWorld());
|
location.setWorld(worldserver.getWorld());
|
||||||
}
|
}
|
||||||
@ -37,11 +37,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.save(entityplayer);
|
this.save(entityplayer);
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - Add PlayerPostRespawnEvent
|
||||||
+ if (isRespawn) {
|
+ if (isRespawn) {
|
||||||
+ cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn));
|
+ cserver.getPluginManager().callEvent(new com.destroystokyo.paper.event.player.PlayerPostRespawnEvent(entityplayer.getBukkitEntity(), location, isBedSpawn));
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add PlayerPostRespawnEvent
|
||||||
+
|
+
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
return entityplayer1;
|
return entityplayer1;
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private int inWaterTime;
|
private int inWaterTime;
|
||||||
public int conversionTime;
|
public int conversionTime;
|
||||||
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field
|
||||||
+ private boolean shouldBurnInDay = true; // Paper
|
+ private boolean shouldBurnInDay = true; // Paper - Add more Zombie API
|
||||||
|
|
||||||
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
public Zombie(EntityType<? extends Zombie> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
@ -22,12 +22,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
super.aiStep();
|
super.aiStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Add more Zombie API
|
||||||
+ public void stopDrowning() {
|
+ public void stopDrowning() {
|
||||||
+ this.conversionTime = -1;
|
+ this.conversionTime = -1;
|
||||||
+ this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false);
|
+ this.getEntityData().set(Zombie.DATA_DROWNED_CONVERSION_ID, false);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add more Zombie API
|
||||||
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
|
public void startUnderWaterConversion(int ticksUntilWaterConversion) {
|
||||||
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
this.lastTick = MinecraftServer.currentTick; // CraftBukkit
|
||||||
this.conversionTime = ticksUntilWaterConversion;
|
this.conversionTime = ticksUntilWaterConversion;
|
||||||
@ -36,14 +36,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
public boolean isSunSensitive() {
|
public boolean isSunSensitive() {
|
||||||
- return true;
|
- return true;
|
||||||
+ return this.shouldBurnInDay; // Paper - use api value instead
|
+ return this.shouldBurnInDay; // Paper - Add more Zombie API
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Add more Zombie API
|
||||||
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
+ public void setShouldBurnInDay(boolean shouldBurnInDay) {
|
||||||
+ this.shouldBurnInDay = shouldBurnInDay;
|
+ this.shouldBurnInDay = shouldBurnInDay;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add more Zombie API
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public boolean hurt(DamageSource source, float amount) {
|
public boolean hurt(DamageSource source, float amount) {
|
||||||
@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
|
nbt.putBoolean("CanBreakDoors", this.canBreakDoors());
|
||||||
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
nbt.putInt("InWaterTime", this.isInWater() ? this.inWaterTime : -1);
|
||||||
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
nbt.putInt("DrownedConversionTime", this.isUnderWaterConverting() ? this.conversionTime : -1);
|
||||||
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper
|
+ nbt.putBoolean("Paper.ShouldBurnInDay", this.shouldBurnInDay); // Paper - Add more Zombie API
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -60,11 +60,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
|
if (nbt.contains("DrownedConversionTime", 99) && nbt.getInt("DrownedConversionTime") > -1) {
|
||||||
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
this.startUnderWaterConversion(nbt.getInt("DrownedConversionTime"));
|
||||||
}
|
}
|
||||||
+ // Paper start
|
+ // Paper start - Add more Zombie API
|
||||||
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
+ if (nbt.contains("Paper.ShouldBurnInDay")) {
|
||||||
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
+ this.shouldBurnInDay = nbt.getBoolean("Paper.ShouldBurnInDay");
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add more Zombie API
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
|
+ this.connection.send(new ClientboundMoveVehiclePacket(entity));
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Prevent moving into unloaded chunks
|
||||||
+
|
+
|
||||||
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -61,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
|
+ this.internalTeleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot(), Collections.emptySet());
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Prevent moving into unloaded chunks
|
||||||
|
|
||||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||||
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
||||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
enuminteractionresult = InteractionResult.FAIL; // cancel placement
|
enuminteractionresult = InteractionResult.FAIL; // cancel placement
|
||||||
// PAIL: Remove this when MC-99075 fixed
|
// PAIL: Remove this when MC-99075 fixed
|
||||||
placeEvent.getPlayer().updateInventory();
|
placeEvent.getPlayer().updateInventory();
|
||||||
+ world.capturedTileEntities.clear(); // Paper - clear out tile entities as chests and such will pop loot
|
+ world.capturedTileEntities.clear(); // Paper - Allow chests to be placed with NBT data; clear out block entities as chests and such will pop loot
|
||||||
// revert back all captured blocks
|
// revert back all captured blocks
|
||||||
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
world.preventPoiUpdated = true; // CraftBukkit - SPIGOT-5710
|
||||||
for (BlockState blockstate : blocks) {
|
for (BlockState blockstate : blocks) {
|
||||||
@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public boolean onlyOpCanSetNbt() {
|
public boolean onlyOpCanSetNbt() {
|
||||||
- return true;
|
- return true;
|
||||||
+ return false; // Paper
|
+ return false; // Paper - Allow chests to be placed with NBT data
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
@ -1022,7 +1022,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
+++ b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Handle oversized block entities in chunks
|
||||||
|
|
||||||
- public ClientboundLevelChunkPacketData(LevelChunk chunk) {
|
- public ClientboundLevelChunkPacketData(LevelChunk chunk) {
|
||||||
+ // Paper start - Anti-Xray - Add chunk packet info
|
+ // Paper start - Anti-Xray - Add chunk packet info
|
||||||
@ -1046,7 +1046,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo);
|
+ extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk, chunkPacketInfo);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.blockEntitiesData = Lists.newArrayList();
|
this.blockEntitiesData = Lists.newArrayList();
|
||||||
int totalTileEntities = 0; // Paper
|
int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
@@ -0,0 +0,0 @@ public class ClientboundLevelChunkPacketData {
|
||||||
return byteBuf;
|
return byteBuf;
|
||||||
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
|
if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// Register Vanilla commands into builtRoot as before
|
// Register Vanilla commands into builtRoot as before
|
||||||
+ // Paper start - Async command map building
|
+ // Paper start - Perf: Async command map building
|
||||||
+ COMMAND_SENDING_POOL.execute(() -> {
|
+ COMMAND_SENDING_POOL.execute(() -> {
|
||||||
+ this.sendAsync(player);
|
+ this.sendAsync(player);
|
||||||
+ });
|
+ });
|
||||||
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ );
|
+ );
|
||||||
+
|
+
|
||||||
+ private void sendAsync(ServerPlayer player) {
|
+ private void sendAsync(ServerPlayer player) {
|
||||||
+ // Paper end - Async command map building
|
+ // Paper end - Perf: Async command map building
|
||||||
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
Map<CommandNode<CommandSourceStack>, CommandNode<SharedSuggestionProvider>> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues
|
||||||
RootCommandNode vanillaRoot = new RootCommandNode();
|
RootCommandNode vanillaRoot = new RootCommandNode();
|
||||||
|
|
||||||
@ -41,14 +41,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
for (CommandNode node : rootcommandnode.getChildren()) {
|
for (CommandNode node : rootcommandnode.getChildren()) {
|
||||||
bukkit.add(node.getName());
|
bukkit.add(node.getName());
|
||||||
}
|
}
|
||||||
+ // Paper start - Async command map building
|
+ // Paper start - Perf: Async command map building
|
||||||
+ net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
+ net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
||||||
+ runSync(player, bukkit, rootcommandnode);
|
+ runSync(player, bukkit, rootcommandnode);
|
||||||
+ });
|
+ });
|
||||||
+ }
|
+ }
|
||||||
|
|
||||||
+ private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
+ private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
||||||
+ // Paper end - Async command map building
|
+ // Paper end - Perf: Async command map building
|
||||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
MinecraftServer.LOGGER.info("Stopping server");
|
MinecraftServer.LOGGER.info("Stopping server");
|
||||||
+ Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Shutdown and don't bother finishing
|
+ Commands.COMMAND_SENDING_POOL.shutdownNow(); // Paper - Perf: Async command map building; Shutdown and don't bother finishing
|
||||||
MinecraftTimings.stopServer(); // Paper
|
MinecraftTimings.stopServer(); // Paper
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.server != null) {
|
if (this.server != null) {
|
||||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
FluidState fluid = this.getFluidState(pos);
|
FluidState fluid = this.getFluidState(pos);
|
||||||
+ // Paper start - while the above setAir method is named same and looks very similar
|
+ // Paper start - BlockDestroyEvent; while the above setAir method is named same and looks very similar
|
||||||
+ // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
+ // they are NOT used with same intent and the above should not fire this event. The above method is more of a BlockSetToAirEvent,
|
||||||
+ // it doesn't imply destruction of a block that plays a sound effect / drops an item.
|
+ // it doesn't imply destruction of a block that plays a sound effect / drops an item.
|
||||||
+ boolean playEffect = true;
|
+ boolean playEffect = true;
|
||||||
@ -42,12 +42,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ drop = event.willDrop();
|
+ drop = event.willDrop();
|
||||||
+ xp = event.getExpToDrop();
|
+ xp = event.getExpToDrop();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - BlockDestroyEvent
|
||||||
|
|
||||||
- if (!(iblockdata.getBlock() instanceof BaseFireBlock)) {
|
- if (!(iblockdata.getBlock() instanceof BaseFireBlock)) {
|
||||||
- this.levelEvent(2001, pos, Block.getId(iblockdata));
|
- this.levelEvent(2001, pos, Block.getId(iblockdata));
|
||||||
+ if (playEffect && !(effectType.getBlock() instanceof BaseFireBlock)) { // Paper
|
+ if (playEffect && !(effectType.getBlock() instanceof BaseFireBlock)) { // Paper - BlockDestroyEvent
|
||||||
+ this.levelEvent(2001, pos, Block.getId(effectType)); // Paper
|
+ this.levelEvent(2001, pos, Block.getId(effectType)); // Paper - BlockDestroyEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
if (drop) {
|
if (drop) {
|
||||||
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handleEditBook(ServerboundEditBookPacket packet) {
|
public void handleEditBook(ServerboundEditBookPacket packet) {
|
||||||
+ // Paper start
|
+ // Paper start - Book size limits
|
||||||
+ if (!this.cserver.isPrimaryThread()) {
|
+ if (!this.cserver.isPrimaryThread()) {
|
||||||
+ List<String> pageList = packet.getPages();
|
+ List<String> pageList = packet.getPages();
|
||||||
+ long byteTotal = 0;
|
+ long byteTotal = 0;
|
||||||
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Book size limits
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
||||||
this.disconnect("Book edited too quickly!");
|
this.disconnect("Book edited too quickly!");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Aikar <aikar@aikar.co>
|
From: Aikar <aikar@aikar.co>
|
||||||
Date: Sun, 19 Apr 2020 18:15:29 -0400
|
Date: Sun, 19 Apr 2020 18:15:29 -0400
|
||||||
Subject: [PATCH] Implement Brigadier Mojang API
|
Subject: [PATCH] Brigadier Mojang API
|
||||||
|
|
||||||
Adds AsyncPlayerSendCommandsEvent
|
Adds AsyncPlayerSendCommandsEvent
|
||||||
- Allows modifying on a per command basis what command data they see.
|
- Allows modifying on a per command basis what command data they see.
|
||||||
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import com.mojang.brigadier.Message;
|
import com.mojang.brigadier.Message;
|
||||||
|
|
||||||
-public class CommandSyntaxException extends Exception {
|
-public class CommandSyntaxException extends Exception {
|
||||||
+public class CommandSyntaxException extends Exception implements net.kyori.adventure.util.ComponentMessageThrowable { // Paper
|
+public class CommandSyntaxException extends Exception implements net.kyori.adventure.util.ComponentMessageThrowable { // Paper - Brigadier API
|
||||||
public static final int CONTEXT_AMOUNT = 10;
|
public static final int CONTEXT_AMOUNT = 10;
|
||||||
public static boolean ENABLE_COMMAND_STACK_TRACES = true;
|
public static boolean ENABLE_COMMAND_STACK_TRACES = true;
|
||||||
public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions();
|
public static BuiltInExceptionProvider BUILT_IN_EXCEPTIONS = new BuiltInExceptions();
|
||||||
@ -39,12 +39,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - Brigadier API
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component componentMessage() {
|
+ public @org.jetbrains.annotations.Nullable net.kyori.adventure.text.Component componentMessage() {
|
||||||
+ return io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(this.message);
|
+ return io.papermc.paper.brigadier.PaperBrigadier.componentFromMessage(this.message);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Brigadier API
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private final RedirectModifier<S> modifier;
|
private final RedirectModifier<S> modifier;
|
||||||
private final boolean forks;
|
private final boolean forks;
|
||||||
private Command<S> command;
|
private Command<S> command;
|
||||||
+ public LiteralCommandNode<CommandSourceStack> clientNode = null; // Paper
|
+ public LiteralCommandNode<CommandSourceStack> clientNode; // Paper - Brigadier API
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public void removeCommand(String name) {
|
public void removeCommand(String name) {
|
||||||
this.children.remove(name);
|
this.children.remove(name);
|
||||||
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
|
import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
|
||||||
|
|
||||||
-public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
|
-public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider {
|
||||||
+public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper
|
+public class CommandSourceStack implements ExecutionCommandSource<CommandSourceStack>, SharedSuggestionProvider, com.destroystokyo.paper.brigadier.BukkitBrigadierCommandSource { // Paper - Brigadier API
|
||||||
|
|
||||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
|
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(Component.translatable("permissions.requires.player"));
|
||||||
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
|
public static final SimpleCommandExceptionType ERROR_NOT_ENTITY = new SimpleCommandExceptionType(Component.translatable("permissions.requires.entity"));
|
||||||
@ -75,7 +75,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return this.textName;
|
return this.textName;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Brigadier API
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public org.bukkit.entity.Entity getBukkitEntity() {
|
+ public org.bukkit.entity.Entity getBukkitEntity() {
|
||||||
+ return getEntity() != null ? getEntity().getBukkitEntity() : null;
|
+ return getEntity() != null ? getEntity().getBukkitEntity() : null;
|
||||||
@ -93,7 +93,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ Vec2 rot = getRotation();
|
+ Vec2 rot = getRotation();
|
||||||
+ return world != null && pos != null ? new org.bukkit.Location(world, pos.x, pos.y, pos.z, rot != null ? rot.y : 0, rot != null ? rot.x : 0) : null;
|
+ return world != null && pos != null ? new org.bukkit.Location(world, pos.x, pos.y, pos.z, rot != null ? rot.y : 0, rot != null ? rot.x : 0) : null;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Brigadier API
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(int level) {
|
public boolean hasPermission(int level) {
|
||||||
@ -105,16 +105,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
bukkit.add(node.getName());
|
bukkit.add(node.getName());
|
||||||
}
|
}
|
||||||
// Paper start - Async command map building
|
// Paper start - Perf: Async command map building
|
||||||
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
|
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API
|
||||||
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
net.minecraft.server.MinecraftServer.getServer().execute(() -> {
|
||||||
runSync(player, bukkit, rootcommandnode);
|
runSync(player, bukkit, rootcommandnode);
|
||||||
});
|
});
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
|
|
||||||
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
private void runSync(ServerPlayer player, Collection<String> bukkit, RootCommandNode<SharedSuggestionProvider> rootcommandnode) {
|
||||||
// Paper end - Async command map building
|
// Paper end - Perf: Async command map building
|
||||||
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper
|
+ new com.destroystokyo.paper.event.brigadier.AsyncPlayerSendCommandsEvent<CommandSourceStack>(player.getBukkitEntity(), (RootCommandNode) rootcommandnode, false).callEvent(); // Paper - Brigadier API
|
||||||
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
PlayerCommandSendEvent event = new PlayerCommandSendEvent(player.getBukkitEntity(), new LinkedHashSet<>(bukkit));
|
||||||
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
event.getPlayer().getServer().getPluginManager().callEvent(event);
|
||||||
|
|
||||||
@ -122,11 +122,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
+ // Paper start
|
+ // Paper start - Brigadier API
|
||||||
+ if (commandnode2.clientNode != null) {
|
+ if (commandnode2.clientNode != null) {
|
||||||
+ commandnode2 = commandnode2.clientNode;
|
+ commandnode2 = commandnode2.clientNode;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Brigadier API
|
||||||
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
|
if ( !org.spigotmc.SpigotConfig.sendNamespaced && commandnode2.getName().contains( ":" ) ) continue; // Spigot
|
||||||
|
|
||||||
if (commandnode2.canUse(source)) {
|
if (commandnode2.canUse(source)) {
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
--- a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
+++ b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
@@ -0,0 +0,0 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit
|
||||||
this.recipeType = recipeType; // Paper
|
this.recipeType = recipeType; // Paper - cook speed multiplier API
|
||||||
}
|
}
|
||||||
|
|
||||||
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
|
+ private static Map<Item, Integer> cachedBurnDurations = null; // Paper - cache burn durations
|
||||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setUsingWhiteList(boolean whitelistEnabled) {
|
public void setUsingWhiteList(boolean whitelistEnabled) {
|
||||||
+ new com.destroystokyo.paper.event.server.WhitelistToggleEvent(whitelistEnabled).callEvent();
|
+ new com.destroystokyo.paper.event.server.WhitelistToggleEvent(whitelistEnabled).callEvent(); // Paper - WhitelistToggleEvent
|
||||||
this.doWhiteList = whitelistEnabled;
|
this.doWhiteList = whitelistEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
this.camera = (Entity) (entity == null ? this : entity);
|
this.camera = (Entity) (entity == null ? this : entity);
|
||||||
if (entity1 != this.camera) {
|
if (entity1 != this.camera) {
|
||||||
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity Event
|
+ // Paper start - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity
|
||||||
+ if (this.camera == this) {
|
+ if (this.camera == this) {
|
||||||
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
|
+ com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent playerStopSpectatingEntityEvent = new com.destroystokyo.paper.event.player.PlayerStopSpectatingEntityEvent(this.getBukkitEntity(), entity1.getBukkitEntity());
|
||||||
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
|
+ if (!playerStopSpectatingEntityEvent.callEvent()) {
|
||||||
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Add PlayerStartSpectatingEntityEvent and PlayerStopSpectatingEntity
|
||||||
Level world = this.camera.level();
|
Level world = this.camera.level();
|
||||||
|
|
||||||
if (world instanceof ServerLevel) {
|
if (world instanceof ServerLevel) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||||
Date: Sat, 22 Sep 2018 15:56:59 -0400
|
Date: Sat, 22 Sep 2018 15:56:59 -0400
|
||||||
Subject: [PATCH] Catch JsonParseException in Entity and TE names
|
Subject: [PATCH] Catch JsonParseException in entity and block entity names
|
||||||
|
|
||||||
As a result, data that no longer parses correctly will not crash the server
|
As a result, data that no longer parses correctly will not crash the server
|
||||||
instead just logging the exception and continuing (and in most cases should
|
instead just logging the exception and continuing (and in most cases should
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
|
this.targetSelector.addGoal(1, (new HurtByTargetGoal(this, new Class[]{Drowned.class})).setAlertOthers(ZombifiedPiglin.class));
|
||||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
|
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, 10, true, false, this::okTarget));
|
||||||
- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false));
|
- this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false));
|
||||||
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper
|
+ if (this.level().spigotConfig.zombieAggressiveTowardsVillager) this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); // Paper - Check drowned for villager aggression config
|
||||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true));
|
||||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false));
|
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, Axolotl.class, true, false));
|
||||||
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
|
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
|
||||||
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
||||||
this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
|
this.destroyableKeys = new java.util.HashSet<>(meta.destroyableKeys);
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Add API for CanPlaceOn and CanDestroy NBT values
|
||||||
- this.unhandledTags.putAll(meta.unhandledTags);
|
- this.unhandledTags.putAll(meta.unhandledTags);
|
||||||
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
- this.persistentDataContainer.putAll(meta.persistentDataContainer.getRaw());
|
||||||
+ // Paper start - Deep clone unhandled nbt tags
|
+ // Paper start - Deep clone unhandled nbt tags
|
||||||
|
@ -14,8 +14,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (this.hasDelayedDestroy) {
|
if (this.hasDelayedDestroy) {
|
||||||
- iblockdata = this.level.getBlockState(this.delayedDestroyPos);
|
- iblockdata = this.level.getBlockState(this.delayedDestroyPos);
|
||||||
- if (iblockdata.isAir()) {
|
- if (iblockdata.isAir()) {
|
||||||
+ iblockdata = this.level.getBlockStateIfLoaded(this.delayedDestroyPos); // Paper
|
+ iblockdata = this.level.getBlockStateIfLoaded(this.delayedDestroyPos); // Paper - Don't allow digging into unloaded chunks
|
||||||
+ if (iblockdata == null || iblockdata.isAir()) { // Paper
|
+ if (iblockdata == null || iblockdata.isAir()) { // Paper - Don't allow digging into unloaded chunks
|
||||||
this.hasDelayedDestroy = false;
|
this.hasDelayedDestroy = false;
|
||||||
} else {
|
} else {
|
||||||
float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart);
|
float f = this.incrementDestroyProgress(iblockdata, this.delayedDestroyPos, this.delayedTickStart);
|
||||||
@ -24,13 +24,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
} else if (this.isDestroyingBlock) {
|
} else if (this.isDestroyingBlock) {
|
||||||
- iblockdata = this.level.getBlockState(this.destroyPos);
|
- iblockdata = this.level.getBlockState(this.destroyPos);
|
||||||
+ // Paper start - don't want to do same logic as above, return instead
|
+ // Paper start - Don't allow digging into unloaded chunks; don't want to do same logic as above, return instead
|
||||||
+ iblockdata = this.level.getBlockStateIfLoaded(this.destroyPos);
|
+ iblockdata = this.level.getBlockStateIfLoaded(this.destroyPos);
|
||||||
+ if (iblockdata == null) {
|
+ if (iblockdata == null) {
|
||||||
+ this.isDestroyingBlock = false;
|
+ this.isDestroyingBlock = false;
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Don't allow digging into unloaded chunks
|
||||||
if (iblockdata.isAir()) {
|
if (iblockdata.isAir()) {
|
||||||
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
|
this.level.destroyBlockProgress(this.player.getId(), this.destroyPos, -1);
|
||||||
this.lastSentState = -1;
|
this.lastSentState = -1;
|
||||||
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
|
public void handleBlockBreakAction(BlockPos pos, ServerboundPlayerActionPacket.Action action, Direction direction, int worldHeight, int sequence) {
|
||||||
if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
|
if (this.player.getEyePosition().distanceToSqr(Vec3.atCenterOf(pos)) > ServerGamePacketListenerImpl.MAX_INTERACTION_DISTANCE) {
|
||||||
+ if (true) return; // Paper - Don't notify if unreasonably far away
|
+ if (true) return; // Paper - Don't allow digging into unloaded chunks; Don't notify if unreasonably far away
|
||||||
this.debugLogging(pos, false, sequence, "too far");
|
this.debugLogging(pos, false, sequence, "too far");
|
||||||
} else if (pos.getY() >= worldHeight) {
|
} else if (pos.getY() >= worldHeight) {
|
||||||
this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos)));
|
this.player.connection.send(new ClientboundBlockUpdatePacket(pos, this.level.getBlockState(pos)));
|
||||||
@ -66,12 +66,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
case START_DESTROY_BLOCK:
|
case START_DESTROY_BLOCK:
|
||||||
case ABORT_DESTROY_BLOCK:
|
case ABORT_DESTROY_BLOCK:
|
||||||
case STOP_DESTROY_BLOCK:
|
case STOP_DESTROY_BLOCK:
|
||||||
+ // Paper start - Don't allow digging in unloaded chunks
|
+ // Paper start - Don't allow digging into unloaded chunks
|
||||||
+ if (this.player.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
|
+ if (this.player.level().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) {
|
||||||
+ this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
+ this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Don't allow digging in unloaded chunks
|
+ // Paper end - Don't allow digging into unloaded chunks
|
||||||
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence());
|
this.player.gameMode.handleBlockBreakAction(blockposition, packetplayinblockdig_enumplayerdigtype, packet.getDirection(), this.player.level().getMaxBuildHeight(), packet.getSequence());
|
||||||
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
this.player.connection.ackBlockChangesUpTo(packet.getSequence());
|
||||||
return;
|
return;
|
||||||
|
@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
@@ -0,0 +0,0 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||||
Entity entity = this.getVehicle();
|
Entity entity = this.getVehicle();
|
||||||
|
|
||||||
super.stopRiding(suppressCancellation); // Paper - suppress
|
super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||||
- if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
|
- if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
|
||||||
+ if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen
|
+ if (entity != null && entity != this.getVehicle() && !this.level().isClientSide && entity.valid) { // Paper - don't process on world gen
|
||||||
this.dismountVehicle(entity);
|
this.dismountVehicle(entity);
|
||||||
|
@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
// Paper start
|
// Paper start - Entity#getEntitySpawnReason
|
||||||
if (nbttagcompound == null) {
|
if (nbttagcompound == null) {
|
||||||
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Entity#getEntitySpawnReason
|
||||||
player.setServerLevel(worldserver1);
|
player.setServerLevel(worldserver1);
|
||||||
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
.collect(Collectors.toSet());
|
.collect(Collectors.toSet());
|
||||||
|
|
||||||
final int page = 0;
|
final int page = 0;
|
||||||
+ boolean hasRequested = false; // Paper
|
+ boolean hasRequested = false; // Paper - Don't sleep after profile lookups if not needed
|
||||||
|
|
||||||
for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) {
|
for (final List<String> request : Iterables.partition(criteria, ENTRIES_PER_PAGE)) {
|
||||||
final List<String> normalizedRequest = request.stream().map(YggdrasilGameProfileRepository::normalizeName).toList();
|
final List<String> normalizedRequest = request.stream().map(YggdrasilGameProfileRepository::normalizeName).toList();
|
||||||
@ -22,12 +22,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
LOGGER.debug("Couldn't find profile {}", name);
|
LOGGER.debug("Couldn't find profile {}", name);
|
||||||
callback.onProfileLookupFailed(name, new ProfileNotFoundException("Server did not find the requested profile"));
|
callback.onProfileLookupFailed(name, new ProfileNotFoundException("Server did not find the requested profile"));
|
||||||
}
|
}
|
||||||
+ // Paper start
|
+ // Paper start - Don't sleep after profile lookups if not needed
|
||||||
+ if (!hasRequested) {
|
+ if (!hasRequested) {
|
||||||
+ hasRequested = true;
|
+ hasRequested = true;
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Don't sleep after profile lookups if not needed
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(DELAY_BETWEEN_PAGES);
|
Thread.sleep(DELAY_BETWEEN_PAGES);
|
||||||
|
@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
// Paper end
|
// Paper end - Book size limits
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
||||||
- this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
- this.disconnect("Book edited too quickly!", org.bukkit.event.player.PlayerKickEvent.Cause.ILLEGAL_ACTION); // Paper - kick event cause
|
||||||
|
@ -220,15 +220,6 @@ diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.ja
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal {
|
|
||||||
protected int nextStartTick;
|
|
||||||
protected int tryTicks;
|
|
||||||
private int maxStayTicks;
|
|
||||||
- protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
|
|
||||||
+ protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } @Deprecated public void setTargetPosition(BlockPos pos) { this.blockPos = pos; mob.movingTarget = pos != BlockPos.ZERO ? pos : null; } // Paper - OBFHELPER
|
|
||||||
private boolean reachedTarget;
|
|
||||||
private final int searchRange;
|
|
||||||
private final int verticalSearchRange;
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal {
|
@@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal {
|
||||||
public MoveToBlockGoal(PathfinderMob mob, double speed, int range) {
|
public MoveToBlockGoal(PathfinderMob mob, double speed, int range) {
|
||||||
this(mob, speed, range, 1);
|
this(mob, speed, range, 1);
|
||||||
@ -237,7 +228,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ @Override
|
+ @Override
|
||||||
+ public void stop() {
|
+ public void stop() {
|
||||||
+ super.stop();
|
+ super.stop();
|
||||||
+ setTargetPosition(BlockPos.ZERO);
|
+ this.blockPos = BlockPos.ZERO;
|
||||||
|
+ this.mob.movingTarget = null;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
@ -247,7 +239,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
|
mutableBlockPos.setWithOffset(blockPos, m, k - 1, n);
|
||||||
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
|
if (this.mob.isWithinRestriction(mutableBlockPos) && this.isValidTarget(this.mob.level(), mutableBlockPos)) {
|
||||||
this.blockPos = mutableBlockPos;
|
this.blockPos = mutableBlockPos;
|
||||||
+ setTargetPosition(mutableBlockPos.immutable()); // Paper
|
+ this.mob.movingTarget = mutableBlockPos == BlockPos.ZERO ? null : mutableBlockPos.immutable(); // Paper
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
ServerLevel worldserver = source.getLevel();
|
ServerLevel worldserver = source.getLevel();
|
||||||
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
|
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1, worldserver, (entity1) -> {
|
||||||
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
|
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
|
||||||
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper
|
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason
|
||||||
return entity1;
|
return entity1;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
+ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper
|
+ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||||
if (entity.isRemoved()) {
|
if (entity.isRemoved()) {
|
||||||
// Paper start
|
// Paper start
|
||||||
if (DEBUG_ENTITIES) {
|
if (DEBUG_ENTITIES) {
|
||||||
@ -41,11 +41,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
worldserver1 = worldserver;
|
worldserver1 = worldserver;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Entity#getEntitySpawnReason
|
||||||
+ if (nbttagcompound == null) {
|
+ if (nbttagcompound == null) {
|
||||||
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Entity#getEntitySpawnReason
|
||||||
player.setServerLevel(worldserver1);
|
player.setServerLevel(worldserver1);
|
||||||
String s1 = connection.getLoggableAddress(this.server.logIPs());
|
String s1 = connection.getLoggableAddress(this.server.logIPs());
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
ServerLevel finalWorldServer = worldserver1;
|
ServerLevel finalWorldServer = worldserver1;
|
||||||
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
|
Entity entity = EntityType.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
|
||||||
- return !finalWorldServer.addWithUUID(entity1) ? null : entity1;
|
- return !finalWorldServer.addWithUUID(entity1) ? null : entity1;
|
||||||
+ return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper
|
+ return !finalWorldServer.addWithUUID(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - Entity#getEntitySpawnReason
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper
|
+ public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||||
|
|
||||||
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
||||||
private CraftEntity bukkitEntity;
|
private CraftEntity bukkitEntity;
|
||||||
@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
entity.spawnedViaMobSpawner = true; // Paper
|
entity.spawnedViaMobSpawner = true; // Paper
|
||||||
+ entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper
|
+ entity.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER; // Paper - Entity#getEntitySpawnReason
|
||||||
flag = true; // Paper
|
flag = true; // Paper
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
||||||
@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
private boolean trySummonWarden(ServerLevel world) {
|
private boolean trySummonWarden(ServerLevel world) {
|
||||||
- return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent();
|
- return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER).isPresent();
|
||||||
+ return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper
|
+ return this.warningLevel < 4 ? false : SpawnUtil.trySpawnMob(EntityType.WARDEN, MobSpawnType.TRIGGERED, world, this.getBlockPos(), 20, 5, 6, SpawnUtil.Strategy.ON_TOP_OF_COLLIDER, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL, null).isPresent(); // Paper - Entity#getEntitySpawnReason
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -37,12 +37,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
|
|
||||||
// Paper start
|
// Paper start - Add PlayerPostRespawnEvent
|
||||||
boolean isBedSpawn = false;
|
boolean isBedSpawn = false;
|
||||||
+ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
|
+ boolean isAnchorSpawn = false; // Paper - Fix PlayerRespawnEvent
|
||||||
boolean isRespawn = false;
|
boolean isRespawn = false;
|
||||||
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
|
boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
|
||||||
// Paper end
|
// Paper end - Add PlayerPostRespawnEvent
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
if (optional.isPresent()) {
|
if (optional.isPresent()) {
|
||||||
BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
BlockState iblockdata = worldserver1.getBlockState(blockposition);
|
||||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.dataOutputStream.write(0);
|
this.dataOutputStream.write(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - unchecked exception variant to use in Stream API
|
+ // Paper start - Fire event on GS4 query
|
||||||
+ public void writeStringUnchecked(String string) {
|
+ public void writeStringUnchecked(String string) {
|
||||||
+ try {
|
+ try {
|
||||||
+ writeString(string);
|
+ writeString(string);
|
||||||
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e);
|
+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Fire event on GS4 query
|
||||||
+
|
+
|
||||||
public void write(int value) throws IOException {
|
public void write(int value) throws IOException {
|
||||||
this.dataOutputStream.write(value);
|
this.dataOutputStream.write(value);
|
||||||
|
@ -14,11 +14,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
// Paper start
|
// Paper start - Add PlayerPostRespawnEvent
|
||||||
boolean isBedSpawn = false;
|
boolean isBedSpawn = false;
|
||||||
boolean isRespawn = false;
|
boolean isRespawn = false;
|
||||||
+ boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
|
+ boolean isLocAltered = false; // Paper - Fix SPIGOT-5989
|
||||||
// Paper end
|
// Paper end - Add PlayerPostRespawnEvent
|
||||||
|
|
||||||
// CraftBukkit start - fire PlayerRespawnEvent
|
// CraftBukkit start - fire PlayerRespawnEvent
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end - Fix SPIGOT-5989
|
+ // Paper end - Fix SPIGOT-5989
|
||||||
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||||
isRespawn = true; // Paper
|
isRespawn = true; // Paper - Add PlayerPostRespawnEvent
|
||||||
} else {
|
} else {
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
} else if (iblockdata.is(Blocks.KELP) || iblockdata.is(Blocks.KELP_PLANT) || iblockdata.is(Blocks.SEAGRASS) || iblockdata.is(Blocks.TALL_SEAGRASS)) {
|
||||||
BlockEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
BlockEntity tileentity = iblockdata.hasBlockEntity() ? world.getBlockEntity(blockposition1) : null;
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Fix SpongeAbsortEvent handling
|
||||||
+ if (block.getHandle().isAir()) {
|
+ if (block.getHandle().isAir()) {
|
||||||
dropResources(iblockdata, world, blockposition1, tileentity);
|
dropResources(iblockdata, world, blockposition1, tileentity);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Fix SpongeAbsortEvent handling
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
world.setBlock(blockposition1, block.getHandle(), block.getFlag());
|
world.setBlock(blockposition1, block.getHandle(), block.getFlag());
|
||||||
|
@ -45,7 +45,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
|
+ boolean registeredAskServerSuggestionsForTree = false; // Paper - tell clients to ask server for suggestions for EntityArguments
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
CommandNode<CommandSourceStack> commandnode2 = (CommandNode) iterator.next();
|
||||||
// Paper start
|
// Paper start - Brigadier API
|
||||||
@@ -0,0 +0,0 @@ public class Commands {
|
@@ -0,0 +0,0 @@ public class Commands {
|
||||||
|
|
||||||
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
if (requiredargumentbuilder.getSuggestionsProvider() != null) {
|
||||||
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
|
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) {
|
||||||
+ // Paper start
|
+ // Paper start - Handle large packets disconnecting client
|
||||||
+ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException packetTooLargeException) {
|
+ if (throwable instanceof io.netty.handler.codec.EncoderException && throwable.getCause() instanceof PacketEncoder.PacketTooLargeException packetTooLargeException) {
|
||||||
+ final Packet<?> packet = packetTooLargeException.getPacket();
|
+ final Packet<?> packet = packetTooLargeException.getPacket();
|
||||||
+ final io.netty.util.Attribute<ConnectionProtocol.CodecData<?>> codecDataAttribute = channelhandlercontext.channel().attr(packetTooLargeException.codecKey);
|
+ final io.netty.util.Attribute<ConnectionProtocol.CodecData<?>> codecDataAttribute = channelhandlercontext.channel().attr(packetTooLargeException.codecKey);
|
||||||
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ throwable = throwable.getCause();
|
+ throwable = throwable.getCause();
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Handle large packets disconnecting client
|
||||||
if (throwable instanceof SkipPacketException) {
|
if (throwable instanceof SkipPacketException) {
|
||||||
Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause());
|
Connection.LOGGER.debug("Skipping packet due to errors", throwable.getCause());
|
||||||
} else {
|
} else {
|
||||||
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
packet.write(friendlyByteBuf);
|
packet.write(friendlyByteBuf);
|
||||||
int k = friendlyByteBuf.writerIndex() - j;
|
int k = friendlyByteBuf.writerIndex() - j;
|
||||||
- if (k > 8388608) {
|
- if (k > 8388608) {
|
||||||
+ if (false && k > 8388608) { // Paper - disable
|
+ if (false && k > 8388608) { // Paper - Handle large packets disconnecting client; disable
|
||||||
throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
|
throw new IllegalArgumentException("Packet too big (is " + k + ", should be less than 8388608): " + packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +50,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
throw var13;
|
throw var13;
|
||||||
} finally {
|
} finally {
|
||||||
+ // Paper start
|
+ // Paper start - Handle large packets disconnecting client
|
||||||
+ int packetLength = friendlyByteBuf.readableBytes();
|
+ int packetLength = friendlyByteBuf.readableBytes();
|
||||||
+ if (packetLength > MAX_PACKET_SIZE) {
|
+ if (packetLength > MAX_PACKET_SIZE) {
|
||||||
+ throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
+ throw new PacketTooLargeException(packet, this.codecKey, packetLength);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Handle large packets disconnecting client
|
||||||
ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
ProtocolSwapHandler.swapProtocolIfNeeded(attribute, packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ Subject: [PATCH] Handle Oversized Tile Entities in chunks
|
|||||||
Splits out Extra Packets if too many TE's are encountered to prevent
|
Splits out Extra Packets if too many TE's are encountered to prevent
|
||||||
creating too large of a packet to sed.
|
creating too large of a packet to sed.
|
||||||
|
|
||||||
Co authored by Spottedleaf
|
Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
diff --git a/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/src/main/java/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
@ -16,14 +16,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private final CompoundTag heightmaps;
|
private final CompoundTag heightmaps;
|
||||||
private final byte[] buffer;
|
private final byte[] buffer;
|
||||||
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
|
private final List<ClientboundLevelChunkPacketData.BlockEntityInfo> blockEntitiesData;
|
||||||
+ // Paper start
|
+ // Paper start - Handle oversized block entities in chunks
|
||||||
+ private final java.util.List<net.minecraft.network.protocol.Packet<?>> extraPackets = new java.util.ArrayList<>();
|
+ private final java.util.List<net.minecraft.network.protocol.Packet<?>> extraPackets = new java.util.ArrayList<>();
|
||||||
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
|
+ private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750);
|
||||||
+
|
+
|
||||||
+ public List<net.minecraft.network.protocol.Packet<?>> getExtraPackets() {
|
+ public List<net.minecraft.network.protocol.Packet<?>> getExtraPackets() {
|
||||||
+ return this.extraPackets;
|
+ return this.extraPackets;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Handle oversized block entities in chunks
|
||||||
|
|
||||||
public ClientboundLevelChunkPacketData(LevelChunk chunk) {
|
public ClientboundLevelChunkPacketData(LevelChunk chunk) {
|
||||||
this.heightmaps = new CompoundTag();
|
this.heightmaps = new CompoundTag();
|
||||||
@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.buffer = new byte[calculateChunkSize(chunk)];
|
this.buffer = new byte[calculateChunkSize(chunk)];
|
||||||
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
|
extractChunkData(new FriendlyByteBuf(this.getWriteBuffer()), chunk);
|
||||||
this.blockEntitiesData = Lists.newArrayList();
|
this.blockEntitiesData = Lists.newArrayList();
|
||||||
+ int totalTileEntities = 0; // Paper
|
+ int totalTileEntities = 0; // Paper - Handle oversized block entities in chunks
|
||||||
|
|
||||||
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
for(Map.Entry<BlockPos, BlockEntity> entry2 : chunk.getBlockEntities().entrySet()) {
|
||||||
+ // Paper start
|
+ // Paper start - Handle oversized block entities in chunks
|
||||||
+ if (++totalTileEntities > TE_LIMIT) {
|
+ if (++totalTileEntities > TE_LIMIT) {
|
||||||
+ var packet = entry2.getValue().getUpdatePacket();
|
+ var packet = entry2.getValue().getUpdatePacket();
|
||||||
+ if (packet != null) {
|
+ if (packet != null) {
|
||||||
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Handle oversized block entities in chunks
|
||||||
this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue()));
|
this.blockEntitiesData.add(ClientboundLevelChunkPacketData.BlockEntityInfo.create(entry2.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,10 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return this.lightData;
|
return this.lightData;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - handle over-sized TE packets
|
+ // Paper start - Handle oversized block entities in chunks
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public java.util.List<Packet<?>> getExtraPackets() {
|
+ public java.util.List<Packet<?>> getExtraPackets() {
|
||||||
+ return this.chunkData.getExtraPackets();
|
+ return this.chunkData.getExtraPackets();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Handle oversized block entities in chunks
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ageUp(int age, boolean overGrow) {
|
public void ageUp(int age, boolean overGrow) {
|
||||||
+ if (this.ageLocked) return; // Paper - GH-1459
|
+ if (this.ageLocked) return; // Paper - Honor ageLock
|
||||||
int j = this.getAge();
|
int j = this.getAge();
|
||||||
int k = j;
|
int k = j;
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void setBeeReleaseData(int ticks, Bee bee) {
|
private static void setBeeReleaseData(int ticks, Bee bee) {
|
||||||
+ if (!bee.ageLocked) { // Paper - respect age lock
|
+ if (!bee.ageLocked) { // Paper - Honor ageLock
|
||||||
int j = bee.getAge();
|
int j = bee.getAge();
|
||||||
|
|
||||||
if (j < 0) {
|
if (j < 0) {
|
||||||
@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
} else if (j > 0) {
|
} else if (j > 0) {
|
||||||
bee.setAge(Math.max(0, j - ticks));
|
bee.setAge(Math.max(0, j - ticks));
|
||||||
}
|
}
|
||||||
+ } // Paper - respect age lock
|
+ } // Paper - Honor ageLock
|
||||||
|
|
||||||
bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticks));
|
bee.setInLoveTime(Math.max(0, bee.getInLoveTime() - ticks));
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ // Paper end - Add fail move event
|
+ // Paper end - Add fail move event
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Prevent moving into unloaded chunks
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
|
|
||||||
|
@ -3,12 +3,10 @@ From: Tassu <git@tassu.me>
|
|||||||
Date: Thu, 13 Sep 2018 08:45:21 +0300
|
Date: Thu, 13 Sep 2018 08:45:21 +0300
|
||||||
Subject: [PATCH] Implement furnace cook speed multiplier API
|
Subject: [PATCH] Implement furnace cook speed multiplier API
|
||||||
|
|
||||||
Signed-off-by: Tassu <git@tassu.me>
|
|
||||||
|
|
||||||
Fixed an issue where a furnace's cook-speed multiplier rounds down
|
Fixed an issue where a furnace's cook-speed multiplier rounds down
|
||||||
to the nearest Integer when updating its current cook time.
|
to the nearest Integer when updating its current cook time.
|
||||||
|
|
||||||
Modified by: Eric Su <ericsu@alumni.usc.edu>
|
Co-authored-by: Eric Su <ericsu@alumni.usc.edu>
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
diff --git a/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
@ -24,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
protected final ContainerData dataAccess;
|
protected final ContainerData dataAccess;
|
||||||
public final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
|
public final Object2IntOpenHashMap<ResourceLocation> recipesUsed;
|
||||||
private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck;
|
private final RecipeManager.CachedCheck<Container, ? extends AbstractCookingRecipe> quickCheck;
|
||||||
+ public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper
|
+ public final RecipeType<? extends AbstractCookingRecipe> recipeType; // Paper - cook speed multiplier API
|
||||||
|
|
||||||
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
|
protected AbstractFurnaceBlockEntity(BlockEntityType<?> blockEntityType, BlockPos pos, BlockState state, RecipeType<? extends AbstractCookingRecipe> recipeType) {
|
||||||
super(blockEntityType, pos, state);
|
super(blockEntityType, pos, state);
|
||||||
@ -32,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
};
|
};
|
||||||
this.recipesUsed = new Object2IntOpenHashMap();
|
this.recipesUsed = new Object2IntOpenHashMap();
|
||||||
this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
|
this.quickCheck = RecipeManager.createCheck((RecipeType<AbstractCookingRecipe>) recipeType); // CraftBukkit - decompile error // Eclipse fail
|
||||||
+ this.recipeType = recipeType; // Paper
|
+ this.recipeType = recipeType; // Paper - cook speed multiplier API
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<Item, Integer> getFuel() {
|
public static Map<Item, Integer> getFuel() {
|
||||||
@ -40,11 +38,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
|
this.recipesUsed.put(new ResourceLocation(s), nbttagcompound1.getInt(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - cook speed API
|
+ // Paper start - cook speed multiplier API
|
||||||
+ if (nbt.contains("Paper.CookSpeedMultiplier")) {
|
+ if (nbt.contains("Paper.CookSpeedMultiplier")) {
|
||||||
+ this.cookSpeedMultiplier = nbt.getDouble("Paper.CookSpeedMultiplier");
|
+ this.cookSpeedMultiplier = nbt.getDouble("Paper.CookSpeedMultiplier");
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - cook speed multiplier API
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -73,7 +71,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (blockEntity.cookingProgress >= blockEntity.cookingTotalTime) { // Paper - cook speed multiplier API
|
+ if (blockEntity.cookingProgress >= blockEntity.cookingTotalTime) { // Paper - cook speed multiplier API
|
||||||
blockEntity.cookingProgress = 0;
|
blockEntity.cookingProgress = 0;
|
||||||
- blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity);
|
- blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity);
|
||||||
+ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper
|
+ blockEntity.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(world, blockEntity.recipeType, blockEntity, blockEntity.cookSpeedMultiplier); // Paper - cook speed multiplier API
|
||||||
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit
|
if (AbstractFurnaceBlockEntity.burn(blockEntity.level, blockEntity.worldPosition, world.registryAccess(), recipeholder, blockEntity.items, i)) { // CraftBukkit
|
||||||
blockEntity.setRecipeUsed(recipeholder);
|
blockEntity.setRecipeUsed(recipeholder);
|
||||||
}
|
}
|
||||||
@ -86,12 +84,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> {
|
- return (Integer) furnace.quickCheck.getRecipeFor(furnace, world).map((recipeholder) -> {
|
||||||
- return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime();
|
- return ((AbstractCookingRecipe) recipeholder.value()).getCookingTime();
|
||||||
- }).orElse(200);
|
- }).orElse(200);
|
||||||
+ // Paper start
|
+ // Paper start - cook speed multiplier API
|
||||||
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) {
|
+ public static int getTotalCookTime(@Nullable Level world, RecipeType<? extends AbstractCookingRecipe> recipeType, AbstractFurnaceBlockEntity furnace, double cookSpeedMultiplier) {
|
||||||
+ /* Scale the recipe's cooking time to the current cookSpeedMultiplier */
|
+ /* Scale the recipe's cooking time to the current cookSpeedMultiplier */
|
||||||
+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200));
|
+ int cookTime = world != null ? furnace.quickCheck.getRecipeFor(furnace, world).map(holder -> holder.value().getCookingTime()).orElse(200) : (net.minecraft.server.MinecraftServer.getServer().getRecipeManager().getRecipeFor(recipeType, furnace, world /* passing a null level here is safe. world is only used for map extending recipes which won't happen here */).map(holder -> holder.value().getCookingTime()).orElse(200));
|
||||||
+ return (int) Math.ceil (cookTime / cookSpeedMultiplier);
|
+ return (int) Math.ceil (cookTime / cookSpeedMultiplier);
|
||||||
+ // Paper end
|
+ // Paper end - cook speed multiplier API
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isFuel(ItemStack stack) {
|
public static boolean isFuel(ItemStack stack) {
|
||||||
@ -100,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
if (slot == 0 && !flag) {
|
if (slot == 0 && !flag) {
|
||||||
- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this);
|
- this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this);
|
||||||
+ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper
|
+ this.cookingTotalTime = AbstractFurnaceBlockEntity.getTotalCookTime(this.level, this.recipeType, this, this.cookSpeedMultiplier); // Paper - cook speed multiplier API
|
||||||
this.cookingProgress = 0;
|
this.cookingProgress = 0;
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
|
private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES = 10;
|
||||||
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
|
private static final String MAX_THREADS_SYSTEM_PROPERTY = "max.bg.threads";
|
||||||
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
|
- private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main");
|
||||||
+ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - add -1 priority
|
+ private static final ExecutorService BACKGROUND_EXECUTOR = makeExecutor("Main", -1); // Paper - Perf: add priority
|
||||||
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
|
private static final ExecutorService IO_POOL = makeIoExecutor("IO-Worker-", false);
|
||||||
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
|
private static final ExecutorService DOWNLOAD_POOL = makeIoExecutor("Download-", true);
|
||||||
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
// Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
|
||||||
@ -56,8 +56,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
- private static ExecutorService makeExecutor(String name) {
|
- private static ExecutorService makeExecutor(String name) {
|
||||||
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads());
|
- int i = Mth.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, getMaxThreads());
|
||||||
+ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - add priority
|
+ private static ExecutorService makeExecutor(String s, int priorityModifier) { // Paper - Perf: add priority
|
||||||
+ // Paper start - use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
|
+ // Paper start - Perf: use simpler thread pool that allows 1 thread and reduce worldgen thread worker count for low core count CPUs
|
||||||
+ int cpus = Runtime.getRuntime().availableProcessors() / 2;
|
+ int cpus = Runtime.getRuntime().availableProcessors() / 2;
|
||||||
+ int i;
|
+ int i;
|
||||||
+ if (cpus <= 4) {
|
+ if (cpus <= 4) {
|
||||||
@ -87,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return forkJoinWorkerThread;
|
return forkJoinWorkerThread;
|
||||||
}, Util::onThreadException, true);
|
}, Util::onThreadException, true);
|
||||||
}
|
}
|
||||||
+ }*/ // Paper end
|
+ }*/ // Paper end - Perf: use simpler thread pool
|
||||||
|
|
||||||
return executorService;
|
return executorService;
|
||||||
}
|
}
|
||||||
@ -99,7 +99,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||||
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
|
MinecraftServer.LOGGER.error("Uncaught exception in server thread", throwable);
|
||||||
});
|
});
|
||||||
+ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority
|
+ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - Perf: Boost priority
|
||||||
if (Runtime.getRuntime().availableProcessors() > 4) {
|
if (Runtime.getRuntime().availableProcessors() > 4) {
|
||||||
thread.setPriority(8);
|
thread.setPriority(8);
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.inventory = entity.getInventory();
|
this.inventory = entity.getInventory();
|
||||||
if (this.testClearGrid() || entity.isCreative()) {
|
if (this.testClearGrid() || entity.isCreative()) {
|
||||||
this.stackedContents.clear();
|
this.stackedContents.clear();
|
||||||
+ this.stackedContents.initialize(recipe.value()); // Paper - better exact choice recipes
|
+ this.stackedContents.initialize(recipe.value()); // Paper - Improve exact choice recipe ingredients
|
||||||
entity.getInventory().fillStackedContents(this.stackedContents);
|
entity.getInventory().fillStackedContents(this.stackedContents);
|
||||||
this.menu.fillCraftSlotsStackedContents(this.stackedContents);
|
this.menu.fillCraftSlotsStackedContents(this.stackedContents);
|
||||||
if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) {
|
if (this.stackedContents.canCraft(recipe.value(), (IntList)null)) {
|
||||||
@ -159,7 +159,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
for(int m : intList) {
|
for(int m : intList) {
|
||||||
- int n = StackedContents.fromStackingIndex(m).getMaxStackSize();
|
- int n = StackedContents.fromStackingIndex(m).getMaxStackSize();
|
||||||
+ int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper
|
+ int n = StackedContents.maxStackSizeFromStackingIndex(m, this.stackedContents); // Paper - Improve exact choice recipe ingredients
|
||||||
if (n < l) {
|
if (n < l) {
|
||||||
l = n;
|
l = n;
|
||||||
}
|
}
|
||||||
@ -168,7 +168,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
|
public void addItemToSlot(Iterator<Integer> inputs, int slot, int amount, int gridX, int gridY) {
|
||||||
Slot slot2 = this.menu.getSlot(slot);
|
Slot slot2 = this.menu.getSlot(slot);
|
||||||
- ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next());
|
- ItemStack itemStack = StackedContents.fromStackingIndex(inputs.next());
|
||||||
+ // Paper start
|
+ // Paper start - Improve exact choice recipe ingredients
|
||||||
+ final int itemId = inputs.next();
|
+ final int itemId = inputs.next();
|
||||||
+ ItemStack itemStack = null;
|
+ ItemStack itemStack = null;
|
||||||
+ boolean isExact = false;
|
+ boolean isExact = false;
|
||||||
@ -179,11 +179,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (itemStack == null) {
|
+ if (itemStack == null) {
|
||||||
+ itemStack = StackedContents.fromStackingIndex(itemId);
|
+ itemStack = StackedContents.fromStackingIndex(itemId);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Improve exact choice recipe ingredients
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
for(int i = 0; i < amount; ++i) {
|
for(int i = 0; i < amount; ++i) {
|
||||||
- this.moveItemToGrid(slot2, itemStack);
|
- this.moveItemToGrid(slot2, itemStack);
|
||||||
+ this.moveItemToGrid(slot2, itemStack, isExact); // Paper
|
+ this.moveItemToGrid(slot2, itemStack, isExact); // Paper - Improve exact choice recipe ingredients
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,15 +191,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper
|
+ @Deprecated @io.papermc.paper.annotation.DoNotUse // Paper - Improve exact choice recipe ingredients
|
||||||
protected void moveItemToGrid(Slot slot, ItemStack stack) {
|
protected void moveItemToGrid(Slot slot, ItemStack stack) {
|
||||||
- int i = this.inventory.findSlotMatchingUnusedItem(stack);
|
- int i = this.inventory.findSlotMatchingUnusedItem(stack);
|
||||||
+ // Paper start
|
+ // Paper start - Improve exact choice recipe ingredients
|
||||||
+ this.moveItemToGrid(slot, stack, false);
|
+ this.moveItemToGrid(slot, stack, false);
|
||||||
+ }
|
+ }
|
||||||
+ protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) {
|
+ protected void moveItemToGrid(Slot slot, ItemStack stack, final boolean isExact) {
|
||||||
+ int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack);
|
+ int i = isExact ? this.inventory.findSlotMatchingItem(stack) : this.inventory.findSlotMatchingUnusedItem(stack);
|
||||||
+ // Paper end
|
+ // Paper end - Improve exact choice recipe ingredients
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
ItemStack itemStack = this.inventory.getItem(i);
|
ItemStack itemStack = this.inventory.getItem(i);
|
||||||
if (!itemStack.isEmpty()) {
|
if (!itemStack.isEmpty()) {
|
||||||
@ -211,10 +211,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public class StackedContents {
|
public class StackedContents {
|
||||||
private static final int EMPTY = 0;
|
private static final int EMPTY = 0;
|
||||||
public final Int2IntMap contents = new Int2IntOpenHashMap();
|
public final Int2IntMap contents = new Int2IntOpenHashMap();
|
||||||
+ @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper
|
+ @Nullable public io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap = null; // Paper - Improve exact choice recipe ingredients
|
||||||
|
|
||||||
public void accountSimpleStack(ItemStack stack) {
|
public void accountSimpleStack(ItemStack stack) {
|
||||||
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - max of 64 due to accountStack method below
|
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, Math.min(64, stack.getCount()))) return; // Paper - Improve exact choice recipe ingredients; max of 64 due to accountStack method below
|
||||||
if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) {
|
if (!stack.isDamaged() && !stack.isEnchanted() && !stack.hasCustomHoverName()) {
|
||||||
this.accountStack(stack);
|
this.accountStack(stack);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
int i = getStackingIndex(stack);
|
int i = getStackingIndex(stack);
|
||||||
int j = Math.min(maxCount, stack.getCount());
|
int j = Math.min(maxCount, stack.getCount());
|
||||||
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - if an exact ingredient, don't include it
|
+ if (this.extrasMap != null && stack.hasTag() && this.extrasMap.accountStack(stack, j)) return; // Paper - Improve exact choice recipe ingredients; if an exact ingredient, don't include it
|
||||||
this.put(i, j);
|
this.put(i, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
|
return itemId == 0 ? ItemStack.EMPTY : new ItemStack(Item.byId(itemId));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Improve exact choice recipe ingredients
|
||||||
+ public void initialize(final Recipe<?> recipe) {
|
+ public void initialize(final Recipe<?> recipe) {
|
||||||
+ this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe);
|
+ this.extrasMap = new io.papermc.paper.inventory.recipe.StackedContentsExtraMap(this, recipe);
|
||||||
+ }
|
+ }
|
||||||
@ -245,7 +245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) {
|
+ public static ItemStack fromStackingIndexExtras(final int itemId, final io.papermc.paper.inventory.recipe.StackedContentsExtraMap extrasMap) {
|
||||||
+ return extrasMap.getById(itemId).copy();
|
+ return extrasMap.getById(itemId).copy();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Improve exact choice recipe ingredients
|
||||||
+
|
+
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.contents.clear();
|
this.contents.clear();
|
||||||
@ -255,7 +255,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
for(int i = 0; i < this.ingredients.size(); ++i) {
|
for(int i = 0; i < this.ingredients.size(); ++i) {
|
||||||
- IntList intList = this.ingredients.get(i).getStackingIds();
|
- IntList intList = this.ingredients.get(i).getStackingIds();
|
||||||
+ IntList intList = this.getStackingIds(this.ingredients.get(i)); // Paper
|
+ IntList intList = this.getStackingIds(this.ingredients.get(i)); // Paper - Improve exact choice recipe ingredients
|
||||||
|
|
||||||
for(int j = 0; j < this.itemCount; ++j) {
|
for(int j = 0; j < this.itemCount; ++j) {
|
||||||
if (intList.contains(this.items[j])) {
|
if (intList.contains(this.items[j])) {
|
||||||
@ -264,7 +264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
for(Ingredient ingredient : this.ingredients) {
|
for(Ingredient ingredient : this.ingredients) {
|
||||||
- intCollection.addAll(ingredient.getStackingIds());
|
- intCollection.addAll(ingredient.getStackingIds());
|
||||||
+ intCollection.addAll(this.getStackingIds(ingredient)); // Paper
|
+ intCollection.addAll(this.getStackingIds(ingredient)); // Paper - Improve exact choice recipe ingredients
|
||||||
}
|
}
|
||||||
|
|
||||||
IntIterator intIterator = intCollection.iterator();
|
IntIterator intIterator = intCollection.iterator();
|
||||||
@ -273,7 +273,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
- for(int k : ingredient.getStackingIds()) {
|
- for(int k : ingredient.getStackingIds()) {
|
||||||
+ for(int k : this.getStackingIds(ingredient)) { // Paper
|
+ for(int k : this.getStackingIds(ingredient)) { // Paper - Improve exact choice recipe ingredients
|
||||||
j = Math.max(j, StackedContents.this.contents.get(k));
|
j = Math.max(j, StackedContents.this.contents.get(k));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
+
|
+
|
||||||
+ // Paper start - improve exact recipe choices
|
+ // Paper start - Improve exact choice recipe ingredients
|
||||||
+ private IntList getStackingIds(final Ingredient ingredient) {
|
+ private IntList getStackingIds(final Ingredient ingredient) {
|
||||||
+ if (StackedContents.this.extrasMap != null) {
|
+ if (StackedContents.this.extrasMap != null) {
|
||||||
+ final IntList ids = StackedContents.this.extrasMap.extraStackingIds.get(ingredient);
|
+ final IntList ids = StackedContents.this.extrasMap.extraStackingIds.get(ingredient);
|
||||||
@ -292,7 +292,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ return ingredient.getStackingIds();
|
+ return ingredient.getStackingIds();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - improve exact recipe choices
|
+ // Paper end - Improve exact choice recipe ingredients
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
|
diff --git a/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java b/src/main/java/net/minecraft/world/item/crafting/AbstractCookingRecipe.java
|
||||||
|
@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault();
|
private final MessageSignatureCache messageSignatureCache = MessageSignatureCache.createDefault();
|
||||||
private final FutureChain chatMessageChain;
|
private final FutureChain chatMessageChain;
|
||||||
private boolean waitingForSwitchToConfig;
|
private boolean waitingForSwitchToConfig;
|
||||||
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper
|
+ private static final int MAX_SIGN_LINE_LENGTH = Integer.getInteger("Paper.maxSignLength", 80); // Paper - Limit client sign length
|
||||||
|
|
||||||
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
|
public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
|
||||||
super(server, connection, clientData, player); // CraftBukkit
|
super(server, connection, clientData, player); // CraftBukkit
|
||||||
@ -38,7 +38,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
|
public void handleSignUpdate(ServerboundSignUpdatePacket packet) {
|
||||||
- List<String> list = (List) Stream.of(packet.getLines()).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
|
- List<String> list = (List) Stream.of(packet.getLines()).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
|
||||||
+ // Paper start - cap line length - modified clients can send longer data than normal
|
+ // Paper start - Limit client sign length
|
||||||
+ String[] lines = packet.getLines();
|
+ String[] lines = packet.getLines();
|
||||||
+ for (int i = 0; i < lines.length; ++i) {
|
+ for (int i = 0; i < lines.length; ++i) {
|
||||||
+ if (MAX_SIGN_LINE_LENGTH > 0 && lines[i].length() > MAX_SIGN_LINE_LENGTH) {
|
+ if (MAX_SIGN_LINE_LENGTH > 0 && lines[i].length() > MAX_SIGN_LINE_LENGTH) {
|
||||||
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ List<String> list = (List) Stream.of(lines).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
|
+ List<String> list = (List) Stream.of(lines).map(ChatFormatting::stripFormatting).collect(Collectors.toList());
|
||||||
+ // Paper end
|
+ // Paper end - Limit client sign length
|
||||||
|
|
||||||
this.filterTextPacket(list).thenAcceptAsync((list1) -> {
|
this.filterTextPacket(list).thenAcceptAsync((list1) -> {
|
||||||
this.updateSignText(packet, list1);
|
this.updateSignText(packet, list1);
|
||||||
|
@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private final BlockPos target;
|
private final BlockPos target;
|
||||||
private final float distToTarget;
|
private final float distToTarget;
|
||||||
private final boolean reached;
|
private final boolean reached;
|
||||||
+ public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper
|
+ public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper - Mob Pathfinding API
|
||||||
|
|
||||||
public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) {
|
public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) {
|
||||||
this.nodes = nodes;
|
this.nodes = nodes;
|
||||||
@ -179,11 +179,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
public abstract class CraftMob extends CraftLivingEntity implements Mob {
|
||||||
public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) {
|
public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) {
|
||||||
super(server, entity);
|
super(server, entity);
|
||||||
+ paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper
|
+ paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper - Mob Pathfinding API
|
||||||
}
|
}
|
||||||
|
|
||||||
+ private final com.destroystokyo.paper.entity.PaperPathfinder paperPathfinder; // Paper
|
+ private final com.destroystokyo.paper.entity.PaperPathfinder paperPathfinder; // Paper - Mob Pathfinding API
|
||||||
+ @Override public com.destroystokyo.paper.entity.Pathfinder getPathfinder() { return paperPathfinder; } // Paper
|
+ @Override public com.destroystokyo.paper.entity.Pathfinder getPathfinder() { return paperPathfinder; } // Paper - Mob Pathfinding API
|
||||||
@Override
|
@Override
|
||||||
public void setTarget(LivingEntity target) {
|
public void setTarget(LivingEntity target) {
|
||||||
Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
Preconditions.checkState(!this.getHandle().generation, "Cannot set target during world generation");
|
||||||
@ -191,13 +191,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
return (net.minecraft.world.entity.Mob) this.entity;
|
return (net.minecraft.world.entity.Mob) this.entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - Mob Pathfinding API
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void setHandle(net.minecraft.world.entity.Entity entity) {
|
+ public void setHandle(net.minecraft.world.entity.Entity entity) {
|
||||||
+ super.setHandle(entity);
|
+ super.setHandle(entity);
|
||||||
+ paperPathfinder.setHandle(getHandle());
|
+ paperPathfinder.setHandle(getHandle());
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Mob Pathfinding API
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
worldserver1 = worldserver;
|
worldserver1 = worldserver;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
// Paper start
|
// Paper start - Entity#getEntitySpawnReason
|
||||||
if (nbttagcompound == null) {
|
if (nbttagcompound == null) {
|
||||||
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ // Paper start - reset to main world spawn if first spawn or invalid world
|
+ // Paper start - reset to main world spawn if first spawn or invalid world
|
||||||
@ -85,7 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end - reset to main world spawn if first spawn or invalid world
|
+ // Paper end - reset to main world spawn if first spawn or invalid world
|
||||||
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end - Entity#getEntitySpawnReason
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
|
@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
||||||
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper
|
public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason; // Paper - Entity#getEntitySpawnReason
|
||||||
|
|
||||||
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
||||||
+ public boolean collisionLoadChunks = false; // Paper
|
+ public boolean collisionLoadChunks = false; // Paper
|
||||||
|
@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
- for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||||
- ServerPlayer entityplayer = (ServerPlayer) this.getPlayerList().players.get(i);
|
- ServerPlayer entityplayer = (ServerPlayer) this.getPlayerList().players.get(i);
|
||||||
- entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
- entityplayer.connection.send(new ClientboundSetTimePacket(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||||
+ // Paper start - optimize time updates
|
+ // Paper start - Perf: Optimize time updates
|
||||||
+ for (final ServerLevel level : this.getAllLevels()) {
|
+ for (final ServerLevel level : this.getAllLevels()) {
|
||||||
+ final boolean doDaylight = level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT);
|
+ final boolean doDaylight = level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT);
|
||||||
+ final long dayTime = level.getDayTime();
|
+ final long dayTime = level.getDayTime();
|
||||||
@ -36,7 +36,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ entityplayer.connection.send(packet); // Add support for per player time
|
+ entityplayer.connection.send(packet); // Add support for per player time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ // Paper end
|
+ // Paper end - Perf: Optimize time updates
|
||||||
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
||||||
|
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
|
@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
public boolean wonGame;
|
public boolean wonGame;
|
||||||
private int containerUpdateDelay; // Paper
|
private int containerUpdateDelay; // Paper
|
||||||
public long loginTime; // Paper
|
public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed
|
||||||
+ public int patrolSpawnDelay; // Paper - Pillager patrol spawn settings and per player options
|
+ public int patrolSpawnDelay; // Paper - Pillager patrol spawn settings and per player options
|
||||||
// Paper start - cancellable death event
|
// Paper start - cancellable death event
|
||||||
public boolean queueHealthUpdatePacket = false;
|
public boolean queueHealthUpdatePacket = false;
|
||||||
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - process inventory
|
+ // Paper start - PlayerDeathEvent#getItemsToKeep
|
||||||
+ private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) {
|
+ private static void processKeep(org.bukkit.event.entity.PlayerDeathEvent event, NonNullList<ItemStack> inv) {
|
||||||
+ List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep();
|
+ List<org.bukkit.inventory.ItemStack> itemsToKeep = event.getItemsToKeep();
|
||||||
+ if (inv == null) {
|
+ if (inv == null) {
|
||||||
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - PlayerDeathEvent#getItemsToKeep
|
||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public void die(DamageSource damageSource) {
|
public void die(DamageSource damageSource) {
|
||||||
@ -66,12 +66,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||||
if (!event.getKeepInventory()) {
|
if (!event.getKeepInventory()) {
|
||||||
- this.getInventory().clearContent();
|
- this.getInventory().clearContent();
|
||||||
+ // Paper start - replace logic
|
+ // Paper start - PlayerDeathEvent#getItemsToKeep
|
||||||
+ for (NonNullList<ItemStack> inv : this.getInventory().compartments) {
|
+ for (NonNullList<ItemStack> inv : this.getInventory().compartments) {
|
||||||
+ processKeep(event, inv);
|
+ processKeep(event, inv);
|
||||||
+ }
|
+ }
|
||||||
+ processKeep(event, null);
|
+ processKeep(event, null);
|
||||||
+ // Paper end
|
+ // Paper end - PlayerDeathEvent#getItemsToKeep
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setCamera(this); // Remove spectated target
|
this.setCamera(this); // Remove spectated target
|
||||||
|
@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (event.shouldDropExperience()) this.dropExperience(); // Paper - tie to event
|
+ if (event.shouldDropExperience()) this.dropExperience(); // Paper - tie to event
|
||||||
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
// we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||||
if (!event.getKeepInventory()) {
|
if (!event.getKeepInventory()) {
|
||||||
// Paper start - replace logic
|
// Paper start - PlayerDeathEvent#getItemsToKeep
|
||||||
|
@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
FluidState fluid1 = (FluidState) entry.getValue();
|
FluidState fluid1 = (FluidState) entry.getValue();
|
||||||
BlockPos blockposition1 = pos.relative(enumdirection);
|
BlockPos blockposition1 = pos.relative(enumdirection);
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||||
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper
|
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing
|
||||||
+ if (iblockdata1 == null) continue; // Paper
|
+ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing
|
||||||
|
|
||||||
if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) {
|
if (this.canSpreadTo(world, pos, blockState, enumdirection, blockposition1, iblockdata1, world.getFluidState(blockposition1), fluid1.getType())) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@ -23,9 +23,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Direction enumdirection = (Direction) iterator.next();
|
Direction enumdirection = (Direction) iterator.next();
|
||||||
BlockPos blockposition1 = pos.relative(enumdirection);
|
BlockPos blockposition1 = pos.relative(enumdirection);
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
- BlockState iblockdata1 = world.getBlockState(blockposition1);
|
||||||
+
|
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper - Prevent chunk loading from fluid flowing
|
||||||
+ BlockState iblockdata1 = world.getBlockStateIfLoaded(blockposition1); // Paper
|
+ if (iblockdata1 == null) continue; // Paper - Prevent chunk loading from fluid flowing
|
||||||
+ if (iblockdata1 == null) continue; // Paper
|
|
||||||
FluidState fluid = iblockdata1.getFluidState();
|
FluidState fluid = iblockdata1.getFluidState();
|
||||||
|
|
||||||
if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) {
|
if (fluid.getType().isSame(this) && this.canPassThroughWall(enumdirection, world, pos, state, blockposition1, iblockdata1)) {
|
||||||
@ -35,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2);
|
short short0 = FlowingFluid.getCacheKey(fromPos, blockposition2);
|
||||||
- Pair<BlockState, FluidState> pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> {
|
- Pair<BlockState, FluidState> pair = (Pair) stateCache.computeIfAbsent(short0, (short1) -> {
|
||||||
- BlockState iblockdata1 = world.getBlockState(blockposition2);
|
- BlockState iblockdata1 = world.getBlockState(blockposition2);
|
||||||
+ // Paper start - avoid loading chunks
|
+ // Paper start - Prevent chunk loading from fluid flowing
|
||||||
+ Pair<BlockState, FluidState> pair = stateCache.get(short0);
|
+ Pair<BlockState, FluidState> pair = stateCache.get(short0);
|
||||||
+ if (pair == null) {
|
+ if (pair == null) {
|
||||||
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2);
|
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition2);
|
||||||
@ -48,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
|
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
|
||||||
+ stateCache.put(short0, pair);
|
+ stateCache.put(short0, pair);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Prevent chunk loading from fluid flowing
|
||||||
BlockState iblockdata1 = (BlockState) pair.getFirst();
|
BlockState iblockdata1 = (BlockState) pair.getFirst();
|
||||||
FluidState fluid = (FluidState) pair.getSecond();
|
FluidState fluid = (FluidState) pair.getSecond();
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
-
|
-
|
||||||
- return Pair.of(iblockdata1, iblockdata1.getFluidState());
|
- return Pair.of(iblockdata1, iblockdata1.getFluidState());
|
||||||
- });
|
- });
|
||||||
+ // Paper start
|
+ // Paper start - Prevent chunk loading from fluid flowing
|
||||||
+ Pair pair = (Pair) short2objectmap.get(short0);
|
+ Pair pair = (Pair) short2objectmap.get(short0);
|
||||||
+ if (pair == null) {
|
+ if (pair == null) {
|
||||||
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition1);
|
+ BlockState iblockdatax = world.getBlockStateIfLoaded(blockposition1);
|
||||||
@ -70,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
|
+ pair = Pair.of(iblockdatax, iblockdatax.getFluidState());
|
||||||
+ short2objectmap.put(short0, pair);
|
+ short2objectmap.put(short0, pair);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Prevent chunk loading from fluid flowing
|
||||||
BlockState iblockdata1 = (BlockState) pair.getFirst();
|
BlockState iblockdata1 = (BlockState) pair.getFirst();
|
||||||
FluidState fluid = (FluidState) pair.getSecond();
|
FluidState fluid = (FluidState) pair.getSecond();
|
||||||
FluidState fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1);
|
FluidState fluid1 = this.getNewLiquid(world, blockposition1, iblockdata1);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
From: Zach Brown <1254957+zachbr@users.noreply.github.com>
|
||||||
Date: Wed, 2 Jan 2019 00:35:43 -0600
|
Date: Wed, 2 Jan 2019 00:35:43 -0600
|
||||||
Subject: [PATCH] Add APIs to replace OfflinePlayer#getLastPlayed
|
Subject: [PATCH] Replace OfflinePlayer#getLastPlayed
|
||||||
|
|
||||||
Currently OfflinePlayer#getLastPlayed could more accurately be described
|
Currently OfflinePlayer#getLastPlayed could more accurately be described
|
||||||
as "OfflinePlayer#getLastTimeTheirDataWasSaved".
|
as "OfflinePlayer#getLastTimeTheirDataWasSaved".
|
||||||
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private int containerCounter;
|
private int containerCounter;
|
||||||
public boolean wonGame;
|
public boolean wonGame;
|
||||||
private int containerUpdateDelay; // Paper
|
private int containerUpdateDelay; // Paper
|
||||||
+ public long loginTime; // Paper
|
+ public long loginTime; // Paper - Replace OfflinePlayer#getLastPlayed
|
||||||
// Paper start - cancellable death event
|
// Paper start - cancellable death event
|
||||||
public boolean queueHealthUpdatePacket = false;
|
public boolean queueHealthUpdatePacket = false;
|
||||||
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
public net.minecraft.network.protocol.game.ClientboundSetHealthPacket queuedHealthUpdatePacket;
|
||||||
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
|
public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) {
|
||||||
player.isRealPlayer = true; // Paper
|
player.isRealPlayer = true; // Paper
|
||||||
+ player.loginTime = System.currentTimeMillis(); // Paper
|
+ player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed
|
||||||
GameProfile gameprofile = player.getGameProfile();
|
GameProfile gameprofile = player.getGameProfile();
|
||||||
GameProfileCache usercache = this.server.getProfileCache();
|
GameProfileCache usercache = this.server.getProfileCache();
|
||||||
String s;
|
String s;
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
this.setHealth(this.getMaxHealth());
|
this.setHealth(this.getMaxHealth());
|
||||||
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset
|
this.stopUsingItem(); // CraftBukkit - SPIGOT-6682: Clear active item on reset
|
||||||
+ this.setAirSupply(this.getMaxAirSupply()); // Paper
|
+ this.setAirSupply(this.getMaxAirSupply()); // Paper - Reset players airTicks on respawn
|
||||||
this.setRemainingFireTicks(0);
|
this.setRemainingFireTicks(0);
|
||||||
this.fallDistance = 0;
|
this.fallDistance = 0;
|
||||||
this.foodData = new FoodData(this);
|
this.foodData = new FoodData(this);
|
||||||
|
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Paper end - Don't allow digging in unloaded chunks
|
// Paper end - Don't allow digging into unloaded chunks
|
||||||
+ // Paper start - Send block entities after destroy prediction
|
+ // Paper start - Send block entities after destroy prediction
|
||||||
+ this.player.gameMode.capturedBlockEntity = false;
|
+ this.player.gameMode.capturedBlockEntity = false;
|
||||||
+ this.player.gameMode.captureSentBlockEntities = true;
|
+ this.player.gameMode.captureSentBlockEntities = true;
|
||||||
|
@ -21,4 +21,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper end - Send empty commands if tab completion is disabled
|
+ // Paper end - Send empty commands if tab completion is disabled
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// Register Vanilla commands into builtRoot as before
|
// Register Vanilla commands into builtRoot as before
|
||||||
// Paper start - Async command map building
|
// Paper start - Perf: Async command map building
|
||||||
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
});
|
});
|
||||||
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
isOversleep = false;MinecraftTimings.serverOversleep.stopTiming();
|
||||||
// Paper end
|
// Paper end
|
||||||
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper
|
+ new com.destroystokyo.paper.event.server.ServerTickStartEvent(this.tickCount+1).callEvent(); // Paper - Server Tick Events
|
||||||
|
|
||||||
++this.tickCount;
|
++this.tickCount;
|
||||||
this.tickRateManager.tick();
|
this.tickRateManager.tick();
|
||||||
@ -21,11 +21,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.runAllTasks();
|
this.runAllTasks();
|
||||||
}
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
+ // Paper start
|
+ // Paper start - Server Tick Events
|
||||||
+ long endTime = System.nanoTime();
|
+ long endTime = System.nanoTime();
|
||||||
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
+ long remaining = (TICK_TIME - (endTime - lastTick)) - catchupTime;
|
||||||
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
+ new com.destroystokyo.paper.event.server.ServerTickEndEvent(this.tickCount, ((double)(endTime - lastTick) / 1000000D), remaining).callEvent();
|
||||||
+ // Paper end
|
+ // Paper end - Server Tick Events
|
||||||
this.profiler.push("tallying");
|
this.profiler.push("tallying");
|
||||||
long j = Util.getNanos() - i;
|
long j = Util.getNanos() - i;
|
||||||
int k = this.tickCount % 100;
|
int k = this.tickCount % 100;
|
||||||
|
@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// Run tasks that are waiting on processing
|
// Run tasks that are waiting on processing
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
// Paper end
|
// Paper end - Perf: Optimize time updates
|
||||||
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
MinecraftTimings.timeUpdateTimer.stopTiming(); // Spigot // Paper
|
||||||
|
|
||||||
+ this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
|
+ this.isIteratingOverLevels = true; // Paper - Throw exception on world create while being ticked
|
||||||
|
@ -11,19 +11,6 @@ public net.minecraft.world.entity.animal.Turtle setGoingHome(Z)V
|
|||||||
public net.minecraft.world.entity.animal.Turtle isTravelling()Z
|
public net.minecraft.world.entity.animal.Turtle isTravelling()Z
|
||||||
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
|
public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/ai/goal/MoveToBlockGoal.java
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class MoveToBlockGoal extends Goal {
|
|
||||||
protected int nextStartTick;
|
|
||||||
protected int tryTicks;
|
|
||||||
private int maxStayTicks;
|
|
||||||
- protected BlockPos blockPos = BlockPos.ZERO;
|
|
||||||
+ protected BlockPos blockPos = BlockPos.ZERO; @Deprecated public final BlockPos getTargetPosition() { return this.blockPos; } // Paper - OBFHELPER
|
|
||||||
private boolean reachedTarget;
|
|
||||||
private final int searchRange;
|
|
||||||
private final int verticalSearchRange;
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
diff --git a/src/main/java/net/minecraft/world/entity/animal/Turtle.java b/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
--- a/src/main/java/net/minecraft/world/entity/animal/Turtle.java
|
||||||
@ -33,13 +20,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (!this.turtle.isInWater() && this.isReachedTarget()) {
|
if (!this.turtle.isInWater() && this.isReachedTarget()) {
|
||||||
if (this.turtle.layEggCounter < 1) {
|
if (this.turtle.layEggCounter < 1) {
|
||||||
- this.turtle.setLayingEgg(true);
|
- this.turtle.setLayingEgg(true);
|
||||||
+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.getTargetPosition())).callEvent()); // Paper
|
+ this.turtle.setLayingEgg(new com.destroystokyo.paper.event.entity.TurtleStartDiggingEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos)).callEvent()); // Paper - Turtle API
|
||||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||||
Level world = this.turtle.level();
|
Level world = this.turtle.level();
|
||||||
|
|
||||||
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit
|
- if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (BlockState) Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, this.turtle.random.nextInt(4) + 1))) { // CraftBukkit
|
||||||
+ // CraftBukkit start
|
+ // Paper start - Turtle API
|
||||||
+ // Paper start
|
|
||||||
+ int eggCount = this.turtle.random.nextInt(4) + 1;
|
+ int eggCount = this.turtle.random.nextInt(4) + 1;
|
||||||
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount);
|
+ com.destroystokyo.paper.event.entity.TurtleLayEggEvent layEggEvent = new com.destroystokyo.paper.event.entity.TurtleLayEggEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity(), io.papermc.paper.util.MCUtil.toLocation(this.turtle.level(), this.blockPos.above()), eggCount);
|
||||||
+ if (layEggEvent.callEvent() && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()))) {
|
+ if (layEggEvent.callEvent() && org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), Blocks.TURTLE_EGG.defaultBlockState().setValue(TurtleEggBlock.EGGS, layEggEvent.getEggCount()))) {
|
||||||
@ -55,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public boolean canUse() {
|
public boolean canUse() {
|
||||||
- return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D)));
|
- return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D)));
|
||||||
+ return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper
|
+ return this.turtle.isBaby() ? false : (this.turtle.hasEgg() ? true : (this.turtle.getRandom().nextInt(reducedTickDelay(700)) != 0 ? false : !this.turtle.getHomePos().closerToCenterThan(this.turtle.position(), 64.0D))) && new com.destroystokyo.paper.event.entity.TurtleGoHomeEvent((org.bukkit.entity.Turtle) this.turtle.getBukkitEntity()).callEvent(); // Paper - Turtle API
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,11 +13,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.disconnected = true;
|
this.disconnected = true;
|
||||||
this.ejectPassengers();
|
this.ejectPassengers();
|
||||||
+
|
+
|
||||||
+ // Paper start - Workaround an issue where the vehicle doesn't track the passenger disconnection dismount.
|
+ // Paper start - Workaround vehicle not tracking the passenger disconnection dismount
|
||||||
+ if (this.isPassenger() && this.getVehicle() instanceof ServerPlayer) {
|
+ if (this.isPassenger() && this.getVehicle() instanceof ServerPlayer) {
|
||||||
+ this.stopRiding();
|
+ this.stopRiding();
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - Workaround vehicle not tracking the passenger disconnection dismount
|
||||||
+
|
+
|
||||||
if (this.isSleeping()) {
|
if (this.isSleeping()) {
|
||||||
this.stopSleepInBed(true, false);
|
this.stopSleepInBed(true, false);
|
||||||
|
@ -27,17 +27,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeVehicle() {
|
public void removeVehicle() {
|
||||||
+ // Paper start
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
+ stopRiding(false);
|
+ stopRiding(false);
|
||||||
+ }
|
+ }
|
||||||
+ public void stopRiding(boolean suppressCancellation) {
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
+ // Paper end
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
if (this.vehicle != null) {
|
if (this.vehicle != null) {
|
||||||
Entity entity = this.vehicle;
|
Entity entity = this.vehicle;
|
||||||
|
|
||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
|
- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit
|
||||||
+ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper
|
+ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper - Force entity dismount during teleportation
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
- protected boolean removePassenger(Entity entity) { // CraftBukkit
|
- protected boolean removePassenger(Entity entity) { // CraftBukkit
|
||||||
+ // Paper start
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
+ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);}
|
+ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);}
|
||||||
+ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit
|
+ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit
|
||||||
+ // Paper end
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
if (entity.getVehicle() == this) {
|
if (entity.getVehicle() == this) {
|
||||||
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
|
||||||
} else {
|
} else {
|
||||||
@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
VehicleExitEvent event = new VehicleExitEvent(
|
VehicleExitEvent event = new VehicleExitEvent(
|
||||||
(Vehicle) this.getBukkitEntity(),
|
(Vehicle) this.getBukkitEntity(),
|
||||||
- (LivingEntity) entity.getBukkitEntity()
|
- (LivingEntity) entity.getBukkitEntity()
|
||||||
+ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper
|
+ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper - Force entity dismount during teleportation
|
||||||
);
|
);
|
||||||
// Suppress during worldgen
|
// Suppress during worldgen
|
||||||
if (this.valid) {
|
if (this.valid) {
|
||||||
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
- EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
- EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity());
|
||||||
+ EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper
|
+ EntityDismountEvent event = new EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||||
// Suppress during worldgen
|
// Suppress during worldgen
|
||||||
if (this.valid) {
|
if (this.valid) {
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
@ -79,16 +79,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopRiding() {
|
public void stopRiding() {
|
||||||
+ // Paper start
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
+ stopRiding(false);
|
+ stopRiding(false);
|
||||||
+ }
|
+ }
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void stopRiding(boolean suppressCancellation) {
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
+ // Paper end
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
Entity entity = this.getVehicle();
|
Entity entity = this.getVehicle();
|
||||||
|
|
||||||
- super.stopRiding();
|
- super.stopRiding();
|
||||||
+ super.stopRiding(suppressCancellation); // Paper - suppress
|
+ super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation
|
||||||
if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
|
if (entity != null && entity != this.getVehicle() && !this.level().isClientSide) {
|
||||||
this.dismountVehicle(entity);
|
this.dismountVehicle(entity);
|
||||||
}
|
}
|
||||||
@ -101,13 +101,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public void removeVehicle() {
|
public void removeVehicle() {
|
||||||
- super.removeVehicle();
|
- super.removeVehicle();
|
||||||
+ // Paper start
|
+ // Paper start - Force entity dismount during teleportation
|
||||||
+ stopRiding(false);
|
+ stopRiding(false);
|
||||||
+ }
|
+ }
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public void stopRiding(boolean suppressCancellation) {
|
+ public void stopRiding(boolean suppressCancellation) {
|
||||||
+ // Paper end
|
+ super.stopRiding(suppressCancellation);
|
||||||
+ super.stopRiding(suppressCancellation); // Paper - suppress
|
+ // Paper end - Force entity dismount during teleportation
|
||||||
this.boardingCooldown = 0;
|
this.boardingCooldown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user