1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2025-01-29 11:07:59 +01:00

more work (721)

This commit is contained in:
Noah van der Aa 2024-04-24 22:05:42 +02:00
parent f2519808c9
commit b8911367e6
27 changed files with 151 additions and 149 deletions

View file

@ -8,8 +8,8 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java --- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java +++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -0,0 +0,0 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> { @@ -0,0 +0,0 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
DyeColor enumcolor = ((DyeItem) item).getDyeColor(); DyeColor enumcolor = itemdye.getDyeColor();
if (enumcolor != this.getCollarColor()) { if (enumcolor != this.getCollarColor()) {
+ // Paper start - Add EntityDyeEvent and CollarColorable interface + // Paper start - Add EntityDyeEvent and CollarColorable interface
@ -19,14 +19,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ enumcolor = DyeColor.byId(event.getColor().getWoolData()); + enumcolor = DyeColor.byId(event.getColor().getWoolData());
+ // Paper end - Add EntityDyeEvent and CollarColorable interface + // Paper end - Add EntityDyeEvent and CollarColorable interface
this.setCollarColor(enumcolor); if (!this.level().isClientSide()) {
if (!player.getAbilities().instabuild) { this.setCollarColor(enumcolor);
itemstack.shrink(1); itemstack.consume(1, player);
diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java diff --git a/src/main/java/net/minecraft/world/entity/animal/Wolf.java b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java --- a/src/main/java/net/minecraft/world/entity/animal/Wolf.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java +++ b/src/main/java/net/minecraft/world/entity/animal/Wolf.java
@@ -0,0 +0,0 @@ public class Wolf extends TamableAnimal implements NeutralMob { @@ -0,0 +0,0 @@ public class Wolf extends TamableAnimal implements NeutralMob, VariantHolder<Hol
DyeColor enumcolor = itemdye.getDyeColor(); DyeColor enumcolor = itemdye.getDyeColor();
if (enumcolor != this.getCollarColor()) { if (enumcolor != this.getCollarColor()) {
@ -39,5 +39,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - Add EntityDyeEvent and CollarColorable interface + // Paper end - Add EntityDyeEvent and CollarColorable interface
+ +
this.setCollarColor(enumcolor); this.setCollarColor(enumcolor);
if (!player.getAbilities().instabuild) { itemstack.consume(1, player);
itemstack.shrink(1); return InteractionResult.SUCCESS;

View file

@ -28,13 +28,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
return true; return true;
} else { } else {
- Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
+ // Paper start - Buffer OOB setBlock calls + // Paper start - Buffer OOB setBlock calls
+ if (!hasSetFarWarned) { + if (!hasSetFarWarned) {
Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + pos + ", status: " + this.generatingStatus + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get())); + Util.logAndPauseIfInIde("Detected setBlock in a far chunk [" + i + ", " + j + "], pos: " + String.valueOf(pos) + ", status: " + String.valueOf(this.generatingStatus) + (this.currentlyGenerating == null ? "" : ", currently generating: " + (String) this.currentlyGenerating.get()));
+ hasSetFarWarned = true; + hasSetFarWarned = true;
+ if (this.getServer() != null && this.getServer().isDebugging()) { + if (this.getServer() != null && this.getServer().isDebugging()) {
+ io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call"); + io.papermc.paper.util.TraceUtil.dumpTraceForThread("far setBlock call");
+ } + }
+ } + }
+ // Paper end - Buffer OOB setBlock calls + // Paper end - Buffer OOB setBlock calls
return false; return false;

View file

@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.worldData.setDataConfiguration(worlddataconfiguration); this.worldData.setDataConfiguration(worlddataconfiguration);
this.resources.managers.updateRegistryTags(this.registryAccess()); this.resources.managers.updateRegistryTags();
+ net.minecraft.world.item.alchemy.PotionBrewing.reload(); // Paper - Custom Potion Mixes + this.potionBrewing.reload(this.worldData.enabledFeatures()); // Paper - Custom Potion Mixes
this.getPlayerList().saveAll(); this.getPlayerList().saveAll();
this.getPlayerList().reloadResources(); this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary()); this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
@ -61,50 +61,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java --- a/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java
+++ b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java +++ b/src/main/java/net/minecraft/world/item/alchemy/PotionBrewing.java
@@ -0,0 +0,0 @@ public class PotionBrewing { @@ -0,0 +0,0 @@ public class PotionBrewing {
public static final int BREWING_TIME_SECONDS = 20; private final List<Ingredient> containers;
private static final List<PotionBrewing.Mix<Potion>> POTION_MIXES = Lists.newArrayList(); private final List<PotionBrewing.Mix<Potion>> potionMixes;
private static final List<PotionBrewing.Mix<Item>> CONTAINER_MIXES = Lists.newArrayList(); private final List<PotionBrewing.Mix<Item>> containerMixes;
+ private static final it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<org.bukkit.NamespacedKey, io.papermc.paper.potion.PaperPotionMix> CUSTOM_MIXES = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // Paper - Custom Potion Mixes + private static final it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<org.bukkit.NamespacedKey, io.papermc.paper.potion.PaperPotionMix> CUSTOM_MIXES = new it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap<>(); // Paper - Custom Potion Mixes
private static final List<Ingredient> ALLOWED_CONTAINERS = Lists.newArrayList();
private static final Predicate<ItemStack> ALLOWED_CONTAINER = stack -> {
for (Ingredient ingredient : ALLOWED_CONTAINERS) {
@@ -0,0 +0,0 @@ public class PotionBrewing {
};
public static boolean isIngredient(ItemStack stack) { PotionBrewing(List<Ingredient> potionTypes, List<PotionBrewing.Mix<Potion>> potionRecipes, List<PotionBrewing.Mix<Item>> itemRecipes) {
- return isContainerIngredient(stack) || isPotionIngredient(stack); this.containers = potionTypes;
+ return isContainerIngredient(stack) || isPotionIngredient(stack) || isCustomIngredient(stack); // Paper - Custom Potion Mixes
}
protected static boolean isContainerIngredient(ItemStack stack) {
@@ -0,0 +0,0 @@ public class PotionBrewing { @@ -0,0 +0,0 @@ public class PotionBrewing {
} }
public static boolean hasMix(ItemStack input, ItemStack ingredient) { public boolean isIngredient(ItemStack stack) {
- return this.isContainerIngredient(stack) || this.isPotionIngredient(stack);
+ return this.isContainerIngredient(stack) || this.isPotionIngredient(stack) || isCustomIngredient(stack); // Paper - Custom Potion Mixes
}
private boolean isContainer(ItemStack stack) {
@@ -0,0 +0,0 @@ public class PotionBrewing {
}
public boolean hasMix(ItemStack input, ItemStack ingredient) {
+ // Paper start - Custom Potion Mixes + // Paper start - Custom Potion Mixes
+ if (hasCustomMix(input, ingredient)) { + if (hasCustomMix(input, ingredient)) {
+ return true; + return true;
+ } + }
+ // Paper end - Custom Potion Mixes + // Paper end - Custom Potion Mixes
return ALLOWED_CONTAINER.test(input) && (hasContainerMix(input, ingredient) || hasPotionMix(input, ingredient)); return this.isContainer(input) && (this.hasContainerMix(input, ingredient) || this.hasPotionMix(input, ingredient));
} }
@@ -0,0 +0,0 @@ public class PotionBrewing { @@ -0,0 +0,0 @@ public class PotionBrewing {
if (optional.isEmpty()) {
public static ItemStack mix(ItemStack ingredient, ItemStack input) { return input;
if (!input.isEmpty()) { } else {
+ // Paper start - Custom Potion Mixes + // Paper start - Custom Potion Mixes
+ for (var mix : CUSTOM_MIXES.values()) { + for (var mix : CUSTOM_MIXES.values()) {
+ if (mix.input().test(input) && mix.ingredient().test(ingredient)) { + if (mix.input().test(input) && mix.ingredient().test(ingredient)) {
+ return mix.result().copy(); + return mix.result().copy();
+ }
+ } + }
+ } + // Paper end - Custom Potion Mixes
+ // Paper end - Custom Potion Mixes for (PotionBrewing.Mix<Item> mix : this.containerMixes) {
Potion potion = PotionUtils.getPotion(input); if (input.is(mix.from) && mix.ingredient.test(ingredient)) {
Item item = input.getItem(); return PotionContents.createItemStack(mix.to.value(), optional.get());
@@ -0,0 +0,0 @@ public class PotionBrewing { @@ -0,0 +0,0 @@ public class PotionBrewing {
return input; builder.addMix(Potions.SLOW_FALLING, Items.REDSTONE, Potions.LONG_SLOW_FALLING);
} }
+ // Paper start - Custom Potion Mixes + // Paper start - Custom Potion Mixes
@ -146,31 +146,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ return CUSTOM_MIXES.remove(key) != null; + return CUSTOM_MIXES.remove(key) != null;
+ } + }
+ +
+ public static void reload() { + public void reload(FeatureFlagSet flags) {
+ POTION_MIXES.clear(); + potionMixes.clear();
+ CONTAINER_MIXES.clear(); + containerMixes.clear();
+ ALLOWED_CONTAINERS.clear(); + containers.clear();
+ CUSTOM_MIXES.clear(); + CUSTOM_MIXES.clear();
+ bootStrap(); + bootstrap(flags);
+ } + }
+ // Paper end - Custom Potion Mixes + // Paper end - Custom Potion Mixes
+ +
public static void bootStrap() { public static class Builder {
addContainer(Items.POTION); private final List<Ingredient> containers = new ArrayList<>();
addContainer(Items.SPLASH_POTION); private final List<PotionBrewing.Mix<Potion>> potionMixes = new ArrayList<>();
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java
@@ -0,0 +0,0 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements @@ -0,0 +0,0 @@ public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements
@Override return potionbrewer.isIngredient(stack);
public boolean canPlaceItem(int slot, ItemStack stack) { } else {
- return slot == 3 ? PotionBrewing.isIngredient(stack) : (slot == 4 ? stack.is(Items.BLAZE_POWDER) : (stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE)) && this.getItem(slot).isEmpty()); - return slot == 4 ? stack.is(Items.BLAZE_POWDER) : (stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE)) && this.getItem(slot).isEmpty();
+ return slot == 3 ? PotionBrewing.isIngredient(stack) : (slot == 4 ? stack.is(Items.BLAZE_POWDER) : (stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE) || PotionBrewing.isCustomInput(stack)) && this.getItem(slot).isEmpty()); // Paper - Custom Potion Mixes + return slot == 4 ? stack.is(Items.BLAZE_POWDER) : (stack.is(Items.POTION) || stack.is(Items.SPLASH_POTION) || stack.is(Items.LINGERING_POTION) || stack.is(Items.GLASS_BOTTLE) || PotionBrewing.isCustomInput(stack)) && this.getItem(slot).isEmpty(); // Paper - Custom Potion Mixes
}
} }
@Override
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
@ -184,15 +184,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
static { static {
ConfigurationSerialization.registerClass(CraftOfflinePlayer.class); ConfigurationSerialization.registerClass(CraftOfflinePlayer.class);
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
CraftRegistry.setMinecraftRegistry(console.registryAccess());
- Potion.setPotionBrewer(new CraftPotionBrewer());
+ Potion.setPotionBrewer(potionBrewer); // Paper - Custom Potion Mixes
// Ugly hack :(
if (!Main.useConsole) {
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
return datapackManager; return datapackManager;
} }
@ -220,13 +211,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
if (bukkit == null) { if (bukkit == null) {
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 new file mode 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java +++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionBrewer.java
@@ -0,0 +0,0 @@ public class CraftPotionBrewer implements PotionBrewer { @@ -0,0 +0,0 @@
public PotionEffect createEffect(PotionEffectType potion, int duration, int amplifier) { +package org.bukkit.craftbukkit.potion;
return new PotionEffect(potion, potion.isInstant() ? 1 : (int) (duration * potion.getDurationModifier()), amplifier); +
} +import com.google.common.base.Preconditions;
+import java.util.ArrayList;
+import java.util.Collection;
+import org.bukkit.potion.PotionBrewer;
+import org.bukkit.potion.PotionData;
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.bukkit.potion.PotionType;
+
+public class CraftPotionBrewer implements PotionBrewer {
+
+ @Override
+ public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended) {
+ Preconditions.checkArgument(!type.getKey().getKey().startsWith("strong_"), "Strong potion type cannot be used directly, got %s", type.getKey());
+ Preconditions.checkArgument(!type.getKey().getKey().startsWith("long_"), "Extended potion type cannot be used directly, got %s", type.getKey());
+
+ return CraftPotionUtil.fromBukkit(new PotionData(type, upgraded, extended)).getPotionEffects();
+ }
+
+ @Override
+ public Collection<PotionEffect> getEffectsFromDamage(int damage) {
+ return new ArrayList<PotionEffect>();
+ }
+
+ @Override
+ public PotionEffect createEffect(PotionEffectType potion, int duration, int amplifier) {
+ return new PotionEffect(potion, potion.isInstant() ? 1 : (int) (duration * potion.getDurationModifier()), amplifier);
+ }
+ +
+ // Paper start + // Paper start
+ @Override + @Override
@ -244,4 +263,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ net.minecraft.world.item.alchemy.PotionBrewing.reload(); + net.minecraft.world.item.alchemy.PotionBrewing.reload();
+ } + }
+ // Paper end + // Paper end
} +}

View file

@ -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 boolean startRiding(Entity entity, boolean force) { public boolean startRiding(Entity entity, boolean force) {

View file

@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java --- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -0,0 +0,0 @@ public final class ItemStack { @@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder {
} }
} }

View file

@ -23,18 +23,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
+ // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows + // Paper start - Fix cancelling ProjectileHitEvent for piercing arrows
+ @Override @Override
+ public void preOnHit(HitResult hitResult) { - protected double getDefaultGravity() {
+ super.preOnHit(hitResult); - return 0.05D;
+ public ProjectileDeflection preHitTargetOrDeflectSelf(HitResult hitResult) {
+ if (hitResult instanceof EntityHitResult entityHitResult && this.hitCancelled && this.getPierceLevel() > 0) { + if (hitResult instanceof EntityHitResult entityHitResult && this.hitCancelled && this.getPierceLevel() > 0) {
+ if (this.piercingIgnoreEntityIds == null) { + if (this.piercingIgnoreEntityIds == null) {
+ this.piercingIgnoreEntityIds = new IntOpenHashSet(5); + this.piercingIgnoreEntityIds = new IntOpenHashSet(5);
+ } + }
+ this.piercingIgnoreEntityIds.add(entityHitResult.getEntity().getId()); + this.piercingIgnoreEntityIds.add(entityHitResult.getEntity().getId());
+ } + }
+ } + super.preHitTargetOrDeflectSelf(hitResult);
}
+ // Paper end - Fix cancelling ProjectileHitEvent for piercing arrows + // Paper end - Fix cancelling ProjectileHitEvent for piercing arrows
+
private boolean shouldFall() { private boolean shouldFall() {
return this.inGround && this.level().noCollision((new AABB(this.position(), this.position())).inflate(0.06D)); return this.inGround && this.level().noCollision((new AABB(this.position(), this.position())).inflate(0.06D));
}

View file

@ -47,11 +47,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java
@@ -0,0 +0,0 @@ public final class CraftEntityTypes { @@ -0,0 +0,0 @@ public final class CraftEntityTypes {
register(new EntityTypeData<>(EntityType.PRIMED_TNT, TNTPrimed.class, CraftTNTPrimed::new, spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null))); register(new EntityTypeData<>(EntityType.TNT, TNTPrimed.class, CraftTNTPrimed::new, spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null)));
register(new EntityTypeData<>(EntityType.FALLING_BLOCK, FallingBlock.class, CraftFallingBlock::new, spawnData -> { register(new EntityTypeData<>(EntityType.FALLING_BLOCK, FallingBlock.class, CraftFallingBlock::new, spawnData -> {
BlockPos pos = BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z()); BlockPos pos = BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z());
- return FallingBlockEntity.fall(spawnData.minecraftWorld(), pos, spawnData.world().getBlockState(pos)); - return FallingBlockEntity.fall(spawnData.minecraftWorld(), pos, spawnData.world().getBlockState(pos));
+ return new FallingBlockEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), spawnData.world().getBlockState(pos)); // Paper - create falling block entities correctly + return new FallingBlockEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), spawnData.world().getBlockState(pos)); // Paper - create falling block entities correctly
})); }));
register(new EntityTypeData<>(EntityType.FIREWORK, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY))); register(new EntityTypeData<>(EntityType.FIREWORK_ROCKET, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY)));
register(new EntityTypeData<>(EntityType.EVOKER_FANGS, EvokerFangs.class, CraftEvokerFangs::new, spawnData -> new net.minecraft.world.entity.projectile.EvokerFangs(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), (float) Math.toRadians(spawnData.yaw()), 0, null))); register(new EntityTypeData<>(EntityType.EVOKER_FANGS, EvokerFangs.class, CraftEvokerFangs::new, spawnData -> new net.minecraft.world.entity.projectile.EvokerFangs(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), (float) Math.toRadians(spawnData.yaw()), 0, null)));

View file

@ -83,13 +83,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java +++ b/src/main/java/net/minecraft/world/entity/boss/wither/WitherBoss.java
@@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob @@ -0,0 +0,0 @@ public class WitherBoss extends Monster implements PowerableMob, RangedAttackMob
if (WitherBoss.canDestroy(iblockdata)) { if (WitherBoss.canDestroy(iblockdata)) {
// CraftBukkit start // CraftBukkit start
- if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) { - if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, Blocks.AIR.defaultBlockState())) {
+ if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state + if (!CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // Paper - fix wrong block state
continue; continue;
} }
// CraftBukkit end // CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java --- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java
@ -101,7 +101,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState())) { // CraftBukkit - Place event - if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, Blocks.AIR.defaultBlockState())) { // CraftBukkit - Place event
+ if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // CraftBukkit - Place event // Paper - fix wrong block state + if (CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata.getFluidState().createLegacyBlock())) { // CraftBukkit - Place event // Paper - fix wrong block state
world.removeBlock(blockposition, false); world.removeBlock(blockposition, false);
world.gameEvent(GameEvent.BLOCK_DESTROY, blockposition, GameEvent.Context.of(this.enderman, iblockdata)); world.gameEvent((Holder) GameEvent.BLOCK_DESTROY, blockposition, GameEvent.Context.of(this.enderman, iblockdata));
this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState()); this.enderman.setCarriedBlock(iblockdata.getBlock().defaultBlockState());
diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java diff --git a/src/main/java/net/minecraft/world/entity/monster/Ravager.java b/src/main/java/net/minecraft/world/entity/monster/Ravager.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644

View file

@ -13,13 +13,13 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java --- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java +++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -0,0 +0,0 @@ public class Cat extends TamableAnimal implements VariantHolder<CatVariant> { @@ -0,0 +0,0 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
}); BuiltInRegistries.CAT_VARIANT.getRandomElementOf(tagkey, world.getRandom()).ifPresent(this::setVariant);
ServerLevel worldserver = world.getLevel(); ServerLevel worldserver = world.getLevel();
- if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { - if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) {
+ if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK, world).isValid()) { // Paper - Fix swamp hut cat generation deadlock + if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK, world).isValid()) { // Paper - Fix swamp hut cat generation deadlock
this.setVariant((CatVariant) BuiltInRegistries.CAT_VARIANT.getOrThrow(CatVariant.ALL_BLACK)); this.setVariant((Holder) BuiltInRegistries.CAT_VARIANT.getHolderOrThrow(CatVariant.ALL_BLACK));
this.setPersistenceRequired(); this.setPersistenceRequired();
} }
diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java
@ -43,17 +43,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
@@ -0,0 +0,0 @@ public class StructureManager { @@ -0,0 +0,0 @@ public class StructureManager {
} }
public StructureStart getStructureWithPieceAt(BlockPos pos, TagKey<Structure> structureTag) { public StructureStart getStructureWithPieceAt(BlockPos pos, Predicate<Holder<Structure>> predicate) {
+ // Paper start - Fix swamp hut cat generation deadlock + // Paper start - Fix swamp hut cat generation deadlock
+ return this.getStructureWithPieceAt(pos, structureTag, null); + return this.getStructureWithPieceAt(pos, predicate, null);
+ } + }
+ public StructureStart getStructureWithPieceAt(BlockPos pos, TagKey<Structure> structureTag, @Nullable ServerLevelAccessor levelAccessor) { +
+ public StructureStart getStructureWithPieceAt(BlockPos pos, TagKey<Structure> tag, @Nullable ServerLevelAccessor levelAccessor) {
+ return this.getStructureWithPieceAt(pos, structure -> structure.is(tag), levelAccessor);
+ }
+
+ public StructureStart getStructureWithPieceAt(BlockPos pos, Predicate<Holder<Structure>> predicate, @Nullable ServerLevelAccessor levelAccessor) {
+ // Paper end - Fix swamp hut cat generation deadlock + // Paper end - Fix swamp hut cat generation deadlock
Registry<Structure> registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE); Registry<Structure> registry = this.registryAccess().registryOrThrow(Registries.STRUCTURE);
for (StructureStart structureStart : this.startsForStructure( for (StructureStart structureStart : this.startsForStructure(
- new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(reference -> reference.is(structureTag)).orElse(false) - new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(predicate::test).orElse(false)
+ new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(reference -> reference.is(structureTag)).orElse(false), levelAccessor // Paper - Fix swamp hut cat generation deadlock + new ChunkPos(pos), structure -> registry.getHolder(registry.getId(structure)).map(predicate::test).orElse(false), levelAccessor // Paper - Fix swamp hut cat generation deadlock
)) { )) {
if (this.structureHasPieceAt(pos, structureStart)) { if (this.structureHasPieceAt(pos, structureStart)) {
return structureStart; return structureStart;

View file

@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/players/PlayerList.java --- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -0,0 +0,0 @@ public abstract class PlayerList {
}
// Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code // Paper start - Fire PlayerJoinEvent when Player is actually ready; move vehicle into method so it can be called above - short circuit around that code
onPlayerJoinFinish(player, worldserver1, s1); this.onPlayerJoinFinish(player, worldserver1, s1);
+ // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead + // Paper start - Send empty chunk, so players aren't stuck in the world loading screen with our chunk system not sending chunks when dead
+ if (player.isDeadOrDying()) { + if (player.isDeadOrDying()) {
+ net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME) + net.minecraft.core.Holder<net.minecraft.world.level.biome.Biome> plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME)
@ -28,5 +28,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ } + }
+ // Paper end - Send empty chunk + // Paper end - Send empty chunk
} }
private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, CompoundTag nbttagcompound) { private void mountSavedVehicle(ServerPlayer player, ServerLevel worldserver1, Optional<CompoundTag> optional) {
// Paper end - Fire PlayerJoinEvent when Player is actually ready // Paper end - Fire PlayerJoinEvent when Player is actually ready

View file

@ -34,10 +34,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - More projectile API + // Paper end - More projectile API
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
ItemStack itemstack = this.getItem(); ItemStack itemstack = this.getItem();
Potion potionregistry = PotionUtils.getPotion(itemstack); PotionContents potioncontents = (PotionContents) itemstack.getOrDefault(DataComponents.POTION_CONTENTS, PotionContents.EMPTY);
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
if (this.isLingering()) { if (this.isLingering()) {
showParticles = this.makeAreaOfEffectCloud(itemstack, potionregistry, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper showParticles = this.makeAreaOfEffectCloud(itemstack, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
} else { } else {
- showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - showParticles = this.applySplash(list, hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper
+ showParticles = this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API + showParticles = this.applySplash(list, hitResult != null && hitResult.getType() == HitResult.Type.ENTITY ? ((EntityHitResult) hitResult).getEntity() : null, hitResult); // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API
@ -48,17 +48,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
} }
- private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events - private boolean applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events
+ private boolean applySplash(List<MobEffectInstance> list, @Nullable Entity entity, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events & More projectile API + private boolean applySplash(Iterable<MobEffectInstance> iterable, @Nullable Entity entity, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - Fix potions splash events & More projectile API
AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D); AABB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<net.minecraft.world.entity.LivingEntity> list1 = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb); List<net.minecraft.world.entity.LivingEntity> list = this.level().getEntitiesOfClass(net.minecraft.world.entity.LivingEntity.class, axisalignedbb);
Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit Map<LivingEntity, Double> affected = new HashMap<LivingEntity, Double>(); // CraftBukkit
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
} }
- private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean - private boolean makeAreaOfEffectCloud(PotionContents potioncontents, HitResult position) { // CraftBukkit - Pass MovingObjectPosition
+ private boolean makeAreaOfEffectCloud(ItemStack itemstack, Potion potionregistry, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - return boolean & More projectile API + private boolean makeAreaOfEffectCloud(PotionContents potioncontents, @Nullable HitResult position) { // CraftBukkit - Pass MovingObjectPosition // Paper - More projectile API
AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ()); AreaEffectCloud entityareaeffectcloud = new AreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
Entity entity = this.getOwner(); Entity entity = this.getOwner();
@ -136,30 +136,8 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/m
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java
@@ -0,0 +0,0 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { @@ -0,0 +0,0 @@ public class CraftArrow extends CraftAbstractArrow implements Arrow {
this.getHandle().setCritArrow(critical); return false;
}
- @Override
- public ProjectileSource getShooter() {
- return this.getHandle().projectileSource;
- }
-
- @Override
- public void setShooter(ProjectileSource shooter) {
- if (shooter instanceof Entity) {
- this.getHandle().setOwner(((CraftEntity) shooter).getHandle());
- } else {
- this.getHandle().setOwner(null);
- }
- this.getHandle().projectileSource = shooter;
- }
+ // Paper - moved to AbstractProjectile
@Override
public boolean isInBlock() {
@@ -0,0 +0,0 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow {
this.getHandle().pickup = net.minecraft.world.entity.projectile.AbstractArrow.Pickup.byOrdinal(status.ordinal());
} }
+ // Paper start + // Paper start
@ -192,8 +170,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end + // Paper end
+ +
@Override @Override
public void setTicksLived(int value) { public boolean hasCustomEffects() {
super.setTicksLived(value); return !this.getHandle().getPotionContents().customEffects().isEmpty();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFireball.java
@ -500,7 +478,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java b/src
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTrident.java
@@ -0,0 +0,0 @@ public class CraftTrident extends CraftArrow implements Trident { @@ -0,0 +0,0 @@ public class CraftTrident extends CraftAbstractArrow implements Trident {
com.google.common.base.Preconditions.checkArgument(loyaltyLevel >= 0 && loyaltyLevel <= 127, "The loyalty level has to be between 0 and 127"); com.google.common.base.Preconditions.checkArgument(loyaltyLevel >= 0 && loyaltyLevel <= 127, "The loyalty level has to be between 0 and 127");
this.getHandle().setLoyalty((byte) loyaltyLevel); this.getHandle().setLoyalty((byte) loyaltyLevel);
} }
@ -592,5 +570,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
- switch (CraftItemStack.getType(item)) { - switch (CraftItemStack.getType(item)) {
+ switch (material) { // Paper + switch (material) { // Paper
case WRITTEN_BOOK: case WRITTEN_BOOK:
return new CraftMetaBookSigned(item.getTag()); return new CraftMetaBookSigned(item.getComponentsPatch());
case WRITABLE_BOOK: case WRITABLE_BOOK:

View file

@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound); BlockPos blockposition = BlockEntity.getPosFromTag(customdata.getUnsafe());
if (this.player.level().isLoaded(blockposition)) { if (this.player.level().isLoaded(blockposition)) {
- BlockEntity tileentity = this.player.level().getBlockEntity(blockposition); - BlockEntity tileentity = this.player.level().getBlockEntity(blockposition);
@ -21,4 +21,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ // Paper end - Prevent tile entity copies loading chunks + // Paper end - Prevent tile entity copies loading chunks
if (tileentity != null) { if (tileentity != null) {
tileentity.saveToItem(itemstack); tileentity.saveToItem(itemstack, this.player.level().registryAccess());

View file

@ -8,20 +8,18 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja
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
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -0,0 +0,0 @@ public final class CraftServer implements Server {
ServerLevel internal = (ServerLevel) new ServerLevel(this.console, this.console.executor, worldSession, worlddata, worldKey, worlddimension, this.getServer().progressListenerFactory.create(11),
worlddata.isDebugWorld(), j, creator.environment() == Environment.NORMAL ? list : ImmutableList.of(), true, this.console.overworld().getRandomSequences(), creator.environment(), generator, biomeProvider);
- internal.keepSpawnInMemory = creator.keepSpawnInMemory();
+ // internal.keepSpawnInMemory = creator.keepSpawnInMemory(); // Paper - replace
if (!(this.worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
return null;
@@ -0,0 +0,0 @@ public final class CraftServer implements Server { @@ -0,0 +0,0 @@ public final class CraftServer implements Server {
internal.setSpawnSettings(true, true); internal.setSpawnSettings(true, true);
// Paper - Put world into worldlist before initing the world; move up // Paper - Put world into worldlist before initing the world; move up
+ internal.keepSpawnInMemory = creator.keepSpawnLoaded().toBooleanOrElse(internal.getWorld().getKeepSpawnInMemory()); // Paper + // Paper start
+ if (creator.keepSpawnLoaded().toBooleanOrElse(internal.getWorld().getKeepSpawnInMemory())) {
+ GameRules.IntegerValue rule = internal.getGameRules().getRule(GameRules.RULE_SPAWN_CHUNK_RADIUS);
+ rule.deserialize("0");
+ rule.onChanged(internal);
+ }
+ // Paper end
+
this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal); this.getServer().prepareLevels(internal.getChunkSource().chunkMap.progressListener, internal);
internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API internal.entityManager.tick(); // SPIGOT-6526: Load pending entities so they are available to the API