geforkt von Mirrors/Paper
Improve multi-dimension code
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
820ad30036
Commit
3e7bd2643c
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -140,6 +140,36 @@
|
||||
@@ -140,6 +140,33 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -10,10 +10,9 @@
|
||||
+import net.minecraft.world.food.FoodMetaData;
|
||||
+import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
+import net.minecraft.world.level.block.BlockChest;
|
||||
+import net.minecraft.world.level.dimension.DimensionManager;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import net.minecraft.world.scores.Scoreboard;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.GameMode;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.WeatherType;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
@ -22,11 +21,9 @@
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftDimensionUtil;
|
||||
+import org.bukkit.event.inventory.InventoryType;
|
||||
+import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
+import org.bukkit.event.player.PlayerGameModeChangeEvent;
|
||||
+import org.bukkit.event.player.PlayerLocaleChangeEvent;
|
||||
+import org.bukkit.event.player.PlayerPortalEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
@ -37,7 +34,7 @@
|
||||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -194,6 +224,20 @@
|
||||
@@ -194,6 +221,20 @@
|
||||
public int latency;
|
||||
public boolean wonGame;
|
||||
|
||||
@ -58,7 +55,7 @@
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -256,12 +300,56 @@
|
||||
@@ -256,12 +297,56 @@
|
||||
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
|
||||
this.maxUpStep = 1.0F;
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
@ -116,7 +113,7 @@
|
||||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -319,11 +407,20 @@
|
||||
@@ -319,11 +404,20 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
@ -137,7 +134,7 @@
|
||||
if (nbttagcompound.contains("SpawnX", 99) && nbttagcompound.contains("SpawnY", 99) && nbttagcompound.contains("SpawnZ", 99)) {
|
||||
this.respawnPosition = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
|
||||
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
|
||||
@@ -356,7 +453,20 @@
|
||||
@@ -356,7 +450,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
@ -159,7 +156,7 @@
|
||||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -374,7 +484,7 @@
|
||||
@@ -374,7 +481,7 @@
|
||||
nbttagcompound.putInt("SpawnZ", this.respawnPosition.getZ());
|
||||
nbttagcompound.putBoolean("SpawnForced", this.respawnForced);
|
||||
nbttagcompound.putFloat("SpawnAngle", this.respawnAngle);
|
||||
@ -168,7 +165,7 @@
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -382,9 +492,33 @@
|
||||
@@ -382,9 +489,33 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
@ -202,7 +199,7 @@
|
||||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -443,6 +577,11 @@
|
||||
@@ -443,6 +574,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@ -214,7 +211,7 @@
|
||||
this.gameMode.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
if (this.invulnerableTime > 0) {
|
||||
@@ -498,7 +637,7 @@
|
||||
@@ -498,7 +634,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
@ -223,7 +220,7 @@
|
||||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -529,6 +668,12 @@
|
||||
@@ -529,6 +665,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
@ -236,7 +233,7 @@
|
||||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -543,6 +688,16 @@
|
||||
@@ -543,6 +685,16 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
@ -253,7 +250,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -585,7 +740,8 @@
|
||||
@@ -585,7 +737,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
@ -263,7 +260,7 @@
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -593,9 +749,47 @@
|
||||
@@ -593,9 +746,47 @@
|
||||
@Override
|
||||
public void die(DamageSource damagesource) {
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
@ -313,7 +310,7 @@
|
||||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), (future) -> {
|
||||
if (!future.isSuccess()) {
|
||||
@@ -629,12 +823,18 @@
|
||||
@@ -629,12 +820,18 @@
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
@ -336,7 +333,7 @@
|
||||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -671,10 +871,12 @@
|
||||
@@ -671,10 +868,12 @@
|
||||
String s = this.getScoreboardName();
|
||||
String s1 = entity.getScoreboardName();
|
||||
|
||||
@ -351,7 +348,7 @@
|
||||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -692,7 +894,8 @@
|
||||
@@ -692,7 +891,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
@ -361,7 +358,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -736,18 +939,20 @@
|
||||
@@ -736,18 +936,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
@ -377,7 +374,7 @@
|
||||
+ worldserver = (shapedetectorshape == null) ? worldserver : shapedetectorshape.world; // CraftBukkit
|
||||
|
||||
- if (shapedetectorshape != null && this.level.dimension() == World.OVERWORLD && worldserver.dimension() == World.END) {
|
||||
+ if (shapedetectorshape != null && this.level.getTypeKey() == DimensionManager.OVERWORLD_LOCATION && worldserver != null && worldserver.getTypeKey() == DimensionManager.END_LOCATION) { // CraftBukkit
|
||||
+ if (shapedetectorshape != null && this.level.getTypeKey() == WorldDimension.OVERWORLD && worldserver != null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
Vec3D vec3d = shapedetectorshape.pos.add(0.0D, -1.0D, 0.0D);
|
||||
|
||||
- return new ShapeDetectorShape(vec3d, Vec3D.ZERO, 90.0F, 0.0F);
|
||||
@ -385,7 +382,7 @@
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -756,11 +961,20 @@
|
||||
@@ -756,11 +958,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@ -401,15 +398,15 @@
|
||||
+ // this.isChangingDimension = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
WorldServer worldserver1 = this.getLevel();
|
||||
- ResourceKey<World> resourcekey = worldserver1.dimension();
|
||||
+ ResourceKey<DimensionManager> resourcekey = worldserver1.getTypeKey(); // CraftBukkit
|
||||
+ ResourceKey<WorldDimension> resourcekey = worldserver1.getTypeKey(); // CraftBukkit
|
||||
|
||||
- if (resourcekey == World.END && worldserver.dimension() == World.OVERWORLD) {
|
||||
+ if (resourcekey == DimensionManager.END_LOCATION && worldserver != null && worldserver.getTypeKey() == DimensionManager.OVERWORLD_LOCATION) { // CraftBukkit
|
||||
+ if (resourcekey == WorldDimension.END && worldserver != null && worldserver.getTypeKey() == WorldDimension.OVERWORLD) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Moved down from above
|
||||
this.unRide();
|
||||
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -771,6 +985,8 @@
|
||||
@@ -771,6 +982,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
@ -418,7 +415,7 @@
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionType(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true));
|
||||
@@ -780,22 +996,52 @@
|
||||
@@ -780,22 +993,52 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
@ -431,10 +428,10 @@
|
||||
- if (resourcekey == World.OVERWORLD && worldserver.dimension() == World.NETHER) {
|
||||
+ worldserver = shapedetectorshape.world; // CraftBukkit
|
||||
+ if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
|
||||
+ if (resourcekey == DimensionManager.OVERWORLD_LOCATION && worldserver.getTypeKey() == DimensionManager.NETHER_LOCATION) { // CraftBukkit
|
||||
+ if (resourcekey == WorldDimension.OVERWORLD && worldserver.getTypeKey() == WorldDimension.NETHER) { // CraftBukkit
|
||||
this.enteredNetherPosition = this.position();
|
||||
- } else if (worldserver.dimension() == World.END) {
|
||||
+ } else if (worldserver.getTypeKey() == DimensionManager.END_LOCATION && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
|
||||
+ } else if (worldserver.getTypeKey() == WorldDimension.END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
|
||||
this.createEndPlatform(worldserver, new BlockPosition(shapedetectorshape.pos));
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
@ -477,7 +474,7 @@
|
||||
worldserver1.getProfiler().pop();
|
||||
this.triggerDimensionChangeTriggers(worldserver1);
|
||||
this.connection.send(new PacketPlayOutAbilities(this.getAbilities()));
|
||||
@@ -813,12 +1059,31 @@
|
||||
@@ -813,12 +1056,31 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@ -509,7 +506,7 @@
|
||||
private void createEndPlatform(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
@@ -835,17 +1100,17 @@
|
||||
@@ -835,17 +1097,17 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -532,7 +529,7 @@
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -855,13 +1120,21 @@
|
||||
@@ -855,13 +1117,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level.dimension();
|
||||
@ -557,7 +554,7 @@
|
||||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -878,12 +1151,10 @@
|
||||
@@ -878,12 +1148,10 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
@ -573,7 +570,7 @@
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
} else if (!this.bedInRange(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
|
||||
@@ -907,7 +1178,36 @@
|
||||
@@ -907,7 +1175,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,7 +608,7 @@
|
||||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -920,9 +1220,8 @@
|
||||
@@ -920,9 +1217,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
@ -622,7 +619,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -949,6 +1248,24 @@
|
||||
@@ -949,6 +1245,24 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
@ -647,7 +644,7 @@
|
||||
if (this.isSleeping()) {
|
||||
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -1030,8 +1347,9 @@
|
||||
@@ -1030,8 +1344,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
|
||||
}
|
||||
|
||||
@ -658,7 +655,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1039,13 +1357,35 @@
|
||||
@@ -1039,13 +1354,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@ -694,7 +691,7 @@
|
||||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage((new ChatMessage("container.spectatorCantOpen")).withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1053,9 +1393,11 @@
|
||||
@@ -1053,9 +1390,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
@ -708,7 +705,7 @@
|
||||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1068,13 +1410,24 @@
|
||||
@@ -1068,13 +1407,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
@ -735,7 +732,7 @@
|
||||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1097,6 +1450,7 @@
|
||||
@@ -1097,6 +1447,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
@ -743,7 +740,7 @@
|
||||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1126,7 +1480,7 @@
|
||||
@@ -1126,7 +1477,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
@ -752,7 +749,7 @@
|
||||
scoreboardscore.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1134,7 +1488,7 @@
|
||||
@@ -1134,7 +1485,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
@ -761,7 +758,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1150,7 +1504,7 @@
|
||||
@@ -1150,7 +1501,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
@ -770,7 +767,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1185,8 +1539,17 @@
|
||||
@@ -1185,8 +1536,17 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
@ -788,7 +785,7 @@
|
||||
@Override
|
||||
public void displayClientMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.sendMessage(ichatbasecomponent, flag ? ChatMessageType.GAME_INFO : ChatMessageType.CHAT, SystemUtils.NIL_UUID);
|
||||
@@ -1240,7 +1603,7 @@
|
||||
@@ -1240,7 +1600,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
@ -797,7 +794,7 @@
|
||||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
||||
@@ -1367,7 +1730,20 @@
|
||||
@@ -1367,7 +1727,20 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
@ -818,7 +815,7 @@
|
||||
this.chatVisibility = packetplayinsettings.chatVisibility();
|
||||
this.canChatColor = packetplayinsettings.chatColors();
|
||||
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
|
||||
@@ -1438,7 +1814,7 @@
|
||||
@@ -1438,7 +1811,7 @@
|
||||
this.camera = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.camera) {
|
||||
this.connection.send(new PacketPlayOutCamera(this.camera));
|
||||
@ -827,7 +824,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1467,7 +1843,7 @@
|
||||
@@ -1467,7 +1840,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
@ -836,7 +833,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1488,9 +1864,16 @@
|
||||
@@ -1488,9 +1861,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
@ -853,7 +850,7 @@
|
||||
if (worldserver == this.level) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1510,6 +1893,9 @@
|
||||
@@ -1510,6 +1890,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
@ -863,7 +860,7 @@
|
||||
|
||||
}
|
||||
|
||||
@@ -1668,4 +2054,145 @@
|
||||
@@ -1668,4 +2051,145 @@
|
||||
public boolean allowsListing() {
|
||||
return this.allowsListing;
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
- return nbttagcompound == null ? null : this.upgradeChunkTag(this.level.dimension(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer());
|
||||
+ return nbttagcompound == null ? null : this.upgradeChunkTag(GeneratorSettings.levelToLevelStem(this.level.getTypeKey()), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), chunkcoordintpair, level); // CraftBukkit
|
||||
+ return nbttagcompound == null ? null : this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), chunkcoordintpair, level); // CraftBukkit
|
||||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
|
@ -1,11 +1,12 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -147,6 +147,19 @@
|
||||
@@ -147,6 +147,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.entity.monster.EntityDrowned;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.WeatherType;
|
||||
@ -20,7 +21,7 @@
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -164,7 +177,7 @@
|
||||
@@ -164,7 +178,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
@ -29,7 +30,7 @@
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -186,9 +199,24 @@
|
||||
@@ -186,9 +200,29 @@
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
|
||||
@ -46,6 +47,11 @@
|
||||
+ return this.chunkSource.getChunk(x, z, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ResourceKey<WorldDimension> getTypeKey() {
|
||||
+ return convertable.dimensionType;
|
||||
+ }
|
||||
+
|
||||
+ // 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) {
|
||||
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
@ -57,7 +63,7 @@
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -200,7 +228,13 @@
|
||||
@@ -200,7 +234,13 @@
|
||||
this.tickTime = flag1;
|
||||
this.server = minecraftserver;
|
||||
this.customSpawners = list;
|
||||
@ -72,7 +78,7 @@
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -231,14 +265,15 @@
|
||||
@@ -231,14 +271,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);
|
||||
@ -90,7 +96,7 @@
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -270,12 +305,20 @@
|
||||
@@ -270,12 +311,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
@ -114,7 +120,7 @@
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -301,7 +344,7 @@
|
||||
@@ -301,7 +350,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
@ -123,7 +129,7 @@
|
||||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -317,7 +360,7 @@
|
||||
@@ -317,7 +366,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
@ -132,7 +138,7 @@
|
||||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -389,7 +432,7 @@
|
||||
@@ -389,7 +438,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
@ -141,7 +147,7 @@
|
||||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -416,14 +459,14 @@
|
||||
@@ -416,14 +465,14 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
@ -158,7 +164,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,12 +477,12 @@
|
||||
@@ -434,12 +483,12 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
@ -173,7 +179,7 @@
|
||||
}
|
||||
|
||||
IBlockData iblockdata = this.getBlockState(blockposition1);
|
||||
@@ -635,6 +678,7 @@
|
||||
@@ -635,6 +684,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
@ -181,7 +187,7 @@
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -653,14 +697,47 @@
|
||||
@@ -653,14 +703,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));
|
||||
}
|
||||
@ -231,7 +237,7 @@
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -695,6 +772,7 @@
|
||||
@@ -695,6 +778,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
@ -239,7 +245,7 @@
|
||||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -718,6 +796,7 @@
|
||||
@@ -718,6 +802,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
@ -247,7 +253,7 @@
|
||||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -742,6 +821,7 @@
|
||||
@@ -742,6 +827,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
@ -255,7 +261,7 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(new ChatMessage("menu.savingLevel"));
|
||||
}
|
||||
@@ -759,11 +839,19 @@
|
||||
@@ -759,11 +845,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -276,7 +282,7 @@
|
||||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -809,15 +897,34 @@
|
||||
@@ -809,15 +903,34 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
@ -314,7 +320,7 @@
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -848,24 +955,36 @@
|
||||
@@ -848,24 +961,36 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
@ -355,7 +361,7 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -879,10 +998,32 @@
|
||||
@@ -879,10 +1004,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
@ -388,7 +394,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -891,6 +1032,12 @@
|
||||
@@ -891,6 +1038,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
@ -401,7 +407,7 @@
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -938,7 +1085,18 @@
|
||||
@@ -938,7 +1091,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -421,7 +427,7 @@
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (!navigationabstract.hasDelayedRecomputation()) {
|
||||
@@ -961,10 +1119,20 @@
|
||||
@@ -961,10 +1125,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) {
|
||||
@ -442,7 +448,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
@@ -1045,13 +1213,20 @@
|
||||
@@ -1045,13 +1219,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) {
|
||||
@ -465,7 +471,7 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1101,7 +1276,7 @@
|
||||
@@ -1101,7 +1282,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapFeature(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
@ -474,7 +480,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1138,11 +1313,21 @@
|
||||
@@ -1138,11 +1319,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
@ -497,7 +503,7 @@
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1454,6 +1639,11 @@
|
||||
@@ -1454,6 +1645,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
@ -509,7 +515,7 @@
|
||||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1473,12 +1663,12 @@
|
||||
@@ -1473,12 +1669,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
@ -524,7 +530,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1506,7 +1696,7 @@
|
||||
@@ -1506,7 +1702,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
@ -533,7 +539,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1515,7 +1705,7 @@
|
||||
@@ -1515,7 +1711,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
@ -542,7 +548,7 @@
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1526,17 +1716,33 @@
|
||||
@@ -1526,17 +1722,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
@ -578,7 +584,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1629,6 +1835,7 @@
|
||||
@@ -1629,6 +1841,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -586,7 +592,7 @@
|
||||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1661,6 +1868,7 @@
|
||||
@@ -1661,6 +1874,7 @@
|
||||
gameeventlistenerregistrar.onListenerRemoved(entity.level);
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -117,8 +117,58 @@
|
||||
@@ -117,8 +117,59 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.Server;
|
||||
@ -59,7 +60,7 @@
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -229,6 +279,22 @@
|
||||
@@ -229,6 +280,22 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
@ -82,7 +83,7 @@
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -366,6 +432,12 @@
|
||||
@@ -366,6 +433,12 @@
|
||||
public void onClientRemoval() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
@ -95,7 +96,7 @@
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -382,6 +454,33 @@
|
||||
@@ -382,6 +455,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
@ -129,7 +130,7 @@
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -423,6 +522,15 @@
|
||||
@@ -423,6 +523,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
@ -145,7 +146,7 @@
|
||||
public void baseTick() {
|
||||
this.level.getProfiler().push("entityBaseTick");
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
@@ -436,7 +544,7 @@
|
||||
@@ -436,7 +545,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
@ -154,7 +155,7 @@
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -514,7 +622,23 @@
|
||||
@@ -514,7 +623,23 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
@ -179,7 +180,7 @@
|
||||
if (this.hurt(DamageSource.LAVA, 4.0F)) {
|
||||
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
@@ -523,6 +647,22 @@
|
||||
@@ -523,6 +648,22 @@
|
||||
}
|
||||
|
||||
public void setSecondsOnFire(int i) {
|
||||
@ -202,7 +203,7 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -627,6 +767,28 @@
|
||||
@@ -627,6 +768,28 @@
|
||||
block.updateEntityAfterFallOn(this.level, this);
|
||||
}
|
||||
|
||||
@ -231,7 +232,7 @@
|
||||
if (this.onGround && !this.isSteppingCarefully()) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -846,7 +1008,7 @@
|
||||
@@ -846,7 +1009,7 @@
|
||||
boolean flag4 = flag && flag1 || flag && flag2 || flag1 && flag2;
|
||||
|
||||
if (flag4) {
|
||||
@ -240,7 +241,7 @@
|
||||
|
||||
return collideBoundingBox(vec3d, axisalignedbb, world, voxelshapecollision, (List) list1);
|
||||
} else {
|
||||
@@ -1306,6 +1468,7 @@
|
||||
@@ -1306,6 +1469,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
@ -248,7 +249,7 @@
|
||||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1496,6 +1659,12 @@
|
||||
@@ -1496,6 +1660,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -261,7 +262,7 @@
|
||||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1529,7 +1698,7 @@
|
||||
@@ -1529,7 +1699,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
@ -270,7 +271,7 @@
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1554,6 +1723,18 @@
|
||||
@@ -1554,6 +1724,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
@ -289,7 +290,7 @@
|
||||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1562,6 +1743,18 @@
|
||||
@@ -1562,6 +1744,18 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
@ -308,7 +309,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1629,6 +1822,11 @@
|
||||
@@ -1629,6 +1823,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,7 +321,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1710,6 +1908,49 @@
|
||||
@@ -1710,6 +1909,49 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@ -370,7 +371,7 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1785,9 +2026,22 @@
|
||||
@@ -1785,9 +2027,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
@ -393,7 +394,7 @@
|
||||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1882,7 +2136,7 @@
|
||||
@@ -1882,7 +2137,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
@ -402,7 +403,7 @@
|
||||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1913,7 +2167,7 @@
|
||||
@@ -1913,7 +2168,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@ -411,7 +412,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1922,10 +2176,31 @@
|
||||
@@ -1922,10 +2177,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
@ -444,7 +445,7 @@
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1941,12 +2216,32 @@
|
||||
@@ -1941,12 +2217,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -478,7 +479,7 @@
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1957,6 +2252,7 @@
|
||||
@@ -1957,6 +2253,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
@ -486,12 +487,12 @@
|
||||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2007,14 +2303,20 @@
|
||||
@@ -2007,14 +2304,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
- ResourceKey<World> resourcekey = this.level.dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.level.getTypeKey() == DimensionManager.NETHER_LOCATION ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
+ ResourceKey<World> resourcekey = this.level.getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
WorldServer worldserver1 = minecraftserver.getLevel(resourcekey);
|
||||
|
||||
- if (worldserver1 != null && minecraftserver.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
@ -510,7 +511,7 @@
|
||||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2132,6 +2434,13 @@
|
||||
@@ -2132,6 +2435,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@ -524,7 +525,7 @@
|
||||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2180,8 +2489,12 @@
|
||||
@@ -2180,8 +2490,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@ -538,7 +539,7 @@
|
||||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2208,7 +2521,17 @@
|
||||
@@ -2208,7 +2522,17 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
@ -557,7 +558,7 @@
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2235,11 +2558,41 @@
|
||||
@@ -2235,11 +2559,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
@ -601,7 +602,7 @@
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2393,15 +2746,32 @@
|
||||
@@ -2393,15 +2747,32 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
@ -636,13 +637,13 @@
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2410,9 +2780,17 @@
|
||||
@@ -2410,9 +2781,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
- if (worldserver.dimension() == World.END) {
|
||||
- WorldServer.makeObsidianPlatform(worldserver);
|
||||
+ if (worldserver.getTypeKey() == DimensionManager.END_LOCATION) { // CraftBukkit
|
||||
+ if (worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
@ -656,7 +657,7 @@
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2433,20 +2811,33 @@
|
||||
@@ -2433,20 +2812,33 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
@ -666,16 +667,16 @@
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ boolean flag = this.level.getTypeKey() == DimensionManager.END_LOCATION && worldserver.getTypeKey() == DimensionManager.OVERWORLD_LOCATION; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.END_LOCATION; // targetIsEnd
|
||||
+ boolean flag = this.level.getTypeKey() == WorldDimension.END && worldserver.getTypeKey() == WorldDimension.OVERWORLD; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == WorldDimension.END; // targetIsEnd
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!flag && !flag1) {
|
||||
- boolean flag2 = worldserver.dimension() == World.NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == DimensionManager.NETHER_LOCATION; // CraftBukkit
|
||||
+ boolean flag2 = worldserver.getTypeKey() == WorldDimension.NETHER; // CraftBukkit
|
||||
|
||||
- if (this.level.dimension() != World.NETHER && !flag2) {
|
||||
+ if (this.level.getTypeKey() != DimensionManager.NETHER_LOCATION && !flag2) {
|
||||
+ if (this.level.getTypeKey() != WorldDimension.NETHER && !flag2) { // CraftBukkit
|
||||
return null;
|
||||
} else {
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
@ -695,7 +696,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2463,8 +2854,8 @@
|
||||
@@ -2463,8 +2855,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
@ -706,7 +707,7 @@
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2474,8 +2865,15 @@
|
||||
@@ -2474,8 +2866,15 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
@ -723,7 +724,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2483,8 +2881,23 @@
|
||||
@@ -2483,8 +2882,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
@ -749,7 +750,7 @@
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2693,7 +3106,26 @@
|
||||
@@ -2693,7 +3107,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/level/World.java
|
||||
+++ b/net/minecraft/world/level/World.java
|
||||
@@ -67,6 +67,28 @@
|
||||
@@ -67,6 +67,29 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
+import net.minecraft.world.entity.item.EntityItem;
|
||||
+import net.minecraft.world.level.border.IWorldBorderListener;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
@ -29,13 +30,12 @@
|
||||
public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -104,7 +126,52 @@
|
||||
@@ -104,7 +127,46 @@
|
||||
private final ResourceKey<World> dimension;
|
||||
private long subTickCount;
|
||||
|
||||
- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i) {
|
||||
+ // CraftBukkit start Added the following
|
||||
+ private final ResourceKey<DimensionManager> typeKey;
|
||||
+ private final CraftWorld world;
|
||||
+ public boolean pvpMode;
|
||||
+ public boolean keepSpawnInMemory = true;
|
||||
@ -63,9 +63,7 @@
|
||||
+ return (CraftServer) Bukkit.getServer();
|
||||
+ }
|
||||
+
|
||||
+ public ResourceKey<DimensionManager> getTypeKey() {
|
||||
+ return typeKey;
|
||||
+ }
|
||||
+ public abstract ResourceKey<WorldDimension> getTypeKey();
|
||||
+
|
||||
+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env) {
|
||||
+ this.generator = gen;
|
||||
@ -76,14 +74,11 @@
|
||||
+ this.ticksPerWaterAmbientSpawns = this.getCraftServer().getTicksPerWaterAmbientSpawns(); // CraftBukkit
|
||||
+ this.ticksPerWaterUndergroundCreatureSpawns = this.getCraftServer().getTicksPerWaterUndergroundCreatureSpawns(); // CraftBukkit
|
||||
+ this.ticksPerAmbientSpawns = this.getCraftServer().getTicksPerAmbientSpawns(); // CraftBukkit
|
||||
+ this.typeKey = (ResourceKey) this.getCraftServer().getHandle().getServer().registryHolder.registryOrThrow(IRegistry.DIMENSION_TYPE_REGISTRY).getResourceKey(dimensionmanager).orElseThrow(() -> {
|
||||
+ return new IllegalStateException("Unregistered dimension type: " + dimensionmanager);
|
||||
+ });
|
||||
+ // CraftBukkit end
|
||||
this.profiler = supplier;
|
||||
this.levelData = worlddatamutable;
|
||||
this.dimensionType = dimensionmanager;
|
||||
@@ -114,12 +181,12 @@
|
||||
@@ -114,12 +176,12 @@
|
||||
this.worldBorder = new WorldBorder() {
|
||||
@Override
|
||||
public double getCenterX() {
|
||||
@ -98,7 +93,7 @@
|
||||
}
|
||||
};
|
||||
} else {
|
||||
@@ -129,6 +196,42 @@
|
||||
@@ -129,6 +191,42 @@
|
||||
this.thread = Thread.currentThread();
|
||||
this.biomeManager = new BiomeManager(this, i);
|
||||
this.isDebug = flag1;
|
||||
@ -141,7 +136,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,6 +289,17 @@
|
||||
@@ -186,6 +284,17 @@
|
||||
|
||||
@Override
|
||||
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
|
||||
@ -159,7 +154,7 @@
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return false;
|
||||
} else if (!this.isClientSide && this.isDebug()) {
|
||||
@@ -193,9 +307,24 @@
|
||||
@@ -193,9 +302,24 @@
|
||||
} else {
|
||||
Chunk chunk = this.getChunkAt(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
@ -185,7 +180,7 @@
|
||||
return false;
|
||||
} else {
|
||||
IBlockData iblockdata2 = this.getBlockState(blockposition);
|
||||
@@ -206,6 +335,7 @@
|
||||
@@ -206,6 +330,7 @@
|
||||
this.getProfiler().pop();
|
||||
}
|
||||
|
||||
@ -193,7 +188,7 @@
|
||||
if (iblockdata2 == iblockdata) {
|
||||
if (iblockdata1 != iblockdata2) {
|
||||
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
|
||||
@@ -232,12 +362,69 @@
|
||||
@@ -232,12 +357,69 @@
|
||||
|
||||
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
|
||||
}
|
||||
@ -263,7 +258,7 @@
|
||||
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
|
||||
|
||||
@Override
|
||||
@@ -327,6 +514,17 @@
|
||||
@@ -327,6 +509,17 @@
|
||||
IBlockData iblockdata = this.getBlockState(blockposition);
|
||||
|
||||
try {
|
||||
@ -281,7 +276,7 @@
|
||||
iblockdata.neighborChanged(this, blockposition, block, blockposition1, false);
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Exception while updating neighbours");
|
||||
@@ -369,6 +567,14 @@
|
||||
@@ -369,6 +562,14 @@
|
||||
|
||||
@Override
|
||||
public IBlockData getBlockState(BlockPosition blockposition) {
|
||||
@ -296,7 +291,7 @@
|
||||
if (this.isOutsideBuildHeight(blockposition)) {
|
||||
return Blocks.VOID_AIR.defaultBlockState();
|
||||
} else {
|
||||
@@ -494,6 +700,16 @@
|
||||
@@ -494,6 +695,16 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public TileEntity getBlockEntity(BlockPosition blockposition) {
|
||||
@ -313,7 +308,7 @@
|
||||
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
|
||||
}
|
||||
|
||||
@@ -501,6 +717,12 @@
|
||||
@@ -501,6 +712,12 @@
|
||||
BlockPosition blockposition = tileentity.getBlockPos();
|
||||
|
||||
if (!this.isOutsideBuildHeight(blockposition)) {
|
||||
@ -326,7 +321,7 @@
|
||||
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
|
||||
}
|
||||
}
|
||||
@@ -605,7 +827,7 @@
|
||||
@@ -605,7 +822,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EntityComplexPart entitycomplexpart = aentitycomplexpart[j];
|
||||
@ -335,7 +330,7 @@
|
||||
|
||||
if (t0 != null && predicate.test(t0)) {
|
||||
list.add(t0);
|
||||
@@ -931,6 +1153,14 @@
|
||||
@@ -931,6 +1148,14 @@
|
||||
public abstract LevelEntityGetter<Entity> getEntities();
|
||||
|
||||
protected void postGameEventInRadius(@Nullable Entity entity, GameEvent gameevent, BlockPosition blockposition, int i) {
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import net.minecraft.world.level.dimension.DimensionManager;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.event.entity.EntityPortalEnterEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
@ -19,7 +19,7 @@
|
||||
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
|
||||
if (world instanceof WorldServer && !entity.isPassenger() && !entity.isVehicle() && entity.canChangeDimensions() && VoxelShapes.joinIsNotEmpty(VoxelShapes.create(entity.getBoundingBox().move((double) (-blockposition.getX()), (double) (-blockposition.getY()), (double) (-blockposition.getZ()))), iblockdata.getShape(world, blockposition), OperatorBoolean.AND)) {
|
||||
- ResourceKey<World> resourcekey = world.dimension() == World.END ? World.OVERWORLD : World.END;
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == DimensionManager.END_LOCATION ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
+ ResourceKey<World> resourcekey = world.getTypeKey() == WorldDimension.END ? World.OVERWORLD : World.END; // CraftBukkit - SPIGOT-6152: send back to main overworld in custom ends
|
||||
WorldServer worldserver = ((WorldServer) world).getServer().getLevel(resourcekey);
|
||||
|
||||
if (worldserver == null) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
private static boolean inPortalDimension(World world) {
|
||||
- return world.dimension() == World.OVERWORLD || world.dimension() == World.NETHER;
|
||||
+ return world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.OVERWORLD_LOCATION || world.getTypeKey() == net.minecraft.world.level.dimension.DimensionManager.NETHER_LOCATION; // CraftBukkit - getTypeKey()
|
||||
+ return world.getTypeKey() == net.minecraft.world.level.dimension.WorldDimension.OVERWORLD || world.getTypeKey() == net.minecraft.world.level.dimension.WorldDimension.NETHER; // CraftBukkit - getTypeKey()
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -5,7 +5,7 @@
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.DimensionManager;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
@ -20,7 +20,7 @@
|
||||
BlockPosition blockposition1;
|
||||
|
||||
- if (tileentityendgateway.exitPortal == null && world.dimension() == World.END) {
|
||||
+ if (tileentityendgateway.exitPortal == null && world.getTypeKey() == DimensionManager.END_LOCATION) { // CraftBukkit - work in alternate worlds
|
||||
+ if (tileentityendgateway.exitPortal == null && world.getTypeKey() == WorldDimension.END) { // CraftBukkit - work in alternate worlds
|
||||
blockposition1 = findOrCreateValidTeleportPos(worldserver, blockposition);
|
||||
blockposition1 = blockposition1.above(10);
|
||||
TileEntityEndGateway.LOGGER.debug("Creating portal at {}", blockposition1);
|
||||
|
@ -34,15 +34,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +172,7 @@
|
||||
return ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
|
||||
}
|
||||
|
||||
- public static ResourceKey<WorldDimension> levelToLevelStem(ResourceKey<World> resourcekey) {
|
||||
+ public static ResourceKey<WorldDimension> levelToLevelStem(ResourceKey<DimensionManager> resourcekey) { // CraftBukkit
|
||||
return ResourceKey.create(IRegistry.LEVEL_STEM_REGISTRY, resourcekey.location());
|
||||
}
|
||||
|
||||
@@ -246,7 +251,7 @@
|
||||
switch (b0) {
|
||||
case 0:
|
||||
|
@ -2,7 +2,7 @@ package org.bukkit.craftbukkit.util;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.dimension.DimensionManager;
|
||||
import net.minecraft.world.level.dimension.WorldDimension;
|
||||
|
||||
public class CraftDimensionUtil {
|
||||
|
||||
@ -10,12 +10,12 @@ public class CraftDimensionUtil {
|
||||
}
|
||||
|
||||
public static ResourceKey<World> getMainDimensionKey(World world) {
|
||||
ResourceKey<DimensionManager> typeKey = world.getTypeKey();
|
||||
if (typeKey == DimensionManager.OVERWORLD_LOCATION) {
|
||||
ResourceKey<WorldDimension> typeKey = world.getTypeKey();
|
||||
if (typeKey == WorldDimension.OVERWORLD) {
|
||||
return World.OVERWORLD;
|
||||
} else if (typeKey == DimensionManager.NETHER_LOCATION) {
|
||||
} else if (typeKey == WorldDimension.NETHER) {
|
||||
return World.NETHER;
|
||||
} else if (typeKey == DimensionManager.END_LOCATION) {
|
||||
} else if (typeKey == WorldDimension.END) {
|
||||
return World.END;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren