@@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -149,6 +149,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -150,6 +150,20 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.entity.monster.EntityDrowned;
|
||||
@@ -21,7 +21,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -166,7 +180,7 @@
|
||||
@@ -167,7 +181,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@@ -30,13 +30,13 @@
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -189,9 +203,29 @@
|
||||
@@ -190,9 +204,29 @@
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i);
|
||||
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ private int tickPosition;
|
||||
@@ -53,9 +53,9 @@
|
||||
+ }
|
||||
+
|
||||
+ // Add env and gen to constructor, WorldData -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, Holder<DimensionManager> holder, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
|
||||
+ super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, gen, biomeProvider, env);
|
||||
+ this.pvpMode = minecraftserver.isPvpAllowed();
|
||||
+ convertable = convertable_conversionsession;
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
|
||||
@@ -63,7 +63,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -203,7 +237,13 @@
|
||||
@@ -204,7 +238,13 @@
|
||||
this.tickTime = flag1;
|
||||
this.server = minecraftserver;
|
||||
this.customSpawners = list;
|
||||
@@ -75,10 +75,10 @@
|
||||
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
chunkgenerator.ensureStructuresGenerated();
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -234,14 +274,15 @@
|
||||
@@ -236,14 +276,15 @@
|
||||
long l = minecraftserver.getWorldData().worldGenSettings().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
@@ -96,7 +96,7 @@
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -273,12 +314,20 @@
|
||||
@@ -275,12 +316,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@@ -120,7 +120,7 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -304,7 +353,7 @@
|
||||
@@ -306,7 +355,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -320,7 +369,7 @@
|
||||
@@ -322,7 +371,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
@@ -138,7 +138,7 @@
|
||||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -392,7 +441,7 @@
|
||||
@@ -394,7 +443,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@@ -147,7 +147,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -419,14 +468,14 @@
|
||||
@@ -421,14 +470,14 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@@ -164,8 +164,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,12 +486,12 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
@@ -439,12 +488,12 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
- this.setBlockAndUpdate(blockposition1, Blocks.ICE.defaultBlockState());
|
||||
@@ -179,7 +179,7 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata = this.getBlockState(blockposition1);
|
||||
@@ -638,6 +687,7 @@
|
||||
@@ -640,6 +689,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -656,14 +706,47 @@
|
||||
@@ -658,14 +708,47 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
@@ -237,7 +237,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -698,6 +781,7 @@
|
||||
@@ -700,6 +783,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@@ -245,7 +245,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -721,6 +805,7 @@
|
||||
@@ -723,6 +807,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@@ -253,7 +253,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -745,6 +830,7 @@
|
||||
@@ -747,6 +832,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@@ -261,7 +261,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel"));
|
||||
}
|
||||
@@ -762,11 +848,19 @@
|
||||
@@ -764,11 +850,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -282,7 +282,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -812,15 +906,34 @@
|
||||
@@ -814,15 +908,34 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@@ -320,7 +320,7 @@
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -851,24 +964,36 @@
|
||||
@@ -853,24 +966,36 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@@ -361,7 +361,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -882,10 +1007,32 @@
|
||||
@@ -884,10 +1009,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -894,6 +1041,12 @@
|
||||
@@ -896,6 +1043,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@@ -407,7 +407,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -948,7 +1101,18 @@
|
||||
@@ -950,7 +1103,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -427,7 +427,7 @@
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -984,10 +1148,20 @@
|
||||
@@ -986,10 +1150,20 @@
|
||||
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
@@ -448,7 +448,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
@@ -1068,13 +1242,20 @@
|
||||
@@ -1070,13 +1244,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@@ -471,16 +471,16 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1125,7 +1306,7 @@
|
||||
@@ -1127,7 +1308,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
- return !this.server.getWorldData().worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag);
|
||||
+ return !this.serverLevelData.worldGenSettings().generateFeatures() ? null : this.getChunkSource().getGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1162,11 +1343,21 @@
|
||||
public BlockPosition findNearestMapFeature(TagKey<StructureFeature<?, ?>> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
- if (!this.server.getWorldData().worldGenSettings().generateFeatures()) {
|
||||
+ if (!this.serverLevelData.worldGenSettings().generateFeatures()) { // CraftBukkit
|
||||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<StructureFeature<?, ?>>> optional = this.registryAccess().registryOrThrow(IRegistry.CONFIGURED_STRUCTURE_FEATURE_REGISTRY).getTag(tagkey);
|
||||
@@ -1169,11 +1350,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
@@ -503,7 +503,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1478,6 +1669,11 @@
|
||||
@@ -1485,6 +1676,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@@ -515,7 +515,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1497,12 +1693,12 @@
|
||||
@@ -1504,12 +1700,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@@ -530,7 +530,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1530,7 +1726,7 @@
|
||||
@@ -1532,7 +1728,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@@ -539,7 +539,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1539,7 +1735,7 @@
|
||||
@@ -1541,7 +1737,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1550,17 +1746,33 @@
|
||||
@@ -1552,17 +1748,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
@@ -584,7 +584,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1666,6 +1878,7 @@
|
||||
@@ -1672,6 +1884,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1707,6 +1920,14 @@
|
||||
@@ -1713,6 +1926,14 @@
|
||||
gameeventlistenerregistrar.onListenerRemoved(entity.level);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user