mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
remove more obfhelpers
This commit is contained in:
parent
6c9cd70194
commit
570006ab1e
@ -49,7 +49,7 @@ public net.minecraft.world.entity.player.Player removeEntitiesOnShoulder()V
|
||||
# LivingEntity setkiller
|
||||
public net.minecraft.world.entity.LivingEntity lastHurtByPlayerTime
|
||||
|
||||
# SkeletonHore Addittions
|
||||
# SkeletonHorse Addittions
|
||||
public net.minecraft.world.entity.animal.horse.SkeletonHorse trapTime
|
||||
|
||||
# Fix client rendering skulls
|
||||
@ -64,6 +64,7 @@ public net.minecraft.server.level.ServerChunkCache mainThreadProcessor
|
||||
public-f net.minecraft.world.level.chunk.storage.RegionFileStorage
|
||||
public net.minecraft.world.level.chunk.storage.RegionFileStorage getFile(Lnet/minecraft/world/level/ChunkPos;Z)Lnet/minecraft/world/level/chunk/storage/RegionFile;
|
||||
public net.minecraft.world.level.chunk.storage.SectionStorage dirty
|
||||
public net.minecraft.util.thread.BlockableEventLoop runAllTasks()V
|
||||
|
||||
# Improve death events
|
||||
public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sounds/SoundEvent;
|
||||
@ -96,6 +97,7 @@ public net.minecraft.world.entity.monster.Zombie isSunSensitive()Z
|
||||
|
||||
# Add PlayerConnectionCloseEvent
|
||||
public net.minecraft.server.network.ServerLoginPacketListenerImpl$State
|
||||
public net.minecraft.server.network.ServerLoginPacketListenerImpl state
|
||||
|
||||
# Entity Activation Range 2.0
|
||||
public net.minecraft.world.entity.Entity isInsidePortal
|
||||
@ -175,9 +177,6 @@ public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.m
|
||||
# Implement Expanded ArmorStand API
|
||||
public net.minecraft.world.entity.decoration.ArmorStand isDisabled(Lnet/minecraft/world/entity/EquipmentSlot;)Z
|
||||
|
||||
# Asynchronous chunk IO and loading
|
||||
public net.minecraft.util.thread.BlockableEventLoop runAllTasks()V
|
||||
|
||||
# Chunk debug command
|
||||
public net.minecraft.server.level.ChunkMap entitiesInLevel
|
||||
public net.minecraft.server.level.ServerLevel players
|
||||
@ -205,3 +204,14 @@ public net.minecraft.commands.arguments.blocks.BlockStateParser id
|
||||
|
||||
# Villager Restock API
|
||||
public net.minecraft.world.entity.npc.Villager numberOfRestocksToday
|
||||
|
||||
# Mob Pathfinding API
|
||||
public net.minecraft.world.entity.ai.navigation.PathNavigation pathFinder
|
||||
public net.minecraft.world.level.pathfinder.PathFinder nodeEvaluator
|
||||
public net.minecraft.world.level.pathfinder.Path nodes
|
||||
|
||||
# Add more Witch API
|
||||
public net.minecraft.world.entity.monster.Witch usingTime
|
||||
|
||||
# PlayerDeathEvent#getItemsToKeep
|
||||
public net.minecraft.world.entity.player.Inventory compartments
|
||||
|
@ -4,18 +4,6 @@ Date: Sat, 22 Sep 2018 00:33:08 -0500
|
||||
Subject: [PATCH] Add LivingEntity#getTargetEntity
|
||||
|
||||
|
||||
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
|
||||
--- a/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, n
|
||||
this.setYHeadRot(yaw);
|
||||
}
|
||||
|
||||
+ @Deprecated public final float getCollisionBorderSize() { return getPickRadius(); } // Paper - OBFHELPER
|
||||
public float getPickRadius() {
|
||||
return 0.0F;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@ -47,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ EntityHitResult result = null;
|
||||
+
|
||||
+ for (Entity entity : entityList) {
|
||||
+ final double inflationAmount = (double) entity.getCollisionBorderSize();
|
||||
+ final double inflationAmount = (double) entity.getPickRadius();
|
||||
+ AABB aabb = entity.getBoundingBox().inflate(inflationAmount, inflationAmount, inflationAmount);
|
||||
+ Optional<Vec3> rayTraceResult = aabb.clip(start, end);
|
||||
+
|
||||
|
@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
nbt.putInt("Size", this.getPhantomSize());
|
||||
+ // Paper start
|
||||
+ if (this.spawningEntity != null) {
|
||||
+ nbt.setUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
+ nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ } else if (packetListener instanceof ServerLoginPacketListenerImpl) {
|
||||
+ /* Player is login stage */
|
||||
+ final ServerLoginPacketListenerImpl loginListener = (ServerLoginPacketListenerImpl) packetListener;
|
||||
+ switch (loginListener.getLoginState()) {
|
||||
+ switch (loginListener.state) {
|
||||
+ case READY_TO_ACCEPT:
|
||||
+ case DELAY_ACCEPT:
|
||||
+ case ACCEPTED:
|
||||
@ -69,11 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
|
||||
private final byte[] nonce = new byte[4];
|
||||
final MinecraftServer server;
|
||||
public final Connection connection;
|
||||
- ServerLoginPacketListenerImpl.State state;
|
||||
+ ServerLoginPacketListenerImpl.State state; @Deprecated public final ServerLoginPacketListenerImpl.State getLoginState() { return this.state; }; // Paper - OBFHELPER
|
||||
public ServerLoginPacketListenerImpl.State state;
|
||||
private int tick;
|
||||
@Nullable
|
||||
- GameProfile gameProfile;
|
||||
|
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (!new com.destroystokyo.paper.event.block.TNTPrimeEvent(tntBlock, com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason.FIRE, null).callEvent()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ world.setAir(blockposition, false);
|
||||
+ world.removeBlock(blockposition, false);
|
||||
+ // Paper end
|
||||
TntBlock.explode(world, blockposition);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
+
|
||||
+ public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline
|
||||
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
+ return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
+ }
|
||||
+
|
||||
+ public LevelChunk getChunkIfLoaded(int x, int z) { // Overridden in WorldServer for ABI compat which has final
|
||||
@ -46,20 +46,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ // reduces need to do isLoaded before getType
|
||||
+ public final BlockState getTypeIfLoadedAndInBounds(BlockPos blockposition) {
|
||||
+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
|
||||
+ return getWorldBorder().isWithinBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
|
||||
+ }
|
||||
// Paper end
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java
|
||||
@@ -0,0 +0,0 @@ public class WorldBorder {
|
||||
|
||||
public WorldBorder() {}
|
||||
|
||||
+ @Deprecated public final boolean isInBounds(BlockPos blockposition) { return this.isWithinBounds(blockposition); } // Paper - OBFHELPER
|
||||
public boolean isWithinBounds(BlockPos pos) {
|
||||
return (double) (pos.getX() + 1) > this.getMinX() && (double) pos.getX() < this.getMaxX() && (double) (pos.getZ() + 1) > this.getMinZ() && (double) pos.getZ() < this.getMaxZ();
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Phantom extends FlyingMob implements Enemy {
|
||||
if (this.spawningEntity != null) {
|
||||
nbt.setUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
||||
}
|
||||
+ nbt.putBoolean("Paper.ShouldBurnInDay", shouldBurnInDay);
|
||||
// Paper end
|
||||
|
@ -17,15 +17,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
private static final UUID SPEED_MODIFIER_DRINKING_UUID = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
|
||||
private static final AttributeModifier SPEED_MODIFIER_DRINKING = new AttributeModifier(Witch.SPEED_MODIFIER_DRINKING_UUID, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION);
|
||||
private static final EntityDataAccessor<Boolean> DATA_USING_ITEM = SynchedEntityData.defineId(Witch.class, EntityDataSerializers.BOOLEAN);
|
||||
- private int usingTime;
|
||||
+ private int usingTime; @Deprecated public int getPotionUseTimeLeft() { return usingTime; } @Deprecated public void setPotionUseTimeLeft(int timeLeft) { usingTime = timeLeft; } // Paper - OBFHELPER
|
||||
private NearestHealableRaiderTargetGoal<Raider> healRaidersGoal;
|
||||
private NearestAttackableWitchTargetGoal<Player> attackPlayersGoal;
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Witch extends Raider implements RangedAttackMob {
|
||||
}
|
||||
|
||||
@ -117,12 +108,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ public int getPotionUseTimeLeft() {
|
||||
+ return getHandle().getPotionUseTimeLeft();
|
||||
+ return getHandle().usingTime;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setPotionUseTimeLeft(int ticks) {
|
||||
+ getHandle().setPotionUseTimeLeft(ticks);
|
||||
+ getHandle().usingTime = ticks;
|
||||
+ }
|
||||
+
|
||||
+ public ItemStack getDrinkingPotion() {
|
||||
|
@ -182,7 +182,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ private static CompoundTag readOversizedChunk(RegionFile regionfile, ChunkPos chunkCoordinate) throws IOException {
|
||||
+ synchronized (regionfile) {
|
||||
+ try (DataInputStream datainputstream = regionfile.getReadStream(chunkCoordinate)) {
|
||||
+ try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) {
|
||||
+ CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z);
|
||||
+ CompoundTag chunk = NbtIo.read((DataInput) datainputstream);
|
||||
+ if (oversizedData == null) {
|
||||
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (!this.aware) return; // CraftBukkit
|
||||
+ if (!this.aware) { // Paper start - Allow nerfed mobs to jump, float and take water damage
|
||||
+ if (goalFloat != null) {
|
||||
+ if (goalFloat.validConditions()) goalFloat.tick();
|
||||
+ if (goalFloat.canUse()) goalFloat.tick();
|
||||
+ this.getJumpControl().tick();
|
||||
+ }
|
||||
+ if ((this instanceof net.minecraft.world.entity.monster.Blaze || this instanceof net.minecraft.world.entity.monster.EnderMan) && isInWaterRainOrBubble()) {
|
||||
@ -73,8 +73,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.setFlags(EnumSet.of(Goal.Flag.JUMP));
|
||||
mob.getNavigation().setCanFloat(true);
|
||||
}
|
||||
|
||||
+ @Deprecated public final boolean validConditions() { return this.canUse(); } // Paper - OBFHELPER
|
||||
@Override
|
||||
public boolean canUse() {
|
||||
return this.mob.isInWater() && this.mob.getFluidHeight(FluidTags.WATER) > this.mob.getFluidJumpThreshold() || this.mob.isInLava();
|
||||
|
@ -169,7 +169,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private final int[] predefinedBlockDataBitsEndStoneGlobal;
|
||||
+ private final boolean[] solidGlobal = new boolean[Block.BLOCK_STATE_REGISTRY.size()];
|
||||
+ private final boolean[] obfuscateGlobal = new boolean[Block.BLOCK_STATE_REGISTRY.size()];
|
||||
+ private final LevelChunkSection[] emptyNearbyChunkSections = {LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION, LevelChunk.EMPTY_CHUNK_SECTION};
|
||||
+ private final LevelChunkSection[] emptyNearbyChunkSections = {LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION, LevelChunk.EMPTY_SECTION};
|
||||
+ private final int maxBlockYUpdatePosition;
|
||||
+
|
||||
+ public ChunkPacketBlockControllerAntiXray(Level world, Executor executor) {
|
||||
@ -194,9 +194,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ predefinedBlockDataNetherrack = new BlockState[] {Blocks.NETHERRACK.defaultBlockState()};
|
||||
+ predefinedBlockDataEndStone = new BlockState[] {Blocks.END_STONE.defaultBlockState()};
|
||||
+ predefinedBlockDataBitsGlobal = null;
|
||||
+ predefinedBlockDataBitsStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.STONE.defaultBlockState())};
|
||||
+ predefinedBlockDataBitsNetherrackGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.NETHERRACK.defaultBlockState())};
|
||||
+ predefinedBlockDataBitsEndStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(Blocks.END_STONE.defaultBlockState())};
|
||||
+ predefinedBlockDataBitsStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.STONE.defaultBlockState())};
|
||||
+ predefinedBlockDataBitsNetherrackGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.NETHERRACK.defaultBlockState())};
|
||||
+ predefinedBlockDataBitsEndStoneGlobal = new int[] {LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(Blocks.END_STONE.defaultBlockState())};
|
||||
+ } else {
|
||||
+ toObfuscate = new ArrayList<>(paperWorldConfig.replacementBlocks);
|
||||
+ List<BlockState> predefinedBlockDataList = new LinkedList<BlockState>();
|
||||
@ -221,7 +221,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ predefinedBlockDataBitsGlobal = new int[predefinedBlockDataFull.length];
|
||||
+
|
||||
+ for (int i = 0; i < predefinedBlockDataFull.length; i++) {
|
||||
+ predefinedBlockDataBitsGlobal[i] = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(predefinedBlockDataFull[i]);
|
||||
+ predefinedBlockDataBitsGlobal[i] = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(predefinedBlockDataFull[i]);
|
||||
+ }
|
||||
+
|
||||
+ predefinedBlockDataBitsStoneGlobal = null;
|
||||
@ -235,10 +235,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Don't obfuscate air because air causes unnecessary block updates and causes block updates to fail in the void
|
||||
+ if (block != null && !block.defaultBlockState().isAir()) {
|
||||
+ // Replace all block states of a specified block
|
||||
+ // No OBFHELPER for nms.BlockStateList#a() due to too many decompile errors
|
||||
+ // The OBFHELPER should be getBlockDataList()
|
||||
+ for (BlockState blockData : block.getStateDefinition().getPossibleStates()) {
|
||||
+ obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)] = true;
|
||||
+ obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)] = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -247,7 +245,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ BlockPos zeroPos = new BlockPos(0, 0, 0);
|
||||
+
|
||||
+ for (int i = 0; i < solidGlobal.length; i++) {
|
||||
+ BlockState blockData = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getObject(i);
|
||||
+ BlockState blockData = LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.valueFor(i);
|
||||
+
|
||||
+ if (blockData != null) {
|
||||
+ solidGlobal[i] = blockData.isRedstoneConductor(emptyChunk, zeroPos)
|
||||
@ -378,7 +376,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ predefinedBlockDataBitsTemp = predefinedBlockDataBits;
|
||||
+
|
||||
+ for (int i = 0; i < predefinedBlockDataBitsTemp.length; i++) {
|
||||
+ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).getOrCreateIdFor(predefinedBlockDataFull[i]);
|
||||
+ predefinedBlockDataBitsTemp[i] = chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex).idFor(predefinedBlockDataFull[i]);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -393,12 +391,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ obfuscateTemp = readDataPalette(chunkPacketInfoAntiXray.getDataPalette(chunkSectionIndex), obfuscate, obfuscateGlobal);
|
||||
+ // Read the blocks of the upper layer of the chunk section below if it exists
|
||||
+ LevelChunkSection belowChunkSection = null;
|
||||
+ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == LevelChunk.EMPTY_CHUNK_SECTION;
|
||||
+ boolean skipFirstLayer = chunkSectionIndex == 0 || (belowChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex - 1]) == LevelChunk.EMPTY_SECTION;
|
||||
+
|
||||
+ for (int z = 0; z < 16; z++) {
|
||||
+ for (int x = 0; x < 16; x++) {
|
||||
+ current[z][x] = true;
|
||||
+ next[z][x] = skipFirstLayer || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(belowChunkSection.getBlockState(x, 15, z))];
|
||||
+ next[z][x] = skipFirstLayer || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(belowChunkSection.getBlockState(x, 15, z))];
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -408,10 +406,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ dataBitsWriter.setBitsPerObject(chunkPacketInfoAntiXray.getBitsPerObject(chunkSectionIndex));
|
||||
+ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? LevelChunk.EMPTY_CHUNK_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[3].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[0] = chunkPacketInfoAntiXray.getNearbyChunks()[0] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[0].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[1] = chunkPacketInfoAntiXray.getNearbyChunks()[1] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[1].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[2] = chunkPacketInfoAntiXray.getNearbyChunks()[2] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[2].getSections()[chunkSectionIndex];
|
||||
+ nearbyChunkSections[3] = chunkPacketInfoAntiXray.getNearbyChunks()[3] == null ? LevelChunk.EMPTY_SECTION : chunkPacketInfoAntiXray.getNearbyChunks()[3].getSections()[chunkSectionIndex];
|
||||
+
|
||||
+ // Obfuscate all layers of the current chunk section except the upper one
|
||||
+ for (int y = 0; y < 15; y++) {
|
||||
@ -427,7 +425,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // If so, obfuscate the upper layer of the current chunk section by reading blocks of the first layer from the chunk section above if it exists
|
||||
+ LevelChunkSection aboveChunkSection;
|
||||
+
|
||||
+ if (chunkSectionIndex != worldSectionHeight && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != LevelChunk.EMPTY_CHUNK_SECTION) {
|
||||
+ if (chunkSectionIndex != worldSectionHeight && (aboveChunkSection = chunkPacketInfoAntiXray.getChunk().getSections()[chunkSectionIndex + 1]) != LevelChunk.EMPTY_SECTION) {
|
||||
+ boolean[][] temp = current;
|
||||
+ current = next;
|
||||
+ next = nextNext;
|
||||
@ -435,7 +433,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ for (int z = 0; z < 16; z++) {
|
||||
+ for (int x = 0; x < 16; x++) {
|
||||
+ if (!solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(aboveChunkSection.getBlockState(x, 0, z))]) {
|
||||
+ if (!solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(aboveChunkSection.getBlockState(x, 0, z))]) {
|
||||
+ current[z][x] = true;
|
||||
+ }
|
||||
+ }
|
||||
@ -475,7 +473,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[0][1] = true;
|
||||
+ next[1][0] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, 0))] || current[0][0]) {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(0, y, 15))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 0))] || current[0][0]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -496,7 +494,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[0][x + 1] = true;
|
||||
+ next[1][x] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(x, y, 15))] || current[0][x]) {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(x, y, 15))] || current[0][x]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -516,7 +514,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[0][14] = true;
|
||||
+ next[1][15] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, 0))] || current[0][15]) {
|
||||
+ if (nearbyChunkSections[2] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[2].getBlockState(15, y, 15))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 0))] || current[0][15]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -538,7 +536,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[z - 1][0] = true;
|
||||
+ next[z + 1][0] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, z))] || current[z][0]) {
|
||||
+ if (nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, z))] || current[z][0]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -581,7 +579,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[z - 1][15] = true;
|
||||
+ next[z + 1][15] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, z))] || current[z][15]) {
|
||||
+ if (nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, z))] || current[z][15]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -601,7 +599,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[15][1] = true;
|
||||
+ next[14][0] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[0].getBlockState(15, y, 15))] || current[15][0]) {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(0, y, 0))] || nearbyChunkSections[0] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[0].getBlockState(15, y, 15))] || current[15][0]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -622,7 +620,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[15][x + 1] = true;
|
||||
+ next[14][x] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(x, y, 0))] || current[15][x]) {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(x, y, 0))] || current[15][x]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -642,7 +640,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ next[15][14] = true;
|
||||
+ next[14][15] = true;
|
||||
+ } else {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_CHUNK_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(nearbyChunkSections[1].getBlockState(0, y, 15))] || current[15][15]) {
|
||||
+ if (nearbyChunkSections[3] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[3].getBlockState(15, y, 0))] || nearbyChunkSections[1] == LevelChunk.EMPTY_SECTION || !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(nearbyChunkSections[1].getBlockState(0, y, 15))] || current[15][15]) {
|
||||
+ dataBitsWriter.skip();
|
||||
+ } else {
|
||||
+ dataBitsWriter.write(predefinedBlockDataBits[random.getAsInt()]);
|
||||
@ -661,8 +659,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ BlockState blockData;
|
||||
+
|
||||
+ for (int i = 0; (blockData = dataPalette.getObject(i)) != null; i++) {
|
||||
+ temp[i] = global[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)];
|
||||
+ for (int i = 0; (blockData = dataPalette.valueFor(i)) != null; i++) {
|
||||
+ temp[i] = global[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)];
|
||||
+ }
|
||||
+
|
||||
+ return temp;
|
||||
@ -670,7 +668,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public void onBlockChange(Level world, BlockPos blockPosition, BlockState newBlockData, BlockState oldBlockData, int flag) {
|
||||
+ if (oldBlockData != null && solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(oldBlockData)] && !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(newBlockData)] && blockPosition.getY() <= maxBlockYUpdatePosition) {
|
||||
+ if (oldBlockData != null && solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(oldBlockData)] && !solidGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(newBlockData)] && blockPosition.getY() <= maxBlockYUpdatePosition) {
|
||||
+ updateNearbyBlocks(world, blockPosition);
|
||||
+ }
|
||||
+ }
|
||||
@ -724,7 +722,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private void updateBlock(Level world, BlockPos blockPosition) {
|
||||
+ BlockState blockData = world.getTypeIfLoaded(blockPosition);
|
||||
+
|
||||
+ if (blockData != null && obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.getOrCreateIdFor(blockData)]) {
|
||||
+ if (blockData != null && obfuscateGlobal[LevelChunkSection.GLOBAL_BLOCKSTATE_PALETTE.idFor(blockData)]) {
|
||||
+ // world.notify(blockPosition, blockData, blockData, 3);
|
||||
+ ((ServerLevel)world).getChunkSource().blockChanged(blockPosition); // We only need to re-send to client
|
||||
+ }
|
||||
@ -1313,9 +1311,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
private final Function<T, CompoundTag> writer;
|
||||
private final T defaultValue;
|
||||
+ private final T[] predefinedObjects; // Paper - Anti-Xray - Add predefined objects
|
||||
protected BitStorage storage; @Deprecated public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER
|
||||
private Palette<T> palette; @Deprecated private Palette<T> getDataPalette() { return this.palette; } // Paper - OBFHELPER
|
||||
private int bits; @Deprecated private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER
|
||||
protected BitStorage storage;
|
||||
private Palette<T> palette;
|
||||
private int bits;
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
this.lock.release();
|
||||
}
|
||||
@ -1339,7 +1337,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (initialize) {
|
||||
+ if (predefinedObjects == null) {
|
||||
+ // Default
|
||||
+ this.initialize(4);
|
||||
+ this.setBits(4);
|
||||
+ } else {
|
||||
+ // MathHelper.d() is trailingBits(roundCeilPow2(n)), alternatively; (int)ceil(log2(n)); however it's trash, use numberOfLeadingZeros instead
|
||||
+ // Count the bits of the maximum array index to initialize a data palette with enough space from the beginning
|
||||
@ -1349,7 +1347,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ int bitCount = (32 - Integer.numberOfLeadingZeros(Math.max(16, maxIndex) - 1));
|
||||
+
|
||||
+ // Initialize with at least 15 free indixes
|
||||
+ this.initialize((1 << bitCount) - predefinedObjects.length < 16 ? bitCount + 1 : bitCount);
|
||||
+ this.setBits((1 << bitCount) - predefinedObjects.length < 16 ? bitCount + 1 : bitCount);
|
||||
+ this.addPredefinedObjects();
|
||||
+ }
|
||||
+ }
|
||||
@ -1360,7 +1358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private void addPredefinedObjects() {
|
||||
+ if (this.predefinedObjects != null && this.palette != this.globalPalette) {
|
||||
+ for (T predefinedObject : this.predefinedObjects) {
|
||||
+ this.palette.getOrCreateIdFor(predefinedObject);
|
||||
+ this.palette.idFor(predefinedObject);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
@ -1378,9 +1376,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
T object = palette.valueFor(bitStorage.get(i));
|
||||
if (object != null) {
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
}
|
||||
|
||||
@Deprecated public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER
|
||||
- public void write(FriendlyByteBuf buf) {
|
||||
+ // Paper start - Anti-Xray - Add chunk packet info
|
||||
+ @Deprecated public void write(FriendlyByteBuf buf) {
|
||||
|
@ -3666,7 +3666,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ ((CraftWorld) loc.getWorld()).getHandle().getChunkSource().addTicketAtLevel(TicketType.POST_TELEPORT, pair, 31, 0);
|
||||
+ net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pair.toLong());
|
||||
+ if (updatingChunk != null) {
|
||||
+ return updatingChunk.getEntityTickingFuture();
|
||||
+ return updatingChunk.getEntityTickingChunkFuture();
|
||||
+ } else {
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(com.mojang.datafixers.util.Either.left(((org.bukkit.craftbukkit.CraftChunk)chunk).getHandle()));
|
||||
+ }
|
||||
|
@ -477,14 +477,6 @@ diff --git a/src/main/java/net/minecraft/server/players/GameProfileCache.java b/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/players/GameProfileCache.java
|
||||
@@ -0,0 +0,0 @@ public class GameProfileCache {
|
||||
return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
|
||||
}
|
||||
|
||||
+ @Deprecated public void saveProfile(GameProfile gameprofile) { add(gameprofile); } // Paper - OBFHELPER
|
||||
public synchronized void add(GameProfile profile) { // Paper - synchronize
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class GameProfileCache {
|
||||
}
|
||||
}
|
||||
|
@ -21,12 +21,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start
|
||||
+ private final BlockPos.MutableBlockPos mutPos = new BlockPos.MutableBlockPos();
|
||||
+ public boolean isBlockInBounds(int chunkX, int chunkZ) {
|
||||
+ this.mutPos.setValues(chunkX, 64, chunkZ);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ this.mutPos.set(chunkX, 64, chunkZ);
|
||||
+ return this.isWithinBounds(this.mutPos);
|
||||
+ }
|
||||
+ public boolean isChunkInBounds(int chunkX, int chunkZ) {
|
||||
+ this.mutPos.setValues(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
||||
+ return this.isInBounds(this.mutPos);
|
||||
+ this.mutPos.set(((chunkX << 4) + 15), 64, (chunkZ << 4) + 15);
|
||||
+ return this.isWithinBounds(this.mutPos);
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
if (this.packetListener instanceof ServerLoginPacketListenerImpl) {
|
||||
+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).getLoginState() != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
||||
+ if ( ((ServerLoginPacketListenerImpl) this.packetListener).state != ServerLoginPacketListenerImpl.State.READY_TO_ACCEPT // Paper
|
||||
+ || (joinAttemptsThisTick++ < MAX_PER_TICK)) { // Paper - limit the number of joins which can be processed each tick
|
||||
((ServerLoginPacketListenerImpl) this.packetListener).tick();
|
||||
+ } // Paper
|
||||
|
@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ int entityTicking = 0;
|
||||
+
|
||||
+ for (ChunkHolder chunk : world.getChunkSource().chunkMap.updatingChunkMap.values()) {
|
||||
+ if (chunk.getFullChunkIfCached() == null) {
|
||||
+ if (chunk.getFullChunkUnchecked() == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
@ -334,7 +334,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ int fullLoadedChunks = 0;
|
||||
+
|
||||
+ for (ChunkHolder chunk : allChunks) {
|
||||
+ if (chunk.getFullChunkIfCached() != null) {
|
||||
+ if (chunk.getFullChunkUnchecked() != null) {
|
||||
+ ++fullLoadedChunks;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -4,32 +4,6 @@ Date: Thu, 31 Mar 2016 19:17:58 -0400
|
||||
Subject: [PATCH] Do not load chunks for Pathfinding
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
private BlockPos targetPos;
|
||||
private int reachRange;
|
||||
private float maxVisitedNodesMultiplier = 1.0F;
|
||||
- private final PathFinder pathFinder;
|
||||
+ private final PathFinder pathFinder; @Deprecated public PathFinder getPathfinder() { return this.pathFinder; } // Paper - OBFHELPER
|
||||
private boolean isStuck;
|
||||
|
||||
public PathNavigation(Mob mob, Level world) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java
|
||||
@@ -0,0 +0,0 @@ public class PathFinder {
|
||||
private static final float FUDGING = 1.5F;
|
||||
private final Node[] neighbors = new Node[32];
|
||||
private final int maxVisitedNodes;
|
||||
- private final NodeEvaluator nodeEvaluator;
|
||||
+ private final NodeEvaluator nodeEvaluator; @Deprecated public NodeEvaluator getPathfinder() { return this.nodeEvaluator; } // Paper - OBFHELPER
|
||||
private static final boolean DEBUG = false;
|
||||
private final BinaryHeap openSet = new BinaryHeap();
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/WalkNodeEvaluator.java
|
||||
|
@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit end
|
||||
+ // Paper start - Save the entity's origin location
|
||||
+ if (this.origin != null) {
|
||||
+ nbt.setUUID("Paper.OriginWorld", originWorld);
|
||||
+ nbt.putUUID("Paper.OriginWorld", originWorld);
|
||||
+ nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void inactiveTick() { }
|
||||
// Spigot end
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
nbt.setUUID("Paper.OriginWorld", originWorld);
|
||||
nbt.putUUID("Paper.OriginWorld", originWorld);
|
||||
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
}
|
||||
+ // Save entity's from mob spawner status
|
||||
|
@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
|
||||
public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||
nbt.setUUID("Paper.OriginWorld", originWorld);
|
||||
nbt.putUUID("Paper.OriginWorld", originWorld);
|
||||
nbt.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
||||
}
|
||||
+ if (spawnReason != null) {
|
||||
|
@ -43,15 +43,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public abstract class PathNavigation {
|
||||
private static final int MAX_TIME_RECOMPUTE = 20;
|
||||
- protected final Mob mob;
|
||||
+ protected final Mob mob; @Deprecated public Entity getEntity() { return mob; } // Paper - OBFHELPER
|
||||
protected final Level level;
|
||||
@Nullable
|
||||
protected Path path;
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
|
||||
@Nullable
|
||||
@ -99,8 +90,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start - Pathfind event
|
||||
+ boolean copiedSet = false;
|
||||
+ for (BlockPos possibleTarget : positions) {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
||||
+ MCUtil.toLocation(getEntity().level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(),
|
||||
+ MCUtil.toLocation(this.mob.level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
+ if (!copiedSet) {
|
||||
+ copiedSet = true;
|
||||
+ positions = new java.util.HashSet<>(positions);
|
||||
|
@ -56,10 +56,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private void savePaperNBT(CompoundTag nbttagcompound) {
|
||||
+ CompoundTag comp = new CompoundTag();
|
||||
+ if (this.sourceEntityId != null) {
|
||||
+ comp.setUUID("source", this.sourceEntityId);
|
||||
+ comp.putUUID("source", this.sourceEntityId);
|
||||
+ }
|
||||
+ if (this.triggerEntityId != null) {
|
||||
+ comp.setUUID("trigger", triggerEntityId);
|
||||
+ comp.putUUID("trigger", triggerEntityId);
|
||||
+ }
|
||||
+ if (this.spawnReason != null && this.spawnReason != org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN) {
|
||||
+ comp.putString("reason", this.spawnReason.name());
|
||||
@ -255,19 +255,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.discard();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java b/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java
|
||||
+++ b/src/main/java/net/minecraft/world/inventory/FurnaceResultSlot.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity;
|
||||
|
||||
public class FurnaceResultSlot extends Slot {
|
||||
|
||||
- private final Player player;
|
||||
+ private final Player player; @Deprecated public final Player getPlayer() { return this.player; } // Paper OBFHELPER
|
||||
private int removeCount;
|
||||
|
||||
public FurnaceResultSlot(Player player, Container inventory, int index, int x, int y) {
|
||||
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
|
||||
|
@ -22,7 +22,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
nbt.putBoolean("ShotAtAngle", (Boolean) this.entityData.get(FireworkRocketEntity.DATA_SHOT_AT_ANGLE));
|
||||
+ // Paper start
|
||||
+ if (this.spawningEntity != null) {
|
||||
+ nbt.setUUID("SpawningEntity", this.spawningEntity);
|
||||
+ nbt.putUUID("SpawningEntity", this.spawningEntity);
|
||||
+ }
|
||||
+ // Paper end
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ public ChunkAccess getAvailableChunkNow() {
|
||||
+ // TODO can we just getStatusFuture(EMPTY)?
|
||||
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getPreviousStatus(); curr != next; curr = next, next = next.getPreviousStatus()) {
|
||||
+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getParent(); curr != next; curr = next, next = next.getParent()) {
|
||||
+ CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> future = this.getFutureIfPresentUnchecked(curr);
|
||||
+ Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = future.getNow(null);
|
||||
+ if (either == null || !either.left().isPresent()) {
|
||||
@ -123,14 +123,6 @@ diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/sr
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java
|
||||
@@ -0,0 +0,0 @@ public class ChunkStatus {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
+ @Deprecated public ChunkStatus getPreviousStatus() { return this.getParent(); } // Paper - OBFHELPER
|
||||
public ChunkStatus getParent() {
|
||||
return this.parent;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class ChunkStatus {
|
||||
return this.chunkType;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (nbttagcompound != null && nbttagcompound.contains("SkullOwner", 10)) {
|
||||
+ CompoundTag owner = nbttagcompound.getCompound("SkullOwner");
|
||||
+ if (owner.hasUUID("Id")) {
|
||||
+ nbttagcompound.setUUID("SkullOwnerOrig", owner.getUUID("Id"));
|
||||
+ nbttagcompound.putUUID("SkullOwnerOrig", owner.getUUID("Id"));
|
||||
+ net.minecraft.world.level.block.entity.SkullBlockEntity.sanitizeUUID(owner);
|
||||
+ }
|
||||
+ }
|
||||
@ -105,11 +105,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ String textures = ((CompoundTag)list.get(0)).getString("Value");
|
||||
+ if (textures != null && textures.length() > 3) {
|
||||
+ UUID uuid = UUID.nameUUIDFromBytes(textures.getBytes());
|
||||
+ owner.setUUID("Id", uuid);
|
||||
+ owner.putUUID("Id", uuid);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ owner.setUUID("Id", UUID.randomUUID());
|
||||
+ owner.putUUID("Id", UUID.randomUUID());
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
|
@ -427,7 +427,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Prioritize circular near
|
||||
+ double playerChunkX = Mth.floor(player.getX()) >> 4;
|
||||
+ double playerChunkZ = Mth.floor(player.getZ()) >> 4;
|
||||
+ pos.setValues(player.getX(), 0, player.getZ());
|
||||
+ pos.set(player.getX(), 0, player.getZ());
|
||||
+ double twoThirdModifier = 2D / 3D;
|
||||
+ MCUtil.getSpiralOutChunks(pos, Math.min(6, viewDistance)).forEach(coord -> {
|
||||
+ if (shouldSkipPrioritization(coord)) return;
|
||||
@ -445,7 +445,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ // Prioritize Frustum near 3
|
||||
+ ChunkPos front3 = player.getChunkInFront(3);
|
||||
+ pos.setValues(front3.x << 4, 0, front3.z << 4);
|
||||
+ pos.set(front3.x << 4, 0, front3.z << 4);
|
||||
+ MCUtil.getSpiralOutChunks(pos, Math.min(5, viewDistance)).forEach(coord -> {
|
||||
+ if (shouldSkipPrioritization(coord)) return;
|
||||
+
|
||||
@ -456,7 +456,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Prioritize Frustum near 5
|
||||
+ if (viewDistance > 4) {
|
||||
+ ChunkPos front5 = player.getChunkInFront(5);
|
||||
+ pos.setValues(front5.x << 4, 0, front5.z << 4);
|
||||
+ pos.set(front5.x << 4, 0, front5.z << 4);
|
||||
+ MCUtil.getSpiralOutChunks(pos, 4).forEach(coord -> {
|
||||
+ if (shouldSkipPrioritization(coord)) return;
|
||||
+
|
||||
@ -468,7 +468,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Prioritize Frustum far 7
|
||||
+ if (viewDistance > 6) {
|
||||
+ ChunkPos front7 = player.getChunkInFront(7);
|
||||
+ pos.setValues(front7.x << 4, 0, front7.z << 4);
|
||||
+ pos.set(front7.x << 4, 0, front7.z << 4);
|
||||
+ MCUtil.getSpiralOutChunks(pos, 3).forEach(coord -> {
|
||||
+ if (shouldSkipPrioritization(coord)) {
|
||||
+ return;
|
||||
@ -878,16 +878,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ ServerPlayer player = (ServerPlayer) backingSet[index];
|
||||
+
|
||||
+ ChunkPos pointInFront = player.getChunkInFront(5);
|
||||
+ pos.setValues(pointInFront.x << 4, 0, pointInFront.z << 4);
|
||||
+ pos.set(pointInFront.x << 4, 0, pointInFront.z << 4);
|
||||
+ double frontDist = net.minecraft.server.MCUtil.distanceSq(pos, blockPos);
|
||||
+
|
||||
+ pos.setValues(player.getX(), 0, player.getZ());
|
||||
+ pos.set(player.getX(), 0, player.getZ());
|
||||
+ double center = net.minecraft.server.MCUtil.distanceSq(pos, blockPos);
|
||||
+
|
||||
+ double dist = Math.min(frontDist, center);
|
||||
+ if (!isFront) {
|
||||
+ ChunkPos pointInBack = player.getChunkInFront(-7);
|
||||
+ pos.setValues(pointInBack.x << 4, 0, pointInBack.z << 4);
|
||||
+ pos.set(pointInBack.x << 4, 0, pointInBack.z << 4);
|
||||
+ double backDist = net.minecraft.server.MCUtil.distanceSq(pos, blockPos);
|
||||
+ if (frontDist < backDist) {
|
||||
+ isFront = true;
|
||||
@ -1126,7 +1126,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ worldserver1.getChunkSource().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { // Paper - Chunk priority
|
||||
net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong());
|
||||
if (updatingChunk != null) {
|
||||
return updatingChunk.getEntityTickingFuture();
|
||||
return updatingChunk.getEntityTickingChunkFuture();
|
||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||
SocketAddress socketaddress = loginlistener.connection.getRemoteAddress();
|
||||
|
||||
|
@ -152,7 +152,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ worldserver1.getChunkSource().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> {
|
||||
+ net.minecraft.server.level.ChunkHolder updatingChunk = playerChunkMap.getUpdatingChunkIfPresent(pos.toLong());
|
||||
+ if (updatingChunk != null) {
|
||||
+ return updatingChunk.getEntityTickingFuture();
|
||||
+ return updatingChunk.getEntityTickingChunkFuture();
|
||||
+ } else {
|
||||
+ return java.util.concurrent.CompletableFuture.completedFuture(chunk);
|
||||
+ }
|
||||
|
@ -342,7 +342,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ ListTag list = new ListTag();
|
||||
+ for (Map.Entry<UUID, Long> entry : this.lootedPlayers.entrySet()) {
|
||||
+ CompoundTag cmp = new CompoundTag();
|
||||
+ cmp.setUUID("UUID", entry.getKey());
|
||||
+ cmp.putUUID("UUID", entry.getKey());
|
||||
+ cmp.putLong("Time", entry.getValue());
|
||||
+ list.add(cmp);
|
||||
+ }
|
||||
|
@ -760,7 +760,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ public static BlockState getBlockDataFromRaw(final long raw) {
|
||||
+ return GLOBAL_PALETTE.getObject((int)(raw >>> 32));
|
||||
+ return GLOBAL_PALETTE.valueFor((int)(raw >>> 32));
|
||||
+ }
|
||||
+
|
||||
+ public static int getIndexFromRaw(final long raw) {
|
||||
@ -772,7 +772,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ public static long getRawFromValues(final int index, final int location, final BlockState data) {
|
||||
+ return (long)index | ((long)location << 16) | (((long)GLOBAL_PALETTE.getOrCreateIdFor(data)) << 32);
|
||||
+ return (long)index | ((long)location << 16) | (((long)GLOBAL_PALETTE.idFor(data)) << 32);
|
||||
+ }
|
||||
+
|
||||
+ public static long setIndexRawValues(final long value, final int index) {
|
||||
@ -2274,22 +2274,6 @@ diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/core/BlockPos.java
|
||||
+++ b/src/main/java/net/minecraft/core/BlockPos.java
|
||||
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
||||
return super.rotate(rotation).immutable();
|
||||
}
|
||||
|
||||
+ @Deprecated public final BlockPos.MutableBlockPos setValues(int i, int j, int k) { return set(i, j, k);} // Paper - OBFHELPER
|
||||
public BlockPos.MutableBlockPos set(int x, int y, int z) {
|
||||
this.setX(x);
|
||||
this.setY(y);
|
||||
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
||||
return this;
|
||||
}
|
||||
|
||||
+ @Deprecated public final BlockPos.MutableBlockPos setValues(double d0, double d1, double d2) { return set(d0, d1, d2);} // Paper - OBFHELPER
|
||||
public BlockPos.MutableBlockPos set(double x, double y, double z) {
|
||||
return this.set(Mth.floor(x), Mth.floor(y), Mth.floor(z));
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public class BlockPos extends Vec3i {
|
||||
}
|
||||
}
|
||||
@ -2320,11 +2304,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
protected CompoundTag(Map<String, Tag> entries) {
|
||||
this.tags = entries;
|
||||
@@ -0,0 +0,0 @@ public class CompoundTag implements Tag {
|
||||
this.tags.put(key, LongTag.valueOf(value));
|
||||
}
|
||||
|
||||
+ @Deprecated public void setUUID(String prefix, UUID uuid) { putUUID(prefix, uuid); } // Paper - OBFHELPER
|
||||
public void putUUID(String key, UUID value) {
|
||||
this.tags.put(key, NbtUtils.createUUID(value));
|
||||
}
|
||||
|
||||
@ -2335,18 +2314,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public UUID getUUID(String key) {
|
||||
return NbtUtils.loadUUID(this.get(key));
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/network/FriendlyByteBuf.java b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
+++ b/src/main/java/net/minecraft/network/FriendlyByteBuf.java
|
||||
@@ -0,0 +0,0 @@ public class FriendlyByteBuf extends ByteBuf {
|
||||
this.source = parent;
|
||||
}
|
||||
|
||||
+ @Deprecated public static int countBytes(int i) { return FriendlyByteBuf.getVarIntSize(i); } // Paper - OBFHELPER
|
||||
public static int getVarIntSize(int value) {
|
||||
for (int j = 1; j < 5; ++j) {
|
||||
if ((value & -1 << j * 7) == 0) {
|
||||
diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/network/PacketEncoder.java
|
||||
@ -2915,23 +2882,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!ChunkHolder.getFullChunkStatus(this.oldTicketLevel).isOrAfter(ChunkHolder.FullChunkStatus.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks
|
||||
return this.getFullChunkUnchecked();
|
||||
}
|
||||
|
||||
+ @Deprecated public final LevelChunk getFullChunkIfCached() { return this.getFullChunkUnchecked(); } // Paper - OBFHELPER
|
||||
public LevelChunk getFullChunkUnchecked() {
|
||||
CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
|
||||
Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure> either = (Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>) statusFuture.getNow(null);
|
||||
@@ -0,0 +0,0 @@ public class ChunkHolder {
|
||||
return ChunkHolder.getStatus(this.ticketLevel).isOrAfter(leastStatus) ? this.getFutureIfPresentUnchecked(leastStatus) : ChunkHolder.UNLOADED_CHUNK_FUTURE;
|
||||
}
|
||||
|
||||
- public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getTickingChunkFuture() {
|
||||
+ @Deprecated public final CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getTickingFuture() { return this.getTickingChunkFuture(); } // Paper - OBFHELPER
|
||||
+ public final CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getTickingChunkFuture() { // Paper - final for inline
|
||||
return this.tickingChunkFuture;
|
||||
}
|
||||
|
||||
- public CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getEntityTickingChunkFuture() {
|
||||
+ @Deprecated public final CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getEntityTickingFuture() { return this.getEntityTickingChunkFuture(); } // Paper - OBFHELPER
|
||||
+ public final CompletableFuture<Either<LevelChunk, ChunkHolder.ChunkLoadingFailure>> getEntityTickingChunkFuture() { // Paper - final for inline
|
||||
return this.entityTickingChunkFuture;
|
||||
}
|
||||
@ -3214,7 +3174,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+ this.getChunkFutureAsynchronously(x, z, 31, ChunkHolder::getEntityTickingFuture, onLoad);
|
||||
+ this.getChunkFutureAsynchronously(x, z, 31, ChunkHolder::getEntityTickingChunkFuture, onLoad);
|
||||
+ }
|
||||
+
|
||||
+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
|
||||
@ -3224,7 +3184,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ });
|
||||
+ return;
|
||||
+ }
|
||||
+ this.getChunkFutureAsynchronously(x, z, 32, ChunkHolder::getTickingFuture, onLoad);
|
||||
+ this.getChunkFutureAsynchronously(x, z, 32, ChunkHolder::getTickingChunkFuture, onLoad);
|
||||
+ }
|
||||
+
|
||||
+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<LevelChunk> onLoad) {
|
||||
@ -3306,7 +3266,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ return playerChunk.getFullChunkIfCached();
|
||||
+ return playerChunk.getFullChunkUnchecked();
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
@ -3514,19 +3474,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
protected Monster(EntityType<? extends Monster> type, Level world) {
|
||||
super(type, world);
|
||||
this.xpReward = 5;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Inventory.java b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Inventory.java
|
||||
@@ -0,0 +0,0 @@ public class Inventory implements Container, Nameable {
|
||||
public final NonNullList<ItemStack> items;
|
||||
public final NonNullList<ItemStack> armor;
|
||||
public final NonNullList<ItemStack> offhand;
|
||||
- private final List<NonNullList<ItemStack>> compartments;
|
||||
+ private final List<NonNullList<ItemStack>> compartments; @Deprecated public final List<NonNullList<ItemStack>> getComponents() { return compartments; } // Paper - OBFHELPER
|
||||
public int selected;
|
||||
public final Player player;
|
||||
private int timesChanged;
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
||||
@ -3556,14 +3503,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
public void setTag(@Nullable CompoundTag tag) {
|
||||
this.tag = tag;
|
||||
if (this.getItem().canBeDepleted()) {
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
return this.tag != null && this.tag.contains("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false;
|
||||
}
|
||||
|
||||
+ @Deprecated public void getOrCreateTagAndSet(String s, net.minecraft.nbt.Tag nbtbase) { addTagElement(s, nbtbase);} // Paper - OBFHELPER
|
||||
public void addTagElement(String key, net.minecraft.nbt.Tag tag) {
|
||||
this.getOrCreateTag().put(key, tag);
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public final class ItemStack {
|
||||
// CraftBukkit start
|
||||
@Deprecated
|
||||
@ -3572,18 +3511,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.item = item;
|
||||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java b/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/alchemy/PotionUtils.java
|
||||
@@ -0,0 +0,0 @@ public class PotionUtils {
|
||||
return compound == null ? Potions.EMPTY : Potion.byName(compound.getString("Potion"));
|
||||
}
|
||||
|
||||
+ @Deprecated public static ItemStack addPotionToItemStack(ItemStack itemstack, Potion potionregistry) { return setPotion(itemstack, potionregistry); } // Paper - OBFHELPER
|
||||
public static ItemStack setPotion(ItemStack stack, Potion potion) {
|
||||
ResourceLocation resourceLocation = Registry.POTION.getKey(potion);
|
||||
if (potion == Potions.EMPTY) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/BlockGetter.java b/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/BlockGetter.java
|
||||
@ -3775,18 +3702,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return this.setBlock(pos, state, flags, 512);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public void onBlockStateChange(BlockPos pos, BlockState oldBlock, BlockState newBlock) {}
|
||||
|
||||
- @Override
|
||||
- public boolean removeBlock(BlockPos pos, boolean move) {
|
||||
+ @Deprecated public boolean setAir(BlockPos blockposition) { return this.removeBlock(blockposition, false); } // Paper - OBFHELPER
|
||||
+ @Deprecated public boolean setAir(BlockPos blockposition, boolean moved) { return this.removeBlock(blockposition, moved); } // Paper - OBFHELPER
|
||||
+ @Override public boolean removeBlock(BlockPos pos, boolean move) { // Paper - OBFHELPER
|
||||
FluidState fluid = this.getFluidState(pos);
|
||||
|
||||
return this.setBlock(pos, fluid.createLegacyBlock(), 3 | (move ? 64 : 0));
|
||||
@@ -0,0 +0,0 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
if (this.isOutsideBuildHeight(pos)) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
@ -3862,15 +3777,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.profiling.ProfilerFiller;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
}
|
||||
};
|
||||
@Nullable
|
||||
- public static final LevelChunkSection EMPTY_SECTION = null;
|
||||
+ public static final LevelChunkSection EMPTY_SECTION = null; @Deprecated public static final LevelChunkSection EMPTY_CHUNK_SECTION = EMPTY_SECTION; // Paper - OBFHELPER
|
||||
private final LevelChunkSection[] sections;
|
||||
private ChunkBiomeContainer biomes;
|
||||
private final Map<BlockPos, CompoundTag> pendingBlockEntities;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
private Supplier<ChunkHolder.FullChunkStatus> fullStatus;
|
||||
@Nullable
|
||||
@ -4099,65 +4005,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
this.setUnsaved(true);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/Palette.java b/src/main/java/net/minecraft/world/level/chunk/Palette.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/Palette.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/Palette.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
|
||||
public interface Palette<T> {
|
||||
+ @Deprecated default int getOrCreateIdFor(T object) { return this.idFor(object); } // Paper - OBFHELPER
|
||||
int idFor(T object);
|
||||
|
||||
boolean maybeHas(Predicate<T> predicate);
|
||||
|
||||
+ @Deprecated @Nullable default T getObject(int dataBits) { return this.valueFor(dataBits); } // Paper - OBFHELPER
|
||||
@Nullable
|
||||
T valueFor(int index);
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/PalettedContainer.java
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
private static final int SIZE = 4096;
|
||||
public static final int GLOBAL_PALETTE_BITS = 9;
|
||||
public static final int MIN_PALETTE_SIZE = 4;
|
||||
- private final Palette<T> globalPalette;
|
||||
+ private final Palette<T> globalPalette; @Deprecated private final Palette<T> getDataPaletteGlobal() { return this.globalPalette; } // Paper - OBFHELPER
|
||||
private final PaletteResize<T> dummyPaletteResize = (newSize, added) -> {
|
||||
return 0;
|
||||
};
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
private final Function<CompoundTag, T> reader;
|
||||
private final Function<T, CompoundTag> writer;
|
||||
private final T defaultValue;
|
||||
- protected BitStorage storage;
|
||||
- private Palette<T> palette;
|
||||
- private int bits;
|
||||
+ protected BitStorage storage; @Deprecated public final BitStorage getDataBits() { return this.storage; } // Paper - OBFHELPER
|
||||
+ private Palette<T> palette; @Deprecated private Palette<T> getDataPalette() { return this.palette; } // Paper - OBFHELPER
|
||||
+ private int bits; @Deprecated private int getBitsPerObject() { return this.bits; } // Paper - OBFHELPER
|
||||
private final Semaphore lock = new Semaphore(1);
|
||||
@Nullable
|
||||
private final DebugBuffer<Pair<Thread, StackTraceElement[]>> traces = null;
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
return y << 8 | z << 4 | x;
|
||||
}
|
||||
|
||||
+ @Deprecated private void initialize(int bitsPerObject) { this.setBits(bitsPerObject); } // Paper - OBFHELPER
|
||||
private void setBits(int size) {
|
||||
if (size != this.bits) {
|
||||
this.bits = size;
|
||||
@@ -0,0 +0,0 @@ public class PalettedContainer<T> implements PaletteResize<T> {
|
||||
|
||||
}
|
||||
|
||||
+ @Deprecated public void writeDataPaletteBlock(FriendlyByteBuf packetDataSerializer) { this.write(packetDataSerializer); } // Paper - OBFHELPER
|
||||
public void write(FriendlyByteBuf buf) {
|
||||
try {
|
||||
this.acquire();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java
|
||||
@ -4181,43 +4028,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
@Override
|
||||
public BlockState getBlockState(BlockPos pos) {
|
||||
int i = pos.getY();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java
|
||||
@@ -0,0 +0,0 @@ public class IOWorker implements AutoCloseable {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final AtomicBoolean shutdownRequested = new AtomicBoolean();
|
||||
private final ProcessorMailbox<StrictQueue.IntRunnable> mailbox;
|
||||
- private final RegionFileStorage storage;
|
||||
+ private final RegionFileStorage storage;@Deprecated public RegionFileStorage getRegionFileCache() { return storage; } // Paper - OBFHELPER
|
||||
private final Map<ChunkPos, IOWorker.PendingStore> pendingWrites = Maps.newLinkedHashMap();
|
||||
|
||||
protected IOWorker(File directory, boolean dsync, String name) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java
|
||||
@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable {
|
||||
return this.externalFileDir.resolve(s);
|
||||
}
|
||||
|
||||
+ @Deprecated @Nullable public synchronized DataInputStream getReadStream(ChunkPos chunkCoordIntPair) throws IOException { return getChunkDataInputStream(chunkCoordIntPair);} // Paper - OBFHELPER
|
||||
@Nullable
|
||||
public synchronized DataInputStream getChunkDataInputStream(ChunkPos pos) throws IOException {
|
||||
int i = this.getOffset(pos);
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/Shapes.java
|
||||
@@ -0,0 +0,0 @@ public final class Shapes {
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
+ @Deprecated public static final VoxelShape fullCube() {return block();} // Paper - OBFHELPER
|
||||
public static VoxelShape block() {
|
||||
return BLOCK;
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java
|
||||
|
@ -40,18 +40,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public void stopPathfinding() {
|
||||
+ entity.getNavigation().stopPathfinding();
|
||||
+ entity.getNavigation().stop();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean hasPath() {
|
||||
+ return entity.getNavigation().getPathEntity() != null;
|
||||
+ return entity.getNavigation().getPath() != null;
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public PathResult getCurrentPath() {
|
||||
+ Path path = entity.getNavigation().getPathEntity();
|
||||
+ Path path = entity.getNavigation().getPath();
|
||||
+ return path != null ? new PaperPathResult(path) : null;
|
||||
+ }
|
||||
+
|
||||
@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public PathResult findPath(Location loc) {
|
||||
+ Validate.notNull(loc, "Location can not be null");
|
||||
+ Path path = entity.getNavigation().calculateDestination(loc.getX(), loc.getY(), loc.getZ());
|
||||
+ Path path = entity.getNavigation().createPath(loc.getX(), loc.getY(), loc.getZ(), 0);
|
||||
+ return path != null ? new PaperPathResult(path) : null;
|
||||
+ }
|
||||
+
|
||||
@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public PathResult findPath(LivingEntity target) {
|
||||
+ Validate.notNull(target, "Target can not be null");
|
||||
+ Path path = entity.getNavigation().calculateDestination(((CraftLivingEntity) target).getHandle());
|
||||
+ Path path = entity.getNavigation().createPath(((CraftLivingEntity) target).getHandle(), 0);
|
||||
+ return path != null ? new PaperPathResult(path) : null;
|
||||
+ }
|
||||
+
|
||||
@ -75,37 +75,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ public boolean moveTo(@Nonnull PathResult path, double speed) {
|
||||
+ Validate.notNull(path, "PathResult can not be null");
|
||||
+ Path pathEntity = ((PaperPathResult) path).path;
|
||||
+ return entity.getNavigation().setDestination(pathEntity, speed);
|
||||
+ return entity.getNavigation().moveTo(pathEntity, speed);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canOpenDoors() {
|
||||
+ return entity.getNavigation().getPathfinder().getPathfinder().shouldOpenDoors();
|
||||
+ return entity.getNavigation().pathFinder.nodeEvaluator.canOpenDoors();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanOpenDoors(boolean canOpenDoors) {
|
||||
+ entity.getNavigation().getPathfinder().getPathfinder().setShouldOpenDoors(canOpenDoors);
|
||||
+ entity.getNavigation().pathFinder.nodeEvaluator.setCanOpenDoors(canOpenDoors);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canPassDoors() {
|
||||
+ return entity.getNavigation().getPathfinder().getPathfinder().shouldPassDoors();
|
||||
+ return entity.getNavigation().pathFinder.nodeEvaluator.canPassDoors();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanPassDoors(boolean canPassDoors) {
|
||||
+ entity.getNavigation().getPathfinder().getPathfinder().setShouldPassDoors(canPassDoors);
|
||||
+ entity.getNavigation().pathFinder.nodeEvaluator.setCanPassDoors(canPassDoors);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean canFloat() {
|
||||
+ return entity.getNavigation().getPathfinder().getPathfinder().shouldFloat();
|
||||
+ return entity.getNavigation().pathFinder.nodeEvaluator.canFloat();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCanFloat(boolean canFloat) {
|
||||
+ entity.getNavigation().getPathfinder().getPathfinder().setShouldFloat(canFloat);
|
||||
+ entity.getNavigation().pathFinder.nodeEvaluator.setCanFloat(canFloat);
|
||||
+ }
|
||||
+
|
||||
+ public class PaperPathResult implements com.destroystokyo.paper.entity.PaperPathfinder.PathResult {
|
||||
@ -118,14 +118,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Nullable
|
||||
+ @Override
|
||||
+ public Location getFinalPoint() {
|
||||
+ Node point = path.getFinalPoint();
|
||||
+ Node point = path.getEndNode();
|
||||
+ return point != null ? toLoc(point) : null;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public List<Location> getPoints() {
|
||||
+ List<Location> points = new ArrayList<>();
|
||||
+ for (Node point : path.getPoints()) {
|
||||
+ for (Node point : path.nodes) {
|
||||
+ points.add(toLoc(point));
|
||||
+ }
|
||||
+ return points;
|
||||
@ -133,7 +133,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ @Override
|
||||
+ public int getNextPointIndex() {
|
||||
+ return path.getNextIndex();
|
||||
+ return path.getNextNodeIndex();
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
@ -142,135 +142,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (!path.hasNext()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ return toLoc(path.getPoints().get(path.getNextIndex()));
|
||||
+ return toLoc(path.nodes.get(path.getNextNodeIndex()));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private Location toLoc(Node point) {
|
||||
+ return new Location(entity.level.getWorld(), point.getX(), point.getY(), point.getZ());
|
||||
+ return new Location(entity.level.getWorld(), point.x, point.y, point.z);
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public final Path createPath(double x, double y, double z, int distance) {
|
||||
+ @Deprecated public final Path calculateDestination(double d0, double d1, double d2) { return createPath(d0, d1, d2, 0); } public final Path createPath(double x, double y, double z, int distance) { // Paper - OBFHELPER
|
||||
return this.createPath(new BlockPos(x, y, z), distance);
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Path createPath(Entity entity, int distance) {
|
||||
+ public final Path calculateDestination(Entity entity) { return createPath(entity, 0); } public Path createPath(Entity entity, int distance) {
|
||||
return this.createPath(ImmutableSet.of(entity.blockPosition()), entity, 16, true, distance); // Paper
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
return path != null && this.moveTo(path, speed);
|
||||
}
|
||||
|
||||
+ @Deprecated public boolean setDestination(@Nullable Path pathentity, double speed) { return moveTo(pathentity, speed); } // Paper - OBFHELPER
|
||||
public boolean moveTo(@Nullable Path path, double speed) {
|
||||
if (path == null) {
|
||||
this.path = null;
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
}
|
||||
}
|
||||
|
||||
- @Nullable
|
||||
+ @Deprecated @Nullable public Path getPathEntity() { return getPath(); } @Nullable // Paper - OBFHELPER
|
||||
public Path getPath() {
|
||||
return this.path;
|
||||
}
|
||||
@@ -0,0 +0,0 @@ public abstract class PathNavigation {
|
||||
return !this.isDone();
|
||||
}
|
||||
|
||||
+ @Deprecated public void stopPathfinding() { stop(); } // Paper - OBFHELPER
|
||||
public void stop() {
|
||||
this.path = null;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Node.java b/src/main/java/net/minecraft/world/level/pathfinder/Node.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/Node.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Node.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class Node {
|
||||
- public final int x;
|
||||
- public final int y;
|
||||
- public final int z;
|
||||
+ public final int x; @Deprecated public final int getX() { return x; } // Paper - OBFHELPER
|
||||
+ public final int y; @Deprecated public final int getY() { return y; } // Paper - OBFHELPER
|
||||
+ public final int z; @Deprecated public final int getZ() { return z; } // Paper - OBFHELPER
|
||||
private final int hash;
|
||||
public int heapIdx = -1;
|
||||
public float g;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java b/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/NodeEvaluator.java
|
||||
@@ -0,0 +0,0 @@ public abstract class NodeEvaluator {
|
||||
protected int entityWidth;
|
||||
protected int entityHeight;
|
||||
protected int entityDepth;
|
||||
- protected boolean canPassDoors;
|
||||
- protected boolean canOpenDoors;
|
||||
- protected boolean canFloat;
|
||||
+ protected boolean canPassDoors; @Deprecated public boolean shouldPassDoors() { return canPassDoors; } @Deprecated public void setShouldPassDoors(boolean b) { canPassDoors = b; } // Paper - obfhelper
|
||||
+ protected boolean canOpenDoors; @Deprecated public boolean shouldOpenDoors() { return canOpenDoors; } @Deprecated public void setShouldOpenDoors(boolean b) { canOpenDoors = b; } // Paper - obfhelper
|
||||
+ protected boolean canFloat; @Deprecated public boolean shouldFloat() { return canFloat; } @Deprecated public void setShouldFloat(boolean b) { canFloat = b; } // Paper - obfhelper
|
||||
|
||||
public void prepare(PathNavigationRegion cachedWorld, Mob entity) {
|
||||
this.level = cachedWorld;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Path.java b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/pathfinder/Path.java
|
||||
@@ -0,0 +0,0 @@ import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class Path {
|
||||
- private final List<Node> nodes;
|
||||
+ private final List<Node> nodes; @Deprecated public List<Node> getPoints() { return nodes; } // Paper - OBFHELPER
|
||||
private Node[] openSet = new Node[0];
|
||||
private Node[] closedSet = new Node[0];
|
||||
private Set<Target> targetNodes;
|
||||
- private int nextNodeIndex;
|
||||
+ private int nextNodeIndex; @Deprecated public int getNextIndex() { return this.nextNodeIndex; } // Paper - OBFHELPER
|
||||
@@ -0,0 +0,0 @@ public class Path {
|
||||
private final BlockPos target;
|
||||
private final float distToTarget;
|
||||
private final boolean reached;
|
||||
+ public boolean hasNext() { return getNextIndex() < getPoints().size(); } // Paper
|
||||
+ public boolean hasNext() { return getNextNodeIndex() < this.nodes.size(); } // Paper
|
||||
|
||||
public Path(List<Node> nodes, BlockPos target, boolean reachesTarget) {
|
||||
this.nodes = nodes;
|
||||
@@ -0,0 +0,0 @@ public class Path {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
- public Node getEndNode() {
|
||||
+ @Deprecated public Node getFinalPoint() { return getEndNode(); } @Nullable public Node getEndNode() { // Paper - OBFHELPER
|
||||
return !this.nodes.isEmpty() ? this.nodes.get(this.nodes.size() - 1) : null;
|
||||
}
|
||||
|
||||
@@ -0,0 +0,0 @@ public class Path {
|
||||
return this.getEntityPosAtNode(entity, this.nextNodeIndex);
|
||||
}
|
||||
|
||||
- public BlockPos getNextNodePos() {
|
||||
+ @Deprecated public BlockPos getNext() { return getNextNodePos(); } public BlockPos getNextNodePos() { // Paper - OBFHELPER
|
||||
return this.nodes.get(this.nextNodeIndex).asBlockPos();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java
|
||||
|
@ -74,7 +74,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- if (blockGetter == null) {
|
||||
+ // Paper start - ensure we don't load chunks
|
||||
+ boolean far = this.source != null && net.minecraft.server.MCUtil.distanceSq(this.source.getX(), y, this.source.getZ(), x, y, z) > 14;
|
||||
+ this.pos.setValues(x, y, z);
|
||||
+ this.pos.set(x, y, z);
|
||||
+
|
||||
+ boolean isRegionLimited = this.collisionGetter instanceof net.minecraft.server.level.WorldGenRegion;
|
||||
+ BlockState blockState = isRegionLimited ? Blocks.VOID_AIR.defaultBlockState() : ((!far && this.source instanceof net.minecraft.server.level.ServerPlayer) || (this.source != null && this.source.collisionLoadChunks)
|
||||
|
@ -40,4 +40,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper end
|
||||
}
|
||||
|
||||
@Deprecated public boolean setDestination(@Nullable Path pathentity, double speed) { return moveTo(pathentity, speed); } // Paper - OBFHELPER
|
||||
public boolean moveTo(@Nullable Path path, double speed) {
|
||||
|
@ -19,5 +19,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
public final boolean isLoadedAndInBounds(BlockPos blockposition) { // Paper - final for inline
|
||||
return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
return getWorldBorder().isWithinBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
- LevelChunkSection levelChunkSection = this.getSections()[this.getSectionIndex(i)];
|
||||
- return LevelChunkSection.isEmpty(levelChunkSection) ? Blocks.AIR.defaultBlockState() : levelChunkSection.getBlockState(pos.getX() & 15, i & 15, pos.getZ() & 15);
|
||||
+ LevelChunkSection chunksection = this.getSections()[this.getSectionIndex(y)];
|
||||
+ return chunksection == LevelChunk.EMPTY_CHUNK_SECTION || chunksection.isEmpty() ? Blocks.AIR.defaultBlockState() : chunksection.getBlockState(x & 15, y & 15, z & 15);
|
||||
+ return chunksection == LevelChunk.EMPTY_SECTION || chunksection.isEmpty() ? Blocks.AIR.defaultBlockState() : chunksection.getBlockState(x & 15, y & 15, z & 15);
|
||||
}
|
||||
}
|
||||
+ // Paper end
|
||||
|
@ -368,7 +368,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ if (!wire.canSurvive(null, worldIn, pos)) {
|
||||
+ // Pop off the redstone dust
|
||||
+ Block.popResource(worldIn, pos, new ItemStack(Items.REDSTONE)); // TODO
|
||||
+ worldIn.setAir(pos);
|
||||
+ worldIn.removeBlock(pos, false);
|
||||
+
|
||||
+ // Mark this position as not being redstone wire
|
||||
+ upd1.type = UpdateNode.Type.OTHER;
|
||||
|
@ -4,18 +4,6 @@ Date: Tue, 1 Mar 2016 14:47:52 -0600
|
||||
Subject: [PATCH] Player affects spawning API
|
||||
|
||||
|
||||
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
|
||||
--- a/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, n
|
||||
return Mth.sqrt(f * f + f1 * f1 + f2 * f2);
|
||||
}
|
||||
|
||||
+ @Deprecated public double getDistanceSquared(double x, double y, double z) { return distanceToSqr(x, y, z); } // Paper - OBFHELPER
|
||||
public double distanceToSqr(double x, double y, double z) {
|
||||
double d3 = this.getX() - x;
|
||||
double d4 = this.getY() - y;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntitySelector.java b/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntitySelector.java
|
||||
@ -118,7 +106,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ entityhuman = (Player) iterator.next();
|
||||
+ } while (!EntitySelector.affectsSpawning.test(entityhuman));
|
||||
+
|
||||
+ d4 = entityhuman.getDistanceSquared(d0, d1, d2);
|
||||
+ d4 = entityhuman.distanceToSqr(d0, d1, d2);
|
||||
+ } while (d3 >= 0.0D && d4 >= d3 * d3);
|
||||
+
|
||||
+ return true;
|
||||
|
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
if (!event.getKeepInventory()) {
|
||||
this.getInventory().clearContent();
|
||||
+ // Paper start - replace logic
|
||||
+ for (NonNullList<ItemStack> inv : this.getInventory().getComponents()) {
|
||||
+ for (NonNullList<ItemStack> inv : this.getInventory().compartments) {
|
||||
+ processKeep(event, inv);
|
||||
+ }
|
||||
+ processKeep(event, null);
|
||||
|
@ -20,8 +20,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Paper start - Pathfind event
|
||||
boolean copiedSet = false;
|
||||
for (BlockPos possibleTarget : positions) {
|
||||
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
||||
+ if (!getEntity().getCommandSenderWorld().getWorldBorder().isInBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(), // Paper - don't path out of world border
|
||||
MCUtil.toLocation(getEntity().level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
- if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(),
|
||||
+ if (!this.mob.getCommandSenderWorld().getWorldBorder().isWithinBounds(possibleTarget) || !new com.destroystokyo.paper.event.entity.EntityPathfindEvent(this.mob.getBukkitEntity(), // Paper - don't path out of world border
|
||||
MCUtil.toLocation(this.mob.level, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
||||
if (!copiedSet) {
|
||||
copiedSet = true;
|
||||
|
@ -128,7 +128,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start - fix headless pistons breaking blocks
|
||||
+ BlockPos headPos = pos.relative(enumdirection);
|
||||
+ if (com.destroystokyo.paper.PaperConfig.allowBlockPermanentBreakingExploits || world.getBlockState(headPos) == Blocks.PISTON_HEAD.defaultBlockState().setValue(FACING, enumdirection)) { // double check to make sure we're not a headless piston.
|
||||
+ world.setAir(headPos, false);
|
||||
+ world.removeBlock(headPos, false);
|
||||
+ } else {
|
||||
+ ((ServerLevel)world).getChunkSource().blockChanged(headPos); // ... fix client desync
|
||||
+ }
|
||||
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+
|
||||
+ for (Player human : this.players()) {
|
||||
+ if (predicate == null || predicate.test(human)) {
|
||||
+ double distanceSquared = human.getDistanceSquared(x, y, z);
|
||||
+ double distanceSquared = human.distanceToSqr(x, y, z);
|
||||
+
|
||||
+ if (radius < 0.0D || distanceSquared < radius * radius) {
|
||||
+ builder.add(human.getBukkitEntity());
|
||||
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
||||
@@ -0,0 +0,0 @@ public class CompoundTag implements Tag {
|
||||
}
|
||||
|
||||
@Deprecated public void setUUID(String prefix, UUID uuid) { putUUID(prefix, uuid); } // Paper - OBFHELPER
|
||||
public void putUUID(String key, UUID value) {
|
||||
+ // Paper start - support old format
|
||||
+ if (this.contains(key + "Most", 99) && this.contains(key + "Least", 99)) {
|
||||
|
@ -779,17 +779,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import org.spigotmc.SlackActivityAccountant; // Spigot
|
||||
|
||||
public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements SnooperPopulator, CommandSource, AutoCloseable {
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
private long lastServerStatus;
|
||||
public final Thread serverThread;
|
||||
private long nextTickTime;
|
||||
- private long delayedTasksMaxNextTickTime;
|
||||
- private boolean mayHaveDelayedTasks;
|
||||
+ private long delayedTasksMaxNextTickTime; @Deprecated final long getTickOversleepMaxTime() { return this.delayedTasksMaxNextTickTime; } // Paper - OBFHELPER
|
||||
+ private boolean mayHaveDelayedTasks; @Deprecated final boolean hasExecutedTask() { return this.mayHaveDelayedTasks; } // Paper - OBFHELPER
|
||||
private boolean hasWorldScreenshot;
|
||||
private final PackRepository packRepository;
|
||||
private final ServerScoreboard scoreboard;
|
||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
// CraftBukkit end
|
||||
@ -809,7 +798,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ // Paper start
|
||||
+ boolean isOversleep = false;
|
||||
+ private boolean canOversleep() {
|
||||
+ return this.hasExecutedTask() && Util.getMillis() < this.getTickOversleepMaxTime();
|
||||
+ return this.mayHaveDelayedTasks && Util.getMillis() < this.delayedTasksMaxNextTickTime;
|
||||
+ }
|
||||
+
|
||||
+ private boolean canSleepForTickNoOversleep() {
|
||||
|
@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ this.discard();
|
||||
+ return;
|
||||
+ } else {
|
||||
+ this.level.setAir(blockposition, false);
|
||||
+ this.level.removeBlock(blockposition, false);
|
||||
+ }
|
||||
+ // Paper end - fix cancelling block falling causing client desync
|
||||
} else if (!this.level.isClientSide) {
|
||||
|
Loading…
Reference in New Issue
Block a user