geforkt von Mirrors/Paper
Update to Minecraft 1.17
By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
Ursprung
75faba7fde
Commit
b3a8254758
@ -1,10 +1,10 @@
|
||||
--- a/net/minecraft/CrashReport.java
|
||||
+++ b/net/minecraft/CrashReport.java
|
||||
@@ -68,6 +68,7 @@
|
||||
|
||||
return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" ")));
|
||||
});
|
||||
+ this.d.a("CraftBukkit Information", (CrashReportCallable) new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
||||
@@ -31,6 +31,7 @@
|
||||
public CrashReport(String s, Throwable throwable) {
|
||||
this.title = s;
|
||||
this.exception = throwable;
|
||||
+ this.systemReport.a("CraftBukkit Information", new org.bukkit.craftbukkit.CraftCrashReport()); // CraftBukkit
|
||||
}
|
||||
|
||||
public String a() {
|
||||
|
@ -7,8 +7,8 @@
|
||||
+ public final org.bukkit.advancement.Advancement bukkit = new org.bukkit.craftbukkit.advancement.CraftAdvancement(this); // CraftBukkit
|
||||
|
||||
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring) {
|
||||
this.key = minecraftkey;
|
||||
@@ -222,7 +223,7 @@
|
||||
this.id = minecraftkey;
|
||||
@@ -233,7 +234,7 @@
|
||||
}
|
||||
|
||||
public Advancement b(MinecraftKey minecraftkey) {
|
||||
|
@ -1,6 +1,15 @@
|
||||
--- a/net/minecraft/advancements/Advancements.java
|
||||
+++ b/net/minecraft/advancements/Advancements.java
|
||||
@@ -73,7 +73,7 @@
|
||||
@@ -79,7 +79,7 @@
|
||||
entry = (Entry) iterator.next();
|
||||
MinecraftKey minecraftkey = (MinecraftKey) entry.getKey();
|
||||
Advancement.SerializedAdvancement advancement_serializedadvancement = (Advancement.SerializedAdvancement) entry.getValue();
|
||||
- Map map1 = this.advancements;
|
||||
+ Map<MinecraftKey, Advancement> map1 = this.advancements; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(this.advancements);
|
||||
if (advancement_serializedadvancement.a(map1::get)) {
|
||||
@@ -116,7 +116,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,4 +17,4 @@
|
||||
+ // Advancements.LOGGER.info("Loaded {} advancements", this.advancements.size()); // CraftBukkit - moved to AdvancementDataWorld#reload
|
||||
}
|
||||
|
||||
public Iterable<Advancement> b() {
|
||||
public void a() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -102,12 +102,21 @@
|
||||
@@ -103,6 +103,14 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -15,27 +15,28 @@
|
||||
public class CommandDispatcher {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> b = new com.mojang.brigadier.CommandDispatcher();
|
||||
@@ -114,6 +122,7 @@
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype) {
|
||||
+ this(); // CraftBukkit
|
||||
CommandAdvancement.a(this.b);
|
||||
CommandAttribute.a(this.b);
|
||||
CommandExecute.a(this.b);
|
||||
@@ -188,17 +197,61 @@
|
||||
CommandAdvancement.a(this.dispatcher);
|
||||
CommandAttribute.a(this.dispatcher);
|
||||
CommandExecute.a(this.dispatcher);
|
||||
@@ -195,17 +204,61 @@
|
||||
}
|
||||
|
||||
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection);
|
||||
this.dispatcher.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
|
||||
- CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.dispatcher.getPath(commandnode1), this.dispatcher.getPath(commandnode2), collection);
|
||||
+ // CommandDispatcher.LOGGER.warn("Ambiguity between arguments {} and {} with inputs: {}", this.b.getPath(commandnode1), this.b.getPath(commandnode2), collection); // CraftBukkit
|
||||
});
|
||||
- this.b.setConsumer((commandcontext, flag, i) -> {
|
||||
- this.dispatcher.setConsumer((commandcontext, flag, i) -> {
|
||||
- ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag, i);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public CommandDispatcher() {
|
||||
+ this.b.setConsumer((commandcontext, flag1, i) -> {
|
||||
+ this.dispatcher.setConsumer((commandcontext, flag1, i) -> {
|
||||
+ ((CommandListenerWrapper) commandcontext.getSource()).a(commandcontext, flag1, i);
|
||||
});
|
||||
}
|
||||
@ -88,7 +89,7 @@
|
||||
stringreader.skip();
|
||||
}
|
||||
|
||||
@@ -222,7 +275,7 @@
|
||||
@@ -229,7 +282,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = (new ChatComponentText("")).a(EnumChatFormat.GRAY).format((chatmodifier) -> {
|
||||
@ -97,7 +98,7 @@
|
||||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -272,11 +325,36 @@
|
||||
@@ -279,11 +332,36 @@
|
||||
}
|
||||
|
||||
public void a(EntityPlayer entityplayer) {
|
||||
@ -114,8 +115,8 @@
|
||||
+ // Now build the global commands in a second pass
|
||||
RootCommandNode<ICompletionProvider> rootcommandnode = new RootCommandNode();
|
||||
|
||||
map.put(this.b.getRoot(), rootcommandnode);
|
||||
this.a(this.b.getRoot(), rootcommandnode, entityplayer.getCommandListener(), (Map) map);
|
||||
map.put(this.dispatcher.getRoot(), rootcommandnode);
|
||||
this.a(this.dispatcher.getRoot(), rootcommandnode, entityplayer.getCommandListener(), (Map) map);
|
||||
+
|
||||
+ Collection<String> bukkit = new LinkedHashSet<>();
|
||||
+ for (CommandNode node : rootcommandnode.getChildren()) {
|
||||
@ -132,10 +133,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -287,7 +365,7 @@
|
||||
@@ -294,7 +372,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
@ -144,7 +145,7 @@
|
||||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -310,7 +388,7 @@
|
||||
@@ -317,7 +395,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
@ -8,16 +8,16 @@
|
||||
+
|
||||
public class CommandListenerWrapper implements ICompletionProvider {
|
||||
|
||||
public static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player"));
|
||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player"));
|
||||
@@ -53,6 +55,7 @@
|
||||
private final ResultConsumer<CommandListenerWrapper> l;
|
||||
private final ArgumentAnchor.Anchor m;
|
||||
private final Vec2F n;
|
||||
private final ResultConsumer<CommandListenerWrapper> consumer;
|
||||
private final ArgumentAnchor.Anchor anchor;
|
||||
private final Vec2F rotation;
|
||||
+ public volatile CommandNode currentCommand; // CraftBukkit
|
||||
|
||||
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
||||
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -149,9 +152,23 @@
|
||||
@@ -153,9 +156,23 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int i) {
|
||||
@ -28,36 +28,36 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
return this.f >= i;
|
||||
return this.permissionLevel >= i;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean hasPermission(int i, String bukkitPermission) {
|
||||
+ // World is null when loading functions
|
||||
+ return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.f >= i) || getBukkitSender().hasPermission(bukkitPermission);
|
||||
+ return ((getWorld() == null || !getWorld().getServer().ignoreVanillaPermissions) && this.permissionLevel >= i) || getBukkitSender().hasPermission(bukkitPermission);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public Vec3D getPosition() {
|
||||
return this.d;
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -213,7 +230,7 @@
|
||||
@@ -217,7 +234,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer != this.base && this.i.getPlayerList().isOp(entityplayer.getProfile())) {
|
||||
+ if (entityplayer != this.base && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
||||
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b);
|
||||
- if (entityplayer != this.source && this.server.getPlayerList().isOp(entityplayer.getProfile())) {
|
||||
+ if (entityplayer != this.source && entityplayer.getBukkitEntity().hasPermission("minecraft.admin.command_feedback")) { // CraftBukkit
|
||||
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.NIL_UUID);
|
||||
}
|
||||
}
|
||||
@@ -273,4 +290,10 @@
|
||||
@@ -277,4 +294,10 @@
|
||||
public IRegistryCustom q() {
|
||||
return this.i.getCustomRegistry();
|
||||
return this.server.getCustomRegistry();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public org.bukkit.command.CommandSender getBukkitSender() {
|
||||
+ return base.getBukkitSender(this);
|
||||
+ return source.getBukkitSender(this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -14,10 +14,10 @@
|
||||
};
|
||||
|
||||
void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid);
|
||||
@@ -32,4 +39,6 @@
|
||||
boolean shouldSendFailure();
|
||||
|
||||
boolean shouldBroadcastCommands();
|
||||
@@ -36,4 +43,6 @@
|
||||
default boolean c_() {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ org.bukkit.command.CommandSender getBukkitSender(CommandListenerWrapper wrapper); // CraftBukkit
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/commands/arguments/ArgumentEntity.java
|
||||
+++ b/net/minecraft/commands/arguments/ArgumentEntity.java
|
||||
@@ -93,9 +93,15 @@
|
||||
@@ -95,9 +95,15 @@
|
||||
}
|
||||
|
||||
public EntitySelector parse(StringReader stringreader) throws CommandSyntaxException {
|
||||
@ -15,5 +15,5 @@
|
||||
- EntitySelector entityselector = argumentparserselector.parse();
|
||||
+ EntitySelector entityselector = argumentparserselector.parse(overridePermissions); // CraftBukkit
|
||||
|
||||
if (entityselector.a() > 1 && this.h) {
|
||||
if (this.i) {
|
||||
if (entityselector.a() > 1 && this.single) {
|
||||
if (this.playersOnly) {
|
||||
|
@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
+++ b/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
@@ -55,7 +55,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
};
|
||||
private final StringReader i;
|
||||
private final boolean j;
|
||||
- private final Map<IBlockState<?>, Comparable<?>> k = Maps.newHashMap();
|
||||
+ private final Map<IBlockState<?>, Comparable<?>> k = Maps.newLinkedHashMap(); // CraftBukkit - stable
|
||||
private final Map<String, String> l = Maps.newHashMap();
|
||||
private MinecraftKey m = new MinecraftKey("");
|
||||
private BlockStateList<Block, IBlockData> n;
|
||||
@@ -231,7 +231,7 @@
|
||||
private final StringReader reader;
|
||||
private final boolean forTesting;
|
||||
- private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newHashMap();
|
||||
+ private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newLinkedHashMap(); // CraftBukkit - stable
|
||||
private final Map<String, String> vagueProperties = Maps.newHashMap();
|
||||
private MinecraftKey id = new MinecraftKey("");
|
||||
private BlockStateList<Block, IBlockData> definition;
|
||||
@@ -237,7 +237,7 @@
|
||||
Iterator iterator = iblockstate.getValues().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@ -18,16 +18,16 @@
|
||||
|
||||
if (t0 instanceof Integer) {
|
||||
suggestionsbuilder.suggest((Integer) t0);
|
||||
@@ -500,7 +500,7 @@
|
||||
@@ -506,7 +506,7 @@
|
||||
Optional<T> optional = iblockstate.b(s);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
- this.o = (IBlockData) this.o.set(iblockstate, (Comparable) optional.get());
|
||||
+ this.o = (IBlockData) this.o.set(iblockstate, (T) optional.get()); // CraftBukkit - decompile error
|
||||
this.k.put(iblockstate, optional.get());
|
||||
- this.state = (IBlockData) this.state.set(iblockstate, (Comparable) optional.get());
|
||||
+ this.state = (IBlockData) this.state.set(iblockstate, (T) optional.get()); // CraftBukkit - decompile error
|
||||
this.properties.put(iblockstate, (Comparable) optional.get());
|
||||
} else {
|
||||
this.i.setCursor(i);
|
||||
@@ -534,7 +534,7 @@
|
||||
this.reader.setCursor(i);
|
||||
@@ -540,7 +540,7 @@
|
||||
private static <T extends Comparable<T>> void a(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
|
||||
stringbuilder.append(iblockstate.getName());
|
||||
stringbuilder.append('=');
|
||||
|
@ -1,28 +1,28 @@
|
||||
--- a/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
|
||||
@@ -137,7 +137,7 @@
|
||||
axisalignedbb = this.a(this.v == null ? 0.0D : this.v, this.w == null ? 0.0D : this.w, this.x == null ? 0.0D : this.x);
|
||||
@@ -149,7 +149,7 @@
|
||||
axisalignedbb = this.a(this.deltaX == null ? 0.0D : this.deltaX, this.deltaY == null ? 0.0D : this.deltaY, this.deltaZ == null ? 0.0D : this.deltaZ);
|
||||
}
|
||||
|
||||
- Function function;
|
||||
+ Function<Vec3D, Vec3D> function; // CraftBukkit - decompile error
|
||||
|
||||
if (this.s == null && this.t == null && this.u == null) {
|
||||
if (this.x == null && this.y == null && this.z == null) {
|
||||
function = (vec3d) -> {
|
||||
@@ -198,8 +198,10 @@
|
||||
@@ -206,8 +206,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
- protected void parseSelector() throws CommandSyntaxException {
|
||||
- this.checkPermissions = true;
|
||||
- this.usesSelectors = true;
|
||||
+ // CraftBukkit start
|
||||
+ protected void parseSelector(boolean overridePermissions) throws CommandSyntaxException {
|
||||
+ this.checkPermissions = !overridePermissions;
|
||||
+ this.usesSelectors = !overridePermissions;
|
||||
+ // CraftBukkit end
|
||||
this.G = this::d;
|
||||
if (!this.l.canRead()) {
|
||||
throw ArgumentParserSelector.d.createWithContext(this.l);
|
||||
@@ -453,6 +455,12 @@
|
||||
this.suggestions = this::d;
|
||||
if (!this.reader.canRead()) {
|
||||
throw ArgumentParserSelector.ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
|
||||
@@ -465,6 +467,12 @@
|
||||
}
|
||||
|
||||
public EntitySelector parse() throws CommandSyntaxException {
|
||||
@ -32,13 +32,13 @@
|
||||
+
|
||||
+ public EntitySelector parse(boolean overridePermissions) throws CommandSyntaxException {
|
||||
+ // CraftBukkit end
|
||||
this.E = this.l.getCursor();
|
||||
this.G = this::b;
|
||||
if (this.l.canRead() && this.l.peek() == '@') {
|
||||
@@ -461,7 +469,7 @@
|
||||
this.startPosition = this.reader.getCursor();
|
||||
this.suggestions = this::b;
|
||||
if (this.reader.canRead() && this.reader.peek() == '@') {
|
||||
@@ -473,7 +481,7 @@
|
||||
}
|
||||
|
||||
this.l.skip();
|
||||
this.reader.skip();
|
||||
- this.parseSelector();
|
||||
+ this.parseSelector(overridePermissions); // CraftBukkit
|
||||
} else {
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -75,7 +75,7 @@
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
private void e(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
|
||||
- if (this.checkPermissions && !commandlistenerwrapper.hasPermission(2)) {
|
||||
+ if (this.checkPermissions && !commandlistenerwrapper.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit
|
||||
throw ArgumentEntity.f.create();
|
||||
- if (this.usesSelector && !commandlistenerwrapper.hasPermission(2)) {
|
||||
+ if (this.usesSelector && !commandlistenerwrapper.hasPermission(2, "minecraft.command.selector")) { // CraftBukkit
|
||||
throw ArgumentEntity.ERROR_SELECTORS_NOT_ALLOWED.create();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,173 @@
|
||||
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
@@ -30,6 +30,10 @@
|
||||
import net.minecraft.world.level.block.state.properties.IBlockState;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.block.CauldronLevelChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public interface CauldronInteraction {
|
||||
|
||||
Map<Item, CauldronInteraction> EMPTY = a();
|
||||
@@ -52,6 +56,11 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
@@ -60,7 +69,7 @@
|
||||
|
||||
entityhuman.a(enumhand, itemstack1);
|
||||
entityhuman.a(StatisticList.CLEAN_SHULKER_BOX);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -71,6 +80,11 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
|
||||
itemstack1.setCount(1);
|
||||
@@ -88,7 +102,7 @@
|
||||
}
|
||||
|
||||
entityhuman.a(StatisticList.CLEAN_BANNER);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -106,9 +120,14 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
idyeable.e_(itemstack);
|
||||
entityhuman.a(StatisticList.CLEAN_ARMOR);
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.a(world.isClientSide);
|
||||
@@ -117,7 +136,7 @@
|
||||
};
|
||||
|
||||
static Object2ObjectOpenHashMap<Item, CauldronInteraction> a() {
|
||||
- return (Object2ObjectOpenHashMap) SystemUtils.a((Object) (new Object2ObjectOpenHashMap()), (object2objectopenhashmap) -> {
|
||||
+ return SystemUtils.a((new Object2ObjectOpenHashMap<>()), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
|
||||
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
return EnumInteractionResult.PASS;
|
||||
});
|
||||
@@ -133,12 +152,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.getBlockData(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, Blocks.WATER_CAULDRON.getBlockData());
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.WATER_CAULDRON.getBlockData()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -154,12 +178,17 @@
|
||||
});
|
||||
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.decreaseLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, PotionUtil.a(new ItemStack(Items.POTION), Potions.WATER)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- LayeredCauldronBlock.e(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.e(iblockdata, world, blockposition); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -169,10 +198,15 @@
|
||||
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if ((Integer) iblockdata.get(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.d(itemstack) == Potions.WATER) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.a(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(itemstack.getItem()));
|
||||
- world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL));
|
||||
+ // world.setTypeUpdate(blockposition, (IBlockData) iblockdata.a((IBlockState) LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -244,12 +278,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.CAULDRON.getBlockData(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, itemstack1));
|
||||
entityhuman.a(StatisticList.USE_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, Blocks.CAULDRON.getBlockData());
|
||||
+ // world.setTypeUpdate(blockposition, Blocks.CAULDRON.getBlockData()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -260,12 +299,17 @@
|
||||
|
||||
static EnumInteractionResult a(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.a(enumhand, ItemLiquidUtil.a(itemstack, entityhuman, new ItemStack(Items.BUCKET)));
|
||||
entityhuman.a(StatisticList.FILL_CAULDRON);
|
||||
entityhuman.b(StatisticList.ITEM_USED.b(item));
|
||||
- world.setTypeUpdate(blockposition, iblockdata);
|
||||
+ // world.setTypeUpdate(blockposition, iblockdata); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.a((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
@ -11,7 +11,7 @@
|
||||
+
|
||||
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
|
||||
private final DispenseBehaviorItem defaultDispenseItemBehavior = new DispenseBehaviorItem();
|
||||
@@ -39,12 +44,40 @@
|
||||
d3 = 0.0D;
|
||||
}
|
||||
@ -37,8 +37,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -47,8 +47,8 @@
|
||||
+ EntityBoat entityboat = new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityboat.setType(this.c);
|
||||
entityboat.yaw = enumdirection.o();
|
||||
entityboat.setType(this.type);
|
||||
entityboat.setYRot(enumdirection.o());
|
||||
- worldserver.addEntity(entityboat);
|
||||
- itemstack.subtract(1);
|
||||
+ if (!worldserver.addEntity(entityboat)) itemstack.add(1); // CraftBukkit
|
||||
|
@ -59,8 +59,8 @@
|
||||
+ if (!event.getItem().getType().equals(craftItem.getType())) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior.getClass() != DispenseBehaviorItem.class) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior.getClass() != DispenseBehaviorItem.class) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ } else {
|
||||
+ world.addEntity(entityitem);
|
||||
|
@ -39,8 +39,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
@@ -23,6 +23,12 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -25,6 +25,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+// CraftBukkit start
|
||||
@ -13,7 +13,7 @@
|
||||
public class DispenseBehaviorShears extends DispenseBehaviorMaybe {
|
||||
|
||||
public DispenseBehaviorShears() {}
|
||||
@@ -30,11 +36,34 @@
|
||||
@@ -32,11 +38,34 @@
|
||||
@Override
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
@ -33,15 +33,15 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!worldserver.s_()) {
|
||||
if (!worldserver.isClientSide()) {
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
|
||||
- this.a(a((WorldServer) worldserver, blockposition) || b((WorldServer) worldserver, blockposition));
|
||||
@ -49,16 +49,16 @@
|
||||
if (this.a() && itemstack.isDamaged(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
@@ -60,7 +89,7 @@
|
||||
@@ -63,7 +92,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- private static boolean b(WorldServer worldserver, BlockPosition blockposition) {
|
||||
+ private static boolean b(WorldServer worldserver, BlockPosition blockposition, org.bukkit.block.Block bukkitBlock, CraftItemStack craftItem) { // CraftBukkit - add args
|
||||
List<EntityLiving> list = worldserver.a(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.g);
|
||||
List<EntityLiving> list = worldserver.a(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -71,6 +100,11 @@
|
||||
@@ -74,6 +103,11 @@
|
||||
IShearable ishearable = (IShearable) entityliving;
|
||||
|
||||
if (ishearable.canShear()) {
|
||||
@ -68,5 +68,5 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ishearable.shear(SoundCategory.BLOCKS);
|
||||
worldserver.a((Entity) null, GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShulkerBox.java
|
||||
@@ -10,6 +10,11 @@
|
||||
import net.minecraft.world.item.context.BlockActionContextDirectional;
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
@@ -12,6 +12,11 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
@ -11,8 +11,8 @@
|
||||
+
|
||||
public class DispenseBehaviorShulkerBox extends DispenseBehaviorMaybe {
|
||||
|
||||
public DispenseBehaviorShulkerBox() {}
|
||||
@@ -24,6 +29,30 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -28,6 +33,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;
|
||||
|
||||
@ -32,14 +32,14 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.a(((ItemBlock) item).a((BlockActionContext) (new BlockActionContextDirectional(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))).a());
|
||||
}
|
||||
|
||||
try {
|
||||
this.a(((ItemBlock) item).a((BlockActionContext) (new BlockActionContextDirectional(isourceblock.getWorld(), blockposition, enumdirection, itemstack, enumdirection1))).a());
|
||||
} catch (Exception exception) {
|
||||
|
@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -74,6 +74,19 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
@@ -79,6 +79,20 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.item.ItemBucket;
|
||||
+import net.minecraft.world.level.block.BlockSapling;
|
||||
+import net.minecraft.world.level.block.IFluidContainer;
|
||||
+import net.minecraft.world.level.material.Material;
|
||||
@ -19,8 +20,8 @@
|
||||
+
|
||||
public interface IDispenseBehavior {
|
||||
|
||||
IDispenseBehavior NONE = (isourceblock, itemstack) -> {
|
||||
@@ -114,7 +127,7 @@
|
||||
Logger LOGGER = LogManager.getLogger();
|
||||
@@ -120,7 +134,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.EGG, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
@ -29,7 +30,7 @@
|
||||
entityegg.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -122,7 +135,7 @@
|
||||
@@ -128,7 +142,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.SNOWBALL, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
@ -38,7 +39,7 @@
|
||||
entitysnowball.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -130,7 +143,7 @@
|
||||
@@ -136,7 +150,7 @@
|
||||
BlockDispenser.a((IMaterial) Items.EXPERIENCE_BOTTLE, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
|
||||
@ -47,7 +48,7 @@
|
||||
entitythrownexpbottle.setItem(itemstack);
|
||||
});
|
||||
}
|
||||
@@ -151,7 +164,7 @@
|
||||
@@ -157,7 +171,7 @@
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
|
||||
@ -56,7 +57,7 @@
|
||||
entitypotion.setItem(itemstack1);
|
||||
});
|
||||
}
|
||||
@@ -174,7 +187,7 @@
|
||||
@@ -180,7 +194,7 @@
|
||||
return (new DispenseBehaviorProjectile() {
|
||||
@Override
|
||||
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
|
||||
@ -65,9 +66,9 @@
|
||||
entitypotion.setItem(itemstack1);
|
||||
});
|
||||
}
|
||||
@@ -197,8 +210,36 @@
|
||||
@@ -203,14 +217,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).a(itemstack.getTag());
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).a(itemstack.getTag());
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = isourceblock.getWorld();
|
||||
@ -89,21 +90,28 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
entitytypes.spawnCreature(isourceblock.getWorld(), itemstack, (EntityHuman) null, isourceblock.getBlockPosition().shift(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false);
|
||||
try {
|
||||
entitytypes.spawnCreature(isourceblock.getWorld(), itemstack, (EntityHuman) null, isourceblock.getBlockPosition().shift(enumdirection), EnumMobSpawn.DISPENSER, enumdirection != EnumDirection.UP, false);
|
||||
} catch (Exception exception) {
|
||||
- null.LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getBlockPosition(), exception);
|
||||
+ LOGGER.error("Error while dispensing spawn egg from dispenser at {}", isourceblock.getBlockPosition(), exception); // CraftBukkit - decompile error
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
isourceblock.getWorld().a(GameEvent.ENTITY_PLACE, isourceblock.getBlockPosition());
|
||||
return itemstack;
|
||||
}
|
||||
};
|
||||
@@ -216,12 +257,40 @@
|
||||
@@ -229,12 +271,40 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
@ -127,8 +135,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -138,14 +146,14 @@
|
||||
EntityArmorStand entityarmorstand = new EntityArmorStand(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D);
|
||||
|
||||
EntityTypes.a((World) worldserver, (EntityHuman) null, (Entity) entityarmorstand, itemstack.getTag());
|
||||
entityarmorstand.yaw = enumdirection.o();
|
||||
entityarmorstand.setYRot(enumdirection.o());
|
||||
worldserver.addEntity(entityarmorstand);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - Handled during event processing
|
||||
return itemstack;
|
||||
}
|
||||
}));
|
||||
@@ -322,12 +391,41 @@
|
||||
@@ -335,12 +405,41 @@
|
||||
@Override
|
||||
public ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
@ -169,8 +177,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -188,12 +196,14 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -350,10 +448,39 @@
|
||||
@@ -362,12 +461,40 @@
|
||||
double d3 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentX();
|
||||
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
|
||||
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
|
||||
- EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5);
|
||||
|
||||
- worldserver.addEntity((Entity) SystemUtils.a((Object) (new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5)), (entitysmallfireball) -> {
|
||||
- entitysmallfireball.setItem(itemstack);
|
||||
- worldserver.addEntity((Entity) SystemUtils.a((Object) entitysmallfireball, (entitysmallfireball1) -> {
|
||||
- entitysmallfireball1.setItem(itemstack);
|
||||
- }));
|
||||
- itemstack.subtract(1);
|
||||
+ // CraftBukkit start
|
||||
@ -215,8 +225,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -232,7 +242,7 @@
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -377,9 +504,52 @@
|
||||
@@ -391,9 +518,52 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
|
||||
@ -242,7 +252,7 @@
|
||||
+ int z = blockposition.getZ();
|
||||
+ IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+ if (worldserver.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || ((iblockdata.getBlock() instanceof IFluidContainer) && ((IFluidContainer) iblockdata.getBlock()).canPlace(worldserver, blockposition, iblockdata, itembucket.fluidType))) {
|
||||
+ if (worldserver.isEmpty(blockposition) || !material.isBuildable() || material.isReplaceable() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlace(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
@ -258,19 +268,19 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itembucket = (ItemBucket) CraftItemStack.asNMSCopy(event.getItem()).getItem();
|
||||
+ dispensiblecontaineritem = (DispensibleContainerItem) CraftItemStack.asNMSCopy(event.getItem()).getItem();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (itembucket.a((EntityHuman) null, (World) worldserver, blockposition, (MovingObjectPositionBlock) null)) {
|
||||
itembucket.a((World) worldserver, itemstack, blockposition);
|
||||
if (dispensiblecontaineritem.a((EntityHuman) null, worldserver, blockposition, (MovingObjectPositionBlock) null)) {
|
||||
dispensiblecontaineritem.a((EntityHuman) null, worldserver, itemstack, blockposition);
|
||||
- return new ItemStack(Items.BUCKET);
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
+ Item item = Items.BUCKET;
|
||||
@ -279,24 +289,25 @@
|
||||
+ itemstack.setItem(Items.BUCKET);
|
||||
+ itemstack.setCount(1);
|
||||
+ } else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
|
||||
+ this.b.dispense(isourceblock, new ItemStack(item));
|
||||
+ this.defaultDispenseItemBehavior.dispense(isourceblock, new ItemStack(item));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ return itemstack;
|
||||
} else {
|
||||
return this.b.dispense(isourceblock, itemstack);
|
||||
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
|
||||
}
|
||||
@@ -403,13 +573,39 @@
|
||||
@@ -419,7 +589,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
- FluidType fluidtype = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata);
|
||||
+ FluidType fluidtype = ((IFluidSource) block).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
|
||||
- ItemStack itemstack1 = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata);
|
||||
+ ItemStack itemstack1 = ((IFluidSource) block).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
|
||||
|
||||
if (!(fluidtype instanceof FluidTypeFlowing)) {
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.a(isourceblock, itemstack);
|
||||
} else {
|
||||
Item item = fluidtype.a();
|
||||
@@ -427,6 +597,32 @@
|
||||
worldserver.a((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.Block bukkitBlock = worldserver.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ());
|
||||
@ -314,20 +325,20 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fluidtype = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata); // From above
|
||||
+ itemstack1 = ((IFluidSource) block).removeFluid(worldserver, blockposition, iblockdata); // From above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
itemstack.subtract(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -431,13 +627,41 @@
|
||||
@@ -448,14 +644,42 @@
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
|
||||
@ -347,8 +358,8 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -362,15 +373,17 @@
|
||||
|
||||
if (BlockFireAbstract.a((World) worldserver, blockposition, enumdirection)) {
|
||||
- worldserver.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) worldserver, blockposition));
|
||||
- worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ // CraftBukkit start - Ignition by dispensing flint and steel
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition, isourceblock.getBlockPosition()).isCancelled()) {
|
||||
+ worldserver.setTypeUpdate(blockposition, BlockFireAbstract.a((IBlockAccess) worldserver, blockposition));
|
||||
+ worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (BlockCampfire.h(iblockdata)) {
|
||||
worldserver.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true));
|
||||
} else if (iblockdata.getBlock() instanceof BlockTNT) {
|
||||
@@ -460,12 +684,62 @@
|
||||
} else if (!BlockCampfire.h(iblockdata) && !CandleBlock.g(iblockdata) && !CandleCakeBlock.g(iblockdata)) {
|
||||
if (iblockdata.getBlock() instanceof BlockTNT) {
|
||||
BlockTNT.a((World) worldserver, blockposition);
|
||||
@@ -481,12 +705,62 @@
|
||||
this.a(true);
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
@ -390,8 +403,8 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -403,7 +416,7 @@
|
||||
if (!ItemBoneMeal.a(itemstack, (World) worldserver, blockposition) && !ItemBoneMeal.a(itemstack, (World) worldserver, blockposition, (EnumDirection) null)) {
|
||||
this.a(false);
|
||||
} else if (!worldserver.isClientSide) {
|
||||
worldserver.triggerEffect(2005, blockposition, 0);
|
||||
worldserver.triggerEffect(1505, blockposition, 0);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
@ -433,12 +446,12 @@
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -475,11 +749,40 @@
|
||||
@@ -496,12 +770,41 @@
|
||||
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getWorld();
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
|
||||
@ -459,8 +472,8 @@
|
||||
+ itemstack.add(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -470,13 +483,14 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
worldserver.addEntity(entitytntprimed);
|
||||
worldserver.playSound((EntityHuman) null, entitytntprimed.locX(), entitytntprimed.locY(), entitytntprimed.locZ(), SoundEffects.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
worldserver.playSound((EntityHuman) null, entitytntprimed.locX(), entitytntprimed.locY(), entitytntprimed.locZ(), SoundEffects.TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
worldserver.a((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
|
||||
- itemstack.subtract(1);
|
||||
+ // itemstack.subtract(1); // CraftBukkit - handled above
|
||||
return itemstack;
|
||||
}
|
||||
}));
|
||||
@@ -503,6 +806,30 @@
|
||||
@@ -525,6 +828,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
|
||||
|
||||
@ -496,8 +510,8 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -505,9 +519,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (worldserver.isEmpty(blockposition) && BlockWitherSkull.b((World) worldserver, blockposition, itemstack)) {
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, enumdirection.n() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3);
|
||||
TileEntity tileentity = worldserver.getTileEntity(blockposition);
|
||||
@@ -527,6 +854,30 @@
|
||||
worldserver.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.ROTATION, enumdirection.n() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3);
|
||||
worldserver.a((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -550,6 +877,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
@ -527,8 +541,8 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -538,7 +552,7 @@
|
||||
if (worldserver.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setTypeAndData(blockposition, blockpumpkincarved.getBlockData(), 3);
|
||||
@@ -574,6 +925,30 @@
|
||||
@@ -599,6 +950,30 @@
|
||||
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getType(blockposition);
|
||||
|
||||
@ -558,8 +572,8 @@
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) {
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(isourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
@ -567,5 +581,5 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (iblockdata.a((Tag) TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
|
||||
return blockbase_blockdata.b(BlockBeehive.b);
|
||||
}) && (Integer) iblockdata.get(BlockBeehive.b) >= 5) {
|
||||
return blockbase_blockdata.b(BlockBeehive.HONEY_LEVEL);
|
||||
}) && (Integer) iblockdata.get(BlockBeehive.HONEY_LEVEL) >= 5) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/NetworkManager.java
|
||||
+++ b/net/minecraft/network/NetworkManager.java
|
||||
@@ -137,7 +137,7 @@
|
||||
@@ -156,7 +156,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void a(Packet<T> packet, PacketListener packetlistener) {
|
||||
@ -9,12 +9,12 @@
|
||||
}
|
||||
|
||||
public void setPacketListener(PacketListener packetlistener) {
|
||||
@@ -247,7 +247,7 @@
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
public void close(IChatBaseComponent ichatbasecomponent) {
|
||||
if (this.channel.isOpen()) {
|
||||
- this.channel.close().awaitUninterruptibly();
|
||||
+ this.channel.close(); // We can't wait as this may be called from an event loop.
|
||||
this.m = ichatbasecomponent;
|
||||
this.disconnectedReason = ichatbasecomponent;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -39,6 +39,8 @@
|
||||
@@ -54,6 +54,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@ -8,17 +8,59 @@
|
||||
+
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
private final ByteBuf a;
|
||||
@@ -167,7 +169,7 @@
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
@@ -112,7 +114,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C a(IntFunction<C> intfunction, Function<PacketDataSerializer, T> function) {
|
||||
int i = this.j();
|
||||
- C c0 = (Collection) intfunction.apply(i);
|
||||
+ C c0 = intfunction.apply(i); // CraftBukkit - decompile error
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
c0.add(function.apply(this));
|
||||
@@ -123,7 +125,7 @@
|
||||
|
||||
public <T> void a(Collection<T> collection, BiConsumer<PacketDataSerializer, T> biconsumer) {
|
||||
this.d(collection.size());
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -134,7 +136,7 @@
|
||||
}
|
||||
|
||||
public <T> List<T> a(Function<PacketDataSerializer, T> function) {
|
||||
- return (List) this.a(Lists::newArrayListWithCapacity, function);
|
||||
+ return (List) this.a((java.util.function.IntFunction) Lists::newArrayListWithCapacity, function); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public IntList a() {
|
||||
@@ -150,12 +152,12 @@
|
||||
|
||||
public void a(IntList intlist) {
|
||||
this.d(intlist.size());
|
||||
- intlist.forEach(this::d);
|
||||
+ intlist.forEach((java.util.function.IntConsumer) this::d); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public <K, V, M extends Map<K, V>> M a(IntFunction<M> intfunction, Function<PacketDataSerializer, K> function, Function<PacketDataSerializer, V> function1) {
|
||||
int i = this.j();
|
||||
- M m0 = (Map) intfunction.apply(i);
|
||||
+ M m0 = intfunction.apply(i); // CraftBukkit - decompile error
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
K k0 = function.apply(this);
|
||||
@@ -330,7 +332,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T a(Class<T> oclass) {
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.i()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.i()]; // CraftBukkit - fix decompile error
|
||||
- return ((Enum[]) oclass.getEnumConstants())[this.j()];
|
||||
+ return ((T[]) oclass.getEnumConstants())[this.j()]; // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(Enum<?> oenum) {
|
||||
@@ -244,7 +246,7 @@
|
||||
@@ -407,7 +409,7 @@
|
||||
} else {
|
||||
try {
|
||||
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
@ -27,7 +69,7 @@
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -281,7 +283,7 @@
|
||||
@@ -444,7 +446,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer a(ItemStack itemstack) {
|
||||
@ -36,10 +78,10 @@
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -310,6 +312,11 @@
|
||||
@@ -473,6 +475,11 @@
|
||||
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
|
||||
|
||||
itemstack.setTag(this.l());
|
||||
itemstack.setTag(this.m());
|
||||
+ // CraftBukkit start
|
||||
+ if (itemstack.getTag() != null) {
|
||||
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
|
@ -1,16 +1,16 @@
|
||||
--- a/net/minecraft/network/chat/ChatHexColor.java
|
||||
+++ b/net/minecraft/network/chat/ChatHexColor.java
|
||||
@@ -11,7 +11,7 @@
|
||||
public final class ChatHexColor {
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
private static final Map<EnumChatFormat, ChatHexColor> a = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
private static final String CUSTOM_COLOR_PREFIX = "#";
|
||||
private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
|
||||
- return new ChatHexColor(enumchatformat.e(), enumchatformat.f());
|
||||
+ return new ChatHexColor(enumchatformat.e(), enumchatformat.f(), enumchatformat); // CraftBukkit
|
||||
}));
|
||||
private static final Map<String, ChatHexColor> b = (Map) ChatHexColor.a.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
|
||||
return chathexcolor.name;
|
||||
@@ -19,16 +19,22 @@
|
||||
private final int rgb;
|
||||
@@ -20,16 +20,22 @@
|
||||
private final int value;
|
||||
@Nullable
|
||||
public final String name;
|
||||
+ // CraftBukkit start
|
||||
@ -19,17 +19,17 @@
|
||||
|
||||
- private ChatHexColor(int i, String s) {
|
||||
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
|
||||
this.rgb = i;
|
||||
this.value = i;
|
||||
this.name = s;
|
||||
+ this.format = format;
|
||||
}
|
||||
|
||||
private ChatHexColor(int i) {
|
||||
this.rgb = i;
|
||||
this.value = i;
|
||||
this.name = null;
|
||||
+ this.format = null;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
public String b() {
|
||||
return this.name != null ? this.name : this.c();
|
||||
public int a() {
|
||||
return this.value;
|
||||
|
@ -1,23 +0,0 @@
|
||||
--- a/net/minecraft/network/chat/ChatModifier.java
|
||||
+++ b/net/minecraft/network/chat/ChatModifier.java
|
||||
@@ -118,6 +118,20 @@
|
||||
return new ChatModifier(this.color, this.bold, obool, this.underlined, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public ChatModifier setStrikethrough(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, obool, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setUnderline(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, obool, this.strikethrough, this.obfuscated, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+
|
||||
+ public ChatModifier setRandom(@Nullable Boolean obool) {
|
||||
+ return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, obool, this.clickEvent, this.hoverEvent, this.insertion, this.font);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public ChatModifier setChatClickable(@Nullable ChatClickable chatclickable) {
|
||||
return new ChatModifier(this.color, this.bold, this.italic, this.underlined, this.strikethrough, this.obfuscated, chatclickable, this.hoverEvent, this.insertion, this.font);
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
@@ -27,7 +27,23 @@
|
||||
import net.minecraft.util.ChatDeserializer;
|
||||
@@ -29,7 +29,23 @@
|
||||
import net.minecraft.util.ChatTypeAdapterFactory;
|
||||
import net.minecraft.util.FormattedString;
|
||||
|
||||
-public interface IChatBaseComponent extends Message, IChatFormatted {
|
||||
+// CraftBukkit start
|
||||
|
@ -12,7 +12,7 @@
|
||||
public class PlayerConnectionUtils {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -18,6 +23,7 @@
|
||||
@@ -20,6 +25,7 @@
|
||||
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isMainThread()) {
|
||||
iasynctaskhandler.execute(() -> {
|
||||
@ -20,13 +20,13 @@
|
||||
if (t0.a().isConnected()) {
|
||||
packet.a(t0);
|
||||
} else {
|
||||
@@ -26,6 +32,10 @@
|
||||
@@ -28,6 +34,10 @@
|
||||
|
||||
});
|
||||
throw CancelledPacketHandleException.INSTANCE;
|
||||
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
+ // CraftBukkit start - SPIGOT-5477, MC-142590
|
||||
+ } else if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) {
|
||||
+ throw CancelledPacketHandleException.INSTANCE;
|
||||
+ throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
@@ -27,8 +27,10 @@
|
||||
}
|
||||
|
||||
public ClientboundInitializeBorderPacket(WorldBorder worldborder) {
|
||||
- this.newCenterX = worldborder.getCenterX();
|
||||
- this.newCenterZ = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ // CraftBukkit end
|
||||
this.oldSize = worldborder.getSize();
|
||||
this.newSize = worldborder.k();
|
||||
this.lerpTime = worldborder.j();
|
@ -0,0 +1,15 @@
|
||||
--- a/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
@@ -10,8 +10,10 @@
|
||||
private final double newCenterZ;
|
||||
|
||||
public ClientboundSetBorderCenterPacket(WorldBorder worldborder) {
|
||||
- this.newCenterX = worldborder.getCenterX();
|
||||
- this.newCenterZ = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.newCenterX = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.newCenterZ = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public ClientboundSetBorderCenterPacket(PacketDataSerializer packetdataserializer) {
|
@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayInChat.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayInChat.java
|
||||
@@ -20,7 +20,7 @@
|
||||
@@ -17,7 +17,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException {
|
||||
- this.a = packetdataserializer.e(256);
|
||||
+ this.a = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.e(256)); // CraftBukkit - see PlayerConnection
|
||||
public PacketPlayInChat(PacketDataSerializer packetdataserializer) {
|
||||
- this.message = packetdataserializer.e(256);
|
||||
+ this.message = org.apache.commons.lang3.StringUtils.normalizeSpace(packetdataserializer.e(256)); // CraftBukkit - see PlayerConnection
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
|
||||
@@ -10,6 +10,12 @@
|
||||
|
||||
public PacketPlayInCloseWindow() {}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public PacketPlayInCloseWindow(int id) {
|
||||
+ this.id = id;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(PacketListenerPlayIn packetlistenerplayin) {
|
||||
packetlistenerplayin.a(this);
|
||||
}
|
@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
|
@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.UUID;
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
@@ -31,7 +31,7 @@
|
||||
@@ -32,7 +32,7 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.b[i] = short0;
|
||||
- this.c[i] = chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0));
|
||||
+ this.c[i] = (chunksection != null) ? chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0)) : net.minecraft.world.level.block.Blocks.AIR.getBlockData(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
|
||||
this.positions[j] = short0;
|
||||
- this.states[j] = chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0));
|
||||
+ this.states[j] = (chunksection != null) ? chunksection.getType(SectionPosition.a(short0), SectionPosition.b(short0), SectionPosition.c(short0)) : net.minecraft.world.level.block.Blocks.AIR.getBlockData(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/network/protocol/game/PacketPlayOutWorldBorder.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutWorldBorder.java
|
||||
@@ -21,8 +21,10 @@
|
||||
|
||||
public PacketPlayOutWorldBorder(WorldBorder worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction packetplayoutworldborder_enumworldborderaction) {
|
||||
this.a = packetplayoutworldborder_enumworldborderaction;
|
||||
- this.c = worldborder.getCenterX();
|
||||
- this.d = worldborder.getCenterZ();
|
||||
+ // CraftBukkit start - multiply out nether border
|
||||
+ this.c = worldborder.getCenterX() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ this.d = worldborder.getCenterZ() * worldborder.world.getDimensionManager().getCoordinateScale();
|
||||
+ // CraftBukkit end
|
||||
this.f = worldborder.getSize();
|
||||
this.e = worldborder.k();
|
||||
this.g = worldborder.j();
|
@ -4,4 +4,4 @@
|
||||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.handshake;
|
||||
|
||||
import java.io.IOException;
|
||||
import net.minecraft.SharedConstants;
|
||||
|
@ -1,16 +1,25 @@
|
||||
--- a/net/minecraft/network/syncher/DataWatcher.java
|
||||
+++ b/net/minecraft/network/syncher/DataWatcher.java
|
||||
@@ -134,6 +134,13 @@
|
||||
@@ -141,6 +141,13 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - add method from above
|
||||
+ public <T> void markDirty(DataWatcherObject<T> datawatcherobject) {
|
||||
+ this.b(datawatcherobject).a(true);
|
||||
+ this.g = true;
|
||||
+ this.isDirty = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean a() {
|
||||
return this.g;
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -273,7 +280,7 @@
|
||||
if (!Objects.equals(datawatcher_item1.accessor.b(), datawatcher_item.accessor.b())) {
|
||||
throw new IllegalStateException(String.format("Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.a(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_item1.value, datawatcher_item1.value.getClass()));
|
||||
} else {
|
||||
- datawatcher_item.a(datawatcher_item1.b());
|
||||
+ datawatcher_item.a((T) datawatcher_item1.b()); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,20 +4,20 @@
|
||||
Advancement advancement = advancementdataworld.a((MinecraftKey) entry.getKey());
|
||||
|
||||
if (advancement == null) {
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
||||
+ // CraftBukkit start
|
||||
+ if (entry.getKey().getNamespace().equals("minecraft")) {
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.f);
|
||||
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.a(advancement, (AdvancementProgress) entry.getValue());
|
||||
}
|
||||
@@ -296,6 +300,7 @@
|
||||
this.j.add(advancement);
|
||||
@@ -276,6 +280,7 @@
|
||||
this.progressChanged.add(advancement);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.world.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
+ this.player.level.getServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.d().a(this.player);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.world.getGameRules().getBoolean(GameRules.ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.e.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
if (advancement.c() != null && advancement.c().i() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.playerList.sendMessage(new ChatMessage("chat.type.advancement." + advancement.c().e().a(), new Object[]{this.player.getScoreboardDisplayName(), advancement.j()}), ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -36,7 +36,7 @@
|
||||
@@ -44,7 +44,7 @@
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -26,6 +26,12 @@
|
||||
@@ -28,6 +28,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -12,8 +12,32 @@
|
||||
+
|
||||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream a = System.out;
|
||||
@@ -50,6 +56,69 @@
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -38,6 +44,23 @@
|
||||
|
||||
public static void init() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
+ // CraftBukkit start
|
||||
+ String name = DispenserRegistry.class.getSimpleName();
|
||||
+ switch (name) {
|
||||
+ case "DispenserRegistry":
|
||||
+ break;
|
||||
+ case "Bootstrap":
|
||||
+ System.err.println("***************************************************************************");
|
||||
+ System.err.println("*** WARNING: This server jar may only be used for development purposes. ***");
|
||||
+ System.err.println("***************************************************************************");
|
||||
+ break;
|
||||
+ default:
|
||||
+ System.err.println("**********************************************************************");
|
||||
+ System.err.println("*** WARNING: This server jar is unsupported, use at your own risk. ***");
|
||||
+ System.err.println("**********************************************************************");
|
||||
+ break;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DispenserRegistry.isBootstrapped = true;
|
||||
if (IRegistry.REGISTRY.keySet().isEmpty()) {
|
||||
throw new IllegalStateException("Unable to load registries");
|
||||
@@ -55,6 +78,69 @@
|
||||
TagStatic.b();
|
||||
d();
|
||||
}
|
||||
@ -34,51 +58,51 @@
|
||||
+ DataConverterFlattenData.map(1021, "{Name:'minecraft:oak_sign',Properties:{rotation:'13'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'13'}}");
|
||||
+ DataConverterFlattenData.map(1022, "{Name:'minecraft:oak_sign',Properties:{rotation:'14'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'14'}}");
|
||||
+ DataConverterFlattenData.map(1023, "{Name:'minecraft:oak_sign',Properties:{rotation:'15'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'15'}}");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(323, "minecraft:oak_sign");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(323, "minecraft:oak_sign");
|
||||
+
|
||||
+ DataConverterFlattenData.map(1440, "{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}", new String[]{"{Name:\'minecraft:portal\',Properties:{axis:\'x\'}}"});
|
||||
+
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(409, "minecraft:prismarine_shard");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(410, "minecraft:prismarine_crystals");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(411, "minecraft:rabbit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(412, "minecraft:cooked_rabbit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(413, "minecraft:rabbit_stew");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(414, "minecraft:rabbit_foot");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(415, "minecraft:rabbit_hide");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(416, "minecraft:armor_stand");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(409, "minecraft:prismarine_shard");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(410, "minecraft:prismarine_crystals");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(411, "minecraft:rabbit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(412, "minecraft:cooked_rabbit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(413, "minecraft:rabbit_stew");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(414, "minecraft:rabbit_foot");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(415, "minecraft:rabbit_hide");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(416, "minecraft:armor_stand");
|
||||
+
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(423, "minecraft:mutton");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(424, "minecraft:cooked_mutton");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(425, "minecraft:banner");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(426, "minecraft:end_crystal");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(427, "minecraft:spruce_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(428, "minecraft:birch_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(429, "minecraft:jungle_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(430, "minecraft:acacia_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(431, "minecraft:dark_oak_door");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(432, "minecraft:chorus_fruit");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(433, "minecraft:chorus_fruit_popped");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(434, "minecraft:beetroot");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(435, "minecraft:beetroot_seeds");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(436, "minecraft:beetroot_soup");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(437, "minecraft:dragon_breath");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(438, "minecraft:splash_potion");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(439, "minecraft:spectral_arrow");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(440, "minecraft:tipped_arrow");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(441, "minecraft:lingering_potion");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(442, "minecraft:shield");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(443, "minecraft:elytra");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(444, "minecraft:spruce_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(445, "minecraft:birch_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(446, "minecraft:jungle_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(447, "minecraft:acacia_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(448, "minecraft:dark_oak_boat");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(449, "minecraft:totem_of_undying");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(450, "minecraft:shulker_shell");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(452, "minecraft:iron_nugget");
|
||||
+ DataConverterMaterialId.ID_MAPPING.put(453, "minecraft:knowledge_book");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(423, "minecraft:mutton");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(424, "minecraft:cooked_mutton");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(425, "minecraft:banner");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(426, "minecraft:end_crystal");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(427, "minecraft:spruce_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(428, "minecraft:birch_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(429, "minecraft:jungle_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(430, "minecraft:acacia_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(431, "minecraft:dark_oak_door");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(432, "minecraft:chorus_fruit");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(433, "minecraft:chorus_fruit_popped");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(434, "minecraft:beetroot");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(435, "minecraft:beetroot_seeds");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(436, "minecraft:beetroot_soup");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(437, "minecraft:dragon_breath");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(438, "minecraft:splash_potion");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(439, "minecraft:spectral_arrow");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(440, "minecraft:tipped_arrow");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(441, "minecraft:lingering_potion");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(442, "minecraft:shield");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(443, "minecraft:elytra");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(444, "minecraft:spruce_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(445, "minecraft:birch_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(446, "minecraft:jungle_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(447, "minecraft:acacia_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(448, "minecraft:dark_oak_boat");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(449, "minecraft:totem_of_undying");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(450, "minecraft:shulker_shell");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(452, "minecraft:iron_nugget");
|
||||
+ DataConverterMaterialId.ITEM_NAMES.put(453, "minecraft:knowledge_book");
|
||||
+
|
||||
+ DataConverterSpawnEgg.ID_MAPPING[23] = "Arrow";
|
||||
+ DataConverterSpawnEgg.ID_TO_ENTITY[23] = "Arrow";
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -54,13 +54,20 @@
|
||||
@@ -58,6 +58,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -13,16 +13,18 @@
|
||||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
@@ -65,8 +71,9 @@
|
||||
public Main() {}
|
||||
|
||||
@DontObfuscate
|
||||
- public static void main(String[] astring) {
|
||||
+ public static void main(final OptionSet optionset) { // CraftBukkit - replaces main(String[] astring)
|
||||
SharedConstants.a();
|
||||
+ /* CraftBukkit start - Replace everything
|
||||
OptionParser optionparser = new OptionParser();
|
||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||
@@ -84,21 +91,23 @@
|
||||
@@ -90,20 +97,22 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
@ -33,26 +35,21 @@
|
||||
DispenserRegistry.init();
|
||||
DispenserRegistry.c();
|
||||
SystemUtils.l();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
|
||||
- Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, path);
|
||||
+ java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.a();
|
||||
Path path = Paths.get("server.properties");
|
||||
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path);
|
||||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
|
||||
|
||||
dedicatedserversettings.save();
|
||||
- Path path1 = Paths.get("eula.txt");
|
||||
- EULA eula = new EULA(path1);
|
||||
+ java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
|
||||
+ EULA eula = new EULA(java_nio_file_path1);
|
||||
Path path1 = Paths.get("eula.txt");
|
||||
EULA eula = new EULA(path1);
|
||||
|
||||
- if (optionset.has(optionspec1)) {
|
||||
- Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
+ if (optionset.has("initSettings")) { // CraftBukkit
|
||||
+ Main.LOGGER.info("Initialized '{}' and '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
|
||||
Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -107,24 +116,42 @@
|
||||
@@ -113,14 +122,15 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -61,15 +58,19 @@
|
||||
YggdrasilAuthenticationService yggdrasilauthenticationservice = new YggdrasilAuthenticationService(Proxy.NO_PROXY);
|
||||
MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService();
|
||||
GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository();
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName()));
|
||||
- String s = (String) Optional.ofNullable(optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.USERID_CACHE_FILE.getName()));
|
||||
- String s = (String) Optional.ofNullable((String) optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable(optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.a(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.c(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.c(s, WorldDimension.OVERWORLD);
|
||||
|
||||
MinecraftServer.convertWorld(convertable_conversionsession);
|
||||
WorldInfo worldinfo = convertable_conversionsession.d();
|
||||
@@ -131,13 +141,30 @@
|
||||
}
|
||||
|
||||
DataPackConfiguration datapackconfiguration = convertable_conversionsession.e();
|
||||
- boolean flag = optionset.has(optionspec6);
|
||||
+ boolean flag = optionset.has("safeMode");
|
||||
@ -78,9 +79,9 @@
|
||||
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
}
|
||||
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), PackSource.c)});
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(EnumResourcePackType.SERVER_DATA, new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), PackSource.WORLD)});
|
||||
+ // CraftBukkit start
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACKS).toFile(), "bukkit");
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getWorldFolder(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
|
||||
+ if (!bukkitDataPackFolder.exists()) {
|
||||
+ bukkitDataPackFolder.mkdirs();
|
||||
+ }
|
||||
@ -96,18 +97,18 @@
|
||||
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.a : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
DataPackConfiguration datapackconfiguration1 = MinecraftServer.a(resourcepackrepository, datapackconfiguration == null ? DataPackConfiguration.DEFAULT : datapackconfiguration, flag);
|
||||
CompletableFuture completablefuture = DataPackResources.a(resourcepackrepository.f(), iregistrycustom_dimension, CommandDispatcher.ServerType.DEDICATED, dedicatedserversettings.getProperties().functionPermissionLevel, SystemUtils.f(), Runnable::run);
|
||||
|
||||
@@ -139,6 +166,7 @@
|
||||
@@ -152,6 +179,7 @@
|
||||
}
|
||||
|
||||
datapackresources.i();
|
||||
datapackresources.j();
|
||||
+ /*
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
|
||||
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
|
||||
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, datapackresources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
|
||||
@@ -166,21 +194,32 @@
|
||||
dedicatedserversettings.getProperties().a((IRegistryCustom) iregistrycustom_dimension);
|
||||
@@ -181,21 +209,32 @@
|
||||
}
|
||||
|
||||
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
|
||||
@ -126,7 +127,7 @@
|
||||
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
|
||||
|
||||
if (flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedserver1.bd();
|
||||
dedicatedserver1.bi();
|
||||
}
|
||||
|
||||
+ if (optionset.has("port")) {
|
||||
@ -142,7 +143,7 @@
|
||||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.safeShutdown(true);
|
||||
@@ -189,14 +228,15 @@
|
||||
@@ -204,14 +243,15 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -155,6 +155,25 @@
|
||||
@@ -166,6 +166,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -26,9 +26,9 @@
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -224,6 +243,20 @@
|
||||
private final DefinedStructureManager ak;
|
||||
protected SaveData saveData;
|
||||
@@ -258,6 +277,20 @@
|
||||
private final DefinedStructureManager structureManager;
|
||||
protected SaveData worldData;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public DataPackConfiguration datapackconfiguration;
|
||||
@ -47,7 +47,7 @@
|
||||
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -233,21 +266,21 @@
|
||||
@@ -267,14 +300,14 @@
|
||||
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
|
||||
MinecraftServer.LOGGER.error(throwable);
|
||||
});
|
||||
@ -59,27 +59,28 @@
|
||||
return s0;
|
||||
}
|
||||
|
||||
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- public MinecraftServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, SaveData savedata, ResourcePackRepository resourcepackrepository, Proxy proxy, DataFixer datafixer, DataPackResources datapackresources, @Nullable MinecraftSessionService minecraftsessionservice, @Nullable GameProfileRepository gameprofilerepository, @Nullable UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
this.m = new GameProfilerSwitcher(SystemUtils.a, this::ai);
|
||||
this.methodProfiler = GameProfilerDisabled.a;
|
||||
this.serverPing = new ServerPing();
|
||||
this.r = new Random();
|
||||
this.serverPort = -1;
|
||||
- this.worldServer = Maps.newLinkedHashMap();
|
||||
+ this.worldServer = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
this.isRunning = true;
|
||||
this.h = new long[100];
|
||||
this.K = "";
|
||||
@@ -273,7 +306,34 @@
|
||||
this.ak = new DefinedStructureManager(datapackresources.h(), convertable_conversionsession, datafixer);
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.e();
|
||||
@@ -286,7 +319,7 @@
|
||||
this.status = new ServerPing();
|
||||
this.random = new Random();
|
||||
this.port = -1;
|
||||
- this.levels = Maps.newLinkedHashMap();
|
||||
+ this.levels = Maps.newLinkedHashMap(); // CraftBukkit - keep order, k+v already use identity methods
|
||||
this.running = true;
|
||||
this.tickTimes = new long[100];
|
||||
this.resourcePack = "";
|
||||
@@ -316,13 +349,40 @@
|
||||
this.structureManager = new DefinedStructureManager(datapackresources.i(), convertable_conversionsession, datafixer);
|
||||
this.serverThread = thread;
|
||||
this.executorService = SystemUtils.f();
|
||||
this.executor = SystemUtils.f();
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
+ this.datapackconfiguration = datapackconfiguration;
|
||||
+ this.vanillaCommandDispatcher = datapackresources.commandDispatcher; // CraftBukkit
|
||||
+ this.vanillaCommandDispatcher = datapackresources.commands; // CraftBukkit
|
||||
+ // Try to see if we're actually running in a terminal, disable jline if not
|
||||
+ if (System.console() == null && System.getProperty("jline.terminal") == null) {
|
||||
+ System.setProperty("jline.terminal", "jline.UnsupportedTerminal");
|
||||
@ -106,42 +107,49 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
|
||||
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
|
||||
@@ -286,7 +346,7 @@
|
||||
ScoreboardServer scoreboardserver = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver);
|
||||
- Function function = scoreboardserver::a;
|
||||
+ Function<net.minecraft.nbt.NBTTagCompound, net.minecraft.world.scores.PersistentScoreboard> function = scoreboardserver::a; // CraftBukkit - decompile error
|
||||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -333,7 +393,7 @@
|
||||
|
||||
public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) {
|
||||
if (convertable_conversionsession.isConvertable()) {
|
||||
- MinecraftServer.LOGGER.info("Converting map!");
|
||||
+ MinecraftServer.LOGGER.info("Converting map! {}", convertable_conversionsession.getLevelName()); // CraftBukkit
|
||||
convertable_conversionsession.convert(new IProgressUpdate() {
|
||||
private long a = SystemUtils.getMonotonicMillis();
|
||||
private long timeStamp = SystemUtils.getMonotonicMillis();
|
||||
|
||||
@@ -309,48 +369,197 @@
|
||||
@@ -362,48 +422,197 @@
|
||||
|
||||
}
|
||||
|
||||
- protected void loadWorld() {
|
||||
- this.loadResourcesZip();
|
||||
- this.saveData.a(this.getServerModName(), this.getModded().isPresent());
|
||||
- WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
- this.worldData.a(this.getServerModName(), this.getModded().isPresent());
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ protected void loadWorld(String s) {
|
||||
+ // CraftBukkit start
|
||||
+ Convertable.ConversionSession worldSession = this.convertable;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.customRegistry;
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, this.dataPackResources.h(), iregistrycustom_dimension);
|
||||
+ Convertable.ConversionSession worldSession = this.storageSource;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
|
||||
+ RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.INSTANCE, this.resources.i(), (IRegistryCustom) iregistrycustom_dimension);
|
||||
+ WorldDataServer overworldData = (WorldDataServer) worldSession.a((DynamicOps) registryreadops, datapackconfiguration);
|
||||
+ if (overworldData == null) {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ worldsettings = MinecraftServer.c;
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.generatorSettings.j() : dedicatedserverproperties.generatorSettings;
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.worldGenSettings.j() : dedicatedserverproperties.worldGenSettings;
|
||||
+ }
|
||||
+
|
||||
+ overworldData = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
@ -156,13 +164,13 @@
|
||||
+ WorldServer world;
|
||||
+ int dimension = 0;
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.THE_NETHER) {
|
||||
+ if (dimensionKey == WorldDimension.NETHER) {
|
||||
+ if (getAllowNether()) {
|
||||
+ dimension = -1;
|
||||
+ } else {
|
||||
+ continue;
|
||||
+ }
|
||||
+ } else if (dimensionKey == WorldDimension.THE_END) {
|
||||
+ } else if (dimensionKey == WorldDimension.END) {
|
||||
+ if (server.getAllowEnd()) {
|
||||
+ dimension = 1;
|
||||
+ } else {
|
||||
@ -225,13 +233,13 @@
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemoMode()) {
|
||||
+ worldsettings = MinecraftServer.c;
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = GeneratorSettings.a((IRegistryCustom) iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getDedicatedServerProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.generatorSettings.j() : dedicatedserverproperties.generatorSettings;
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.worldGenSettings.j() : dedicatedserverproperties.worldGenSettings;
|
||||
+ }
|
||||
+
|
||||
+ worlddata = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
@ -241,7 +249,7 @@
|
||||
+ net.minecraft.server.Main.convertWorld(worldSession, DataConverterRegistry.a(), options.has("eraseCache"), () -> {
|
||||
+ return true;
|
||||
+ }, worlddata.getGeneratorSettings().d().d().stream().map((entry1) -> {
|
||||
+ return ResourceKey.a(IRegistry.K, ((ResourceKey) entry1.getKey()).a());
|
||||
+ return ResourceKey.a(IRegistry.DIMENSION_TYPE_REGISTRY, ((ResourceKey) entry1.getKey()).a());
|
||||
+ }).collect(ImmutableSet.toImmutableSet()));
|
||||
+ }
|
||||
+
|
||||
@ -256,35 +264,35 @@
|
||||
+ ChunkGenerator chunkgenerator;
|
||||
+
|
||||
+ if (worlddimension == null) {
|
||||
+ dimensionmanager = (DimensionManager) this.customRegistry.a().d(DimensionManager.OVERWORLD);
|
||||
+ chunkgenerator = GeneratorSettings.a(customRegistry.b(IRegistry.ay), customRegistry.b(IRegistry.ar), (new Random()).nextLong());
|
||||
+ dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
+ chunkgenerator = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
+ } else {
|
||||
+ dimensionmanager = worlddimension.b();
|
||||
+ chunkgenerator = worlddimension.c();
|
||||
+ }
|
||||
+
|
||||
+ ResourceKey<World> worldKey = ResourceKey.a(IRegistry.L, dimensionKey.a());
|
||||
+ ResourceKey<World> worldKey = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, dimensionKey.a());
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.OVERWORLD) {
|
||||
+ this.saveData = worlddata;
|
||||
+ this.saveData.setGameType(((DedicatedServer) this).getDedicatedServerProperties().gamemode); // From DedicatedServer.init
|
||||
+ this.worldData = worlddata;
|
||||
+ this.worldData.setGameType(((DedicatedServer) this).getDedicatedServerProperties().gamemode); // From DedicatedServer.init
|
||||
+
|
||||
+ WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+
|
||||
+ world = new WorldServer(this, this.executorService, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ WorldPersistentData worldpersistentdata = world.getWorldPersistentData();
|
||||
+ this.initializeScoreboards(worldpersistentdata);
|
||||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
+ WorldLoadListener worldloadlistener = this.worldLoadListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executorService, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, dimensionmanager, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen);
|
||||
+ }
|
||||
+
|
||||
+ worlddata.a(this.getServerModName(), this.getModded().isPresent());
|
||||
+ this.initWorld(world, worlddata, saveData, worlddata.getGeneratorSettings());
|
||||
+ this.initWorld(world, worlddata, worldData, worlddata.getGeneratorSettings());
|
||||
+
|
||||
+ this.worldServer.put(world.getDimensionKey(), world);
|
||||
+ this.levels.put(world.getDimensionKey(), world);
|
||||
+ this.getPlayerList().setPlayerFileData(world);
|
||||
+
|
||||
+ if (worlddata.getCustomBossEvents() != null) {
|
||||
@ -294,21 +302,21 @@
|
||||
this.updateWorldSettings();
|
||||
- this.loadSpawn(worldloadlistener);
|
||||
+ for (WorldServer worldserver : this.getWorlds()) {
|
||||
+ this.loadSpawn(worldserver.getChunkProvider().playerChunkMap.worldLoadListener, worldserver);
|
||||
+ this.loadSpawn(worldserver.getChunkProvider().chunkMap.progressListener, worldserver);
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(worldserver.getWorld()));
|
||||
+ }
|
||||
+
|
||||
+ this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD);
|
||||
+ this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP));
|
||||
+ this.serverConnection.acceptConnections();
|
||||
+ this.connection.acceptConnections();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void updateWorldSettings() {}
|
||||
|
||||
- protected void a(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.saveData.H();
|
||||
- GeneratorSettings generatorsettings = this.saveData.getGeneratorSettings();
|
||||
- IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
- GeneratorSettings generatorsettings = this.worldData.getGeneratorSettings();
|
||||
+ // CraftBukkit start
|
||||
+ public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, GeneratorSettings generatorsettings) {
|
||||
boolean flag = generatorsettings.isDebugWorld();
|
||||
@ -321,8 +329,8 @@
|
||||
- Object object;
|
||||
-
|
||||
- if (worlddimension == null) {
|
||||
- dimensionmanager = (DimensionManager) this.customRegistry.a().d(DimensionManager.OVERWORLD);
|
||||
- object = GeneratorSettings.a(this.customRegistry.b(IRegistry.ay), this.customRegistry.b(IRegistry.ar), (new Random()).nextLong());
|
||||
- dimensionmanager = (DimensionManager) this.registryHolder.d(IRegistry.DIMENSION_TYPE_REGISTRY).d(DimensionManager.OVERWORLD_LOCATION);
|
||||
- object = GeneratorSettings.a(this.registryHolder.d(IRegistry.BIOME_REGISTRY), this.registryHolder.d(IRegistry.NOISE_GENERATOR_SETTINGS_REGISTRY), (new Random()).nextLong());
|
||||
- } else {
|
||||
- dimensionmanager = worlddimension.b();
|
||||
- object = worlddimension.c();
|
||||
@ -331,28 +339,28 @@
|
||||
+ worldserver.getWorld().getPopulators().addAll(worldserver.generator.getDefaultPopulators(worldserver.getWorld()));
|
||||
}
|
||||
-
|
||||
- WorldServer worldserver = new WorldServer(this, this.executorService, this.convertable, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, dimensionmanager, worldloadlistener, (ChunkGenerator) object, flag, j, list, true);
|
||||
-
|
||||
- this.worldServer.put(World.OVERWORLD, worldserver);
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getWorldPersistentData();
|
||||
-
|
||||
- this.initializeScoreboards(worldpersistentdata);
|
||||
- this.persistentCommandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
|
||||
worldborder.a(iworlddataserver.r());
|
||||
+ this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(worldserver.getWorld())); // CraftBukkit - SPIGOT-5569
|
||||
if (!iworlddataserver.p()) {
|
||||
try {
|
||||
a(worldserver, iworlddataserver, generatorsettings.c(), flag, true);
|
||||
@@ -372,31 +581,8 @@
|
||||
a(worldserver, iworlddataserver, generatorsettings.c(), flag);
|
||||
@@ -425,31 +634,8 @@
|
||||
|
||||
iworlddataserver.c(true);
|
||||
}
|
||||
-
|
||||
- this.getPlayerList().setPlayerFileData(worldserver);
|
||||
- if (this.saveData.getCustomBossEvents() != null) {
|
||||
- this.getBossBattleCustomData().load(this.saveData.getCustomBossEvents());
|
||||
- if (this.worldData.getCustomBossEvents() != null) {
|
||||
- this.getBossBattleCustomData().load(this.worldData.getCustomBossEvents());
|
||||
- }
|
||||
-
|
||||
- Iterator iterator = registrymaterials.d().iterator();
|
||||
@ -362,23 +370,23 @@
|
||||
- ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
|
||||
-
|
||||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.a(IRegistry.L, resourcekey.a());
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.a(IRegistry.DIMENSION_REGISTRY, resourcekey.a());
|
||||
- DimensionManager dimensionmanager1 = ((WorldDimension) entry.getValue()).b();
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) entry.getValue()).c();
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.saveData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executorService, this.convertable, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, dimensionmanager1, worldloadlistener, chunkgenerator, flag, j, ImmutableList.of(), false);
|
||||
-
|
||||
- worldborder.a((IWorldBorderListener) (new IWorldBorderListener.a(worldserver1.getWorldBorder())));
|
||||
- this.worldServer.put(resourcekey1, worldserver1);
|
||||
- this.levels.put(resourcekey1, worldserver1);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1, boolean flag2) {
|
||||
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
|
||||
@@ -412,6 +598,21 @@
|
||||
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -462,6 +648,21 @@
|
||||
return biomebase.b().b();
|
||||
}, random);
|
||||
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
|
||||
@ -400,60 +408,58 @@
|
||||
|
||||
if (blockposition == null) {
|
||||
MinecraftServer.LOGGER.warn("Unable to find spawn biome");
|
||||
@@ -478,8 +679,15 @@
|
||||
@@ -536,8 +737,15 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
- public void loadSpawn(WorldLoadListener worldloadlistener) {
|
||||
- WorldServer worldserver = this.E();
|
||||
- WorldServer worldserver = this.F();
|
||||
+ // CraftBukkit start
|
||||
+ public void loadSpawn(WorldLoadListener worldloadlistener, WorldServer worldserver) {
|
||||
+ if (!worldserver.getWorld().getKeepSpawnInMemory()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // WorldServer worldserver = this.E();
|
||||
+ // WorldServer worldserver = this.F();
|
||||
+ this.forceTicks = true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
|
||||
BlockPosition blockposition = worldserver.getSpawn();
|
||||
@@ -492,17 +700,21 @@
|
||||
@@ -550,16 +758,20 @@
|
||||
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
|
||||
while (chunkproviderserver.b() != 441) {
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
- Iterator iterator = this.worldServer.values().iterator();
|
||||
- Iterator iterator = this.levels.values().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
- WorldServer worldserver1 = (WorldServer) iterator.next();
|
||||
- ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ // this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
+ this.executeModerately();
|
||||
+ // Iterator iterator = this.worldServer.values().iterator();
|
||||
+
|
||||
+ if (true) {
|
||||
+ WorldServer worldserver1 = worldserver;
|
||||
+ ForcedChunk forcedchunk = (ForcedChunk) worldserver.getWorldPersistentData().b(ForcedChunk::new, "chunks");
|
||||
+ // CraftBukkit end
|
||||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getWorldPersistentData().a(ForcedChunk::b, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
LongIterator longiterator = forcedchunk.a().iterator();
|
||||
@@ -516,11 +728,18 @@
|
||||
@@ -574,11 +786,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.nextTickTime = SystemUtils.getMonotonicMillis() + 10L;
|
||||
- this.sleepForTick();
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTick = SystemUtils.getMonotonicMillis() + 10L;
|
||||
@ -471,24 +477,24 @@
|
||||
}
|
||||
|
||||
protected void loadResourcesZip() {
|
||||
@@ -565,12 +784,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.savingDisabled && !flag2);
|
||||
@@ -623,12 +842,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - moved to WorldServer.save
|
||||
+ /*
|
||||
WorldServer worldserver1 = this.E();
|
||||
IWorldDataServer iworlddataserver = this.saveData.H();
|
||||
WorldServer worldserver1 = this.F();
|
||||
IWorldDataServer iworlddataserver = this.worldData.H();
|
||||
|
||||
iworlddataserver.a(worldserver1.getWorldBorder().t());
|
||||
this.saveData.setCustomBossEvents(this.getBossBattleCustomData().save());
|
||||
this.convertable.a(this.customRegistry, this.saveData, this.getPlayerList().save());
|
||||
this.worldData.setCustomBossEvents(this.getBossBattleCustomData().save());
|
||||
this.storageSource.a(this.registryHolder, this.worldData, this.getPlayerList().save());
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
return flag3;
|
||||
}
|
||||
|
||||
@@ -579,8 +802,29 @@
|
||||
@@ -637,8 +860,29 @@
|
||||
this.stop();
|
||||
}
|
||||
|
||||
@ -502,7 +508,7 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void stop() {
|
||||
public void stop() {
|
||||
+ // CraftBukkit start - prevent double stopping on multiple threads
|
||||
+ synchronized(stopLock) {
|
||||
+ if (hasStopped) return;
|
||||
@ -518,7 +524,7 @@
|
||||
if (this.getServerConnection() != null) {
|
||||
this.getServerConnection().b();
|
||||
}
|
||||
@@ -589,6 +833,7 @@
|
||||
@@ -647,6 +891,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.savePlayers();
|
||||
this.playerList.shutdown();
|
||||
@ -526,25 +532,27 @@
|
||||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -666,14 +911,16 @@
|
||||
while (this.isRunning) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
|
||||
@@ -724,9 +969,10 @@
|
||||
while (this.running) {
|
||||
long i = SystemUtils.getMonotonicMillis() - this.nextTickTime;
|
||||
|
||||
- if (i > 2000L && this.nextTick - this.lastOverloadTime >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTick - this.lastOverloadTime >= 30000L) { // CraftBukkit
|
||||
- if (i > 2000L && this.nextTickTime - this.lastOverloadWarning >= 15000L) {
|
||||
+ if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
|
||||
long j = i / 50L;
|
||||
|
||||
+ if (server.getWarnOnOverload()) // CraftBukkit
|
||||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTick += j * 50L;
|
||||
this.lastOverloadTime = this.nextTick;
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -737,6 +983,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.a(SystemUtils.getMonotonicNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
|
||||
this.nextTick += 50L;
|
||||
GameProfilerTick gameprofilertick = GameProfilerTick.a("Server");
|
||||
|
||||
@@ -719,6 +966,12 @@
|
||||
this.nextTickTime += 50L;
|
||||
this.bi();
|
||||
this.profiler.enter("tick");
|
||||
@@ -782,6 +1029,12 @@
|
||||
} catch (Throwable throwable1) {
|
||||
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
|
||||
} finally {
|
||||
@ -557,13 +565,13 @@
|
||||
this.exit();
|
||||
}
|
||||
|
||||
@@ -727,8 +980,15 @@
|
||||
@@ -790,8 +1043,15 @@
|
||||
}
|
||||
|
||||
private boolean canSleepForTick() {
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick);
|
||||
- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick);
|
||||
+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ }
|
||||
+
|
||||
+ private void executeModerately() {
|
||||
@ -574,23 +582,23 @@
|
||||
|
||||
protected void sleepForTick() {
|
||||
this.executeAll();
|
||||
@@ -834,7 +1094,7 @@
|
||||
this.serverPing.b().a(agameprofile);
|
||||
@@ -906,7 +1166,7 @@
|
||||
this.status.b().a(agameprofile);
|
||||
}
|
||||
|
||||
- if (this.ticks % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit
|
||||
- if (this.tickCount % 6000 == 0) {
|
||||
+ if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // CraftBukkit
|
||||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.methodProfiler.enter("save");
|
||||
this.profiler.enter("save");
|
||||
this.playerList.savePlayers();
|
||||
@@ -864,22 +1124,39 @@
|
||||
@@ -936,22 +1196,39 @@
|
||||
}
|
||||
|
||||
protected void b(BooleanSupplier booleansupplier) {
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit
|
||||
this.methodProfiler.enter("commandFunctions");
|
||||
public void b(BooleanSupplier booleansupplier) {
|
||||
+ this.server.getScheduler().mainThreadHeartbeat(this.tickCount); // CraftBukkit
|
||||
this.profiler.enter("commandFunctions");
|
||||
this.getFunctionData().tick();
|
||||
this.methodProfiler.exitEnter("levels");
|
||||
this.profiler.exitEnter("levels");
|
||||
Iterator iterator = this.getWorlds().iterator();
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -600,59 +608,59 @@
|
||||
+ }
|
||||
+
|
||||
+ // Send time updates to everyone, it will get the right time from the world the player is in.
|
||||
+ if (this.ticks % 20 == 0) {
|
||||
+ if (this.tickCount % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))); // Add support for per player time
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutUpdateTime(entityplayer.level.getTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
this.methodProfiler.a(() -> {
|
||||
this.profiler.a(() -> {
|
||||
return worldserver + " " + worldserver.getDimensionKey().a();
|
||||
});
|
||||
+ /* Drop global time updates
|
||||
if (this.ticks % 20 == 0) {
|
||||
this.methodProfiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE))), worldserver.getDimensionKey());
|
||||
this.methodProfiler.exit();
|
||||
if (this.tickCount % 20 == 0) {
|
||||
this.profiler.enter("timeSync");
|
||||
this.playerList.a((Packet) (new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))), worldserver.getDimensionKey());
|
||||
this.profiler.exit();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.methodProfiler.enter("tick");
|
||||
this.profiler.enter("tick");
|
||||
|
||||
@@ -963,7 +1240,7 @@
|
||||
}
|
||||
@@ -1040,7 +1317,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
- return "vanilla";
|
||||
+ return server.getName(); // CraftBukkit - cb > vanilla!
|
||||
}
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
@@ -1320,16 +1597,17 @@
|
||||
public SystemReport b(SystemReport systemreport) {
|
||||
@@ -1412,16 +1689,17 @@
|
||||
|
||||
public CompletableFuture<Void> a(Collection<String> collection) {
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream stream = collection.stream();
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
ResourcePackRepository resourcepackrepository = this.resourcePackRepository;
|
||||
ResourcePackRepository resourcepackrepository = this.packRepository;
|
||||
|
||||
this.resourcePackRepository.getClass();
|
||||
Objects.requireNonNull(this.packRepository);
|
||||
- return (ImmutableList) stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList());
|
||||
+ return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error
|
||||
}, this).thenCompose((immutablelist) -> {
|
||||
return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this);
|
||||
return DataPackResources.a(immutablelist, this.registryHolder, this.k() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.i(), this.executor, this);
|
||||
}).thenAcceptAsync((datapackresources) -> {
|
||||
this.dataPackResources.close();
|
||||
this.dataPackResources = datapackresources;
|
||||
this.resources.close();
|
||||
this.resources = datapackresources;
|
||||
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
this.resourcePackRepository.a(collection);
|
||||
this.saveData.a(a(this.resourcePackRepository));
|
||||
datapackresources.i();
|
||||
@@ -1695,6 +1973,22 @@
|
||||
this.packRepository.a(collection);
|
||||
this.worldData.a(a(this.packRepository));
|
||||
datapackresources.j();
|
||||
@@ -1766,6 +2044,22 @@
|
||||
|
||||
}
|
||||
|
||||
@ -672,6 +680,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private void a(@Nullable GameProfilerTick gameprofilertick) {
|
||||
if (this.O) {
|
||||
this.O = false;
|
||||
private void bi() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.a(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.k()), SystemUtils.timeSource, SystemUtils.g(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
|
@ -1,100 +1,100 @@
|
||||
--- a/net/minecraft/server/ScoreboardServer.java
|
||||
+++ b/net/minecraft/server/ScoreboardServer.java
|
||||
@@ -32,7 +32,7 @@
|
||||
@@ -34,7 +34,7 @@
|
||||
public void handleScoreChanged(ScoreboardScore scoreboardscore) {
|
||||
super.handleScoreChanged(scoreboardscore);
|
||||
if (this.b.contains(scoreboardscore.getObjective())) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
if (this.trackedObjectives.contains(scoreboardscore.getObjective())) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getPlayerName(), scoreboardscore.getScore()));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -41,7 +41,7 @@
|
||||
this.a();
|
||||
@@ -43,7 +43,7 @@
|
||||
@Override
|
||||
public void handlePlayerRemoved(String s) {
|
||||
super.handlePlayerRemoved(s);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
|
||||
this.b();
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
@@ -51,7 +51,7 @@
|
||||
public void a(String s, ScoreboardObjective scoreboardobjective) {
|
||||
super.a(s, scoreboardobjective);
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -62,7 +62,7 @@
|
||||
this.a();
|
||||
@@ -64,7 +64,7 @@
|
||||
super.setDisplaySlot(i, scoreboardobjective);
|
||||
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
||||
if (this.h(scoreboardobjective1) > 0) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
} else {
|
||||
this.g(scoreboardobjective1);
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
if (scoreboardobjective != null) {
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective));
|
||||
} else {
|
||||
this.e(scoreboardobjective);
|
||||
}
|
||||
@@ -82,7 +82,7 @@
|
||||
@@ -84,7 +84,7 @@
|
||||
@Override
|
||||
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
if (super.addPlayerToTeam(s, scoreboardteam)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 3));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
|
||||
this.a();
|
||||
return true;
|
||||
} else {
|
||||
@@ -93,7 +93,7 @@
|
||||
@@ -95,7 +95,7 @@
|
||||
@Override
|
||||
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
super.removePlayerFromTeam(s, scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(s), 4));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@
|
||||
@@ -109,7 +109,7 @@
|
||||
public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) {
|
||||
super.handleObjectiveChanged(scoreboardobjective);
|
||||
if (this.b.contains(scoreboardobjective)) {
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
- this.server.getPlayerList().sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
|
||||
}
|
||||
|
||||
this.b();
|
||||
@@ -126,21 +126,21 @@
|
||||
this.a();
|
||||
@@ -128,21 +128,21 @@
|
||||
@Override
|
||||
public void handleTeamAdded(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamAdded(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, true));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, true));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTeamChanged(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamChanged(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, false));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam, false));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleTeamRemoved(ScoreboardTeam scoreboardteam) {
|
||||
super.handleTeamRemoved(scoreboardteam);
|
||||
- this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1));
|
||||
+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1));
|
||||
this.b();
|
||||
- this.server.getPlayerList().sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam));
|
||||
+ this.sendAll(PacketPlayOutScoreboardTeam.a(scoreboardteam));
|
||||
this.a();
|
||||
}
|
||||
|
||||
@@ -189,6 +189,7 @@
|
||||
@ -113,15 +113,15 @@
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -245,6 +247,16 @@
|
||||
return i;
|
||||
@@ -257,6 +259,16 @@
|
||||
return this.b().b(nbttagcompound);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send to players
|
||||
+ private void sendAll(Packet packet) {
|
||||
+ for (EntityPlayer entityplayer : (List<EntityPlayer>) this.a.getPlayerList().players) {
|
||||
+ for (EntityPlayer entityplayer : (List<EntityPlayer>) this.server.getPlayerList().players) {
|
||||
+ if (entityplayer.getBukkitEntity().getScoreboard().getHandle() == this) {
|
||||
+ entityplayer.playerConnection.sendPacket(packet);
|
||||
+ entityplayer.connection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
@ -11,10 +11,10 @@
|
||||
+
|
||||
public class BossBattleCustom extends BossBattleServer {
|
||||
|
||||
private final MinecraftKey h;
|
||||
private final Set<UUID> i = Sets.newHashSet();
|
||||
private int j;
|
||||
private int k = 100;
|
||||
private final MinecraftKey id;
|
||||
private final Set<UUID> players = Sets.newHashSet();
|
||||
private int value;
|
||||
private int max = 100;
|
||||
+ // CraftBukkit start
|
||||
+ private KeyedBossBar bossBar;
|
||||
+
|
||||
|
@ -1,15 +1,15 @@
|
||||
--- a/net/minecraft/server/commands/CommandEffect.java
|
||||
+++ b/net/minecraft/server/commands/CommandEffect.java
|
||||
@@ -71,7 +71,7 @@
|
||||
@@ -73,7 +73,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect)) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity())) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -99,7 +99,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@
|
||||
@@ -124,7 +124,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
@ -1,15 +0,0 @@
|
||||
--- a/net/minecraft/server/commands/CommandGamemode.java
|
||||
+++ b/net/minecraft/server/commands/CommandGamemode.java
|
||||
@@ -63,6 +63,12 @@
|
||||
|
||||
if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
entityplayer.a(enumgamemode);
|
||||
+ // CraftBukkit start - handle event cancelling the change
|
||||
+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) {
|
||||
+ commandcontext.getSource().sendFailureMessage(new net.minecraft.network.chat.ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
a((CommandListenerWrapper) commandcontext.getSource(), entityplayer, enumgamemode);
|
||||
++i;
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
--- a/net/minecraft/server/commands/CommandGamerule.java
|
||||
+++ b/net/minecraft/server/commands/CommandGamerule.java
|
||||
@@ -29,7 +29,7 @@
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
static <T extends GameRules.GameRuleValue<T>> int a(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.b(commandcontext, "value");
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
|
||||
@@ -37,7 +37,7 @@
|
||||
@@ -39,7 +39,7 @@
|
||||
}
|
||||
|
||||
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
static <T extends GameRules.GameRuleValue<T>> int a(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().get(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandList.java
|
||||
+++ b/net/minecraft/server/commands/CommandList.java
|
||||
@@ -36,6 +36,12 @@
|
||||
@@ -37,6 +37,12 @@
|
||||
private static int a(CommandListenerWrapper commandlistenerwrapper, Function<EntityPlayer, IChatBaseComponent> function) {
|
||||
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
|
||||
List<EntityPlayer> list = playerlist.getPlayers();
|
||||
@ -10,6 +10,6 @@
|
||||
+ list = list.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChatMutableComponent ichatmutablecomponent = ChatComponentUtils.b(list, function);
|
||||
IChatBaseComponent ichatbasecomponent = ChatComponentUtils.b(list, function);
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.list.players", new Object[]{list.size(), playerlist.getMaxPlayers(), ichatmutablecomponent}), false);
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.list.players", new Object[]{list.size(), playerlist.getMaxPlayers(), ichatbasecomponent}), false);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandReload.java
|
||||
+++ b/net/minecraft/server/commands/CommandReload.java
|
||||
@@ -42,6 +42,16 @@
|
||||
@@ -44,6 +44,16 @@
|
||||
return collection1;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
@@ -77,7 +77,7 @@
|
||||
@@ -80,7 +80,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getScoreboardTeam());
|
||||
} else {
|
||||
@ -9,27 +9,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@
|
||||
@@ -289,7 +289,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
|
||||
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
|
||||
blockposition_mutableblockposition.c(EnumDirection.DOWN);
|
||||
- flag1 = iblockaccess.getType(blockposition_mutableblockposition).isAir();
|
||||
+ flag1 = getType(iblockaccess, blockposition_mutableblockposition).isAir(); // CraftBukkit
|
||||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -299,7 +299,7 @@
|
||||
@@ -302,7 +302,7 @@
|
||||
|
||||
public boolean b(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
|
||||
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.a(iblockaccess, i) - 1), this.z);
|
||||
- IBlockData iblockdata = iblockaccess.getType(blockposition);
|
||||
+ IBlockData iblockdata = getType(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -309,5 +309,12 @@
|
||||
this.a = MathHelper.a(random, d0, d2);
|
||||
this.b = MathHelper.a(random, d1, d3);
|
||||
@@ -312,5 +312,12 @@
|
||||
this.x = MathHelper.a(random, d0, d2);
|
||||
this.z = MathHelper.a(random, d1, d3);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - add a version of getType which force loads chunks
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- a/net/minecraft/server/commands/CommandSummon.java
|
||||
+++ b/net/minecraft/server/commands/CommandSummon.java
|
||||
@@ -64,7 +64,7 @@
|
||||
@@ -66,7 +66,7 @@
|
||||
((EntityInsentient) entity).prepare(commandlistenerwrapper.getWorld(), commandlistenerwrapper.getWorld().getDamageScaler(entity.getChunkCoordinates()), EnumMobSpawn.COMMAND, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
}
|
||||
|
||||
- if (!worldserver.addAllEntitiesSafely(entity)) {
|
||||
+ if (!worldserver.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
|
||||
throw CommandSummon.b.create();
|
||||
throw CommandSummon.ERROR_DUPLICATE_UUID.create();
|
||||
} else {
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.summon.success", new Object[]{entity.getScoreboardDisplayName()}), true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/commands/CommandTeleport.java
|
||||
+++ b/net/minecraft/server/commands/CommandTeleport.java
|
||||
@@ -35,6 +35,12 @@
|
||||
@@ -36,6 +36,12 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
@ -12,25 +12,23 @@
|
||||
+
|
||||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
|
||||
@@ -150,9 +156,9 @@
|
||||
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
|
||||
@@ -160,14 +166,29 @@
|
||||
}
|
||||
|
||||
if (worldserver == entity.world) {
|
||||
- ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set);
|
||||
+ ((EntityPlayer) entity).playerConnection.a(d0, d1, d2, f, f1, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
if (worldserver == entity.level) {
|
||||
- ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set);
|
||||
+ ((EntityPlayer) entity).connection.a(d0, d1, d2, f2, f3, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
} else {
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f, f1, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
- ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3);
|
||||
+ ((EntityPlayer) entity).a(worldserver, d0, d1, d2, f2, f3, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit
|
||||
}
|
||||
|
||||
entity.setHeadRotation(f);
|
||||
@@ -161,6 +167,21 @@
|
||||
float f3 = MathHelper.g(f1);
|
||||
|
||||
f3 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
entity.setHeadRotation(f2);
|
||||
} else {
|
||||
float f4 = MathHelper.a(f3, -90.0F, 90.0F);
|
||||
+ // CraftBukkit start - Teleport event
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
|
||||
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
|
||||
+ worldserver.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
@ -41,9 +39,9 @@
|
||||
+ d1 = to.getY();
|
||||
+ d2 = to.getZ();
|
||||
+ f2 = to.getYaw();
|
||||
+ f3 = to.getPitch();
|
||||
+ f4 = to.getPitch();
|
||||
+ worldserver = ((CraftWorld) to.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
if (worldserver == entity.world) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f3);
|
||||
entity.setHeadRotation(f2);
|
||||
|
||||
if (worldserver == entity.level) {
|
||||
entity.setPositionRotation(d0, d1, d2, f2, f4);
|
||||
|
@ -11,8 +11,8 @@
|
||||
+
|
||||
public class CommandTime {
|
||||
|
||||
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
|
||||
@@ -51,7 +56,13 @@
|
||||
public CommandTime() {}
|
||||
@@ -53,7 +58,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
|
||||
@@ -64,7 +75,13 @@
|
||||
@@ -66,7 +77,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -60,6 +60,15 @@
|
||||
@@ -64,6 +64,15 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -15,10 +15,10 @@
|
||||
+
|
||||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -74,8 +83,10 @@
|
||||
static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -82,8 +91,10 @@
|
||||
@Nullable
|
||||
private final TextFilter r;
|
||||
private final IChatBaseComponent resourcePackPrompt;
|
||||
|
||||
- public DedicatedServer(Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- super(thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
|
||||
@ -26,10 +26,10 @@
|
||||
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, Thread thread, IRegistryCustom.Dimension iregistrycustom_dimension, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, DataPackResources datapackresources, SaveData savedata, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ super(options, datapackconfiguration, thread, iregistrycustom_dimension, convertable_conversionsession, savedata, resourcepackrepository, Proxy.NO_PROXY, datafixer, datapackresources, minecraftsessionservice, gameprofilerepository, usercache, worldloadlistenerfactory);
|
||||
+ // CraftBukkit end
|
||||
this.propertyManager = dedicatedserversettings;
|
||||
this.remoteControlCommandListener = new RemoteControlCommandListener(this);
|
||||
this.r = null;
|
||||
@@ -85,13 +96,44 @@
|
||||
this.settings = dedicatedserversettings;
|
||||
this.rconConsoleSource = new RemoteControlCommandListener(this);
|
||||
this.textFilterClient = TextFilter.a(dedicatedserversettings.getProperties().textFilteringConfig);
|
||||
@@ -94,13 +105,44 @@
|
||||
public boolean init() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
@ -77,7 +77,7 @@
|
||||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -100,6 +142,27 @@
|
||||
@@ -109,6 +151,27 @@
|
||||
}
|
||||
};
|
||||
|
||||
@ -105,21 +105,21 @@
|
||||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
|
||||
thread.start();
|
||||
@@ -126,7 +189,7 @@
|
||||
this.setForceGamemode(dedicatedserverproperties.forceGamemode);
|
||||
@@ -134,7 +197,7 @@
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
|
||||
this.i(dedicatedserverproperties.enforceWhitelist);
|
||||
- this.saveData.setGameType(dedicatedserverproperties.gamemode);
|
||||
+ // this.saveData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
|
||||
this.h(dedicatedserverproperties.enforceWhitelist);
|
||||
- this.worldData.setGameType(dedicatedserverproperties.gamemode);
|
||||
+ // this.worldData.setGameType(dedicatedserverproperties.gamemode); // CraftBukkit - moved to world loading
|
||||
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
@@ -150,6 +213,12 @@
|
||||
@@ -158,6 +221,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage)));
|
||||
+ this.a((PlayerList) (new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)));
|
||||
+ server.loadPlugins();
|
||||
+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
+ // CraftBukkit end
|
||||
@ -127,47 +127,46 @@
|
||||
if (!this.getOnlineMode()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -164,7 +233,7 @@
|
||||
@@ -172,14 +241,14 @@
|
||||
if (!NameReferencingFileConverter.e(this)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage)));
|
||||
- this.a((PlayerList) (new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage)));
|
||||
+ // this.a((PlayerList) (new DedicatedPlayerList(this, this.customRegistry, this.worldNBTStorage))); // CraftBukkit - moved up
|
||||
long i = SystemUtils.getMonotonicNanos();
|
||||
|
||||
this.c(dedicatedserverproperties.maxBuildHeight);
|
||||
@@ -172,7 +241,7 @@
|
||||
TileEntitySkull.a(this.getUserCache());
|
||||
TileEntitySkull.a(this.getMinecraftSessionService());
|
||||
UserCache.a(this.getOnlineMode());
|
||||
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
|
||||
- this.loadWorld();
|
||||
+ this.loadWorld(convertable.getLevelName()); // CraftBukkit
|
||||
+ this.loadWorld(storageSource.getLevelName()); // CraftBukkit
|
||||
long j = SystemUtils.getMonotonicNanos() - i;
|
||||
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
|
||||
|
||||
@@ -189,6 +258,7 @@
|
||||
@@ -196,6 +265,7 @@
|
||||
if (dedicatedserverproperties.enableRcon) {
|
||||
DedicatedServer.LOGGER.info("Starting remote control listener");
|
||||
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.remoteControlCommandListener); // CraftBukkit
|
||||
this.rconThread = RemoteControlListener.a((IMinecraftServer) this);
|
||||
+ this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(this.rconConsoleSource); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.getMaxTickTime() > 0L) {
|
||||
@@ -303,6 +373,7 @@
|
||||
this.remoteStatusListener.b();
|
||||
@@ -345,6 +415,7 @@
|
||||
this.queryThreadGs4.b();
|
||||
}
|
||||
|
||||
+ System.exit(0); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -331,7 +402,15 @@
|
||||
while (!this.serverCommandQueue.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
|
||||
@@ -378,7 +449,15 @@
|
||||
while (!this.consoleInput.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
|
||||
|
||||
- this.getCommandDispatcher().a(servercommand.source, servercommand.command);
|
||||
- this.getCommandDispatcher().a(servercommand.source, servercommand.msg);
|
||||
+ // CraftBukkit start - ServerCommand for preprocessing
|
||||
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
|
||||
+ ServerCommandEvent event = new ServerCommandEvent(console, servercommand.msg);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) continue;
|
||||
+ servercommand = new ServerCommand(event.getCommand(), servercommand.source);
|
||||
@ -178,7 +177,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -541,14 +620,45 @@
|
||||
@@ -583,14 +662,45 @@
|
||||
|
||||
@Override
|
||||
public String getPlugins() {
|
||||
@ -211,24 +210,24 @@
|
||||
|
||||
@Override
|
||||
public String executeRemoteCommand(String s) {
|
||||
this.remoteControlCommandListener.clearMessages();
|
||||
this.rconConsoleSource.clearMessages();
|
||||
this.executeSync(() -> {
|
||||
- this.getCommandDispatcher().a(this.remoteControlCommandListener.getWrapper(), s);
|
||||
- this.getCommandDispatcher().a(this.rconConsoleSource.getWrapper(), s);
|
||||
+ // CraftBukkit start - fire RemoteServerCommandEvent
|
||||
+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s);
|
||||
+ server.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.getWrapper());
|
||||
+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), rconConsoleSource.getWrapper());
|
||||
+ server.dispatchServerCommand(remoteConsole, serverCommand);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
return this.remoteControlCommandListener.getMessages();
|
||||
return this.rconConsoleSource.getMessages();
|
||||
}
|
||||
@@ -590,4 +700,15 @@
|
||||
public ITextFilter a(EntityPlayer entityplayer) {
|
||||
return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
|
||||
@@ -663,4 +773,15 @@
|
||||
public IChatBaseComponent bb() {
|
||||
return this.resourcePackPrompt;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -9,8 +9,14 @@
|
||||
@@ -10,8 +10,14 @@
|
||||
import net.minecraft.world.level.EnumGamemode;
|
||||
import net.minecraft.world.level.levelgen.GeneratorSettings;
|
||||
|
||||
@ -15,35 +15,36 @@
|
||||
public final boolean onlineMode = this.getBoolean("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.getString("server-ip", "");
|
||||
@@ -61,8 +67,10 @@
|
||||
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
|
||||
public final GeneratorSettings generatorSettings;
|
||||
@@ -64,8 +70,10 @@
|
||||
@Nullable
|
||||
public GeneratorSettings worldGenSettings;
|
||||
|
||||
- public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom) {
|
||||
- public DedicatedServerProperties(Properties properties) {
|
||||
- super(properties);
|
||||
+ // CraftBukkit start
|
||||
+ public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) {
|
||||
+ public DedicatedServerProperties(Properties properties, OptionSet optionset) {
|
||||
+ super(properties, optionset);
|
||||
+ // CraftBukkit end
|
||||
this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY);
|
||||
this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL);
|
||||
this.levelName = this.getString("level-name", "world");
|
||||
@@ -113,12 +121,14 @@
|
||||
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
|
||||
@@ -112,13 +120,15 @@
|
||||
this.whiteList = this.b("white-list", false);
|
||||
}
|
||||
|
||||
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path) {
|
||||
- return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom);
|
||||
- public static DedicatedServerProperties load(Path path) {
|
||||
- return new DedicatedServerProperties(loadPropertiesFile(path));
|
||||
+ // CraftBukkit start
|
||||
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom, optionset);
|
||||
+ public static DedicatedServerProperties load(Path path, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(loadPropertiesFile(path), optionset);
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties) {
|
||||
- return new DedicatedServerProperties(properties, iregistrycustom);
|
||||
- DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties);
|
||||
+ protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties, OptionSet optionset) {
|
||||
+ return new DedicatedServerProperties(properties, iregistrycustom, optionset);
|
||||
+ DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties, optionset);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
dedicatedserverproperties.a(iregistrycustom);
|
||||
return dedicatedserverproperties;
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/server/dedicated/DedicatedServerSettings.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerSettings.java
|
||||
@@ -4,14 +4,21 @@
|
||||
@@ -3,14 +3,21 @@
|
||||
import java.nio.file.Path;
|
||||
import java.util.function.UnaryOperator;
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.io.File;
|
||||
@ -11,16 +11,16 @@
|
||||
+
|
||||
public class DedicatedServerSettings {
|
||||
|
||||
private final Path path;
|
||||
private final Path source;
|
||||
private DedicatedServerProperties properties;
|
||||
|
||||
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, Path path) {
|
||||
- this.path = path;
|
||||
- this.properties = DedicatedServerProperties.load(iregistrycustom, path);
|
||||
- public DedicatedServerSettings(Path path) {
|
||||
- this.source = path;
|
||||
- this.properties = DedicatedServerProperties.load(path);
|
||||
+ // CraftBukkit start
|
||||
+ public DedicatedServerSettings(IRegistryCustom iregistrycustom, OptionSet optionset) {
|
||||
+ this.path = ((File) optionset.valueOf("config")).toPath();
|
||||
+ this.properties = DedicatedServerProperties.load(iregistrycustom, path, optionset);
|
||||
+ public DedicatedServerSettings(OptionSet optionset) {
|
||||
+ this.source = ((File) optionset.valueOf("config")).toPath();
|
||||
+ this.properties = DedicatedServerProperties.load(source, optionset);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
public static Properties loadPropertiesFile(Path path) {
|
||||
Properties properties = new Properties();
|
||||
|
||||
@@ -61,6 +76,11 @@
|
||||
@@ -58,6 +73,11 @@
|
||||
|
||||
public void savePropertiesFile(Path path) {
|
||||
try {
|
||||
@ -42,9 +42,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
OutputStream outputstream = Files.newOutputStream(path);
|
||||
Throwable throwable = null;
|
||||
|
||||
@@ -92,7 +112,7 @@
|
||||
try {
|
||||
@@ -86,7 +106,7 @@
|
||||
private static <V extends Number> Function<String, V> a(Function<String, V> function) {
|
||||
return (s) -> {
|
||||
try {
|
||||
@ -53,7 +53,7 @@
|
||||
} catch (NumberFormatException numberformatexception) {
|
||||
return null;
|
||||
}
|
||||
@@ -111,7 +131,7 @@
|
||||
@@ -105,7 +125,7 @@
|
||||
|
||||
@Nullable
|
||||
private String c(String s) {
|
||||
@ -62,7 +62,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -139,7 +159,7 @@
|
||||
@@ -133,7 +153,7 @@
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
this.properties.put(s, function1.apply(v1));
|
||||
@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
protected <V> V a(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
|
||||
@@ -168,7 +188,7 @@
|
||||
@@ -162,7 +182,7 @@
|
||||
}
|
||||
|
||||
protected int getInt(String s, int i) {
|
||||
@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
|
||||
@@ -180,7 +200,7 @@
|
||||
@@ -174,7 +194,7 @@
|
||||
}
|
||||
|
||||
protected long getLong(String s, long i) {
|
||||
@ -89,7 +89,7 @@
|
||||
}
|
||||
|
||||
protected boolean getBoolean(String s, boolean flag) {
|
||||
@@ -203,7 +223,7 @@
|
||||
@@ -197,7 +217,7 @@
|
||||
return properties;
|
||||
}
|
||||
|
||||
@ -98,19 +98,19 @@
|
||||
|
||||
public class EditableProperty<V> implements Supplier<V> {
|
||||
|
||||
@@ -211,7 +231,7 @@
|
||||
private final V c;
|
||||
private final Function<V, String> d;
|
||||
@@ -205,7 +225,7 @@
|
||||
private final V value;
|
||||
private final Function<V, String> serializer;
|
||||
|
||||
- private EditableProperty(String s, Object object, Function function) {
|
||||
+ private EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
|
||||
this.b = s;
|
||||
this.c = object;
|
||||
this.d = function;
|
||||
@@ -225,7 +245,7 @@
|
||||
- EditableProperty(String s, Object object, Function function) {
|
||||
+ EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
|
||||
this.key = s;
|
||||
this.value = object;
|
||||
this.serializer = function;
|
||||
@@ -219,7 +239,7 @@
|
||||
Properties properties = PropertyManager.this.a();
|
||||
|
||||
properties.put(this.b, this.d.apply(v0));
|
||||
properties.put(this.key, this.serializer.apply(v0));
|
||||
- return PropertyManager.this.reload(iregistrycustom, properties);
|
||||
+ return PropertyManager.this.reload(iregistrycustom, properties, PropertyManager.this.options); // CraftBukkit
|
||||
}
|
||||
|
@ -1,14 +1,23 @@
|
||||
--- a/net/minecraft/server/gui/ServerGUI.java
|
||||
+++ b/net/minecraft/server/gui/ServerGUI.java
|
||||
@@ -160,6 +160,7 @@
|
||||
this.e.forEach(Runnable::run);
|
||||
@@ -96,7 +96,7 @@
|
||||
private JComponent c() {
|
||||
JPanel jpanel = new JPanel(new BorderLayout());
|
||||
GuiStatsComponent guistatscomponent = new GuiStatsComponent(this.server);
|
||||
- Collection collection = this.finalizers;
|
||||
+ Collection<Runnable> collection = this.finalizers; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(guistatscomponent);
|
||||
collection.add(guistatscomponent::a);
|
||||
@@ -166,6 +166,7 @@
|
||||
this.finalizers.forEach(Runnable::run);
|
||||
}
|
||||
|
||||
+ private static final java.util.regex.Pattern ANSI = java.util.regex.Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})*)?[m|K]"); // CraftBukkit
|
||||
public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) {
|
||||
if (!SwingUtilities.isEventDispatchThread()) {
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
@@ -175,7 +176,7 @@
|
||||
@@ -181,7 +182,7 @@
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -1,64 +1,64 @@
|
||||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -65,7 +65,7 @@
|
||||
@@ -73,7 +73,7 @@
|
||||
while (objectiterator.hasNext()) {
|
||||
Entry<ArraySetSorted<Ticket<?>>> entry = (Entry) objectiterator.next();
|
||||
|
||||
- if (((ArraySetSorted) entry.getValue()).removeIf((ticket) -> {
|
||||
+ if ((entry.getValue()).removeIf((ticket) -> { // CraftBukkit - decompile error
|
||||
return ticket.b(this.currentTick);
|
||||
return ticket.b(this.ticketTickCounter);
|
||||
})) {
|
||||
this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
|
||||
@@ -101,10 +101,25 @@
|
||||
this.ticketTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
|
||||
@@ -109,10 +109,25 @@
|
||||
}
|
||||
|
||||
if (!this.pendingChunkUpdates.isEmpty()) {
|
||||
- this.pendingChunkUpdates.forEach((playerchunk) -> {
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
||||
+ // CraftBukkit start
|
||||
+ // Iterate pending chunk updates with protection against concurrent modification exceptions
|
||||
+ java.util.Iterator<PlayerChunk> iter = this.pendingChunkUpdates.iterator();
|
||||
+ int expectedSize = this.pendingChunkUpdates.size();
|
||||
+ java.util.Iterator<PlayerChunk> iter = this.chunksToUpdateFutures.iterator();
|
||||
+ int expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ do {
|
||||
+ PlayerChunk playerchunk = iter.next();
|
||||
+ iter.remove();
|
||||
+ expectedSize--;
|
||||
+
|
||||
playerchunk.a(playerchunkmap);
|
||||
playerchunk.a(playerchunkmap, this.mainThreadExecutor);
|
||||
- });
|
||||
- this.pendingChunkUpdates.clear();
|
||||
- this.chunksToUpdateFutures.clear();
|
||||
+
|
||||
+ // Reset iterator if set was modified using add()
|
||||
+ if (this.pendingChunkUpdates.size() != expectedSize) {
|
||||
+ expectedSize = this.pendingChunkUpdates.size();
|
||||
+ iter = this.pendingChunkUpdates.iterator();
|
||||
+ if (this.chunksToUpdateFutures.size() != expectedSize) {
|
||||
+ expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ iter = this.chunksToUpdateFutures.iterator();
|
||||
+ }
|
||||
+ } while (iter.hasNext());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
return true;
|
||||
} else {
|
||||
if (!this.l.isEmpty()) {
|
||||
@@ -140,23 +155,25 @@
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -148,23 +163,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
- private void addTicket(long i, Ticket<?> ticket) {
|
||||
+ private boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
- void addTicket(long i, Ticket<?> ticket) {
|
||||
+ boolean addTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
|
||||
int j = getLowestTicketLevel(arraysetsorted);
|
||||
- Ticket<?> ticket1 = (Ticket) arraysetsorted.a((Object) ticket);
|
||||
+ Ticket<?> ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error
|
||||
|
||||
ticket1.a(this.currentTick);
|
||||
ticket1.a(this.ticketTickCounter);
|
||||
if (ticket.b() < j) {
|
||||
this.ticketLevelTracker.update(i, ticket.b(), true);
|
||||
this.ticketTracker.update(i, ticket.b(), true);
|
||||
}
|
||||
|
||||
+ return ticket == ticket1; // CraftBukkit
|
||||
}
|
||||
|
||||
- private void removeTicket(long i, Ticket<?> ticket) {
|
||||
+ private boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
- void removeTicket(long i, Ticket<?> ticket) {
|
||||
+ boolean removeTicket(long i, Ticket<?> ticket) { // CraftBukkit - void -> boolean
|
||||
ArraySetSorted<Ticket<?>> arraysetsorted = this.e(i);
|
||||
|
||||
+ boolean removed = false; // CraftBukkit
|
||||
@ -68,10 +68,10 @@
|
||||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -164,16 +181,29 @@
|
||||
@@ -172,16 +189,29 @@
|
||||
}
|
||||
|
||||
this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
|
||||
this.ticketTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
|
||||
+ return removed; // CraftBukkit
|
||||
}
|
||||
|
||||
@ -101,16 +101,16 @@
|
||||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -216,6 +246,7 @@
|
||||
@@ -224,6 +254,7 @@
|
||||
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
|
||||
long i = sectionposition.r().pair();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
+ if (objectset == null) return; // CraftBukkit - SPIGOT-6208
|
||||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -257,6 +288,26 @@
|
||||
return this.i.a();
|
||||
@@ -300,6 +331,26 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -122,7 +122,7 @@
|
||||
+ ArraySetSorted<Ticket<?>> tickets = entry.getValue();
|
||||
+ if (tickets.remove(target)) {
|
||||
+ // copied from removeTicket
|
||||
+ this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel(tickets), false);
|
||||
+ this.ticketTracker.update(entry.getLongKey(), getLowestTicketLevel(tickets), false);
|
||||
+
|
||||
+ // can't use entry after it's removed
|
||||
+ if (tickets.isEmpty()) {
|
||||
@ -133,6 +133,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
class a extends ChunkMap {
|
||||
private class a extends ChunkMap {
|
||||
|
||||
public a() {
|
||||
|
@ -1,12 +1,12 @@
|
||||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -79,6 +79,24 @@
|
||||
@@ -83,6 +83,24 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - properly implement isChunkLoaded
|
||||
+ public boolean isChunkLoaded(int chunkX, int chunkZ) {
|
||||
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ PlayerChunk chunk = this.chunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ if (chunk == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
@ -14,7 +14,7 @@
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkUnchecked(int chunkX, int chunkZ) {
|
||||
+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ PlayerChunk chunk = this.chunkMap.getUpdatingChunk(ChunkCoordIntPair.pair(chunkX, chunkZ));
|
||||
+ if (chunk == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
@ -25,16 +25,16 @@
|
||||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -123,7 +141,7 @@
|
||||
@@ -127,7 +145,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
|
||||
ichunkaccess = this.cacheChunk[l];
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
ichunkaccess = this.lastChunk[l];
|
||||
- if (ichunkaccess != null || !flag) {
|
||||
+ if (ichunkaccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
|
||||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -169,12 +187,12 @@
|
||||
@@ -175,12 +193,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
@ -49,7 +49,7 @@
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.a(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -201,7 +219,15 @@
|
||||
@@ -228,7 +246,15 @@
|
||||
int l = 33 + ChunkStatus.a(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getChunk(k);
|
||||
|
||||
@ -63,10 +63,10 @@
|
||||
+ }
|
||||
+ if (flag && !currentlyUnloading) {
|
||||
+ // CraftBukkit end
|
||||
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
this.distanceManager.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.a(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
@@ -220,7 +246,7 @@
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getMethodProfiler();
|
||||
@@ -247,7 +273,7 @@
|
||||
}
|
||||
|
||||
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@ -74,31 +74,17 @@
|
||||
+ return playerchunk == null || playerchunk.oldTicketLevel > i; // CraftBukkit using oldTicketLevel for isLoaded checks
|
||||
}
|
||||
|
||||
public boolean isLoaded(int i, int j) {
|
||||
@@ -282,19 +308,19 @@
|
||||
public boolean a(Entity entity) {
|
||||
long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
|
||||
|
||||
- return this.a(i, PlayerChunk::b);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
@Override
|
||||
@@ -307,7 +333,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(ChunkCoordIntPair chunkcoordintpair) {
|
||||
- return this.a(chunkcoordintpair.pair(), PlayerChunk::b);
|
||||
+ return this.a(chunkcoordintpair.pair(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean a(BlockPosition blockposition) {
|
||||
long i = ChunkCoordIntPair.pair(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
|
||||
public boolean a(long i) {
|
||||
- return this.a(i, PlayerChunk::a);
|
||||
+ return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::a); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
|
||||
@@ -316,11 +342,31 @@
|
||||
@@ -329,11 +355,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
@ -113,44 +99,46 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.lightEngine.close();
|
||||
this.playerChunkMap.close();
|
||||
this.chunkMap.close();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - modelled on below
|
||||
+ public void purgeUnload() {
|
||||
+ this.world.getMethodProfiler().enter("purge");
|
||||
+ this.chunkMapDistance.purgeTickets();
|
||||
+ this.level.getMethodProfiler().enter("purge");
|
||||
+ this.distanceManager.purgeTickets();
|
||||
+ this.tickDistanceManager();
|
||||
+ this.world.getMethodProfiler().exitEnter("unload");
|
||||
+ this.playerChunkMap.unloadChunks(() -> true);
|
||||
+ this.world.getMethodProfiler().exit();
|
||||
+ this.level.getMethodProfiler().exitEnter("unload");
|
||||
+ this.chunkMap.unloadChunks(() -> true);
|
||||
+ this.level.getMethodProfiler().exit();
|
||||
+ this.clearCache();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier) {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
@@ -340,12 +386,12 @@
|
||||
this.lastTickTime = i;
|
||||
WorldData worlddata = this.world.getWorldData();
|
||||
boolean flag = this.world.isDebugWorld();
|
||||
- boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING);
|
||||
+ boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
this.level.getMethodProfiler().enter("purge");
|
||||
@@ -354,12 +400,12 @@
|
||||
this.lastInhabitedUpdate = i;
|
||||
WorldData worlddata = this.level.getWorldData();
|
||||
boolean flag = this.level.isDebugWorld();
|
||||
- boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
|
||||
+ boolean flag1 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.getPlayers().isEmpty(); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
|
||||
this.level.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
- boolean flag2 = worlddata.getTime() % 400L == 0L;
|
||||
+ boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
+ boolean flag2 = level.ticksPerAnimalSpawns != 0L && worlddata.getTime() % level.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.chunkMapDistance.b();
|
||||
@@ -532,12 +578,18 @@
|
||||
this.level.getMethodProfiler().enter("naturalSpawnCount");
|
||||
int l = this.distanceManager.b();
|
||||
@@ -548,13 +594,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean executeNext() {
|
||||
- protected boolean executeNext() {
|
||||
+ // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
|
||||
+ public boolean executeNext() {
|
||||
+ try {
|
||||
if (ChunkProviderServer.this.tickDistanceManager()) {
|
||||
return true;
|
||||
@ -159,7 +147,7 @@
|
||||
return super.executeNext();
|
||||
}
|
||||
+ } finally {
|
||||
+ playerChunkMap.callbackExecutor.run();
|
||||
+ chunkMap.callbackExecutor.run();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,10 +1,11 @@
|
||||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -40,6 +40,11 @@
|
||||
@@ -42,6 +42,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.network.ServerPlayerConnection;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
+// CraftBukkit end
|
||||
@ -12,44 +13,51 @@
|
||||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -60,8 +65,12 @@
|
||||
private List<Entity> p;
|
||||
private boolean q;
|
||||
private boolean r;
|
||||
@@ -63,8 +69,12 @@
|
||||
private List<Entity> lastPassengers;
|
||||
private boolean wasRiding;
|
||||
private boolean wasOnGround;
|
||||
+ // CraftBukkit start
|
||||
+ private final Set<EntityPlayer> trackedPlayers;
|
||||
+ private final Set<ServerPlayerConnection> trackedPlayers;
|
||||
|
||||
- public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer) {
|
||||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<EntityPlayer> trackedPlayers) {
|
||||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
||||
+ this.trackedPlayers = trackedPlayers;
|
||||
+ // CraftBukkit end
|
||||
this.m = Vec3D.ORIGIN;
|
||||
this.p = Collections.emptyList();
|
||||
this.b = worldserver;
|
||||
@@ -81,16 +90,16 @@
|
||||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -84,22 +94,22 @@
|
||||
|
||||
if (!list.equals(this.p)) {
|
||||
this.p = list;
|
||||
- this.f.accept(new PacketPlayOutMount(this.tracker));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
this.lastPassengers = list;
|
||||
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutMount(this.entity)); // CraftBukkit
|
||||
}
|
||||
|
||||
- if (this.tracker instanceof EntityItemFrame && this.tickCounter % 10 == 0) {
|
||||
+ if (this.tracker instanceof EntityItemFrame /*&& this.tickCounter % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
|
||||
- if (this.entity instanceof EntityItemFrame && this.tickCount % 10 == 0) {
|
||||
+ if (this.entity instanceof EntityItemFrame /*&& this.tickCounter % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) this.entity;
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
- if (itemstack.getItem() instanceof ItemWorldMap) {
|
||||
+ if (this.tickCounter % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
WorldMap worldmap = ItemWorldMap.getSavedMap(itemstack, this.b);
|
||||
- Iterator iterator = this.b.getPlayers().iterator();
|
||||
+ Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit
|
||||
+ if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
Integer integer = ItemWorldMap.d(itemstack);
|
||||
WorldMap worldmap = ItemWorldMap.a(integer, (World) this.level);
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
@@ -135,6 +144,17 @@
|
||||
boolean flag2 = flag1 || this.tickCounter % 60 == 0;
|
||||
boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;
|
||||
if (worldmap != null) {
|
||||
- Iterator iterator = this.level.getPlayers().iterator();
|
||||
+ Iterator<ServerPlayerConnection> iterator = this.trackedPlayers.iterator(); // CraftBukkit
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
+ EntityPlayer entityplayer = iterator.next().d(); // CraftBukkit
|
||||
|
||||
worldmap.a((EntityHuman) entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.a(integer, entityplayer);
|
||||
@@ -142,6 +152,17 @@
|
||||
boolean flag2 = flag1 || this.tickCount % 60 == 0;
|
||||
boolean flag3 = Math.abs(i - this.yRotp) >= 1 || Math.abs(j - this.xRotp) >= 1;
|
||||
|
||||
+ // CraftBukkit start - Code moved from below
|
||||
+ if (flag2) {
|
||||
@ -57,15 +65,15 @@
|
||||
+ }
|
||||
+
|
||||
+ if (flag3) {
|
||||
+ this.yRot = i;
|
||||
+ this.xRot = j;
|
||||
+ this.yRotp = i;
|
||||
+ this.xRotp = j;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) {
|
||||
if (this.tickCount > 0 || this.entity instanceof EntityArrow) {
|
||||
long k = PacketPlayOutEntity.a(vec3d.x);
|
||||
long l = PacketPlayOutEntity.a(vec3d.y);
|
||||
@@ -173,6 +193,7 @@
|
||||
@@ -180,6 +201,7 @@
|
||||
}
|
||||
|
||||
this.c();
|
||||
@ -73,28 +81,28 @@
|
||||
if (flag2) {
|
||||
this.d();
|
||||
}
|
||||
@@ -181,6 +202,7 @@
|
||||
this.yRot = i;
|
||||
this.xRot = j;
|
||||
@@ -188,6 +210,7 @@
|
||||
this.yRotp = i;
|
||||
this.xRotp = j;
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
this.q = false;
|
||||
this.wasRiding = false;
|
||||
}
|
||||
@@ -196,7 +218,27 @@
|
||||
@@ -203,7 +226,27 @@
|
||||
|
||||
++this.tickCounter;
|
||||
if (this.tracker.velocityChanged) {
|
||||
- this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
- this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ // CraftBukkit start - Create PlayerVelocity event
|
||||
+ boolean cancelled = false;
|
||||
+
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ Player player = (Player) this.tracker.getBukkitEntity();
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ Player player = (Player) this.entity.getBukkitEntity();
|
||||
+ org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.tracker.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.entity.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
@ -104,70 +112,69 @@
|
||||
+ }
|
||||
+
|
||||
+ if (!cancelled) {
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.tracker));
|
||||
+ this.broadcastIncludingSelf(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.tracker.velocityChanged = false;
|
||||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -211,14 +253,17 @@
|
||||
PlayerConnection playerconnection = entityplayer.playerConnection;
|
||||
@@ -218,13 +261,16 @@
|
||||
PlayerConnection playerconnection = entityplayer.connection;
|
||||
|
||||
entityplayer.playerConnection.getClass();
|
||||
Objects.requireNonNull(entityplayer.connection);
|
||||
- this.a(playerconnection::sendPacket);
|
||||
+ this.a(playerconnection::sendPacket, entityplayer); // CraftBukkit - add player
|
||||
this.tracker.b(entityplayer);
|
||||
entityplayer.d(this.tracker);
|
||||
this.entity.c(entityplayer);
|
||||
}
|
||||
|
||||
- public void a(Consumer<Packet<?>> consumer) {
|
||||
+ public void a(Consumer<Packet<?>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
|
||||
if (this.tracker.dead) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
if (this.entity.isRemoved()) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ // CraftBukkit start - Remove useless error spam, just return
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity " + this.tracker);
|
||||
+ // EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ return;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
Packet<?> packet = this.tracker.P();
|
||||
@@ -234,6 +279,12 @@
|
||||
if (this.tracker instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.tracker).getAttributeMap().b();
|
||||
Packet<?> packet = this.entity.getPacket();
|
||||
@@ -240,6 +286,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributeMap().b();
|
||||
|
||||
+ // CraftBukkit start - If sending own attributes send scaled health instead of current maximum health
|
||||
+ if (this.tracker.getId() == entityplayer.getId()) {
|
||||
+ ((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(collection, false);
|
||||
+ if (this.entity.getId() == entityplayer.getId()) {
|
||||
+ ((EntityPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(collection, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -265,8 +316,14 @@
|
||||
@@ -271,8 +323,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.tracker.getId(), list));
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
+ ((EntityLiving) this.tracker).updateEquipment(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
+ ((EntityLiving) this.entity).updateEquipment(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Fix for nonsensical head yaw
|
||||
+ this.headYaw = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F);
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) headYaw));
|
||||
+ this.yHeadRotp = MathHelper.d(this.entity.getHeadRotation() * 256.0F / 360.0F);
|
||||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.entity, (byte) yHeadRotp));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.tracker instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.tracker;
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.entity;
|
||||
Iterator iterator = entityliving.getEffects().iterator();
|
||||
@@ -307,6 +364,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.tracker).getAttributeMap().getAttributes();
|
||||
@@ -313,6 +371,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributeMap().getAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
+ // CraftBukkit start - Send scaled max health
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(set, false);
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this.entity).getBukkitEntity().injectScaledMaxHealth(set, false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set));
|
||||
this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.entity.getId(), set));
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -33,6 +33,10 @@
|
||||
@@ -38,6 +38,10 @@
|
||||
import net.minecraft.world.level.chunk.ProtoChunkExtension;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
|
||||
@ -10,18 +10,23 @@
|
||||
+
|
||||
public class PlayerChunk {
|
||||
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK_ACCESS = Either.right(PlayerChunk.Failure.b);
|
||||
@@ -65,7 +69,7 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
- this.chunkSave = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.chunkSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.dirtyBlocks = new ShortSet[16];
|
||||
this.location = chunkcoordintpair;
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
|
||||
@@ -75,11 +79,11 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
- this.chunkToSave = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.chunkToSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.chunkToSaveHistory = null;
|
||||
this.blockChangedLightSectionFilter = new BitSet();
|
||||
this.skyChangedLightSectionFilter = new BitSet();
|
||||
- this.pendingFullStateConfirmation = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.pendingFullStateConfirmation = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.pos = chunkcoordintpair;
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = lightengine;
|
||||
@@ -77,6 +81,19 @@
|
||||
this.a(i);
|
||||
@@ -92,6 +96,19 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -38,9 +43,9 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.c());
|
||||
|
||||
@@ -102,9 +119,9 @@
|
||||
@@ -117,9 +134,9 @@
|
||||
@Nullable
|
||||
public Chunk getChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.a();
|
||||
@ -52,25 +57,34 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -135,6 +152,7 @@
|
||||
@@ -164,6 +181,7 @@
|
||||
if (chunk != null) {
|
||||
byte b0 = (byte) SectionPosition.a(blockposition.getY());
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
+ if (b0 < 0 || b0 >= this.dirtyBlocks.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296
|
||||
if (this.dirtyBlocks[b0] == null) {
|
||||
this.p = true;
|
||||
this.dirtyBlocks[b0] = new ShortArraySet();
|
||||
@@ -237,7 +255,7 @@
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(i);
|
||||
+ if (i < 0 || i >= this.changedBlocksPerSection.length) return; // CraftBukkit - SPIGOT-6086, SPIGOT-6296
|
||||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortArraySet();
|
||||
@@ -274,7 +292,7 @@
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(i);
|
||||
|
||||
if (completablefuture != null) {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
boolean flag = either != null && either.right().isPresent();
|
||||
|
||||
if (either == null || either.left().isPresent()) {
|
||||
return completablefuture;
|
||||
@@ -292,6 +310,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET;
|
||||
if (!flag) {
|
||||
@@ -341,7 +359,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((either) -> {
|
||||
either.ifLeft((chunk) -> {
|
||||
- completablefuture1.complete((Object) null);
|
||||
+ completablefuture1.complete(null); // CraftBukkit - decompile error
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -358,6 +376,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
|
||||
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
|
||||
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
|
||||
+ // CraftBukkit start
|
||||
@ -89,7 +103,7 @@
|
||||
+ }
|
||||
+ }).exceptionally((throwable) -> {
|
||||
+ // ensure exceptions are printed, by default this is not the case
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.location, throwable);
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule unload callback for chunk " + PlayerChunk.this.pos, throwable);
|
||||
+ return null;
|
||||
+ });
|
||||
+
|
||||
@ -100,18 +114,18 @@
|
||||
CompletableFuture completablefuture;
|
||||
|
||||
if (flag) {
|
||||
@@ -323,7 +365,7 @@
|
||||
@@ -388,7 +430,7 @@
|
||||
if (flag2 && !flag3) {
|
||||
completablefuture = this.fullChunkFuture;
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
- this.a(completablefuture.thenApply((either1) -> {
|
||||
+ this.a(((CompletableFuture<Either<Chunk, PlayerChunk.Failure>>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error
|
||||
playerchunkmap.getClass();
|
||||
Objects.requireNonNull(playerchunkmap);
|
||||
return either1.ifLeft(playerchunkmap::a);
|
||||
}));
|
||||
@@ -361,6 +403,26 @@
|
||||
}), "unfull");
|
||||
@@ -432,6 +474,26 @@
|
||||
|
||||
this.u.a(this.location, this::k, this.ticketLevel, this::d);
|
||||
this.onLevelChange.a(this.pos, this::k, this.ticketLevel, this::d);
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
@ -125,7 +139,7 @@
|
||||
+ }
|
||||
+ }).exceptionally((throwable) -> {
|
||||
+ // ensure exceptions are printed, by default this is not the case
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.location, throwable);
|
||||
+ MinecraftServer.LOGGER.fatal("Failed to schedule load callback for chunk " + PlayerChunk.this.pos, throwable);
|
||||
+ return null;
|
||||
+ });
|
||||
+
|
||||
|
@ -1,47 +1,43 @@
|
||||
--- a/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -89,6 +89,8 @@
|
||||
@@ -91,6 +91,8 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+import org.bukkit.entity.Player; // CraftBukkit
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -119,6 +121,31 @@
|
||||
private final Queue<Runnable> A;
|
||||
private int viewDistance;
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -129,6 +131,27 @@
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
int viewDistance;
|
||||
|
||||
+ // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||
+ public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
||||
+ public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
|
||||
+
|
||||
+ private Runnable queued;
|
||||
+ private final java.util.Queue<Runnable> queue = new java.util.ArrayDeque<>();
|
||||
+
|
||||
+ @Override
|
||||
+ public void execute(Runnable runnable) {
|
||||
+ if (queued != null) {
|
||||
+ throw new IllegalStateException("Already queued");
|
||||
+ }
|
||||
+ queued = runnable;
|
||||
+ queue.add(runnable);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ Runnable task = queued;
|
||||
+ queued = null;
|
||||
+ if (task != null) {
|
||||
+ Runnable task;
|
||||
+ while ((task = queue.poll()) != null) {
|
||||
+ task.run();
|
||||
+ }
|
||||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
|
||||
this.visibleChunks = this.updatingChunks.clone();
|
||||
@@ -239,9 +266,12 @@
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -279,9 +302,12 @@
|
||||
|
||||
return completablefuture1.thenApply((list1) -> {
|
||||
List<IChunkAccess> list2 = Lists.newArrayList();
|
||||
@ -56,24 +52,24 @@
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
Optional<IChunkAccess> optional = either.left();
|
||||
|
||||
@@ -344,7 +374,7 @@
|
||||
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
|
||||
@@ -389,7 +415,7 @@
|
||||
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.storageFolder.getName());
|
||||
} else {
|
||||
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
||||
this.visibleChunkMap.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
||||
this.saveChunk(ichunkaccess);
|
||||
@@ -355,7 +385,6 @@
|
||||
@@ -400,7 +426,6 @@
|
||||
}
|
||||
|
||||
}
|
||||
-
|
||||
protected void unloadChunks(BooleanSupplier booleansupplier) {
|
||||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getMethodProfiler();
|
||||
|
||||
@@ -394,7 +423,7 @@
|
||||
@@ -439,7 +464,7 @@
|
||||
|
||||
private void a(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
|
||||
@ -82,42 +78,40 @@
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -616,8 +645,23 @@
|
||||
@@ -615,7 +640,21 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ boolean needsRemoval = false;
|
||||
+ if (chunk.needsDecoration) {
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = this.world.getServer().getServer();
|
||||
+ if (!server.getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+
|
||||
+ if (!server.getSpawnAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ }
|
||||
private static void a(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
- worldserver.b(EntityTypes.a(list, (World) worldserver));
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ worldserver.b(EntityTypes.a(list, (World) worldserver).filter((entity) -> {
|
||||
+ boolean needsRemoval = false;
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getServer().getServer();
|
||||
+ if (!server.getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ if (!server.getSpawnAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.die();
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ return !needsRemoval;
|
||||
+ }));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- if (!(entity instanceof EntityHuman) && !this.world.addEntityChunk(entity)) {
|
||||
+ if (!(entity instanceof EntityHuman) && (needsRemoval || !this.world.addEntityChunk(entity))) {
|
||||
+ // CraftBukkit end
|
||||
if (list == null) {
|
||||
list = Lists.newArrayList(new Entity[]{entity});
|
||||
} else {
|
||||
@@ -828,7 +872,8 @@
|
||||
}
|
||||
@@ -843,7 +882,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
- csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse((Object) null), optional1.map(Chunk::getState).orElse((Object) null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
- csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse((Object) null), optional1.map(Chunk::getState).orElse((Object) null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.distanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
|
||||
}).orElse(0), optional1.map((chunk) -> {
|
||||
+ csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.distanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
return chunk.getTileEntities().size();
|
||||
@@ -839,7 +884,7 @@
|
||||
}).orElse(0));
|
||||
}
|
||||
@@ -852,7 +892,7 @@
|
||||
|
||||
private static String a(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
@ -126,48 +120,41 @@
|
||||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -857,7 +902,7 @@
|
||||
@@ -870,7 +910,7 @@
|
||||
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
||||
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
||||
|
||||
- return nbttagcompound == null ? null : this.getChunkData(this.world.getDimensionKey(), this.l, nbttagcompound);
|
||||
+ return nbttagcompound == null ? null : this.getChunkData(this.world.getTypeKey(), this.l, nbttagcompound, chunkcoordintpair, world); // CraftBukkit
|
||||
- return nbttagcompound == null ? null : this.getChunkData(this.level.getDimensionKey(), this.overworldDataStorage, nbttagcompound);
|
||||
+ return nbttagcompound == null ? null : this.getChunkData(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, chunkcoordintpair, level); // CraftBukkit
|
||||
}
|
||||
|
||||
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1189,7 +1234,7 @@
|
||||
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
||||
@@ -1233,7 +1273,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
- this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast);
|
||||
+ this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast, trackedPlayers); // CraftBukkit
|
||||
this.tracker = entity;
|
||||
this.trackingDistance = i;
|
||||
this.e = SectionPosition.a(entity);
|
||||
@@ -1242,7 +1287,7 @@
|
||||
- this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast);
|
||||
+ this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast, seenBy); // CraftBukkit
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.a(entity);
|
||||
@@ -1286,10 +1326,18 @@
|
||||
|
||||
public void updatePlayer(EntityPlayer entityplayer) {
|
||||
if (entityplayer != this.tracker) {
|
||||
- Vec3D vec3d = entityplayer.getPositionVector().d(this.trackerEntry.b());
|
||||
+ Vec3D vec3d = entityplayer.getPositionVector().d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113
|
||||
if (entityplayer != this.entity) {
|
||||
- Vec3D vec3d = entityplayer.getPositionVector().d(this.serverEntity.b());
|
||||
+ Vec3D vec3d = entityplayer.getPositionVector().d(this.entity.getPositionVector()); // MC-155077, SPIGOT-5113
|
||||
int i = Math.min(this.b(), (PlayerChunkMap.this.viewDistance - 1) * 16);
|
||||
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer);
|
||||
boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.entity.a(entityplayer);
|
||||
|
||||
@@ -1258,6 +1303,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - respect vanish API
|
||||
+ if (this.tracker instanceof EntityPlayer) {
|
||||
+ Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
|
||||
+ flag1 = false;
|
||||
+ }
|
||||
+ // CraftBukkit start - respect vanish API
|
||||
+ if (this.entity instanceof EntityPlayer) {
|
||||
+ Player player = ((EntityPlayer) this.entity).getBukkitEntity();
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
|
||||
+ flag = false;
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (flag1 && this.trackedPlayers.add(entityplayer)) {
|
||||
this.trackerEntry.b(entityplayer);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (flag) {
|
||||
if (this.seenBy.add(entityplayer.connection)) {
|
||||
this.serverEntity.b(entityplayer);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/PlayerInteractManager.java
|
||||
+++ b/net/minecraft/server/level/PlayerInteractManager.java
|
||||
@@ -26,6 +26,25 @@
|
||||
@@ -25,6 +25,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -26,49 +26,49 @@
|
||||
public class PlayerInteractManager {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -60,7 +79,7 @@
|
||||
this.gamemode = enumgamemode;
|
||||
enumgamemode.a(this.player.abilities);
|
||||
@@ -65,7 +84,7 @@
|
||||
this.gameModeForPlayer = enumgamemode;
|
||||
enumgamemode.a(this.player.getAbilities());
|
||||
this.player.updateAbilities();
|
||||
- this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}));
|
||||
+ this.player.server.getPlayerList().sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}), this.player); // CraftBukkit
|
||||
this.world.everyoneSleeping();
|
||||
this.level.everyoneSleeping();
|
||||
}
|
||||
|
||||
@@ -89,7 +108,7 @@
|
||||
@@ -87,7 +106,7 @@
|
||||
}
|
||||
|
||||
public void a() {
|
||||
- ++this.currentTick;
|
||||
+ this.currentTick = MinecraftServer.currentTick; // CraftBukkit;
|
||||
- ++this.gameTicks;
|
||||
+ this.gameTicks = MinecraftServer.currentTick; // CraftBukkit;
|
||||
IBlockData iblockdata;
|
||||
|
||||
if (this.j) {
|
||||
@@ -145,9 +164,31 @@
|
||||
if (this.hasDelayedDestroy) {
|
||||
@@ -143,9 +162,31 @@
|
||||
|
||||
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
|
||||
if (!this.world.a((EntityHuman) this.player, blockposition)) {
|
||||
if (!this.level.a((EntityHuman) this.player, blockposition)) {
|
||||
+ // CraftBukkit start - fire PlayerInteractEvent
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact"));
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getItemInHand(), EnumHand.MAIN_HAND);
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, "may not interact"));
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND);
|
||||
+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.getInventory().getItemInHand(), EnumHand.MAIN_HAND);
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
return;
|
||||
}
|
||||
@ -76,40 +76,40 @@
|
||||
|
||||
if (this.isCreative()) {
|
||||
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
|
||||
@@ -163,11 +204,43 @@
|
||||
@@ -161,11 +202,43 @@
|
||||
float f = 1.0F;
|
||||
|
||||
iblockdata = this.world.getType(blockposition);
|
||||
iblockdata = this.level.getType(blockposition);
|
||||
- if (!iblockdata.isAir()) {
|
||||
+ // CraftBukkit start - Swings at air do *NOT* exist.
|
||||
+ if (event.useInteractedBlock() == Event.Result.DENY) {
|
||||
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
+ IBlockData data = this.world.getType(blockposition);
|
||||
+ IBlockData data = this.level.getType(blockposition);
|
||||
+ if (data.getBlock() instanceof BlockDoor) {
|
||||
+ // For some reason *BOTH* the bottom/top part have to be marked updated.
|
||||
+ boolean bottom = data.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ } else if (data.getBlock() instanceof BlockTrapdoor) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ }
|
||||
+ } else if (!iblockdata.isAir()) {
|
||||
iblockdata.attack(this.world, blockposition, this.player);
|
||||
f = iblockdata.getDamage(this.player, this.player.world, blockposition);
|
||||
iblockdata.attack(this.level, blockposition, this.player);
|
||||
f = iblockdata.getDamage(this.player, this.player.level, blockposition);
|
||||
}
|
||||
|
||||
+ if (event.useItemInHand() == Event.Result.DENY) {
|
||||
+ // If we 'insta destroyed' then the client needs to be informed.
|
||||
+ if (f > 1.0f) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.inventory.getItemInHand(), f >= 1.0f);
|
||||
+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.getInventory().getItemInHand(), f >= 1.0f);
|
||||
+
|
||||
+ if (blockEvent.isCancelled()) {
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@ -121,41 +121,40 @@
|
||||
if (!iblockdata.isAir() && f >= 1.0F) {
|
||||
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
|
||||
} else {
|
||||
@@ -211,7 +284,7 @@
|
||||
@@ -209,7 +282,7 @@
|
||||
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
|
||||
this.f = false;
|
||||
if (!Objects.equals(this.h, blockposition)) {
|
||||
- PlayerInteractManager.LOGGER.warn("Mismatch in destroy block pos: " + this.h + " " + blockposition);
|
||||
+ PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: " + this.h + " " + blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
this.world.a(this.player.getId(), this.h, -1);
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(this.h, this.world.getType(this.h), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
this.isDestroyingBlock = false;
|
||||
if (!Objects.equals(this.destroyPos, blockposition)) {
|
||||
- PlayerInteractManager.LOGGER.warn("Mismatch in destroy block pos: {} {}", this.destroyPos, blockposition);
|
||||
+ PlayerInteractManager.LOGGER.debug("Mismatch in destroy block pos: {} {}", this.destroyPos, blockposition); // CraftBukkit - SPIGOT-5457 sent by client when interact event cancelled
|
||||
this.level.a(this.player.getId(), this.destroyPos, -1);
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(this.destroyPos, this.level.getType(this.destroyPos), packetplayinblockdig_enumplayerdigtype, true, "aborted mismatched destroying"));
|
||||
}
|
||||
@@ -227,17 +300,73 @@
|
||||
@@ -225,17 +298,72 @@
|
||||
if (this.breakBlock(blockposition)) {
|
||||
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
|
||||
this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
|
||||
} else {
|
||||
- this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s));
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // CraftBukkit - SPIGOT-5196
|
||||
- this.player.connection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.level.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false, s));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition)); // CraftBukkit - SPIGOT-5196
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public boolean breakBlock(BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.world.getType(blockposition);
|
||||
IBlockData iblockdata = this.level.getType(blockposition);
|
||||
+ // CraftBukkit start - fire BlockBreakEvent
|
||||
+ org.bukkit.block.Block bblock = CraftBlock.at(world, blockposition);
|
||||
+ org.bukkit.block.Block bblock = CraftBlock.at(level, blockposition);
|
||||
+ BlockBreakEvent event = null;
|
||||
+
|
||||
+ if (this.player instanceof EntityPlayer) {
|
||||
+ // Sword + Creative mode pre-cancel
|
||||
+ boolean isSwordNoBreak = !this.player.getItemInMainHand().getItem().a(iblockdata, this.world, blockposition, (EntityHuman) this.player);
|
||||
+ boolean isSwordNoBreak = !this.player.getItemInMainHand().getItem().a(iblockdata, this.level, blockposition, (EntityHuman) this.player);
|
||||
+
|
||||
+ // Tell client the block is gone immediately then process events
|
||||
+ // Don't tell the client if its a creative sword break because its not broken!
|
||||
+ if (world.getTileEntity(blockposition) == null && !isSwordNoBreak) {
|
||||
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition);
|
||||
+ packet.block = Blocks.AIR.getBlockData();
|
||||
+ this.player.playerConnection.sendPacket(packet);
|
||||
+ if (level.getTileEntity(blockposition) == null && !isSwordNoBreak) {
|
||||
+ PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(blockposition, Blocks.AIR.getBlockData());
|
||||
+ this.player.connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ event = new BlockBreakEvent(bblock, this.player.getBukkitEntity());
|
||||
@ -164,60 +163,60 @@
|
||||
+ event.setCancelled(isSwordNoBreak);
|
||||
+
|
||||
+ // Calculate default block experience
|
||||
+ IBlockData nmsData = this.world.getType(blockposition);
|
||||
+ IBlockData nmsData = this.level.getType(blockposition);
|
||||
+ Block nmsBlock = nmsData.getBlock();
|
||||
+
|
||||
+ ItemStack itemstack = this.player.getEquipment(EnumItemSlot.MAINHAND);
|
||||
+
|
||||
+ if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.hasBlock(nmsBlock.getBlockData())) {
|
||||
+ event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.world, blockposition, itemstack));
|
||||
+ event.setExpToDrop(nmsBlock.getExpDrop(nmsData, this.level, blockposition, itemstack));
|
||||
+ }
|
||||
|
||||
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.world, blockposition, (EntityHuman) this.player)) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
- if (!this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.level, blockposition, (EntityHuman) this.player)) {
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (isSwordNoBreak) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+
|
||||
+ // Brute force all possible updates
|
||||
+ for (EnumDirection dir : EnumDirection.values()) {
|
||||
+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(dir)));
|
||||
+ this.player.connection.sendPacket(new PacketPlayOutBlockChange(level, blockposition.shift(dir)));
|
||||
+ }
|
||||
+
|
||||
+ // Update any tile entity data for this block
|
||||
+ TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
+ TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
+ if (tileentity != null) {
|
||||
+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ this.player.connection.sendPacket(tileentity.getUpdatePacket());
|
||||
+ }
|
||||
+ return false;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (false && !this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.world, blockposition, (EntityHuman) this.player)) { // CraftBukkit - false
|
||||
+ if (false && !this.player.getItemInMainHand().getItem().a(iblockdata, (World) this.level, blockposition, (EntityHuman) this.player)) { // CraftBukkit - false
|
||||
return false;
|
||||
} else {
|
||||
+ iblockdata = this.world.getType(blockposition); // CraftBukkit - update state from plugins
|
||||
+ iblockdata = this.level.getType(blockposition); // CraftBukkit - update state from plugins
|
||||
+ if (iblockdata.isAir()) return false; // CraftBukkit - A plugin set block to air without cancelling
|
||||
TileEntity tileentity = this.world.getTileEntity(blockposition);
|
||||
TileEntity tileentity = this.level.getTileEntity(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
@@ -247,6 +376,10 @@
|
||||
} else if (this.player.a((World) this.world, blockposition, this.gamemode)) {
|
||||
@@ -245,6 +373,10 @@
|
||||
} else if (this.player.a((World) this.level, blockposition, this.gameModeForPlayer)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.block.BlockState state = bblock.getState();
|
||||
+ world.captureDrops = new ArrayList<>();
|
||||
+ level.captureDrops = new ArrayList<>();
|
||||
+ // CraftBukkit end
|
||||
block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player);
|
||||
boolean flag = this.world.a(blockposition, false);
|
||||
block.a((World) this.level, blockposition, iblockdata, (EntityHuman) this.player);
|
||||
boolean flag = this.level.a(blockposition, false);
|
||||
|
||||
@@ -255,19 +388,32 @@
|
||||
@@ -253,19 +385,32 @@
|
||||
}
|
||||
|
||||
if (this.isCreative()) {
|
||||
@ -228,10 +227,10 @@
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
boolean flag1 = this.player.hasBlock(iblockdata);
|
||||
|
||||
itemstack.a(this.world, iblockdata, blockposition, this.player);
|
||||
itemstack.a(this.level, iblockdata, blockposition, this.player);
|
||||
- if (flag && flag1) {
|
||||
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
|
||||
block.a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack1);
|
||||
block.a(this.level, this.player, blockposition, iblockdata, tileentity, itemstack1);
|
||||
}
|
||||
|
||||
- return true;
|
||||
@ -239,13 +238,13 @@
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ if (event.isDropItems()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, world.captureDrops);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
|
||||
}
|
||||
+ world.captureDrops = null;
|
||||
+ level.captureDrops = null;
|
||||
+
|
||||
+ // Drop event experience
|
||||
+ if (flag && event != null) {
|
||||
+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop());
|
||||
+ iblockdata.getBlock().dropExperience(this.level, blockposition, event.getExpToDrop());
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
@ -253,7 +252,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -309,12 +455,52 @@
|
||||
@@ -307,12 +452,52 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,7 +268,7 @@
|
||||
+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
|
||||
+ boolean cancelledBlock = false;
|
||||
|
||||
if (this.gamemode == EnumGamemode.SPECTATOR) {
|
||||
if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
ITileInventory itileinventory = iblockdata.b(world, blockposition);
|
||||
+ cancelledBlock = !(itileinventory instanceof ITileInventory);
|
||||
+ }
|
||||
@ -289,24 +288,24 @@
|
||||
+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door.
|
||||
+ if (iblockdata.getBlock() instanceof BlockDoor) {
|
||||
+ boolean bottom = iblockdata.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down()));
|
||||
+ } else if (iblockdata.getBlock() instanceof BlockCake) {
|
||||
+ entityplayer.getBukkitEntity().sendHealthUpdate(); // SPIGOT-1341 - reset health for cake
|
||||
+ } else if (interactItemStack.getItem() instanceof ItemBisected) {
|
||||
+ // send a correcting update to the client, as it already placed the upper half of the bisected item
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(movingobjectpositionblock.getDirection()).up()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(movingobjectpositionblock.getDirection()).up()));
|
||||
+
|
||||
+ // send a correcting update to the client for the block above as well, this because of replaceable blocks (such as grass, sea grass etc)
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.up()));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.up()));
|
||||
+ }
|
||||
+ entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867
|
||||
+ enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
|
||||
+ } else if (this.gamemode == EnumGamemode.SPECTATOR) {
|
||||
+ } else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
+ ITileInventory itileinventory = iblockdata.b(world, blockposition);
|
||||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openContainer(itileinventory);
|
||||
@@ -328,7 +514,7 @@
|
||||
@@ -326,7 +511,7 @@
|
||||
ItemStack itemstack1 = itemstack.cloneItemStack();
|
||||
|
||||
if (!flag1) {
|
||||
@ -314,8 +313,8 @@
|
||||
+ enuminteractionresult = iblockdata.interact(world, entityplayer, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enuminteractionresult.a()) {
|
||||
CriterionTriggers.M.a(entityplayer, blockposition, itemstack1);
|
||||
@@ -336,17 +522,17 @@
|
||||
CriterionTriggers.ITEM_USED_ON_BLOCK.a(entityplayer, blockposition, itemstack1);
|
||||
@@ -334,17 +519,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -336,7 +335,7 @@
|
||||
}
|
||||
|
||||
if (enuminteractionresult1.a()) {
|
||||
@@ -354,10 +540,10 @@
|
||||
@@ -352,10 +537,10 @@
|
||||
}
|
||||
|
||||
return enuminteractionresult1;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
@@ -273,6 +273,13 @@
|
||||
@@ -308,6 +308,13 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@ -11,6 +11,6 @@
|
||||
+ @Override
|
||||
+ public boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // CraftBukkit end
|
||||
int i = MathHelper.floor(entity.locX() / 16.0D);
|
||||
int j = MathHelper.floor(entity.locZ() / 16.0D);
|
||||
int i = SectionPosition.a(entity.cW());
|
||||
int j = SectionPosition.a(entity.dc());
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -145,6 +145,21 @@
|
||||
@@ -152,6 +152,22 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
+import java.util.logging.Level;
|
||||
+import net.minecraft.world.entity.monster.EntityDrowned;
|
||||
+import net.minecraft.world.level.block.ITileEntity;
|
||||
+import net.minecraft.world.level.block.entity.TileEntity;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.WeatherType;
|
||||
@ -21,21 +22,22 @@
|
||||
+
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition a = new BlockPosition(100, 50, 0);
|
||||
@@ -156,7 +171,7 @@
|
||||
private final ChunkProviderServer chunkProvider;
|
||||
boolean tickingEntities;
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -160,7 +176,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
- public final IWorldDataServer worldDataServer;
|
||||
+ public final WorldDataServer worldDataServer; // CraftBukkit - type
|
||||
public boolean savingDisabled;
|
||||
private boolean everyoneSleeping;
|
||||
private int emptyTime;
|
||||
@@ -173,8 +188,23 @@
|
||||
private final StructureManager structureManager;
|
||||
private final boolean Q;
|
||||
- public final IWorldDataServer serverLevelData;
|
||||
+ public final WorldDataServer serverLevelData; // CraftBukkit - type
|
||||
final EntityTickList entityTickList;
|
||||
private final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -180,31 +196,52 @@
|
||||
private final StructureManager structureFeatureManager;
|
||||
private final boolean tickTime;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
@ -44,50 +46,67 @@
|
||||
+ public final UUID uuid;
|
||||
+
|
||||
+ public Chunk getChunkIfLoaded(int x, int z) {
|
||||
+ return this.chunkProvider.getChunkAt(x, z, false);
|
||||
+ return this.chunkSource.getChunkAt(x, z, false);
|
||||
+ }
|
||||
+
|
||||
+ // 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) {
|
||||
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env);
|
||||
+ this.pvpMode = minecraftserver.getPVP();
|
||||
+ convertable = convertable_conversionsession;
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile());
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelPath.toFile());
|
||||
+ // CraftBukkit end
|
||||
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
|
||||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
- Predicate predicate = (block) -> {
|
||||
+ Predicate<Block> predicate = (block) -> { // CraftBukkit - decompile eror
|
||||
return block == null || block.getBlockData().isAir();
|
||||
}, IRegistry.BLOCK::getKey, this::b);
|
||||
@@ -186,10 +216,17 @@
|
||||
this.Q = flag1;
|
||||
};
|
||||
RegistryBlocks registryblocks = IRegistry.BLOCK;
|
||||
|
||||
Objects.requireNonNull(registryblocks);
|
||||
- this.blockTicks = new TickListServer<>(this, predicate, registryblocks::getKey, this::b);
|
||||
- predicate = (fluidtype) -> {
|
||||
+ this.blockTicks = new TickListServer<>(this, predicate, IRegistry.BLOCK::getKey, this::b); // CraftBukkit - decompile error
|
||||
+ Predicate<FluidType> predicate2 = (fluidtype) -> { // CraftBukkit - decompile error
|
||||
return fluidtype == null || fluidtype == FluidTypes.EMPTY;
|
||||
};
|
||||
registryblocks = IRegistry.FLUID;
|
||||
Objects.requireNonNull(registryblocks);
|
||||
- this.liquidTicks = new TickListServer<>(this, predicate, registryblocks::getKey, this::a);
|
||||
+ this.liquidTicks = new TickListServer<>(this, predicate2, IRegistry.FLUID::getKey, this::a); // CraftBukkit - decompile error
|
||||
this.navigatingMobs = new ObjectOpenHashSet();
|
||||
this.blockEvents = new ObjectLinkedOpenHashSet();
|
||||
this.dragonParts = new Int2ObjectOpenHashMap();
|
||||
this.tickTime = flag1;
|
||||
this.server = minecraftserver;
|
||||
this.mobSpawners = list;
|
||||
- this.worldDataServer = iworlddataserver;
|
||||
this.customSpawners = list;
|
||||
- this.serverLevelData = iworlddataserver;
|
||||
+ // CraftBukkit start
|
||||
+ this.worldDataServer = (WorldDataServer) iworlddataserver;
|
||||
+ worldDataServer.world = this;
|
||||
+ this.serverLevelData = (WorldDataServer) iworlddataserver;
|
||||
+ serverLevelData.world = this;
|
||||
+ if (gen != null) {
|
||||
+ chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen);
|
||||
+ }
|
||||
+
|
||||
this.chunkProvider = new ChunkProviderServer(this, convertable_conversionsession, minecraftserver.getDataFixer(), minecraftserver.getDefinedStructureManager(), executor, chunkgenerator, minecraftserver.getPlayerList().getViewDistance(), minecraftserver.isSyncChunkWrites(), worldloadlistener, () -> {
|
||||
return minecraftserver.E().getWorldPersistentData();
|
||||
});
|
||||
+ // CraftBukkit end
|
||||
this.portalTravelAgent = new PortalTravelAgent(this);
|
||||
this.Q();
|
||||
this.R();
|
||||
@@ -201,14 +238,50 @@
|
||||
boolean flag2 = minecraftserver.isSyncChunkWrites();
|
||||
DataFixer datafixer = minecraftserver.getDataFixer();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, new File(convertable_conversionsession.a(resourcekey), "entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -231,15 +268,51 @@
|
||||
iworlddataserver.setGameType(minecraftserver.getGamemode());
|
||||
}
|
||||
|
||||
- this.structureManager = new StructureManager(this, minecraftserver.getSaveData().getGeneratorSettings());
|
||||
+ this.structureManager = new StructureManager(this, this.worldDataServer.getGeneratorSettings()); // CraftBukkit
|
||||
- this.structureFeatureManager = new StructureManager(this, minecraftserver.getSaveData().getGeneratorSettings());
|
||||
+ this.structureFeatureManager = new StructureManager(this, this.serverLevelData.getGeneratorSettings()); // CraftBukkit
|
||||
if (this.getDimensionManager().isCreateDragonBattle()) {
|
||||
- this.dragonBattle = new EnderDragonBattle(this, minecraftserver.getSaveData().getGeneratorSettings().getSeed(), minecraftserver.getSaveData().C());
|
||||
+ this.dragonBattle = new EnderDragonBattle(this, this.worldDataServer.getGeneratorSettings().getSeed(), this.worldDataServer.C()); // CraftBukkit
|
||||
- this.dragonFight = new EnderDragonBattle(this, minecraftserver.getSaveData().getGeneratorSettings().getSeed(), minecraftserver.getSaveData().C());
|
||||
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.getGeneratorSettings().getSeed(), this.serverLevelData.C()); // CraftBukkit
|
||||
} else {
|
||||
this.dragonBattle = null;
|
||||
this.dragonFight = null;
|
||||
}
|
||||
|
||||
this.sleepStatus = new SleepStatus();
|
||||
+ this.getServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
@ -95,13 +114,13 @@
|
||||
+ @Override
|
||||
+ public TileEntity getTileEntity(BlockPosition pos, boolean validate) {
|
||||
+ TileEntity result = super.getTileEntity(pos, validate);
|
||||
+ if (!validate || Thread.currentThread() != this.serverThread) {
|
||||
+ if (!validate || Thread.currentThread() != this.thread) {
|
||||
+ // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load
|
||||
+ return result;
|
||||
+ }
|
||||
+ Block type = getType(pos).getBlock();
|
||||
|
||||
+ if (result != null && type != Blocks.AIR) {
|
||||
+ IBlockData type = getType(pos);
|
||||
+
|
||||
+ if (result != null && !type.a(Blocks.AIR)) {
|
||||
+ if (!result.getTileType().isValidBlock(type)) {
|
||||
+ result = fixTileEntity(pos, type, result);
|
||||
+ }
|
||||
@ -110,15 +129,14 @@
|
||||
+ return result;
|
||||
+ }
|
||||
+
|
||||
+ private TileEntity fixTileEntity(BlockPosition pos, Block type, TileEntity found) {
|
||||
+ private TileEntity fixTileEntity(BlockPosition pos, IBlockData type, TileEntity found) {
|
||||
+ this.getServer().getLogger().log(Level.SEVERE, "Block at {0}, {1}, {2} is {3} but has {4}" + ". "
|
||||
+ + "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.", new Object[]{pos.getX(), pos.getY(), pos.getZ(), type, found});
|
||||
+
|
||||
+ if (type instanceof ITileEntity) {
|
||||
+ TileEntity replacement = ((ITileEntity) type).createTile(this);
|
||||
+ TileEntity replacement = ((ITileEntity) type).createTile(pos, type);
|
||||
+ if (replacement != null) {
|
||||
+ replacement.setLocation(this, pos);
|
||||
+ this.setTileEntity(pos, replacement);
|
||||
+ this.setTileEntity(replacement);
|
||||
+ }
|
||||
+ return replacement;
|
||||
+ } else {
|
||||
@ -128,22 +146,22 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
public void a(int i, int j, boolean flag, boolean flag1) {
|
||||
this.worldDataServer.setClearWeatherTime(i);
|
||||
@@ -299,6 +372,7 @@
|
||||
this.serverLevelData.setClearWeatherTime(i);
|
||||
@@ -331,6 +404,7 @@
|
||||
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
+ /* CraftBukkit start
|
||||
if (this.lastRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
|
||||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel)), this.getDimensionKey());
|
||||
}
|
||||
@@ -317,18 +391,47 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
|
||||
@@ -349,16 +423,45 @@
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
+ // */
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).tickWeather();
|
||||
+ }
|
||||
+ }
|
||||
@ -151,28 +169,25 @@
|
||||
+ if (flag != this.isRaining()) {
|
||||
+ // Only send weather packets to those affected
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).world == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.lastRainLevel, this.rainLevel, this.lastThunderLevel, this.thunderLevel);
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.everyoneSleeping && this.players.stream().noneMatch((entityplayer) -> {
|
||||
- return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping();
|
||||
+ return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit
|
||||
})) {
|
||||
- this.everyoneSleeping = false;
|
||||
i = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE);
|
||||
if (this.sleepStatus.a(i) && this.sleepStatus.a(i, this.players)) {
|
||||
+ // CraftBukkit start
|
||||
+ long l = this.worldData.getDayTime() + 24000L;
|
||||
+ long l = this.levelData.getDayTime() + 24000L;
|
||||
+ TimeSkipEvent event = new TimeSkipEvent(this.getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (l - l % 24000L) - this.getDayTime());
|
||||
if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) {
|
||||
- long l = this.worldData.getDayTime() + 24000L;
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) {
|
||||
- long l = this.levelData.getDayTime() + 24000L;
|
||||
+ getServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.setDayTime(this.getDayTime() + event.getSkipAmount());
|
||||
@ -183,49 +198,41 @@
|
||||
|
||||
- this.wakeupPlayers();
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.everyoneSleeping = false;
|
||||
+ this.wakeupPlayers();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
|
||||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE)) {
|
||||
this.clearWeather();
|
||||
}
|
||||
@@ -350,7 +453,7 @@
|
||||
this.ak();
|
||||
this.ticking = false;
|
||||
gameprofilerfiller.exitEnter("entities");
|
||||
@@ -380,7 +483,7 @@
|
||||
this.aq();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.exit();
|
||||
- boolean flag3 = !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty();
|
||||
+ boolean flag3 = true || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
|
||||
|
||||
if (flag3) {
|
||||
this.resetEmptyTime();
|
||||
@@ -369,6 +472,7 @@
|
||||
Entity entity = (Entity) entry.getValue();
|
||||
Entity entity1 = entity.getVehicle();
|
||||
@@ -396,7 +499,7 @@
|
||||
|
||||
+ /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
|
||||
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
|
||||
entity.die();
|
||||
}
|
||||
@@ -376,6 +480,7 @@
|
||||
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
|
||||
entity.die();
|
||||
}
|
||||
+ // CraftBukkit end */
|
||||
|
||||
gameprofilerfiller.enter("checkDespawn");
|
||||
if (!entity.dead) {
|
||||
@@ -450,7 +555,7 @@
|
||||
}
|
||||
this.entityTickList.a((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
- if (this.i(entity)) {
|
||||
+ if (false && this.i(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
entity.die();
|
||||
} else {
|
||||
gameprofilerfiller.enter("checkDespawn");
|
||||
@@ -461,7 +564,7 @@
|
||||
|
||||
private void wakeupPlayers() {
|
||||
this.sleepStatus.a();
|
||||
- ((List) this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> {
|
||||
+ (this.players.stream().filter(EntityLiving::isSleeping).collect(Collectors.toList())).forEach((entityplayer) -> { // CraftBukkit - decompile error
|
||||
entityplayer.wakeup(false, false);
|
||||
});
|
||||
}
|
||||
@@ -477,14 +582,14 @@
|
||||
entityhorseskeleton.t(true);
|
||||
@@ -488,14 +591,14 @@
|
||||
entityhorseskeleton.v(true);
|
||||
entityhorseskeleton.setAgeRaw(0);
|
||||
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
- this.addEntity(entityhorseskeleton);
|
||||
@ -241,80 +248,63 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,11 +600,11 @@
|
||||
@@ -506,12 +609,12 @@
|
||||
BiomeBase biomebase = this.getBiome(blockposition);
|
||||
|
||||
if (biomebase.a(this, blockposition1)) {
|
||||
if (biomebase.a((IWorldReader) this, blockposition1)) {
|
||||
- this.setTypeUpdate(blockposition1, Blocks.ICE.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition1, Blocks.ICE.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && biomebase.b(this, blockposition)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
if (flag) {
|
||||
if (biomebase.b(this, blockposition)) {
|
||||
- this.setTypeUpdate(blockposition, Blocks.SNOW.getBlockData());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.getBlockData(), null); // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
|
||||
@@ -546,7 +651,7 @@
|
||||
protected BlockPosition a(BlockPosition blockposition) {
|
||||
BlockPosition blockposition1 = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, blockposition);
|
||||
AxisAlignedBB axisalignedbb = (new AxisAlignedBB(blockposition1, new BlockPosition(blockposition1.getX(), this.getBuildHeight(), blockposition1.getZ()))).g(3.0D);
|
||||
- List<EntityLiving> list = this.a(EntityLiving.class, axisalignedbb, (entityliving) -> {
|
||||
+ List<EntityLiving> list = this.a(EntityLiving.class, axisalignedbb, (java.util.function.Predicate<EntityLiving>) (entityliving) -> { // CraftBukkit - decompile error
|
||||
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
|
||||
});
|
||||
|
||||
@@ -575,7 +680,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (entityplayer.isSpectator()) {
|
||||
+ if (entityplayer.isSpectator() || (entityplayer.fauxSleeping && !entityplayer.isSleeping())) { // CraftBukkit
|
||||
++i;
|
||||
} else if (entityplayer.isSleeping()) {
|
||||
++j;
|
||||
@@ -593,10 +698,22 @@
|
||||
IBlockData iblockdata = this.getType(blockposition1);
|
||||
@@ -642,10 +745,22 @@
|
||||
}
|
||||
|
||||
private void clearWeather() {
|
||||
- this.worldDataServer.setWeatherDuration(0);
|
||||
- this.serverLevelData.setWeatherDuration(0);
|
||||
+ // CraftBukkit start
|
||||
this.worldDataServer.setStorm(false);
|
||||
- this.worldDataServer.setThunderDuration(0);
|
||||
this.serverLevelData.setStorm(false);
|
||||
- this.serverLevelData.setThunderDuration(0);
|
||||
+ // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
+ // Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
+ if (!this.worldDataServer.hasStorm()) {
|
||||
+ this.worldDataServer.setWeatherDuration(0);
|
||||
+ if (!this.serverLevelData.hasStorm()) {
|
||||
+ this.serverLevelData.setWeatherDuration(0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.worldDataServer.setThundering(false);
|
||||
this.serverLevelData.setThundering(false);
|
||||
+ // CraftBukkit start
|
||||
+ // If we stop due to everyone sleeping we should reset the weather duration to some other random value.
|
||||
+ // Not that everyone ever manages to get the whole server to sleep at the same time....
|
||||
+ if (!this.worldDataServer.isThundering()) {
|
||||
+ this.worldDataServer.setThunderDuration(0);
|
||||
+ if (!this.serverLevelData.isThundering()) {
|
||||
+ this.serverLevelData.setThunderDuration(0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -637,6 +754,7 @@
|
||||
@@ -680,6 +795,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickNonPassenger");
|
||||
entity.tick();
|
||||
+ entity.postTick(); // CraftBukkit
|
||||
this.getMethodProfiler().exit();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -703,6 +819,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickNonPassenger");
|
||||
entity.tick();
|
||||
+ entity.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.c("tickPassenger");
|
||||
entity1.passengerTick();
|
||||
+ entity1.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.exit();
|
||||
}
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -669,6 +787,7 @@
|
||||
});
|
||||
gameprofilerfiller.c("tickPassenger");
|
||||
entity1.passengerTick();
|
||||
+ entity1.postTick(); // CraftBukkit
|
||||
gameprofilerfiller.exit();
|
||||
}
|
||||
|
||||
@@ -725,6 +844,7 @@
|
||||
@@ -727,6 +844,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
|
||||
|
||||
if (!flag1) {
|
||||
@ -322,28 +312,28 @@
|
||||
if (iprogressupdate != null) {
|
||||
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
|
||||
}
|
||||
@@ -736,11 +856,19 @@
|
||||
@@ -744,11 +862,19 @@
|
||||
}
|
||||
|
||||
chunkproviderserver.save(flag);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - moved from MinecraftServer.saveChunks
|
||||
+ WorldServer worldserver1 = this;
|
||||
+
|
||||
+ worldDataServer.a(worldserver1.getWorldBorder().t());
|
||||
+ worldDataServer.setCustomBossEvents(this.server.getBossBattleCustomData().save());
|
||||
+ convertable.a(this.server.customRegistry, this.worldDataServer, this.server.getPlayerList().save());
|
||||
+ serverLevelData.a(worldserver1.getWorldBorder().t());
|
||||
+ serverLevelData.setCustomBossEvents(this.server.getBossBattleCustomData().save());
|
||||
+ convertable.a(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().save());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private void aj() {
|
||||
if (this.dragonBattle != null) {
|
||||
- this.server.getSaveData().a(this.dragonBattle.a());
|
||||
+ this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit
|
||||
private void ap() {
|
||||
if (this.dragonFight != null) {
|
||||
- this.server.getSaveData().a(this.dragonFight.a());
|
||||
+ this.serverLevelData.a(this.dragonFight.a()); // CraftBukkit
|
||||
}
|
||||
|
||||
this.getChunkProvider().getWorldPersistentData().a();
|
||||
@@ -801,11 +929,24 @@
|
||||
@@ -794,15 +920,34 @@
|
||||
|
||||
@Override
|
||||
public boolean addEntity(Entity entity) {
|
||||
@ -370,47 +360,56 @@
|
||||
}
|
||||
|
||||
public void addEntityTeleport(Entity entity) {
|
||||
@@ -855,13 +996,18 @@
|
||||
this.registerEntity(entityplayer);
|
||||
- this.addEntity0(entity);
|
||||
+ // CraftBukkit start
|
||||
+ this.addEntity0(entity, CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public void addEntityTeleport(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.addEntity0(entity, reason);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void addPlayerCommand(EntityPlayer entityplayer) {
|
||||
@@ -830,27 +975,39 @@
|
||||
this.a((EntityPlayer) entity, Entity.RemovalReason.DISCARDED);
|
||||
}
|
||||
|
||||
- this.entityManager.a((EntityAccess) entityplayer);
|
||||
+ this.entityManager.a(entityplayer); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
- private boolean addEntity0(Entity entity) {
|
||||
+ // CraftBukkit start
|
||||
+ private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
if (entity.dead) {
|
||||
if (entity.isRemoved()) {
|
||||
- WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType()));
|
||||
+ // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit
|
||||
return false;
|
||||
} else if (this.isUUIDTaken(entity)) {
|
||||
return false;
|
||||
} else {
|
||||
- return this.entityManager.a((EntityAccess) entity);
|
||||
+ if (!CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
|
||||
|
||||
if (!(ichunkaccess instanceof Chunk)) {
|
||||
@@ -890,7 +1036,7 @@
|
||||
if (entity1 == null) {
|
||||
return false;
|
||||
} else {
|
||||
- WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId());
|
||||
+ // WorldServer.LOGGER.warn("Trying to add entity with duplicated UUID {}. Existing {}#{}, new: {}#{}", uuid, EntityTypes.getName(entity1.getEntityType()), entity1.getId(), EntityTypes.getName(entity.getEntityType()), entity.getId()); // CraftBukkit
|
||||
return true;
|
||||
+
|
||||
+ return this.entityManager.a(entity); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
@@ -919,10 +1065,16 @@
|
||||
}
|
||||
|
||||
public boolean addAllEntitiesSafely(Entity entity) {
|
||||
- Stream stream = entity.recursiveStream().map(Entity::getUniqueID);
|
||||
+ // CraftBukkit start
|
||||
+ return this.addAllEntitiesSafely(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ public boolean addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ // CraftBukkit end
|
||||
if (entity.recursiveStream().anyMatch(this::isUUIDTaken)) {
|
||||
+ Stream<UUID> stream = entity.recursiveStream().map(Entity::getUniqueID); // CraftBukkit - decompile error
|
||||
PersistentEntitySectionManager persistententitysectionmanager = this.entityManager;
|
||||
|
||||
Objects.requireNonNull(this.entityManager);
|
||||
if (stream.anyMatch(persistententitysectionmanager::a)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.addAllEntities(entity);
|
||||
@ -418,52 +417,8 @@
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -973,10 +1125,17 @@
|
||||
}
|
||||
|
||||
this.getScoreboard().a(entity);
|
||||
+ // CraftBukkit start - SPIGOT-5278
|
||||
+ if (entity instanceof EntityDrowned) {
|
||||
+ this.navigators.remove(((EntityDrowned) entity).navigationWater);
|
||||
+ this.navigators.remove(((EntityDrowned) entity).navigationLand);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.navigators.remove(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
|
||||
+ entity.valid = false; // CraftBukkit
|
||||
}
|
||||
|
||||
private void registerEntity(Entity entity) {
|
||||
@@ -997,9 +1156,16 @@
|
||||
|
||||
this.entitiesByUUID.put(entity.getUniqueID(), entity);
|
||||
this.getChunkProvider().addEntity(entity);
|
||||
+ // CraftBukkit start - SPIGOT-5278
|
||||
+ if (entity instanceof EntityDrowned) {
|
||||
+ this.navigators.add(((EntityDrowned) entity).navigationWater);
|
||||
+ this.navigators.add(((EntityDrowned) entity).navigationLand);
|
||||
+ } else
|
||||
+ // CraftBukkit end
|
||||
if (entity instanceof EntityInsentient) {
|
||||
this.navigators.add(((EntityInsentient) entity).getNavigation());
|
||||
}
|
||||
+ entity.valid = true; // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1015,7 +1181,7 @@
|
||||
}
|
||||
|
||||
private void removeEntityFromChunk(Entity entity) {
|
||||
- IChunkAccess ichunkaccess = this.getChunkAt(entity.chunkX, entity.chunkZ, ChunkStatus.FULL, false);
|
||||
+ IChunkAccess ichunkaccess = chunkProvider.getChunkUnchecked(entity.chunkX, entity.chunkZ); // CraftBukkit - SPIGOT-5228: getChunkAt won't find the entity's chunk if it has already been unloaded (i.e. if it switched to state INACCESSIBLE).
|
||||
|
||||
if (ichunkaccess instanceof Chunk) {
|
||||
((Chunk) ichunkaccess).b(entity);
|
||||
@@ -1029,10 +1195,32 @@
|
||||
this.everyoneSleeping();
|
||||
@@ -863,10 +1020,32 @@
|
||||
entityplayer.a(entity_removalreason);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -495,7 +450,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -1041,6 +1229,12 @@
|
||||
@@ -875,6 +1054,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.locY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
|
||||
|
||||
@ -506,17 +461,17 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1079,7 +1273,18 @@
|
||||
Iterator iterator = this.navigators.iterator();
|
||||
@@ -923,7 +1108,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- NavigationAbstract navigationabstract = (NavigationAbstract) iterator.next();
|
||||
- EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
|
||||
+ // CraftBukkit start - fix SPIGOT-6362
|
||||
+ NavigationAbstract navigationabstract;
|
||||
+ EntityInsentient entityinsentient;
|
||||
+ try {
|
||||
+ navigationabstract = (NavigationAbstract) iterator.next();
|
||||
+ entityinsentient = (EntityInsentient) iterator.next();
|
||||
+ } catch (java.util.ConcurrentModificationException ex) {
|
||||
+ // This can happen because the pathfinder update below may trigger a chunk load, which in turn may cause more navigators to register
|
||||
+ // In this case we just run the update again across all the iterators as the chunk will then be loaded
|
||||
@ -525,10 +480,10 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (!navigationabstract.i()) {
|
||||
navigationabstract.b(blockposition);
|
||||
@@ -1101,10 +1306,20 @@
|
||||
@@ -946,10 +1142,20 @@
|
||||
|
||||
@Override
|
||||
public Explosion createExplosion(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
@ -549,7 +504,7 @@
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
explosion.clearBlocks();
|
||||
}
|
||||
@@ -1169,13 +1384,20 @@
|
||||
@@ -1023,13 +1229,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
@ -572,85 +527,39 @@
|
||||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1217,7 +1439,7 @@
|
||||
@@ -1079,7 +1292,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
|
||||
- return !this.server.getSaveData().getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag);
|
||||
+ return !this.worldDataServer.getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
|
||||
+ return !this.serverLevelData.getGeneratorSettings().shouldGenerateMapFeatures() ? null : this.getChunkProvider().getChunkGenerator().findNearestMapFeature(this, structuregenerator, blockposition, i, flag); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1255,7 +1477,13 @@
|
||||
@@ -1116,11 +1329,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap a(String s) {
|
||||
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
|
||||
- return new WorldMap(s);
|
||||
- return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a(WorldMap::b, s);
|
||||
+ return (WorldMap) this.getMinecraftServer().F().getWorldPersistentData().a((nbttagcompound) -> {
|
||||
+ // CraftBukkit start
|
||||
+ // We only get here when the data file exists, but is not a valid map
|
||||
+ WorldMap newMap = new WorldMap(s);
|
||||
+ WorldMap newMap = WorldMap.b(nbttagcompound);
|
||||
+ newMap.id = s;
|
||||
+ MapInitializeEvent event = new MapInitializeEvent(newMap.mapView);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ return newMap;
|
||||
+ // CraftBukkit end
|
||||
}, s);
|
||||
+ }, s);
|
||||
}
|
||||
|
||||
@@ -1386,9 +1614,9 @@
|
||||
reputationhandler.a(reputationevent, entity);
|
||||
@Override
|
||||
public void a(String s, WorldMap worldmap) {
|
||||
+ worldmap.id = s; // CraftBukkit
|
||||
this.getMinecraftServer().F().getWorldPersistentData().a(s, (PersistentBase) worldmap);
|
||||
}
|
||||
|
||||
- public void a(Path path) throws IOException {
|
||||
+ public void a(java.nio.file.Path java_nio_file_path) throws IOException {
|
||||
PlayerChunkMap playerchunkmap = this.getChunkProvider().playerChunkMap;
|
||||
- BufferedWriter bufferedwriter = Files.newBufferedWriter(path.resolve("stats.txt"));
|
||||
+ BufferedWriter bufferedwriter = Files.newBufferedWriter(java_nio_file_path.resolve("stats.txt"));
|
||||
Throwable throwable = null;
|
||||
|
||||
try {
|
||||
@@ -1432,7 +1660,7 @@
|
||||
CrashReport crashreport = new CrashReport("Level dump", new Exception("dummy"));
|
||||
|
||||
this.a(crashreport);
|
||||
- BufferedWriter bufferedwriter1 = Files.newBufferedWriter(path.resolve("example_crash.txt"));
|
||||
+ BufferedWriter bufferedwriter1 = Files.newBufferedWriter(java_nio_file_path.resolve("example_crash.txt"));
|
||||
Throwable throwable3 = null;
|
||||
|
||||
try {
|
||||
@@ -1455,8 +1683,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path1 = path.resolve("chunks.csv");
|
||||
- BufferedWriter bufferedwriter2 = Files.newBufferedWriter(path1);
|
||||
+ java.nio.file.Path java_nio_file_path1 = java_nio_file_path.resolve("chunks.csv");
|
||||
+ BufferedWriter bufferedwriter2 = Files.newBufferedWriter(java_nio_file_path1);
|
||||
Throwable throwable6 = null;
|
||||
|
||||
try {
|
||||
@@ -1479,8 +1707,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path2 = path.resolve("entities.csv");
|
||||
- BufferedWriter bufferedwriter3 = Files.newBufferedWriter(path2);
|
||||
+ java.nio.file.Path java_nio_file_path2 = java_nio_file_path.resolve("entities.csv");
|
||||
+ BufferedWriter bufferedwriter3 = Files.newBufferedWriter(java_nio_file_path2);
|
||||
Throwable throwable9 = null;
|
||||
|
||||
try {
|
||||
@@ -1503,8 +1731,8 @@
|
||||
|
||||
}
|
||||
|
||||
- Path path3 = path.resolve("block_entities.csv");
|
||||
- BufferedWriter bufferedwriter4 = Files.newBufferedWriter(path3);
|
||||
+ java.nio.file.Path java_nio_file_path3 = java_nio_file_path.resolve("block_entities.csv");
|
||||
+ BufferedWriter bufferedwriter4 = Files.newBufferedWriter(java_nio_file_path3);
|
||||
Throwable throwable12 = null;
|
||||
|
||||
try {
|
||||
@@ -1566,6 +1794,11 @@
|
||||
@@ -1432,6 +1655,11 @@
|
||||
@Override
|
||||
public void update(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebugWorld()) {
|
||||
@ -662,53 +571,40 @@
|
||||
this.applyPhysics(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1580,12 +1813,12 @@
|
||||
@@ -1451,12 +1679,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlatWorld() {
|
||||
- return this.server.getSaveData().getGeneratorSettings().isFlatWorld();
|
||||
+ return this.worldDataServer.getGeneratorSettings().isFlatWorld(); // CraftBukkit
|
||||
+ return this.serverLevelData.getGeneratorSettings().isFlatWorld(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
- return this.server.getSaveData().getGeneratorSettings().getSeed();
|
||||
+ return this.worldDataServer.getGeneratorSettings().getSeed(); // CraftBukkit
|
||||
+ return this.serverLevelData.getGeneratorSettings().getSeed(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1605,9 +1838,9 @@
|
||||
|
||||
@VisibleForTesting
|
||||
public String F() {
|
||||
- return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a((Collection) this.entitiesById.values(), (entity) -> {
|
||||
+ return String.format("players: %s, entities: %d [%s], block_entities: %d [%s], block_ticks: %d, fluid_ticks: %d, chunk_source: %s", this.players.size(), this.entitiesById.size(), a(this.entitiesById.values(), (entity) -> { // CraftBukkit - decompile error
|
||||
return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType());
|
||||
- }), this.tileEntityListTick.size(), a((Collection) this.tileEntityListTick, (tileentity) -> {
|
||||
+ }), this.tileEntityListTick.size(), a(this.tileEntityListTick, (tileentity) -> { // CraftBukkit - decompile error
|
||||
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
|
||||
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
|
||||
}
|
||||
@@ -1615,7 +1848,7 @@
|
||||
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
|
||||
@@ -1484,7 +1712,7 @@
|
||||
private static <T> String a(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
- Iterator iterator = iterable.iterator();
|
||||
+ Iterator<T> iterator = iterable.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1624,7 +1857,8 @@
|
||||
object2intopenhashmap.addTo(minecraftkey, 1);
|
||||
@@ -1493,7 +1721,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> {
|
||||
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
|
||||
}).collect(Collectors.joining(","));
|
||||
} catch (Exception exception) {
|
||||
@@ -1633,16 +1867,32 @@
|
||||
- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry::getIntValue).reversed()).limit(5L).map((entry) -> {
|
||||
+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Entry<String>::getIntValue).reversed()).limit(5L).map((entry) -> { // CraftBukkit - decompile error
|
||||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1504,17 +1732,33 @@
|
||||
}
|
||||
|
||||
public static void a(WorldServer worldserver) {
|
||||
@ -718,7 +614,7 @@
|
||||
+
|
||||
+ public static void a(WorldServer worldserver, Entity entity) {
|
||||
+ // CraftBukkit end
|
||||
BlockPosition blockposition = WorldServer.a;
|
||||
BlockPosition blockposition = WorldServer.END_SPAWN_POINT;
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY() - 2;
|
||||
int k = blockposition.getZ();
|
||||
@ -742,4 +638,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1601,6 +1845,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ entity.valid = true; // CraftBukkit
|
||||
}
|
||||
|
||||
public void a(Entity entity) {
|
||||
@@ -1633,6 +1878,7 @@
|
||||
gameeventlistenerregistrar.a(entity.level);
|
||||
}
|
||||
|
||||
+ entity.valid = false; // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,25 +15,25 @@
|
||||
+ private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
|
||||
+ private static int throttleCounter = 0;
|
||||
+ // CraftBukkit end
|
||||
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer b;
|
||||
private final NetworkManager c;
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = new ChatComponentText("Ignoring status request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -27,6 +36,40 @@
|
||||
switch (packethandshakinginsetprotocol.b()) {
|
||||
case LOGIN:
|
||||
this.c.setProtocol(EnumProtocol.LOGIN);
|
||||
this.connection.setProtocol(EnumProtocol.LOGIN);
|
||||
+ // CraftBukkit start - Connection throttle
|
||||
+ try {
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ long connectionThrottle = this.b.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.c.getSocketAddress()).getAddress();
|
||||
+ long connectionThrottle = this.server.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.connection.getSocketAddress()).getAddress();
|
||||
+
|
||||
+ synchronized (throttleTracker) {
|
||||
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ ChatMessage chatmessage = new ChatMessage("Connection throttled! Please wait before reconnecting.");
|
||||
+ this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.c.close(chatmessage);
|
||||
+ this.connection.sendPacket(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.connection.close(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@ -60,10 +60,10 @@
|
||||
ChatMessage chatmessage;
|
||||
|
||||
@@ -40,6 +83,7 @@
|
||||
this.c.close(chatmessage);
|
||||
this.connection.close(chatmessage);
|
||||
} else {
|
||||
this.c.setPacketListener(new LoginListener(this.b, this.c));
|
||||
+ ((LoginListener) this.c.j()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
this.connection.setPacketListener(new LoginListener(this.server, this.connection));
|
||||
+ ((LoginListener) this.connection.j()).hostname = packethandshakinginsetprotocol.hostName + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname
|
||||
}
|
||||
break;
|
||||
case STATUS:
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/network/LegacyPingHandler.java
|
||||
+++ b/net/minecraft/server/network/LegacyPingHandler.java
|
||||
@@ -35,11 +35,12 @@
|
||||
MinecraftServer minecraftserver = this.b.d();
|
||||
@@ -36,11 +36,12 @@
|
||||
MinecraftServer minecraftserver = this.serverConnectionListener.d();
|
||||
int i = bytebuf.readableBytes();
|
||||
String s;
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
@ -14,7 +14,7 @@
|
||||
this.a(channelhandlercontext, this.a(s));
|
||||
break;
|
||||
case 1:
|
||||
@@ -48,7 +49,7 @@
|
||||
@@ -49,7 +50,7 @@
|
||||
}
|
||||
|
||||
LegacyPingHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
|
||||
@ -23,7 +23,7 @@
|
||||
this.a(channelhandlercontext, this.a(s));
|
||||
break;
|
||||
default:
|
||||
@@ -67,7 +68,7 @@
|
||||
@@ -68,7 +69,7 @@
|
||||
}
|
||||
|
||||
LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -35,6 +35,13 @@
|
||||
@@ -36,6 +36,13 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -13,16 +13,16 @@
|
||||
+
|
||||
public class LoginListener implements PacketLoginInListener {
|
||||
|
||||
private static final AtomicInteger b = new AtomicInteger(0);
|
||||
@@ -49,6 +56,7 @@
|
||||
private final String j;
|
||||
private SecretKey loginKey;
|
||||
private EntityPlayer l;
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
@@ -52,6 +59,7 @@
|
||||
private final String serverId;
|
||||
@Nullable
|
||||
private EntityPlayer delayedAcceptPlayer;
|
||||
+ public String hostname = ""; // CraftBukkit - add field
|
||||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
this.g = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -77,6 +85,20 @@
|
||||
this.state = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -80,6 +88,20 @@
|
||||
|
||||
}
|
||||
|
||||
@ -32,8 +32,8 @@
|
||||
+ try {
|
||||
+ IChatBaseComponent ichatbasecomponent = new ChatComponentText(s);
|
||||
+ LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), s);
|
||||
+ this.networkManager.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent));
|
||||
+ this.networkManager.close(ichatbasecomponent);
|
||||
+ this.connection.sendPacket(new PacketLoginOutDisconnect(ichatbasecomponent));
|
||||
+ this.connection.close(ichatbasecomponent);
|
||||
+ } catch (Exception exception) {
|
||||
+ LoginListener.LOGGER.error("Error whilst disconnecting player", exception);
|
||||
+ }
|
||||
@ -42,14 +42,14 @@
|
||||
+
|
||||
@Override
|
||||
public NetworkManager a() {
|
||||
return this.networkManager;
|
||||
@@ -98,10 +120,12 @@
|
||||
this.i = this.a(this.i);
|
||||
return this.connection;
|
||||
@@ -101,10 +123,12 @@
|
||||
this.gameProfile = this.a(this.gameProfile);
|
||||
}
|
||||
|
||||
- IChatBaseComponent ichatbasecomponent = this.server.getPlayerList().attemptLogin(this.networkManager.getSocketAddress(), this.i);
|
||||
- IChatBaseComponent ichatbasecomponent = this.server.getPlayerList().attemptLogin(this.connection.getSocketAddress(), this.gameProfile);
|
||||
+ // CraftBukkit start - fire PlayerLoginEvent
|
||||
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.i, hostname);
|
||||
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.gameProfile, hostname);
|
||||
|
||||
- if (ichatbasecomponent != null) {
|
||||
- this.disconnect(ichatbasecomponent);
|
||||
@ -57,32 +57,29 @@
|
||||
+ // this.disconnect(ichatbasecomponent);
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.g = LoginListener.EnumProtocolState.ACCEPTED;
|
||||
if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
|
||||
@@ -115,9 +139,9 @@
|
||||
this.state = LoginListener.EnumProtocolState.ACCEPTED;
|
||||
if (this.server.aw() >= 0 && !this.connection.isLocal()) {
|
||||
@@ -117,7 +141,7 @@
|
||||
EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
- this.l = this.server.getPlayerList().processLogin(this.i);
|
||||
+ this.l = this.server.getPlayerList().processLogin(this.i, s); // CraftBukkit - add player reference
|
||||
} else {
|
||||
- this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i));
|
||||
+ this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference
|
||||
}
|
||||
}
|
||||
try {
|
||||
- EntityPlayer entityplayer1 = this.server.getPlayerList().processLogin(this.gameProfile);
|
||||
+ EntityPlayer entityplayer1 = this.server.getPlayerList().processLogin(this.gameProfile, s); // CraftBukkit - add player reference
|
||||
|
||||
@@ -175,6 +199,43 @@
|
||||
if (entityplayer != null) {
|
||||
this.state = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
@@ -191,6 +215,43 @@
|
||||
try {
|
||||
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
|
||||
if (LoginListener.this.i != null) {
|
||||
LoginListener.this.gameProfile = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
|
||||
if (LoginListener.this.gameProfile != null) {
|
||||
+ // CraftBukkit start - fire PlayerPreLoginEvent
|
||||
+ if (!networkManager.isConnected()) {
|
||||
+ if (!connection.isConnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ String playerName = i.getName();
|
||||
+ java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress();
|
||||
+ java.util.UUID uniqueId = i.getId();
|
||||
+ String playerName = gameProfile.getName();
|
||||
+ java.net.InetAddress address = ((java.net.InetSocketAddress) connection.getSocketAddress()).getAddress();
|
||||
+ java.util.UUID uniqueId = gameProfile.getId();
|
||||
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
|
||||
+
|
||||
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
||||
@ -112,10 +109,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
|
||||
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.gameProfile.getName(), LoginListener.this.gameProfile.getId());
|
||||
LoginListener.this.state = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
} else if (LoginListener.this.server.isEmbeddedServer()) {
|
||||
@@ -194,6 +255,11 @@
|
||||
@@ -210,6 +271,11 @@
|
||||
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
|
@ -18,21 +18,21 @@
|
||||
+
|
||||
public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled");
|
||||
private static final IChatBaseComponent DISCONNECT_REASON = new ChatMessage("multiplayer.status.request_handled");
|
||||
@@ -36,8 +48,96 @@
|
||||
this.networkManager.close(PacketStatusListener.a);
|
||||
this.connection.close(PacketStatusListener.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.d = true;
|
||||
- this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
|
||||
this.hasRequestedStatus = true;
|
||||
- this.connection.sendPacket(new PacketStatusOutServerInfo(this.server.getServerPing()));
|
||||
+ // CraftBukkit start
|
||||
+ // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing()));
|
||||
+ final Object[] players = minecraftServer.getPlayerList().players.toArray();
|
||||
+ final Object[] players = server.getPlayerList().players.toArray();
|
||||
+ class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {
|
||||
+
|
||||
+ CraftIconCache icon = minecraftServer.server.getServerIcon();
|
||||
+ CraftIconCache icon = server.server.getServerIcon();
|
||||
+
|
||||
+ ServerListPingEvent() {
|
||||
+ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.getMotd(), minecraftServer.getPlayerList().getMaxPlayers());
|
||||
+ super(((InetSocketAddress) connection.getSocketAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
@ -92,7 +92,7 @@
|
||||
+ }
|
||||
+
|
||||
+ ServerListPingEvent event = new ServerListPingEvent();
|
||||
+ this.minecraftServer.server.getPluginManager().callEvent(event);
|
||||
+ this.server.server.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
|
||||
+ for (Object player : players) {
|
||||
@ -109,9 +109,9 @@
|
||||
+ ping.setMOTD(CraftChatMessage.fromString(event.getMotd(), true)[0]);
|
||||
+ ping.setPlayerSample(playerSample);
|
||||
+ int version = SharedConstants.getGameVersion().getProtocolVersion();
|
||||
+ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version));
|
||||
+ ping.setServerInfo(new ServerPing.ServerData(server.getServerModName() + " " + server.getVersion(), version));
|
||||
+
|
||||
+ this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping));
|
||||
+ this.connection.sendPacket(new PacketStatusOutServerInfo(ping));
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
Datei-Diff unterdrückt, da er zu groß ist
Diff laden
@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/server/network/ServerConnection.java
|
||||
+++ b/net/minecraft/server/network/ServerConnection.java
|
||||
@@ -87,14 +87,24 @@
|
||||
int j = ServerConnection.this.e.k();
|
||||
@@ -96,14 +96,24 @@
|
||||
int j = ServerConnection.this.server.l();
|
||||
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
|
||||
|
||||
- ServerConnection.this.connectedChannels.add(object);
|
||||
+ ServerConnection.this.connectedChannels.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
- ServerConnection.this.connections.add(object);
|
||||
+ ServerConnection.this.connections.add((NetworkManager) object); // CraftBukkit - decompile error
|
||||
channel.pipeline().addLast("packet_handler", (ChannelHandler) object);
|
||||
((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.e, (NetworkManager) object));
|
||||
((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.server, (NetworkManager) object));
|
||||
}
|
||||
- }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).bind().syncUninterruptibly());
|
||||
+ }).group((EventLoopGroup) lazyinitvar.a()).localAddress(inetaddress, i)).option(ChannelOption.AUTO_READ, false).bind().syncUninterruptibly()); // CraftBukkit
|
||||
@ -16,14 +16,14 @@
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void acceptConnections() {
|
||||
+ synchronized (this.listeningChannels) {
|
||||
+ for (ChannelFuture future : this.listeningChannels) {
|
||||
+ synchronized (this.channels) {
|
||||
+ for (ChannelFuture future : this.channels) {
|
||||
+ future.channel().config().setAutoRead(true);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void b() {
|
||||
this.c = false;
|
||||
Iterator iterator = this.listeningChannels.iterator();
|
||||
public SocketAddress a() {
|
||||
List list = this.channels;
|
||||
ChannelFuture channelfuture;
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/server/players/ExpirableListEntry.java
|
||||
+++ b/net/minecraft/server/players/ExpirableListEntry.java
|
||||
@@ -24,7 +24,7 @@
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
|
||||
protected ExpirableListEntry(T t0, JsonObject jsonobject) {
|
||||
@ -9,21 +9,17 @@
|
||||
|
||||
Date date;
|
||||
|
||||
@@ -75,4 +75,26 @@
|
||||
jsonobject.addProperty("expires", this.d == null ? "forever" : ExpirableListEntry.a.format(this.d));
|
||||
jsonobject.addProperty("reason", this.e);
|
||||
@@ -80,4 +80,22 @@
|
||||
jsonobject.addProperty("expires", this.expires == null ? "forever" : ExpirableListEntry.DATE_FORMAT.format(this.expires));
|
||||
jsonobject.addProperty("reason", this.reason);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public Date getCreated() {
|
||||
+ return this.b;
|
||||
+ }
|
||||
+
|
||||
+ private static <T> T checkExpiry(T object, JsonObject jsonobject) {
|
||||
+ Date expires = null;
|
||||
+
|
||||
+ try {
|
||||
+ expires = jsonobject.has("expires") ? a.parse(jsonobject.get("expires").getAsString()) : null;
|
||||
+ expires = jsonobject.has("expires") ? DATE_FORMAT.parse(jsonobject.get("expires").getAsString()) : null;
|
||||
+ } catch (ParseException ex) {
|
||||
+ // Guess we don't have a date
|
||||
+ }
|
||||
|
@ -1,29 +1,29 @@
|
||||
--- a/net/minecraft/server/players/JsonList.java
|
||||
+++ b/net/minecraft/server/players/JsonList.java
|
||||
@@ -52,7 +52,7 @@
|
||||
@@ -54,7 +54,7 @@
|
||||
@Nullable
|
||||
public V get(K k0) {
|
||||
this.g();
|
||||
- return (JsonListEntry) this.d.get(this.a(k0));
|
||||
+ return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
- return (JsonListEntry) this.map.get(this.a(k0));
|
||||
+ return (V) this.map.get(this.a(k0)); // CraftBukkit - fix decompile error
|
||||
}
|
||||
|
||||
public void remove(K k0) {
|
||||
@@ -74,6 +74,12 @@
|
||||
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
|
||||
@@ -76,6 +76,12 @@
|
||||
return (String[]) this.map.keySet().toArray(new String[0]);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Collection<V> getValues() {
|
||||
+ return this.d.values();
|
||||
+ return this.map.values();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean isEmpty() {
|
||||
return this.d.size() < 1;
|
||||
return this.map.size() < 1;
|
||||
}
|
||||
@@ -91,7 +97,7 @@
|
||||
Iterator iterator = this.d.values().iterator();
|
||||
@@ -93,7 +99,7 @@
|
||||
Iterator iterator = this.map.values().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- V v0 = (JsonListEntry) iterator.next();
|
||||
@ -31,30 +31,35 @@
|
||||
|
||||
if (v0.hasExpired()) {
|
||||
list.add(v0.getKey());
|
||||
@@ -101,7 +107,7 @@
|
||||
@@ -103,7 +109,7 @@
|
||||
iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- K k0 = iterator.next();
|
||||
+ K k0 = (K) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
this.d.remove(this.a(k0));
|
||||
this.map.remove(this.a(k0));
|
||||
}
|
||||
@@ -121,7 +127,7 @@
|
||||
@@ -118,11 +124,11 @@
|
||||
|
||||
public void save() throws IOException {
|
||||
JsonArray jsonarray = new JsonArray();
|
||||
- Stream stream = this.map.values().stream().map((jsonlistentry) -> {
|
||||
+ Stream<JsonObject> stream = this.map.values().stream().map((jsonlistentry) -> { // CraftBukkit - decompile error
|
||||
JsonObject jsonobject = new JsonObject();
|
||||
|
||||
jsonlistentry.getClass();
|
||||
Objects.requireNonNull(jsonlistentry);
|
||||
- return (JsonObject) SystemUtils.a((Object) jsonobject, jsonlistentry::a);
|
||||
+ return (JsonObject) SystemUtils.a(jsonobject, jsonlistentry::a); // CraftBukkit - decompile error
|
||||
}).forEach(jsonarray::add);
|
||||
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
|
||||
Throwable throwable = null;
|
||||
});
|
||||
|
||||
Objects.requireNonNull(jsonarray);
|
||||
@@ -165,7 +171,7 @@
|
||||
JsonListEntry<K> jsonlistentry = this.a(jsonobject);
|
||||
|
||||
if (jsonlistentry.getKey() != null) {
|
||||
- this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry);
|
||||
+ this.d.put(this.a(jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error
|
||||
- this.map.put(this.a(jsonlistentry.getKey()), jsonlistentry);
|
||||
+ this.map.put(this.a(jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error
|
||||
}
|
||||
}
|
||||
} catch (Throwable throwable1) {
|
||||
} catch (Throwable throwable) {
|
||||
|
@ -11,8 +11,8 @@
|
||||
+
|
||||
public class NameReferencingFileConverter {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -85,7 +90,7 @@
|
||||
static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -87,7 +92,7 @@
|
||||
try {
|
||||
gameprofilebanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@ -21,7 +21,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +148,7 @@
|
||||
@@ -145,7 +150,7 @@
|
||||
try {
|
||||
ipbanlist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@ -30,7 +30,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -184,7 +189,7 @@
|
||||
@@ -186,7 +191,7 @@
|
||||
try {
|
||||
oplist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@ -39,7 +39,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +233,7 @@
|
||||
@@ -230,7 +235,7 @@
|
||||
try {
|
||||
whitelist.load();
|
||||
} catch (IOException ioexception) {
|
||||
@ -48,7 +48,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,6 +356,30 @@
|
||||
@@ -353,6 +358,30 @@
|
||||
File file5 = new File(file, s2 + ".dat");
|
||||
File file6 = new File(file4, s3 + ".dat");
|
||||
|
||||
@ -76,6 +76,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
NameReferencingFileConverter.b(file4);
|
||||
NameReferencingFileConverter.a(file4);
|
||||
if (!file5.renameTo(file6)) {
|
||||
throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s2);
|
||||
|
@ -1,21 +1,19 @@
|
||||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -90,6 +90,27 @@
|
||||
@@ -93,6 +93,25 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.base.Predicate;
|
||||
+import com.google.common.collect.Iterables;
|
||||
+
|
||||
+import java.util.stream.Collectors;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutChat;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.network.LoginListener;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.CraftWorld;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
@ -27,30 +25,30 @@
|
||||
+
|
||||
public abstract class PlayerList {
|
||||
|
||||
public static final File b = new File("banned-players.json");
|
||||
@@ -99,14 +120,16 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -103,14 +122,16 @@
|
||||
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
|
||||
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
private final MinecraftServer server;
|
||||
- public final List<EntityPlayer> players = Lists.newArrayList();
|
||||
+ public final List<EntityPlayer> players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
|
||||
private final Map<UUID, EntityPlayer> j = Maps.newHashMap();
|
||||
private final GameProfileBanList k;
|
||||
private final IpBanList l;
|
||||
private final OpList operators;
|
||||
private final Map<UUID, EntityPlayer> playersByUUID = Maps.newHashMap();
|
||||
private final GameProfileBanList bans;
|
||||
private final IpBanList ipBans;
|
||||
private final OpList ops;
|
||||
private final WhiteList whitelist;
|
||||
- private final Map<UUID, ServerStatisticManager> o;
|
||||
- private final Map<UUID, AdvancementDataPlayer> p;
|
||||
- private final Map<UUID, ServerStatisticManager> stats;
|
||||
- private final Map<UUID, AdvancementDataPlayer> advancements;
|
||||
+ // CraftBukkit start
|
||||
+ // private final Map<UUID, ServerStatisticManager> o;
|
||||
+ // private final Map<UUID, AdvancementDataPlayer> p;
|
||||
+ // CraftBukkit end
|
||||
public final WorldNBTStorage playerFileData;
|
||||
private boolean hasWhitelist;
|
||||
private final IRegistryCustom.Dimension s;
|
||||
@@ -116,13 +139,23 @@
|
||||
private boolean v;
|
||||
private int w;
|
||||
public final WorldNBTStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final IRegistryCustom.Dimension registryHolder;
|
||||
@@ -120,13 +141,23 @@
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
private int sendAllPlayerInfoIn;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftServer cserver;
|
||||
@ -61,20 +59,20 @@
|
||||
+ minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.k = new GameProfileBanList(PlayerList.b);
|
||||
this.l = new IpBanList(PlayerList.c);
|
||||
this.operators = new OpList(PlayerList.d);
|
||||
this.whitelist = new WhiteList(PlayerList.e);
|
||||
- this.o = Maps.newHashMap();
|
||||
- this.p = Maps.newHashMap();
|
||||
this.bans = new GameProfileBanList(PlayerList.USERBANLIST_FILE);
|
||||
this.ipBans = new IpBanList(PlayerList.IPBANLIST_FILE);
|
||||
this.ops = new OpList(PlayerList.OPLIST_FILE);
|
||||
this.whitelist = new WhiteList(PlayerList.WHITELIST_FILE);
|
||||
- this.stats = Maps.newHashMap();
|
||||
- this.advancements = Maps.newHashMap();
|
||||
+ // CraftBukkit start
|
||||
+ // this.o = Maps.newHashMap();
|
||||
+ // this.p = Maps.newHashMap();
|
||||
+ // CraftBukkit end
|
||||
this.server = minecraftserver;
|
||||
this.s = iregistrycustom_dimension;
|
||||
this.registryHolder = iregistrycustom_dimension;
|
||||
this.maxPlayers = i;
|
||||
@@ -138,6 +171,12 @@
|
||||
@@ -142,6 +173,12 @@
|
||||
usercache.a(gameprofile);
|
||||
NBTTagCompound nbttagcompound = this.a(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
@ -86,8 +84,8 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("Dimension")));
|
||||
@@ -168,7 +207,8 @@
|
||||
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
|
||||
@@ -171,7 +208,8 @@
|
||||
s1 = networkmanager.getSocketAddress().toString();
|
||||
}
|
||||
|
||||
@ -96,16 +94,16 @@
|
||||
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
WorldData worlddata = worldserver1.getWorldData();
|
||||
|
||||
this.a(entityplayer, (EntityPlayer) null, worldserver1);
|
||||
@@ -178,6 +218,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
|
||||
entityplayer.c(nbttagcompound);
|
||||
@@ -181,6 +219,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.playerInteractManager.getGameMode(), entityplayer.playerInteractManager.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.F(), this.s, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
|
||||
playerconnection.sendPacket(new PacketPlayOutLogin(entityplayer.getId(), entityplayer.gameMode.getGameMode(), entityplayer.gameMode.c(), BiomeManager.a(worldserver1.getSeed()), worlddata.isHardcore(), this.server.G(), this.registryHolder, worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), this.getMaxPlayers(), this.viewDistance, flag1, !flag, worldserver1.isDebugWorld(), worldserver1.isFlatWorld()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
|
||||
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
|
||||
@@ -196,19 +237,61 @@
|
||||
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.getAbilities()));
|
||||
@@ -199,19 +238,61 @@
|
||||
} else {
|
||||
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s});
|
||||
}
|
||||
@ -113,10 +111,10 @@
|
||||
+ chatmessage.a(EnumChatFormat.YELLOW);
|
||||
+ String joinMessage = CraftChatMessage.fromComponent(chatmessage);
|
||||
|
||||
- this.sendMessage(chatmessage.a(EnumChatFormat.YELLOW), ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
playerconnection.a(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch);
|
||||
- this.sendMessage(chatmessage.a(EnumChatFormat.YELLOW), ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
playerconnection.b(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
this.players.add(entityplayer);
|
||||
this.j.put(entityplayer.getUniqueID(), entityplayer);
|
||||
this.playersByUUID.put(entityplayer.getUniqueID(), entityplayer);
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
|
||||
+
|
||||
@ -124,7 +122,7 @@
|
||||
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage);
|
||||
+ cserver.getPluginManager().callEvent(playerJoinEvent);
|
||||
+
|
||||
+ if (!entityplayer.playerConnection.networkManager.isConnected()) {
|
||||
+ if (!entityplayer.connection.connection.isConnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
@ -132,7 +130,7 @@
|
||||
+
|
||||
+ if (joinMessage != null && joinMessage.length() > 0) {
|
||||
+ for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) {
|
||||
+ server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b));
|
||||
+ server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
@ -141,26 +139,26 @@
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityplayer);
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{(EntityPlayer) this.players.get(i)}));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{(EntityPlayer) this.players.get(i)}));
|
||||
+ EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
||||
+ entityplayer1.playerConnection.sendPacket(packet);
|
||||
+ entityplayer1.connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ if (!entityplayer.getBukkitEntity().canSee(entityplayer1.getBukkitEntity())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1}));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1}));
|
||||
+ }
|
||||
+ entityplayer.sentListPacket = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+
|
||||
+ // CraftBukkit start - Only add if the player wasn't moved in the event
|
||||
+ if (entityplayer.world == worldserver1 && !worldserver1.getPlayers().contains(entityplayer)) {
|
||||
+ if (entityplayer.level == worldserver1 && !worldserver1.getPlayers().contains(entityplayer)) {
|
||||
+ worldserver1.addPlayerJoin(entityplayer);
|
||||
+ this.server.getBossBattleCustomData().a(entityplayer);
|
||||
}
|
||||
@ -171,8 +169,8 @@
|
||||
+ // CraftBukkit end
|
||||
this.a(entityplayer, worldserver1);
|
||||
if (!this.server.getResourcePack().isEmpty()) {
|
||||
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash());
|
||||
@@ -224,8 +307,11 @@
|
||||
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash(), this.server.aY(), this.server.bb());
|
||||
@@ -227,8 +308,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
@ -186,71 +184,71 @@
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -268,6 +354,8 @@
|
||||
@@ -271,6 +355,8 @@
|
||||
}
|
||||
|
||||
entityplayer.syncInventory();
|
||||
+ // CraftBukkit - Moved from above, added world
|
||||
+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
+ PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.serverLevelData.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ());
|
||||
}
|
||||
|
||||
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -300,30 +388,31 @@
|
||||
@@ -303,30 +389,31 @@
|
||||
}
|
||||
|
||||
public void setPlayerFileData(WorldServer worldserver) {
|
||||
+ if (playerFileData != null) return; // CraftBukkit
|
||||
+ if (playerIo != null) return; // CraftBukkit
|
||||
worldserver.getWorldBorder().a(new IWorldBorderListener() {
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderSizePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderSizePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0, double d1, long i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderLerpSizePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderLerpSizePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, double d0, double d1) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderCenterPacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderCenterPacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(WorldBorder worldborder, int i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderWarningDelayPacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(WorldBorder worldborder, int i) {
|
||||
- PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS));
|
||||
+ PlayerList.this.sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS), worldborder.world);
|
||||
- PlayerList.this.sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder));
|
||||
+ PlayerList.this.sendAll(new ClientboundSetBorderWarningDistancePacket(worldborder), worldborder.world); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -351,14 +440,15 @@
|
||||
@@ -354,14 +441,15 @@
|
||||
}
|
||||
|
||||
protected void savePlayerFile(EntityPlayer entityplayer) {
|
||||
+ if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit
|
||||
this.playerFileData.save(entityplayer);
|
||||
- ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.o.get(entityplayer.getUniqueID());
|
||||
this.playerIo.save(entityplayer);
|
||||
- ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) this.stats.get(entityplayer.getUniqueID());
|
||||
+ ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit
|
||||
|
||||
if (serverstatisticmanager != null) {
|
||||
serverstatisticmanager.save();
|
||||
}
|
||||
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.p.get(entityplayer.getUniqueID());
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.advancements.get(entityplayer.getUniqueID());
|
||||
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancementData(); // CraftBukkit
|
||||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.b();
|
||||
@@ -366,10 +456,24 @@
|
||||
@@ -369,10 +457,24 @@
|
||||
|
||||
}
|
||||
|
||||
@ -262,7 +260,7 @@
|
||||
+
|
||||
+ // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it
|
||||
+ // See SPIGOT-5799, SPIGOT-6145
|
||||
+ if (entityplayer.activeContainer != entityplayer.defaultContainer) {
|
||||
+ if (entityplayer.containerMenu != entityplayer.inventoryMenu) {
|
||||
+ entityplayer.closeInventory();
|
||||
+ }
|
||||
+
|
||||
@ -276,19 +274,18 @@
|
||||
this.savePlayerFile(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -401,18 +505,66 @@
|
||||
@@ -396,18 +498,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.j.remove(uuid);
|
||||
- this.o.remove(uuid);
|
||||
- this.p.remove(uuid);
|
||||
this.playersByUUID.remove(uuid);
|
||||
- this.stats.remove(uuid);
|
||||
- this.advancements.remove(uuid);
|
||||
+ // CraftBukkit start
|
||||
+ // this.o.remove(uuid);
|
||||
+ // this.p.remove(uuid);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entityplayer);
|
||||
@ -296,15 +293,16 @@
|
||||
+ EntityPlayer entityplayer2 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ if (entityplayer2.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) {
|
||||
+ entityplayer2.playerConnection.sendPacket(packet);
|
||||
+ entityplayer2.connection.sendPacket(packet);
|
||||
+ } else {
|
||||
+ entityplayer2.getBukkitEntity().removeDisconnectingPlayer(entityplayer.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+ // This removes the scoreboard (and player reference) for the specific player in the manager
|
||||
+ cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||
}
|
||||
|
||||
@ -314,7 +312,7 @@
|
||||
+ public EntityPlayer attemptLogin(LoginListener loginlistener, GameProfile gameprofile, String hostname) {
|
||||
ChatMessage chatmessage;
|
||||
|
||||
- if (this.k.isBanned(gameprofile)) {
|
||||
- if (this.bans.isBanned(gameprofile)) {
|
||||
+ // Moved from processLogin
|
||||
+ UUID uuid = EntityHuman.a(gameprofile);
|
||||
+ List<EntityPlayer> list = Lists.newArrayList();
|
||||
@ -333,24 +331,24 @@
|
||||
+ while (iterator.hasNext()) {
|
||||
+ entityplayer = (EntityPlayer) iterator.next();
|
||||
+ savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved
|
||||
+ entityplayer.playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.duplicate_login", new Object[0]));
|
||||
+ entityplayer.connection.disconnect(new ChatMessage("multiplayer.disconnect.duplicate_login", new Object[0]));
|
||||
+ }
|
||||
+
|
||||
+ // Instead of kicking then returning, we need to store the kick reason
|
||||
+ // in the event, check with plugins to see if it's ok, and THEN kick
|
||||
+ // depending on the outcome.
|
||||
+ SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress();
|
||||
+ SocketAddress socketaddress = loginlistener.connection.getSocketAddress();
|
||||
+
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD)));
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile);
|
||||
+ Player player = entity.getBukkitEntity();
|
||||
+ PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
|
||||
+
|
||||
+ if (getProfileBans().isBanned(gameprofile) && !getProfileBans().get(gameprofile).hasExpired()) {
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
|
||||
@@ -420,10 +572,12 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())}));
|
||||
@@ -415,10 +565,12 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())}));
|
||||
}
|
||||
|
||||
- return chatmessage;
|
||||
@ -358,33 +356,33 @@
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage));
|
||||
} else if (!this.isWhitelisted(gameprofile)) {
|
||||
- return new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
- } else if (this.l.isBanned(socketaddress)) {
|
||||
- } else if (this.ipBans.isBanned(socketaddress)) {
|
||||
+ chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted");
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, CraftChatMessage.fromComponent(chatmessage));
|
||||
+ } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) {
|
||||
IpBanEntry ipbanentry = this.l.get(socketaddress);
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()});
|
||||
@@ -431,13 +585,25 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.g.format(ipbanentry.getExpires())}));
|
||||
@@ -426,13 +578,25 @@
|
||||
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())}));
|
||||
}
|
||||
|
||||
- return chatmessage;
|
||||
+ // return chatmessage;
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage));
|
||||
} else {
|
||||
- return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ // return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) {
|
||||
- return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ // return this.players.size() >= this.maxPlayers && !this.d(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null;
|
||||
+ if (this.players.size() >= this.maxPlayers && !this.d(gameprofile)) {
|
||||
+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full");
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
+
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+ if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) {
|
||||
+ loginlistener.disconnect(event.getKickMessage());
|
||||
+ return null;
|
||||
}
|
||||
+ }
|
||||
+ return entity;
|
||||
}
|
||||
|
||||
@ -394,10 +392,10 @@
|
||||
UUID uuid = EntityHuman.a(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -473,14 +639,24 @@
|
||||
@@ -459,14 +623,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, worldserver, gameprofile, (PlayerInteractManager) object);
|
||||
return new EntityPlayer(this.server, this.server.F(), gameprofile);
|
||||
+ */
|
||||
+ return player;
|
||||
+ // CraftBukkit end
|
||||
@ -411,7 +409,7 @@
|
||||
+ public EntityPlayer moveToWorld(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
entityplayer.getWorldServer().removePlayer(entityplayer);
|
||||
entityplayer.getWorldServer().a(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
BlockPosition blockposition = entityplayer.getSpawn();
|
||||
float f = entityplayer.getSpawnAngle();
|
||||
boolean flag1 = entityplayer.isSpawnForced();
|
||||
@ -419,24 +417,20 @@
|
||||
WorldServer worldserver = this.server.getWorldServer(entityplayer.getSpawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -500,6 +676,11 @@
|
||||
}
|
||||
@@ -478,6 +652,11 @@
|
||||
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile(), (PlayerInteractManager) object);
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.F();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile());
|
||||
+ // */
|
||||
+ EntityPlayer entityplayer1 = entityplayer;
|
||||
+ org.bukkit.World fromWorld = entityplayer.getBukkitEntity().getWorld();
|
||||
+ entityplayer.viewingCredits = false;
|
||||
+ entityplayer.wonGame = false;
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityplayer1.playerConnection = entityplayer.playerConnection;
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.copyFrom(entityplayer, flag);
|
||||
@@ -513,52 +694,113 @@
|
||||
entityplayer1.addScoreboardTag(s);
|
||||
}
|
||||
@@ -493,49 +672,110 @@
|
||||
|
||||
- this.a(entityplayer1, entityplayer, worldserver1);
|
||||
+ // this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed
|
||||
boolean flag2 = false;
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
@ -472,30 +466,30 @@
|
||||
+ } else {
|
||||
+ Vec3D vec3d1 = Vec3D.c((BaseBlockPosition) blockposition).d(vec3d).d();
|
||||
+
|
||||
+ f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ f1 = (float) MathHelper.f(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.g(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+
|
||||
+ entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false);
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = new Location(worldserver1.getWorld(), vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
+ } else if (blockposition != null) {
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.a, 0.0F));
|
||||
+ entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.f(MathHelper.d(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getWorldServer(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F));
|
||||
}
|
||||
|
||||
- entityplayer1.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
- entityplayer1.setRespawnPosition(worldserver1.getDimensionKey(), blockposition, f, flag1, false);
|
||||
- flag2 = !flag && flag3;
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.a, 0.0F));
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getWorldServer(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = new Location(worldserver1.getWorld(), (double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.1F), (double) ((float) blockposition.getZ() + 0.5F));
|
||||
+ }
|
||||
+
|
||||
- entityplayer1.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ Player respawnPlayer = cserver.getPlayer(entityplayer1);
|
||||
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2);
|
||||
+ cserver.getPluginManager().callEvent(respawnEvent);
|
||||
@ -509,48 +503,48 @@
|
||||
+ entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
+ // CraftBukkit end
|
||||
|
||||
- while (!worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
|
||||
+ while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) {
|
||||
- while (!worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
+ while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ());
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ WorldData worlddata = worldserver1.getWorldData();
|
||||
+ entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
|
||||
+ entityplayer1.connection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.gameMode.getGameMode(), entityplayer1.gameMode.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag));
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ entityplayer1.dead = false;
|
||||
+ entityplayer1.playerConnection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch));
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ entityplayer1.setSneaking(false);
|
||||
|
||||
- WorldData worlddata = entityplayer1.world.getWorldData();
|
||||
- WorldData worlddata = entityplayer1.level.getWorldData();
|
||||
-
|
||||
- entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.world.getDimensionManager(), entityplayer1.world.getDimensionKey(), BiomeManager.a(entityplayer1.getWorldServer().getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), entityplayer1.getWorldServer().isDebugWorld(), entityplayer1.getWorldServer().isFlatWorld(), flag));
|
||||
- entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch);
|
||||
+ // entityplayer1.playerConnection.a(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch);
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(worldserver1.getSpawn(), worldserver1.v()));
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel));
|
||||
- entityplayer1.connection.sendPacket(new PacketPlayOutRespawn(entityplayer1.level.getDimensionManager(), entityplayer1.level.getDimensionKey(), BiomeManager.a(entityplayer1.getWorldServer().getSeed()), entityplayer1.gameMode.getGameMode(), entityplayer1.gameMode.c(), entityplayer1.getWorldServer().isDebugWorld(), entityplayer1.getWorldServer().isFlatWorld(), flag));
|
||||
- entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ // entityplayer1.connection.b(entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutSpawnPosition(worldserver1.getSpawn(), worldserver1.x()));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutExperience(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel));
|
||||
this.a(entityplayer1, worldserver1);
|
||||
this.d(entityplayer1);
|
||||
- worldserver1.addPlayerRespawn(entityplayer1);
|
||||
- this.players.add(entityplayer1);
|
||||
- this.j.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
- this.playersByUUID.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
- entityplayer1.syncInventory();
|
||||
+ if (!entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (!entityplayer.connection.isDisconnected()) {
|
||||
+ worldserver1.addPlayerRespawn(entityplayer1);
|
||||
+ this.players.add(entityplayer1);
|
||||
+ this.j.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
+ this.playersByUUID.put(entityplayer1.getUniqueID(), entityplayer1);
|
||||
+ }
|
||||
+ // entityplayer1.syncInventory();
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
if (flag2) {
|
||||
entityplayer1.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.BLOCK_RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
||||
entityplayer1.connection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F));
|
||||
}
|
||||
+ // Added from changeDimension
|
||||
+ updateClient(entityplayer); // Update health, etc...
|
||||
+ entityplayer.updateAbilities();
|
||||
+ for (Object o1 : entityplayer.getEffects()) {
|
||||
+ MobEffect mobEffect = (MobEffect) o1;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+ }
|
||||
+
|
||||
+ // Fire advancement trigger
|
||||
@ -563,34 +557,34 @@
|
||||
+ }
|
||||
|
||||
+ // Save player file again if they were disconnected
|
||||
+ if (entityplayer.playerConnection.isDisconnected()) {
|
||||
+ if (entityplayer.connection.isDisconnected()) {
|
||||
+ this.savePlayerFile(entityplayer);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -571,7 +813,18 @@
|
||||
@@ -548,7 +788,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.w > 600) {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players));
|
||||
+ // CraftBukkit start
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ final EntityPlayer target = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ target.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, Iterables.filter(this.players, new Predicate<EntityPlayer>() {
|
||||
+ target.connection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players.stream().filter(new Predicate<EntityPlayer>() {
|
||||
+ @Override
|
||||
+ public boolean apply(EntityPlayer input) {
|
||||
+ return target.getBukkitEntity().canSee(input.getBukkitEntity());
|
||||
+ }
|
||||
+ })));
|
||||
+ }).collect(Collectors.toList())));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.w = 0;
|
||||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -584,6 +837,25 @@
|
||||
@@ -565,6 +816,25 @@
|
||||
|
||||
}
|
||||
|
||||
@ -601,30 +595,30 @@
|
||||
+ if (entityhuman != null && entityhuman instanceof EntityPlayer && !entityplayer.getBukkitEntity().canSee(((EntityPlayer) entityhuman).getBukkitEntity())) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ((EntityPlayer) this.players.get(i)).playerConnection.sendPacket(packet);
|
||||
+ ((EntityPlayer) this.players.get(i)).connection.sendPacket(packet);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void sendAll(Packet packet, World world) {
|
||||
+ for (int i = 0; i < world.getPlayers().size(); ++i) {
|
||||
+ ((EntityPlayer) world.getPlayers().get(i)).playerConnection.sendPacket(packet);
|
||||
+ ((EntityPlayer) world.getPlayers().get(i)).connection.sendPacket(packet);
|
||||
+ }
|
||||
+
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
@@ -684,6 +956,7 @@
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -667,6 +937,7 @@
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
+ entityplayer.getBukkitEntity().recalculatePermissions(); // CraftBukkit
|
||||
this.server.getCommandDispatcher().a(entityplayer);
|
||||
}
|
||||
|
||||
@@ -716,6 +989,12 @@
|
||||
@@ -699,6 +970,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
@ -634,23 +628,23 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) {
|
||||
if (entityplayer != entityhuman && entityplayer.level.getDimensionKey() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.locX();
|
||||
double d5 = d1 - entityplayer.locY();
|
||||
@@ -755,23 +1034,34 @@
|
||||
@@ -738,23 +1015,34 @@
|
||||
public void reloadWhitelist() {}
|
||||
|
||||
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
- WorldBorder worldborder = this.server.E().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.world.getWorldBorder(); // CraftBukkit
|
||||
- WorldBorder worldborder = this.server.F().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.level.getWorldBorder(); // CraftBukkit
|
||||
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)));
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(worldserver.getSpawn(), worldserver.v()));
|
||||
entityplayer.connection.sendPacket(new ClientboundInitializeBorderPacket(worldborder));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutSpawnPosition(worldserver.getSpawn(), worldserver.x()));
|
||||
if (worldserver.isRaining()) {
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.b, 0.0F));
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, worldserver.d(1.0F)));
|
||||
- entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, worldserver.b(1.0F)));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.START_RAINING, 0.0F));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, worldserver.d(1.0F)));
|
||||
- entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, worldserver.b(1.0F)));
|
||||
+ // CraftBukkit start - handle player weather
|
||||
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.b, 0.0F));
|
||||
+ // entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, worldserver.d(1.0F)));
|
||||
@ -663,62 +657,52 @@
|
||||
}
|
||||
|
||||
public void updateClient(EntityPlayer entityplayer) {
|
||||
entityplayer.updateInventory(entityplayer.defaultContainer);
|
||||
entityplayer.inventoryMenu.updateInventory();
|
||||
- entityplayer.triggerHealthUpdate();
|
||||
+ // entityplayer.triggerHealthUpdate();
|
||||
+ entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex));
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.world.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.world.getGameRules().getBoolean(GameRules.DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.l, immediateRespawn));
|
||||
+ int i = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.connection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.IMMEDIATE_RESPAWN, immediateRespawn));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -824,31 +1114,54 @@
|
||||
entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET);
|
||||
}
|
||||
|
||||
- entityplayer.playerInteractManager.b(worldserver.getMinecraftServer().getSaveData().getGameType());
|
||||
+ entityplayer.playerInteractManager.b(worldserver.worldDataServer.getGameType()); // CraftBukkit
|
||||
@@ -805,12 +1093,22 @@
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
- for (int i = 0; i < this.players.size(); ++i) {
|
||||
- ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(new ChatMessage("multiplayer.disconnect.server_shutdown"));
|
||||
- ((EntityPlayer) this.players.get(i)).connection.disconnect(new ChatMessage("multiplayer.disconnect.server_shutdown"));
|
||||
+ // CraftBukkit start - disconnect safely
|
||||
+ for (EntityPlayer player : this.players) {
|
||||
+ player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
+ player.connection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ }
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void sendMessage(IChatBaseComponent[] iChatBaseComponents) {
|
||||
+ for (IChatBaseComponent component : iChatBaseComponents) {
|
||||
+ sendMessage(component, ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
+ sendMessage(component, ChatMessageType.SYSTEM, SystemUtils.NIL_UUID);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void sendMessage(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) {
|
||||
this.server.sendMessage(ichatbasecomponent, uuid);
|
||||
- this.sendAll(new PacketPlayOutChat(ichatbasecomponent, chatmessagetype, uuid));
|
||||
+ // CraftBukkit start - we run this through our processor first so we can get web links etc
|
||||
+ this.sendAll(new PacketPlayOutChat(CraftChatMessage.fixComponent(ichatbasecomponent), chatmessagetype, uuid));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
+ public void sendMessage(IChatBaseComponent ichatbasecomponent) {
|
||||
+ this.sendMessage(ichatbasecomponent, ChatMessageType.SYSTEM, SystemUtils.b);
|
||||
Iterator iterator = this.players.iterator();
|
||||
@@ -838,16 +1136,23 @@
|
||||
|
||||
}
|
||||
|
||||
- public ServerStatisticManager getStatisticManager(EntityHuman entityhuman) {
|
||||
- UUID uuid = entityhuman.getUniqueID();
|
||||
- ServerStatisticManager serverstatisticmanager = uuid == null ? null : (ServerStatisticManager) this.o.get(uuid);
|
||||
- ServerStatisticManager serverstatisticmanager = uuid == null ? null : (ServerStatisticManager) this.stats.get(uuid);
|
||||
+ // CraftBukkit start
|
||||
+ public ServerStatisticManager getStatisticManager(EntityPlayer entityhuman) {
|
||||
+ ServerStatisticManager serverstatisticmanager = entityhuman.getStatisticManager();
|
||||
@ -731,7 +715,7 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (serverstatisticmanager == null) {
|
||||
File file = this.server.a(SavedFile.STATS).toFile();
|
||||
File file = this.server.a(SavedFile.PLAYER_STATS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
|
||||
if (!file1.exists()) {
|
||||
@ -740,37 +724,37 @@
|
||||
|
||||
if (file2.exists() && file2.isFile()) {
|
||||
file2.renameTo(file1);
|
||||
@@ -856,7 +1169,7 @@
|
||||
@@ -855,7 +1160,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
- this.o.put(uuid, serverstatisticmanager);
|
||||
- this.stats.put(uuid, serverstatisticmanager);
|
||||
+ // this.o.put(uuid, serverstatisticmanager); // CraftBukkit
|
||||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -864,14 +1177,14 @@
|
||||
@@ -863,14 +1168,14 @@
|
||||
|
||||
public AdvancementDataPlayer f(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUniqueID();
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.p.get(uuid);
|
||||
- AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) this.advancements.get(uuid);
|
||||
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancementData(); // CraftBukkit
|
||||
|
||||
if (advancementdataplayer == null) {
|
||||
File file = this.server.a(SavedFile.ADVANCEMENTS).toFile();
|
||||
File file = this.server.a(SavedFile.PLAYER_ADVANCEMENTS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
|
||||
advancementdataplayer = new AdvancementDataPlayer(this.server.getDataFixer(), this, this.server.getAdvancementData(), file1, entityplayer);
|
||||
- this.p.put(uuid, advancementdataplayer);
|
||||
- this.advancements.put(uuid, advancementdataplayer);
|
||||
+ // this.p.put(uuid, advancementdataplayer); // CraftBukkit
|
||||
}
|
||||
|
||||
advancementdataplayer.a(entityplayer);
|
||||
@@ -907,13 +1220,20 @@
|
||||
@@ -906,13 +1211,20 @@
|
||||
}
|
||||
|
||||
public void reload() {
|
||||
- Iterator iterator = this.p.values().iterator();
|
||||
- Iterator iterator = this.advancements.values().iterator();
|
||||
+ // CraftBukkit start
|
||||
+ /*Iterator iterator = this.p.values().iterator();
|
||||
|
||||
@ -786,5 +770,5 @@
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.sendAll(new PacketPlayOutTags(this.server.getTagRegistry()));
|
||||
this.sendAll(new PacketPlayOutTags(this.server.getTagRegistry().a((IRegistryCustom) this.registryHolder)));
|
||||
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b());
|
||||
|
@ -0,0 +1,20 @@
|
||||
--- a/net/minecraft/server/players/SleepStatus.java
|
||||
+++ b/net/minecraft/server/players/SleepStatus.java
|
||||
@@ -18,7 +18,7 @@
|
||||
}
|
||||
|
||||
public boolean a(int i, List<EntityPlayer> list) {
|
||||
- int j = (int) list.stream().filter(EntityHuman::isDeeplySleeping).count();
|
||||
+ int j = (int) list.stream().filter((eh) -> { return eh.isDeeplySleeping() || eh.fauxSleeping; }).count(); // CraftBukkit
|
||||
|
||||
return j >= this.b(i);
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
- if (!entityplayer.isSpectator()) {
|
||||
+ if (!entityplayer.isSpectator() && !entityplayer.fauxSleeping) { // CraftBukkit
|
||||
++this.activePlayers;
|
||||
if (entityplayer.isSleeping()) {
|
||||
++this.sleepingPlayers;
|
@ -5,7 +5,7 @@
|
||||
package net.minecraft.server.players;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
@@ -83,7 +84,7 @@
|
||||
@@ -92,7 +93,7 @@
|
||||
}
|
||||
|
||||
public void onProfileLookupFailed(GameProfile gameprofile, Exception exception) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/server/rcon/RemoteControlCommandListener.java
|
||||
+++ b/net/minecraft/server/rcon/RemoteControlCommandListener.java
|
||||
@@ -36,6 +36,17 @@
|
||||
return new CommandListenerWrapper(this, Vec3D.b((BaseBlockPosition) worldserver.getSpawn()), Vec2F.a, worldserver, 4, "Rcon", RemoteControlCommandListener.b, this.server, (Entity) null);
|
||||
@@ -37,6 +37,17 @@
|
||||
return new CommandListenerWrapper(this, Vec3D.b((BaseBlockPosition) worldserver.getSpawn()), Vec2F.ZERO, worldserver, 4, "Rcon", RemoteControlCommandListener.RCON_COMPONENT, this.server, (Entity) null);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send a String
|
||||
|
@ -8,21 +8,21 @@
|
||||
+
|
||||
public class RecipeBookServer extends RecipeBook {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -35,7 +37,7 @@
|
||||
public static final String RECIPE_BOOK_TAG = "recipeBook";
|
||||
@@ -36,7 +38,7 @@
|
||||
IRecipe<?> irecipe = (IRecipe) iterator.next();
|
||||
MinecraftKey minecraftkey = irecipe.getKey();
|
||||
|
||||
- if (!this.recipes.contains(minecraftkey) && !irecipe.isComplex()) {
|
||||
+ if (!this.recipes.contains(minecraftkey) && !irecipe.isComplex() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit
|
||||
- if (!this.known.contains(minecraftkey) && !irecipe.isComplex()) {
|
||||
+ if (!this.known.contains(minecraftkey) && !irecipe.isComplex() && CraftEventFactory.handlePlayerRecipeListUpdateEvent(entityplayer, minecraftkey)) { // CraftBukkit
|
||||
this.a(minecraftkey);
|
||||
this.d(minecraftkey);
|
||||
list.add(minecraftkey);
|
||||
@@ -69,6 +71,7 @@
|
||||
@@ -70,6 +72,7 @@
|
||||
}
|
||||
|
||||
private void a(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {
|
||||
+ if (entityplayer.playerConnection == null) return; // SPIGOT-4478 during PlayerLoginEvent
|
||||
entityplayer.playerConnection.sendPacket(new PacketPlayOutRecipes(packetplayoutrecipes_action, list, Collections.emptyList(), this.a()));
|
||||
+ if (entityplayer.connection == null) return; // SPIGOT-4478 during PlayerLoginEvent
|
||||
entityplayer.connection.sendPacket(new PacketPlayOutRecipes(packetplayoutrecipes_action, list, Collections.emptyList(), this.a()));
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
package net.minecraft.stats;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -158,13 +159,12 @@
|
||||
@@ -161,13 +162,12 @@
|
||||
}
|
||||
|
||||
private <T> Optional<Statistic<T>> a(StatisticWrapper<T> statisticwrapper, String s) {
|
||||
@ -15,9 +15,9 @@
|
||||
+ Optional<MinecraftKey> optional = Optional.ofNullable(MinecraftKey.a(s));
|
||||
+ IRegistry<T> iregistry = statisticwrapper.getRegistry();
|
||||
|
||||
- iregistry.getClass();
|
||||
- Objects.requireNonNull(iregistry);
|
||||
- optional = optional.flatMap(iregistry::getOptional);
|
||||
- statisticwrapper.getClass();
|
||||
- Objects.requireNonNull(statisticwrapper);
|
||||
- return optional.map(statisticwrapper::b);
|
||||
+ return optional.flatMap(iregistry::getOptional).map(statisticwrapper::b);
|
||||
+ // CraftBukkit - decompile error end
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -367,6 +367,18 @@
|
||||
@@ -380,6 +380,18 @@
|
||||
datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false));
|
||||
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.b);
|
||||
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ datafixerbuilder.addFixer(new com.mojang.datafixers.DataFix(schema47, false) {
|
||||
@ -19,3 +19,27 @@
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema47, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema47, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema47, false));
|
||||
@@ -693,17 +705,20 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Squid", DataConverterTypes.ENTITY));
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Item Frame", DataConverterTypes.ENTITY));
|
||||
Schema schema131 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
|
||||
- ImmutableMap<String, String> immutablemap = ImmutableMap.builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
|
||||
+ // CraftBukkit - decompile error
|
||||
+ ImmutableMap<String, String> immutablemap = ImmutableMap.<String, String>builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
|
||||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.a(schema131, "Renamed copper block items to new oxidized terms", a((Map) immutablemap)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.b(schema131, "Renamed copper blocks to new oxidized terms", a((Map) immutablemap)));
|
||||
Schema schema132 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
|
||||
- ImmutableMap<String, String> immutablemap1 = ImmutableMap.builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
|
||||
+ // CraftBukkit - decompile error
|
||||
+ ImmutableMap<String, String> immutablemap1 = ImmutableMap.<String, String>builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
|
||||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.a(schema132, "Rename copper item suffixes", a((Map) immutablemap1)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.b(schema132, "Rename copper blocks suffixes", a((Map) immutablemap1)));
|
||||
Schema schema133 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
- ImmutableMap<String, String> immutablemap2 = ImmutableMap.builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
|
||||
+ // CraftBukkit - decompile error
|
||||
+ ImmutableMap<String, String> immutablemap2 = ImmutableMap.<String, String>builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
|
||||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.a(schema133, "Renamed grimstone block items to deepslate", a((Map) immutablemap2)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.b(schema133, "Renamed grimstone blocks to deepslate", a((Map) immutablemap2)));
|
||||
|
@ -11,70 +11,70 @@
|
||||
public class WorldUpgrader {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final ThreadFactory b = (new ThreadFactoryBuilder()).setDaemon(true).build();
|
||||
- private final ImmutableSet<ResourceKey<World>> c;
|
||||
+ private final ImmutableSet<ResourceKey<DimensionManager>> c; // CraftBukkit
|
||||
private final boolean d;
|
||||
private final Convertable.ConversionSession e;
|
||||
private final Thread f;
|
||||
private static final ThreadFactory THREAD_FACTORY = (new ThreadFactoryBuilder()).setDaemon(true).build();
|
||||
- private final ImmutableSet<ResourceKey<World>> levels;
|
||||
+ private final ImmutableSet<ResourceKey<DimensionManager>> levels; // CraftBukkit
|
||||
private final boolean eraseCache;
|
||||
private final Convertable.ConversionSession levelStorage;
|
||||
private final Thread thread;
|
||||
@@ -49,12 +53,12 @@
|
||||
private volatile int k;
|
||||
private volatile int l;
|
||||
private volatile int m;
|
||||
- private final Object2FloatMap<ResourceKey<World>> n = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k()));
|
||||
+ private final Object2FloatMap<ResourceKey<DimensionManager>> n = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k())); // CraftBukkit
|
||||
private volatile IChatBaseComponent o = new ChatMessage("optimizeWorld.stage.counting");
|
||||
private static final Pattern p = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
||||
private final WorldPersistentData q;
|
||||
private volatile int totalChunks;
|
||||
private volatile int converted;
|
||||
private volatile int skipped;
|
||||
- private final Object2FloatMap<ResourceKey<World>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k()));
|
||||
+ private final Object2FloatMap<ResourceKey<DimensionManager>> progressMap = Object2FloatMaps.synchronize(new Object2FloatOpenCustomHashMap(SystemUtils.k())); // CraftBukkit
|
||||
private volatile IChatBaseComponent status = new ChatMessage("optimizeWorld.stage.counting");
|
||||
private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
||||
private final WorldPersistentData overworldDataStorage;
|
||||
|
||||
- public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, ImmutableSet<ResourceKey<World>> immutableset, boolean flag) {
|
||||
+ public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, ImmutableSet<ResourceKey<DimensionManager>> immutableset, boolean flag) { // CraftBukkit
|
||||
this.c = immutableset;
|
||||
this.d = flag;
|
||||
this.g = datafixer;
|
||||
this.levels = immutableset;
|
||||
this.eraseCache = flag;
|
||||
this.dataFixer = datafixer;
|
||||
@@ -82,12 +86,12 @@
|
||||
|
||||
private void i() {
|
||||
this.k = 0;
|
||||
this.totalChunks = 0;
|
||||
- Builder<ResourceKey<World>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder();
|
||||
+ Builder<ResourceKey<DimensionManager>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder(); // CraftBukkit
|
||||
|
||||
List list;
|
||||
|
||||
for (UnmodifiableIterator unmodifiableiterator = this.c.iterator(); unmodifiableiterator.hasNext(); this.k += list.size()) {
|
||||
for (UnmodifiableIterator unmodifiableiterator = this.levels.iterator(); unmodifiableiterator.hasNext(); this.totalChunks += list.size()) {
|
||||
- ResourceKey<World> resourcekey = (ResourceKey) unmodifiableiterator.next();
|
||||
+ ResourceKey<DimensionManager> resourcekey = (ResourceKey) unmodifiableiterator.next(); // CraftBukkit
|
||||
|
||||
list = this.b(resourcekey);
|
||||
builder.put(resourcekey, list.listIterator());
|
||||
@@ -97,18 +101,18 @@
|
||||
this.i = true;
|
||||
this.finished = true;
|
||||
} else {
|
||||
float f = (float) this.k;
|
||||
float f = (float) this.totalChunks;
|
||||
- ImmutableMap<ResourceKey<World>, ListIterator<ChunkCoordIntPair>> immutablemap = builder.build();
|
||||
- Builder<ResourceKey<World>, IChunkLoader> builder1 = ImmutableMap.builder();
|
||||
+ ImmutableMap<ResourceKey<DimensionManager>, ListIterator<ChunkCoordIntPair>> immutablemap = builder.build(); // CraftBukkit
|
||||
+ Builder<ResourceKey<DimensionManager>, IChunkLoader> builder1 = ImmutableMap.builder(); // CraftBukkit
|
||||
UnmodifiableIterator unmodifiableiterator1 = this.c.iterator();
|
||||
UnmodifiableIterator unmodifiableiterator1 = this.levels.iterator();
|
||||
|
||||
while (unmodifiableiterator1.hasNext()) {
|
||||
- ResourceKey<World> resourcekey1 = (ResourceKey) unmodifiableiterator1.next();
|
||||
- File file = this.e.a(resourcekey1);
|
||||
- File file = this.levelStorage.a(resourcekey1);
|
||||
+ ResourceKey<DimensionManager> resourcekey1 = (ResourceKey) unmodifiableiterator1.next(); // CraftBukkit
|
||||
+ File file = this.e.a(null); // CraftBukkit
|
||||
+ File file = this.levelStorage.a((ResourceKey) null); // CraftBukkit
|
||||
|
||||
builder1.put(resourcekey1, new IChunkLoader(new File(file, "region"), this.g, true));
|
||||
builder1.put(resourcekey1, new IChunkLoader(new File(file, "region"), this.dataFixer, true));
|
||||
}
|
||||
|
||||
- ImmutableMap<ResourceKey<World>, IChunkLoader> immutablemap1 = builder1.build();
|
||||
+ ImmutableMap<ResourceKey<DimensionManager>, IChunkLoader> immutablemap1 = builder1.build(); // CraftBukkit
|
||||
long i = SystemUtils.getMonotonicMillis();
|
||||
|
||||
this.o = new ChatMessage("optimizeWorld.stage.upgrading");
|
||||
this.status = new ChatMessage("optimizeWorld.stage.upgrading");
|
||||
@@ -120,7 +124,7 @@
|
||||
float f2;
|
||||
|
||||
for (UnmodifiableIterator unmodifiableiterator2 = this.c.iterator(); unmodifiableiterator2.hasNext(); f1 += f2) {
|
||||
for (UnmodifiableIterator unmodifiableiterator2 = this.levels.iterator(); unmodifiableiterator2.hasNext(); f1 += f2) {
|
||||
- ResourceKey<World> resourcekey2 = (ResourceKey) unmodifiableiterator2.next();
|
||||
+ ResourceKey<DimensionManager> resourcekey2 = (ResourceKey) unmodifiableiterator2.next(); // CraftBukkit
|
||||
ListIterator<ChunkCoordIntPair> listiterator = (ListIterator) immutablemap.get(resourcekey2);
|
||||
@ -83,7 +83,7 @@
|
||||
@@ -135,7 +139,7 @@
|
||||
int j = IChunkLoader.a(nbttagcompound);
|
||||
NBTTagCompound nbttagcompound1 = ichunkloader.getChunkData(resourcekey2, () -> {
|
||||
return this.q;
|
||||
return this.overworldDataStorage;
|
||||
- }, nbttagcompound);
|
||||
+ }, nbttagcompound, chunkcoordintpair, null); // CraftBukkit
|
||||
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("Level");
|
||||
@ -94,9 +94,18 @@
|
||||
}
|
||||
|
||||
- private List<ChunkCoordIntPair> b(ResourceKey<World> resourcekey) {
|
||||
- File file = this.e.a(resourcekey);
|
||||
- File file = this.levelStorage.a(resourcekey);
|
||||
+ private List<ChunkCoordIntPair> b(ResourceKey<DimensionManager> resourcekey) { // CraftBukkit
|
||||
+ File file = this.e.a(null); // CraftBukkit
|
||||
+ File file = this.levelStorage.a((ResourceKey) null); // CraftBukkit
|
||||
File file1 = new File(file, "region");
|
||||
File[] afile = file1.listFiles((file2, s) -> {
|
||||
return s.endsWith(".mca");
|
||||
@@ -269,7 +273,7 @@
|
||||
}
|
||||
|
||||
public ImmutableSet<ResourceKey<World>> c() {
|
||||
- return this.levels;
|
||||
+ throw new AssertionError("Unsupported"); // CraftBukkit
|
||||
}
|
||||
|
||||
public float a(ResourceKey<World> resourcekey) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
@Immutable
|
||||
public class ChestLock {
|
||||
|
||||
@@ -15,7 +20,19 @@
|
||||
@@ -16,7 +21,19 @@
|
||||
}
|
||||
|
||||
public boolean a(ItemStack itemstack) {
|
||||
|
@ -11,8 +11,8 @@
|
||||
+
|
||||
public interface IInventory extends Clearable {
|
||||
|
||||
int getSize();
|
||||
@@ -19,9 +24,7 @@
|
||||
int LARGE_MAX_STACK_SIZE = 64;
|
||||
@@ -21,9 +26,7 @@
|
||||
|
||||
void setItem(int i, ItemStack itemstack);
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
void update();
|
||||
|
||||
@@ -60,4 +63,29 @@
|
||||
@@ -62,4 +65,29 @@
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -15,8 +15,8 @@
|
||||
+
|
||||
public class InventoryLargeChest implements IInventory {
|
||||
|
||||
public final IInventory left;
|
||||
public final IInventory right;
|
||||
public final IInventory container1;
|
||||
public final IInventory container2;
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
@ -30,14 +30,14 @@
|
||||
+ }
|
||||
+
|
||||
+ public void onOpen(CraftHumanEntity who) {
|
||||
+ this.left.onOpen(who);
|
||||
+ this.right.onOpen(who);
|
||||
+ this.container1.onOpen(who);
|
||||
+ this.container2.onOpen(who);
|
||||
+ transaction.add(who);
|
||||
+ }
|
||||
+
|
||||
+ public void onClose(CraftHumanEntity who) {
|
||||
+ this.left.onClose(who);
|
||||
+ this.right.onClose(who);
|
||||
+ this.container1.onClose(who);
|
||||
+ this.container2.onClose(who);
|
||||
+ transaction.remove(who);
|
||||
+ }
|
||||
+
|
||||
@ -50,13 +50,13 @@
|
||||
+ }
|
||||
+
|
||||
+ public void setMaxStackSize(int size) {
|
||||
+ this.left.setMaxStackSize(size);
|
||||
+ this.right.setMaxStackSize(size);
|
||||
+ this.container1.setMaxStackSize(size);
|
||||
+ this.container2.setMaxStackSize(size);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Location getLocation() {
|
||||
+ return left.getLocation(); // TODO: right?
|
||||
+ return container1.getLocation(); // TODO: right?
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@ -67,8 +67,8 @@
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
- return this.left.getMaxStackSize();
|
||||
+ return Math.min(this.left.getMaxStackSize(), this.right.getMaxStackSize()); // CraftBukkit - check both sides
|
||||
- return this.container1.getMaxStackSize();
|
||||
+ return Math.min(this.container1.getMaxStackSize(), this.container2.getMaxStackSize()); // CraftBukkit - check both sides
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,9 +12,9 @@
|
||||
+
|
||||
public class InventorySubcontainer implements IInventory, AutoRecipeOutput {
|
||||
|
||||
private final int a;
|
||||
private final int size;
|
||||
public final NonNullList<ItemStack> items;
|
||||
private List<IInventoryListener> c;
|
||||
private List<IInventoryListener> listeners;
|
||||
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
|
||||
@ -56,8 +56,8 @@
|
||||
+ }
|
||||
+
|
||||
+ public InventorySubcontainer(InventorySubcontainer original) {
|
||||
+ this(original.a);
|
||||
+ for (int slot = 0; slot < original.a; slot++) {
|
||||
+ this(original.size);
|
||||
+ for (int slot = 0; slot < original.size; slot++) {
|
||||
+ this.items.set(slot, original.items.get(slot).cloneItemStack());
|
||||
+ }
|
||||
+ }
|
||||
@ -69,6 +69,6 @@
|
||||
+ public InventorySubcontainer(int i, org.bukkit.inventory.InventoryHolder owner) {
|
||||
+ this.bukkitOwner = owner;
|
||||
+ // CraftBukkit end
|
||||
this.a = i;
|
||||
this.items = NonNullList.a(i, ItemStack.b);
|
||||
this.size = i;
|
||||
this.items = NonNullList.a(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -46,6 +46,18 @@
|
||||
private boolean D;
|
||||
private boolean E;
|
||||
public final String translationIndex;
|
||||
@@ -52,6 +52,18 @@
|
||||
private boolean isFall;
|
||||
private boolean noAggro;
|
||||
public final String msgId;
|
||||
+ // CraftBukkit start
|
||||
+ private boolean sweep;
|
||||
+
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
|
||||
+++ b/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
|
||||
@@ -37,4 +37,10 @@
|
||||
@@ -38,4 +38,10 @@
|
||||
|
||||
return !itemstack.isEmpty() && itemstack.hasName() ? new ChatMessage(s1, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.C()}) : new ChatMessage(s, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent});
|
||||
return !itemstack.isEmpty() && itemstack.hasName() ? new ChatMessage(s1, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.G()}) : new ChatMessage(s, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent});
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -13,16 +13,7 @@
|
||||
+
|
||||
public class MobEffectList {
|
||||
|
||||
private final Map<AttributeBase, AttributeModifier> a = Maps.newHashMap();
|
||||
@@ -33,7 +40,7 @@
|
||||
}
|
||||
|
||||
public static int getId(MobEffectList mobeffectlist) {
|
||||
- return IRegistry.MOB_EFFECT.a((Object) mobeffectlist);
|
||||
+ return IRegistry.MOB_EFFECT.a(mobeffectlist); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
protected MobEffectList(MobEffectInfo mobeffectinfo, int i) {
|
||||
private final Map<AttributeBase, AttributeModifier> attributeModifiers = Maps.newHashMap();
|
||||
@@ -44,26 +51,37 @@
|
||||
public void tick(EntityLiving entityliving, int i) {
|
||||
if (this == MobEffects.REGENERATION) {
|
||||
@ -41,7 +32,7 @@
|
||||
- ((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1));
|
||||
+ ((EntityHuman) entityliving).applyExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
|
||||
if (!entityliving.world.isClientSide) {
|
||||
if (!entityliving.level.isClientSide) {
|
||||
- ((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
@ -53,11 +44,11 @@
|
||||
+ entityhuman.getFoodData().eat(event.getFoodLevel() - oldFoodLevel, 1.0F);
|
||||
+ }
|
||||
+
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else if ((this != MobEffects.HEAL || entityliving.dj()) && (this != MobEffects.HARM || !entityliving.dj())) {
|
||||
if (this == MobEffects.HARM && !entityliving.dj() || this == MobEffects.HEAL && entityliving.dj()) {
|
||||
} else if ((this != MobEffects.HEAL || entityliving.dT()) && (this != MobEffects.HARM || !entityliving.dT())) {
|
||||
if (this == MobEffects.HARM && !entityliving.dT() || this == MobEffects.HEAL && entityliving.dT()) {
|
||||
entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
|
||||
}
|
||||
} else {
|
||||
|
@ -12,6 +12,6 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public MobEffects() {}
|
||||
|
||||
private static MobEffectList a(int i, String s, MobEffectList mobeffectlist) {
|
||||
return (MobEffectList) IRegistry.a(IRegistry.MOB_EFFECT, i, s, mobeffectlist);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -106,8 +106,58 @@
|
||||
@@ -116,8 +116,58 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
+import org.bukkit.plugin.PluginManager;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class Entity implements INamableTileEntity, ICommandListener {
|
||||
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener {
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private static final int CURRENT_LEVEL = 2;
|
||||
@ -45,7 +45,7 @@
|
||||
+
|
||||
+ public CraftEntity getBukkitEntity() {
|
||||
+ if (bukkitEntity == null) {
|
||||
+ bukkitEntity = CraftEntity.getEntity(world.getServer(), this);
|
||||
+ bukkitEntity = CraftEntity.getEntity(level.getServer(), this);
|
||||
+ }
|
||||
+ return bukkitEntity;
|
||||
+ }
|
||||
@ -57,12 +57,12 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final AtomicInteger entityCount = new AtomicInteger();
|
||||
private static final List<ItemStack> c = Collections.emptyList();
|
||||
@@ -191,6 +241,21 @@
|
||||
private long aB;
|
||||
private EntitySize size;
|
||||
private float headHeight;
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -224,6 +274,21 @@
|
||||
private float crystalSoundIntensity;
|
||||
private int lastCrystalSoundPlayTick;
|
||||
public boolean hasVisualFire;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean persist = true;
|
||||
+ public boolean valid;
|
||||
@ -71,30 +71,30 @@
|
||||
+ public boolean persistentInvisibility = false;
|
||||
+
|
||||
+ public float getBukkitYaw() {
|
||||
+ return this.yaw;
|
||||
+ return this.yRot;
|
||||
+ }
|
||||
+
|
||||
+ public boolean isChunkLoaded() {
|
||||
+ return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4);
|
||||
+ return level.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.entityCount.incrementAndGet();
|
||||
@@ -297,6 +362,12 @@
|
||||
}
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -359,6 +424,12 @@
|
||||
public void ae() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entitypose == this.getPose()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[entitypose.ordinal()]));
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityPoseChangeEvent(this.getBukkitEntity(), Pose.values()[entitypose.ordinal()]));
|
||||
+ // CraftBukkit end
|
||||
this.datawatcher.set(Entity.POSE, entitypose);
|
||||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -313,6 +384,33 @@
|
||||
@@ -375,6 +446,33 @@
|
||||
}
|
||||
|
||||
protected void setYawPitch(float f, float f1) {
|
||||
@ -105,7 +105,7 @@
|
||||
+
|
||||
+ if (f == Float.POSITIVE_INFINITY || f == Float.NEGATIVE_INFINITY) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw");
|
||||
+ this.level.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid yaw");
|
||||
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite yaw (Hacking?)");
|
||||
+ }
|
||||
+ f = 0;
|
||||
@ -118,25 +118,17 @@
|
||||
+
|
||||
+ if (f1 == Float.POSITIVE_INFINITY || f1 == Float.NEGATIVE_INFINITY) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ this.world.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch");
|
||||
+ this.level.getServer().getLogger().warning(this.getName() + " was caught trying to crash the server with an invalid pitch");
|
||||
+ ((CraftPlayer) this.getBukkitEntity()).kickPlayer("Infinite pitch (Hacking?)");
|
||||
+ }
|
||||
+ f1 = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.yaw = f % 360.0F;
|
||||
this.pitch = f1 % 360.0F;
|
||||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -320,6 +418,7 @@
|
||||
public void setPosition(double d0, double d1, double d2) {
|
||||
this.setPositionRaw(d0, d1, d2);
|
||||
this.a(this.size.a(d0, d1, d2));
|
||||
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
|
||||
}
|
||||
|
||||
protected void af() {
|
||||
@@ -334,6 +433,15 @@
|
||||
@@ -416,6 +514,15 @@
|
||||
this.entityBaseTick();
|
||||
}
|
||||
|
||||
@ -150,30 +142,30 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void entityBaseTick() {
|
||||
this.world.getMethodProfiler().enter("entityBaseTick");
|
||||
if (this.isPassenger() && this.getVehicle().dead) {
|
||||
@@ -347,7 +455,7 @@
|
||||
this.z = this.A;
|
||||
this.lastPitch = this.pitch;
|
||||
this.lastYaw = this.yaw;
|
||||
this.level.getMethodProfiler().enter("entityBaseTick");
|
||||
if (this.isPassenger() && this.getVehicle().isRemoved()) {
|
||||
@@ -429,7 +536,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
- this.doPortalTick();
|
||||
+ if (this instanceof EntityPlayer) this.doPortalTick(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.aO()) {
|
||||
this.aP();
|
||||
if (this.aV()) {
|
||||
this.aW();
|
||||
}
|
||||
@@ -410,12 +518,44 @@
|
||||
@@ -507,7 +614,23 @@
|
||||
|
||||
protected void burnFromLava() {
|
||||
public void burnFromLava() {
|
||||
if (!this.isFireProof()) {
|
||||
- this.setOnFire(15);
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && fireTicks <= 0) {
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
+ // not on fire yet
|
||||
+ // TODO: shouldn't be sending null for the block
|
||||
+ org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
|
||||
+ org.bukkit.entity.Entity damagee = this.getBukkitEntity();
|
||||
+ EntityCombustEvent combustEvent = new org.bukkit.event.entity.EntityCombustByBlockEvent(damager, damagee, 15);
|
||||
+ this.world.getServer().getPluginManager().callEvent(combustEvent);
|
||||
+ this.level.getServer().getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ this.setOnFire(combustEvent.getDuration(), false);
|
||||
@ -183,8 +175,10 @@
|
||||
+ this.setOnFire(15, false);
|
||||
+ }
|
||||
+ // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls
|
||||
this.damageEntity(DamageSource.LAVA, 4.0F);
|
||||
}
|
||||
if (this.damageEntity(DamageSource.LAVA, 4.0F)) {
|
||||
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
|
||||
}
|
||||
@@ -516,6 +639,22 @@
|
||||
}
|
||||
|
||||
public void setOnFire(int i) {
|
||||
@ -195,7 +189,7 @@
|
||||
+ public void setOnFire(int i, boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
@ -207,114 +201,92 @@
|
||||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -512,6 +652,28 @@
|
||||
block.a((IBlockAccess) this.world, this);
|
||||
}
|
||||
@@ -614,6 +753,28 @@
|
||||
block.a((IBlockAccess) this.level, this);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (positionChanged && getBukkitEntity() instanceof Vehicle) {
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ org.bukkit.block.Block bl = this.world.getWorld().getBlockAt(MathHelper.floor(this.locX()), MathHelper.floor(this.locY()), MathHelper.floor(this.locZ()));
|
||||
+ // CraftBukkit start
|
||||
+ if (horizontalCollision && getBukkitEntity() instanceof Vehicle) {
|
||||
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
|
||||
+ org.bukkit.block.Block bl = this.level.getWorld().getBlockAt(MathHelper.floor(this.locX()), MathHelper.floor(this.locY()), MathHelper.floor(this.locZ()));
|
||||
+
|
||||
+ if (vec3d.x > vec3d1.x) {
|
||||
+ bl = bl.getRelative(BlockFace.EAST);
|
||||
+ } else if (vec3d.x < vec3d1.x) {
|
||||
+ bl = bl.getRelative(BlockFace.WEST);
|
||||
+ } else if (vec3d.z > vec3d1.z) {
|
||||
+ bl = bl.getRelative(BlockFace.SOUTH);
|
||||
+ } else if (vec3d.z < vec3d1.z) {
|
||||
+ bl = bl.getRelative(BlockFace.NORTH);
|
||||
+ if (vec3d.x > vec3d1.x) {
|
||||
+ bl = bl.getRelative(BlockFace.EAST);
|
||||
+ } else if (vec3d.x < vec3d1.x) {
|
||||
+ bl = bl.getRelative(BlockFace.WEST);
|
||||
+ } else if (vec3d.z > vec3d1.z) {
|
||||
+ bl = bl.getRelative(BlockFace.SOUTH);
|
||||
+ } else if (vec3d.z < vec3d1.z) {
|
||||
+ bl = bl.getRelative(BlockFace.NORTH);
|
||||
+ }
|
||||
+
|
||||
+ if (!bl.getType().isAir()) {
|
||||
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
|
||||
+ level.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ if (!bl.getType().isAir()) {
|
||||
+ VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, bl);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.onGround && !this.bv()) {
|
||||
block.stepOn(this.world, blockposition, this);
|
||||
}
|
||||
@@ -785,6 +947,7 @@
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
|
||||
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
|
||||
+ if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit
|
||||
}
|
||||
|
||||
protected SoundEffect getSoundSwim() {
|
||||
@@ -1110,6 +1273,13 @@
|
||||
}
|
||||
|
||||
public void spawnIn(World world) {
|
||||
+ // CraftBukkit start
|
||||
+ if (world == null) {
|
||||
+ die();
|
||||
+ this.world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@@ -1129,6 +1299,7 @@
|
||||
this.lastY = d1;
|
||||
this.lastZ = d4;
|
||||
if (this.onGround && !this.bE()) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1276,6 +1437,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPosition(d3, d1, d4);
|
||||
+ world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit
|
||||
+ level.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit
|
||||
}
|
||||
|
||||
public void d(Vec3D vec3d) {
|
||||
@@ -1303,6 +1474,12 @@
|
||||
@@ -1466,6 +1628,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - collidable API
|
||||
+ public boolean canCollideWith(Entity entity) {
|
||||
+ public boolean canCollideWithBukkit(Entity entity) {
|
||||
+ return isCollidable();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public void a(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1313,7 +1490,7 @@
|
||||
public boolean a_(NBTTagCompound nbttagcompound) {
|
||||
String s = this.getSaveID();
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.a((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1499,7 +1667,7 @@
|
||||
} else {
|
||||
String s = this.getSaveID();
|
||||
|
||||
- if (!this.dead && s != null) {
|
||||
+ if (this.persist && !this.dead && s != null) { // CraftBukkit - persist flag
|
||||
nbttagcompound.setString("id", s);
|
||||
this.save(nbttagcompound);
|
||||
return true;
|
||||
@@ -1337,6 +1514,18 @@
|
||||
- if (s == null) {
|
||||
+ if (!this.persist || s == null) { // CraftBukkit - persist flag
|
||||
return false;
|
||||
} else {
|
||||
nbttagcompound.setString("id", s);
|
||||
@@ -1524,6 +1692,18 @@
|
||||
Vec3D vec3d = this.getMot();
|
||||
|
||||
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
|
||||
nbttagcompound.set("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
+
|
||||
+ // CraftBukkit start - Checking for NaN pitch/yaw and resetting to zero
|
||||
+ // TODO: make sure this is the best way to address this.
|
||||
+ if (Float.isNaN(this.yaw)) {
|
||||
+ this.yaw = 0;
|
||||
+ if (Float.isNaN(this.yRot)) {
|
||||
+ this.yRot = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (Float.isNaN(this.pitch)) {
|
||||
+ this.pitch = 0;
|
||||
+ if (Float.isNaN(this.xRot)) {
|
||||
+ this.xRot = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
|
||||
nbttagcompound.set("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.setFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.setShort("Fire", (short) this.fireTicks);
|
||||
@@ -1345,6 +1534,18 @@
|
||||
nbttagcompound.setShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1532,6 +1712,18 @@
|
||||
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.a("UUID", this.getUniqueID());
|
||||
+ // CraftBukkit start
|
||||
+ // PAIL: Check above UUID reads 1.8 properly, ie: UUIDMost / UUIDLeast
|
||||
+ nbttagcompound.setLong("WorldUUIDLeast", ((WorldServer) this.world).getWorld().getUID().getLeastSignificantBits());
|
||||
+ nbttagcompound.setLong("WorldUUIDMost", ((WorldServer) this.world).getWorld().getUID().getMostSignificantBits());
|
||||
+ nbttagcompound.setLong("WorldUUIDLeast", ((WorldServer) this.level).getWorld().getUID().getLeastSignificantBits());
|
||||
+ nbttagcompound.setLong("WorldUUIDMost", ((WorldServer) this.level).getWorld().getUID().getMostSignificantBits());
|
||||
+ nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
|
||||
+ if (!this.persist) {
|
||||
+ nbttagcompound.setBoolean("Bukkit.persist", this.persist);
|
||||
@ -326,7 +298,7 @@
|
||||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1402,6 +1603,11 @@
|
||||
@@ -1599,6 +1791,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -338,7 +310,7 @@
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
|
||||
@@ -1479,6 +1685,49 @@
|
||||
@@ -1680,6 +1877,49 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
@ -350,7 +322,7 @@
|
||||
+ // Reset the persistence for tamed animals
|
||||
+ if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
|
||||
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
|
||||
+ entityinsentient.persistent = !entityinsentient.isTypeNotPersistent(0);
|
||||
+ entityinsentient.persistenceRequired = !entityinsentient.isTypeNotPersistent(0);
|
||||
+ }
|
||||
+ }
|
||||
+ this.persist = !nbttagcompound.hasKey("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist");
|
||||
@ -375,7 +347,7 @@
|
||||
+ bworld = ((org.bukkit.craftbukkit.CraftServer) server).getServer().getWorldServer(World.OVERWORLD).getWorld();
|
||||
+ }
|
||||
+
|
||||
+ spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
|
||||
+ ((EntityPlayer) this).spawnIn(bworld == null ? null : ((CraftWorld) bworld).getHandle());
|
||||
+ }
|
||||
+ this.getBukkitEntity().readBukkitValues(nbttagcompound);
|
||||
+ if (nbttagcompound.hasKey("Bukkit.invisible")) {
|
||||
@ -388,8 +360,8 @@
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
|
||||
@@ -1554,9 +1803,22 @@
|
||||
} else if (this.world.isClientSide) {
|
||||
@@ -1755,9 +1995,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start - Capture drops for death event
|
||||
@ -398,7 +370,7 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY() + (double) f, this.locZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY() + (double) f, this.locZ(), itemstack);
|
||||
|
||||
entityitem.defaultPickupDelay();
|
||||
+ // CraftBukkit start
|
||||
@ -408,19 +380,19 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.addEntity(entityitem);
|
||||
this.level.addEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1640,7 +1902,7 @@
|
||||
@@ -1849,7 +2102,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
- this.vehicle.addPassenger(this);
|
||||
+ if (!this.vehicle.addPassenger(this)) this.vehicle = null; // CraftBukkit
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1665,7 +1927,7 @@
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
- this.vehicle.addPassenger(this);
|
||||
+ if (!this.vehicle.addPassenger(this)) this.vehicle = null; // CraftBukkit
|
||||
entity.n().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1880,7 +2133,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
@ -429,8 +401,8 @@
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1674,10 +1936,31 @@
|
||||
this.bf();
|
||||
@@ -1889,10 +2142,31 @@
|
||||
this.bo();
|
||||
}
|
||||
|
||||
- protected void addPassenger(Entity entity) {
|
||||
@ -459,10 +431,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
|
||||
this.passengers.add(0, entity);
|
||||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1685,15 +1968,36 @@
|
||||
@@ -1908,12 +2182,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
@ -493,25 +465,29 @@
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.passengers.remove(entity);
|
||||
entity.j = 60;
|
||||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1924,6 +2218,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
+ return true; // CraftBukkit
|
||||
}
|
||||
|
||||
protected boolean q(Entity entity) {
|
||||
@@ -1731,14 +2035,20 @@
|
||||
protected boolean o(Entity entity) {
|
||||
@@ -1974,14 +2269,20 @@
|
||||
|
||||
if (this.inPortal) {
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
|
||||
- ResourceKey<World> resourcekey = this.world.getDimensionKey() == World.THE_NETHER ? World.OVERWORLD : World.THE_NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.world.getTypeKey() == DimensionManager.THE_NETHER ? World.OVERWORLD : World.THE_NETHER; // CraftBukkit
|
||||
- ResourceKey<World> resourcekey = this.level.getDimensionKey() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.level.getTypeKey() == DimensionManager.NETHER_LOCATION ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
WorldServer worldserver1 = minecraftserver.getWorldServer(resourcekey);
|
||||
|
||||
- if (worldserver1 != null && minecraftserver.getAllowNether() && !this.isPassenger() && this.portalTicks++ >= i) {
|
||||
+ if (true && !this.isPassenger() && this.portalTicks++ >= i) { // CraftBukkit
|
||||
this.world.getMethodProfiler().enter("portal");
|
||||
this.portalTicks = i;
|
||||
- if (worldserver1 != null && minecraftserver.getAllowNether() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
+ if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
|
||||
this.level.getMethodProfiler().enter("portal");
|
||||
this.portalTime = i;
|
||||
this.resetPortalCooldown();
|
||||
- this.b(worldserver1);
|
||||
+ // CraftBukkit start
|
||||
@ -521,10 +497,10 @@
|
||||
+ this.b(worldserver1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.level.getMethodProfiler().exit();
|
||||
}
|
||||
|
||||
@@ -1838,6 +2148,13 @@
|
||||
@@ -2099,6 +2400,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
@ -538,7 +514,7 @@
|
||||
this.setFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -1870,8 +2187,12 @@
|
||||
@@ -2147,8 +2455,12 @@
|
||||
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
@ -552,11 +528,11 @@
|
||||
}
|
||||
|
||||
public boolean getFlag(int i) {
|
||||
@@ -1898,16 +2219,56 @@
|
||||
@@ -2175,7 +2487,17 @@
|
||||
}
|
||||
|
||||
public void setAirTicks(int i) {
|
||||
- this.datawatcher.set(Entity.AIR_TICKS, i);
|
||||
- this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, i);
|
||||
+ // CraftBukkit start
|
||||
+ EntityAirChangeEvent event = new EntityAirChangeEvent(this.getBukkitEntity(), i);
|
||||
+ // Suppress during worldgen
|
||||
@ -566,19 +542,22 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.datawatcher.set(Entity.AIR_TICKS, event.getAmount());
|
||||
+ this.entityData.set(Entity.DATA_AIR_SUPPLY_ID, event.getAmount());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2202,11 +2524,41 @@
|
||||
|
||||
public void onLightningStrike(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setFireTicks(this.fireTicks + 1);
|
||||
this.setFireTicks(this.remainingFireTicks + 1);
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity();
|
||||
+ final org.bukkit.entity.Entity stormBukkitEntity = entitylightning.getBukkitEntity();
|
||||
+ final PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.fireTicks == 0) {
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.setOnFire(8);
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
||||
@ -599,12 +578,12 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.damageEntity(DamageSource.LIGHTNING, 5.0F);
|
||||
- this.damageEntity(DamageSource.LIGHTNING_BOLT, 5.0F);
|
||||
+ if (this.isFireProof()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ CraftEventFactory.entityDamage = entitylightning;
|
||||
+ if (!this.damageEntity(DamageSource.LIGHTNING, 5.0F)) {
|
||||
+ if (!this.damageEntity(DamageSource.LIGHTNING_BOLT, 5.0F)) {
|
||||
+ CraftEventFactory.entityDamage = null;
|
||||
+ return;
|
||||
+ }
|
||||
@ -612,7 +591,7 @@
|
||||
}
|
||||
|
||||
public void k(boolean flag) {
|
||||
@@ -2057,15 +2418,32 @@
|
||||
@@ -2356,15 +2708,32 @@
|
||||
|
||||
@Nullable
|
||||
public Entity b(WorldServer worldserver) {
|
||||
@ -623,8 +602,8 @@
|
||||
+ @Nullable
|
||||
+ public Entity teleportTo(WorldServer worldserver, BlockPosition location) {
|
||||
+ // CraftBukkit end
|
||||
if (this.world instanceof WorldServer && !this.dead) {
|
||||
this.world.getMethodProfiler().enter("changeDimension");
|
||||
if (this.level instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level.getMethodProfiler().enter("changeDimension");
|
||||
- this.decouple();
|
||||
+ // CraftBukkit start
|
||||
+ // this.decouple();
|
||||
@ -632,9 +611,9 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.getMethodProfiler().enter("reposition");
|
||||
this.level.getMethodProfiler().enter("reposition");
|
||||
- ShapeDetectorShape shapedetectorshape = this.a(worldserver);
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.ORIGIN, this.yaw, this.pitch, worldserver, null); // CraftBukkit
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.a(worldserver) : new ShapeDetectorShape(new Vec3D(location.getX(), location.getY(), location.getZ()), Vec3D.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
||||
|
||||
if (shapedetectorshape == null) {
|
||||
return null;
|
||||
@ -644,55 +623,55 @@
|
||||
+ this.decouple();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.world.getMethodProfiler().exitEnter("reloading");
|
||||
this.level.getMethodProfiler().exitEnter("reloading");
|
||||
Entity entity = this.getEntityType().a((World) worldserver);
|
||||
|
||||
@@ -2074,9 +2452,17 @@
|
||||
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
|
||||
entity.setMot(shapedetectorshape.velocity);
|
||||
@@ -2373,9 +2742,17 @@
|
||||
entity.setPositionRotation(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setMot(shapedetectorshape.speed);
|
||||
worldserver.addEntityTeleport(entity);
|
||||
- if (worldserver.getDimensionKey() == World.THE_END) {
|
||||
- if (worldserver.getDimensionKey() == World.END) {
|
||||
- WorldServer.a(worldserver);
|
||||
+ if (worldserver.getTypeKey() == DimensionManager.THE_END) { // CraftBukkit
|
||||
+ if (worldserver.getTypeKey() == DimensionManager.END_LOCATION) { // CraftBukkit
|
||||
+ WorldServer.a(worldserver, this); // CraftBukkit
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+
|
||||
+ if (this instanceof EntityInsentient) {
|
||||
+ ((EntityInsentient) this).unleash(true, false); // Unleash to prevent duping of leads.
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.bN();
|
||||
@@ -2097,13 +2483,18 @@
|
||||
this.cc();
|
||||
@@ -2396,13 +2773,18 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape a(WorldServer worldserver) {
|
||||
- boolean flag = this.world.getDimensionKey() == World.THE_END && worldserver.getDimensionKey() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.getDimensionKey() == World.THE_END;
|
||||
- boolean flag = this.level.getDimensionKey() == World.END && worldserver.getDimensionKey() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.getDimensionKey() == World.END;
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ boolean flag = this.world.getTypeKey() == DimensionManager.THE_END && worldserver.getTypeKey() == DimensionManager.OVERWORLD; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.THE_END; // targetIsEnd
|
||||
+ boolean flag = this.level.getTypeKey() == DimensionManager.END_LOCATION && worldserver.getTypeKey() == DimensionManager.OVERWORLD_LOCATION; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == DimensionManager.END_LOCATION; // targetIsEnd
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!flag && !flag1) {
|
||||
- boolean flag2 = worldserver.getDimensionKey() == World.THE_NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == DimensionManager.THE_NETHER; // CraftBukkit
|
||||
- boolean flag2 = worldserver.getDimensionKey() == World.NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == DimensionManager.NETHER_LOCATION; // CraftBukkit
|
||||
|
||||
- if (this.world.getDimensionKey() != World.THE_NETHER && !flag2) {
|
||||
+ if (this.world.getTypeKey() != DimensionManager.THE_NETHER && !flag2) {
|
||||
- if (this.level.getDimensionKey() != World.NETHER && !flag2) {
|
||||
+ if (this.level.getTypeKey() != DimensionManager.NETHER_LOCATION && !flag2) {
|
||||
return null;
|
||||
} else {
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
@@ -2113,8 +2504,16 @@
|
||||
@@ -2412,8 +2794,16 @@
|
||||
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
|
||||
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
|
||||
double d4 = DimensionManager.a(this.level.getDimensionManager(), worldserver.getDimensionManager());
|
||||
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, blockposition, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
@ -705,21 +684,21 @@
|
||||
- return (ShapeDetectorShape) this.findOrCreatePortal(worldserver, blockposition, flag2).map((blockutil_rectangle) -> {
|
||||
+ return (ShapeDetectorShape) this.findOrCreatePortal(worldserver, blockposition, flag2, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.world.getType(this.ac);
|
||||
IBlockData iblockdata = this.level.getType(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2131,8 +2530,8 @@
|
||||
@@ -2430,8 +2820,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch);
|
||||
- return BlockPortalShape.a(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.yaw, this.pitch, event); // CraftBukkit
|
||||
+ return BlockPortalShape.a(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.a(this.getPose()), this.getMot(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBuukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2142,8 +2541,15 @@
|
||||
@@ -2441,8 +2831,15 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
|
||||
}
|
||||
@ -730,13 +709,13 @@
|
||||
+ }
|
||||
+ blockposition1 = new BlockPosition(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch);
|
||||
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.yaw, this.pitch, ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.getYRot(), this.getXRot());
|
||||
+ return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getMot(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2151,8 +2557,23 @@
|
||||
@@ -2450,8 +2847,23 @@
|
||||
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
|
||||
}
|
||||
|
||||
@ -762,11 +741,11 @@
|
||||
}
|
||||
|
||||
public boolean canPortal() {
|
||||
@@ -2338,7 +2759,26 @@
|
||||
@@ -2660,7 +3072,26 @@
|
||||
}
|
||||
|
||||
public void a(AxisAlignedBB axisalignedbb) {
|
||||
- this.boundingBox = axisalignedbb;
|
||||
public final void a(AxisAlignedBB axisalignedbb) {
|
||||
- this.bb = axisalignedbb;
|
||||
+ // CraftBukkit start - block invalid bounding boxes
|
||||
+ double minX = axisalignedbb.minX,
|
||||
+ minY = axisalignedbb.minY,
|
||||
@ -785,7 +764,7 @@
|
||||
+ len = axisalignedbb.maxZ - axisalignedbb.minZ;
|
||||
+ if (len < 0) maxZ = minZ;
|
||||
+ if (len > 64) maxZ = minZ + 64.0;
|
||||
+ this.boundingBox = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
+ this.bb = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -1,35 +1,35 @@
|
||||
--- a/net/minecraft/world/entity/EntityAgeable.java
|
||||
+++ b/net/minecraft/world/entity/EntityAgeable.java
|
||||
@@ -17,6 +17,7 @@
|
||||
protected int b;
|
||||
protected int c;
|
||||
protected int d;
|
||||
@@ -19,6 +19,7 @@
|
||||
protected int age;
|
||||
protected int forcedAge;
|
||||
protected int forcedAgeTimer;
|
||||
+ public boolean ageLocked; // CraftBukkit
|
||||
|
||||
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -100,6 +101,7 @@
|
||||
@@ -102,6 +103,7 @@
|
||||
super.saveData(nbttagcompound);
|
||||
nbttagcompound.setInt("Age", this.getAge());
|
||||
nbttagcompound.setInt("ForcedAge", this.c);
|
||||
nbttagcompound.setInt("ForcedAge", this.forcedAge);
|
||||
+ nbttagcompound.setBoolean("AgeLocked", this.ageLocked); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +109,7 @@
|
||||
@@ -109,6 +111,7 @@
|
||||
super.loadData(nbttagcompound);
|
||||
this.setAgeRaw(nbttagcompound.getInt("Age"));
|
||||
this.c = nbttagcompound.getInt("ForcedAge");
|
||||
this.forcedAge = nbttagcompound.getInt("ForcedAge");
|
||||
+ this.ageLocked = nbttagcompound.getBoolean("AgeLocked"); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,7 +124,7 @@
|
||||
@@ -123,7 +126,7 @@
|
||||
@Override
|
||||
public void movementTick() {
|
||||
super.movementTick();
|
||||
- if (this.world.isClientSide) {
|
||||
+ if (this.world.isClientSide || ageLocked) { // CraftBukkit
|
||||
if (this.d > 0) {
|
||||
if (this.d % 4 == 0) {
|
||||
this.world.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.cF() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
- if (this.level.isClientSide) {
|
||||
+ if (this.level.isClientSide || ageLocked) { // CraftBukkit
|
||||
if (this.forcedAgeTimer > 0) {
|
||||
if (this.forcedAgeTimer % 4 == 0) {
|
||||
this.level.addParticle(Particles.HAPPY_VILLAGER, this.d(1.0D), this.da() + 0.5D, this.g(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -33,6 +33,12 @@
|
||||
@@ -32,6 +32,12 @@
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -13,19 +13,19 @@
|
||||
public class EntityAreaEffectCloud extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
@@ -124,6 +130,22 @@
|
||||
@@ -127,6 +133,22 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start accessor methods
|
||||
+ public void refreshEffects() {
|
||||
+ if (!this.hasColor) {
|
||||
+ this.getDataWatcher().set(EntityAreaEffectCloud.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))); // PAIL: rename
|
||||
+ if (!this.fixedColor) {
|
||||
+ this.getDataWatcher().set(EntityAreaEffectCloud.DATA_COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potion, (Collection) this.effects))); // PAIL: rename
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public String getType() {
|
||||
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potionRegistry)).toString();
|
||||
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potion)).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setType(String string) {
|
||||
@ -34,20 +34,20 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.COLOR);
|
||||
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.DATA_COLOR);
|
||||
}
|
||||
@@ -268,6 +290,7 @@
|
||||
@@ -259,6 +281,7 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator2 = list1.iterator();
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
+ List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
|
||||
while (iterator2.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator2.next();
|
||||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -277,6 +300,17 @@
|
||||
double d2 = d0 * d0 + d1 * d1;
|
||||
@@ -268,6 +291,17 @@
|
||||
double d8 = d6 * d6 + d7 * d7;
|
||||
|
||||
if (d2 <= (double) (f * f)) {
|
||||
if (d8 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
+ }
|
||||
@ -59,15 +59,15 @@
|
||||
+ if (entity instanceof CraftLivingEntity) {
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.affectedEntities.put(entityliving, this.ticksLived + this.reapplicationDelay);
|
||||
Iterator iterator3 = list.iterator();
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -286,7 +320,7 @@
|
||||
@@ -277,7 +311,7 @@
|
||||
if (mobeffect1.getMobEffect().isInstant()) {
|
||||
mobeffect1.getMobEffect().applyInstantEffect(this, this.getSource(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1));
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,15 +15,15 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
|
||||
if (f > 10.0F) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
@@ -49,6 +54,7 @@
|
||||
|
||||
this.x(f);
|
||||
this.y(f);
|
||||
if (f > 10.0F) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
this.goalSelector.a(PathfinderGoal.Type.MOVE);
|
||||
} else if (f > 6.0F) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -16,6 +16,12 @@
|
||||
import net.minecraft.world.level.World;
|
||||
@@ -21,6 +21,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
@ -12,63 +12,63 @@
|
||||
+
|
||||
public class EntityExperienceOrb extends Entity {
|
||||
|
||||
public int b;
|
||||
@@ -50,6 +56,7 @@
|
||||
private static final int LIFETIME = 6000;
|
||||
@@ -59,6 +65,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
+ EntityHuman prevTarget = this.targetPlayer;// CraftBukkit - store old target
|
||||
if (this.d > 0) {
|
||||
--this.d;
|
||||
}
|
||||
@@ -86,7 +93,22 @@
|
||||
this.targetPlayer = null;
|
||||
+ EntityHuman prevTarget = this.followingPlayer;// CraftBukkit - store old target
|
||||
this.xo = this.locX();
|
||||
this.yo = this.locY();
|
||||
this.zo = this.locZ();
|
||||
@@ -84,7 +91,22 @@
|
||||
this.followingPlayer = null;
|
||||
}
|
||||
|
||||
- if (this.targetPlayer != null) {
|
||||
- if (this.followingPlayer != null) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean cancelled = false;
|
||||
+ if (this.targetPlayer != prevTarget) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this, targetPlayer, (targetPlayer != null) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (this.followingPlayer != prevTarget) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this, followingPlayer, (followingPlayer != null) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ EntityLiving target = (event.getTarget() == null) ? null : ((org.bukkit.craftbukkit.entity.CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ cancelled = event.isCancelled();
|
||||
+
|
||||
+ if (cancelled) {
|
||||
+ targetPlayer = prevTarget;
|
||||
+ followingPlayer = prevTarget;
|
||||
+ } else {
|
||||
+ targetPlayer = (target instanceof EntityHuman) ? (EntityHuman) target : null;
|
||||
+ followingPlayer = (target instanceof EntityHuman) ? (EntityHuman) target : null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (this.targetPlayer != null && !cancelled) {
|
||||
+ if (this.followingPlayer != null && !cancelled) {
|
||||
+ // CraftBukkit end
|
||||
Vec3D vec3d = new Vec3D(this.targetPlayer.locX() - this.locX(), this.targetPlayer.locY() + (double) this.targetPlayer.getHeadHeight() / 2.0D - this.locY(), this.targetPlayer.locZ() - this.locZ());
|
||||
double d1 = vec3d.g();
|
||||
Vec3D vec3d = new Vec3D(this.followingPlayer.locX() - this.locX(), this.followingPlayer.locY() + (double) this.followingPlayer.getHeadHeight() / 2.0D - this.locY(), this.followingPlayer.locZ() - this.locZ());
|
||||
double d0 = vec3d.g();
|
||||
|
||||
@@ -169,13 +191,19 @@
|
||||
if (!itemstack.isEmpty() && itemstack.f()) {
|
||||
int i = Math.min(this.c(this.value), itemstack.getDamage());
|
||||
@@ -225,7 +247,7 @@
|
||||
int i = this.a(entityhuman, this.value);
|
||||
|
||||
- this.value -= this.b(i);
|
||||
- itemstack.setDamage(itemstack.getDamage() - i);
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, i);
|
||||
+ i = event.getRepairAmount();
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.value -= this.b(i);
|
||||
+ itemstack.setDamage(itemstack.getDamage() - i);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (i > 0) {
|
||||
- entityhuman.giveExp(i);
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, i).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
}
|
||||
|
||||
if (this.value > 0) {
|
||||
- entityhuman.giveExp(this.value);
|
||||
+ entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value -> event.getAmount()
|
||||
}
|
||||
--this.count;
|
||||
@@ -243,6 +265,13 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.c(this.value), itemstack.getDamage());
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, j);
|
||||
+ j = event.getRepairAmount();
|
||||
+ if (event.isCancelled()) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.die();
|
||||
@@ -197,6 +225,24 @@
|
||||
itemstack.setDamage(itemstack.getDamage() - j);
|
||||
int k = i - this.b(j);
|
||||
@@ -270,6 +299,24 @@
|
||||
}
|
||||
|
||||
public static int getOrbValue(int i) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -74,6 +74,19 @@
|
||||
@@ -72,6 +72,19 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.storage.loot.LootTableInfo;
|
||||
|
||||
@ -19,36 +19,27 @@
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving {
|
||||
|
||||
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
|
||||
@@ -92,7 +105,7 @@
|
||||
public final float[] dropChanceHand;
|
||||
private final NonNullList<ItemStack> bq;
|
||||
public final float[] dropChanceArmor;
|
||||
- private boolean canPickUpLoot;
|
||||
+ // private boolean canPickUpLoot; // CraftBukkit - moved up to EntityLiving
|
||||
public boolean persistent;
|
||||
private final Map<PathType, Float> bt;
|
||||
public MinecraftKey lootTableKey;
|
||||
@@ -105,6 +118,8 @@
|
||||
private BlockPosition bz;
|
||||
private float bA;
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -112,6 +125,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
+ public boolean aware = true; // CraftBukkit
|
||||
+
|
||||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.bp = NonNullList.a(2, ItemStack.b);
|
||||
@@ -128,6 +143,9 @@
|
||||
this.handItems = NonNullList.a(2, ItemStack.EMPTY);
|
||||
@@ -135,6 +150,9 @@
|
||||
this.initPathfinder();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - default persistance to type's persistance value
|
||||
+ this.persistent = !isTypeNotPersistent(0);
|
||||
+ this.persistenceRequired = !isTypeNotPersistent(0);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void initPathfinder() {}
|
||||
@@ -208,7 +226,38 @@
|
||||
@@ -215,7 +233,38 @@
|
||||
}
|
||||
|
||||
public void setGoalTarget(@Nullable EntityLiving entityliving) {
|
||||
@ -63,14 +54,14 @@
|
||||
+ reason = getGoalTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
+ }
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN) {
|
||||
+ world.getServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
|
||||
+ level.getServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
|
||||
+ }
|
||||
+ CraftLivingEntity ctarget = null;
|
||||
+ if (entityliving != null) {
|
||||
+ ctarget = (CraftLivingEntity) entityliving.getBukkitEntity();
|
||||
+ }
|
||||
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ level.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
@ -81,13 +72,13 @@
|
||||
+ entityliving = null;
|
||||
+ }
|
||||
+ }
|
||||
this.goalTarget = entityliving;
|
||||
this.target = entityliving;
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -425,16 +474,26 @@
|
||||
@@ -442,16 +491,26 @@
|
||||
nbttagcompound.setBoolean("NoAI", this.isNoAI());
|
||||
}
|
||||
|
||||
@ -107,16 +98,16 @@
|
||||
+ }
|
||||
}
|
||||
|
||||
- this.persistent = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
- this.persistenceRequired = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
+ boolean data = nbttagcompound.getBoolean("PersistenceRequired");
|
||||
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
|
||||
+ this.persistent = data;
|
||||
+ this.persistenceRequired = data;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -481,6 +540,11 @@
|
||||
@@ -498,6 +557,11 @@
|
||||
}
|
||||
|
||||
this.setNoAI(nbttagcompound.getBoolean("NoAI"));
|
||||
@ -128,38 +119,26 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -488,6 +552,11 @@
|
||||
super.a(damagesource, flag);
|
||||
this.lootTableKey = null;
|
||||
}
|
||||
+ // CraftBukkit - start
|
||||
+ public MinecraftKey getLootTable() {
|
||||
+ return getDefaultLootTable();
|
||||
+ }
|
||||
+ // CraftBukkit - end
|
||||
|
||||
@Override
|
||||
protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) {
|
||||
@@ -544,7 +613,7 @@
|
||||
@@ -561,7 +625,7 @@
|
||||
protected void b(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItemStack();
|
||||
|
||||
- if (this.g(itemstack)) {
|
||||
+ if (this.g(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
- if (this.j(itemstack)) {
|
||||
+ if (this.j(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
this.a(entityitem);
|
||||
this.receive(entityitem, itemstack.getCount());
|
||||
entityitem.die();
|
||||
@@ -553,15 +622,29 @@
|
||||
@@ -570,15 +634,29 @@
|
||||
}
|
||||
|
||||
public boolean g(ItemStack itemstack) {
|
||||
public boolean j(ItemStack itemstack) {
|
||||
+ // CraftBukkit start - add item
|
||||
+ return this.g(itemstack, null);
|
||||
+ return this.j(itemstack, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean g(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ public boolean j(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = j(itemstack);
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getEquipment(enumitemslot);
|
||||
boolean flag = this.a(itemstack, itemstack1);
|
||||
|
||||
@ -175,18 +154,18 @@
|
||||
|
||||
if (!itemstack1.isEmpty() && (double) Math.max(this.random.nextFloat() - 0.1F, 0.0F) < d0) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a(itemstack1);
|
||||
this.b(itemstack1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
this.b(enumitemslot, itemstack);
|
||||
@@ -674,18 +757,18 @@
|
||||
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
|
||||
@@ -691,18 +769,18 @@
|
||||
EntityHuman entityhuman = this.level.findNearbyPlayer(this, -1.0D);
|
||||
|
||||
if (entityhuman != null) {
|
||||
- double d0 = entityhuman.h(this);
|
||||
+ double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error
|
||||
int i = this.getEntityType().e().f();
|
||||
- double d0 = entityhuman.f(this);
|
||||
+ double d0 = entityhuman.f((Entity) this); // CraftBukkit - decompile error
|
||||
int i = this.getEntityType().f().f();
|
||||
int j = i * i;
|
||||
|
||||
- if (d0 > (double) j && this.isTypeNotPersistent(d0)) {
|
||||
@ -194,59 +173,59 @@
|
||||
this.die();
|
||||
}
|
||||
|
||||
int k = this.getEntityType().e().g();
|
||||
int k = this.getEntityType().f().g();
|
||||
int l = k * k;
|
||||
|
||||
- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.isTypeNotPersistent(d0)) {
|
||||
+ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.isTypeNotPersistent(d0)) {
|
||||
+ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l) { // CraftBukkit - remove isTypeNotPersistent() check
|
||||
this.die();
|
||||
} else if (d0 < (double) l) {
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -700,6 +783,7 @@
|
||||
this.noActionTime = 0;
|
||||
@@ -717,6 +795,7 @@
|
||||
@Override
|
||||
protected final void doTick() {
|
||||
++this.ticksFarFromPlayer;
|
||||
++this.noActionTime;
|
||||
+ if (!this.aware) return; // CraftBukkit
|
||||
this.world.getMethodProfiler().enter("sensing");
|
||||
this.bo.a();
|
||||
this.world.getMethodProfiler().exit();
|
||||
@@ -1088,6 +1172,12 @@
|
||||
this.level.getMethodProfiler().enter("sensing");
|
||||
this.sensing.a();
|
||||
this.level.getMethodProfiler().exit();
|
||||
@@ -1100,6 +1179,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
|
||||
return EnumInteractionResult.a(this.world.isClientSide);
|
||||
this.unleash(true, !entityhuman.getAbilities().instabuild);
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
} else {
|
||||
@@ -1106,6 +1196,12 @@
|
||||
@@ -1118,6 +1203,12 @@
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) {
|
||||
if (itemstack.a(Items.LEAD) && this.a(entityhuman)) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ ((EntityPlayer) entityhuman).connection.sendPacket(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setLeashHolder(entityhuman, true);
|
||||
itemstack.subtract(1);
|
||||
return EnumInteractionResult.a(this.world.isClientSide);
|
||||
@@ -1121,7 +1217,7 @@
|
||||
return EnumInteractionResult.a(this.level.isClientSide);
|
||||
@@ -1133,7 +1224,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.world instanceof WorldServer) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, this.getEntityType(), (WorldServer) this.world, this.getPositionVector(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getEntityType(), (WorldServer) this.world, this.getPositionVector(), itemstack); // CraftBukkit - decompile error
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, this.getEntityType(), (WorldServer) this.level, this.getPositionVector(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.a(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getEntityType(), (WorldServer) this.level, this.getPositionVector(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.a(entityhuman, entityinsentient);
|
||||
@@ -1167,12 +1263,19 @@
|
||||
return this.bA != -1.0F;
|
||||
@@ -1183,12 +1274,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -258,55 +237,55 @@
|
||||
+ @Nullable
|
||||
+ public <T extends EntityInsentient> T a(EntityTypes<T> entitytypes, boolean flag, EntityTransformEvent.TransformReason transformReason, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
if (this.dead) {
|
||||
if (this.isRemoved()) {
|
||||
return null;
|
||||
} else {
|
||||
- T t0 = (EntityInsentient) entitytypes.a(this.world);
|
||||
+ T t0 = entitytypes.a(this.world); // CraftBukkit - decompile error
|
||||
- T t0 = (EntityInsentient) entitytypes.a(this.level);
|
||||
+ T t0 = entitytypes.a(this.level); // CraftBukkit - decompile error
|
||||
|
||||
t0.u(this);
|
||||
t0.s(this);
|
||||
t0.setBaby(this.isBaby());
|
||||
@@ -1204,7 +1307,12 @@
|
||||
@@ -1220,7 +1318,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.world.addEntity(t0);
|
||||
- this.level.addEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.world.addEntity(t0, spawnReason);
|
||||
+ this.level.addEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1224,6 +1332,7 @@
|
||||
@@ -1240,6 +1343,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
@@ -1240,7 +1349,9 @@
|
||||
@@ -1251,7 +1355,9 @@
|
||||
this.leashHolder = null;
|
||||
this.by = null;
|
||||
if (!this.world.isClientSide && flag1) {
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.a((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
|
||||
@@ -1290,6 +1401,7 @@
|
||||
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
|
||||
@@ -1301,6 +1407,7 @@
|
||||
boolean flag1 = super.a(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(true, true);
|
||||
}
|
||||
|
||||
@@ -1422,7 +1534,14 @@
|
||||
@@ -1396,7 +1503,14 @@
|
||||
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
|
||||
|
||||
if (i > 0) {
|
||||
@ -322,11 +301,15 @@
|
||||
}
|
||||
|
||||
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
|
||||
@@ -1484,6 +1603,7 @@
|
||||
@@ -1464,9 +1578,10 @@
|
||||
@Override
|
||||
protected void bN() {
|
||||
super.bN();
|
||||
+ this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
protected void cc() {
|
||||
super.cc();
|
||||
+ this.level.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.unleash(true, false);
|
||||
this.by().forEach((itemstack) -> {
|
||||
- itemstack.setCount(0);
|
||||
+ if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -22,6 +22,11 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -32,6 +32,11 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect;
|
||||
@ -11,65 +11,54 @@
|
||||
+
|
||||
public class EntityLightning extends Entity {
|
||||
|
||||
private int lifeTicks;
|
||||
@@ -62,7 +67,24 @@
|
||||
this.a(4);
|
||||
}
|
||||
|
||||
- this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
|
||||
+ float pitch = 0.8F + this.random.nextFloat() * 0.2F;
|
||||
+ int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) (List) this.world.getPlayers()) {
|
||||
+ double deltaX = this.locX() - player.locX();
|
||||
+ double deltaZ = this.locZ() - player.locZ();
|
||||
+ double distanceSquared = deltaX * deltaX + deltaZ * deltaZ;
|
||||
+ if (distanceSquared > viewDistance * viewDistance) {
|
||||
+ double deltaLength = Math.sqrt(distanceSquared);
|
||||
+ double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance;
|
||||
+ double relativeZ = player.locZ() + (deltaZ / deltaLength) * viewDistance;
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, relativeX, this.locY(), relativeZ, 10000.0F, pitch));
|
||||
+ } else {
|
||||
+ player.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, this.locX(), this.locY(), this.locZ(), 10000.0F, pitch));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.playSound((EntityHuman) null, this.locX(), this.locY(), this.locZ(), SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
|
||||
}
|
||||
|
||||
@@ -78,7 +100,7 @@
|
||||
private static final int START_LIFE = 2;
|
||||
@@ -132,7 +137,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.lifeTicks >= 0) {
|
||||
+ if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit - add !this.isEffect
|
||||
if (!(this.world instanceof WorldServer)) {
|
||||
this.world.c(2);
|
||||
} else if (!this.isEffect) {
|
||||
@@ -106,7 +128,11 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.a((IBlockAccess) this.world, blockposition);
|
||||
- if (this.life >= 0) {
|
||||
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.isEffect
|
||||
if (!(this.level instanceof WorldServer)) {
|
||||
this.level.c(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -166,8 +171,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition);
|
||||
|
||||
if (this.world.getType(blockposition).isAir() && iblockdata.canPlace(this.world, blockposition)) {
|
||||
- this.world.setTypeUpdate(blockposition, iblockdata);
|
||||
if (this.level.getType(blockposition).isAir() && iblockdata.canPlace(this.level, blockposition)) {
|
||||
- this.level.setTypeUpdate(blockposition, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!isEffect"
|
||||
+ if (!isEffect && !CraftEventFactory.callBlockIgniteEvent(world, blockposition, this).isCancelled()) {
|
||||
+ this.world.setTypeUpdate(blockposition, iblockdata);
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -114,7 +140,11 @@
|
||||
@@ -175,8 +184,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.a((IBlockAccess) this.world, blockposition1);
|
||||
if (this.world.getType(blockposition1).isAir() && iblockdata.canPlace(this.world, blockposition1)) {
|
||||
- this.world.setTypeUpdate(blockposition1, iblockdata);
|
||||
iblockdata = BlockFireAbstract.a((IBlockAccess) this.level, blockposition1);
|
||||
if (this.level.getType(blockposition1).isAir() && iblockdata.canPlace(this.level, blockposition1)) {
|
||||
- this.level.setTypeUpdate(blockposition1, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!isEffect"
|
||||
+ if (!isEffect && !CraftEventFactory.callBlockIgniteEvent(world, blockposition1, this).isCancelled()) {
|
||||
+ this.world.setTypeUpdate(blockposition1, iblockdata);
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition1, this).isCancelled()) {
|
||||
+ this.level.setTypeUpdate(blockposition1, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,8 +253,9 @@
|
||||
iblockdata = world.getType(blockposition1);
|
||||
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
||||
|
||||
+ BlockPosition blockposition1Final = blockposition1; // CraftBukkit - decompile error
|
||||
WeatheringCopper.b(iblockdata).ifPresent((iblockdata1) -> {
|
||||
- world.setTypeUpdate(blockposition1, iblockdata1);
|
||||
+ world.setTypeUpdate(blockposition1Final, iblockdata1); // CraftBukkit - decompile error
|
||||
});
|
||||
world.triggerEffect(3002, blockposition1, -1);
|
||||
return Optional.of(blockposition1);
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -111,6 +111,30 @@
|
||||
@@ -119,6 +119,30 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@ -30,11 +30,11 @@
|
||||
+
|
||||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
@@ -196,6 +220,21 @@
|
||||
private float bB;
|
||||
private float bC;
|
||||
protected BehaviorController<?> bg;
|
||||
private static final UUID SPEED_MODIFIER_SPRINTING_UUID = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
|
||||
@@ -227,6 +251,21 @@
|
||||
private float swimAmount;
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public int maxAirTicks = 300;
|
||||
@ -43,7 +43,7 @@
|
||||
+ public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
+ public boolean collides = true;
|
||||
+ public Set<UUID> collidableExemptions = new HashSet<>();
|
||||
+ public boolean canPickUpLoot;
|
||||
+ public boolean bukkitPickUpLoot;
|
||||
+
|
||||
+ @Override
|
||||
+ public float getBukkitYaw() {
|
||||
@ -53,57 +53,59 @@
|
||||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -207,7 +246,9 @@
|
||||
this.activeItem = ItemStack.b;
|
||||
this.by = Optional.empty();
|
||||
this.attributeMap = new AttributeMapBase(AttributeDefaults.a(entitytypes));
|
||||
@@ -239,7 +278,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.a(entitytypes));
|
||||
- this.setHealth(this.getMaxHealth());
|
||||
+ this.craftAttributes = new CraftAttributeMap(attributeMap); // CraftBukkit
|
||||
+ this.craftAttributes = new CraftAttributeMap(attributes); // CraftBukkit
|
||||
+ // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor
|
||||
+ this.datawatcher.set(EntityLiving.HEALTH, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
|
||||
this.i = true;
|
||||
this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.af();
|
||||
@@ -274,7 +315,13 @@
|
||||
+ this.entityData.set(EntityLiving.DATA_HEALTH_ID, (float) this.getAttributeInstance(GenericAttributes.MAX_HEALTH).getValue());
|
||||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.ah();
|
||||
@@ -306,7 +347,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
- ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
- ((WorldServer) this.level).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.world).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ ((WorldServer) this.level).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.world).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ ((WorldServer) this.level).a(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.locX(), this.locY(), this.locZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -496,7 +543,7 @@
|
||||
@@ -566,7 +613,7 @@
|
||||
|
||||
protected void cU() {
|
||||
++this.deathTicks;
|
||||
- if (this.deathTicks == 20) {
|
||||
+ if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||
this.die();
|
||||
|
||||
for (int i = 0; i < 20; ++i) {
|
||||
@@ -587,7 +634,13 @@
|
||||
protected void dB() {
|
||||
++this.deathTime;
|
||||
- if (this.deathTime == 20 && !this.level.isClientSide()) {
|
||||
+ if (this.deathTime >= 20 && !this.isRemoved() && !this.level.isClientSide()) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
|
||||
this.level.broadcastEntityEffect(this, (byte) 60);
|
||||
this.a(Entity.RemovalReason.KILLED);
|
||||
}
|
||||
@@ -658,9 +705,15 @@
|
||||
}
|
||||
|
||||
protected void playEquipSound(ItemStack itemstack) {
|
||||
- if (!itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ this.playEquipSound(itemstack, false);
|
||||
+ }
|
||||
+
|
||||
+ protected void playEquipSound(ItemStack itemstack, boolean silent) {
|
||||
+ if (!itemstack.isEmpty() && !silent) {
|
||||
+ // CraftBukkit end
|
||||
SoundEffect soundeffect = SoundEffects.ITEM_ARMOR_EQUIP_GENERIC;
|
||||
Item item = itemstack.getItem();
|
||||
SoundEffect soundeffect = itemstack.M();
|
||||
|
||||
@@ -657,6 +710,17 @@
|
||||
- if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator()) {
|
||||
+ if (!itemstack.isEmpty() && soundeffect != null && !this.isSpectator() && !silent) {
|
||||
+ // CraftBukkit end
|
||||
this.a(GameEvent.EQUIP);
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
}
|
||||
@@ -722,6 +775,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,7 +123,7 @@
|
||||
if (nbttagcompound.hasKeyOfType("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -694,9 +758,32 @@
|
||||
@@ -759,9 +823,32 @@
|
||||
|
||||
}
|
||||
|
||||
@ -148,16 +150,16 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
protected void tickPotionEffects() {
|
||||
Iterator iterator = this.effects.keySet().iterator();
|
||||
Iterator iterator = this.activeEffects.keySet().iterator();
|
||||
|
||||
+ isTickingEffects = true; // CraftBukkit
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -706,6 +793,12 @@
|
||||
this.a(mobeffect, true);
|
||||
@@ -771,6 +858,12 @@
|
||||
this.a(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.world.isClientSide) {
|
||||
if (!this.level.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect, null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EXPIRATION);
|
||||
+ if (event.isCancelled()) {
|
||||
@ -165,9 +167,9 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
iterator.remove();
|
||||
this.b(mobeffect);
|
||||
this.a(mobeffect);
|
||||
}
|
||||
@@ -716,6 +809,17 @@
|
||||
@@ -781,6 +874,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
@ -183,10 +185,10 @@
|
||||
+ effectsToProcess.clear();
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.updateEffects) {
|
||||
if (!this.world.isClientSide) {
|
||||
@@ -825,7 +929,13 @@
|
||||
this.datawatcher.set(EntityLiving.f, 0);
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -907,7 +1011,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -196,45 +198,49 @@
|
||||
+
|
||||
+ public boolean removeAllEffects(EntityPotionEffectEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (this.world.isClientSide) {
|
||||
if (this.level.isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -834,7 +944,14 @@
|
||||
@@ -916,7 +1026,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
- this.b((MobEffect) iterator.next());
|
||||
- this.a((MobEffect) iterator.next());
|
||||
+ // CraftBukkit start
|
||||
+ MobEffect effect = (MobEffect) iterator.next();
|
||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, effect, null, cause, EntityPotionEffectEvent.Action.CLEARED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.b(effect);
|
||||
+ this.a(effect);
|
||||
+ // CraftBukkit end
|
||||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -859,18 +976,44 @@
|
||||
return (MobEffect) this.effects.get(mobeffectlist);
|
||||
@@ -945,18 +1062,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
public boolean addEffect(MobEffect mobeffect) {
|
||||
+ return addEffect(mobeffect, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ public boolean addEffect(MobEffect mobeffect, EntityPotionEffectEvent.Cause cause) {
|
||||
+ return this.addEffect(mobeffect, (Entity) null, cause);
|
||||
+ }
|
||||
+
|
||||
+ public boolean addEffect(MobEffect mobeffect, EntityPotionEffectEvent.Cause cause) {
|
||||
public boolean addEffect(MobEffect mobeffect, @Nullable Entity entity) {
|
||||
+ return this.addEffect(mobeffect, entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public boolean addEffect(MobEffect mobeffect, @Nullable Entity entity, EntityPotionEffectEvent.Cause cause) {
|
||||
+ if (isTickingEffects) {
|
||||
+ effectsToProcess.add(new ProcessableEffect(mobeffect, cause));
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!this.d(mobeffect)) {
|
||||
if (!this.c(mobeffect)) {
|
||||
return false;
|
||||
} else {
|
||||
MobEffect mobeffect1 = (MobEffect) this.effects.get(mobeffect.getMobEffect());
|
||||
MobEffect mobeffect1 = (MobEffect) this.activeEffects.get(mobeffect.getMobEffect());
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ boolean override = false;
|
||||
@ -249,19 +255,19 @@
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (mobeffect1 == null) {
|
||||
this.effects.put(mobeffect.getMobEffect(), mobeffect);
|
||||
this.a(mobeffect);
|
||||
this.activeEffects.put(mobeffect.getMobEffect(), mobeffect);
|
||||
this.a(mobeffect, entity);
|
||||
return true;
|
||||
- } else if (mobeffect1.b(mobeffect)) {
|
||||
+ // CraftBukkit start
|
||||
+ } else if (event.isOverride()) {
|
||||
+ mobeffect1.b(mobeffect);
|
||||
this.a(mobeffect1, true);
|
||||
this.a(mobeffect1, true, entity);
|
||||
+ // CraftBukkit end
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -894,13 +1037,39 @@
|
||||
@@ -993,13 +1140,39 @@
|
||||
return this.getMonsterType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
@ -278,7 +284,7 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ MobEffect effect = this.effects.get(mobeffectlist);
|
||||
+ MobEffect effect = this.activeEffects.get(mobeffectlist);
|
||||
+ if (effect == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
@ -288,7 +294,7 @@
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
return (MobEffect) this.effects.remove(mobeffectlist);
|
||||
return (MobEffect) this.activeEffects.remove(mobeffectlist);
|
||||
}
|
||||
|
||||
public boolean removeEffect(MobEffectList mobeffectlist) {
|
||||
@ -301,8 +307,8 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.b(mobeffect);
|
||||
@@ -937,20 +1106,55 @@
|
||||
this.a(mobeffect);
|
||||
@@ -1036,20 +1209,55 @@
|
||||
|
||||
}
|
||||
|
||||
@ -319,7 +325,7 @@
|
||||
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
|
||||
+ // Suppress during worldgen
|
||||
+ if (this.valid) {
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
@ -336,7 +342,7 @@
|
||||
+ return (float) ((EntityPlayer) this).getBukkitEntity().getHealth();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return (Float) this.datawatcher.get(EntityLiving.HEALTH);
|
||||
return (Float) this.entityData.get(EntityLiving.DATA_HEALTH_ID);
|
||||
}
|
||||
|
||||
public void setHealth(float f) {
|
||||
@ -356,31 +362,22 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth()));
|
||||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.a(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -964,7 +1168,7 @@
|
||||
@@ -1063,7 +1271,7 @@
|
||||
return false;
|
||||
} else if (this.world.isClientSide) {
|
||||
} else if (this.level.isClientSide) {
|
||||
return false;
|
||||
- } else if (this.dl()) {
|
||||
+ } else if (this.dead || this.killed || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
|
||||
- } else if (this.dV()) {
|
||||
+ } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
|
||||
return false;
|
||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -976,17 +1180,19 @@
|
||||
this.ticksFarFromPlayer = 0;
|
||||
@@ -1074,10 +1282,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
|
||||
- if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
+ if (false && (damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.getEquipment(EnumItemSlot.HEAD).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this, (entityliving) -> {
|
||||
entityliving.broadcastItemBreak(EnumItemSlot.HEAD);
|
||||
});
|
||||
f *= 0.75F;
|
||||
}
|
||||
|
||||
- boolean flag = false;
|
||||
+ boolean flag = f > 0.0F && this.applyBlockingModifier(damagesource); // Copied from below
|
||||
float f2 = 0.0F;
|
||||
@ -391,38 +388,45 @@
|
||||
this.damageShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1004,22 +1210,41 @@
|
||||
this.av = 1.5F;
|
||||
@@ -1095,27 +1304,47 @@
|
||||
this.animationSpeed = 1.5F;
|
||||
boolean flag1 = true;
|
||||
|
||||
- if ((float) this.noDamageTicks > 10.0F) {
|
||||
+ if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) { // CraftBukkit - restore use of maxNoDamageTicks
|
||||
if (f <= this.lastDamage) {
|
||||
- if ((float) this.invulnerableTime > 10.0F) {
|
||||
+ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F) { // CraftBukkit - restore use of maxNoDamageTicks
|
||||
if (f <= this.lastHurt) {
|
||||
+ this.forceExplosionKnockback = true; // CraftBukkit - SPIGOT-949 - for vanilla consistency, cooldown does not prevent explosion knockback
|
||||
return false;
|
||||
}
|
||||
|
||||
- this.damageEntity0(damagesource, f - this.lastDamage);
|
||||
- this.damageEntity0(damagesource, f - this.lastHurt);
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.damageEntity0(damagesource, f - this.lastDamage)) {
|
||||
+ if (!this.damageEntity0(damagesource, f - this.lastHurt)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.lastDamage = f;
|
||||
this.lastHurt = f;
|
||||
flag1 = false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.damageEntity0(damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
this.lastDamage = f;
|
||||
- this.noDamageTicks = 20;
|
||||
this.lastHurt = f;
|
||||
- this.invulnerableTime = 20;
|
||||
- this.damageEntity0(damagesource, f);
|
||||
+ this.noDamageTicks = this.maxNoDamageTicks; // CraftBukkit - restore use of maxNoDamageTicks
|
||||
+ this.invulnerableTime = this.invulnerableDuration; // CraftBukkit - restore use of maxNoDamageTicks
|
||||
+ // this.damageEntity0(damagesource, f);
|
||||
+ // CraftBukkit end
|
||||
this.hurtDuration = 10;
|
||||
this.hurtTicks = this.hurtDuration;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
|
||||
- if (damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float)
|
||||
+ if (false && damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.damageHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@ -434,21 +438,21 @@
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.ap = 0.0F;
|
||||
this.hurtDir = 0.0F;
|
||||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
@@ -1140,19 +1365,29 @@
|
||||
@@ -1238,19 +1467,29 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = ItemStack.b;
|
||||
+ ItemStack itemstack1 = ItemStack.EMPTY;
|
||||
for (int j = 0; j < i; ++j) {
|
||||
EnumHand enumhand = aenumhand[j];
|
||||
- ItemStack itemstack1 = this.b(enumhand);
|
||||
+ itemstack1 = this.b(enumhand);
|
||||
|
||||
if (itemstack1.getItem() == Items.TOTEM_OF_UNDYING) {
|
||||
if (itemstack1.a(Items.TOTEM_OF_UNDYING)) {
|
||||
itemstack = itemstack1.cloneItemStack();
|
||||
- itemstack1.subtract(1);
|
||||
+ // itemstack1.subtract(1); // CraftBukkit
|
||||
@ -460,7 +464,7 @@
|
||||
- if (this instanceof EntityPlayer) {
|
||||
+ EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity());
|
||||
+ event.setCancelled(itemstack == null);
|
||||
+ this.world.getServer().getPluginManager().callEvent(event);
|
||||
+ this.level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (!itemstack1.isEmpty()) {
|
||||
@ -471,21 +475,21 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1160,14 +1395,16 @@
|
||||
@@ -1258,14 +1497,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
- this.removeAllEffects();
|
||||
- this.addEffect(new MobEffect(MobEffects.REGENERATION, 900, 1));
|
||||
- this.addEffect(new MobEffect(MobEffects.ABSORBTION, 100, 1));
|
||||
- this.addEffect(new MobEffect(MobEffects.ABSORPTION, 100, 1));
|
||||
- this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0));
|
||||
+ // CraftBukkit start
|
||||
+ this.removeAllEffects(org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.REGENERATION, 900, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.ABSORBTION, 100, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.ABSORPTION, 100, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ // CraftBukkit end
|
||||
this.world.broadcastEntityEffect(this, (byte) 35);
|
||||
this.level.broadcastEntityEffect(this, (byte) 35);
|
||||
}
|
||||
|
||||
- return itemstack != null;
|
||||
@ -493,9 +497,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1265,6 +1502,13 @@
|
||||
@@ -1374,6 +1615,13 @@
|
||||
if (!flag) {
|
||||
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.bt));
|
||||
EntityItem entityitem = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.WITHER_ROSE));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
@ -504,15 +508,15 @@
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.world.addEntity(entityitem);
|
||||
this.level.addEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1284,28 +1528,46 @@
|
||||
@@ -1393,21 +1641,40 @@
|
||||
|
||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
+ this.dropInventory(); // CraftBukkit - from below
|
||||
if (this.cW() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
if (this.dD() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
}
|
||||
@ -531,48 +535,43 @@
|
||||
- protected void dropExperience() {
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpReward() {
|
||||
if (!this.world.isClientSide && (this.alwaysGivesExp() || this.lastDamageByPlayerTime > 0 && this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT))) {
|
||||
int i = this.getExpValue(this.killer);
|
||||
if (this.level instanceof WorldServer && (this.alwaysGivesExp() || this.lastHurtByPlayerTime > 0 && this.isDropExperience() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.a((WorldServer) this.level, this.getPositionVector(), this.getExpValue(this.lastHurtByPlayer));
|
||||
+ int i = this.getExpValue(this.lastHurtByPlayer);
|
||||
+ return i;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
+ protected void dropExperience() {
|
||||
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||
+ if (true) {
|
||||
+ int i = this.expToDrop;
|
||||
while (i > 0) {
|
||||
int j = EntityExperienceOrb.getOrbValue(i);
|
||||
|
||||
i -= j;
|
||||
this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j));
|
||||
}
|
||||
+ EntityExperienceOrb.a((WorldServer) this.level, this.getPositionVector(), this.expToDrop);
|
||||
+ this.expToDrop = 0;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1426,9 +1688,14 @@
|
||||
int i = this.e(f, f1);
|
||||
@@ -1523,9 +1790,14 @@
|
||||
int i = this.d(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!this.damageEntity(DamageSource.FALL, (float) i)) {
|
||||
+ if (!this.damageEntity(damagesource, (float) i)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(this.getSoundFall(i), 1.0F, 1.0F);
|
||||
this.playBlockStepSound();
|
||||
- this.damageEntity(DamageSource.FALL, (float) i);
|
||||
+ // this.damageEntity(DamageSource.FALL, (float) i); // CraftBukkit - moved up
|
||||
- this.damageEntity(damagesource, (float) i);
|
||||
+ // this.damageEntity(damagesource, (float) i); // CraftBukkit - moved up
|
||||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1468,7 +1735,7 @@
|
||||
@@ -1574,7 +1846,7 @@
|
||||
|
||||
protected float applyArmorModifier(DamageSource damagesource, float f) {
|
||||
if (!damagesource.ignoresArmor()) {
|
||||
@ -581,17 +580,17 @@
|
||||
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1481,7 +1748,8 @@
|
||||
@@ -1587,7 +1859,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
- if (this.hasEffect(MobEffects.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
+ // CraftBukkit - Moved to damageEntity0(DamageSource, float)
|
||||
+ if (false && this.hasEffect(MobEffects.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1512,28 +1780,173 @@
|
||||
@@ -1618,29 +1891,172 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -608,7 +607,7 @@
|
||||
+ Function<Double, Double> hardHat = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ if (damagesource.g() && !EntityLiving.this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ return -(f - (f * 0.75F));
|
||||
+
|
||||
+ }
|
||||
@ -639,8 +638,8 @@
|
||||
+ Function<Double, Double> resistance = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
+ if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffects.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
+ int i = (EntityLiving.this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
|
||||
+ if (!damagesource.isStarvation() && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
|
||||
+ int i = (EntityLiving.this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
+ int j = 25 - i;
|
||||
+ float f1 = f.floatValue() * (float) j;
|
||||
+ return -(f - (f1 / 25.0F));
|
||||
@ -675,9 +674,12 @@
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
|
||||
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+ f = (float) event.getFinalDamage();
|
||||
+
|
||||
|
||||
+ // Resistance
|
||||
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
|
||||
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
|
||||
@ -689,15 +691,10 @@
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionHearts(), 0.0F);
|
||||
- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+
|
||||
+ // Apply damage to helmet
|
||||
+ if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(EnumItemSlot.HEAD) != null) {
|
||||
+ this.getEquipment(EnumItemSlot.HEAD).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this, (entityliving) -> {
|
||||
+ entityliving.broadcastItemBreak(EnumItemSlot.HEAD);
|
||||
+ });
|
||||
+ if (damagesource.g() && !this.getEquipment(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.damageHelmet(damagesource, f);
|
||||
+ }
|
||||
+
|
||||
+ // Apply damage to armor
|
||||
@ -705,12 +702,12 @@
|
||||
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||
+ this.damageArmor(damagesource, armorDamage);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ // Apply blocking code // PAIL: steal from above
|
||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
+ this.world.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.level.broadcastEntityEffect(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.damageShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
+ Entity entity = damagesource.j();
|
||||
+ Entity entity = damagesource.k();
|
||||
+
|
||||
+ if (entity instanceof EntityLiving) {
|
||||
+ this.shieldBlock((EntityLiving) entity);
|
||||
@ -747,13 +744,14 @@
|
||||
+ if (!human) {
|
||||
+ this.setAbsorptionHearts(this.getAbsorptionHearts() - f);
|
||||
+ }
|
||||
this.a(GameEvent.ENTITY_DAMAGED, damagesource.getEntity());
|
||||
+
|
||||
+ return true;
|
||||
+ } else {
|
||||
+ // Duplicate triggers if blocking
|
||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ CriterionTriggers.h.a((EntityPlayer) this, damagesource, f, originalDamage, true);
|
||||
+ CriterionTriggers.ENTITY_HURT_PLAYER.a((EntityPlayer) this, damagesource, f, originalDamage, true);
|
||||
+ f2 = (float) -event.getDamage(DamageModifier.BLOCKING);
|
||||
+ if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
+ ((EntityPlayer) this).a(StatisticList.DAMAGE_BLOCKED_BY_SHIELD, Math.round(originalDamage * 10.0F));
|
||||
@ -761,7 +759,7 @@
|
||||
+ }
|
||||
+
|
||||
+ if (damagesource.getEntity() instanceof EntityPlayer) {
|
||||
+ CriterionTriggers.g.a((EntityPlayer) damagesource.getEntity(), this, damagesource, f, originalDamage, true);
|
||||
+ CriterionTriggers.PLAYER_HURT_ENTITY.a((EntityPlayer) damagesource.getEntity(), this, damagesource, f, originalDamage, true);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
@ -775,28 +773,27 @@
|
||||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1554,9 +1967,19 @@
|
||||
@@ -1661,8 +2077,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
- this.datawatcher.set(EntityLiving.ARROWS_IN_BODY, i);
|
||||
- this.entityData.set(EntityLiving.DATA_ARROW_COUNT_ID, i);
|
||||
+ // CraftBukkit start
|
||||
+ setArrowCount(i, false);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public final void setArrowCount(int i, boolean flag) {
|
||||
+ ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, getArrowCount(), i, flag);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.datawatcher.set(EntityLiving.ARROWS_IN_BODY, event.getNewAmount());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public final int dz() {
|
||||
return (Integer) this.datawatcher.get(EntityLiving.bi);
|
||||
+ this.entityData.set(EntityLiving.DATA_ARROW_COUNT_ID, event.getNewAmount());
|
||||
}
|
||||
@@ -1684,6 +2107,12 @@
|
||||
+ // CraftBukkit end
|
||||
|
||||
public final int eh() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -1958,6 +2384,12 @@
|
||||
|
||||
public abstract ItemStack getEquipment(EnumItemSlot enumitemslot);
|
||||
|
||||
@ -809,64 +806,57 @@
|
||||
@Override
|
||||
public abstract void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -1906,6 +2335,7 @@
|
||||
@@ -2202,6 +2634,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.world.isClientSide) {
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
+ if (getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2411,6 +2841,7 @@
|
||||
@@ -2732,6 +3165,7 @@
|
||||
}
|
||||
|
||||
if (!this.world.isClientSide) {
|
||||
if (!this.level.isClientSide) {
|
||||
+ if (flag != this.getFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, flag).isCancelled()) // CraftBukkit
|
||||
this.setFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2531,6 +2962,7 @@
|
||||
}
|
||||
|
||||
public boolean hasLineOfSight(Entity entity) {
|
||||
+ if (this.world != entity.world) return false; // CraftBukkit - SPIGOT-5675, SPIGOT-5798, MC-149563
|
||||
Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
|
||||
Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
|
||||
|
||||
@@ -2548,13 +2980,20 @@
|
||||
@@ -2899,14 +3333,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isInteractable() {
|
||||
- return !this.dead;
|
||||
+ return !this.dead && this.collides; // CraftBukkit
|
||||
- return !this.isRemoved();
|
||||
+ return !this.isRemoved() && this.collides; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCollidable() {
|
||||
- return this.isAlive() && !this.isSpectator() && !this.isClimbing();
|
||||
+ return this.isAlive() && !this.isSpectator() && !this.isClimbing() && this.collides; // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - collidable API
|
||||
+ @Override
|
||||
+ public boolean canCollideWith(Entity entity) {
|
||||
+ public boolean canCollideWithBukkit(Entity entity) {
|
||||
+ return isCollidable() && this.collides != this.collidableExemptions.contains(entity.getUniqueID());
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
@Override
|
||||
protected void velocityChanged() {
|
||||
@@ -2748,7 +3187,25 @@
|
||||
this.hurtMarked = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
|
||||
@@ -3104,7 +3545,25 @@
|
||||
} else {
|
||||
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
|
||||
this.b(this.activeItem, 16);
|
||||
- ItemStack itemstack = this.activeItem.a(this.world, this);
|
||||
if (!this.useItem.isEmpty() && this.isHandRaised()) {
|
||||
this.b(this.useItem, 16);
|
||||
- ItemStack itemstack = this.useItem.a(this.level, this);
|
||||
+ // CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
+ ItemStack itemstack;
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.activeItem);
|
||||
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
|
||||
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem);
|
||||
+ world.getServer().getPluginManager().callEvent(event);
|
||||
+ level.getServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
@ -875,15 +865,15 @@
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.activeItem.a(this.world, this) : CraftItemStack.asNMSCopy(event.getItem()).a(world, this);
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.a(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).a(level, this);
|
||||
+ } else {
|
||||
+ itemstack = this.activeItem.a(this.world, this);
|
||||
+ itemstack = this.useItem.a(this.level, this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack != this.activeItem) {
|
||||
if (itemstack != this.useItem) {
|
||||
this.a(enumhand, itemstack);
|
||||
@@ -2816,6 +3273,12 @@
|
||||
@@ -3176,6 +3635,12 @@
|
||||
}
|
||||
|
||||
public boolean a(double d0, double d1, double d2, boolean flag) {
|
||||
@ -896,7 +886,7 @@
|
||||
double d3 = this.locX();
|
||||
double d4 = this.locY();
|
||||
double d5 = this.locZ();
|
||||
@@ -2840,16 +3303,41 @@
|
||||
@@ -3200,16 +3665,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@ -914,8 +904,8 @@
|
||||
+
|
||||
+ if (flag1) {
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), d0, d6, d2));
|
||||
+ this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level.getWorld(), d3, d4, d5), new Location(this.level.getWorld(), d0, d6, d2));
|
||||
+ this.level.getServer().getPluginManager().callEvent(teleport);
|
||||
+ if (!teleport.isCancelled()) {
|
||||
+ Location to = teleport.getTo();
|
||||
+ this.enderTeleportTo(to.getX(), to.getY(), to.getZ());
|
||||
@ -924,7 +914,7 @@
|
||||
+ }
|
||||
+ } else {
|
||||
+ // player teleport event is called in the underlining code
|
||||
+ if (((EntityPlayer) this).playerConnection.a(d0, d6, d2, this.yaw, this.pitch, java.util.Collections.emptySet(), cause)) {
|
||||
+ if (((EntityPlayer) this).connection.a(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), false, cause)) {
|
||||
+ return Optional.empty();
|
||||
+ }
|
||||
+ }
|
||||
@ -941,7 +931,7 @@
|
||||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEffect(this, (byte) 46);
|
||||
@@ -2859,7 +3347,7 @@
|
||||
@@ -3219,7 +3709,7 @@
|
||||
((EntityCreature) this).getNavigation().o();
|
||||
}
|
||||
|
||||
@ -950,16 +940,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2940,7 +3428,7 @@
|
||||
@@ -3302,7 +3792,7 @@
|
||||
}
|
||||
|
||||
public void entityWakeup() {
|
||||
- Optional optional = this.getBedPosition();
|
||||
+ Optional<BlockPosition> optional = this.getBedPosition(); // CraftBukkit - decompile error
|
||||
World world = this.world;
|
||||
World world = this.level;
|
||||
|
||||
this.world.getClass();
|
||||
@@ -3011,7 +3499,7 @@
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3334,7 +3824,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection eW() {
|
||||
- BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse((Object) null);
|
||||
+ BlockPosition blockposition = (BlockPosition) this.getBedPosition().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
return blockposition != null ? BlockBed.a((IBlockAccess) this.level, blockposition) : null;
|
||||
}
|
||||
@@ -3383,7 +3873,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
|
@ -1,24 +1,24 @@
|
||||
--- a/net/minecraft/world/entity/EntityTypes.java
|
||||
+++ b/net/minecraft/world/entity/EntityTypes.java
|
||||
@@ -142,7 +142,7 @@
|
||||
public class EntityTypes<T extends Entity> {
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String ENTITY_TAG = "EntityTag";
|
||||
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
|
||||
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(Integer.MAX_VALUE));
|
||||
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = a("area_effect_cloud", EntityTypes.Builder.a(EntityAreaEffectCloud::new, EnumCreatureType.MISC).c().a(6.0F, 0.5F).trackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
||||
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = a("armor_stand", EntityTypes.Builder.a(EntityArmorStand::new, EnumCreatureType.MISC).a(0.5F, 1.975F).trackingRange(10));
|
||||
public static final EntityTypes<EntityTippedArrow> ARROW = a("arrow", EntityTypes.Builder.a(EntityTippedArrow::new, EnumCreatureType.MISC).a(0.5F, 0.5F).trackingRange(4).updateInterval(20));
|
||||
public static final EntityTypes<EntityBat> BAT = a("bat", EntityTypes.Builder.a(EntityBat::new, EnumCreatureType.AMBIENT).a(0.5F, 0.9F).trackingRange(5));
|
||||
@@ -267,7 +267,7 @@
|
||||
private MinecraftKey bq;
|
||||
private final EntitySize br;
|
||||
public static final EntityTypes<Axolotl> AXOLOTL = a("axolotl", EntityTypes.Builder.a(Axolotl::new, EnumCreatureType.UNDERGROUND_WATER_CREATURE).a(0.75F, 0.42F).trackingRange(10));
|
||||
@@ -282,7 +282,7 @@
|
||||
private MinecraftKey lootTable;
|
||||
private final EntitySize dimensions;
|
||||
|
||||
- private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
+ private static <T extends Entity> EntityTypes<T> a(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
||||
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
|
||||
}
|
||||
|
||||
@@ -299,10 +299,18 @@
|
||||
@@ -314,10 +314,18 @@
|
||||
|
||||
@Nullable
|
||||
public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
@ -33,12 +33,12 @@
|
||||
if (t0 != null) {
|
||||
- worldserver.addAllEntities(t0);
|
||||
+ worldserver.addAllEntities(t0, spawnReason);
|
||||
+ return !t0.dead ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
+ return !t0.isRemoved() ? t0 : null; // Don't return an entity when CreatureSpawnEvent is canceled
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
return t0;
|
||||
@@ -338,7 +346,7 @@
|
||||
@@ -353,7 +361,7 @@
|
||||
t0.setCustomName(ichatbasecomponent);
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -481,7 +489,7 @@
|
||||
@@ -512,7 +520,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
@ -55,9 +55,18 @@
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static Optional<Entity> b(NBTTagCompound nbttagcompound, World world) {
|
||||
@@ -533,7 +541,7 @@
|
||||
this.g = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
public static Stream<Entity> a(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -569,7 +577,7 @@
|
||||
|
||||
@Nullable
|
||||
public T a(Entity entity) {
|
||||
- return entity.getEntityType() == this ? entity : null;
|
||||
+ return entity.getEntityType() == this ? (T) entity : null; // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -596,7 +604,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
- public static <T extends Entity> EntityTypes.Builder<T> a(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/entity/IEntityAngerable.java
|
||||
+++ b/net/minecraft/world/entity/IEntityAngerable.java
|
||||
@@ -103,7 +103,7 @@
|
||||
@@ -108,7 +108,7 @@
|
||||
default void pacify() {
|
||||
this.setLastDamager((EntityLiving) null);
|
||||
this.setAngerTarget((UUID) null);
|
||||
@ -9,12 +9,12 @@
|
||||
this.setAnger(0);
|
||||
}
|
||||
|
||||
@@ -113,6 +113,8 @@
|
||||
@@ -121,6 +121,8 @@
|
||||
|
||||
void setGoalTarget(@Nullable EntityLiving entityliving);
|
||||
|
||||
+ boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit
|
||||
+ boolean setGoalTarget(@Nullable EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent); // CraftBukkit
|
||||
+
|
||||
boolean c(EntityLiving entityliving);
|
||||
|
||||
@Nullable
|
||||
EntityLiving getGoalTarget();
|
||||
}
|
||||
|
@ -3,9 +3,9 @@
|
||||
@@ -42,7 +42,7 @@
|
||||
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteambase == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteambase.getCollisionRule();
|
||||
|
||||
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.g.and((entity1) -> {
|
||||
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.NO_SPECTATORS.and((entity1) -> {
|
||||
- if (!entity1.isCollidable()) {
|
||||
+ if (!entity1.canCollideWith(entity) || !entity.canCollideWith(entity1)) { // CraftBukkit - collidable API
|
||||
+ if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
|
||||
return false;
|
||||
} else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) {
|
||||
} else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).fh())) {
|
||||
return false;
|
||||
|
Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren