moaaaaar patches

This commit is contained in:
Jake Potrebic 2021-11-24 11:33:17 -08:00
parent 148ea9dceb
commit 11bdf4fca7
23 changed files with 13 additions and 32 deletions

View File

@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin + annotationProcessor("org.apache.logging.log4j:log4j-core:2.14.1") // Paper - Needed to generate meta for out hex color converter plugin
// Paper end // Paper end
implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper implementation("org.apache.logging.log4j:log4j-iostreams:2.14.1") // Paper
implementation("org.apache.logging.log4j:log4j-api:2.14.1") // Paper implementation("org.ow2.asm:asm:9.2")
diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java diff --git a/src/main/java/io/papermc/paper/console/HexFormattingConverter.java b/src/main/java/io/papermc/paper/console/HexFormattingConverter.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000

View File

@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
public List<MerchantRecipe> getRecipes() { public List<MerchantRecipe> getRecipes() {
- return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { - return Collections.unmodifiableList(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() {
+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) + return List.copyOf(Lists.transform(this.merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantOffer, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes())
@Override @Override
public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) { public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantOffer recipe) {
return recipe.asBukkit(); return recipe.asBukkit();

View File

@ -44,25 +44,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
} }
} }
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
@@ -0,0 +0,0 @@ public class NearestLivingEntitySensor extends Sensor<LivingEntity> {
list.sort(Comparator.comparingDouble(entity::distanceToSqr));
Brain<?> brain = entity.getBrain();
brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
- brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, list.stream().filter((livingEntity2) -> {
- return isEntityTargetable(entity, livingEntity2);
- }).collect(Collectors.toList()));
+ // Paper start - remove streams in favour of lists
+ List<LivingEntity> visibleMobs = new java.util.ArrayList<>(list);
+ visibleMobs.removeIf(otherEntityLiving -> !Sensor.isEntityTargetable(entity, otherEntityLiving));
+ brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, visibleMobs);
+ // Paper end
}
@Override
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java
@ -71,12 +52,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@Override @Override
protected void doTick(ServerLevel world, LivingEntity entity) { protected void doTick(ServerLevel world, LivingEntity entity) {
- List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((serverPlayer) -> { - List<Player> list = world.players().stream().filter(EntitySelector.NO_SPECTATORS).filter((player) -> {
- return entity.closerThan(serverPlayer, 16.0D); - return entity.closerThan(player, 16.0D);
- }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList()); - }).sorted(Comparator.comparingDouble(entity::distanceToSqr)).collect(Collectors.toList());
+ // Paper start - remove streams in favour of lists
+ List<Player> players= new java.util.ArrayList<>(world.players()); + List<Player> players= new java.util.ArrayList<>(world.players());
+ players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D)); // Paper - removeIf only re-allocates once compared to iterator + players.removeIf(player -> !EntitySelector.NO_SPECTATORS.test(player) || !entity.closerThan(player, 16.0D));
+ players.sort(Comparator.comparingDouble(entity::distanceTo));
Brain<?> brain = entity.getBrain(); Brain<?> brain = entity.getBrain();
- brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); - brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list);
- List<Player> list2 = list.stream().filter((player) -> { - List<Player> list2 = list.stream().filter((player) -> {

View File

@ -14,10 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
this.spawnNewGateway(); this.spawnNewGateway();
+ // Paper start - DragonEggFormEvent + // Paper start - DragonEggFormEvent
+ BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION); + BlockPos eggPosition = this.level.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, EndPodiumFeature.END_PODIUM_LOCATION);
+ org.bukkit.craftbukkit.block.CraftBlock eggBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition);
+ org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition); + org.bukkit.craftbukkit.block.CraftBlockState eggState = org.bukkit.craftbukkit.block.CraftBlockStates.getBlockState(this.level, eggPosition);
+ eggState.setData(Blocks.DRAGON_EGG.defaultBlockState()); + eggState.setData(Blocks.DRAGON_EGG.defaultBlockState());
+ io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(eggBlock, eggState, + io.papermc.paper.event.block.DragonEggFormEvent eggEvent = new io.papermc.paper.event.block.DragonEggFormEvent(org.bukkit.craftbukkit.block.CraftBlock.at(this.level, eggPosition), eggState,
+ new org.bukkit.craftbukkit.boss.CraftDragonBattle(this)); + new org.bukkit.craftbukkit.boss.CraftDragonBattle(this));
+ // Paper end - DragonEggFormEvent + // Paper end - DragonEggFormEvent
if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg if (this.level.paperConfig.enderDragonsDeathAlwaysPlacesDragonEgg || !this.previouslyKilled) { // Paper - always place dragon egg

View File

@ -9,16 +9,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -0,0 +0,0 @@ public class PaperWorldConfig { @@ -0,0 +0,0 @@ public class PaperWorldConfig {
private void enderDragonsDeathAlwaysPlacesDragonEgg() {
enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg);
} }
+
+ public boolean updatePathfindingOnBlockUpdate = true; + public boolean updatePathfindingOnBlockUpdate = true;
+ private void setUpdatePathfindingOnBlockUpdate() { + private void setUpdatePathfindingOnBlockUpdate() {
+ updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate);
+ } + }
} +
public boolean phantomIgnoreCreative = true;
public boolean phantomOnlyAttackInsomniacs = true;
private void phantomSettings() {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java --- a/src/main/java/net/minecraft/server/level/ServerLevel.java