mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-21 23:33:48 -07:00
some patches
This commit is contained in:
@@ -1,82 +0,0 @@
|
|||||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Aikar <aikar@aikar.co>
|
|
||||||
Date: Sun, 17 Apr 2016 17:27:09 -0400
|
|
||||||
Subject: [PATCH] Prevent Fire from loading chunks & wrongly spread
|
|
||||||
|
|
||||||
This causes the nether to spam unload/reload chunks, plus overall
|
|
||||||
bad behavior.
|
|
||||||
|
|
||||||
This also stops fire from spreading to illegal locations.
|
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/world/level/block/FireBlock.java b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
||||||
--- a/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
|
||||||
+++ b/src/main/java/net/minecraft/world/level/block/FireBlock.java
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
BooleanProperty blockstateboolean = (BooleanProperty) FireBlock.PROPERTY_BY_DIRECTION.get(enumdirection);
|
|
||||||
|
|
||||||
if (blockstateboolean != null) {
|
|
||||||
- iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getBlockState(pos.relative(enumdirection))));
|
|
||||||
+ iblockdata1 = (BlockState) iblockdata1.setValue(blockstateboolean, this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))); // Paper - prevent chunk loads
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
}
|
|
||||||
|
|
||||||
blockposition_mutableblockposition.setWithOffset((Vec3i) pos, l, j1, i1);
|
|
||||||
+ if (blockposition_mutableblockposition.isInvalidYLocation() || !world.hasChunkAt(blockposition_mutableblockposition)) continue; // Paper
|
|
||||||
int l1 = this.getFireOdds((LevelReader) world, (BlockPos) blockposition_mutableblockposition);
|
|
||||||
|
|
||||||
if (l1 > 0) {
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
}
|
|
||||||
|
|
||||||
private void trySpread(Level world, BlockPos blockposition, int i, Random random, int j, BlockPos sourceposition) { // CraftBukkit add sourceposition
|
|
||||||
- int k = this.getBurnOdd(world.getBlockState(blockposition));
|
|
||||||
+ // Paper start
|
|
||||||
+ final BlockState iblockdata = world.getTypeIfLoaded(blockposition);
|
|
||||||
+ if (iblockdata == null) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ int k = this.getBurnOdd(iblockdata);
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
if (random.nextInt(i) < k) {
|
|
||||||
- BlockState iblockdata = world.getBlockState(blockposition);
|
|
||||||
+ //IBlockData iblockdata = world.getType(blockposition); // Paper
|
|
||||||
|
|
||||||
// CraftBukkit start
|
|
||||||
org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
for (int j = 0; j < i; ++j) {
|
|
||||||
Direction enumdirection = aenumdirection[j];
|
|
||||||
|
|
||||||
- if (this.canBurn(world.getBlockState(pos.relative(enumdirection)))) {
|
|
||||||
+ if (this.canBurn(world.getTypeIfLoaded(pos.relative(enumdirection)))) { // Paper - prevent chunk loads
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
|
|
||||||
for (int k = 0; k < j; ++k) {
|
|
||||||
Direction enumdirection = aenumdirection[k];
|
|
||||||
- BlockState iblockdata = iworldreader.getBlockState(pos.relative(enumdirection));
|
|
||||||
+ // Paper start
|
|
||||||
+ BlockState iblockdata = iworldreader.getTypeIfLoaded(pos.relative(enumdirection));
|
|
||||||
+ if (iblockdata == null) {
|
|
||||||
+ continue;
|
|
||||||
+ }
|
|
||||||
+ // Paper end
|
|
||||||
|
|
||||||
i = Math.max(this.getFlameOdds(iblockdata), i);
|
|
||||||
}
|
|
||||||
@@ -0,0 +0,0 @@ public class FireBlock extends BaseFireBlock {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean canBurn(BlockState state) {
|
|
||||||
- return this.getFlameOdds(state) > 0;
|
|
||||||
+ return state != null && this.getFlameOdds(state) > 0; // Paper - iblockdata can be nullable if chunk is unloaded now
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
@@ -32,15 +32,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@Override
|
@Override
|
||||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||||
+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
|
+ if (!world.paperConfig.frostedIceEnabled) return; // Paper - add ability to disable frosted ice
|
||||||
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - (Integer) state.getValue(FrostedIceBlock.AGE) - state.getLightBlock((BlockGetter) world, pos) && this.slightlyMelt(state, (Level) world, pos)) {
|
if ((random.nextInt(3) == 0 || this.fewerNeigboursThan(world, pos, 4)) && world.getMaxLocalRawBrightness(pos) > 11 - state.getValue(AGE) - state.getLightBlock(world, pos) && this.slightlyMelt(state, world, pos)) {
|
||||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||||
Direction[] aenumdirection = Direction.values();
|
|
||||||
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
|
|
||||||
BlockState iblockdata1 = world.getBlockState(blockposition_mutableblockposition);
|
|
||||||
|
|
||||||
if (iblockdata1.is((Block) this) && !this.slightlyMelt(iblockdata1, (Level) world, blockposition_mutableblockposition)) {
|
@@ -0,0 +0,0 @@ public class FrostedIceBlock extends IceBlock {
|
||||||
- world.getBlockTicks().scheduleTick(blockposition_mutableblockposition, this, Mth.nextInt(random, 20, 40));
|
mutableBlockPos.setWithOffset(pos, direction);
|
||||||
+ world.getBlockTicks().scheduleTick(blockposition_mutableblockposition, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
|
BlockState blockState = world.getBlockState(mutableBlockPos);
|
||||||
|
if (blockState.is(this) && !this.slightlyMelt(blockState, world, mutableBlockPos)) {
|
||||||
|
- world.getBlockTicks().scheduleTick(mutableBlockPos, this, Mth.nextInt(random, 20, 40));
|
||||||
|
+ world.getBlockTicks().scheduleTick(mutableBlockPos, this, Mth.nextInt(random, world.paperConfig.frostedIceDelayMin, world.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@@ -9,15 +9,6 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketLis
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
|
||||||
// CraftBukkit end
|
|
||||||
private static final Component IGNORE_STATUS_REASON = new TextComponent("Ignoring status request");
|
|
||||||
private final MinecraftServer server;
|
|
||||||
- private final Connection connection;
|
|
||||||
+ private final Connection connection; final Connection getNetworkManager() { return this.connection; } // Paper - OBFHELPER
|
|
||||||
|
|
||||||
public ServerHandshakePacketListenerImpl(MinecraftServer server, Connection connection) {
|
|
||||||
this.server = server;
|
|
||||||
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
@@ -0,0 +0,0 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
|
||||||
this.connection.disconnect(chatmessage);
|
this.connection.disconnect(chatmessage);
|
||||||
} else {
|
} else {
|
||||||
@@ -27,22 +18,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ boolean handledByEvent = false;
|
+ boolean handledByEvent = false;
|
||||||
+ // Try and handle the handshake through the event
|
+ // Try and handle the handshake through the event
|
||||||
+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me?
|
+ if (com.destroystokyo.paper.event.player.PlayerHandshakeEvent.getHandlerList().getRegisteredListeners().length != 0) { // Hello? Can you hear me?
|
||||||
+ java.net.SocketAddress socketAddress = this.getNetworkManager().address;
|
+ java.net.SocketAddress socketAddress = this.connection.address;
|
||||||
+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress();
|
+ String hostnameOfRemote = socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getHostString() : InetAddress.getLoopbackAddress().getHostAddress();
|
||||||
+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName, hostnameOfRemote, !proxyLogicEnabled);
|
+ com.destroystokyo.paper.event.player.PlayerHandshakeEvent event = new com.destroystokyo.paper.event.player.PlayerHandshakeEvent(packet.hostName, hostnameOfRemote, !proxyLogicEnabled);
|
||||||
+ if (event.callEvent()) {
|
+ if (event.callEvent()) {
|
||||||
+ // If we've failed somehow, let the client know so and go no further.
|
+ // If we've failed somehow, let the client know so and go no further.
|
||||||
+ if (event.isFailed()) {
|
+ if (event.isFailed()) {
|
||||||
+ chatmessage = new TranslatableComponent(event.getFailMessage());
|
+ TranslatableComponent chatmessage = new TranslatableComponent(event.getFailMessage());
|
||||||
+ this.getNetworkManager().send(new ClientboundLoginDisconnectPacket(chatmessage));
|
+ this.connection.send(new ClientboundLoginDisconnectPacket(chatmessage));
|
||||||
+ this.getNetworkManager().disconnect(chatmessage);
|
+ this.connection.disconnect(chatmessage);
|
||||||
+ return;
|
+ return;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (event.getServerHostname() != null) packet.hostName = event.getServerHostname();
|
+ if (event.getServerHostname() != null) packet.hostName = event.getServerHostname();
|
||||||
+ if (event.getSocketAddressHostname() != null) this.getNetworkManager().address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
+ if (event.getSocketAddressHostname() != null) this.connection.address = new java.net.InetSocketAddress(event.getSocketAddressHostname(), socketAddress instanceof java.net.InetSocketAddress ? ((java.net.InetSocketAddress) socketAddress).getPort() : 0);
|
||||||
+ this.getNetworkManager().spoofedUUID = event.getUniqueId();
|
+ this.connection.spoofedUUID = event.getUniqueId();
|
||||||
+ this.getNetworkManager().spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
+ this.connection.spoofedProfile = gson.fromJson(event.getPropertiesJson(), com.mojang.authlib.properties.Property[].class);
|
||||||
+ handledByEvent = true; // Hooray, we did it!
|
+ handledByEvent = true; // Hooray, we did it!
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
@@ -53,5 +44,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
- if (org.spigotmc.SpigotConfig.bungee) {
|
- if (org.spigotmc.SpigotConfig.bungee) {
|
||||||
+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
+ //if (org.spigotmc.SpigotConfig.bungee) { // Paper - comment out, we check above!
|
||||||
String[] split = packet.hostName.split("\00");
|
String[] split = packet.hostName.split("\00");
|
||||||
if ( ( split.length == 3 || split.length == 4 ) && ( HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
if ( ( split.length == 3 || split.length == 4 ) && ( ServerHandshakePacketListenerImpl.HOST_PATTERN.matcher( split[1] ).matches() ) ) {
|
||||||
packet.hostName = split[0];
|
packet.hostName = split[0];
|
@@ -28,7 +28,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
buf.writeUtf(this.nametagVisibility);
|
buf.writeUtf(this.nametagVisibility);
|
||||||
- buf.writeUtf(this.collisionRule);
|
- buf.writeUtf(this.collisionRule);
|
||||||
+ buf.writeUtf(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.collisionRule); // Paper
|
+ buf.writeUtf(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.collisionRule); // Paper
|
||||||
buf.writeEnum((Enum) this.color);
|
buf.writeEnum(this.color);
|
||||||
buf.writeComponent(this.playerPrefix);
|
buf.writeComponent(this.playerPrefix);
|
||||||
buf.writeComponent(this.playerSuffix);
|
buf.writeComponent(this.playerSuffix);
|
||||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||||
@@ -39,24 +39,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.world.level.storage.loot.PredicateManager;
|
import net.minecraft.world.level.storage.loot.PredicateManager;
|
||||||
import net.minecraft.world.phys.Vec2;
|
import net.minecraft.world.phys.Vec2;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
+import net.minecraft.world.scores.PlayerTeam;
|
+import net.minecraft.world.scores.PlayerTeam; // Paper
|
||||||
import net.minecraft.world.scores.Scoreboard;
|
|
||||||
import net.minecraft.world.scores.ScoreboardSaveData;
|
|
||||||
import org.apache.commons.lang3.Validate;
|
import org.apache.commons.lang3.Validate;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||||
}
|
}
|
||||||
|
|
||||||
+ // Paper start - Handle collideRule team for player collision toggle
|
+ // Paper start - Handle collideRule team for player collision toggle
|
||||||
+ final Scoreboard scoreboard = this.getScoreboard();
|
+ final ServerScoreboard scoreboard = this.getScoreboard();
|
||||||
+ final java.util.Collection<String> toRemove = scoreboard.getTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(PlayerTeam::getName).collect(java.util.stream.Collectors.toList());
|
+ final java.util.Collection<String> toRemove = scoreboard.getPlayerTeams().stream().filter(team -> team.getName().startsWith("collideRule_")).map(PlayerTeam::getName).collect(java.util.stream.Collectors.toList());
|
||||||
+ for (String teamName : toRemove) {
|
+ for (String teamName : toRemove) {
|
||||||
+ scoreboard.removeTeam(scoreboard.getTeam(teamName)); // Clean up after ourselves
|
+ scoreboard.removePlayerTeam(scoreboard.getPlayersTeam(teamName)); // Clean up after ourselves
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
|
+ if (!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions) {
|
||||||
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16);
|
+ this.getPlayerList().collideRuleTeamName = org.apache.commons.lang3.StringUtils.left("collideRule_" + java.util.concurrent.ThreadLocalRandom.current().nextInt(), 16);
|
||||||
+ PlayerTeam collideTeam = scoreboard.createTeam(this.getPlayerList().collideRuleTeamName);
|
+ PlayerTeam collideTeam = scoreboard.addPlayerTeam(this.getPlayerList().collideRuleTeamName);
|
||||||
+ collideTeam.setSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
|
+ collideTeam.setSeeFriendlyInvisibles(false); // Because we want to mimic them not being on a team at all
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
@@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.scores.Objective;
|
import net.minecraft.world.scores.Objective;
|
||||||
import net.minecraft.world.scores.PlayerTeam;
|
import net.minecraft.world.scores.PlayerTeam;
|
||||||
+import net.minecraft.world.scores.Scoreboard;
|
+import net.minecraft.world.scores.Scoreboard; // Paper
|
||||||
import net.minecraft.world.scores.Team;
|
import net.minecraft.world.scores.Team;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -85,19 +85,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public PlayerList(MinecraftServer server, RegistryAccess.RegistryHolder registryManager, PlayerDataStorage saveHandler, int maxPlayers) {
|
public PlayerList(MinecraftServer server, RegistryAccess.RegistryHolder registryManager, PlayerDataStorage saveHandler, int maxPlayers) {
|
||||||
this.cserver = server.server = new CraftServer((DedicatedServer) server, this);
|
this.cserver = server.server = new CraftServer((DedicatedServer) server, this);
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
}
|
|
||||||
|
|
||||||
player.initMenu();
|
player.initInventoryMenu();
|
||||||
|
// CraftBukkit - Moved from above, added world
|
||||||
+ // Paper start - Add to collideRule team if needed
|
+ // Paper start - Add to collideRule team if needed
|
||||||
+ final Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
|
+ final Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
|
||||||
+ final PlayerTeam collideRuleTeam = scoreboard.getTeam(collideRuleTeamName);
|
+ final PlayerTeam collideRuleTeam = scoreboard.getPlayersTeam(this.collideRuleTeamName);
|
||||||
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && player.getTeam() == null) {
|
+ if (this.collideRuleTeamName != null && collideRuleTeam != null && player.getTeam() == null) {
|
||||||
+ scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
|
+ scoreboard.addPlayerToTeam(player.getScoreboardName(), collideRuleTeam);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
// CraftBukkit - Moved from above, added world
|
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.serverLevelData.getLevelName(), player.getX(), player.getY(), player.getZ());
|
||||||
PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", player.getName().getString(), s1, player.getId(), worldserver1.worldDataServer.getLevelName(), player.getX(), player.getY(), player.getZ());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
@@ -0,0 +0,0 @@ public abstract class PlayerList {
|
||||||
entityplayer.doTick(); // SPIGOT-924
|
entityplayer.doTick(); // SPIGOT-924
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
@@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - Remove from collideRule team if needed
|
+ // Paper start - Remove from collideRule team if needed
|
||||||
+ if (this.collideRuleTeamName != null) {
|
+ if (this.collideRuleTeamName != null) {
|
||||||
+ final Scoreboard scoreBoard = this.server.getLevel(Level.OVERWORLD).getScoreboard();
|
+ final Scoreboard scoreBoard = this.server.getLevel(Level.OVERWORLD).getScoreboard();
|
||||||
+ final PlayerTeam team = scoreBoard.getTeam(this.collideRuleTeamName);
|
+ final PlayerTeam team = scoreBoard.getPlayersTeam(this.collideRuleTeamName);
|
||||||
+ if (entityplayer.getTeam() == team && team != null) {
|
+ if (entityplayer.getTeam() == team && team != null) {
|
||||||
+ scoreBoard.removePlayerFromTeam(entityplayer.getScoreboardName(), team);
|
+ scoreBoard.removePlayerFromTeam(entityplayer.getScoreboardName(), team);
|
||||||
+ }
|
+ }
|
||||||
@@ -122,8 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ // Paper start - Remove collideRule team if it exists
|
+ // Paper start - Remove collideRule team if it exists
|
||||||
+ if (this.collideRuleTeamName != null) {
|
+ if (this.collideRuleTeamName != null) {
|
||||||
+ final Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
|
+ final Scoreboard scoreboard = this.getServer().getLevel(Level.OVERWORLD).getScoreboard();
|
||||||
+ final PlayerTeam team = scoreboard.getTeam(this.collideRuleTeamName);
|
+ final PlayerTeam team = scoreboard.getPlayersTeam(this.collideRuleTeamName);
|
||||||
+ if (team != null) scoreboard.removeTeam(team);
|
+ if (team != null) scoreboard.removePlayerTeam(team);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
@@ -10,38 +10,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||||
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
public final Settings<DedicatedServerProperties>.MutableValue<Boolean> whiteList;
|
@Nullable
|
||||||
public final WorldGenSettings worldGenSettings;
|
public WorldGenSettings worldGenSettings;
|
||||||
|
|
||||||
+ public final String rconIp; // Paper - Add rcon ip
|
+ public final String rconIp; // Paper - Add rcon ip
|
||||||
+
|
+
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public DedicatedServerProperties(Properties properties, RegistryAccess iregistrycustom, OptionSet optionset) {
|
public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
||||||
super(properties, optionset);
|
super(properties, optionset);
|
||||||
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
@@ -0,0 +0,0 @@ public class DedicatedServerProperties extends Settings<DedicatedServerPropertie
|
||||||
this.textFilteringConfig = this.get("text-filtering-config", "");
|
this.textFilteringConfig = this.get("text-filtering-config", "");
|
||||||
this.playerIdleTimeout = this.getMutable("player-idle-timeout", 0);
|
this.playerIdleTimeout = this.getMutable("player-idle-timeout", 0);
|
||||||
this.whiteList = this.getMutable("white-list", false);
|
this.whiteList = this.getMutable("white-list", false);
|
||||||
+ // Paper start - Configurable rcon ip
|
+ // Paper start - Configurable rcon ip
|
||||||
+ final String rconIp = this.getSettingIfExists("rcon.ip");
|
+ final String rconIp = this.getStringRaw("rcon.ip");
|
||||||
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
+ this.rconIp = rconIp == null ? this.serverIp : rconIp;
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
this.worldGenSettings = WorldGenSettings.create(iregistrycustom, properties);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CraftBukkit start
|
||||||
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
diff --git a/src/main/java/net/minecraft/server/dedicated/Settings.java b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java
|
--- a/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
+++ b/src/main/java/net/minecraft/server/dedicated/Settings.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class Settings<T extends Settings<T>> {
|
@@ -0,0 +0,0 @@ public abstract class Settings<T extends Settings<T>> {
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- @Nullable
|
@Nullable
|
||||||
- private String getStringRaw(String key) {
|
- private String getStringRaw(String key) {
|
||||||
+ @Nullable String getSettingIfExists(final String path) { return this.getStringRaw(path); } // Paper - OBFHELPER
|
+ public String getStringRaw(String key) { // Paper - private -> public
|
||||||
+ @Nullable private String getStringRaw(String key) { // Paper - OBFHELPER
|
return (String) this.getOverride(key, this.properties.getProperty(key)); // CraftBukkit
|
||||||
return (String) getOverride(key, this.properties.getProperty(key)); // CraftBukkit
|
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
|
diff --git a/src/main/java/net/minecraft/server/rcon/thread/RconThread.java b/src/main/java/net/minecraft/server/rcon/thread/RconThread.java
|
||||||
@@ -51,9 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@ public class RconThread extends GenericThread {
|
@@ -0,0 +0,0 @@ public class RconThread extends GenericThread {
|
||||||
@Nullable
|
@Nullable
|
||||||
public static RconThread create(ServerInterface server) {
|
public static RconThread create(ServerInterface server) {
|
||||||
DedicatedServerProperties dedicatedserverproperties = server.getProperties();
|
DedicatedServerProperties dedicatedServerProperties = server.getProperties();
|
||||||
- String s = server.getServerIp();
|
- String string = server.getServerIp();
|
||||||
+ String s = dedicatedserverproperties.rconIp; // Paper - Configurable rcon ip
|
+ String string = dedicatedServerProperties.rconIp; // Paper - Configurable rcon ip
|
||||||
|
if (string.isEmpty()) {
|
||||||
if (s.isEmpty()) {
|
string = "0.0.0.0";
|
||||||
s = "0.0.0.0";
|
}
|
@@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/ma
|
|||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,13 +17,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
public java.util.Locale adventure$locale = java.util.Locale.US; // Paper
|
||||||
public void updateOptions(ServerboundClientInformationPacket packet) {
|
public void updateOptions(ServerboundClientInformationPacket packet) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player implements ContainerListener {
|
@@ -0,0 +0,0 @@ public class ServerPlayer extends Player {
|
||||||
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(this.getBukkitEntity(), getMainArm() == HumanoidArm.LEFT ? MainHand.LEFT : MainHand.RIGHT);
|
||||||
this.server.server.getPluginManager().callEvent(event);
|
this.server.server.getPluginManager().callEvent(event);
|
||||||
}
|
}
|
||||||
- if (!this.locale.equals(packet.language)) {
|
- if (!this.locale.equals(packet.language)) {
|
||||||
+ if (this.locale == null || !this.locale.equals(packet.language)) { // Paper - check for null
|
+ if (this.locale == null || !this.locale.equals(packet.language)) { // Paper - check for null
|
||||||
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(getBukkitEntity(), packet.language);
|
PlayerLocaleChangeEvent event = new PlayerLocaleChangeEvent(this.getBukkitEntity(), packet.language);
|
||||||
this.server.server.getPluginManager().callEvent(event);
|
this.server.server.getPluginManager().callEvent(event);
|
||||||
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.locale, packet.language).callEvent(); // Paper
|
+ new com.destroystokyo.paper.event.player.PlayerLocaleChangeEvent(this.getBukkitEntity(), this.locale, packet.language).callEvent(); // Paper
|
||||||
}
|
}
|
||||||
@@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLocale() {
|
public String getLocale() {
|
||||||
- return getHandle().locale;
|
- return this.getHandle().locale;
|
||||||
-
|
-
|
||||||
+ // Paper start - Locale change event
|
+ // Paper start - Locale change event
|
||||||
+ final String locale = getHandle().locale;
|
+ final String locale = this.getHandle().locale;
|
||||||
+ return locale != null ? locale : "en_us";
|
+ return locale != null ? locale : "en_us";
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
}
|
}
|
@@ -32,7 +32,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.world.item.ItemCooldowns;
|
import net.minecraft.world.item.ItemCooldowns;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
+import net.minecraft.world.item.MapItem;
|
+import net.minecraft.world.item.MapItem; // Paper
|
||||||
import net.minecraft.world.item.ProjectileWeaponItem;
|
import net.minecraft.world.item.ProjectileWeaponItem;
|
||||||
import net.minecraft.world.item.SwordItem;
|
import net.minecraft.world.item.SwordItem;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
@@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
import net.minecraft.world.level.block.entity.StructureBlockEntity;
|
import net.minecraft.world.level.block.entity.StructureBlockEntity;
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
import net.minecraft.world.level.block.state.pattern.BlockInWorld;
|
||||||
+import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
|
+import net.minecraft.world.level.saveddata.maps.MapItemSavedData; // Paper
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraft.world.scores.PlayerTeam;
|
import net.minecraft.world.scores.PlayerTeam;
|
||||||
@@ -50,8 +50,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
+ // Paper start - remove player from map on drop
|
+ // Paper start - remove player from map on drop
|
||||||
+ if (stack.getItem() == Items.FILLED_MAP) {
|
+ if (stack.getItem() == Items.FILLED_MAP) {
|
||||||
+ MapItemSavedData worldmap = MapItem.getOrCreateSavedData(stack, this.level);
|
+ MapItemSavedData worldmap = MapItem.getSavedData(stack, this.level);
|
||||||
+ worldmap.updateSeenPlayers(this, stack);
|
+ worldmap.tickCarriedBy(this, stack);
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
@@ -62,44 +62,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
private final Map<String, MapBanner> bannerMarkers = Maps.newHashMap();
|
|
||||||
public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap();
|
public final Map<String, MapDecoration> decorations = Maps.newLinkedHashMap();
|
||||||
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
|
private final Map<String, MapFrame> frameMarkers = Maps.newHashMap();
|
||||||
|
private int trackedDecorationCount;
|
||||||
+ private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
|
+ private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper
|
||||||
|
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
public final CraftMapView mapView;
|
public final CraftMapView mapView;
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
mapView = new CraftMapView(this);
|
this.mapView = new CraftMapView(this);
|
||||||
server = (CraftServer) org.bukkit.Bukkit.getServer();
|
this.server = (CraftServer) org.bukkit.Bukkit.getServer();
|
||||||
+ vanillaRender.buffer = colors; // Paper
|
+ this.vanillaRender.buffer = colors; // Paper
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
|
if (abyte.length == 16384) {
|
||||||
this.addDecoration(mapiconbanner.getDecoration(), (LevelAccessor) null, mapiconbanner.getId(), (double) mapiconbanner.getPos().getX(), (double) mapiconbanner.getPos().getZ(), 180.0D, mapiconbanner.getName());
|
worldmap.colors = abyte;
|
||||||
}
|
}
|
||||||
+ this.vanillaRender.buffer = colors; // Paper
|
+ worldmap.vanillaRender.buffer = abyte; // Paper
|
||||||
|
|
||||||
ListTag nbttaglist1 = tag.getList("frames", 10);
|
ListTag nbttaglist = nbt.getList("banners", 10);
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
|
||||||
this.setDirty();
|
|
||||||
}
|
|
||||||
|
|
||||||
+ public void updateSeenPlayers(Player entityhuman, ItemStack itemstack) { this.tickCarriedBy(entityhuman, itemstack); } // Paper - OBFHELPER
|
|
||||||
public void tickCarriedBy(Player player, ItemStack stack) {
|
|
||||||
if (!this.carriedByPlayers.containsKey(player)) {
|
|
||||||
MapItemSavedData.HoldingPlayer worldmap_worldmaphumantracker = new MapItemSavedData.HoldingPlayer(player);
|
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
|
||||||
public class HoldingPlayer {
|
public class HoldingPlayer {
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start
|
||||||
+ private void addSeenPlayers(java.util.Collection<MapDecoration> icons) {
|
+ private void addSeenPlayers(java.util.Collection<MapDecoration> icons) {
|
||||||
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) player.getBukkitEntity();
|
+ org.bukkit.entity.Player player = (org.bukkit.entity.Player) this.player.getBukkitEntity();
|
||||||
+ MapItemSavedData.this.decorations.forEach((name, mapIcon) -> {
|
+ MapItemSavedData.this.decorations.forEach((name, mapIcon) -> {
|
||||||
+ // If this cursor is for a player check visibility with vanish system
|
+ // If this cursor is for a player check visibility with vanish system
|
||||||
+ org.bukkit.entity.Player other = org.bukkit.Bukkit.getPlayerExact(name); // Spigot
|
+ org.bukkit.entity.Player other = org.bukkit.Bukkit.getPlayerExact(name); // Spigot
|
||||||
@@ -117,18 +109,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
private int minDirtyX;
|
private int minDirtyX;
|
||||||
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
@Nullable
|
@Nullable
|
||||||
public Packet<?> nextUpdatePacket(ItemStack stack) {
|
Packet<?> nextUpdatePacket(int mapId) {
|
||||||
// CraftBukkit start
|
MapItemSavedData.MapPatch worldmap_b;
|
||||||
- org.bukkit.craftbukkit.map.RenderData render = MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()); // CraftBukkit
|
- org.bukkit.craftbukkit.map.RenderData render = MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()); // CraftBukkit
|
||||||
+ if (!this.dirtyData && this.tick % 5 != 0) { this.tick++; return null; } // Paper - this won't end up sending, so don't render it!
|
+ if (!this.dirtyData && this.tick % 5 != 0) { this.tick++; return null; } // Paper - this won't end up sending, so don't render it!
|
||||||
+ boolean vanillaMaps = shouldUseVanillaMap(); // Paper
|
+ boolean vanillaMaps = shouldUseVanillaMap(); // Paper
|
||||||
+ org.bukkit.craftbukkit.map.RenderData render = !vanillaMaps ? MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()) : MapItemSavedData.this.vanillaRender; // CraftBukkit // Paper
|
+ org.bukkit.craftbukkit.map.RenderData render = !vanillaMaps ? MapItemSavedData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()) : MapItemSavedData.this.vanillaRender; // CraftBukkit // Paper
|
||||||
|
|
||||||
|
if (this.dirtyData) {
|
||||||
|
this.dirtyData = false;
|
||||||
|
@@ -0,0 +0,0 @@ public class MapItemSavedData extends SavedData {
|
||||||
|
// CraftBukkit start
|
||||||
java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>();
|
java.util.Collection<MapDecoration> icons = new java.util.ArrayList<MapDecoration>();
|
||||||
|
|
||||||
+ if (vanillaMaps) addSeenPlayers(icons); // Paper
|
+ if (vanillaMaps) addSeenPlayers(icons); // Paper
|
||||||
|
+
|
||||||
for ( org.bukkit.map.MapCursor cursor : render.cursors) {
|
for (org.bukkit.map.MapCursor cursor : render.cursors) {
|
||||||
|
if (cursor.isVisible()) {
|
||||||
|
icons.add(new MapDecoration(MapDecoration.Type.byIcon(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection(), PaperAdventure.asVanilla(cursor.caption()))); // Paper - Adventure
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
--- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java
|
@@ -49,7 +49,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+package com.destroystokyo.paper.loottable;
|
+package com.destroystokyo.paper.loottable;
|
||||||
+
|
+
|
||||||
+import LootableInventory;
|
|
||||||
+import net.minecraft.core.BlockPos;
|
+import net.minecraft.core.BlockPos;
|
||||||
+import net.minecraft.world.level.Level;
|
+import net.minecraft.world.level.Level;
|
||||||
+import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
+import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
||||||
@@ -125,7 +124,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+package com.destroystokyo.paper.loottable;
|
+package com.destroystokyo.paper.loottable;
|
||||||
+
|
+
|
||||||
+import org.bukkit.loot.Lootable;
|
+import org.bukkit.loot.Lootable;
|
||||||
+import LootableInventory;
|
|
||||||
+import java.util.UUID;
|
+import java.util.UUID;
|
||||||
+import net.minecraft.world.level.Level;
|
+import net.minecraft.world.level.Level;
|
||||||
+
|
+
|
||||||
@@ -204,7 +202,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+import com.destroystokyo.paper.PaperWorldConfig;
|
+import com.destroystokyo.paper.PaperWorldConfig;
|
||||||
+import org.bukkit.entity.Player;
|
+import org.bukkit.entity.Player;
|
||||||
+import org.bukkit.loot.LootTable;
|
+import org.bukkit.loot.LootTable;
|
||||||
+
|
|
||||||
+import javax.annotation.Nullable;
|
+import javax.annotation.Nullable;
|
||||||
+import net.minecraft.nbt.CompoundTag;
|
+import net.minecraft.nbt.CompoundTag;
|
||||||
+import net.minecraft.nbt.ListTag;
|
+import net.minecraft.nbt.ListTag;
|
||||||
@@ -387,7 +384,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+package com.destroystokyo.paper.loottable;
|
+package com.destroystokyo.paper.loottable;
|
||||||
+
|
+
|
||||||
+import LootableInventory;
|
|
||||||
+import net.minecraft.world.entity.Entity;
|
+import net.minecraft.world.entity.Entity;
|
||||||
+import net.minecraft.world.entity.vehicle.AbstractMinecartContainer;
|
+import net.minecraft.world.entity.vehicle.AbstractMinecartContainer;
|
||||||
+import net.minecraft.world.level.Level;
|
+import net.minecraft.world.level.Level;
|
||||||
@@ -456,7 +452,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
@@ -0,0 +0,0 @@
|
@@ -0,0 +0,0 @@
|
||||||
+package com.destroystokyo.paper.loottable;
|
+package com.destroystokyo.paper.loottable;
|
||||||
+
|
+
|
||||||
+import LootableInventory;
|
|
||||||
+import net.minecraft.server.MCUtil;
|
+import net.minecraft.server.MCUtil;
|
||||||
+import net.minecraft.world.level.Level;
|
+import net.minecraft.world.level.Level;
|
||||||
+import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
+import net.minecraft.world.level.block.entity.RandomizableContainerBlockEntity;
|
||||||
@@ -524,7 +519,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, CommandSource, net.minecraft.s
|
@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
|
||||||
};
|
};
|
||||||
// Paper end
|
// Paper end
|
||||||
|
|
||||||
@@ -546,31 +541,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@Override
|
@Override
|
||||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
protected void addAdditionalSaveData(CompoundTag nbt) {
|
||||||
super.addAdditionalSaveData(tag);
|
super.addAdditionalSaveData(nbt);
|
||||||
+ this.lootableData.saveNbt(tag); // Paper
|
+ this.lootableData.saveNbt(nbt); // Paper
|
||||||
if (this.lootTable != null) {
|
if (this.lootTable != null) {
|
||||||
tag.putString("LootTable", this.lootTable.toString());
|
nbt.putString("LootTable", this.lootTable.toString());
|
||||||
if (this.lootTableSeed != 0L) {
|
if (this.lootTableSeed != 0L) {
|
||||||
tag.putLong("LootTableSeed", this.lootTableSeed);
|
nbt.putLong("LootTableSeed", this.lootTableSeed);
|
||||||
}
|
}
|
||||||
- } else {
|
- } else {
|
||||||
+ } if (true) { // Paper - Always save the items, Table may stick around
|
+ } if (true) { // Paper - Always save the items, Table may stick around
|
||||||
ContainerHelper.saveAllItems(tag, this.itemStacks);
|
ContainerHelper.saveAllItems(nbt, this.itemStacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@Override
|
@Override
|
||||||
protected void readAdditionalSaveData(CompoundTag tag) {
|
protected void readAdditionalSaveData(CompoundTag nbt) {
|
||||||
super.readAdditionalSaveData(tag);
|
super.readAdditionalSaveData(nbt);
|
||||||
+ this.lootableData.loadNbt(tag); // Paper
|
+ this.lootableData.loadNbt(nbt); // Paper
|
||||||
this.itemStacks = NonNullList.a(this.getContainerSize(), ItemStack.EMPTY);
|
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY);
|
||||||
if (tag.contains("LootTable", 8)) {
|
if (nbt.contains("LootTable", 8)) {
|
||||||
this.lootTable = new ResourceLocation(tag.getString("LootTable"));
|
this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||||
this.lootTableSeed = tag.getLong("LootTableSeed");
|
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||||
- } else {
|
- } else {
|
||||||
+ } if (true) { // Paper - always load the items, table may still remain
|
+ } if (true) { // Paper - always load the items, table may still remain
|
||||||
ContainerHelper.loadAllItems(tag, this.itemStacks);
|
ContainerHelper.loadAllItems(nbt, this.itemStacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
@@ -0,0 +0,0 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme
|
||||||
@@ -601,17 +596,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public long lootTableSeed;
|
public long lootTableSeed;
|
||||||
+ public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper
|
+ public final com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData = new com.destroystokyo.paper.loottable.PaperLootableInventoryData(new com.destroystokyo.paper.loottable.PaperTileEntityLootableInventory(this)); // Paper
|
||||||
|
|
||||||
protected RandomizableContainerBlockEntity(BlockEntityType<?> type) {
|
protected RandomizableContainerBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
||||||
super(type);
|
super(type, pos, state);
|
||||||
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean tryLoadLootTable(CompoundTag nbttagcompound) {
|
protected boolean tryLoadLootTable(CompoundTag nbt) {
|
||||||
+ this.lootableData.loadNbt(nbttagcompound); // Paper
|
+ this.lootableData.loadNbt(nbt); // Paper
|
||||||
if (nbttagcompound.contains("LootTable", 8)) {
|
if (nbt.contains("LootTable", 8)) {
|
||||||
this.lootTable = new ResourceLocation(nbttagcompound.getString("LootTable"));
|
this.lootTable = new ResourceLocation(nbt.getString("LootTable"));
|
||||||
+ try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate
|
+ try { org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(this.lootTable); } catch (IllegalArgumentException ex) { this.lootTable = null; } // Paper - validate
|
||||||
this.lootTableSeed = nbttagcompound.getLong("LootTableSeed");
|
this.lootTableSeed = nbt.getLong("LootTableSeed");
|
||||||
- return true;
|
- return true;
|
||||||
+ return false; // Paper - always load the items, table may still remain
|
+ return false; // Paper - always load the items, table may still remain
|
||||||
} else {
|
} else {
|
||||||
@@ -619,13 +614,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean trySaveLootTable(CompoundTag nbttagcompound) {
|
protected boolean trySaveLootTable(CompoundTag nbt) {
|
||||||
+ this.lootableData.saveNbt(nbttagcompound); // Paper
|
+ this.lootableData.saveNbt(nbt); // Paper
|
||||||
if (this.lootTable == null) {
|
if (this.lootTable == null) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
@@ -0,0 +0,0 @@ public abstract class RandomizableContainerBlockEntity extends BaseContainerBloc
|
||||||
nbttagcompound.putLong("LootTableSeed", this.lootTableSeed);
|
nbt.putLong("LootTableSeed", this.lootTableSeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
- return true;
|
- return true;
|
||||||
@@ -636,18 +631,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public void unpackLootTable(@Nullable Player player) {
|
public void unpackLootTable(@Nullable Player player) {
|
||||||
- if (this.lootTable != null && this.level.getServer() != null) {
|
- if (this.lootTable != null && this.level.getServer() != null) {
|
||||||
+ if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
|
+ if (this.lootableData.shouldReplenish(player) && this.level.getServer() != null) { // Paper
|
||||||
LootTable loottable = this.level.getServer().getLootTables().get(this.lootTable);
|
LootTable lootTable = this.level.getServer().getLootTables().get(this.lootTable);
|
||||||
|
|
||||||
if (player instanceof ServerPlayer) {
|
if (player instanceof ServerPlayer) {
|
||||||
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer) player, this.lootTable);
|
CriteriaTriggers.GENERATE_LOOT.trigger((ServerPlayer)player, this.lootTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
- this.lootTable = null;
|
- this.lootTable = null;
|
||||||
+ //this.lootTable = null; // Paper
|
+ //this.lootTable = null; // Paper
|
||||||
+ this.lootableData.processRefill(player); // Paper
|
+ this.lootableData.processRefill(player); // Paper
|
||||||
LootContext.Builder loottableinfo_builder = (new LootContext.Builder((ServerLevel) this.level)).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf((Vec3i) this.worldPosition)).withOptionalRandomSeed(this.lootTableSeed);
|
LootContext.Builder builder = (new LootContext.Builder((ServerLevel)this.level)).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(this.worldPosition)).withOptionalRandomSeed(this.lootTableSeed);
|
||||||
|
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
|
builder.withLuck(player.getLuck()).withParameter(LootContextParams.THIS_ENTITY, player);
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java
|
||||||
@@ -658,7 +652,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
// gets the wrapped TileEntity
|
// gets the wrapped TileEntity
|
||||||
- protected T getTileEntity() {
|
- protected T getTileEntity() {
|
||||||
+ public T getTileEntity() { // Paper - protected -> public
|
+ public T getTileEntity() { // Paper - protected -> public
|
||||||
return tileEntity;
|
return this.tileEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java
|
||||||
@@ -690,7 +684,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
public CraftLootable(Block block, Class<T> tileEntityClass) {
|
public CraftLootable(Block block, Class<T> tileEntityClass) {
|
||||||
super(block, tileEntityClass);
|
super(block, tileEntityClass);
|
||||||
@@ -0,0 +0,0 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
@@ -0,0 +0,0 @@ public abstract class CraftLootable<T extends RandomizableContainerBlockEntity>
|
||||||
setLootTable(getLootTable(), seed);
|
this.setLootTable(this.getLootTable(), seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
- private void setLootTable(LootTable table, long seed) {
|
- private void setLootTable(LootTable table, long seed) {
|
||||||
@@ -716,13 +710,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java
|
||||||
@@ -0,0 +0,0 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
@@ -0,0 +0,0 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo
|
||||||
return getHandle().lootTableSeed;
|
return this.getHandle().lootTableSeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
- private void setLootTable(LootTable table, long seed) {
|
- private void setLootTable(LootTable table, long seed) {
|
||||||
+ public void setLootTable(LootTable table, long seed) { // Paper
|
+ @Override public void setLootTable(LootTable table, long seed) { // Paper
|
||||||
ResourceLocation newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
ResourceLocation newKey = (table == null) ? null : CraftNamespacedKey.toMinecraft(table.getKey());
|
||||||
getHandle().setLootTable(newKey, seed);
|
this.getHandle().setLootTable(newKey, seed);
|
||||||
}
|
}
|
||||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
@@ -15,16 +15,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
|
|
||||||
+ private static MinecraftServer SERVER; // Paper
|
+ private static MinecraftServer SERVER; // Paper
|
||||||
public static final Logger LOGGER = LogManager.getLogger();
|
public static final Logger LOGGER = LogManager.getLogger();
|
||||||
public static final File USERID_CACHE_FILE = new File("usercache.json");
|
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
|
||||||
public static final LevelSettings DEMO_SETTINGS = new LevelSettings("Demo World", GameType.SURVIVAL, false, Difficulty.NORMAL, false, new GameRules(), DataPackConfig.DEFAULT);
|
private static final int TICK_STATS_SPAN = 100;
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, Thread thread, RegistryAccess.RegistryHolder iregistrycustom_dimension, LevelStorageSource.LevelStorageAccess convertable_conversionsession, WorldData savedata, PackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, ServerResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) {
|
public MinecraftServer(OptionSet options, DataPackConfig datapackconfiguration, Thread thread, RegistryAccess.RegistryHolder iregistrycustom_dimension, LevelStorageSource.LevelStorageAccess convertable_conversionsession, WorldData savedata, PackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, ServerResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable GameProfileCache usercache, ChunkProgressListenerFactory worldloadlistenerfactory) {
|
||||||
super("Server");
|
super("Server");
|
||||||
+ SERVER = this; // Paper - better singleton
|
+ SERVER = this; // Paper - better singleton
|
||||||
this.continousProfiler = new ContinuousProfiler(Util.timeSource, this::getTickCount);
|
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||||
this.profiler = InactiveProfiler.INSTANCE;
|
this.profiler = this.metricsRecorder.getProfiler();
|
||||||
this.status = new ServerStatus();
|
this.onMetricsRecordingStopped = (methodprofilerresults) -> {
|
||||||
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
Reference in New Issue
Block a user