Repackage NMS

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2021-03-16 09:00:00 +11:00
parent 18496e998f
commit 9da047989c
968 changed files with 5448 additions and 5050 deletions

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
if [ -z "$1" ]
then
echo "Please run this script again with the clean decompile sources as an argument. In most cases this will be ../work/decompile-XXXX"
@ -18,19 +20,19 @@ else
}
fi
nms=$1/net/minecraft/server
cb=src/main/java/net/minecraft/server
nms=$1
cb=src/main/java
#clean up and rebuild
rm -rf $cb
mkdir -p $cb
for file in $(/bin/ls nms-patches)
rm -rf $cb/net
for file in $(find nms-patches -type f -printf '%P\n')
do
patchFile="nms-patches/$file"
patchFile="$file"
file="$(echo $file | cut -d. -f1).java"
echo "Patching $file < $patchFile"
strip_cr "$nms/$file" > /dev/null
mkdir -p $(dirname $cb/$file)
cp "$nms/$file" "$cb/$file"
patch -d src/main/java/ "net/minecraft/server/$file" < "$patchFile"
patch -d src/main/java -p 1 < "nms-patches/$patchFile"
done

View file

@ -58,7 +58,7 @@
<property name="sortStaticImportsAlphabetically" value="true"/>
</module>
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!--<module name="UnusedImports"/>-->
<!-- See https://checkstyle.org/config_whitespace.html -->
<module name="GenericWhitespace"/>

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
if [ -z "$1" ]
then
echo "Please run this script again with the clean decompile sources as an argument. In most cases this will be ../work/decompile-XXXX"
@ -18,8 +20,8 @@ else
}
fi
cb=src/main/java/net/minecraft/server
nms="$1/net/minecraft/server"
cb=src/main/java
nms="$1"
show_diff_msg=true
if [ $# -ge 2 ]
@ -31,7 +33,7 @@ then
fi
fi
for file in $(/bin/ls $cb)
for file in $(find src/main/java/net -type f -printf 'net/%P\n')
do
if [ "$show_diff_msg" = true ]
then
@ -40,7 +42,7 @@ do
strip_cr "$nms/$file" > /dev/null
strip_cr "$cb/$file" > /dev/null
outName=$(echo nms-patches/"$(echo $file | cut -d. -f1)".patch)
patchNew=$(diff -u --label a/net/minecraft/server/$file "$nms/$file" --label b/net/minecraft/server/$file "$cb/$file")
patchNew=$(diff -u --label a/$file "$nms/$file" --label b/$file "$cb/$file" || true)
if [ -f "$outName" ]
then
patchCut=$(echo "$patchNew" | tail -n +3)
@ -51,6 +53,7 @@ do
fi
else
echo "New patch $outName"
mkdir -p $(dirname $outName)
echo "$patchNew" > "$outName"
fi
done

View file

@ -1,5 +1,5 @@
--- a/net/minecraft/server/CrashReport.java
+++ b/net/minecraft/server/CrashReport.java
--- 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(" ")));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Advancement.java
+++ b/net/minecraft/server/Advancement.java
@@ -26,6 +26,7 @@
--- a/net/minecraft/advancements/Advancement.java
+++ b/net/minecraft/advancements/Advancement.java
@@ -39,6 +39,7 @@
private final String[][] requirements;
private final Set<Advancement> children = Sets.newLinkedHashSet();
private final IChatBaseComponent chatComponent;
@ -8,7 +8,7 @@
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring) {
this.key = minecraftkey;
@@ -209,7 +210,7 @@
@@ -222,7 +223,7 @@
}
public Advancement b(MinecraftKey minecraftkey) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Advancements.java
+++ b/net/minecraft/server/Advancements.java
@@ -72,7 +72,7 @@
--- a/net/minecraft/advancements/Advancements.java
+++ b/net/minecraft/advancements/Advancements.java
@@ -73,7 +73,7 @@
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandDispatcher.java
+++ b/net/minecraft/server/CommandDispatcher.java
@@ -19,12 +19,21 @@
--- a/net/minecraft/commands/CommandDispatcher.java
+++ b/net/minecraft/commands/CommandDispatcher.java
@@ -102,12 +102,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -22,7 +22,7 @@
CommandAdvancement.a(this.b);
CommandAttribute.a(this.b);
CommandExecute.a(this.b);
@@ -105,14 +114,57 @@
@@ -188,14 +197,57 @@
}
this.b.findAmbiguities((commandnode, commandnode1, commandnode2, collection) -> {
@ -83,7 +83,7 @@
StringReader stringreader = new StringReader(s);
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -139,7 +191,7 @@
@@ -222,7 +274,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) -> {
@ -92,7 +92,7 @@
});
if (j > 10) {
@@ -189,11 +241,36 @@
@@ -272,11 +324,36 @@
}
public void a(EntityPlayer entityplayer) {
@ -130,7 +130,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutCommands(rootcommandnode));
}
@@ -204,7 +281,7 @@
@@ -287,7 +364,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) {
@ -139,7 +139,7 @@
argumentbuilder.requires((icompletionprovider) -> {
return true;
@@ -227,7 +304,7 @@
@@ -310,7 +387,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
}

View file

@ -1,15 +1,15 @@
--- a/net/minecraft/server/CommandListenerWrapper.java
+++ b/net/minecraft/server/CommandListenerWrapper.java
@@ -15,6 +15,8 @@
import java.util.stream.Stream;
import javax.annotation.Nullable;
--- a/net/minecraft/commands/CommandListenerWrapper.java
+++ b/net/minecraft/commands/CommandListenerWrapper.java
@@ -36,6 +36,8 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
+
public class CommandListenerWrapper implements ICompletionProvider {
public static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player"));
@@ -32,6 +34,7 @@
@@ -53,6 +55,7 @@
private final ResultConsumer<CommandListenerWrapper> l;
private final ArgumentAnchor.Anchor m;
private final Vec2F n;
@ -17,7 +17,7 @@
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) -> {
@@ -128,9 +131,23 @@
@@ -149,9 +152,23 @@
@Override
public boolean hasPermission(int i) {
@ -41,7 +41,7 @@
public Vec3D getPosition() {
return this.d;
}
@@ -192,7 +209,7 @@
@@ -213,7 +230,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -50,7 +50,7 @@
entityplayer.sendMessage(ichatmutablecomponent, SystemUtils.b);
}
}
@@ -252,4 +269,10 @@
@@ -273,4 +290,10 @@
public IRegistryCustom q() {
return this.i.getCustomRegistry();
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ICommandListener.java
+++ b/net/minecraft/server/ICommandListener.java
@@ -22,6 +22,13 @@
--- a/net/minecraft/commands/ICommandListener.java
+++ b/net/minecraft/commands/ICommandListener.java
@@ -23,6 +23,13 @@
public boolean shouldBroadcastCommands() {
return false;
}
@ -14,7 +14,7 @@
};
void sendMessage(IChatBaseComponent ichatbasecomponent, UUID uuid);
@@ -31,4 +38,6 @@
@@ -32,4 +39,6 @@
boolean shouldSendFailure();
boolean shouldBroadcastCommands();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ArgumentEntity.java
+++ b/net/minecraft/server/ArgumentEntity.java
@@ -84,9 +84,15 @@
--- a/net/minecraft/commands/arguments/ArgumentEntity.java
+++ b/net/minecraft/commands/arguments/ArgumentEntity.java
@@ -93,9 +93,15 @@
}
public EntitySelector parse(StringReader stringreader) throws CommandSyntaxException {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ArgumentBlock.java
+++ b/net/minecraft/server/ArgumentBlock.java
@@ -43,7 +43,7 @@
--- a/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
+++ b/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
@@ -55,7 +55,7 @@
};
private final StringReader i;
private final boolean j;
@ -9,7 +9,7 @@
private final Map<String, String> l = Maps.newHashMap();
private MinecraftKey m = new MinecraftKey("");
private BlockStateList<Block, IBlockData> n;
@@ -219,7 +219,7 @@
@@ -231,7 +231,7 @@
Iterator iterator = iblockstate.getValues().iterator();
while (iterator.hasNext()) {
@ -18,7 +18,7 @@
if (t0 instanceof Integer) {
suggestionsbuilder.suggest((Integer) t0);
@@ -488,7 +488,7 @@
@@ -500,7 +500,7 @@
Optional<T> optional = iblockstate.b(s);
if (optional.isPresent()) {
@ -27,7 +27,7 @@
this.k.put(iblockstate, optional.get());
} else {
this.i.setCursor(i);
@@ -522,7 +522,7 @@
@@ -534,7 +534,7 @@
private static <T extends Comparable<T>> void a(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
stringbuilder.append(iblockstate.getName());
stringbuilder.append('=');

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ArgumentParserSelector.java
+++ b/net/minecraft/server/ArgumentParserSelector.java
@@ -127,7 +127,7 @@
--- 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);
}
@ -9,7 +9,7 @@
if (this.s == null && this.t == null && this.u == null) {
function = (vec3d) -> {
@@ -188,8 +188,10 @@
@@ -198,8 +198,10 @@
};
}
@ -22,7 +22,7 @@
this.G = this::d;
if (!this.l.canRead()) {
throw ArgumentParserSelector.d.createWithContext(this.l);
@@ -443,6 +445,12 @@
@@ -453,6 +455,12 @@
}
public EntitySelector parse() throws CommandSyntaxException {
@ -35,7 +35,7 @@
this.E = this.l.getCursor();
this.G = this::b;
if (this.l.canRead() && this.l.peek() == '@') {
@@ -451,7 +459,7 @@
@@ -461,7 +469,7 @@
}
this.l.skip();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntitySelector.java
+++ b/net/minecraft/server/EntitySelector.java
@@ -64,7 +64,7 @@
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
@@ -75,7 +75,7 @@
}
private void e(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/DispenseBehaviorBoat.java
+++ b/net/minecraft/server/DispenseBehaviorBoat.java
@@ -1,5 +1,10 @@
package net.minecraft.server;
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
@@ -10,6 +10,11 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.BlockDispenser;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -11,7 +12,7 @@
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
private final DispenseBehaviorItem b = new DispenseBehaviorItem();
@@ -29,12 +34,40 @@
@@ -39,12 +44,40 @@
d3 = 0.0D;
}

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/DispenseBehaviorItem.java
+++ b/net/minecraft/server/DispenseBehaviorItem.java
@@ -1,5 +1,11 @@
package net.minecraft.server;
--- a/net/minecraft/core/dispenser/DispenseBehaviorItem.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorItem.java
@@ -8,6 +8,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.BlockDispenser;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -12,7 +13,7 @@
public class DispenseBehaviorItem implements IDispenseBehavior {
public DispenseBehaviorItem() {}
@@ -18,11 +24,19 @@
@@ -26,11 +32,19 @@
IPosition iposition = BlockDispenser.a(isourceblock);
ItemStack itemstack1 = itemstack.cloneAndSubtract(1);
@ -34,7 +35,7 @@
double d0 = iposition.getX();
double d1 = iposition.getY();
double d2 = iposition.getZ();
@@ -37,7 +51,39 @@
@@ -45,7 +59,39 @@
double d3 = world.random.nextDouble() * 0.1D + 0.2D;
entityitem.setMot(world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getAdjacentX() * d3, world.random.nextGaussian() * 0.007499999832361937D * (double) i + 0.20000000298023224D, world.random.nextGaussian() * 0.007499999832361937D * (double) i + (double) enumdirection.getAdjacentZ() * d3);

View file

@ -1,9 +1,12 @@
--- a/net/minecraft/server/DispenseBehaviorProjectile.java
+++ b/net/minecraft/server/DispenseBehaviorProjectile.java
@@ -1,5 +1,10 @@
package net.minecraft.server;
--- a/net/minecraft/core/dispenser/DispenseBehaviorProjectile.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorProjectile.java
@@ -9,6 +9,13 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.BlockDispenser;
+// CraftBukkit start
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.level.block.entity.TileEntityDispenser;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.event.block.BlockDispenseEvent;
+// CraftBukkit end
@ -11,7 +14,7 @@
public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
public DispenseBehaviorProjectile() {}
@@ -11,9 +16,38 @@
@@ -20,9 +27,38 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
IProjectile iprojectile = this.a((World) worldserver, iposition, itemstack);

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/DispenseBehaviorShears.java
+++ b/net/minecraft/server/DispenseBehaviorShears.java
@@ -3,6 +3,12 @@
import java.util.Iterator;
import java.util.List;
--- 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;
import net.minecraft.world.phys.AxisAlignedBB;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -13,7 +13,7 @@
public class DispenseBehaviorShears extends DispenseBehaviorMaybe {
public DispenseBehaviorShears() {}
@@ -10,11 +16,34 @@
@@ -30,11 +36,34 @@
@Override
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getWorld();
@ -49,7 +49,7 @@
if (this.a() && itemstack.isDamaged(1, worldserver.getRandom(), (EntityPlayer) null)) {
itemstack.setCount(0);
}
@@ -40,7 +69,7 @@
@@ -60,7 +89,7 @@
return false;
}
@ -58,7 +58,7 @@
List<EntityLiving> list = worldserver.a(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.g);
Iterator iterator = list.iterator();
@@ -51,6 +80,11 @@
@@ -71,6 +100,11 @@
IShearable ishearable = (IShearable) entityliving;
if (ishearable.canShear()) {

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/DispenseBehaviorShulkerBox.java
+++ b/net/minecraft/server/DispenseBehaviorShulkerBox.java
@@ -1,5 +1,10 @@
package net.minecraft.server;
--- 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;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -11,7 +12,7 @@
public class DispenseBehaviorShulkerBox extends DispenseBehaviorMaybe {
public DispenseBehaviorShulkerBox() {}
@@ -14,6 +19,30 @@
@@ -24,6 +29,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
EnumDirection enumdirection1 = isourceblock.getWorld().isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP;

View file

@ -1,10 +1,13 @@
--- a/net/minecraft/server/IDispenseBehavior.java
+++ b/net/minecraft/server/IDispenseBehavior.java
@@ -4,6 +4,15 @@
import java.util.List;
import java.util.Random;
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -74,6 +74,18 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.MovingObjectPositionBlock;
+// CraftBukkit start
+import net.minecraft.world.level.block.BlockSapling;
+import net.minecraft.world.level.block.IFluidContainer;
+import net.minecraft.world.level.material.Material;
+import org.bukkit.Location;
+import org.bukkit.TreeType;
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
@ -16,7 +19,7 @@
public interface IDispenseBehavior {
IDispenseBehavior NONE = (isourceblock, itemstack) -> {
@@ -44,7 +53,7 @@
@@ -114,7 +126,7 @@
BlockDispenser.a((IMaterial) Items.EGG, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
@Override
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
@ -25,7 +28,7 @@
entityegg.setItem(itemstack);
});
}
@@ -52,7 +61,7 @@
@@ -122,7 +134,7 @@
BlockDispenser.a((IMaterial) Items.SNOWBALL, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
@Override
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
@ -34,7 +37,7 @@
entitysnowball.setItem(itemstack);
});
}
@@ -60,7 +69,7 @@
@@ -130,7 +142,7 @@
BlockDispenser.a((IMaterial) Items.EXPERIENCE_BOTTLE, (IDispenseBehavior) (new DispenseBehaviorProjectile() {
@Override
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack) {
@ -43,7 +46,7 @@
entitythrownexpbottle.setItem(itemstack);
});
}
@@ -81,7 +90,7 @@
@@ -151,7 +163,7 @@
return (new DispenseBehaviorProjectile() {
@Override
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
@ -52,7 +55,7 @@
entitypotion.setItem(itemstack1);
});
}
@@ -104,7 +113,7 @@
@@ -174,7 +186,7 @@
return (new DispenseBehaviorProjectile() {
@Override
protected IProjectile a(World world, IPosition iposition, ItemStack itemstack1) {
@ -61,7 +64,7 @@
entitypotion.setItem(itemstack1);
});
}
@@ -127,8 +136,36 @@
@@ -197,8 +209,36 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).a(itemstack.getTag());
@ -99,7 +102,7 @@
return itemstack;
}
};
@@ -146,12 +183,40 @@
@@ -216,12 +256,40 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
WorldServer worldserver = isourceblock.getWorld();
@ -141,7 +144,7 @@
return itemstack;
}
}));
@@ -252,12 +317,41 @@
@@ -322,12 +390,41 @@
@Override
public ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
@ -184,7 +187,7 @@
return itemstack;
}
@@ -280,10 +374,39 @@
@@ -350,10 +447,39 @@
double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY();
double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ();
@ -228,7 +231,7 @@
return itemstack;
}
@@ -307,9 +430,52 @@
@@ -377,9 +503,52 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
WorldServer worldserver = isourceblock.getWorld();
@ -282,7 +285,7 @@
} else {
return this.b.dispense(isourceblock, itemstack);
}
@@ -333,13 +499,39 @@
@@ -403,13 +572,39 @@
Block block = iblockdata.getBlock();
if (block instanceof IFluidSource) {
@ -323,7 +326,7 @@
itemstack.subtract(1);
if (itemstack.isEmpty()) {
return new ItemStack(item);
@@ -361,13 +553,41 @@
@@ -431,13 +626,41 @@
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getWorld();
@ -366,7 +369,7 @@
} else if (BlockCampfire.h(iblockdata)) {
worldserver.setTypeUpdate(blockposition, (IBlockData) iblockdata.set(BlockProperties.r, true));
} else if (iblockdata.getBlock() instanceof BlockTNT) {
@@ -390,12 +610,57 @@
@@ -460,12 +683,57 @@
this.a(true);
WorldServer worldserver = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
@ -424,7 +427,7 @@
return itemstack;
}
@@ -405,11 +670,40 @@
@@ -475,11 +743,40 @@
protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getWorld();
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
@ -467,7 +470,7 @@
return itemstack;
}
}));
@@ -433,6 +727,30 @@
@@ -503,6 +800,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection);
@ -498,7 +501,7 @@
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);
@@ -457,6 +775,30 @@
@@ -527,6 +848,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@ -529,7 +532,7 @@
if (worldserver.isEmpty(blockposition) && blockpumpkincarved.a((IWorldReader) worldserver, blockposition)) {
if (!worldserver.isClientSide) {
worldserver.setTypeAndData(blockposition, blockpumpkincarved.getBlockData(), 3);
@@ -504,6 +846,30 @@
@@ -574,6 +919,30 @@
BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING));
IBlockData iblockdata = worldserver.getType(blockposition);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/NetworkManager.java
+++ b/net/minecraft/server/NetworkManager.java
@@ -127,7 +127,7 @@
--- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java
@@ -137,7 +137,7 @@
}
private static <T extends PacketListener> void a(Packet<T> packet, PacketListener packetlistener) {
@ -9,7 +9,7 @@
}
public void setPacketListener(PacketListener packetlistener) {
@@ -237,7 +237,7 @@
@@ -247,7 +247,7 @@
public void close(IChatBaseComponent ichatbasecomponent) {
if (this.channel.isOpen()) {

View file

@ -1,15 +1,15 @@
--- a/net/minecraft/server/PacketDataSerializer.java
+++ b/net/minecraft/server/PacketDataSerializer.java
@@ -26,6 +26,8 @@
import java.util.UUID;
import javax.annotation.Nullable;
--- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java
@@ -39,6 +39,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.Vec3D;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+
public class PacketDataSerializer extends ByteBuf {
private final ByteBuf a;
@@ -154,7 +156,7 @@
@@ -167,7 +169,7 @@
}
public <T extends Enum<T>> T a(Class<T> oclass) {
@ -18,7 +18,7 @@
}
public PacketDataSerializer a(Enum<?> oenum) {
@@ -231,7 +233,7 @@
@@ -244,7 +246,7 @@
} else {
try {
NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@ -27,7 +27,7 @@
throw new EncoderException(ioexception);
}
}
@@ -268,7 +270,7 @@
@@ -281,7 +283,7 @@
}
public PacketDataSerializer a(ItemStack itemstack) {
@ -36,7 +36,7 @@
this.writeBoolean(false);
} else {
this.writeBoolean(true);
@@ -297,6 +299,11 @@
@@ -310,6 +312,11 @@
ItemStack itemstack = new ItemStack(Item.getById(i), b0);
itemstack.setTag(this.l());

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChatHexColor.java
+++ b/net/minecraft/server/ChatHexColor.java
@@ -10,7 +10,7 @@
--- a/net/minecraft/network/chat/ChatHexColor.java
+++ b/net/minecraft/network/chat/ChatHexColor.java
@@ -11,7 +11,7 @@
public final class ChatHexColor {
private static final Map<EnumChatFormat, ChatHexColor> a = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::d).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
@ -9,7 +9,7 @@
}));
private static final Map<String, ChatHexColor> b = (Map) ChatHexColor.a.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
return chathexcolor.name;
@@ -18,16 +18,22 @@
@@ -19,16 +19,22 @@
private final int rgb;
@Nullable
public final String name;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChatModifier.java
+++ b/net/minecraft/server/ChatModifier.java
@@ -114,6 +114,20 @@
--- 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);
}

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/IChatBaseComponent.java
+++ b/net/minecraft/server/IChatBaseComponent.java
@@ -23,7 +23,23 @@
import java.util.Optional;
import javax.annotation.Nullable;
--- a/net/minecraft/network/chat/IChatBaseComponent.java
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
@@ -27,7 +27,23 @@
import net.minecraft.util.ChatDeserializer;
import net.minecraft.util.ChatTypeAdapterFactory;
-public interface IChatBaseComponent extends Message, IChatFormatted {
+// CraftBukkit start

View file

@ -1,6 +1,18 @@
--- a/net/minecraft/server/PlayerConnectionUtils.java
+++ b/net/minecraft/server/PlayerConnectionUtils.java
@@ -14,6 +14,7 @@
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
@@ -7,6 +7,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.network.PlayerConnection;
+// CraftBukkit end
+
public class PlayerConnectionUtils {
private static final Logger LOGGER = LogManager.getLogger();
@@ -18,6 +23,7 @@
public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
if (!iasynctaskhandler.isMainThread()) {
iasynctaskhandler.execute(() -> {
@ -8,7 +20,7 @@
if (t0.a().isConnected()) {
packet.a(t0);
} else {
@@ -22,6 +23,10 @@
@@ -26,6 +32,10 @@
});
throw CancelledPacketHandleException.INSTANCE;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PacketPlayInCloseWindow.java
+++ b/net/minecraft/server/PacketPlayInCloseWindow.java
@@ -8,6 +8,12 @@
--- a/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
+++ b/net/minecraft/network/protocol/game/PacketPlayInCloseWindow.java
@@ -10,6 +10,12 @@
public PacketPlayInCloseWindow() {}

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/server/PacketPlayOutMultiBlockChange.java
+++ b/net/minecraft/server/PacketPlayOutMultiBlockChange.java
@@ -24,7 +24,7 @@
--- a/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
+++ b/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
@@ -31,7 +31,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)) : Blocks.AIR.getBlockData(); // CraftBukkit - SPIGOT-6076, Mojang bug when empty chunk section notified
+ 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
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PacketPlayOutWorldBorder.java
+++ b/net/minecraft/server/PacketPlayOutWorldBorder.java
@@ -18,8 +18,10 @@
--- 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;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataWatcher.java
+++ b/net/minecraft/server/DataWatcher.java
@@ -129,6 +129,13 @@
--- a/net/minecraft/network/syncher/DataWatcher.java
+++ b/net/minecraft/network/syncher/DataWatcher.java
@@ -134,6 +134,13 @@
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -163,7 +163,11 @@
@@ -181,7 +181,11 @@
Advancement advancement = advancementdataworld.a((MinecraftKey) entry.getKey());
if (advancement == null) {
@ -13,7 +13,7 @@
} else {
this.a(advancement, (AdvancementProgress) entry.getValue());
}
@@ -278,6 +282,7 @@
@@ -296,6 +300,7 @@
this.j.add(advancement);
flag = true;
if (!flag1 && advancementprogress.isDone()) {

View file

@ -1,9 +1,9 @@
--- a/net/minecraft/server/CustomFunctionData.java
+++ b/net/minecraft/server/CustomFunctionData.java
@@ -30,7 +30,7 @@
@@ -36,7 +36,7 @@
}
public com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
public CommandDispatcher<CommandListenerWrapper> getCommandDispatcher() {
- return this.server.getCommandDispatcher().a();
+ return this.server.vanillaCommandDispatcher.a(); // CraftBukkit
}

View file

@ -1,6 +1,19 @@
--- a/net/minecraft/server/DispenserRegistry.java
+++ b/net/minecraft/server/DispenserRegistry.java
@@ -31,6 +31,69 @@
@@ -26,6 +26,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.util.datafix.fixes.DataConverterFlattenData;
+import net.minecraft.util.datafix.fixes.DataConverterMaterialId;
+import net.minecraft.util.datafix.fixes.DataConverterSpawnEgg;
+// CraftBukkit end
+
public class DispenserRegistry {
public static final PrintStream a = System.out;
@@ -50,6 +56,69 @@
TagStatic.b();
d();
}

View file

@ -1,6 +1,18 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -27,7 +27,8 @@
@@ -54,13 +54,20 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.SharedConstants;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.level.dimension.WorldDimension;
+// CraftBukkit end
+
public class Main {
private static final Logger LOGGER = LogManager.getLogger();
public Main() {}
@ -10,7 +22,7 @@
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -51,20 +52,22 @@
@@ -84,21 +91,23 @@
optionparser.printHelpOn(System.err);
return;
}
@ -22,20 +34,25 @@
DispenserRegistry.c();
SystemUtils.l();
IRegistryCustom.Dimension iregistrycustom_dimension = IRegistryCustom.b();
java.nio.file.Path java_nio_file_path = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, java_nio_file_path);
- 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
dedicatedserversettings.save();
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);
+ java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt");
+ EULA eula = new EULA(java_nio_file_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 '{}'", java_nio_file_path.toAbsolutePath(), java_nio_file_path1.toAbsolutePath());
return;
}
@@ -74,24 +77,42 @@
@@ -107,24 +116,42 @@
return;
}
@ -82,7 +99,7 @@
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);
@@ -106,6 +127,7 @@
@@ -139,6 +166,7 @@
}
datapackresources.i();
@ -90,7 +107,7 @@
RegistryReadOps<NBTBase> registryreadops = RegistryReadOps.a((DynamicOps) DynamicOpsNBT.a, datapackresources.h(), iregistrycustom_dimension);
Object object = convertable_conversionsession.a((DynamicOps) registryreadops, datapackconfiguration1);
@@ -133,21 +155,32 @@
@@ -166,21 +194,32 @@
}
convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object);
@ -125,7 +142,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.safeShutdown(true);
@@ -156,14 +189,15 @@
@@ -189,14 +228,15 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -55,6 +55,18 @@
@@ -155,6 +155,25 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -10,6 +10,13 @@
+import com.google.common.collect.ImmutableSet;
+import jline.console.ConsoleReader;
+import joptsimple.OptionSet;
+import net.minecraft.nbt.DynamicOpsNBT;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.resources.RegistryReadOps;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServerProperties;
+import net.minecraft.util.datafix.DataConverterRegistry;
+import net.minecraft.world.level.storage.WorldDataServer;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.Main;
@ -19,7 +26,7 @@
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements IMojangStatistics, ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogManager.getLogger();
@@ -124,6 +136,20 @@
@@ -224,6 +243,20 @@
private final DefinedStructureManager ak;
protected SaveData saveData;
@ -40,7 +47,7 @@
public static <S extends MinecraftServer> S a(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -133,21 +159,21 @@
@@ -233,21 +266,21 @@
thread.setUncaughtExceptionHandler((thread1, throwable) -> {
MinecraftServer.LOGGER.error(throwable);
});
@ -65,7 +72,7 @@
this.isRunning = true;
this.h = new long[100];
this.K = "";
@@ -173,7 +199,34 @@
@@ -273,7 +306,34 @@
this.ak = new DefinedStructureManager(datapackresources.h(), convertable_conversionsession, datafixer);
this.serverThread = thread;
this.executorService = SystemUtils.f();
@ -100,7 +107,7 @@
private void initializeScoreboards(WorldPersistentData worldpersistentdata) {
PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard");
@@ -186,7 +239,7 @@
@@ -286,7 +346,7 @@
public static void convertWorld(Convertable.ConversionSession convertable_conversionsession) {
if (convertable_conversionsession.isConvertable()) {
@ -109,7 +116,7 @@
convertable_conversionsession.convert(new IProgressUpdate() {
private long a = SystemUtils.getMonotonicMillis();
@@ -209,45 +262,184 @@
@@ -309,45 +369,184 @@
}
@ -325,7 +332,7 @@
WorldBorder worldborder = worldserver.getWorldBorder();
worldborder.a(iworlddataserver.r());
@@ -272,31 +464,8 @@
@@ -372,31 +571,8 @@
iworlddataserver.c(true);
}
@ -358,7 +365,7 @@
private static void a(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1, boolean flag2) {
ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator();
@@ -312,6 +481,21 @@
@@ -412,6 +588,21 @@
return biomebase.b().b();
}, random);
ChunkCoordIntPair chunkcoordintpair = blockposition == null ? new ChunkCoordIntPair(0, 0) : new ChunkCoordIntPair(blockposition);
@ -380,7 +387,7 @@
if (blockposition == null) {
MinecraftServer.LOGGER.warn("Unable to find spawn biome");
@@ -378,8 +562,15 @@
@@ -478,8 +669,15 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
}
@ -398,7 +405,7 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.getDimensionKey().a());
BlockPosition blockposition = worldserver.getSpawn();
@@ -392,17 +583,21 @@
@@ -492,17 +690,21 @@
chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
while (chunkproviderserver.b() != 441) {
@ -429,7 +436,7 @@
if (forcedchunk != null) {
LongIterator longiterator = forcedchunk.a().iterator();
@@ -416,11 +611,18 @@
@@ -516,11 +718,18 @@
}
}
@ -451,7 +458,7 @@
}
protected void loadResourcesZip() {
@@ -465,12 +667,16 @@
@@ -565,12 +774,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.savingDisabled && !flag2);
}
@ -468,7 +475,7 @@
return flag3;
}
@@ -479,8 +685,29 @@
@@ -579,8 +792,29 @@
this.stop();
}
@ -498,7 +505,7 @@
if (this.getServerConnection() != null) {
this.getServerConnection().b();
}
@@ -489,6 +716,7 @@
@@ -589,6 +823,7 @@
MinecraftServer.LOGGER.info("Saving players");
this.playerList.savePlayers();
this.playerList.shutdown();
@ -506,7 +513,7 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -566,14 +794,16 @@
@@ -666,14 +901,16 @@
while (this.isRunning) {
long i = SystemUtils.getMonotonicMillis() - this.nextTick;
@ -524,7 +531,7 @@
this.nextTick += 50L;
GameProfilerTick gameprofilertick = GameProfilerTick.a("Server");
@@ -619,6 +849,12 @@
@@ -719,6 +956,12 @@
} catch (Throwable throwable1) {
MinecraftServer.LOGGER.error("Exception stopping the server", throwable1);
} finally {
@ -537,7 +544,7 @@
this.exit();
}
@@ -627,8 +863,15 @@
@@ -727,8 +970,15 @@
}
private boolean canSleepForTick() {
@ -554,7 +561,7 @@
protected void sleepForTick() {
this.executeAll();
@@ -734,7 +977,7 @@
@@ -834,7 +1084,7 @@
this.serverPing.b().a(agameprofile);
}
@ -563,7 +570,7 @@
MinecraftServer.LOGGER.debug("Autosave started");
this.methodProfiler.enter("save");
this.playerList.savePlayers();
@@ -764,22 +1007,39 @@
@@ -864,22 +1114,39 @@
}
protected void b(BooleanSupplier booleansupplier) {
@ -603,7 +610,7 @@
this.methodProfiler.enter("tick");
@@ -863,7 +1123,7 @@
@@ -963,7 +1230,7 @@
}
public String getServerModName() {
@ -612,7 +619,7 @@
}
public CrashReport b(CrashReport crashreport) {
@@ -1220,16 +1480,17 @@
@@ -1320,16 +1587,17 @@
public CompletableFuture<Void> a(Collection<String> collection) {
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -632,7 +639,7 @@
this.resourcePackRepository.a(collection);
this.saveData.a(a(this.resourcePackRepository));
datapackresources.i();
@@ -1595,6 +1856,22 @@
@@ -1695,6 +1963,22 @@
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ScoreboardServer.java
+++ b/net/minecraft/server/ScoreboardServer.java
@@ -22,7 +22,7 @@
@@ -32,7 +32,7 @@
public void handleScoreChanged(ScoreboardScore scoreboardscore) {
super.handleScoreChanged(scoreboardscore);
if (this.b.contains(scoreboardscore.getObjective())) {
@ -9,7 +9,7 @@
}
this.b();
@@ -31,7 +31,7 @@
@@ -41,7 +41,7 @@
@Override
public void handlePlayerRemoved(String s) {
super.handlePlayerRemoved(s);
@ -18,7 +18,7 @@
this.b();
}
@@ -39,7 +39,7 @@
@@ -49,7 +49,7 @@
public void a(String s, ScoreboardObjective scoreboardobjective) {
super.a(s, scoreboardobjective);
if (this.b.contains(scoreboardobjective)) {
@ -27,7 +27,7 @@
}
this.b();
@@ -52,7 +52,7 @@
@@ -62,7 +62,7 @@
super.setDisplaySlot(i, scoreboardobjective);
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
if (this.h(scoreboardobjective1) > 0) {
@ -36,7 +36,7 @@
} else {
this.g(scoreboardobjective1);
}
@@ -60,7 +60,7 @@
@@ -70,7 +70,7 @@
if (scoreboardobjective != null) {
if (this.b.contains(scoreboardobjective)) {
@ -45,7 +45,7 @@
} else {
this.e(scoreboardobjective);
}
@@ -72,7 +72,7 @@
@@ -82,7 +82,7 @@
@Override
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
if (super.addPlayerToTeam(s, scoreboardteam)) {
@ -54,7 +54,7 @@
this.b();
return true;
} else {
@@ -83,7 +83,7 @@
@@ -93,7 +93,7 @@
@Override
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
super.removePlayerFromTeam(s, scoreboardteam);
@ -63,7 +63,7 @@
this.b();
}
@@ -97,7 +97,7 @@
@@ -107,7 +107,7 @@
public void handleObjectiveChanged(ScoreboardObjective scoreboardobjective) {
super.handleObjectiveChanged(scoreboardobjective);
if (this.b.contains(scoreboardobjective)) {
@ -72,7 +72,7 @@
}
this.b();
@@ -116,21 +116,21 @@
@@ -126,21 +126,21 @@
@Override
public void handleTeamAdded(ScoreboardTeam scoreboardteam) {
super.handleTeamAdded(scoreboardteam);
@ -97,7 +97,7 @@
this.b();
}
@@ -179,6 +179,7 @@
@@ -189,6 +189,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -105,7 +105,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -211,6 +212,7 @@
@@ -221,6 +222,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -113,7 +113,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -235,6 +237,16 @@
@@ -245,6 +247,16 @@
return i;
}

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BossBattleCustom.java
+++ b/net/minecraft/server/BossBattleCustom.java
@@ -6,12 +6,27 @@
import java.util.Set;
import java.util.UUID;
--- a/net/minecraft/server/bossevents/BossBattleCustom.java
+++ b/net/minecraft/server/bossevents/BossBattleCustom.java
@@ -18,12 +18,27 @@
import net.minecraft.util.MathHelper;
import net.minecraft.world.BossBattle;
+// CraftBukkit start
+import org.bukkit.boss.KeyedBossBar;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandEffect.java
+++ b/net/minecraft/server/CommandEffect.java
@@ -62,7 +62,7 @@
--- a/net/minecraft/server/commands/CommandEffect.java
+++ b/net/minecraft/server/commands/CommandEffect.java
@@ -71,7 +71,7 @@
if (entity instanceof EntityLiving) {
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
@ -9,7 +9,7 @@
++j;
}
}
@@ -88,7 +88,7 @@
@@ -97,7 +97,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -18,7 +18,7 @@
++i;
}
}
@@ -113,7 +113,7 @@
@@ -122,7 +122,7 @@
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View file

@ -1,12 +1,12 @@
--- a/net/minecraft/server/CommandGamemode.java
+++ b/net/minecraft/server/CommandGamemode.java
@@ -55,6 +55,12 @@
--- 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 ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
+ commandcontext.getSource().sendFailureMessage(new net.minecraft.network.chat.ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'"));
+ continue;
+ }
+ // CraftBukkit end

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandGamerule.java
+++ b/net/minecraft/server/CommandGamerule.java
@@ -25,7 +25,7 @@
--- a/net/minecraft/server/commands/CommandGamerule.java
+++ b/net/minecraft/server/commands/CommandGamerule.java
@@ -29,7 +29,7 @@
private static <T extends GameRules.GameRuleValue<T>> int b(CommandContext<CommandListenerWrapper> commandcontext, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource();
@ -9,7 +9,7 @@
t0.b(commandcontext, "value");
commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true);
@@ -33,7 +33,7 @@
@@ -37,7 +37,7 @@
}
private static <T extends GameRules.GameRuleValue<T>> int b(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandReload.java
+++ b/net/minecraft/server/CommandReload.java
@@ -36,6 +36,16 @@
--- a/net/minecraft/server/commands/CommandReload.java
+++ b/net/minecraft/server/commands/CommandReload.java
@@ -42,6 +42,16 @@
return collection1;
}
@ -14,6 +14,6 @@
+ }
+ // CraftBukkit end
+
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
com_mojang_brigadier_commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
commanddispatcher.register((LiteralArgumentBuilder) ((LiteralArgumentBuilder) net.minecraft.commands.CommandDispatcher.a("reload").requires((commandlistenerwrapper) -> {
return commandlistenerwrapper.hasPermission(2);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CommandSpreadPlayers.java
+++ b/net/minecraft/server/CommandSpreadPlayers.java
@@ -61,7 +61,7 @@
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -77,7 +77,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getScoreboardTeam());
} else {
@ -9,7 +9,7 @@
}
}
@@ -270,7 +270,7 @@
@@ -286,7 +286,7 @@
for (boolean flag2 = iblockaccess.getType(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > 0; flag2 = flag1) {
blockposition_mutableblockposition.c(EnumDirection.DOWN);
@ -18,7 +18,7 @@
if (!flag1 && flag2 && flag) {
return blockposition_mutableblockposition.getY() + 1;
}
@@ -283,7 +283,7 @@
@@ -299,7 +299,7 @@
public boolean b(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.a, (double) (this.a(iblockaccess, i) - 1), this.b);
@ -27,7 +27,7 @@
Material material = iblockdata.getMaterial();
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
@@ -293,5 +293,12 @@
@@ -309,5 +309,12 @@
this.a = MathHelper.a(random, d0, d2);
this.b = MathHelper.a(random, d1, d3);
}

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/CommandTeleport.java
+++ b/net/minecraft/server/CommandTeleport.java
@@ -13,6 +13,12 @@
import java.util.Set;
import javax.annotation.Nullable;
--- a/net/minecraft/server/commands/CommandTeleport.java
+++ b/net/minecraft/server/commands/CommandTeleport.java
@@ -35,6 +35,12 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.Location;
@ -13,7 +13,7 @@
public class CommandTeleport {
private static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("commands.teleport.invalidPosition"));
@@ -128,9 +134,9 @@
@@ -150,9 +156,9 @@
}
if (worldserver == entity.world) {
@ -25,7 +25,7 @@
}
entity.setHeadRotation(f);
@@ -139,6 +145,21 @@
@@ -161,6 +167,21 @@
float f3 = MathHelper.g(f1);
f3 = MathHelper.a(f3, -90.0F, 90.0F);

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/CommandTime.java
+++ b/net/minecraft/server/CommandTime.java
@@ -5,6 +5,11 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import java.util.Iterator;
--- a/net/minecraft/server/commands/CommandTime.java
+++ b/net/minecraft/server/commands/CommandTime.java
@@ -10,6 +10,11 @@
import net.minecraft.network.chat.ChatMessage;
import net.minecraft.server.level.WorldServer;
+// CraftBukkit start
+import org.bukkit.Bukkit;
@ -11,8 +11,8 @@
+
public class CommandTime {
public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) {
@@ -46,7 +51,13 @@
public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) {
@@ -51,7 +56,13 @@
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();
@ -27,7 +27,7 @@
}
commandlistenerwrapper.sendMessage(new ChatMessage("commands.time.set", new Object[]{i}), true);
@@ -59,7 +70,13 @@
@@ -64,7 +75,13 @@
while (iterator.hasNext()) {
WorldServer worldserver = (WorldServer) iterator.next();

View file

@ -1,10 +1,11 @@
--- a/net/minecraft/server/DedicatedServer.java
+++ b/net/minecraft/server/DedicatedServer.java
@@ -22,6 +22,14 @@
--- a/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
@@ -60,6 +60,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.DataPackConfiguration;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.io.IoBuilder;
+import org.bukkit.command.CommandSender;
@ -15,7 +16,7 @@
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
private static final Logger LOGGER = LogManager.getLogger();
@@ -36,8 +44,10 @@
@@ -74,8 +83,10 @@
@Nullable
private final TextFilter r;
@ -28,7 +29,7 @@
this.propertyManager = dedicatedserversettings;
this.remoteControlCommandListener = new RemoteControlCommandListener(this);
this.r = null;
@@ -47,13 +57,44 @@
@@ -85,13 +96,44 @@
public boolean init() throws IOException {
Thread thread = new Thread("Server console handler") {
public void run() {
@ -76,7 +77,7 @@
}
} catch (IOException ioexception) {
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
@@ -62,6 +103,27 @@
@@ -100,6 +142,27 @@
}
};
@ -104,7 +105,7 @@
thread.setDaemon(true);
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
thread.start();
@@ -88,7 +150,7 @@
@@ -126,7 +189,7 @@
this.setForceGamemode(dedicatedserverproperties.forceGamemode);
super.setIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
this.i(dedicatedserverproperties.enforceWhitelist);
@ -113,7 +114,7 @@
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
InetAddress inetaddress = null;
@@ -112,6 +174,12 @@
@@ -150,6 +213,12 @@
return false;
}
@ -126,7 +127,7 @@
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.");
@@ -126,7 +194,7 @@
@@ -164,7 +233,7 @@
if (!NameReferencingFileConverter.e(this)) {
return false;
} else {
@ -135,7 +136,7 @@
long i = SystemUtils.getMonotonicNanos();
this.c(dedicatedserverproperties.maxBuildHeight);
@@ -134,7 +202,7 @@
@@ -172,7 +241,7 @@
TileEntitySkull.a(this.getMinecraftSessionService());
UserCache.a(this.getOnlineMode());
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getWorld());
@ -144,7 +145,7 @@
long j = SystemUtils.getMonotonicNanos() - i;
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
@@ -151,6 +219,7 @@
@@ -189,6 +258,7 @@
if (dedicatedserverproperties.enableRcon) {
DedicatedServer.LOGGER.info("Starting remote control listener");
this.remoteControlListener = RemoteControlListener.a((IMinecraftServer) this);
@ -152,7 +153,7 @@
}
if (this.getMaxTickTime() > 0L) {
@@ -265,6 +334,7 @@
@@ -303,6 +373,7 @@
this.remoteStatusListener.b();
}
@ -160,7 +161,7 @@
}
@Override
@@ -293,7 +363,15 @@
@@ -331,7 +402,15 @@
while (!this.serverCommandQueue.isEmpty()) {
ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);
@ -177,7 +178,7 @@
}
}
@@ -503,14 +581,45 @@
@@ -541,14 +620,45 @@
@Override
public String getPlugins() {
@ -225,7 +226,7 @@
});
return this.remoteControlCommandListener.getMessages();
}
@@ -552,4 +661,15 @@
@@ -590,4 +700,15 @@
public ITextFilter a(EntityPlayer entityplayer) {
return this.r != null ? this.r.a(entityplayer.getProfile()) : null;
}

View file

@ -1,12 +1,12 @@
--- a/net/minecraft/server/DedicatedServerProperties.java
+++ b/net/minecraft/server/DedicatedServerProperties.java
@@ -3,8 +3,14 @@
import java.util.Properties;
import java.util.concurrent.TimeUnit;
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -9,8 +9,14 @@
import net.minecraft.world.level.EnumGamemode;
import net.minecraft.world.level.levelgen.GeneratorSettings;
+// CraftBukkit start
+import joptsimple.OptionSet;
+import net.minecraft.server.PropertyManager.EditableProperty;
+import net.minecraft.server.dedicated.PropertyManager.EditableProperty;
+// CraftBukkit end
+
public class DedicatedServerProperties extends PropertyManager<DedicatedServerProperties> {
@ -15,7 +15,7 @@
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", "");
@@ -55,8 +61,10 @@
@@ -61,8 +67,10 @@
public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList;
public final GeneratorSettings generatorSettings;
@ -28,15 +28,15 @@
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");
@@ -107,12 +115,14 @@
@@ -113,12 +121,14 @@
this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties);
}
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom);
- public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path) {
- return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom);
+ // CraftBukkit start
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(java_nio_file_path), iregistrycustom, optionset);
+ public static DedicatedServerProperties load(IRegistryCustom iregistrycustom, Path path, OptionSet optionset) {
+ return new DedicatedServerProperties(loadPropertiesFile(path), iregistrycustom, optionset);
}
@Override

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/DedicatedServerSettings.java
+++ b/net/minecraft/server/DedicatedServerSettings.java
@@ -2,14 +2,21 @@
--- a/net/minecraft/server/dedicated/DedicatedServerSettings.java
+++ b/net/minecraft/server/dedicated/DedicatedServerSettings.java
@@ -4,14 +4,21 @@
import java.util.function.UnaryOperator;
import net.minecraft.core.IRegistryCustom;
+// CraftBukkit start
+import java.io.File;
@ -11,12 +11,12 @@
+
public class DedicatedServerSettings {
private final java.nio.file.Path path;
private final Path path;
private DedicatedServerProperties properties;
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, java.nio.file.Path java_nio_file_path) {
- this.path = java_nio_file_path;
- this.properties = DedicatedServerProperties.load(iregistrycustom, java_nio_file_path);
- public DedicatedServerSettings(IRegistryCustom iregistrycustom, Path path) {
- this.path = path;
- this.properties = DedicatedServerProperties.load(iregistrycustom, path);
+ // CraftBukkit start
+ public DedicatedServerSettings(IRegistryCustom iregistrycustom, OptionSet optionset) {
+ this.path = ((File) optionset.valueOf("config")).toPath();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PropertyManager.java
+++ b/net/minecraft/server/PropertyManager.java
@@ -15,15 +15,30 @@
--- a/net/minecraft/server/dedicated/PropertyManager.java
+++ b/net/minecraft/server/dedicated/PropertyManager.java
@@ -17,15 +17,30 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -29,22 +29,22 @@
+ }
+ // CraftBukkit end
+
public static Properties loadPropertiesFile(java.nio.file.Path java_nio_file_path) {
public static Properties loadPropertiesFile(Path path) {
Properties properties = new Properties();
@@ -59,6 +74,11 @@
@@ -61,6 +76,11 @@
public void savePropertiesFile(java.nio.file.Path java_nio_file_path) {
public void savePropertiesFile(Path path) {
try {
+ // CraftBukkit start - Don't attempt writing to file if it's read only
+ if (java_nio_file_path.toFile().exists() && !java_nio_file_path.toFile().canWrite()) {
+ if (path.toFile().exists() && !path.toFile().canWrite()) {
+ return;
+ }
+ // CraftBukkit end
OutputStream outputstream = Files.newOutputStream(java_nio_file_path);
OutputStream outputstream = Files.newOutputStream(path);
Throwable throwable = null;
@@ -90,7 +110,7 @@
@@ -92,7 +112,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;
}
@@ -109,7 +129,7 @@
@@ -111,7 +131,7 @@
@Nullable
private String c(String s) {
@ -62,7 +62,7 @@
}
@Nullable
@@ -137,7 +157,7 @@
@@ -139,7 +159,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) {
@@ -166,7 +186,7 @@
@@ -168,7 +188,7 @@
}
protected int getInt(String s, int i) {
@ -80,7 +80,7 @@
}
protected PropertyManager<T>.EditableProperty<Integer> b(String s, int i) {
@@ -178,7 +198,7 @@
@@ -180,7 +200,7 @@
}
protected long getLong(String s, long i) {
@ -89,7 +89,7 @@
}
protected boolean getBoolean(String s, boolean flag) {
@@ -201,7 +221,7 @@
@@ -203,7 +223,7 @@
return properties;
}
@ -98,7 +98,7 @@
public class EditableProperty<V> implements Supplier<V> {
@@ -209,7 +229,7 @@
@@ -211,7 +231,7 @@
private final V c;
private final Function<V, String> d;
@ -107,7 +107,7 @@
this.b = s;
this.c = object;
this.d = function;
@@ -223,7 +243,7 @@
@@ -225,7 +245,7 @@
Properties properties = PropertyManager.this.a();
properties.put(this.b, this.d.apply(v0));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ServerGUI.java
+++ b/net/minecraft/server/ServerGUI.java
@@ -158,6 +158,7 @@
--- a/net/minecraft/server/gui/ServerGUI.java
+++ b/net/minecraft/server/gui/ServerGUI.java
@@ -160,6 +160,7 @@
this.e.forEach(Runnable::run);
}
@ -8,7 +8,7 @@
public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(() -> {
@@ -173,7 +174,7 @@
@@ -175,7 +176,7 @@
}
try {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkMapDistance.java
+++ b/net/minecraft/server/ChunkMapDistance.java
@@ -59,7 +59,7 @@
--- a/net/minecraft/server/level/ChunkMapDistance.java
+++ b/net/minecraft/server/level/ChunkMapDistance.java
@@ -65,7 +65,7 @@
while (objectiterator.hasNext()) {
Entry<ArraySetSorted<Ticket<?>>> entry = (Entry) objectiterator.next();
@ -9,7 +9,7 @@
return ticket.b(this.currentTick);
})) {
this.ticketLevelTracker.update(entry.getLongKey(), getLowestTicketLevel((ArraySetSorted) entry.getValue()), false);
@@ -95,10 +95,25 @@
@@ -101,10 +101,25 @@
}
if (!this.pendingChunkUpdates.isEmpty()) {
@ -38,7 +38,7 @@
return true;
} else {
if (!this.l.isEmpty()) {
@@ -134,23 +149,25 @@
@@ -140,23 +155,25 @@
}
}
@ -68,7 +68,7 @@
}
if (arraysetsorted.isEmpty()) {
@@ -158,16 +175,29 @@
@@ -164,16 +181,29 @@
}
this.ticketLevelTracker.update(i, getLowestTicketLevel(arraysetsorted), false);
@ -101,7 +101,7 @@
}
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
@@ -210,6 +240,7 @@
@@ -216,6 +246,7 @@
public void b(SectionPosition sectionposition, EntityPlayer entityplayer) {
long i = sectionposition.r().pair();
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i);
@ -109,7 +109,7 @@
objectset.remove(entityplayer);
if (objectset.isEmpty()) {
@@ -251,6 +282,26 @@
@@ -257,6 +288,26 @@
return this.i.a();
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ChunkProviderServer.java
+++ b/net/minecraft/server/ChunkProviderServer.java
@@ -54,6 +54,24 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -79,6 +79,24 @@
this.clearCache();
}
@ -25,7 +25,7 @@
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -98,7 +116,7 @@
@@ -123,7 +141,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
ichunkaccess = this.cacheChunk[l];
@ -34,7 +34,7 @@
return ichunkaccess;
}
}
@@ -144,12 +162,12 @@
@@ -169,12 +187,12 @@
if (playerchunk == null) {
return null;
} else {
@ -49,7 +49,7 @@
if (ichunkaccess1 != null) {
this.a(k, ichunkaccess1, ChunkStatus.FULL);
@@ -176,7 +194,15 @@
@@ -201,7 +219,15 @@
int l = 33 + ChunkStatus.a(chunkstatus);
PlayerChunk playerchunk = this.getChunk(k);
@ -66,7 +66,7 @@
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.a(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
@@ -195,7 +221,7 @@
@@ -220,7 +246,7 @@
}
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
@ -75,7 +75,7 @@
}
public boolean isLoaded(int i, int j) {
@@ -257,19 +283,19 @@
@@ -282,19 +308,19 @@
public boolean a(Entity entity) {
long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4);
@ -98,7 +98,7 @@
}
private boolean a(long i, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> function) {
@@ -291,11 +317,31 @@
@@ -316,11 +342,31 @@
@Override
public void close() throws IOException {
@ -131,7 +131,7 @@
public void tick(BooleanSupplier booleansupplier) {
this.world.getMethodProfiler().enter("purge");
this.chunkMapDistance.purgeTickets();
@@ -315,12 +361,12 @@
@@ -340,12 +386,12 @@
this.lastTickTime = i;
WorldData worlddata = this.world.getWorldData();
boolean flag = this.world.isDebugWorld();
@ -146,7 +146,7 @@
this.world.getMethodProfiler().enter("naturalSpawnCount");
int l = this.chunkMapDistance.b();
@@ -507,12 +553,18 @@
@@ -532,12 +578,18 @@
@Override
protected boolean executeNext() {

View file

@ -1,10 +1,17 @@
--- a/net/minecraft/server/EntityPlayer.java
+++ b/net/minecraft/server/EntityPlayer.java
@@ -15,6 +15,28 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -135,6 +135,35 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.world.damagesource.CombatTracker;
+import net.minecraft.world.food.FoodMetaData;
+import net.minecraft.world.item.enchantment.EnchantmentManager;
+import net.minecraft.world.level.block.BlockChest;
+import net.minecraft.world.level.dimension.DimensionManager;
+import net.minecraft.world.scores.Scoreboard;
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
@ -29,7 +36,7 @@
public class EntityPlayer extends EntityHuman implements ICrafting {
private static final Logger LOGGER = LogManager.getLogger();
@@ -60,6 +82,20 @@
@@ -180,6 +209,20 @@
public int ping;
public boolean viewingCredits;
@ -50,7 +57,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) {
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
this.spawnDimension = World.OVERWORLD;
@@ -71,12 +107,56 @@
@@ -191,12 +234,56 @@
this.G = 1.0F;
this.c(worldserver);
this.co = minecraftserver.a(this);
@ -108,7 +115,7 @@
int i = Math.max(0, this.server.a(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().b((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -142,11 +222,20 @@
@@ -262,11 +349,20 @@
if (nbttagcompound.hasKeyOfType("recipeBook", 10)) {
this.recipeBook.a(nbttagcompound.getCompound("recipeBook"), this.server.getCraftingManager());
}
@ -129,7 +136,7 @@
if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) {
this.spawn = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
this.spawnForced = nbttagcompound.getBoolean("SpawnForced");
@@ -180,7 +269,20 @@
@@ -300,7 +396,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@ -151,7 +158,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -198,7 +300,7 @@
@@ -318,7 +427,7 @@
nbttagcompound.setInt("SpawnZ", this.spawn.getZ());
nbttagcompound.setBoolean("SpawnForced", this.spawnForced);
nbttagcompound.setFloat("SpawnAngle", this.spawnAngle);
@ -160,7 +167,7 @@
Logger logger = EntityPlayer.LOGGER;
logger.getClass();
@@ -206,9 +308,33 @@
@@ -326,9 +435,33 @@
nbttagcompound.set("SpawnDimension", nbtbase);
});
}
@ -194,7 +201,7 @@
public void a(int i) {
float f = (float) this.getExpToLevel();
float f1 = (f - 1.0F) / f;
@@ -262,6 +388,11 @@
@@ -382,6 +515,11 @@
@Override
public void tick() {
@ -206,7 +213,7 @@
this.playerInteractManager.a();
--this.invulnerableTicks;
if (this.noDamageTicks > 0) {
@@ -329,7 +460,7 @@
@@ -449,7 +587,7 @@
}
if (this.getHealth() != this.lastHealthSent || this.lastFoodSent != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastSentSaturationZero) {
@ -215,7 +222,7 @@
this.lastHealthSent = this.getHealth();
this.lastFoodSent = this.foodData.getFoodLevel();
this.lastSentSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -360,6 +491,12 @@
@@ -480,6 +618,12 @@
this.a(IScoreboardCriteria.XP, MathHelper.f((float) this.lastExpTotalScored));
}
@ -228,7 +235,7 @@
if (this.expLevel != this.lastExpLevelScored) {
this.lastExpLevelScored = this.expLevel;
this.a(IScoreboardCriteria.LEVEL, MathHelper.f((float) this.lastExpLevelScored));
@@ -374,6 +511,16 @@
@@ -494,6 +638,16 @@
CriterionTriggers.p.a(this);
}
@ -245,7 +252,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
@@ -384,7 +531,8 @@
@@ -504,7 +658,8 @@
}
private void a(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -255,7 +262,7 @@
scoreboardscore.setScore(i);
});
}
@@ -392,9 +540,46 @@
@@ -512,9 +667,46 @@
@Override
public void die(DamageSource damagesource) {
boolean flag = this.world.getGameRules().getBoolean(GameRules.SHOW_DEATH_MESSAGES);
@ -304,7 +311,7 @@
this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> {
if (!future.isSuccess()) {
@@ -428,12 +613,18 @@
@@ -548,12 +740,18 @@
if (this.world.getGameRules().getBoolean(GameRules.FORGIVE_DEAD_PLAYERS)) {
this.eW();
}
@ -327,7 +334,7 @@
EntityLiving entityliving = this.getKillingEntity();
if (entityliving != null) {
@@ -469,10 +660,12 @@
@@ -589,10 +787,12 @@
String s = this.getName();
String s1 = entity.getName();
@ -342,7 +349,7 @@
} else {
this.a(StatisticList.MOB_KILLS);
}
@@ -490,7 +683,8 @@
@@ -610,7 +810,8 @@
int i = scoreboardteam.getColor().b();
if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -352,7 +359,7 @@
}
}
@@ -534,18 +728,20 @@
@@ -654,18 +855,20 @@
}
private boolean canPvP() {
@ -376,7 +383,7 @@
} else {
return shapedetectorshape;
}
@@ -554,11 +750,20 @@
@@ -674,11 +877,20 @@
@Nullable
@Override
public Entity b(WorldServer worldserver) {
@ -400,7 +407,7 @@
this.decouple();
this.getWorldServer().removePlayer(this);
if (!this.viewingCredits) {
@@ -569,6 +774,8 @@
@@ -689,6 +901,8 @@
return this;
} else {
@ -409,7 +416,7 @@
WorldData worlddata = worldserver.getWorldData();
this.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), BiomeManager.a(worldserver.getSeed()), this.playerInteractManager.getGameMode(), this.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true));
@@ -578,22 +785,52 @@
@@ -698,22 +912,52 @@
playerlist.d(this);
worldserver1.removePlayer(this);
this.dead = false;
@ -468,7 +475,7 @@
worldserver1.getMethodProfiler().exit();
this.triggerDimensionAdvancements(worldserver1);
this.playerInteractManager.a(worldserver);
@@ -612,12 +849,31 @@
@@ -732,12 +976,31 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@ -500,7 +507,7 @@
private void a(WorldServer worldserver, BlockPosition blockposition) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.i();
@@ -634,17 +890,17 @@
@@ -754,17 +1017,17 @@
}
@Override
@ -523,7 +530,7 @@
}
return optional1;
@@ -688,10 +944,8 @@
@@ -808,10 +1071,8 @@
this.activeContainer.c();
}
@ -536,7 +543,7 @@
if (!this.isSleeping() && this.isAlive()) {
if (!this.world.getDimensionManager().isNatural()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
@@ -717,7 +971,36 @@
@@ -837,7 +1098,36 @@
}
}
@ -574,7 +581,7 @@
this.a(StatisticList.SLEEP_IN_BED);
CriterionTriggers.q.a(this);
});
@@ -726,9 +1009,8 @@
@@ -846,9 +1136,8 @@
return either;
}
}
@ -585,7 +592,7 @@
}
@Override
@@ -755,6 +1037,24 @@
@@ -875,6 +1164,24 @@
@Override
public void wakeup(boolean flag, boolean flag1) {
@ -610,7 +617,7 @@
if (this.isSleeping()) {
this.getWorldServer().getChunkProvider().broadcastIncludingSelf(this, new PacketPlayOutAnimation(this, 2));
}
@@ -826,8 +1126,9 @@
@@ -946,8 +1253,9 @@
this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition()));
}
@ -621,7 +628,7 @@
}
@Override
@@ -842,6 +1143,24 @@
@@ -962,6 +1270,24 @@
this.nextContainerCounter();
Container container = itileinventory.createMenu(this.containerCounter, this.inventory, this);
@ -646,7 +653,7 @@
if (container == null) {
if (this.isSpectator()) {
this.a((IChatBaseComponent) (new ChatMessage("container.spectatorCantOpen")).a(EnumChatFormat.RED), true);
@@ -849,9 +1168,11 @@
@@ -969,9 +1295,11 @@
return OptionalInt.empty();
} else {
@ -660,7 +667,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -864,13 +1185,24 @@
@@ -984,13 +1312,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -687,7 +694,7 @@
this.activeContainer.addSlotListener(this);
}
@@ -915,6 +1247,11 @@
@@ -1035,6 +1374,11 @@
public void a(Container container, NonNullList<ItemStack> nonnulllist) {
this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, nonnulllist));
this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried()));
@ -699,7 +706,7 @@
}
@Override
@@ -924,6 +1261,7 @@
@@ -1044,6 +1388,7 @@
@Override
public void closeInventory() {
@ -707,7 +714,7 @@
this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId));
this.o();
}
@@ -958,7 +1296,7 @@
@@ -1078,7 +1423,7 @@
@Override
public void a(Statistic<?> statistic, int i) {
this.serverStatisticManager.b(this, statistic, i);
@ -716,7 +723,7 @@
scoreboardscore.addScore(i);
});
}
@@ -966,7 +1304,7 @@
@@ -1086,7 +1431,7 @@
@Override
public void a(Statistic<?> statistic) {
this.serverStatisticManager.setStatistic(this, statistic, 0);
@ -725,7 +732,7 @@
}
@Override
@@ -1015,7 +1353,16 @@
@@ -1135,7 +1480,16 @@
public void triggerHealthUpdate() {
this.lastHealthSent = -1.0E8F;
@ -742,7 +749,7 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent, boolean flag) {
@@ -1068,12 +1415,13 @@
@@ -1188,12 +1542,13 @@
this.lastSentExp = -1;
this.lastHealthSent = -1.0F;
this.lastFoodSent = -1;
@ -757,7 +764,7 @@
}
@Override
@@ -1141,6 +1489,18 @@
@@ -1261,6 +1616,18 @@
@Override
public void a(EnumGamemode enumgamemode) {
@ -776,7 +783,7 @@
this.playerInteractManager.setGameMode(enumgamemode);
this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.d, (float) enumgamemode.getId()));
if (enumgamemode == EnumGamemode.SPECTATOR) {
@@ -1190,7 +1550,20 @@
@@ -1310,7 +1677,20 @@
return s;
}
@ -797,7 +804,7 @@
this.bY = packetplayinsettings.d();
this.bZ = packetplayinsettings.e();
this.getDataWatcher().set(EntityPlayer.bi, (byte) packetplayinsettings.f());
@@ -1226,13 +1599,13 @@
@@ -1346,13 +1726,13 @@
if (entity instanceof EntityHuman) {
this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]{entity.getId()}));
} else {
@ -813,7 +820,7 @@
}
@Override
@@ -1256,7 +1629,7 @@
@@ -1376,7 +1756,7 @@
this.spectatedEntity = (Entity) (entity == null ? this : entity);
if (entity1 != this.spectatedEntity) {
this.playerConnection.sendPacket(new PacketPlayOutCamera(this.spectatedEntity));
@ -822,7 +829,7 @@
}
}
@@ -1285,7 +1658,7 @@
@@ -1405,7 +1785,7 @@
@Nullable
public IChatBaseComponent getPlayerListName() {
@ -831,7 +838,7 @@
}
@Override
@@ -1306,9 +1679,16 @@
@@ -1426,9 +1806,16 @@
return this.advancementDataPlayer;
}
@ -848,7 +855,7 @@
if (worldserver == this.world) {
this.playerConnection.a(d0, d1, d2, f, f1);
} else {
@@ -1329,6 +1709,9 @@
@@ -1449,6 +1836,9 @@
this.server.getPlayerList().a(this, worldserver);
this.server.getPlayerList().updateClient(this);
}
@ -858,7 +865,7 @@
}
@@ -1426,4 +1809,144 @@
@@ -1546,4 +1936,144 @@
public ITextFilter Q() {
return this.co;
}
@ -954,7 +961,7 @@
+ }
+
+ @Override
+ protected boolean isFrozen() {
+ public boolean isFrozen() {
+ return super.isFrozen() || !getBukkitEntity().isOnline();
+ }
+

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTrackerEntry.java
+++ b/net/minecraft/server/EntityTrackerEntry.java
@@ -11,6 +11,11 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -40,6 +40,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -12,7 +12,7 @@
public class EntityTrackerEntry {
private static final Logger LOGGER = LogManager.getLogger();
@@ -31,8 +36,12 @@
@@ -60,8 +65,12 @@
private List<Entity> p;
private boolean q;
private boolean r;
@ -26,7 +26,7 @@
this.m = Vec3D.ORIGIN;
this.p = Collections.emptyList();
this.b = worldserver;
@@ -52,16 +61,17 @@
@@ -81,16 +90,17 @@
if (!list.equals(this.p)) {
this.p = list;
@ -48,7 +48,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -106,6 +116,17 @@
@@ -135,6 +145,17 @@
boolean flag2 = flag1 || this.tickCounter % 60 == 0;
boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1;
@ -66,7 +66,7 @@
if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) {
long k = PacketPlayOutEntity.a(vec3d.x);
long l = PacketPlayOutEntity.a(vec3d.y);
@@ -144,6 +165,7 @@
@@ -173,6 +194,7 @@
}
this.c();
@ -74,7 +74,7 @@
if (flag2) {
this.d();
}
@@ -152,6 +174,7 @@
@@ -181,6 +203,7 @@
this.yRot = i;
this.xRot = j;
}
@ -82,7 +82,7 @@
this.q = false;
}
@@ -167,7 +190,27 @@
@@ -196,7 +219,27 @@
++this.tickCounter;
if (this.tracker.velocityChanged) {
@ -111,7 +111,7 @@
this.tracker.velocityChanged = false;
}
@@ -182,14 +225,17 @@
@@ -211,14 +254,17 @@
PlayerConnection playerconnection = entityplayer.playerConnection;
entityplayer.playerConnection.getClass();
@ -132,7 +132,7 @@
}
Packet<?> packet = this.tracker.P();
@@ -205,6 +251,12 @@
@@ -234,6 +280,12 @@
if (this.tracker instanceof EntityLiving) {
Collection<AttributeModifiable> collection = ((EntityLiving) this.tracker).getAttributeMap().b();
@ -145,7 +145,7 @@
if (!collection.isEmpty()) {
consumer.accept(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection));
}
@@ -236,8 +288,14 @@
@@ -265,8 +317,14 @@
if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.tracker.getId(), list));
}
@ -160,7 +160,7 @@
if (this.tracker instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.tracker;
Iterator iterator = entityliving.getEffects().iterator();
@@ -278,6 +336,11 @@
@@ -307,6 +365,11 @@
Set<AttributeModifiable> set = ((EntityLiving) this.tracker).getAttributeMap().getAttributes();
if (!set.isEmpty()) {

View file

@ -1,6 +1,17 @@
--- a/net/minecraft/server/PlayerChunk.java
+++ b/net/minecraft/server/PlayerChunk.java
@@ -44,7 +44,7 @@
--- a/net/minecraft/server/level/PlayerChunk.java
+++ b/net/minecraft/server/level/PlayerChunk.java
@@ -33,6 +33,10 @@
import net.minecraft.world.level.chunk.ProtoChunkExtension;
import net.minecraft.world.level.lighting.LightEngine;
+// CraftBukkit start
+import net.minecraft.server.MinecraftServer;
+// CraftBukkit end
+
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;
@ -9,7 +20,7 @@
this.dirtyBlocks = new ShortSet[16];
this.location = chunkcoordintpair;
this.lightEngine = lightengine;
@@ -56,6 +56,19 @@
@@ -77,6 +81,19 @@
this.a(i);
}
@ -29,7 +40,7 @@
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) {
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c());
@@ -81,9 +94,9 @@
@@ -102,9 +119,9 @@
@Nullable
public Chunk getChunk() {
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.a();
@ -41,7 +52,7 @@
}
@Nullable
@@ -114,6 +127,7 @@
@@ -135,6 +152,7 @@
if (chunk != null) {
byte b0 = (byte) SectionPosition.a(blockposition.getY());
@ -49,7 +60,7 @@
if (this.dirtyBlocks[b0] == null) {
this.p = true;
this.dirtyBlocks[b0] = new ShortArraySet();
@@ -216,7 +230,7 @@
@@ -237,7 +255,7 @@
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.statusFutures.get(i);
if (completablefuture != null) {
@ -58,7 +69,7 @@
if (either == null || either.left().isPresent()) {
return completablefuture;
@@ -271,6 +285,30 @@
@@ -292,6 +310,30 @@
boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET;
PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel);
PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel);
@ -89,7 +100,7 @@
CompletableFuture completablefuture;
if (flag) {
@@ -302,7 +340,7 @@
@@ -323,7 +365,7 @@
if (flag2 && !flag3) {
completablefuture = this.fullChunkFuture;
this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
@ -98,7 +109,7 @@
playerchunkmap.getClass();
return either1.ifLeft(playerchunkmap::a);
}));
@@ -340,6 +378,26 @@
@@ -361,6 +403,26 @@
this.u.a(this.location, this::k, this.ticketLevel, this::d);
this.oldTicketLevel = this.ticketLevel;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerChunkMap.java
+++ b/net/minecraft/server/PlayerChunkMap.java
@@ -45,6 +45,8 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -89,6 +89,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -9,7 +9,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private static final Logger LOGGER = LogManager.getLogger();
@@ -75,6 +77,31 @@
@@ -119,6 +121,31 @@
private final Queue<Runnable> A;
private int viewDistance;
@ -41,7 +41,7 @@
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) {
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
this.visibleChunks = this.updatingChunks.clone();
@@ -195,9 +222,12 @@
@@ -239,9 +266,12 @@
return completablefuture1.thenApply((list1) -> {
List<IChunkAccess> list2 = Lists.newArrayList();
@ -56,7 +56,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
Optional<IChunkAccess> optional = either.left();
@@ -300,7 +330,7 @@
@@ -344,7 +374,7 @@
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName());
} else {
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
@ -65,7 +65,7 @@
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
this.saveChunk(ichunkaccess);
@@ -311,7 +341,6 @@
@@ -355,7 +385,6 @@
}
}
@ -73,7 +73,7 @@
protected void unloadChunks(BooleanSupplier booleansupplier) {
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
@@ -350,7 +379,7 @@
@@ -394,7 +423,7 @@
private void a(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkSave();
@ -82,13 +82,13 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkSave();
if (completablefuture1 != completablefuture) {
@@ -572,8 +601,15 @@
@@ -616,8 +645,15 @@
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 && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) {
+ if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) {
+ entity.die();
+ needsRemoval = true;
+ }
@ -99,7 +99,7 @@
if (list == null) {
list = Lists.newArrayList(new Entity[]{entity});
} else {
@@ -784,7 +820,8 @@
@@ -828,7 +864,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
});
@ -109,7 +109,7 @@
return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum();
}).orElse(0), optional1.map((chunk) -> {
return chunk.getTileEntities().size();
@@ -795,7 +832,7 @@
@@ -839,7 +876,7 @@
private static String a(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try {
@ -118,7 +118,7 @@
return either != null ? (String) either.map((chunk) -> {
return "done";
@@ -813,7 +850,7 @@
@@ -857,7 +894,7 @@
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
@ -127,7 +127,7 @@
}
boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) {
@@ -1145,7 +1182,7 @@
@@ -1189,7 +1226,7 @@
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) {
@ -136,7 +136,7 @@
this.tracker = entity;
this.trackingDistance = i;
this.e = SectionPosition.a(entity);
@@ -1198,7 +1235,7 @@
@@ -1242,7 +1279,7 @@
public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.tracker) {
@ -145,7 +145,7 @@
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);
@@ -1214,6 +1251,17 @@
@@ -1258,6 +1295,17 @@
}
}

View file

@ -1,11 +1,19 @@
--- a/net/minecraft/server/PlayerInteractManager.java
+++ b/net/minecraft/server/PlayerInteractManager.java
@@ -4,6 +4,16 @@
--- a/net/minecraft/server/level/PlayerInteractManager.java
+++ b/net/minecraft/server/level/PlayerInteractManager.java
@@ -26,6 +26,24 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.ArrayList;
+import net.minecraft.network.protocol.game.PacketPlayOutBlockChange;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.world.entity.EnumItemSlot;
+import net.minecraft.world.level.block.BlockCake;
+import net.minecraft.world.level.block.BlockDoor;
+import net.minecraft.world.level.block.BlockTrapdoor;
+import net.minecraft.world.level.block.Blocks;
+import net.minecraft.world.level.block.state.properties.BlockPropertyDoubleBlockHalf;
+import org.bukkit.craftbukkit.block.CraftBlock;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -17,7 +25,7 @@
public class PlayerInteractManager {
private static final Logger LOGGER = LogManager.getLogger();
@@ -38,7 +48,7 @@
@@ -60,7 +78,7 @@
this.gamemode = enumgamemode;
enumgamemode.a(this.player.abilities);
this.player.updateAbilities();
@ -26,7 +34,7 @@
this.world.everyoneSleeping();
}
@@ -67,7 +77,7 @@
@@ -89,7 +107,7 @@
}
public void a() {
@ -35,7 +43,7 @@
IBlockData iblockdata;
if (this.j) {
@@ -123,9 +133,31 @@
@@ -145,9 +163,31 @@
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
if (!this.world.a((EntityHuman) this.player, blockposition)) {
@ -67,7 +75,7 @@
if (this.isCreative()) {
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "creative destroy");
@@ -141,11 +173,43 @@
@@ -163,11 +203,43 @@
float f = 1.0F;
iblockdata = this.world.getType(blockposition);
@ -112,7 +120,7 @@
if (!iblockdata.isAir() && f >= 1.0F) {
this.a(blockposition, packetplayinblockdig_enumplayerdigtype, "insta mine");
} else {
@@ -189,7 +253,7 @@
@@ -211,7 +283,7 @@
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
this.f = false;
if (!Objects.equals(this.h, blockposition)) {
@ -121,7 +129,7 @@
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"));
}
@@ -205,17 +269,73 @@
@@ -227,17 +299,73 @@
if (this.breakBlock(blockposition)) {
this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, s));
} else {
@ -197,7 +205,7 @@
TileEntity tileentity = this.world.getTileEntity(blockposition);
Block block = iblockdata.getBlock();
@@ -225,6 +345,10 @@
@@ -247,6 +375,10 @@
} else if (this.player.a((World) this.world, blockposition, this.gamemode)) {
return false;
} else {
@ -208,7 +216,7 @@
block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player);
boolean flag = this.world.a(blockposition, false);
@@ -233,19 +357,32 @@
@@ -255,19 +387,32 @@
}
if (this.isCreative()) {
@ -244,7 +252,7 @@
}
}
}
@@ -287,12 +424,46 @@
@@ -309,12 +454,46 @@
}
}
@ -291,7 +299,7 @@
if (itileinventory != null) {
entityplayer.openContainer(itileinventory);
@@ -306,7 +477,7 @@
@@ -328,7 +507,7 @@
ItemStack itemstack1 = itemstack.cloneItemStack();
if (!flag1) {
@ -300,7 +308,7 @@
if (enuminteractionresult.a()) {
CriterionTriggers.M.a(entityplayer, blockposition, itemstack1);
@@ -314,17 +485,17 @@
@@ -336,17 +515,17 @@
}
}
@ -321,7 +329,7 @@
}
if (enuminteractionresult1.a()) {
@@ -332,10 +503,10 @@
@@ -354,10 +533,10 @@
}
return enuminteractionresult1;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/RegionLimitedWorldAccess.java
@@ -236,6 +236,13 @@
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
@@ -273,6 +273,13 @@
@Override
public boolean addEntity(Entity entity) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/TicketType.java
+++ b/net/minecraft/server/TicketType.java
@@ -19,6 +19,8 @@
--- a/net/minecraft/server/level/TicketType.java
+++ b/net/minecraft/server/level/TicketType.java
@@ -23,6 +23,8 @@
public static final TicketType<BlockPosition> PORTAL = a("portal", BaseBlockPosition::compareTo, 300);
public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5);
public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1);

View file

@ -1,11 +1,14 @@
--- a/net/minecraft/server/WorldServer.java
+++ b/net/minecraft/server/WorldServer.java
@@ -39,6 +39,18 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -145,6 +145,21 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.logging.Level;
+import net.minecraft.world.entity.monster.EntityDrowned;
+import net.minecraft.world.level.block.ITileEntity;
+import net.minecraft.world.level.storage.WorldDataServer;
+import org.bukkit.Bukkit;
+import org.bukkit.WeatherType;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -19,7 +22,7 @@
public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition a = new BlockPosition(100, 50, 0);
@@ -50,7 +62,7 @@
@@ -156,7 +171,7 @@
private final ChunkProviderServer chunkProvider;
boolean tickingEntities;
private final MinecraftServer server;
@ -28,7 +31,7 @@
public boolean savingDisabled;
private boolean everyoneSleeping;
private int emptyTime;
@@ -67,8 +79,23 @@
@@ -173,8 +188,23 @@
private final StructureManager structureManager;
private final boolean Q;
@ -54,7 +57,7 @@
this.nextTickListBlock = new TickListServer<>(this, (block) -> {
return block == null || block.getBlockData().isAir();
}, IRegistry.BLOCK::getKey, this::b);
@@ -80,10 +107,17 @@
@@ -186,10 +216,17 @@
this.Q = flag1;
this.server = minecraftserver;
this.mobSpawners = list;
@ -73,7 +76,7 @@
this.portalTravelAgent = new PortalTravelAgent(this);
this.Q();
this.R();
@@ -95,14 +129,48 @@
@@ -201,14 +238,48 @@
iworlddataserver.setGameType(minecraftserver.getGamemode());
}
@ -90,7 +93,7 @@
+
+ // CraftBukkit start
+ @Override
+ protected TileEntity getTileEntity(BlockPosition pos, boolean validate) {
+ public TileEntity getTileEntity(BlockPosition pos, boolean validate) {
+ TileEntity result = super.getTileEntity(pos, validate);
+ if (!validate || Thread.currentThread() != this.serverThread) {
+ // SPIGOT-5378: avoid deadlock, this can be called in loading logic (i.e lighting) but getType() will block on chunk load
@ -113,7 +116,7 @@
+
+ if (type instanceof ITileEntity) {
+ TileEntity replacement = ((ITileEntity) type).createTile(this);
+ replacement.world = this;
+ replacement.setLocation(this, pos);
+ this.setTileEntity(pos, replacement);
+ return replacement;
+ } else {
@ -124,7 +127,7 @@
public void a(int i, int j, boolean flag, boolean flag1) {
this.worldDataServer.setClearWeatherTime(i);
@@ -193,6 +261,7 @@
@@ -299,6 +370,7 @@
this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F);
}
@ -132,7 +135,7 @@
if (this.lastRainLevel != this.rainLevel) {
this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel)), this.getDimensionKey());
}
@@ -211,18 +280,47 @@
@@ -317,18 +389,47 @@
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.h, this.rainLevel));
this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.i, this.thunderLevel));
}
@ -185,7 +188,7 @@
if (this.getGameRules().getBoolean(GameRules.DO_WEATHER_CYCLE)) {
this.clearWeather();
}
@@ -244,7 +342,7 @@
@@ -350,7 +451,7 @@
this.ak();
this.ticking = false;
gameprofilerfiller.exitEnter("entities");
@ -194,7 +197,7 @@
if (flag3) {
this.resetEmptyTime();
@@ -263,6 +361,7 @@
@@ -369,6 +470,7 @@
Entity entity = (Entity) entry.getValue();
Entity entity1 = entity.getVehicle();
@ -202,7 +205,7 @@
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
}
@@ -270,6 +369,7 @@
@@ -376,6 +478,7 @@
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die();
}
@ -210,7 +213,7 @@
gameprofilerfiller.enter("checkDespawn");
if (!entity.dead) {
@@ -344,7 +444,7 @@
@@ -450,7 +553,7 @@
}
private void wakeupPlayers() {
@ -219,7 +222,7 @@
entityplayer.wakeup(false, false);
});
}
@@ -371,14 +471,14 @@
@@ -477,14 +580,14 @@
entityhorseskeleton.t(true);
entityhorseskeleton.setAgeRaw(0);
entityhorseskeleton.setPosition((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -236,7 +239,7 @@
}
}
@@ -389,11 +489,11 @@
@@ -495,11 +598,11 @@
BiomeBase biomebase = this.getBiome(blockposition);
if (biomebase.a(this, blockposition1)) {
@ -250,7 +253,7 @@
}
if (flag && this.getBiome(blockposition1).c() == BiomeBase.Precipitation.RAIN) {
@@ -440,7 +540,7 @@
@@ -546,7 +649,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);
@ -259,7 +262,7 @@
return entityliving != null && entityliving.isAlive() && this.e(entityliving.getChunkCoordinates());
});
@@ -469,7 +569,7 @@
@@ -575,7 +678,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -268,7 +271,7 @@
++i;
} else if (entityplayer.isSleeping()) {
++j;
@@ -487,10 +587,22 @@
@@ -593,10 +696,22 @@
}
private void clearWeather() {
@ -293,7 +296,7 @@
}
public void resetEmptyTime() {
@@ -531,6 +643,7 @@
@@ -637,6 +752,7 @@
});
gameprofilerfiller.c("tickNonPassenger");
entity.tick();
@ -301,7 +304,7 @@
gameprofilerfiller.exit();
}
@@ -563,6 +676,7 @@
@@ -669,6 +785,7 @@
});
gameprofilerfiller.c("tickPassenger");
entity1.passengerTick();
@ -309,7 +312,7 @@
gameprofilerfiller.exit();
}
@@ -619,6 +733,7 @@
@@ -725,6 +842,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkProvider();
if (!flag1) {
@ -317,7 +320,7 @@
if (iprogressupdate != null) {
iprogressupdate.a(new ChatMessage("menu.savingLevel"));
}
@@ -630,11 +745,19 @@
@@ -736,11 +854,19 @@
chunkproviderserver.save(flag);
}
@ -338,7 +341,7 @@
}
this.getChunkProvider().getWorldPersistentData().a();
@@ -695,11 +818,24 @@
@@ -801,11 +927,24 @@
@Override
public boolean addEntity(Entity entity) {
@ -365,7 +368,7 @@
}
public void addEntityTeleport(Entity entity) {
@@ -749,13 +885,18 @@
@@ -855,13 +994,18 @@
this.registerEntity(entityplayer);
}
@ -386,7 +389,7 @@
IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX() / 16.0D), MathHelper.floor(entity.locZ() / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer);
if (!(ichunkaccess instanceof Chunk)) {
@@ -784,7 +925,7 @@
@@ -890,7 +1034,7 @@
if (entity1 == null) {
return false;
} else {
@ -395,7 +398,7 @@
return true;
}
}
@@ -813,10 +954,16 @@
@@ -919,10 +1063,16 @@
}
public boolean addAllEntitiesSafely(Entity entity) {
@ -413,7 +416,7 @@
return true;
}
}
@@ -867,10 +1014,17 @@
@@ -973,10 +1123,17 @@
}
this.getScoreboard().a(entity);
@ -431,7 +434,7 @@
}
private void registerEntity(Entity entity) {
@@ -891,9 +1045,16 @@
@@ -997,9 +1154,16 @@
this.entitiesByUUID.put(entity.getUniqueID(), entity);
this.getChunkProvider().addEntity(entity);
@ -448,7 +451,7 @@
}
}
@@ -909,7 +1070,7 @@
@@ -1015,7 +1179,7 @@
}
private void removeEntityFromChunk(Entity entity) {
@ -457,7 +460,7 @@
if (ichunkaccess instanceof Chunk) {
((Chunk) ichunkaccess).b(entity);
@@ -923,10 +1084,33 @@
@@ -1029,10 +1193,33 @@
this.everyoneSleeping();
}
@ -491,7 +494,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -935,6 +1119,12 @@
@@ -1041,6 +1228,12 @@
double d1 = (double) blockposition.getY() - entityplayer.locY();
double d2 = (double) blockposition.getZ() - entityplayer.locZ();
@ -504,7 +507,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -973,7 +1163,18 @@
@@ -1079,7 +1272,18 @@
Iterator iterator = this.navigators.iterator();
while (iterator.hasNext()) {
@ -524,7 +527,7 @@
if (!navigationabstract.i()) {
navigationabstract.b(blockposition);
@@ -995,10 +1196,20 @@
@@ -1101,10 +1305,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) {
@ -545,7 +548,7 @@
if (explosion_effect == Explosion.Effect.NONE) {
explosion.clearBlocks();
}
@@ -1063,13 +1274,20 @@
@@ -1169,13 +1383,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) {
@ -568,7 +571,7 @@
++j;
}
}
@@ -1111,7 +1329,7 @@
@@ -1217,7 +1438,7 @@
@Nullable
public BlockPosition a(StructureGenerator<?> structuregenerator, BlockPosition blockposition, int i, boolean flag) {
@ -577,7 +580,7 @@
}
@Nullable
@@ -1149,7 +1367,13 @@
@@ -1255,7 +1476,13 @@
@Override
public WorldMap a(String s) {
return (WorldMap) this.getMinecraftServer().E().getWorldPersistentData().b(() -> {
@ -592,7 +595,61 @@
}, s);
}
@@ -1460,6 +1684,11 @@
@@ -1386,9 +1613,9 @@
reputationhandler.a(reputationevent, entity);
}
- 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 +1659,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 +1682,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 +1706,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 +1730,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 +1793,11 @@
@Override
public void update(BlockPosition blockposition, Block block) {
if (!this.isDebugWorld()) {
@ -604,7 +661,7 @@
this.applyPhysics(blockposition, block);
}
@@ -1474,12 +1703,12 @@
@@ -1580,12 +1812,12 @@
}
public boolean isFlatWorld() {
@ -619,7 +676,7 @@
}
@Nullable
@@ -1499,9 +1728,9 @@
@@ -1605,9 +1837,9 @@
@VisibleForTesting
public String F() {
@ -631,7 +688,7 @@
return IRegistry.BLOCK_ENTITY_TYPE.getKey(tileentity.getTileType());
}), this.getBlockTickList().a(), this.getFluidTickList().a(), this.P());
}
@@ -1509,7 +1738,7 @@
@@ -1615,7 +1847,7 @@
private static <T> String a(Collection<T> collection, Function<T, MinecraftKey> function) {
try {
Object2IntOpenHashMap<MinecraftKey> object2intopenhashmap = new Object2IntOpenHashMap();
@ -640,7 +697,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1518,7 +1747,8 @@
@@ -1624,7 +1856,8 @@
object2intopenhashmap.addTo(minecraftkey, 1);
}
@ -650,7 +707,7 @@
return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue();
}).collect(Collectors.joining(","));
} catch (Exception exception) {
@@ -1527,16 +1757,32 @@
@@ -1633,16 +1866,32 @@
}
public static void a(WorldServer worldserver) {

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/HandshakeListener.java
+++ b/net/minecraft/server/HandshakeListener.java
@@ -1,7 +1,16 @@
package net.minecraft.server;
--- a/net/minecraft/server/network/HandshakeListener.java
+++ b/net/minecraft/server/network/HandshakeListener.java
@@ -11,8 +11,17 @@
import net.minecraft.network.protocol.login.PacketLoginOutDisconnect;
import net.minecraft.server.MinecraftServer;
+// CraftBukkit start
+import java.net.InetAddress;
@ -17,7 +18,7 @@
private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request");
private final MinecraftServer b;
private final NetworkManager c;
@@ -16,6 +25,40 @@
@@ -27,6 +36,40 @@
switch (packethandshakinginsetprotocol.b()) {
case LOGIN:
this.c.setProtocol(EnumProtocol.LOGIN);
@ -58,7 +59,7 @@
if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) {
ChatMessage chatmessage;
@@ -29,6 +72,7 @@
@@ -40,6 +83,7 @@
this.c.close(chatmessage);
} else {
this.c.setPacketListener(new LoginListener(this.b, this.c));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/LegacyPingHandler.java
+++ b/net/minecraft/server/LegacyPingHandler.java
@@ -34,11 +34,12 @@
--- a/net/minecraft/server/network/LegacyPingHandler.java
+++ b/net/minecraft/server/network/LegacyPingHandler.java
@@ -35,11 +35,12 @@
MinecraftServer minecraftserver = this.b.d();
int i = bytebuf.readableBytes();
String s;
@ -14,7 +14,7 @@
this.a(channelhandlercontext, this.a(s));
break;
case 1:
@@ -47,7 +48,7 @@
@@ -48,7 +49,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:
@@ -66,7 +67,7 @@
@@ -67,7 +68,7 @@
}
LegacyPingHandler.LOGGER.debug("Ping: (1.6) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort());

View file

@ -1,10 +1,11 @@
--- a/net/minecraft/server/LoginListener.java
+++ b/net/minecraft/server/LoginListener.java
@@ -18,6 +18,12 @@
--- a/net/minecraft/server/network/LoginListener.java
+++ b/net/minecraft/server/network/LoginListener.java
@@ -35,6 +35,13 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.network.chat.ChatComponentText;
+import org.bukkit.craftbukkit.util.Waitable;
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
+import org.bukkit.event.player.PlayerPreLoginEvent;
@ -13,7 +14,7 @@
public class LoginListener implements PacketLoginInListener {
private static final AtomicInteger b = new AtomicInteger(0);
@@ -32,6 +38,7 @@
@@ -49,6 +56,7 @@
private final String j;
private SecretKey loginKey;
private EntityPlayer l;
@ -21,7 +22,7 @@
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.g = LoginListener.EnumProtocolState.HELLO;
@@ -60,6 +67,20 @@
@@ -77,6 +85,20 @@
}
@ -42,7 +43,7 @@
@Override
public NetworkManager a() {
return this.networkManager;
@@ -81,10 +102,12 @@
@@ -98,10 +120,12 @@
this.i = this.a(this.i);
}
@ -58,7 +59,7 @@
} else {
this.g = LoginListener.EnumProtocolState.ACCEPTED;
if (this.server.ax() >= 0 && !this.networkManager.isLocal()) {
@@ -98,9 +121,9 @@
@@ -115,9 +139,9 @@
if (entityplayer != null) {
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
@ -70,7 +71,7 @@
}
}
@@ -158,6 +181,43 @@
@@ -175,6 +199,43 @@
try {
LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a());
if (LoginListener.this.i != null) {
@ -114,7 +115,7 @@
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId());
LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
} else if (LoginListener.this.server.isEmbeddedServer()) {
@@ -177,6 +237,11 @@
@@ -194,6 +255,11 @@
LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}

View file

@ -1,12 +1,16 @@
--- a/net/minecraft/server/PacketStatusListener.java
+++ b/net/minecraft/server/PacketStatusListener.java
@@ -1,5 +1,14 @@
package net.minecraft.server;
--- a/net/minecraft/server/network/PacketStatusListener.java
+++ b/net/minecraft/server/network/PacketStatusListener.java
@@ -10,6 +10,18 @@
import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
import net.minecraft.server.MinecraftServer;
+// CraftBukkit start
+import com.mojang.authlib.GameProfile;
+import java.net.InetSocketAddress;
+import java.util.Iterator;
+import net.minecraft.SharedConstants;
+import net.minecraft.network.protocol.status.ServerPing;
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.CraftIconCache;
+import org.bukkit.entity.Player;
@ -15,7 +19,7 @@
public class PacketStatusListener implements PacketStatusInListener {
private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled");
@@ -26,8 +35,96 @@
@@ -36,8 +48,96 @@
this.networkManager.close(PacketStatusListener.a);
} else {
this.d = true;

View file

@ -1,12 +1,23 @@
--- a/net/minecraft/server/PlayerConnection.java
+++ b/net/minecraft/server/PlayerConnection.java
@@ -24,6 +24,48 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -158,6 +158,59 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntityLiving;
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnPosition;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.entity.EntityInsentient;
+import net.minecraft.world.entity.animal.EntityFish;
+import net.minecraft.world.inventory.InventoryClickType;
+import net.minecraft.world.item.crafting.IRecipe;
+import net.minecraft.world.level.RayTrace;
+import net.minecraft.world.phys.MovingObjectPosition;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.entity.CraftPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -49,7 +60,7 @@
public class PlayerConnection implements PacketListenerPlayIn {
private static final Logger LOGGER = LogManager.getLogger();
@@ -34,7 +76,10 @@
@@ -168,7 +221,10 @@
private long lastKeepAlive;
private boolean awaitingKeepAlive;
private long h;
@ -61,7 +72,7 @@
private int j;
private final Int2ShortMap k = new Int2ShortOpenHashMap();
private double l;
@@ -72,8 +117,33 @@
@@ -206,8 +262,33 @@
itextfilter.a();
}
@ -95,7 +106,7 @@
public void tick() {
this.syncPosition();
this.player.lastX = this.player.locX();
@@ -121,7 +191,7 @@
@@ -255,7 +336,7 @@
this.minecraftServer.getMethodProfiler().enter("keepAlive");
long i = SystemUtils.getMonotonicMillis();
@ -104,7 +115,7 @@
if (this.awaitingKeepAlive) {
this.disconnect(new ChatMessage("disconnect.timeout"));
} else {
@@ -133,15 +203,21 @@
@@ -267,15 +348,21 @@
}
this.minecraftServer.getMethodProfiler().exit();
@ -126,7 +137,7 @@
this.disconnect(new ChatMessage("multiplayer.disconnect.idling"));
}
@@ -165,16 +241,46 @@
@@ -299,16 +386,46 @@
return this.minecraftServer.a(this.player.getProfile());
}
@ -174,7 +185,7 @@
}
private <T> void a(T t0, Consumer<T> consumer, BiFunction<ITextFilter, T, CompletableFuture<Optional<T>>> bifunction) {
@@ -190,7 +296,7 @@
@@ -324,7 +441,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
@ -183,7 +194,7 @@
optional.ifPresent(consumer1);
}, iasynctaskhandler);
} else {
@@ -247,7 +353,34 @@
@@ -381,7 +498,34 @@
double d9 = entity.getMot().g();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -219,7 +230,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8);
this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity));
return;
@@ -277,14 +410,72 @@
@@ -411,14 +555,72 @@
}
entity.setLocation(d3, d4, d5, f, f1);
@ -292,7 +303,7 @@
this.player.getWorldServer().getChunkProvider().movePlayer(this.player);
this.player.checkMovement(this.player.locX() - d0, this.player.locY() - d1, this.player.locZ() - d2);
this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && this.a(entity);
@@ -303,7 +494,7 @@
@@ -437,7 +639,7 @@
@Override
public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) {
PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer());
@ -301,7 +312,7 @@
this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
this.o = this.teleportPos.x;
this.p = this.teleportPos.y;
@@ -313,6 +504,7 @@
@@ -447,6 +649,7 @@
}
this.teleportPos = null;
@ -309,7 +320,7 @@
}
}
@@ -320,7 +512,7 @@
@@ -454,7 +657,7 @@
@Override
public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer());
@ -318,7 +329,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
optional.ifPresent(recipebookserver::e);
@@ -349,6 +541,12 @@
@@ -483,6 +686,12 @@
@Override
public void a(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer());
@ -331,7 +342,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.c());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -358,6 +556,7 @@
@@ -492,6 +701,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener());
this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -339,7 +350,7 @@
this.networkManager.sendPacket(new PacketPlayOutTabComplete(packetplayintabcomplete.b(), suggestions));
});
}
@@ -586,6 +785,7 @@
@@ -720,6 +930,7 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@ -347,7 +358,7 @@
containermerchant.d(i);
containermerchant.g(i);
@@ -595,6 +795,13 @@
@@ -729,6 +940,13 @@
@Override
public void a(PacketPlayInBEdit packetplayinbedit) {
@ -361,7 +372,7 @@
ItemStack itemstack = packetplayinbedit.b();
if (itemstack.getItem() == Items.WRITABLE_BOOK) {
@@ -610,13 +817,15 @@
@@ -744,13 +962,15 @@
NBTTagList nbttaglist = nbttagcompound.getList("pages", 8);
@ -380,7 +391,7 @@
if (PlayerInventory.d(i) || i == 40) {
this.a((List) list, flag ? (list1) -> {
this.a((String) list1.get(0), list1.subList(1, list1.size()), i);
@@ -635,7 +844,9 @@
@@ -769,7 +989,9 @@
NBTTagList nbttaglist = new NBTTagList();
list.stream().map(NBTTagString::a).forEach(nbttaglist::add);
@ -390,7 +401,7 @@
}
}
@@ -664,7 +875,7 @@
@@ -798,7 +1020,7 @@
}
itemstack1.a("pages", (NBTBase) nbttaglist);
@ -399,7 +410,7 @@
}
}
@@ -702,7 +913,7 @@
@@ -836,7 +1058,7 @@
} else {
WorldServer worldserver = this.player.getWorldServer();
@ -408,7 +419,7 @@
if (this.e == 0) {
this.syncPosition();
}
@@ -712,13 +923,21 @@
@@ -846,13 +1068,21 @@
this.A = this.e;
this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch);
}
@ -431,7 +442,7 @@
double d0 = this.player.locX();
double d1 = this.player.locY();
double d2 = this.player.locZ();
@@ -743,15 +962,33 @@
@@ -877,15 +1107,33 @@
++this.receivedMovePackets;
int i = this.receivedMovePackets - this.processedMovePackets;
@ -467,7 +478,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9);
this.a(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch);
return;
@@ -770,6 +1007,7 @@
@@ -904,6 +1152,7 @@
}
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@ -475,7 +486,7 @@
double d12 = d8;
d7 = d4 - this.player.locX();
@@ -791,10 +1029,74 @@
@@ -925,10 +1174,74 @@
if (!this.player.noclip && !this.player.isSleeping() && (flag1 && worldserver.getCubes(this.player, axisalignedbb) || this.a((IWorldReader) worldserver, axisalignedbb))) {
this.a(d0, d1, d2, f, f1);
} else {
@ -552,7 +563,7 @@
if (flag) {
this.player.fallDistance = 0.0F;
}
@@ -823,10 +1125,66 @@
@@ -957,10 +1270,66 @@
}
public void a(double d0, double d1, double d2, float f, float f1) {
@ -620,7 +631,7 @@
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ() : 0.0D;
@@ -838,6 +1196,14 @@
@@ -972,6 +1341,14 @@
this.teleportAwait = 0;
}
@ -635,7 +646,7 @@
this.A = this.e;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait));
@@ -846,6 +1212,7 @@
@@ -980,6 +1357,7 @@
@Override
public void a(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer());
@ -643,7 +654,7 @@
BlockPosition blockposition = packetplayinblockdig.b();
this.player.resetIdleTimer();
@@ -856,14 +1223,46 @@
@@ -990,14 +1368,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.b(EnumHand.OFF_HAND);
@ -692,7 +703,7 @@
this.player.dropItem(false);
}
@@ -900,6 +1299,7 @@
@@ -1034,6 +1444,7 @@
@Override
public void a(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer());
@ -700,7 +711,7 @@
WorldServer worldserver = this.player.getWorldServer();
EnumHand enumhand = packetplayinuseitem.b();
ItemStack itemstack = this.player.b(enumhand);
@@ -910,6 +1310,14 @@
@@ -1044,6 +1455,14 @@
this.player.resetIdleTimer();
if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) {
if (this.teleportPos == null && this.player.h((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) {
@ -715,7 +726,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
if (enumdirection == EnumDirection.UP && !enuminteractionresult.a() && blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && a(this.player, itemstack)) {
@@ -933,12 +1341,51 @@
@@ -1067,12 +1486,51 @@
@Override
public void a(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer());
@ -767,7 +778,7 @@
EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.b()) {
@@ -959,7 +1406,7 @@
@@ -1093,7 +1551,7 @@
Entity entity = packetplayinspectate.a(worldserver);
if (entity != null) {
@ -776,7 +787,7 @@
return;
}
}
@@ -968,7 +1415,12 @@
@@ -1102,7 +1560,12 @@
}
@Override
@ -790,7 +801,7 @@
@Override
public void a(PacketPlayInBoatMove packetplayinboatmove) {
@@ -983,11 +1435,26 @@
@@ -1117,11 +1580,26 @@
@Override
public void a(IChatBaseComponent ichatbasecomponent) {
@ -818,7 +829,7 @@
ITextFilter itextfilter = this.player.Q();
if (itextfilter != null) {
@@ -1019,6 +1486,15 @@
@@ -1153,6 +1631,15 @@
}
}
@ -834,7 +845,7 @@
try {
this.networkManager.sendPacket(packet, genericfuturelistener);
} catch (Throwable throwable) {
@@ -1035,7 +1511,16 @@
@@ -1169,7 +1656,16 @@
@Override
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer());
@ -851,7 +862,7 @@
if (this.player.inventory.itemInHandIndex != packetplayinhelditemslot.b() && this.player.getRaisedHand() == EnumHand.MAIN_HAND) {
this.player.clearActiveItem();
}
@@ -1044,65 +1529,286 @@
@@ -1178,65 +1674,286 @@
this.player.resetIdleTimer();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getDisplayName().getString());
@ -1147,7 +1158,7 @@
this.player.resetIdleTimer();
IJumpable ijumpable;
@@ -1160,6 +1866,7 @@
@@ -1294,6 +2011,7 @@
@Override
public void a(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer());
@ -1155,7 +1166,7 @@
WorldServer worldserver = this.player.getWorldServer();
Entity entity = packetplayinuseentity.a((World) worldserver);
@@ -1173,18 +1880,72 @@
@@ -1307,18 +2025,72 @@
ItemStack itemstack = enumhand != null ? this.player.b(enumhand).cloneItemStack() : ItemStack.b;
Optional<EnumInteractionResult> optional = Optional.empty();
@ -1188,7 +1199,7 @@
+
+ if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) {
+ // Refresh the current entity metadata
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true));
+ this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true));
+ }
+
+ if (event.isCancelled()) {
@ -1229,7 +1240,7 @@
}
if (optional.isPresent() && ((EnumInteractionResult) optional.get()).a()) {
@@ -1231,15 +1992,21 @@
@@ -1365,15 +2137,21 @@
@Override
public void a(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer());
@ -1253,7 +1264,7 @@
NonNullList<ItemStack> nonnulllist = NonNullList.a();
for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) {
@@ -1248,8 +2015,274 @@
@@ -1382,8 +2160,274 @@
this.player.a(this.player.activeContainer, nonnulllist);
} else {
@ -1529,7 +1540,7 @@
if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) {
this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true));
this.player.e = true;
@@ -1289,6 +2322,7 @@
@@ -1423,6 +2467,7 @@
@Override
public void a(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer());
@ -1537,7 +1548,7 @@
this.player.resetIdleTimer();
if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c());
@@ -1321,6 +2355,43 @@
@@ -1455,6 +2500,43 @@
boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1581,7 +1592,7 @@
if (flag1 && flag2) {
if (itemstack.isEmpty()) {
@@ -1342,6 +2413,7 @@
@@ -1476,6 +2558,7 @@
@Override
public void a(PacketPlayInTransaction packetplayintransaction) {
PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer());
@ -1589,7 +1600,7 @@
int i = this.player.activeContainer.windowId;
if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) {
@@ -1360,6 +2432,7 @@
@@ -1494,6 +2577,7 @@
}
private void a(PacketPlayInUpdateSign packetplayinupdatesign, List<String> list) {
@ -1597,7 +1608,7 @@
this.player.resetIdleTimer();
WorldServer worldserver = this.player.getWorldServer();
BlockPosition blockposition = packetplayinupdatesign.b();
@@ -1376,12 +2449,28 @@
@@ -1510,12 +2594,28 @@
if (!tileentitysign.d() || tileentitysign.f() != this.player) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString());
@ -1627,7 +1638,7 @@
tileentitysign.update();
worldserver.notify(blockposition, iblockdata, iblockdata, 3);
@@ -1391,6 +2480,7 @@
@@ -1525,6 +2625,7 @@
@Override
public void a(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -1635,7 +1646,7 @@
if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) {
int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive);
@@ -1405,7 +2495,17 @@
@@ -1539,7 +2640,17 @@
@Override
public void a(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer());
@ -1654,7 +1665,7 @@
}
@Override
@@ -1414,8 +2514,50 @@
@@ -1548,8 +2659,50 @@
this.player.a(packetplayinsettings);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ServerConnection.java
+++ b/net/minecraft/server/ServerConnection.java
@@ -74,14 +74,24 @@
--- a/net/minecraft/server/network/ServerConnection.java
+++ b/net/minecraft/server/network/ServerConnection.java
@@ -87,14 +87,24 @@
int j = ServerConnection.this.e.k();
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/ExpirableListEntry.java
+++ b/net/minecraft/server/ExpirableListEntry.java
@@ -23,7 +23,7 @@
--- a/net/minecraft/server/players/ExpirableListEntry.java
+++ b/net/minecraft/server/players/ExpirableListEntry.java
@@ -24,7 +24,7 @@
}
protected ExpirableListEntry(T t0, JsonObject jsonobject) {
@ -9,7 +9,7 @@
Date date;
@@ -74,4 +74,26 @@
@@ -75,4 +75,26 @@
jsonobject.addProperty("expires", this.d == null ? "forever" : ExpirableListEntry.a.format(this.d));
jsonobject.addProperty("reason", this.e);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/JsonList.java
+++ b/net/minecraft/server/JsonList.java
@@ -50,7 +50,7 @@
--- a/net/minecraft/server/players/JsonList.java
+++ b/net/minecraft/server/players/JsonList.java
@@ -52,7 +52,7 @@
@Nullable
public V get(K k0) {
this.g();
@ -9,7 +9,7 @@
}
public void remove(K k0) {
@@ -72,6 +72,12 @@
@@ -74,6 +74,12 @@
return (String[]) this.d.keySet().toArray(new String[this.d.size()]);
}
@ -22,7 +22,7 @@
public boolean isEmpty() {
return this.d.size() < 1;
}
@@ -89,7 +95,7 @@
@@ -91,7 +97,7 @@
Iterator iterator = this.d.values().iterator();
while (iterator.hasNext()) {
@ -31,7 +31,7 @@
if (v0.hasExpired()) {
list.add(v0.getKey());
@@ -99,7 +105,7 @@
@@ -101,7 +107,7 @@
iterator = list.iterator();
while (iterator.hasNext()) {
@ -40,7 +40,7 @@
this.d.remove(this.a(k0));
}
@@ -119,7 +125,7 @@
@@ -121,7 +127,7 @@
JsonObject jsonobject = new JsonObject();
jsonlistentry.getClass();
@ -49,7 +49,7 @@
}).forEach(jsonarray::add);
BufferedWriter bufferedwriter = Files.newWriter(this.c, StandardCharsets.UTF_8);
Throwable throwable = null;
@@ -163,7 +169,7 @@
@@ -165,7 +171,7 @@
JsonListEntry<K> jsonlistentry = this.a(jsonobject);
if (jsonlistentry.getKey() != null) {

View file

@ -1,6 +1,18 @@
--- a/net/minecraft/server/NameReferencingFileConverter.java
+++ b/net/minecraft/server/NameReferencingFileConverter.java
@@ -80,7 +80,7 @@
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -27,6 +27,11 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
+import net.minecraft.nbt.NBTTagCompound;
+// CraftBukkit end
+
public class NameReferencingFileConverter {
private static final Logger LOGGER = LogManager.getLogger();
@@ -85,7 +90,7 @@
try {
gameprofilebanlist.load();
} catch (IOException ioexception) {
@ -9,7 +21,7 @@
}
}
@@ -138,7 +138,7 @@
@@ -143,7 +148,7 @@
try {
ipbanlist.load();
} catch (IOException ioexception) {
@ -18,7 +30,7 @@
}
}
@@ -179,7 +179,7 @@
@@ -184,7 +189,7 @@
try {
oplist.load();
} catch (IOException ioexception) {
@ -27,7 +39,7 @@
}
}
@@ -223,7 +223,7 @@
@@ -228,7 +233,7 @@
try {
whitelist.load();
} catch (IOException ioexception) {
@ -36,7 +48,7 @@
}
}
@@ -346,6 +346,30 @@
@@ -351,6 +356,30 @@
File file5 = new File(file, s2 + ".dat");
File file6 = new File(file4, s3 + ".dat");

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/PlayerList.java
+++ b/net/minecraft/server/PlayerList.java
@@ -21,6 +21,23 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -90,6 +90,27 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -8,6 +8,10 @@
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.network.LoginListener;
+
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.CraftWorld;
+
@ -24,7 +28,7 @@
public abstract class PlayerList {
public static final File b = new File("banned-players.json");
@@ -30,14 +47,16 @@
@@ -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");
private final MinecraftServer server;
@ -44,7 +48,7 @@
public final WorldNBTStorage playerFileData;
private boolean hasWhitelist;
private final IRegistryCustom.Dimension s;
@@ -47,13 +66,23 @@
@@ -116,13 +139,23 @@
private boolean v;
private int w;
@ -70,7 +74,7 @@
this.server = minecraftserver;
this.s = iregistrycustom_dimension;
this.maxPlayers = i;
@@ -69,6 +98,12 @@
@@ -138,6 +171,12 @@
usercache.a(gameprofile);
NBTTagCompound nbttagcompound = this.a(entityplayer);
ResourceKey resourcekey;
@ -83,7 +87,7 @@
if (nbttagcompound != null) {
DataResult dataresult = DimensionManager.a(new Dynamic(DynamicOpsNBT.a, nbttagcompound.get("Dimension")));
@@ -99,7 +134,8 @@
@@ -168,7 +207,8 @@
s1 = networkmanager.getSocketAddress().toString();
}
@ -93,7 +97,7 @@
WorldData worlddata = worldserver1.getWorldData();
this.a(entityplayer, (EntityPlayer) null, worldserver1);
@@ -109,6 +145,7 @@
@@ -178,6 +218,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO);
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()));
@ -101,7 +105,7 @@
playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName())));
playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.sendPacket(new PacketPlayOutAbilities(entityplayer.abilities));
@@ -127,19 +164,61 @@
@@ -196,19 +237,61 @@
} else {
chatmessage = new ChatMessage("multiplayer.player.joined.renamed", new Object[]{entityplayer.getScoreboardDisplayName(), s});
}
@ -153,7 +157,7 @@
+ entityplayer.sentListPacket = true;
+ // CraftBukkit end
+
+ entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
+ entityplayer.playerConnection.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)) {
@ -168,7 +172,7 @@
this.a(entityplayer, worldserver1);
if (!this.server.getResourcePack().isEmpty()) {
entityplayer.setResourcePack(this.server.getResourcePack(), this.server.getResourcePackHash());
@@ -155,8 +234,11 @@
@@ -224,8 +307,11 @@
if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@ -182,7 +186,7 @@
});
if (entity != null) {
@@ -199,6 +281,8 @@
@@ -268,6 +354,8 @@
}
entityplayer.syncInventory();
@ -191,7 +195,7 @@
}
public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
@@ -231,30 +315,31 @@
@@ -300,30 +388,31 @@
}
public void setPlayerFileData(WorldServer worldserver) {
@ -228,7 +232,7 @@
}
@Override
@@ -282,14 +367,15 @@
@@ -351,14 +440,15 @@
}
protected void savePlayerFile(EntityPlayer entityplayer) {
@ -246,7 +250,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.b();
@@ -297,10 +383,24 @@
@@ -366,10 +456,24 @@
}
@ -272,7 +276,7 @@
this.savePlayerFile(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -332,18 +432,66 @@
@@ -401,18 +505,66 @@
if (entityplayer1 == entityplayer) {
this.j.remove(uuid);
@ -345,7 +349,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile);
chatmessage = new ChatMessage("multiplayer.disconnect.banned.reason", new Object[]{gameprofilebanentry.getReason()});
@@ -351,10 +499,12 @@
@@ -420,10 +572,12 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned.expiration", new Object[]{PlayerList.g.format(gameprofilebanentry.getExpires())}));
}
@ -361,7 +365,7 @@
IpBanEntry ipbanentry = this.l.get(socketaddress);
chatmessage = new ChatMessage("multiplayer.disconnect.banned_ip.reason", new Object[]{ipbanentry.getReason()});
@@ -362,13 +512,25 @@
@@ -431,13 +585,25 @@
chatmessage.addSibling(new ChatMessage("multiplayer.disconnect.banned_ip.expiration", new Object[]{PlayerList.g.format(ipbanentry.getExpires())}));
}
@ -390,7 +394,7 @@
UUID uuid = EntityHuman.a(gameprofile);
List<EntityPlayer> list = Lists.newArrayList();
@@ -404,14 +566,24 @@
@@ -473,14 +639,24 @@
}
return new EntityPlayer(this.server, worldserver, gameprofile, (PlayerInteractManager) object);
@ -415,7 +419,7 @@
WorldServer worldserver = this.server.getWorldServer(entityplayer.getSpawnDimension());
Optional optional;
@@ -431,6 +603,11 @@
@@ -500,6 +676,11 @@
}
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getProfile(), (PlayerInteractManager) object);
@ -427,7 +431,7 @@
entityplayer1.playerConnection = entityplayer.playerConnection;
entityplayer1.copyFrom(entityplayer, flag);
@@ -444,52 +621,113 @@
@@ -513,52 +694,113 @@
entityplayer1.addScoreboardTag(s);
}
@ -566,7 +570,7 @@
return entityplayer1;
}
@@ -502,7 +740,18 @@
@@ -571,7 +813,18 @@
public void tick() {
if (++this.w > 600) {
@ -586,7 +590,7 @@
this.w = 0;
}
@@ -515,6 +764,25 @@
@@ -584,6 +837,25 @@
}
@ -612,7 +616,7 @@
public void a(Packet<?> packet, ResourceKey<World> resourcekey) {
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@@ -615,6 +883,7 @@
@@ -684,6 +956,7 @@
entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0));
}
@ -620,7 +624,7 @@
this.server.getCommandDispatcher().a(entityplayer);
}
@@ -647,6 +916,12 @@
@@ -716,6 +989,12 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -633,7 +637,7 @@
if (entityplayer != entityhuman && entityplayer.world.getDimensionKey() == resourcekey) {
double d4 = d0 - entityplayer.locX();
double d5 = d1 - entityplayer.locY();
@@ -686,23 +961,34 @@
@@ -755,23 +1034,34 @@
public void reloadWhitelist() {}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
@ -673,7 +677,7 @@
}
public int getPlayerCount() {
@@ -755,31 +1041,54 @@
@@ -824,31 +1114,54 @@
entityplayer.playerInteractManager.a(this.u, EnumGamemode.NOT_SET);
}
@ -736,7 +740,7 @@
if (file2.exists() && file2.isFile()) {
file2.renameTo(file1);
@@ -787,7 +1096,7 @@
@@ -856,7 +1169,7 @@
}
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -745,7 +749,7 @@
}
return serverstatisticmanager;
@@ -795,14 +1104,14 @@
@@ -864,14 +1177,14 @@
public AdvancementDataPlayer f(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUniqueID();
@ -762,7 +766,7 @@
}
advancementdataplayer.a(entityplayer);
@@ -838,13 +1147,20 @@
@@ -907,13 +1220,20 @@
}
public void reload() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/RemoteControlCommandListener.java
+++ b/net/minecraft/server/RemoteControlCommandListener.java
@@ -26,6 +26,17 @@
--- 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);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/RecipeBookServer.java
+++ b/net/minecraft/server/RecipeBookServer.java
@@ -10,6 +10,8 @@
--- a/net/minecraft/stats/RecipeBookServer.java
+++ b/net/minecraft/stats/RecipeBookServer.java
@@ -20,6 +20,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -9,7 +9,7 @@
public class RecipeBookServer extends RecipeBook {
private static final Logger LOGGER = LogManager.getLogger();
@@ -25,7 +27,7 @@
@@ -35,7 +37,7 @@
IRecipe<?> irecipe = (IRecipe) iterator.next();
MinecraftKey minecraftkey = irecipe.getKey();
@ -18,7 +18,7 @@
this.a(minecraftkey);
this.d(minecraftkey);
list.add(minecraftkey);
@@ -59,6 +61,7 @@
@@ -69,6 +71,7 @@
}
private void a(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/StatisticManager.java
+++ b/net/minecraft/server/StatisticManager.java
@@ -15,6 +15,12 @@
--- a/net/minecraft/stats/StatisticManager.java
+++ b/net/minecraft/stats/StatisticManager.java
@@ -16,6 +16,12 @@
public void b(EntityHuman entityhuman, Statistic<?> statistic, int i) {
int j = (int) Math.min((long) this.getStatisticValue(statistic) + (long) i, 2147483647L);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataConverterRegistry.java
+++ b/net/minecraft/server/DataConverterRegistry.java
@@ -183,6 +183,18 @@
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
@@ -367,6 +367,18 @@
datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false));
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.b);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataConverterFlatten.java
+++ b/net/minecraft/server/DataConverterFlatten.java
@@ -375,7 +375,7 @@
--- a/net/minecraft/util/datafix/fixes/DataConverterFlatten.java
+++ b/net/minecraft/util/datafix/fixes/DataConverterFlatten.java
@@ -376,7 +376,7 @@
Typed<?> typed2 = typed.getOrCreateTyped(opticfinder1);
Dynamic<?> dynamic1 = (Dynamic) typed2.get(DSL.remainderFinder());

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DataConverterMap.java
+++ b/net/minecraft/server/DataConverterMap.java
@@ -31,7 +31,7 @@
--- a/net/minecraft/util/datafix/fixes/DataConverterMap.java
+++ b/net/minecraft/util/datafix/fixes/DataConverterMap.java
@@ -32,7 +32,7 @@
Typed<?> typed1 = typed.getOrCreateTyped(opticfinder1);
Dynamic<?> dynamic1 = (Dynamic) typed1.get(DSL.remainderFinder());

View file

@ -1,6 +1,14 @@
--- a/net/minecraft/server/WorldUpgrader.java
+++ b/net/minecraft/server/WorldUpgrader.java
@@ -25,7 +25,7 @@
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
@@ -34,11 +34,15 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.world.level.dimension.DimensionManager;
+// CraftBukkit end
+
public class WorldUpgrader {
private static final Logger LOGGER = LogManager.getLogger();
private static final ThreadFactory b = (new ThreadFactoryBuilder()).setDaemon(true).build();
@ -9,7 +17,7 @@
private final boolean d;
private final Convertable.ConversionSession e;
private final Thread f;
@@ -36,12 +36,12 @@
@@ -49,12 +53,12 @@
private volatile int k;
private volatile int l;
private volatile int m;
@ -24,7 +32,7 @@
this.c = immutableset;
this.d = flag;
this.g = datafixer;
@@ -69,12 +69,12 @@
@@ -82,12 +86,12 @@
private void i() {
this.k = 0;
@ -39,7 +47,7 @@
list = this.b(resourcekey);
builder.put(resourcekey, list.listIterator());
@@ -84,18 +84,18 @@
@@ -97,18 +101,18 @@
this.i = true;
} else {
float f = (float) this.k;
@ -63,7 +71,7 @@
long i = SystemUtils.getMonotonicMillis();
this.o = new ChatMessage("optimizeWorld.stage.upgrading");
@@ -107,7 +107,7 @@
@@ -120,7 +124,7 @@
float f2;
for (UnmodifiableIterator unmodifiableiterator2 = this.c.iterator(); unmodifiableiterator2.hasNext(); f1 += f2) {
@ -72,7 +80,7 @@
ListIterator<ChunkCoordIntPair> listiterator = (ListIterator) immutablemap.get(resourcekey2);
IChunkLoader ichunkloader = (IChunkLoader) immutablemap1.get(resourcekey2);
@@ -122,7 +122,7 @@
@@ -135,7 +139,7 @@
int j = IChunkLoader.a(nbttagcompound);
NBTTagCompound nbttagcompound1 = ichunkloader.getChunkData(resourcekey2, () -> {
return this.q;
@ -81,7 +89,7 @@
NBTTagCompound nbttagcompound2 = nbttagcompound1.getCompound("Level");
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound2.getInt("xPos"), nbttagcompound2.getInt("zPos"));
@@ -195,8 +195,8 @@
@@ -208,8 +212,8 @@
}
}

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/ChestLock.java
+++ b/net/minecraft/server/ChestLock.java
@@ -2,6 +2,11 @@
import javax.annotation.concurrent.Immutable;
--- a/net/minecraft/world/ChestLock.java
+++ b/net/minecraft/world/ChestLock.java
@@ -4,6 +4,11 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import org.bukkit.ChatColor;
@ -12,7 +12,7 @@
@Immutable
public class ChestLock {
@@ -13,7 +18,19 @@
@@ -15,7 +20,19 @@
}
public boolean a(ItemStack itemstack) {

View file

@ -1,15 +1,18 @@
--- a/net/minecraft/server/IInventory.java
+++ b/net/minecraft/server/IInventory.java
@@ -2,6 +2,8 @@
--- a/net/minecraft/world/IInventory.java
+++ b/net/minecraft/world/IInventory.java
@@ -5,6 +5,11 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import java.util.Set;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity; // CraftBukkit
+// CraftBukkit start
+import net.minecraft.world.item.crafting.IRecipe;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+// CraftBukkit end
+
public interface IInventory extends Clearable {
int getSize();
@@ -16,9 +18,7 @@
@@ -19,9 +24,7 @@
void setItem(int i, ItemStack itemstack);
@ -20,7 +23,7 @@
void update();
@@ -57,4 +57,29 @@
@@ -60,4 +63,29 @@
return false;
}

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/InventoryLargeChest.java
+++ b/net/minecraft/server/InventoryLargeChest.java
@@ -1,10 +1,61 @@
package net.minecraft.server;
--- a/net/minecraft/world/InventoryLargeChest.java
+++ b/net/minecraft/world/InventoryLargeChest.java
@@ -3,11 +3,62 @@
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import java.util.ArrayList;
@ -62,7 +63,7 @@
public InventoryLargeChest(IInventory iinventory, IInventory iinventory1) {
if (iinventory == null) {
iinventory = iinventory1;
@@ -59,7 +110,7 @@
@@ -62,7 +113,7 @@
@Override
public int getMaxStackSize() {

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/InventorySubcontainer.java
+++ b/net/minecraft/server/InventorySubcontainer.java
@@ -5,13 +5,64 @@
import java.util.List;
import java.util.stream.Collectors;
--- a/net/minecraft/world/InventorySubcontainer.java
+++ b/net/minecraft/world/InventorySubcontainer.java
@@ -13,13 +13,64 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
+// CraftBukkit start
+import org.bukkit.Location;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/DamageSource.java
+++ b/net/minecraft/server/DamageSource.java
@@ -35,6 +35,18 @@
--- 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;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -32,4 +32,10 @@
--- a/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
+++ b/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
@@ -37,4 +37,10 @@
return !itemstack.isEmpty() && itemstack.hasName() ? new ChatMessage(s1, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.C()}) : new ChatMessage(s, new Object[]{entityliving.getScoreboardDisplayName(), ichatbasecomponent});
}

View file

@ -1,10 +1,12 @@
--- a/net/minecraft/server/MobEffectList.java
+++ b/net/minecraft/server/MobEffectList.java
@@ -7,6 +7,11 @@
import java.util.UUID;
import javax.annotation.Nullable;
--- a/net/minecraft/world/effect/MobEffectList.java
+++ b/net/minecraft/world/effect/MobEffectList.java
@@ -19,6 +19,13 @@
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.player.EntityHuman;
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth;
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
+// CraftBukkit end
@ -12,7 +14,7 @@
public class MobEffectList {
private final Map<AttributeBase, AttributeModifier> a = Maps.newHashMap();
@@ -21,7 +26,7 @@
@@ -33,7 +40,7 @@
}
public static int getId(MobEffectList mobeffectlist) {
@ -21,7 +23,7 @@
}
protected MobEffectList(MobEffectInfo mobeffectinfo, int i) {
@@ -32,26 +37,37 @@
@@ -44,26 +51,37 @@
public void tick(EntityLiving entityliving, int i) {
if (this == MobEffects.REGENERATION) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
@ -64,7 +66,7 @@
}
}
@@ -72,7 +88,7 @@
@@ -84,7 +102,7 @@
}
} else {
j = (int) (d0 * (double) (4 << i) + 0.5D);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/MobEffects.java
+++ b/net/minecraft/server/MobEffects.java
@@ -57,6 +57,14 @@
--- a/net/minecraft/world/effect/MobEffects.java
+++ b/net/minecraft/world/effect/MobEffects.java
@@ -65,6 +65,14 @@
});
public static final MobEffectList HERO_OF_THE_VILLAGE = a(32, "hero_of_the_village", new MobEffectList(MobEffectInfo.BENEFICIAL, 4521796));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Entity.java
+++ b/net/minecraft/server/Entity.java
@@ -21,8 +21,58 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -106,8 +106,58 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -59,7 +59,7 @@
protected static final Logger LOGGER = LogManager.getLogger();
private static final AtomicInteger entityCount = new AtomicInteger();
private static final List<ItemStack> c = Collections.emptyList();
@@ -106,6 +156,21 @@
@@ -191,6 +241,21 @@
private long aB;
private EntitySize size;
private float headHeight;
@ -81,7 +81,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.entityCount.incrementAndGet();
@@ -212,6 +277,12 @@
@@ -297,6 +362,12 @@
}
public void setPose(EntityPose entitypose) {
@ -94,7 +94,7 @@
this.datawatcher.set(Entity.POSE, entitypose);
}
@@ -228,6 +299,33 @@
@@ -313,6 +384,33 @@
}
protected void setYawPitch(float f, float f1) {
@ -128,7 +128,7 @@
this.yaw = f % 360.0F;
this.pitch = f1 % 360.0F;
}
@@ -235,6 +333,7 @@
@@ -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));
@ -136,7 +136,7 @@
}
protected void af() {
@@ -249,6 +348,15 @@
@@ -334,6 +433,15 @@
this.entityBaseTick();
}
@ -152,7 +152,7 @@
public void entityBaseTick() {
this.world.getMethodProfiler().enter("entityBaseTick");
if (this.isPassenger() && this.getVehicle().dead) {
@@ -262,7 +370,7 @@
@@ -347,7 +455,7 @@
this.z = this.A;
this.lastPitch = this.pitch;
this.lastYaw = this.yaw;
@ -161,7 +161,7 @@
if (this.aO()) {
this.aP();
}
@@ -325,12 +433,44 @@
@@ -410,12 +518,44 @@
protected void burnFromLava() {
if (!this.isFireProof()) {
@ -207,7 +207,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -427,6 +567,28 @@
@@ -512,6 +652,28 @@
block.a((IBlockAccess) this.world, this);
}
@ -236,7 +236,7 @@
if (this.onGround && !this.bv()) {
block.stepOn(this.world, blockposition, this);
}
@@ -700,6 +862,7 @@
@@ -785,6 +947,7 @@
AxisAlignedBB axisalignedbb = this.getBoundingBox();
this.setPositionRaw((axisalignedbb.minX + axisalignedbb.maxX) / 2.0D, axisalignedbb.minY, (axisalignedbb.minZ + axisalignedbb.maxZ) / 2.0D);
@ -244,7 +244,7 @@
}
protected SoundEffect getSoundSwim() {
@@ -1025,6 +1188,13 @@
@@ -1110,6 +1273,13 @@
}
public void spawnIn(World world) {
@ -258,7 +258,7 @@
this.world = world;
}
@@ -1044,6 +1214,7 @@
@@ -1129,6 +1299,7 @@
this.lastY = d1;
this.lastZ = d4;
this.setPosition(d3, d1, d4);
@ -266,7 +266,7 @@
}
public void d(Vec3D vec3d) {
@@ -1218,6 +1389,12 @@
@@ -1303,6 +1474,12 @@
return false;
}
@ -279,7 +279,7 @@
public void a(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource);
@@ -1228,7 +1405,7 @@
@@ -1313,7 +1490,7 @@
public boolean a_(NBTTagCompound nbttagcompound) {
String s = this.getSaveID();
@ -288,7 +288,7 @@
nbttagcompound.setString("id", s);
this.save(nbttagcompound);
return true;
@@ -1252,6 +1429,18 @@
@@ -1337,6 +1514,18 @@
Vec3D vec3d = this.getMot();
nbttagcompound.set("Motion", this.a(vec3d.x, vec3d.y, vec3d.z));
@ -307,7 +307,7 @@
nbttagcompound.set("Rotation", this.a(this.yaw, this.pitch));
nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.setShort("Fire", (short) this.fireTicks);
@@ -1260,6 +1449,18 @@
@@ -1345,6 +1534,18 @@
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
nbttagcompound.a("UUID", this.getUniqueID());
@ -326,7 +326,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1317,6 +1518,11 @@
@@ -1402,6 +1603,11 @@
}
}
@ -338,7 +338,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
@@ -1394,6 +1600,49 @@
@@ -1479,6 +1685,49 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -388,7 +388,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded");
@@ -1469,9 +1718,22 @@
@@ -1554,9 +1803,22 @@
} else if (this.world.isClientSide) {
return null;
} else {
@ -411,7 +411,7 @@
this.world.addEntity(entityitem);
return entityitem;
}
@@ -1555,7 +1817,7 @@
@@ -1640,7 +1902,7 @@
this.setPose(EntityPose.STANDING);
this.vehicle = entity;
@ -420,7 +420,7 @@
return true;
}
}
@@ -1580,7 +1842,7 @@
@@ -1665,7 +1927,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -429,7 +429,7 @@
}
}
@@ -1589,10 +1851,31 @@
@@ -1674,10 +1936,31 @@
this.bf();
}
@ -462,7 +462,7 @@
if (!this.world.isClientSide && entity instanceof EntityHuman && !(this.getRidingPassenger() instanceof EntityHuman)) {
this.passengers.add(0, entity);
} else {
@@ -1600,15 +1883,36 @@
@@ -1685,15 +1968,36 @@
}
}
@ -500,7 +500,7 @@
}
protected boolean q(Entity entity) {
@@ -1646,14 +1950,20 @@
@@ -1731,14 +2035,20 @@
if (this.inPortal) {
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
@ -524,7 +524,7 @@
this.world.getMethodProfiler().exit();
}
@@ -1753,6 +2063,13 @@
@@ -1838,6 +2148,13 @@
}
public void setSwimming(boolean flag) {
@ -538,7 +538,7 @@
this.setFlag(4, flag);
}
@@ -1785,8 +2102,12 @@
@@ -1870,8 +2187,12 @@
return this.getScoreboardTeam() != null ? this.getScoreboardTeam().isAlly(scoreboardteambase) : false;
}
@ -552,7 +552,7 @@
}
public boolean getFlag(int i) {
@@ -1813,16 +2134,56 @@
@@ -1898,16 +2219,56 @@
}
public void setAirTicks(int i) {
@ -612,7 +612,7 @@
}
public void k(boolean flag) {
@@ -1972,15 +2333,32 @@
@@ -2057,15 +2418,32 @@
@Nullable
public Entity b(WorldServer worldserver) {
@ -647,7 +647,7 @@
this.world.getMethodProfiler().exitEnter("reloading");
Entity entity = this.getEntityType().a((World) worldserver);
@@ -1989,9 +2367,17 @@
@@ -2074,9 +2452,17 @@
entity.setPositionRotation(shapedetectorshape.position.x, shapedetectorshape.position.y, shapedetectorshape.position.z, shapedetectorshape.yaw, entity.pitch);
entity.setMot(shapedetectorshape.velocity);
worldserver.addEntityTeleport(entity);
@ -667,7 +667,7 @@
}
this.bN();
@@ -2012,13 +2398,18 @@
@@ -2097,13 +2483,18 @@
@Nullable
protected ShapeDetectorShape a(WorldServer worldserver) {
@ -690,7 +690,7 @@
return null;
} else {
WorldBorder worldborder = worldserver.getWorldBorder();
@@ -2028,8 +2419,16 @@
@@ -2113,8 +2504,16 @@
double d3 = Math.min(2.9999872E7D, worldborder.h() - 16.0D);
double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager());
BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3));
@ -708,7 +708,7 @@
IBlockData iblockdata = this.world.getType(this.ac);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2046,8 +2445,8 @@
@@ -2131,8 +2530,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@ -719,7 +719,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2057,8 +2456,15 @@
@@ -2142,8 +2541,15 @@
} else {
blockposition1 = worldserver.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSpawn());
}
@ -736,7 +736,7 @@
}
}
@@ -2066,8 +2472,23 @@
@@ -2151,8 +2557,23 @@
return BlockPortalShape.a(blockutil_rectangle, enumdirection_enumaxis, this.getPositionVector(), this.a(this.getPose()));
}
@ -762,7 +762,7 @@
}
public boolean canPortal() {
@@ -2253,7 +2674,26 @@
@@ -2338,7 +2759,26 @@
}
public void a(AxisAlignedBB axisalignedbb) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityAgeable.java
+++ b/net/minecraft/server/EntityAgeable.java
@@ -8,6 +8,7 @@
--- 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;
@ -8,7 +8,7 @@
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
super(entitytypes, world);
@@ -91,6 +92,7 @@
@@ -100,6 +101,7 @@
super.saveData(nbttagcompound);
nbttagcompound.setInt("Age", this.getAge());
nbttagcompound.setInt("ForcedAge", this.c);
@ -16,7 +16,7 @@
}
@Override
@@ -98,6 +100,7 @@
@@ -107,6 +109,7 @@
super.loadData(nbttagcompound);
this.setAgeRaw(nbttagcompound.getInt("Age"));
this.c = nbttagcompound.getInt("ForcedAge");
@ -24,7 +24,7 @@
}
@Override
@@ -112,7 +115,7 @@
@@ -121,7 +124,7 @@
@Override
public void movementTick() {
super.movementTick();

View file

@ -1,10 +1,11 @@
--- a/net/minecraft/server/EntityAreaEffectCloud.java
+++ b/net/minecraft/server/EntityAreaEffectCloud.java
@@ -14,6 +14,11 @@
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
@@ -33,6 +33,12 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
+import net.minecraft.resources.MinecraftKey;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
+// CraftBukkit end
@ -12,7 +13,7 @@
public class EntityAreaEffectCloud extends Entity {
private static final Logger LOGGER = LogManager.getLogger();
@@ -105,6 +110,22 @@
@@ -124,6 +130,22 @@
}
@ -35,7 +36,7 @@
public int getColor() {
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.COLOR);
}
@@ -249,6 +270,7 @@
@@ -268,6 +290,7 @@
if (!list1.isEmpty()) {
Iterator iterator2 = list1.iterator();
@ -43,7 +44,7 @@
while (iterator2.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator2.next();
@@ -258,6 +280,17 @@
@@ -277,6 +300,17 @@
double d2 = d0 * d0 + d1 * d1;
if (d2 <= (double) (f * f)) {
@ -61,7 +62,7 @@
this.affectedEntities.put(entityliving, this.ticksLived + this.reapplicationDelay);
Iterator iterator3 = list.iterator();
@@ -267,7 +300,7 @@
@@ -286,7 +320,7 @@
if (mobeffect1.getMobEffect().isInstant()) {
mobeffect1.getMobEffect().applyInstantEffect(this, this.getSource(), entityliving, mobeffect1.getAmplifier(), 0.5D);
} else {

View file

@ -1,7 +1,8 @@
--- a/net/minecraft/server/EntityCreature.java
+++ b/net/minecraft/server/EntityCreature.java
@@ -1,5 +1,9 @@
package net.minecraft.server;
--- a/net/minecraft/world/entity/EntityCreature.java
+++ b/net/minecraft/world/entity/EntityCreature.java
@@ -7,6 +7,10 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityUnleashEvent;
@ -10,7 +11,7 @@
public abstract class EntityCreature extends EntityInsentient {
protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) {
@@ -34,6 +38,7 @@
@@ -41,6 +45,7 @@
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
@ -18,7 +19,7 @@
this.unleash(true, true);
}
@@ -42,6 +47,7 @@
@@ -49,6 +54,7 @@
this.x(f);
if (f > 10.0F) {

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/EntityExperienceOrb.java
+++ b/net/minecraft/server/EntityExperienceOrb.java
@@ -2,6 +2,12 @@
import java.util.Map.Entry;
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
@@ -16,6 +16,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -13,7 +13,7 @@
public class EntityExperienceOrb extends Entity {
public int b;
@@ -36,6 +42,7 @@
@@ -50,6 +56,7 @@
@Override
public void tick() {
super.tick();
@ -21,7 +21,7 @@
if (this.d > 0) {
--this.d;
}
@@ -72,7 +79,22 @@
@@ -86,7 +93,22 @@
this.targetPlayer = null;
}
@ -45,7 +45,7 @@
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();
@@ -155,13 +177,19 @@
@@ -169,13 +191,19 @@
if (!itemstack.isEmpty() && itemstack.f()) {
int i = Math.min(this.c(this.value), itemstack.getDamage());
@ -68,7 +68,7 @@
}
this.die();
@@ -183,6 +211,24 @@
@@ -197,6 +225,24 @@
}
public static int getOrbValue(int i) {

View file

@ -1,10 +1,11 @@
--- a/net/minecraft/server/EntityInsentient.java
+++ b/net/minecraft/server/EntityInsentient.java
@@ -10,6 +10,18 @@
import java.util.UUID;
import javax.annotation.Nullable;
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -74,6 +74,19 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.level.storage.loot.LootTableInfo;
+// CraftBukkit start
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.event.entity.CreatureSpawnEvent;
@ -19,7 +20,7 @@
public abstract class EntityInsentient extends EntityLiving {
private static final DataWatcherObject<Byte> b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a);
@@ -28,7 +40,7 @@
@@ -92,7 +105,7 @@
public final float[] dropChanceHand;
private final NonNullList<ItemStack> bq;
public final float[] dropChanceArmor;
@ -28,7 +29,7 @@
public boolean persistent;
private final Map<PathType, Float> bt;
public MinecraftKey lootTableKey;
@@ -41,6 +53,8 @@
@@ -105,6 +118,8 @@
private BlockPosition bz;
private float bA;
@ -37,7 +38,7 @@
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
super(entitytypes, world);
this.bp = NonNullList.a(2, ItemStack.b);
@@ -64,6 +78,9 @@
@@ -128,6 +143,9 @@
this.initPathfinder();
}
@ -47,7 +48,7 @@
}
protected void initPathfinder() {}
@@ -144,7 +161,38 @@
@@ -208,7 +226,38 @@
}
public void setGoalTarget(@Nullable EntityLiving entityliving) {
@ -86,7 +87,7 @@
}
@Override
@@ -361,16 +409,26 @@
@@ -425,16 +474,26 @@
nbttagcompound.setBoolean("NoAI", this.isNoAI());
}
@ -115,7 +116,7 @@
NBTTagList nbttaglist;
int i;
@@ -417,6 +475,11 @@
@@ -481,6 +540,11 @@
}
this.setNoAI(nbttagcompound.getBoolean("NoAI"));
@ -127,7 +128,7 @@
}
@Override
@@ -424,6 +487,11 @@
@@ -488,6 +552,11 @@
super.a(damagesource, flag);
this.lootTableKey = null;
}
@ -139,7 +140,7 @@
@Override
protected LootTableInfo.Builder a(boolean flag, DamageSource damagesource) {
@@ -480,7 +548,7 @@
@@ -544,7 +613,7 @@
protected void b(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItemStack();
@ -148,7 +149,7 @@
this.a(entityitem);
this.receive(entityitem, itemstack.getCount());
entityitem.die();
@@ -489,15 +557,29 @@
@@ -553,15 +622,29 @@
}
public boolean g(ItemStack itemstack) {
@ -179,7 +180,7 @@
}
this.b(enumitemslot, itemstack);
@@ -610,18 +692,18 @@
@@ -674,18 +757,18 @@
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
if (entityhuman != null) {
@ -201,7 +202,7 @@
this.die();
} else if (d0 < (double) l) {
this.ticksFarFromPlayer = 0;
@@ -636,6 +718,7 @@
@@ -700,6 +783,7 @@
@Override
protected final void doTick() {
++this.ticksFarFromPlayer;
@ -209,7 +210,7 @@
this.world.getMethodProfiler().enter("sensing");
this.bo.a();
this.world.getMethodProfiler().exit();
@@ -1024,6 +1107,12 @@
@@ -1088,6 +1172,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@ -222,7 +223,7 @@
this.unleash(true, !entityhuman.abilities.canInstantlyBuild);
return EnumInteractionResult.a(this.world.isClientSide);
} else {
@@ -1042,6 +1131,12 @@
@@ -1106,6 +1196,12 @@
ItemStack itemstack = entityhuman.b(enumhand);
if (itemstack.getItem() == Items.LEAD && this.a(entityhuman)) {
@ -235,7 +236,7 @@
this.setLeashHolder(entityhuman, true);
itemstack.subtract(1);
return EnumInteractionResult.a(this.world.isClientSide);
@@ -1057,7 +1152,7 @@
@@ -1121,7 +1217,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.world instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@ -244,7 +245,7 @@
optional.ifPresent((entityinsentient) -> {
this.a(entityhuman, entityinsentient);
@@ -1103,12 +1198,19 @@
@@ -1167,12 +1263,19 @@
return this.bA != -1.0F;
}
@ -265,7 +266,7 @@
t0.u(this);
t0.setBaby(this.isBaby());
@@ -1140,7 +1242,12 @@
@@ -1204,7 +1307,12 @@
}
}
@ -279,7 +280,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1160,6 +1267,7 @@
@@ -1224,6 +1332,7 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -287,7 +288,7 @@
this.unleash(true, true);
}
@@ -1176,7 +1284,9 @@
@@ -1240,7 +1349,9 @@
this.leashHolder = null;
this.by = null;
if (!this.world.isClientSide && flag1) {
@ -297,7 +298,7 @@
}
if (!this.world.isClientSide && flag && this.world instanceof WorldServer) {
@@ -1226,6 +1336,7 @@
@@ -1290,6 +1401,7 @@
boolean flag1 = super.a(entity, flag);
if (flag1 && this.isLeashed()) {
@ -305,7 +306,7 @@
this.unleash(true, true);
}
@@ -1358,7 +1469,14 @@
@@ -1422,7 +1534,14 @@
int i = EnchantmentManager.getFireAspectEnchantmentLevel(this);
if (i > 0) {
@ -321,7 +322,7 @@
}
boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
@@ -1420,6 +1538,7 @@
@@ -1484,6 +1603,7 @@
@Override
protected void bN() {
super.bN();

View file

@ -1,15 +1,18 @@
--- a/net/minecraft/server/EntityLightning.java
+++ b/net/minecraft/server/EntityLightning.java
@@ -5,6 +5,8 @@
import java.util.List;
import javax.annotation.Nullable;
--- 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;
import net.minecraft.world.phys.AxisAlignedBB;
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+// CraftBukkit start
+import net.minecraft.network.protocol.game.PacketPlayOutNamedSoundEffect;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+// CraftBukkit end
+
public class EntityLightning extends Entity {
private int lifeTicks;
@@ -45,7 +47,24 @@
@@ -62,7 +67,24 @@
this.a(4);
}
@ -35,7 +38,7 @@
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);
}
@@ -61,7 +80,7 @@
@@ -78,7 +100,7 @@
}
}
@ -44,7 +47,7 @@
if (!(this.world instanceof WorldServer)) {
this.world.c(2);
} else if (!this.isEffect) {
@@ -89,7 +108,11 @@
@@ -106,7 +128,11 @@
IBlockData iblockdata = BlockFireAbstract.a((IBlockAccess) this.world, blockposition);
if (this.world.getType(blockposition).isAir() && iblockdata.canPlace(this.world, blockposition)) {
@ -57,7 +60,7 @@
}
for (int j = 0; j < i; ++j) {
@@ -97,7 +120,11 @@
@@ -114,7 +140,11 @@
iblockdata = BlockFireAbstract.a((IBlockAccess) this.world, blockposition1);
if (this.world.getType(blockposition1).isAir() && iblockdata.canPlace(this.world, blockposition1)) {

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/server/EntityLiving.java
+++ b/net/minecraft/server/EntityLiving.java
@@ -21,6 +21,27 @@
import javax.annotation.Nullable;
--- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java
@@ -111,6 +111,30 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.apache.logging.log4j.Logger;
+// CraftBukkit start
@ -9,6 +9,9 @@
+import java.util.HashSet;
+import java.util.Set;
+import com.google.common.base.Function;
+import net.minecraft.nbt.NBTTagFloat;
+import net.minecraft.nbt.NBTTagInt;
+import net.minecraft.world.entity.animal.EntityAnimal;
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.attribute.CraftAttributeMap;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -28,15 +31,15 @@
public abstract class EntityLiving extends Entity {
private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
@@ -106,6 +127,21 @@
@@ -196,6 +220,21 @@
private float bB;
private float bC;
protected BehaviorController<?> bg;
+ // CraftBukkit start
+ public int expToDrop;
+ public int maxAirTicks = 300;
+ boolean forceDrops;
+ ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
+ public boolean forceDrops;
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
+ public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
+ public boolean collides = true;
+ public Set<UUID> collidableExemptions = new HashSet<>();
@ -50,7 +53,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world);
@@ -117,7 +153,9 @@
@@ -207,7 +246,9 @@
this.activeItem = ItemStack.b;
this.by = Optional.empty();
this.attributeMap = new AttributeMapBase(AttributeDefaults.a(entitytypes));
@ -61,7 +64,7 @@
this.i = true;
this.az = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.af();
@@ -184,7 +222,13 @@
@@ -274,7 +315,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1);
@ -76,7 +79,7 @@
}
}
@@ -406,7 +450,7 @@
@@ -496,7 +543,7 @@
protected void cU() {
++this.deathTicks;
@ -85,7 +88,7 @@
this.die();
for (int i = 0; i < 20; ++i) {
@@ -497,7 +541,13 @@
@@ -587,7 +634,13 @@
}
protected void playEquipSound(ItemStack itemstack) {
@ -100,7 +103,7 @@
SoundEffect soundeffect = SoundEffects.ITEM_ARMOR_EQUIP_GENERIC;
Item item = itemstack.getItem();
@@ -567,6 +617,17 @@
@@ -657,6 +710,17 @@
}
}
@ -118,7 +121,7 @@
if (nbttagcompound.hasKeyOfType("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -604,9 +665,32 @@
@@ -694,9 +758,32 @@
}
@ -151,7 +154,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -616,6 +700,12 @@
@@ -706,6 +793,12 @@
this.a(mobeffect, true);
})) {
if (!this.world.isClientSide) {
@ -164,7 +167,7 @@
iterator.remove();
this.b(mobeffect);
}
@@ -626,6 +716,17 @@
@@ -716,6 +809,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@ -182,7 +185,7 @@
if (this.updateEffects) {
if (!this.world.isClientSide) {
@@ -735,7 +836,13 @@
@@ -825,7 +929,13 @@
this.datawatcher.set(EntityLiving.f, 0);
}
@ -196,7 +199,7 @@
if (this.world.isClientSide) {
return false;
} else {
@@ -744,7 +851,14 @@
@@ -834,7 +944,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@ -212,7 +215,7 @@
iterator.remove();
}
@@ -769,18 +883,44 @@
@@ -859,18 +976,44 @@
return (MobEffect) this.effects.get(mobeffectlist);
}
@ -258,7 +261,7 @@
return true;
} else {
return false;
@@ -804,13 +944,39 @@
@@ -894,13 +1037,39 @@
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@ -299,7 +302,7 @@
if (mobeffect != null) {
this.b(mobeffect);
@@ -847,20 +1013,55 @@
@@ -937,20 +1106,55 @@
}
@ -356,7 +359,7 @@
this.datawatcher.set(EntityLiving.HEALTH, MathHelper.a(f, 0.0F, this.getMaxHealth()));
}
@@ -874,7 +1075,7 @@
@@ -964,7 +1168,7 @@
return false;
} else if (this.world.isClientSide) {
return false;
@ -365,7 +368,7 @@
return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -886,17 +1087,19 @@
@@ -976,17 +1180,19 @@
this.ticksFarFromPlayer = 0;
float f1 = f;
@ -388,7 +391,7 @@
this.damageShield(f);
f2 = f;
f = 0.0F;
@@ -914,22 +1117,41 @@
@@ -1004,22 +1210,41 @@
this.av = 1.5F;
boolean flag1 = true;
@ -434,7 +437,7 @@
this.ap = 0.0F;
Entity entity1 = damagesource.getEntity();
@@ -1050,19 +1272,29 @@
@@ -1140,19 +1365,29 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@ -468,7 +471,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.b(StatisticList.ITEM_USED.b(Items.TOTEM_OF_UNDYING));
@@ -1070,14 +1302,16 @@
@@ -1160,14 +1395,16 @@
}
this.setHealth(1.0F);
@ -490,7 +493,7 @@
}
}
@@ -1175,6 +1409,13 @@
@@ -1265,6 +1502,13 @@
if (!flag) {
EntityItem entityitem = new EntityItem(this.world, this.locX(), this.locY(), this.locZ(), new ItemStack(Items.bt));
@ -504,7 +507,7 @@
this.world.addEntity(entityitem);
}
}
@@ -1194,28 +1435,46 @@
@@ -1284,28 +1528,46 @@
boolean flag = this.lastDamageByPlayerTime > 0;
@ -553,7 +556,7 @@
}
@@ -1336,9 +1595,14 @@
@@ -1426,9 +1688,14 @@
int i = this.e(f, f1);
if (i > 0) {
@ -569,7 +572,7 @@
return true;
} else {
return flag;
@@ -1378,7 +1642,7 @@
@@ -1468,7 +1735,7 @@
protected float applyArmorModifier(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
@ -578,7 +581,7 @@
f = CombatMath.a(f, (float) this.getArmorStrength(), (float) this.b(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1391,7 +1655,8 @@
@@ -1481,7 +1748,8 @@
} else {
int i;
@ -588,7 +591,7 @@
i = (this.getEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1422,28 +1687,173 @@
@@ -1512,28 +1780,173 @@
}
}
@ -772,7 +775,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1464,9 +1874,19 @@
@@ -1554,9 +1967,19 @@
}
public final void setArrowCount(int i) {
@ -793,7 +796,7 @@
public final int dz() {
return (Integer) this.datawatcher.get(EntityLiving.bi);
}
@@ -1594,6 +2014,12 @@
@@ -1684,6 +2107,12 @@
public abstract ItemStack getEquipment(EnumItemSlot enumitemslot);
@ -806,7 +809,7 @@
@Override
public abstract void setSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -1816,6 +2242,7 @@
@@ -1906,6 +2335,7 @@
}
if (this.onGround && !this.world.isClientSide) {
@ -814,25 +817,25 @@
this.setFlag(7, false);
}
} else {
@@ -1957,7 +2384,7 @@
@@ -2047,7 +2477,7 @@
}
}
- this.p();
- this.updateEquipment();
+ this.updateEquipment(); // PAIL rename
if (this.ticksLived % 20 == 0) {
this.getCombatTracker().g();
}
@@ -2058,7 +2485,7 @@
@@ -2148,7 +2578,7 @@
}
- private void p() {
- public void updateEquipment() {
+ public void updateEquipment() { // PAIL private->public; updateEquipment
Map<EnumItemSlot, ItemStack> map = this.q();
if (map != null) {
@@ -2321,6 +2748,7 @@
@@ -2411,6 +2841,7 @@
}
if (!this.world.isClientSide) {
@ -840,7 +843,7 @@
this.setFlag(7, flag);
}
@@ -2441,6 +2869,7 @@
@@ -2531,6 +2962,7 @@
}
public boolean hasLineOfSight(Entity entity) {
@ -848,7 +851,7 @@
Vec3D vec3d = new Vec3D(this.locX(), this.getHeadY(), this.locZ());
Vec3D vec3d1 = new Vec3D(entity.locX(), entity.getHeadY(), entity.locZ());
@@ -2458,14 +2887,21 @@
@@ -2548,14 +2980,21 @@
@Override
public boolean isInteractable() {
@ -872,7 +875,7 @@
@Override
protected void velocityChanged() {
this.velocityChanged = this.random.nextDouble() >= this.b(GenericAttributes.KNOCKBACK_RESISTANCE);
@@ -2658,7 +3094,25 @@
@@ -2748,7 +3187,25 @@
} else {
if (!this.activeItem.isEmpty() && this.isHandRaised()) {
this.b(this.activeItem, 16);
@ -899,7 +902,7 @@
if (itemstack != this.activeItem) {
this.a(enumhand, itemstack);
@@ -2750,10 +3204,18 @@
@@ -2840,10 +3297,18 @@
}
if (flag2) {
@ -921,7 +924,7 @@
}
}
@@ -2850,7 +3312,7 @@
@@ -2940,7 +3405,7 @@
}
public void entityWakeup() {
@ -930,7 +933,7 @@
World world = this.world;
this.world.getClass();
@@ -2921,7 +3383,7 @@
@@ -3011,7 +3476,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/EntityTypes.java
+++ b/net/minecraft/server/EntityTypes.java
@@ -12,7 +12,7 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -142,7 +142,7 @@
public class EntityTypes<T extends Entity> {
private static final Logger LOGGER = LogManager.getLogger();
@ -9,7 +9,7 @@
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));
@@ -137,7 +137,7 @@
@@ -267,7 +267,7 @@
private MinecraftKey bq;
private final EntitySize br;
@ -18,7 +18,7 @@
return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_builder.a(s));
}
@@ -169,10 +169,18 @@
@@ -299,10 +299,18 @@
@Nullable
public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@ -38,7 +38,7 @@
}
return t0;
@@ -208,7 +216,7 @@
@@ -338,7 +346,7 @@
t0.setCustomName(ichatbasecomponent);
}
@ -47,7 +47,7 @@
return t0;
}
}
@@ -351,7 +359,7 @@
@@ -481,7 +489,7 @@
}
return entity;
@ -56,7 +56,7 @@
}
private static Optional<Entity> b(NBTTagCompound nbttagcompound, World world) {
@@ -403,7 +411,7 @@
@@ -533,7 +541,7 @@
this.g = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/IEntityAngerable.java
+++ b/net/minecraft/server/IEntityAngerable.java
@@ -98,7 +98,7 @@
--- a/net/minecraft/world/entity/IEntityAngerable.java
+++ b/net/minecraft/world/entity/IEntityAngerable.java
@@ -103,7 +103,7 @@
default void pacify() {
this.setLastDamager((EntityLiving) null);
this.setAngerTarget((UUID) null);
@ -9,7 +9,7 @@
this.setAnger(0);
}
@@ -108,6 +108,8 @@
@@ -113,6 +113,8 @@
void setGoalTarget(@Nullable EntityLiving entityliving);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/IEntitySelector.java
+++ b/net/minecraft/server/IEntitySelector.java
@@ -37,7 +37,7 @@
--- a/net/minecraft/world/entity/IEntitySelector.java
+++ b/net/minecraft/world/entity/IEntitySelector.java
@@ -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) -> {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/SaddleStorage.java
+++ b/net/minecraft/server/SaddleStorage.java
@@ -35,6 +35,15 @@
--- a/net/minecraft/world/entity/SaddleStorage.java
+++ b/net/minecraft/world/entity/SaddleStorage.java
@@ -38,6 +38,15 @@
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/AttributeRanged.java
+++ b/net/minecraft/server/AttributeRanged.java
@@ -20,6 +20,8 @@
--- a/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
+++ b/net/minecraft/world/entity/ai/attributes/AttributeRanged.java
@@ -22,6 +22,8 @@
@Override
public double a(double d0) {

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BehaviorAttackTargetForget.java
+++ b/net/minecraft/server/BehaviorAttackTargetForget.java
@@ -4,6 +4,12 @@
import java.util.Optional;
import java.util.function.Predicate;
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
@@ -10,6 +10,12 @@
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.ai.memory.MemoryStatus;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
@ -13,7 +13,7 @@
public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
private final Predicate<EntityLiving> b;
@@ -54,6 +60,17 @@
@@ -60,6 +66,17 @@
}
private void d(E e0) {

View file

@ -1,10 +1,11 @@
--- a/net/minecraft/server/BehaviorAttackTargetSet.java
+++ b/net/minecraft/server/BehaviorAttackTargetSet.java
@@ -5,6 +5,12 @@
import java.util.function.Function;
import java.util.function.Predicate;
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
@@ -10,6 +10,13 @@
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.ai.memory.MemoryStatus;
+// CraftBukkit start
+import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityTargetEvent;
@ -13,7 +14,7 @@
public class BehaviorAttackTargetSet<E extends EntityInsentient> extends Behavior<E> {
private final Predicate<E> b;
@@ -33,13 +39,21 @@
@@ -38,13 +45,21 @@
}
protected void a(WorldServer worldserver, E e0, long i) {

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/server/BehaviorCareer.java
+++ b/net/minecraft/server/BehaviorCareer.java
@@ -3,6 +3,12 @@
import com.google.common.collect.ImmutableMap;
import java.util.Optional;
--- a/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
@@ -13,6 +13,12 @@
import net.minecraft.world.entity.npc.EntityVillager;
import net.minecraft.world.entity.npc.VillagerProfession;
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftVillager;
@ -13,7 +13,7 @@
public class BehaviorCareer extends Behavior<EntityVillager> {
public BehaviorCareer() {
@@ -19,7 +25,7 @@
@@ -29,7 +35,7 @@
GlobalPos globalpos = (GlobalPos) entityvillager.getBehaviorController().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
entityvillager.getBehaviorController().removeMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
@ -22,7 +22,7 @@
worldserver.broadcastEntityEffect(entityvillager, (byte) 14);
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
MinecraftServer minecraftserver = worldserver.getMinecraftServer();
@@ -31,7 +37,14 @@
@@ -41,7 +47,14 @@
return villagerprofession.b() == villageplacetype;
}).findFirst();
}).ifPresent((villagerprofession) -> {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/BehaviorFarm.java
+++ b/net/minecraft/server/BehaviorFarm.java
@@ -58,8 +58,8 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
@@ -78,8 +78,8 @@
protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) {
if (i > this.c && this.farmBlock != null) {
@ -11,7 +11,7 @@
}
}
@@ -79,7 +79,11 @@
@@ -99,7 +99,11 @@
Block block1 = worldserver.getType(this.farmBlock.down()).getBlock();
if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata)) {
@ -24,7 +24,7 @@
}
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.canPlant()) {
@@ -90,19 +94,28 @@
@@ -110,19 +114,28 @@
boolean flag = false;
if (!itemstack.isEmpty()) {
@ -57,7 +57,7 @@
}
if (flag) {
@@ -121,8 +134,8 @@
@@ -141,8 +154,8 @@
this.farmBlock = this.a(worldserver);
if (this.farmBlock != null) {
this.c = i + 20L;

Some files were not shown because too many files have changed in this diff Show more