geforkt von Mirrors/Paper
even even more progress
Dieser Commit ist enthalten in:
Ursprung
c6393c4571
Commit
4b66e6c02d
@ -1,22 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 21 Sep 2016 22:54:28 -0400
|
||||
Subject: [PATCH] Chunk registration fixes
|
||||
|
||||
World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is treated
|
||||
|
||||
Keep them consistent
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
if (entity.checkAndResetUpdateChunkPos()) {
|
||||
this.getProfiler().push("chunkCheck");
|
||||
int i = Mth.floor(entity.getX() / 16.0D);
|
||||
- int j = Mth.floor(entity.getY() / 16.0D);
|
||||
+ int j = Math.min(15, Math.max(0, Mth.floor(entity.getY() / 16.0D))); // Paper - stay consistent with chunk add/remove behavior
|
||||
int k = Mth.floor(entity.getZ() / 16.0D);
|
||||
|
||||
if (!entity.inChunk || entity.xChunk != i || entity.yChunk != j || entity.zChunk != k) {
|
@ -1,21 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Tue, 21 Jun 2016 22:54:34 -0400
|
||||
Subject: [PATCH] Fix Double World Add issues
|
||||
|
||||
Vanilla will double add Spider Jockeys to the world, so ignore already added.
|
||||
|
||||
Also add debug if something else tries to, and abort before world gets bad state
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -0,0 +0,0 @@ public class ServerLevel extends net.minecraft.world.level.Level implements Worl
|
||||
// CraftBukkit start
|
||||
private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot
|
||||
+ if (entity.valid) { MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); return true; } // Paper
|
||||
if (entity.removed) {
|
||||
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
@ -25,7 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
|
||||
@@ -0,0 +0,0 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
|
||||
Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
|
||||
@Override
|
||||
public void thunderHit(ServerLevel world, LightningBolt lightning) {
|
||||
if (world.getDifficulty() != Difficulty.PEACEFUL) {
|
||||
- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning);
|
||||
+ // Paper - move log down, event can cancel
|
||||
Witch entitywitch = (Witch) EntityType.WITCH.create((Level) world);
|
||||
|
||||
+ // Paper start
|
||||
@ -34,7 +38,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.yRot, this.xRot);
|
||||
+ Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Paper - move log down, event can cancel
|
||||
+
|
||||
entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null);
|
||||
entitywitch.setNoAi(this.isNoAi());
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
@ -167,7 +167,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.UnmodifiableIterator;
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
this.blockEntities.remove(blockposition);
|
||||
this.removeBlockEntity(blockEntity.getBlockPos());
|
||||
// Paper end
|
||||
} else {
|
||||
- System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
|
@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ return com.destroystokyo.paper.PaperConfig.isProxyOnlineMode(); // Paper
|
||||
}
|
||||
|
||||
public synchronized void add(GameProfile gameprofile) { // Paper - synchronize
|
||||
public synchronized void add(GameProfile profile) { // Paper - synchronize
|
||||
diff --git a/src/main/java/net/minecraft/server/players/OldUsersConverter.java b/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/players/OldUsersConverter.java
|
||||
@ -74,9 +74,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// Spigot Start
|
||||
GameProfile profile = null;
|
||||
// Only fetch an online UUID in online mode
|
||||
- if ( getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
|
||||
+ if ( getOnlineMode()
|
||||
+ || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
|
||||
- if ( this.getOnlineMode() || org.spigotmc.SpigotConfig.bungee )
|
||||
+ if ( this.getOnlineMode() || com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() ) // Paper - Handle via setting
|
||||
{
|
||||
profile = console.getProfileCache().get( name );
|
||||
profile = this.console.getProfileCache().getProfile( name );
|
||||
}
|
@ -9,11 +9,11 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag tag) {
|
||||
super.readAdditionalSaveData(tag);
|
||||
public void readAdditionalSaveData(CompoundTag nbt) {
|
||||
super.readAdditionalSaveData(nbt);
|
||||
+ if (this.getY() > 300) this.setPosRaw(getX(), 257, getZ()); // Paper - bring down to a saner Y level if out of world
|
||||
if (tag.contains("playerGameType", 99)) {
|
||||
if (this.getServer().getForceGameType()) {
|
||||
this.gameMode.setGameModeForPlayer(this.getServer().getDefaultGameType(), GameType.NOT_SET);
|
||||
if (nbt.contains("enteredNetherPosition", 10)) {
|
||||
CompoundTag nbttagcompound1 = nbt.getCompound("enteredNetherPosition");
|
||||
|
@ -24,7 +24,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
if (this.clientIsFloating && !this.player.isSleeping()) {
|
||||
if (++this.aboveGroundTickCount > 80) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating too long!", this.player.getName().getString());
|
||||
@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
if (this.clientVehicleIsFloating && this.player.getRootVehicle().getControllingPassenger() == this.player) {
|
||||
if (++this.aboveGroundVehicleTickCount > 80) {
|
||||
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getName().getString());
|
@ -26,20 +26,20 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerGamePacketListener {
|
||||
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Ser
|
||||
// Spigot start - limit place/interactions
|
||||
private int limitedPackets;
|
||||
private long lastLimitedPacket = -1;
|
||||
+ private static final int THRESHOLD = com.destroystokyo.paper.PaperConfig.packetInSpamThreshold; // Paper - Configurable threshold
|
||||
|
||||
private boolean checkLimit(long timestamp) {
|
||||
- if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < 30 && limitedPackets++ >= 4) {
|
||||
+ if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < THRESHOLD && limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
|
||||
- if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < 30 && this.limitedPackets++ >= 4) {
|
||||
+ if (this.lastLimitedPacket != -1 && timestamp - this.lastLimitedPacket < THRESHOLD && this.limitedPackets++ >= 8) { // Paper - Use threshold, raise packet limit to 8
|
||||
return false;
|
||||
}
|
||||
|
||||
- if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= 30) {
|
||||
+ if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= THRESHOLD) { // Paper
|
||||
lastLimitedPacket = timestamp;
|
||||
limitedPackets = 0;
|
||||
- if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= 30) {
|
||||
+ if (this.lastLimitedPacket == -1 || timestamp - this.lastLimitedPacket >= THRESHOLD) { // Paper
|
||||
this.lastLimitedPacket = timestamp;
|
||||
this.limitedPackets = 0;
|
||||
return true;
|
@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
repository.findProfilesByNames(new String[]{name}, Agent.MINECRAFT, profilelookupcallback);
|
||||
GameProfile gameprofile = (GameProfile) atomicreference.get();
|
||||
|
||||
- if (!usesAuthentication() && gameprofile == null) {
|
||||
+ if (!usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
|
||||
- if (!GameProfileCache.usesAuthentication() && gameprofile == null) {
|
||||
+ if (!GameProfileCache.usesAuthentication() && gameprofile == null && !org.apache.commons.lang3.StringUtils.isBlank(name)) { // Paper - Don't lookup a profile with a blank name
|
||||
UUID uuid = Player.createPlayerUUID(new GameProfile((UUID) null, name));
|
||||
|
||||
gameprofile = new GameProfile(uuid, name);
|
@ -25,22 +25,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
|
||||
@@ -0,0 +0,0 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
|
||||
s = "\"\"";
|
||||
}
|
||||
|
||||
try {
|
||||
- MutableComponent ichatmutablecomponent = Component.Serializer.fromJson(s.isEmpty() ? "\"\"" : s);
|
||||
+ //IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.ChatSerializer.a(s.isEmpty() ? "\"\"" : s); // Paper - move down - the old format might throw a json error
|
||||
|
||||
- if (oldSign) {
|
||||
+ if (oldSign && !isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
|
||||
messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
|
||||
continue;
|
||||
}
|
||||
// CraftBukkit end
|
||||
+ MutableComponent ichatmutablecomponent = Component.Serializer.fromJson(s.isEmpty() ? "\"\"" : s); // Paper - after old sign
|
||||
|
||||
if (this.level instanceof ServerLevel) {
|
||||
try {
|
||||
- if (oldSign) {
|
||||
+ if (oldSign && !this.isLoadingStructure) { // Paper - saved structures will be in the new format, but will not have isConverted
|
||||
this.messages[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
|
||||
continue;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java
|
||||
@ -50,9 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
+ tileentity.isLoadingStructure = true; // Paper
|
||||
tileentity.load(definedstructure_blockinfo.state, definedstructure_blockinfo.nbt);
|
||||
tileentity.mirror(placementData.getMirror());
|
||||
tileentity.rotate(placementData.getRotation());
|
||||
tileentity.load(definedstructure_blockinfo.nbt);
|
||||
+ tileentity.isLoadingStructure = false; // Paper
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/EnumProperty.java
|
||||
@@ -0,0 +0,0 @@ public class EnumProperty<T extends Enum<T> & StringRepresentable> extends Prope
|
||||
return ((StringRepresentable) value).getSerializedName();
|
||||
return value.getSerializedName();
|
||||
}
|
||||
|
||||
- @Override
|
||||
@ -55,30 +55,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/state/properties/Property.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Property<T extends Comparable<T>> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
- if (this == object) {
|
||||
- return true;
|
||||
- } else if (!(object instanceof Property)) {
|
||||
- return false;
|
||||
- } else {
|
||||
- Property<?> iblockstate = (Property) object;
|
||||
-
|
||||
- return this.clazz.equals(iblockstate.clazz) && this.name.equals(iblockstate.name);
|
||||
- Property<?> property = (Property)object;
|
||||
- return this.clazz.equals(property.clazz) && this.name.equals(property.name);
|
||||
- }
|
||||
+ return this == object; // Paper - only one instance per configuration
|
||||
+ return this == object;
|
||||
}
|
||||
|
||||
+ private static final java.util.concurrent.atomic.AtomicInteger hashId = new java.util.concurrent.atomic.AtomicInteger(1); // Paper - only one instance per configuration
|
||||
+ private final int hashCode = 92821 * hashId.getAndIncrement(); // Paper - only one instance per configuration
|
||||
public final int hashCode() {
|
||||
if (this.hashCode == null) {
|
||||
this.hashCode = this.generateHashCode();
|
||||
}
|
||||
|
||||
- return this.hashCode;
|
||||
+ return this.hashCode; // Paper - only one instance per configuration
|
||||
}
|
||||
|
||||
public int generateHashCode() {
|
||||
@Override
|
@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -0,0 +0,0 @@ public class LevelChunk implements ChunkAccess {
|
||||
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
"Chunk coordinates: " + (this.chunkPos.x * 16) + "," + (this.chunkPos.z * 16));
|
||||
e.printStackTrace();
|
||||
ServerInternalException.reportInternalException(e);
|
||||
+
|
||||
+ if (this.world.paperConfig.removeCorruptTEs) {
|
||||
+ if (this.level.paperConfig.removeCorruptTEs) {
|
||||
+ this.removeBlockEntity(blockEntity.getBlockPos());
|
||||
+ this.markUnsaved();
|
||||
+ org.bukkit.Bukkit.getLogger().info("Removing corrupt tile entity");
|
@ -3,6 +3,7 @@ From: Aikar <aikar@aikar.co>
|
||||
Date: Thu, 16 Jun 2016 00:17:23 -0400
|
||||
Subject: [PATCH] Remove FishingHook reference on Craft Entity removal
|
||||
|
||||
TODO 1.17 isn't this supposed to be applied to when the fish hook is removed _in general_? Not just in Bukkit api calls?
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
@ -10,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFishHook.java
|
||||
@@ -0,0 +0,0 @@ public class CraftFishHook extends CraftProjectile implements FishHook {
|
||||
public HookState getState() {
|
||||
return HookState.values()[getHandle().currentState.ordinal()];
|
||||
return HookState.values()[this.getHandle().currentState.ordinal()];
|
||||
}
|
||||
+
|
||||
+ // Paper start
|
@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
// CraftBukkit start
|
||||
+ // Paper start - Remove invalid mob spawner tile entities
|
||||
+ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockState(blockposition).getBlock() instanceof SpawnerBlock)) {
|
||||
+ this.blockEntities.remove(blockposition);
|
||||
+ this.removeBlockEntity(blockEntity.getBlockPos());
|
||||
+ // Paper end
|
||||
} else {
|
||||
System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren