mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-30 20:21:41 +01:00
405
This commit is contained in:
parent
49787270cb
commit
27c46717f6
@ -21,4 +21,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+
|
+
|
||||||
@Override
|
@Override
|
||||||
public BlockState getBlockState() {
|
public BlockState getBlockState() {
|
||||||
Material stateMaterial = (this.material != Material.SHIELD) ? this.material : CraftMetaBlockState.shieldToBannerHack(this.blockEntityTag); // Only actually used for jigsaws
|
return (this.blockEntityTag != null) ? this.blockEntityTag.copy() : CraftMetaBlockState.getBlockState(this.material, null);
|
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||||
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
|
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
|
||||||
+ TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
|
+ TicketType.PLUGIN.timeout = Math.min(20, this.configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
|
||||||
this.minimumAPI = this.configuration.getString("settings.minimum-api");
|
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
|
||||||
this.loadIcon();
|
this.loadIcon();
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
|
||||||
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
this.warningState = WarningState.value(this.configuration.getString("settings.deprecated-verbose"));
|
||||||
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
|
- TicketType.PLUGIN.timeout = this.configuration.getInt("chunk-gc.period-in-ticks");
|
||||||
+ TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
|
+ TicketType.PLUGIN.timeout = Math.min(20, configuration.getInt("chunk-gc.period-in-ticks")); // Paper - cap plugin loads to 1 second
|
||||||
this.minimumAPI = this.configuration.getString("settings.minimum-api");
|
this.minimumAPI = ApiVersion.getOrCreateVersion(this.configuration.getString("settings.minimum-api"));
|
||||||
this.printSaveWarning = false;
|
this.printSaveWarning = false;
|
||||||
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
this.console.autosavePeriod = this.configuration.getInt("ticks-per.autosave");
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
@ -57,7 +57,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
--- a/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/CommandBlock.java
|
||||||
@@ -0,0 +0,0 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
@@ -0,0 +0,0 @@ public class CommandBlock extends BaseEntityBlock implements GameMasterBlock {
|
||||||
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult hit) {
|
protected InteractionResult useWithoutItem(BlockState state, Level world, BlockPos pos, Player player, BlockHitResult hit) {
|
||||||
BlockEntity tileentity = world.getBlockEntity(pos);
|
BlockEntity tileentity = world.getBlockEntity(pos);
|
||||||
|
|
||||||
- if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) {
|
- if (tileentity instanceof CommandBlockEntity && player.canUseGameMasterBlocks()) {
|
@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
||||||
@Override
|
@Override
|
||||||
public BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
protected BlockState updateShape(BlockState state, Direction direction, BlockState neighborState, LevelAccessor world, BlockPos pos, BlockPos neighborPos) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
+ if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation
|
+ if (!(world instanceof ServerLevel)) return this.canSurvive(state, world, pos) ? (BlockState) this.getStateWithAge(world, pos, (Integer) state.getValue(FireBlock.AGE)) : Blocks.AIR.defaultBlockState(); // Paper - don't fire events in world generation
|
||||||
if (!this.canSurvive(state, world, pos)) {
|
if (!this.canSurvive(state, world, pos)) {
|
@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
// Paper start - Entity#getEntitySpawnReason
|
// Paper start - Entity#getEntitySpawnReason
|
||||||
if (nbttagcompound == null) {
|
if (optional.isEmpty()) {
|
||||||
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
+ player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPos(double x, double y, double z) {
|
public void setPos(double x, double y, double z) {
|
||||||
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected AABB makeBoundingBox() {
|
protected AABB makeBoundingBox() {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
if (this.position.x != x || this.position.y != y || this.position.z != z) {
|
||||||
this.position = new Vec3(x, y, z);
|
this.position = new Vec3(x, y, z);
|
||||||
int i = Mth.floor(x);
|
int i = Mth.floor(x);
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
this.levelCallback.onMove();
|
this.levelCallback.onMove();
|
||||||
}
|
}
|
||||||
|
|
@ -16,4 +16,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
+ if (!this.mob.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) || !this.mob.canPickUpLoot()) return false; // Paper - respect game and entity rules for picking up items
|
||||||
Raid raid = this.mob.getCurrentRaid();
|
Raid raid = this.mob.getCurrentRaid();
|
||||||
|
|
||||||
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance())) {
|
if (this.mob.hasActiveRaid() && !this.mob.getCurrentRaid().isOver() && this.mob.canBeLeader() && !ItemStack.matches(this.mob.getItemBySlot(EquipmentSlot.HEAD), Raid.getLeaderBannerInstance(this.mob.registryAccess().lookupOrThrow(Registries.BANNER_PATTERN)))) {
|
@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Entity#getEntitySpawnReason
|
+ // Paper start - Entity#getEntitySpawnReason
|
||||||
+ if (nbttagcompound == null) {
|
+ if (optional.isEmpty()) {
|
||||||
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
+ player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Entity#getEntitySpawnReason
|
+ // Paper end - Entity#getEntitySpawnReason
|
||||||
|
@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
if (worldserver.getWorld().getKeepSpawnInMemory()) worldloadlistener.stop(); // Paper - Configurable Keep Spawn Loaded range per world
|
worldloadlistener.stop();
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
// this.updateMobSpawningFlags();
|
// this.updateMobSpawningFlags();
|
||||||
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
|
- worldserver.setSpawnSettings(this.isSpawningMonsters(), this.isSpawningAnimals());
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
public boolean addPotionEffect(PotionEffect effect, boolean force) {
|
||||||
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraft(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
|
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
|
||||||
+ this.getHandle().addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(effect), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
|
+ this.getHandle().addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(effect), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||||
@Override
|
@Override
|
||||||
public PotionEffect getPotionEffect(PotionEffectType type) {
|
public PotionEffect getPotionEffect(PotionEffectType type) {
|
||||||
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraft(type));
|
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type));
|
||||||
- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
|
- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
|
||||||
+ return (handle == null) ? null : org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle); // Paper
|
+ return (handle == null) ? null : org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public Collection<PotionEffect> getActivePotionEffects() {
|
public Collection<PotionEffect> getActivePotionEffects() {
|
||||||
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
List<PotionEffect> effects = new ArrayList<PotionEffect>();
|
||||||
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {
|
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {
|
||||||
- effects.add(new PotionEffect(CraftPotionEffectType.minecraftToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
|
- effects.add(new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
|
||||||
+ effects.add(org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle)); // Paper
|
+ effects.add(org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle)); // Paper
|
||||||
}
|
}
|
||||||
return effects;
|
return effects;
|
||||||
@ -43,7 +43,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class CraftPotionUtil {
|
@@ -0,0 +0,0 @@ public class CraftPotionUtil {
|
||||||
|
|
||||||
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
public static MobEffectInstance fromBukkit(PotionEffect effect) {
|
||||||
MobEffect type = CraftPotionEffectType.bukkitToMinecraft(effect.getType());
|
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
|
||||||
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
|
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
|
||||||
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
|
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
|
||||||
}
|
}
|
||||||
@ -57,4 +57,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
|
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean equals(MobEffect mobEffect, PotionEffectType type) {
|
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {
|
@ -19,7 +19,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start - Capture drops for death event
|
// CraftBukkit start - Capture drops for death event
|
||||||
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
|
if (this instanceof net.minecraft.world.entity.LivingEntity && !((net.minecraft.world.entity.LivingEntity) this).forceDrops) {
|
||||||
@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
entityitem.setDefaultPickUpDelay();
|
entityitem.setDefaultPickUpDelay();
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
@Nullable
|
@Nullable
|
||||||
public Entity teleportTo(ServerLevel worldserver, Vec3 location) {
|
public Entity teleportTo(ServerLevel worldserver, Vec3 location) {
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
|
if (this.level() instanceof ServerLevel && !this.isRemoved()) {
|
||||||
this.level().getProfiler().push("changeDimension");
|
this.level().getProfiler().push("changeDimension");
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
this.level().getProfiler().popPush("reloading");
|
this.level().getProfiler().popPush("reloading");
|
||||||
@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
Entity entity = this.getType().create(worldserver);
|
Entity entity = this.getType().create(worldserver);
|
||||||
|
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
// CraftBukkit start - Forward the CraftEntity to the new entity
|
// CraftBukkit start - Forward the CraftEntity to the new entity
|
||||||
this.getBukkitEntity().setHandle(entity);
|
this.getBukkitEntity().setHandle(entity);
|
||||||
entity.bukkitEntity = this.getBukkitEntity();
|
entity.bukkitEntity = this.getBukkitEntity();
|
||||||
@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canChangeDimensions() {
|
public boolean canChangeDimensions() {
|
@ -18,6 +18,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}, 29999984);
|
}, 29999984);
|
||||||
- this.syncChunkWrites = this.get("sync-chunk-writes", true);
|
- this.syncChunkWrites = this.get("sync-chunk-writes", true);
|
||||||
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag
|
+ this.syncChunkWrites = this.get("sync-chunk-writes", true) && Boolean.getBoolean("Paper.enable-sync-chunk-writes"); // Paper - Hide sync chunk writes behind flag
|
||||||
|
this.regionFileComression = this.get("region-file-compression", "deflate");
|
||||||
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
this.enableJmxMonitoring = this.get("enable-jmx-monitoring", false);
|
||||||
this.enableStatus = this.get("enable-status", true);
|
this.enableStatus = this.get("enable-status", true);
|
||||||
this.hideOnlinePlayers = this.get("hide-online-players", false);
|
|
@ -19,14 +19,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
@@ -0,0 +0,0 @@ public class MapItem extends ComplexItem {
|
@@ -0,0 +0,0 @@ public class MapItem extends ComplexItem {
|
||||||
int j2 = (j / i + k1 - 64) * i;
|
int r = (j / i + o - 64) * i;
|
||||||
int k2 = (k / i + l1 - 64) * i;
|
int s = (k / i + p - 64) * i;
|
||||||
Multiset<MapColor> multiset = LinkedHashMultiset.create();
|
Multiset<MapColor> multiset = LinkedHashMultiset.create();
|
||||||
- LevelChunk chunk = world.getChunk(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2));
|
- LevelChunk levelChunk = world.getChunk(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s));
|
||||||
+ LevelChunk chunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(j2), SectionPos.blockToSectionCoord(k2)); // Paper - Maps shouldn't load chunks
|
- if (!levelChunk.isEmpty()) {
|
||||||
|
+ LevelChunk levelChunk = world.getChunkIfLoaded(SectionPos.blockToSectionCoord(r), SectionPos.blockToSectionCoord(s)); // Paper - Maps shouldn't load chunks
|
||||||
- if (!chunk.isEmpty()) {
|
+ if (levelChunk != null && !levelChunk.isEmpty()) { // Paper - Maps shouldn't load chunks
|
||||||
+ if (chunk != null && !chunk.isEmpty()) { // Paper - Maps shouldn't load chunks
|
int t = 0;
|
||||||
int l2 = 0;
|
double e = 0.0;
|
||||||
double d1 = 0.0D;
|
if (world.dimensionType().hasCeiling()) {
|
||||||
int i3;
|
|
@ -16,25 +16,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag nbttagcompound = this.load(player);
|
Optional<CompoundTag> optional = this.load(player); // CraftBukkit - decompile error
|
||||||
- ResourceKey resourcekey;
|
|
||||||
+ ResourceKey<Level> resourcekey = null; // Paper
|
+ ResourceKey<Level> resourcekey = null; // Paper
|
||||||
// CraftBukkit start - Better rename detection
|
// CraftBukkit start - Better rename detection
|
||||||
if (nbttagcompound != null && nbttagcompound.contains("bukkit")) {
|
if (optional.isPresent()) {
|
||||||
CompoundTag bukkit = nbttagcompound.getCompound("bukkit");
|
CompoundTag nbttagcompound = optional.get();
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
- ResourceKey<Level> resourcekey = (ResourceKey) optional.flatMap((nbttagcompound) -> {
|
||||||
+ // Paper start - move logic in Entity to here, to use bukkit supplied world UUID & reset to main world spawn if no valid world is found
|
+ // Paper start - move logic in Entity to here, to use bukkit supplied world UUID & reset to main world spawn if no valid world is found
|
||||||
+ boolean invalidPlayerWorld = false;
|
+ boolean[] invalidPlayerWorld = {false};
|
||||||
+ bukkitData: if (nbttagcompound != null) {
|
+ bukkitData: if (optional.isPresent()) {
|
||||||
+ // The main way for bukkit worlds to store the world is the world UUID despite mojang adding custom worlds
|
+ // The main way for bukkit worlds to store the world is the world UUID despite mojang adding custom worlds
|
||||||
+ final org.bukkit.World bWorld;
|
+ final org.bukkit.World bWorld;
|
||||||
+ if (nbttagcompound.contains("WorldUUIDMost") && nbttagcompound.contains("WorldUUIDLeast")) {
|
+ if (optional.get().contains("WorldUUIDMost") && optional.get().contains("WorldUUIDLeast")) {
|
||||||
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(nbttagcompound.getLong("WorldUUIDMost"), nbttagcompound.getLong("WorldUUIDLeast")));
|
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(new UUID(optional.get().getLong("WorldUUIDMost"), optional.get().getLong("WorldUUIDLeast")));
|
||||||
+ } else if (nbttagcompound.contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name
|
+ } else if (optional.get().contains("world", net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - legacy bukkit world name
|
||||||
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(nbttagcompound.getString("world"));
|
+ bWorld = org.bukkit.Bukkit.getServer().getWorld(optional.get().getString("world"));
|
||||||
+ } else {
|
+ } else {
|
||||||
+ break bukkitData; // if neither of the bukkit data points exist, proceed to the vanilla migration section
|
+ break bukkitData; // if neither of the bukkit data points exist, proceed to the vanilla migration section
|
||||||
+ }
|
+ }
|
||||||
@ -42,46 +42,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ resourcekey = ((CraftWorld) bWorld).getHandle().dimension();
|
+ resourcekey = ((CraftWorld) bWorld).getHandle().dimension();
|
||||||
+ } else {
|
+ } else {
|
||||||
+ resourcekey = Level.OVERWORLD;
|
+ resourcekey = Level.OVERWORLD;
|
||||||
+ invalidPlayerWorld = true;
|
+ invalidPlayerWorld[0] = true;
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
+ if (resourcekey == null) { // only run the vanilla logic if we haven't found a world from the bukkit data
|
+ if (resourcekey == null) { // only run the vanilla logic if we haven't found a world from the bukkit data
|
||||||
+ // Below is the vanilla way of getting the dimension, this is for migration from vanilla servers
|
+ // Below is the vanilla way of getting the dimension, this is for migration from vanilla servers
|
||||||
+ // Paper end
|
+ resourcekey = optional.flatMap((nbttagcompound) -> {
|
||||||
if (nbttagcompound != null) {
|
+ // Paper end
|
||||||
DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
|
DataResult<ResourceKey<Level>> dataresult = DimensionType.parseLegacy(new Dynamic(NbtOps.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
|
||||||
Logger logger = PlayerList.LOGGER;
|
Logger logger = PlayerList.LOGGER;
|
||||||
|
|
||||||
Objects.requireNonNull(logger);
|
Objects.requireNonNull(logger);
|
||||||
- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
- return dataresult.resultOrPartial(logger::error);
|
||||||
|
- }).orElse(player.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||||
+ // Paper start - reset to main world spawn if no valid world is found
|
+ // Paper start - reset to main world spawn if no valid world is found
|
||||||
+ final Optional<ResourceKey<Level>> result = dataresult.resultOrPartial(logger::error);
|
+ final Optional<ResourceKey<Level>> result = dataresult.resultOrPartial(logger::error);
|
||||||
+ invalidPlayerWorld = result.isEmpty();
|
+ invalidPlayerWorld[0] = result.isEmpty();
|
||||||
+ resourcekey = result.orElse(Level.OVERWORLD);
|
+ return result;
|
||||||
+ // Paper end
|
+ }).orElse(Level.OVERWORLD); // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed
|
||||||
} else {
|
+ }
|
||||||
- resourcekey = player.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
+ // Paper end
|
||||||
+ resourcekey = Level.OVERWORLD; // Paper - revert to vanilla default main world, this isn't an "invalid world" since no player data existed
|
ServerLevel worldserver = this.server.getLevel(resourcekey);
|
||||||
}
|
ServerLevel worldserver1;
|
||||||
+ } // Paper
|
|
||||||
|
|
||||||
ResourceKey<Level> resourcekey1 = resourcekey;
|
|
||||||
ServerLevel worldserver = this.server.getLevel(resourcekey1);
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
|
||||||
if (worldserver == null) {
|
if (worldserver == null) {
|
||||||
PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey1);
|
PlayerList.LOGGER.warn("Unknown respawn dimension {}, defaulting to overworld", resourcekey);
|
||||||
worldserver1 = this.server.overworld();
|
worldserver1 = this.server.overworld();
|
||||||
+ invalidPlayerWorld = true; // Paper - reset to main world if no world with parsed value is found
|
+ invalidPlayerWorld[0] = true; // Paper - reset to main world if no world with parsed value is found
|
||||||
} else {
|
} else {
|
||||||
worldserver1 = worldserver;
|
worldserver1 = worldserver;
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
// Paper start - Entity#getEntitySpawnReason
|
// Paper start - Entity#getEntitySpawnReason
|
||||||
if (nbttagcompound == null) {
|
if (optional.isEmpty()) {
|
||||||
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
player.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT; // set Player SpawnReason to DEFAULT on first login
|
||||||
+ // Paper start - reset to main world spawn if first spawn or invalid world
|
+ // Paper start - reset to main world spawn if first spawn or invalid world
|
||||||
+ }
|
+ }
|
||||||
+ if (nbttagcompound == null || invalidPlayerWorld) {
|
+ if (optional.isEmpty() || invalidPlayerWorld[0]) {
|
||||||
+ // Paper end - reset to main world spawn if first spawn or invalid world
|
+ // Paper end - reset to main world spawn if first spawn or invalid world
|
||||||
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
player.fudgeSpawnLocation(worldserver1); // Paper - Don't move existing players to world spawn
|
||||||
}
|
}
|
||||||
@ -90,7 +87,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
@ -4,18 +4,6 @@ Date: Sun, 5 Jul 2020 22:38:18 -0400
|
|||||||
Subject: [PATCH] Optimize NetworkManager Exception Handling
|
Subject: [PATCH] Optimize NetworkManager Exception Handling
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/ConnectionProtocol.java b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
|
||||||
+++ b/src/main/java/net/minecraft/network/ConnectionProtocol.java
|
|
||||||
@@ -0,0 +0,0 @@ public enum ConnectionProtocol {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public Packet<?> createPacket(int id, FriendlyByteBuf buf) {
|
|
||||||
+ if (id < 0 || id >= this.idToDeserializer.size()) return null; // Paper - Perf: Optimize exception handling
|
|
||||||
Function<FriendlyByteBuf, ? extends Packet<? super T>> function = this.idToDeserializer.get(id);
|
|
||||||
return (Packet<?>)(function != null ? function.apply(buf) : null);
|
|
||||||
}
|
|
||||||
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
diff --git a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java b/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
--- a/src/main/java/net/minecraft/network/Varint21FrameDecoder.java
|
@ -0,0 +1,20 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Aikar <aikar@aikar.co>
|
||||||
|
Date: Sun, 7 Jun 2020 19:25:13 -0400
|
||||||
|
Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
|
||||||
|
carto/sunken maps
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
||||||
|
@@ -0,0 +0,0 @@ public class MapItem extends ComplexItem {
|
||||||
|
|
||||||
|
for (int n = 0; n < 128; n++) {
|
||||||
|
for (int o = 0; o < 128; o++) {
|
||||||
|
- Holder<Biome> holder = world.getBiome(mutableBlockPos.set((l + o) * i, 0, (m + n) * i));
|
||||||
|
+ Holder<Biome> holder = world.getUncachedNoiseBiome((l + o) * i, 0, (m + n) * i); // Paper - Perf: Use seed based lookup for treasure maps
|
||||||
|
bls[n * 128 + o] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES);
|
||||||
|
}
|
||||||
|
}
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
+ this.server.waitForAsyncTasksShutdown(); // Paper - Wait for Async Tasks during shutdown
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.getConnection().stop();
|
if (io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper != null) io.papermc.paper.plugin.PluginInitializerManager.instance().pluginRemapper.shutdown(); // Paper - Plugin remapping
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
@ -86,7 +86,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
super.onDisconnect(reason);
|
super.onDisconnect(reason);
|
||||||
}
|
}
|
||||||
@@ -0,0 +0,0 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
@@ -0,0 +0,0 @@ public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketLis
|
||||||
this.connection.resumeInboundAfterProtocolChange();
|
playerlist.placeNewPlayer(this.connection, entityplayer, this.createCookie(this.clientInformation));
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
|
ServerConfigurationPacketListenerImpl.LOGGER.error("Couldn't place player in world", exception);
|
||||||
+ // Paper start - Debugging
|
+ // Paper start - Debugging
|
@ -1,27 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Sun, 7 Jun 2020 19:25:13 -0400
|
|
||||||
Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from
|
|
||||||
carto/sunken maps
|
|
||||||
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/item/MapItem.java
|
|
||||||
@@ -0,0 +0,0 @@ public class MapItem extends ComplexItem {
|
|
||||||
boolean[] aboolean = new boolean[16384];
|
|
||||||
int l = j / i - 64;
|
|
||||||
int i1 = k / i - 64;
|
|
||||||
- BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
|
||||||
|
|
||||||
int j1;
|
|
||||||
int k1;
|
|
||||||
|
|
||||||
for (j1 = 0; j1 < 128; ++j1) {
|
|
||||||
for (k1 = 0; k1 < 128; ++k1) {
|
|
||||||
- Holder<Biome> holder = world.getBiome(blockposition_mutableblockposition.set((l + k1) * i, 0, (i1 + j1) * i));
|
|
||||||
+ Holder<Biome> holder = world.getUncachedNoiseBiome((l + k1) * i, 0, (i1 + j1) * i); // Paper - Perf: Use seed based lookup for treasure maps
|
|
||||||
|
|
||||||
aboolean[j1 * 128 + k1] = holder.is(BiomeTags.WATER_ON_MAP_OUTLINES);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user