mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-19 23:33:49 +01:00
Update to Minecraft 1.19.3
By: md_5 <git@md-5.net>
This commit is contained in:
parent
a13136ada2
commit
8b26bb8f3e
305 changed files with 3331 additions and 2864 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -109,6 +109,14 @@
|
||||
@@ -116,6 +116,14 @@
|
||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -15,15 +15,15 @@
|
|||
public class CommandDispatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -120,6 +128,7 @@
|
||||
@@ -127,6 +135,7 @@
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) {
|
||||
+ this(); // CraftBukkit
|
||||
CommandAdvancement.register(this.dispatcher);
|
||||
CommandAttribute.register(this.dispatcher);
|
||||
CommandAttribute.register(this.dispatcher, commandbuildcontext);
|
||||
CommandExecute.register(this.dispatcher, commandbuildcontext);
|
||||
@@ -204,6 +213,11 @@
|
||||
@@ -212,6 +221,11 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.dispatcher.setConsumer((commandcontext, flag, i) -> {
|
||||
((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i);
|
||||
});
|
||||
@@ -216,12 +230,59 @@
|
||||
@@ -224,12 +238,59 @@
|
||||
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
|||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource();
|
||||
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
@@ -246,7 +307,7 @@
|
||||
@@ -254,7 +315,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
|
@ -105,7 +105,7 @@
|
|||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -296,11 +357,36 @@
|
||||
@@ -304,11 +365,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
|
@ -143,7 +143,7 @@
|
|||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -311,7 +397,7 @@
|
||||
@@ -319,7 +405,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
|
@ -152,7 +152,7 @@
|
|||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -334,7 +420,7 @@
|
||||
@@ -342,7 +428,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandListenerWrapper.java
|
||||
+++ b/net/minecraft/commands/CommandListenerWrapper.java
|
||||
@@ -38,6 +38,8 @@
|
||||
@@ -40,6 +40,8 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class CommandListenerWrapper implements ICompletionProvider {
|
||||
|
||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(IChatBaseComponent.translatable("permissions.requires.player"));
|
||||
@@ -58,6 +60,7 @@
|
||||
@@ -60,6 +62,7 @@
|
||||
private final Vec2F rotation;
|
||||
private final CommandSigningContext signingContext;
|
||||
private final TaskChainer chatMessageChainer;
|
||||
|
@ -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) -> {
|
||||
@@ -172,9 +175,23 @@
|
||||
@@ -170,9 +173,23 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int i) {
|
||||
|
@ -41,7 +41,7 @@
|
|||
public Vec3D getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -300,7 +317,7 @@
|
||||
@@ -298,7 +315,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
|
@ -50,9 +50,9 @@
|
|||
entityplayer.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
}
|
||||
@@ -368,4 +385,10 @@
|
||||
public IRegistryCustom registryAccess() {
|
||||
return this.server.registryAccess();
|
||||
@@ -371,4 +388,10 @@
|
||||
public FeatureFlagSet enabledFeatures() {
|
||||
return this.level.enabledFeatures();
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
private final Map<String, String> vagueProperties = Maps.newHashMap();
|
||||
private MinecraftKey id = new MinecraftKey("");
|
||||
@Nullable
|
||||
@@ -284,7 +284,7 @@
|
||||
@@ -276,7 +276,7 @@
|
||||
Iterator iterator = iblockstate.getPossibleValues().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
if (t0 instanceof Integer) {
|
||||
Integer integer = (Integer) t0;
|
||||
@@ -556,7 +556,7 @@
|
||||
@@ -548,7 +548,7 @@
|
||||
Optional<T> optional = iblockstate.getValue(s);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.properties.put(iblockstate, (Comparable) optional.get());
|
||||
} else {
|
||||
this.reader.setCursor(i);
|
||||
@@ -592,7 +592,7 @@
|
||||
@@ -584,7 +584,7 @@
|
||||
private static <T extends Comparable<T>> void appendProperty(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
|
||||
stringbuilder.append(iblockstate.getName());
|
||||
stringbuilder.append('=');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/ArgumentParserSelector.java
|
||||
@@ -149,7 +149,7 @@
|
||||
@@ -147,7 +147,7 @@
|
||||
axisalignedbb = this.createAabb(this.deltaX == null ? 0.0D : this.deltaX, this.deltaY == null ? 0.0D : this.deltaY, this.deltaZ == null ? 0.0D : this.deltaZ);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
if (this.x == null && this.y == null && this.z == null) {
|
||||
function = (vec3d) -> {
|
||||
@@ -206,8 +206,10 @@
|
||||
@@ -204,8 +204,10 @@
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
this.suggestions = this::suggestSelector;
|
||||
if (!this.reader.canRead()) {
|
||||
throw ArgumentParserSelector.ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
|
||||
@@ -465,6 +467,12 @@
|
||||
@@ -463,6 +465,12 @@
|
||||
}
|
||||
|
||||
public EntitySelector parse() throws CommandSyntaxException {
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.startPosition = this.reader.getCursor();
|
||||
this.suggestions = this::suggestNameOrSelector;
|
||||
if (this.reader.canRead() && this.reader.peek() == '@') {
|
||||
@@ -473,7 +481,7 @@
|
||||
@@ -471,7 +479,7 @@
|
||||
}
|
||||
|
||||
this.reader.skip();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
|
||||
private void checkPermissions(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
+ Object object = this.isChestBoat ? new ChestBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()) : new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ // CraftBukkit end
|
||||
|
||||
((EntityBoat) object).setType(this.type);
|
||||
((EntityBoat) object).setVariant(this.type);
|
||||
((EntityBoat) object).setYRot(enumdirection.toYRot());
|
||||
- worldserver.addFreshEntity((Entity) object);
|
||||
- itemstack.shrink(1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -76,6 +76,21 @@
|
||||
@@ -77,6 +77,21 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -200,14 +215,42 @@
|
||||
@@ -201,14 +216,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -226,12 +269,40 @@
|
||||
@@ -227,12 +270,40 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
@ -109,7 +109,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -250,8 +321,35 @@
|
||||
@@ -251,8 +322,35 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -146,7 +146,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
@@ -278,7 +376,35 @@
|
||||
@@ -279,7 +377,35 @@
|
||||
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
|
||||
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
|
||||
|
||||
|
@ -183,7 +183,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -321,9 +447,35 @@
|
||||
@@ -322,9 +448,35 @@
|
||||
}
|
||||
|
||||
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
|
||||
|
@ -221,7 +221,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -332,12 +484,41 @@
|
||||
@@ -333,12 +485,41 @@
|
||||
@Override
|
||||
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
|
@ -264,7 +264,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -359,12 +540,40 @@
|
||||
@@ -360,12 +541,40 @@
|
||||
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
|
||||
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
|
||||
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
|
||||
|
@ -310,7 +310,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -396,9 +605,52 @@
|
||||
@@ -399,9 +608,52 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
|
@ -364,7 +364,7 @@
|
|||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
|
||||
}
|
||||
@@ -425,7 +677,7 @@
|
||||
@@ -428,7 +680,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
|
@ -373,7 +373,7 @@
|
|||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.execute(isourceblock, itemstack);
|
||||
@@ -433,6 +685,32 @@
|
||||
@@ -436,6 +688,32 @@
|
||||
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
|
@ -406,7 +406,7 @@
|
|||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -454,14 +732,42 @@
|
||||
@@ -457,14 +735,42 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
|
@ -451,7 +451,7 @@
|
|||
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
|
||||
if (iblockdata.getBlock() instanceof BlockTNT) {
|
||||
BlockTNT.explode(worldserver, blockposition);
|
||||
@@ -487,12 +793,62 @@
|
||||
@@ -490,12 +796,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
@ -514,7 +514,7 @@
|
|||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -502,12 +858,41 @@
|
||||
@@ -505,12 +861,41 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
@ -558,7 +558,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -531,6 +916,30 @@
|
||||
@@ -535,6 +920,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
|
||||
|
@ -587,9 +587,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, enumdirection.getAxis() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.getOpposite().get2DDataValue() * 4), 3);
|
||||
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -556,6 +965,30 @@
|
||||
@@ -560,6 +969,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
|
@ -620,7 +620,7 @@
|
|||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -605,6 +1038,30 @@
|
||||
@@ -609,6 +1042,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -68,6 +68,8 @@
|
||||
@@ -74,6 +74,8 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
private static final int MAX_VARINT_SIZE = 5;
|
||||
@@ -158,7 +160,7 @@
|
||||
@@ -195,7 +197,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) {
|
||||
int i = this.readVarInt();
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
c0.add(packetdataserializer_a.apply(this));
|
||||
@@ -169,7 +171,7 @@
|
||||
@@ -206,7 +208,7 @@
|
||||
|
||||
public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) {
|
||||
this.writeVarInt(collection.size());
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -196,12 +198,12 @@
|
||||
@@ -233,12 +235,12 @@
|
||||
|
||||
public void writeIntIdList(IntList intlist) {
|
||||
this.writeVarInt(intlist.size());
|
||||
|
@ -42,7 +42,25 @@
|
|||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
K k0 = packetdataserializer_a.apply(this);
|
||||
@@ -437,7 +439,7 @@
|
||||
@@ -272,7 +274,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
|
||||
- E[] ae = (Enum[]) oclass.getEnumConstants();
|
||||
+ E[] ae = oclass.getEnumConstants(); // CraftBukkit - decompile error
|
||||
BitSet bitset = new BitSet(ae.length);
|
||||
|
||||
for (int i = 0; i < ae.length; ++i) {
|
||||
@@ -283,7 +285,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
|
||||
- E[] ae = (Enum[]) oclass.getEnumConstants();
|
||||
+ E[] ae = oclass.getEnumConstants(); // CraftBukkit - decompile error
|
||||
BitSet bitset = this.readFixedBitSet(ae.length);
|
||||
EnumSet<E> enumset = EnumSet.noneOf(oclass);
|
||||
|
||||
@@ -499,7 +501,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
|
||||
|
@ -51,7 +69,7 @@
|
|||
}
|
||||
|
||||
public PacketDataSerializer writeEnum(Enum<?> oenum) {
|
||||
@@ -514,7 +516,7 @@
|
||||
@@ -576,7 +578,7 @@
|
||||
} else {
|
||||
try {
|
||||
NBTCompressedStreamTools.write(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
|
||||
|
@ -60,7 +78,7 @@
|
|||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -551,7 +553,7 @@
|
||||
@@ -613,7 +615,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer writeItem(ItemStack itemstack) {
|
||||
|
@ -69,7 +87,7 @@
|
|||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -580,6 +582,11 @@
|
||||
@@ -642,6 +644,11 @@
|
||||
ItemStack itemstack = new ItemStack(item, b0);
|
||||
|
||||
itemstack.setTag(this.readNbt());
|
||||
|
|
|
@ -15,16 +15,12 @@
|
|||
+ public static final ResourceKey<ChatMessageType> RAW = create("raw"); // CraftBukkit
|
||||
|
||||
private static ResourceKey<ChatMessageType> create(String s) {
|
||||
return ResourceKey.create(IRegistry.CHAT_TYPE_REGISTRY, new MinecraftKey(s));
|
||||
@@ -39,7 +41,10 @@
|
||||
RegistryGeneration.register(iregistry, ChatMessageType.MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.outgoingDirectMessage("commands.message.display.outgoing"), ChatDecoration.withSender("chat.type.text.narrate")));
|
||||
RegistryGeneration.register(iregistry, ChatMessageType.TEAM_MSG_COMMAND_INCOMING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.text"), ChatDecoration.withSender("chat.type.text.narrate")));
|
||||
RegistryGeneration.register(iregistry, ChatMessageType.TEAM_MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.sent"), ChatDecoration.withSender("chat.type.text.narrate")));
|
||||
- return RegistryGeneration.register(iregistry, ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
|
||||
+ // CraftBukkit start
|
||||
+ RegistryGeneration.register(iregistry, ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
|
||||
+ return RegistryGeneration.register(iregistry, ChatMessageType.RAW, new ChatMessageType(new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY), new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY)));
|
||||
+ // CraftBukkit end
|
||||
return ResourceKey.create(Registries.CHAT_TYPE, new MinecraftKey(s));
|
||||
@@ -40,6 +42,7 @@
|
||||
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_INCOMING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.text"), ChatDecoration.withSender("chat.type.text.narrate")));
|
||||
bootstapcontext.register(ChatMessageType.TEAM_MSG_COMMAND_OUTGOING, new ChatMessageType(ChatDecoration.teamMessage("chat.type.team.sent"), ChatDecoration.withSender("chat.type.text.narrate")));
|
||||
bootstapcontext.register(ChatMessageType.EMOTE_COMMAND, new ChatMessageType(ChatDecoration.withSender("chat.type.emote"), ChatDecoration.withSender("chat.type.emote")));
|
||||
+ bootstapcontext.register(ChatMessageType.RAW, new ChatMessageType(new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY), new ChatDecoration("%s", List.of(ChatDecoration.a.CONTENT), ChatModifier.EMPTY))); // CraftBukkit
|
||||
}
|
||||
|
||||
public static ChatMessageType.a bind(ResourceKey<ChatMessageType> resourcekey, Entity entity) {
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
--- a/net/minecraft/network/syncher/DataWatcher.java
|
||||
+++ b/net/minecraft/network/syncher/DataWatcher.java
|
||||
@@ -142,6 +142,13 @@
|
||||
@@ -24,6 +24,11 @@
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class DataWatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -138,6 +143,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,12 +26,40 @@
|
|||
public boolean isDirty() {
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -274,7 +281,7 @@
|
||||
if (!Objects.equals(datawatcher_item1.accessor.getSerializer(), datawatcher_item.accessor.getSerializer())) {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_item1.value, datawatcher_item1.value.getClass()));
|
||||
@@ -218,7 +230,7 @@
|
||||
if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_b.value, datawatcher_b.value.getClass()));
|
||||
} else {
|
||||
- datawatcher_item.setValue(datawatcher_item1.getValue());
|
||||
+ datawatcher_item.setValue((T) datawatcher_item1.getValue()); // CraftBukkit - decompile error
|
||||
- datawatcher_item.setValue(datawatcher_b.value);
|
||||
+ datawatcher_item.setValue((T) datawatcher_b.value); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,6 +238,18 @@
|
||||
return this.itemsById.isEmpty();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void refresh(EntityPlayer to) {
|
||||
+ if (!this.isEmpty()) {
|
||||
+ List<DataWatcher.b<?>> list = this.getNonDefaultValues();
|
||||
+
|
||||
+ if (list != null) {
|
||||
+ to.connection.send(new PacketPlayOutEntityMetadata(this.entity.getId(), list));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static class Item<T> {
|
||||
|
||||
final DataWatcherObject<T> accessor;
|
||||
@@ -268,7 +292,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public static record b<T> (int id, DataWatcherSerializer<T> serializer, T value) {
|
||||
+ public static record b<T>(int id, DataWatcherSerializer<T> serializer, T value) { // CraftBukkit - decompile error
|
||||
|
||||
public static <T> DataWatcher.b<T> create(DataWatcherObject<T> datawatcherobject, T t0) {
|
||||
DataWatcherSerializer<T> datawatcherserializer = datawatcherobject.getSerializer();
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
--- a/net/minecraft/resources/ResourceKey.java
|
||||
+++ b/net/minecraft/resources/ResourceKey.java
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
public class ResourceKey<T> {
|
||||
|
||||
- private static final Map<String, ResourceKey<?>> VALUES = Collections.synchronizedMap(Maps.newIdentityHashMap());
|
||||
+ private static final Map<String, ResourceKey<?>> VALUES = Collections.synchronizedMap(Maps.newHashMap()); // CraftBukkit - SPIGOT-6973: remove costly intern
|
||||
private final MinecraftKey registryName;
|
||||
private final MinecraftKey location;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
}
|
||||
|
||||
private static <T> ResourceKey<T> create(MinecraftKey minecraftkey, MinecraftKey minecraftkey1) {
|
||||
- String s = (minecraftkey + ":" + minecraftkey1).intern();
|
||||
+ String s = (minecraftkey + ":" + minecraftkey1); // CraftBukkit - SPIGOT-6973: remove costly intern
|
||||
|
||||
return (ResourceKey) ResourceKey.VALUES.computeIfAbsent(s, (s1) -> {
|
||||
return new ResourceKey<>(minecraftkey, minecraftkey1);
|
||||
@@ -49,7 +49,7 @@
|
||||
}
|
||||
|
||||
public <E> Optional<ResourceKey<E>> cast(ResourceKey<? extends IRegistry<E>> resourcekey) {
|
||||
- return this.isFor(resourcekey) ? Optional.of(this) : Optional.empty();
|
||||
+ return this.isFor(resourcekey) ? (Optional) Optional.of(this) : Optional.empty(); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public MinecraftKey location() {
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -32,6 +32,12 @@
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
@@ -26,6 +26,12 @@
|
||||
import net.minecraft.world.level.block.BlockFire;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -42,6 +48,23 @@
|
||||
@@ -36,6 +42,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
|
@ -35,10 +35,10 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
DispenserRegistry.isBootstrapped = true;
|
||||
if (IRegistry.REGISTRY.keySet().isEmpty()) {
|
||||
if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
|
||||
throw new IllegalStateException("Unable to load registries");
|
||||
@@ -58,6 +81,69 @@
|
||||
IRegistry.freezeBuiltins();
|
||||
@@ -52,6 +75,69 @@
|
||||
BuiltInRegistries.bootStrap();
|
||||
wrapStreams();
|
||||
}
|
||||
+ // CraftBukkit start - easier than fixing the decompile
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
--- a/net/minecraft/server/Main.java
|
||||
+++ b/net/minecraft/server/Main.java
|
||||
@@ -58,6 +58,15 @@
|
||||
@@ -59,6 +59,16 @@
|
||||
import net.minecraft.world.level.storage.WorldInfo;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.google.common.base.Charsets;
|
||||
+import com.mojang.bridge.game.PackType;
|
||||
+import java.io.InputStreamReader;
|
||||
+import java.util.concurrent.atomic.AtomicReference;
|
||||
+import net.minecraft.SharedConstants;
|
||||
|
@ -16,7 +17,7 @@
|
|||
public class Main {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -65,8 +74,9 @@
|
||||
@@ -66,8 +76,9 @@
|
||||
public Main() {}
|
||||
|
||||
@DontObfuscate
|
||||
|
@ -27,7 +28,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");
|
||||
@@ -91,9 +101,12 @@
|
||||
@@ -92,9 +103,12 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
|
@ -41,7 +42,7 @@
|
|||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -101,13 +114,26 @@
|
||||
@@ -102,13 +116,26 @@
|
||||
DispenserRegistry.validate();
|
||||
SystemUtils.startTimerHackThread();
|
||||
Path path = Paths.get("server.properties");
|
||||
|
@ -70,7 +71,7 @@
|
|||
Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
@@ -117,11 +143,12 @@
|
||||
@@ -118,11 +145,12 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -86,7 +87,7 @@
|
|||
WorldInfo worldinfo = convertable_conversionsession.getSummary();
|
||||
|
||||
if (worldinfo != null) {
|
||||
@@ -136,13 +163,32 @@
|
||||
@@ -137,13 +165,31 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -97,7 +98,7 @@
|
|||
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
|
||||
}
|
||||
|
||||
ResourcePackRepository resourcepackrepository = new ResourcePackRepository(EnumResourcePackType.SERVER_DATA, new ResourcePackSource[]{new ResourcePackSourceVanilla(), new ResourcePackSourceFolder(convertable_conversionsession.getLevelPath(SavedFile.DATAPACK_DIR).toFile(), PackSource.WORLD)});
|
||||
ResourcePackRepository resourcepackrepository = ResourcePackSourceVanilla.createPackRepository(convertable_conversionsession.getLevelPath(SavedFile.DATAPACK_DIR));
|
||||
+ // CraftBukkit start
|
||||
+ File bukkitDataPackFolder = new File(convertable_conversionsession.getLevelPath(SavedFile.DATAPACK_DIR).toFile(), "bukkit");
|
||||
+ if (!bukkitDataPackFolder.exists()) {
|
||||
|
@ -108,55 +109,59 @@
|
|||
+ com.google.common.io.Files.write("{\n"
|
||||
+ + " \"pack\": {\n"
|
||||
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
|
||||
+ + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion() + "\n"
|
||||
+ + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(PackType.DATA) + "\n"
|
||||
+ + " }\n"
|
||||
+ + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
|
||||
+ } catch (java.io.IOException ex) {
|
||||
+ throw new RuntimeException("Could not initialize Bukkit datapack", ex);
|
||||
+ }
|
||||
+ AtomicReference<DataPackConfiguration> config = new AtomicReference<>();
|
||||
+ AtomicReference<DynamicOps<NBTBase>> ops = new AtomicReference<>();
|
||||
+ AtomicReference<WorldLoader.a> worldLoader = new AtomicReference<>();
|
||||
+ // CraftBukkit end
|
||||
|
||||
WorldStem worldstem;
|
||||
|
||||
@@ -155,6 +201,12 @@
|
||||
return WorldStem.load(worldloader_a, (iresourcemanager, datapackconfiguration1) -> {
|
||||
IRegistryCustom.e iregistrycustom_e = IRegistryCustom.builtinCopy();
|
||||
DynamicOps<NBTBase> dynamicops = RegistryOps.createAndLoad(DynamicOpsNBT.INSTANCE, iregistrycustom_e, iresourcemanager);
|
||||
+ // CraftBukkit start
|
||||
+ config.set(datapackconfiguration1);
|
||||
+ ops.set(dynamicops);
|
||||
+ return Pair.of(null, iregistrycustom_e.freeze());
|
||||
+ // CraftBukkit end
|
||||
+ /*
|
||||
SaveData savedata = convertable_conversionsession.getDataTag(dynamicops, datapackconfiguration1, iregistrycustom_e.allElementsLifecycle());
|
||||
@@ -152,6 +198,7 @@
|
||||
|
||||
if (savedata != null) {
|
||||
@@ -177,6 +229,7 @@
|
||||
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
|
||||
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
|
||||
+ worldLoader.set(worldloader_a); // CraftBukkit
|
||||
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
|
||||
Pair<SaveData, WorldDimensions.b> pair = convertable_conversionsession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
|
||||
@@ -163,7 +210,7 @@
|
||||
WorldOptions worldoptions;
|
||||
WorldDimensions worlddimensions;
|
||||
|
||||
return Pair.of(worlddataserver, iregistrycustom_e.freeze());
|
||||
}
|
||||
+ */
|
||||
}, SystemUtils.backgroundExecutor(), executor);
|
||||
}).get();
|
||||
} catch (Exception exception) {
|
||||
@@ -184,6 +237,7 @@
|
||||
- if (optionset.has(optionspec2)) {
|
||||
+ if (optionset.has("demo")) { // CraftBukkit
|
||||
worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
worldoptions = WorldOptions.DEMO_OPTIONS;
|
||||
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
|
||||
@@ -171,7 +218,7 @@
|
||||
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
|
||||
|
||||
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
|
||||
- worldoptions = optionset.has(optionspec3) ? dedicatedserverproperties.worldOptions.withBonusChest(true) : dedicatedserverproperties.worldOptions;
|
||||
+ worldoptions = optionset.has("bonusChest") ? dedicatedserverproperties.worldOptions.withBonusChest(true) : dedicatedserverproperties.worldOptions; // CraftBukkit
|
||||
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
|
||||
}
|
||||
|
||||
@@ -187,6 +234,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ /*
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registryAccess();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
|
||||
|
||||
dedicatedserversettings.getProperties().getWorldGenSettings(iregistrycustom_dimension);
|
||||
@@ -196,21 +250,32 @@
|
||||
}
|
||||
if (optionset.has(optionspec4)) {
|
||||
@@ -198,21 +246,32 @@
|
||||
SaveData savedata = worldstem.worldData();
|
||||
|
||||
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
|
||||
+ */
|
||||
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
|
||||
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::new);
|
||||
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, config.get(), ops.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::new);
|
||||
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::new);
|
||||
|
||||
+ /*
|
||||
dedicatedserver1.setSingleplayerProfile(optionset.has(optionspec8) ? new GameProfile((UUID) null, (String) optionset.valueOf(optionspec8)) : null);
|
||||
|
@ -184,7 +189,7 @@
|
|||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.halt(true);
|
||||
@@ -219,6 +284,7 @@
|
||||
@@ -221,6 +280,7 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
@ -192,12 +197,12 @@
|
|||
} catch (Exception exception1) {
|
||||
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
|
||||
}
|
||||
@@ -226,7 +292,7 @@
|
||||
@@ -246,7 +306,7 @@
|
||||
}
|
||||
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, GeneratorSettings generatorsettings) {
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) {
|
||||
- Main.LOGGER.info("Forcing world upgrade!");
|
||||
+ Main.LOGGER.info("Forcing world upgrade! {}", convertable_conversionsession.getLevelId()); // CraftBukkit
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, generatorsettings, flag);
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, iregistry, flag);
|
||||
IChatBaseComponent ichatbasecomponent = null;
|
||||
|
||||
|
|
|
@ -1,28 +1,29 @@
|
|||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -157,6 +157,31 @@
|
||||
@@ -165,6 +165,32 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.datafixers.util.Pair;
|
||||
+import com.mojang.serialization.DynamicOps;
|
||||
+import com.mojang.serialization.Lifecycle;
|
||||
+import java.util.Random;
|
||||
+import jline.console.ConsoleReader;
|
||||
+import joptsimple.OptionSet;
|
||||
+import net.minecraft.core.HolderLookup;
|
||||
+import net.minecraft.nbt.DynamicOpsNBT;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
+import net.minecraft.resources.RegistryOps;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.dedicated.DedicatedServerProperties;
|
||||
+import net.minecraft.util.datafix.DataConverterRegistry;
|
||||
+import net.minecraft.world.level.biome.WorldChunkManager;
|
||||
+import net.minecraft.world.level.levelgen.ChunkGeneratorAbstract;
|
||||
+import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
+import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.Main;
|
||||
+import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
|
||||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+import org.bukkit.craftbukkit.util.LazyPlayerSet;
|
||||
+import org.bukkit.event.player.AsyncPlayerChatPreviewEvent;
|
||||
|
@ -32,22 +33,12 @@
|
|||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -195,7 +220,7 @@
|
||||
private String localIp;
|
||||
private int port;
|
||||
public final IRegistryCustom.Dimension registryHolder;
|
||||
- public final Map<ResourceKey<World>, WorldServer> levels;
|
||||
+ private Map<ResourceKey<World>, WorldServer> levels;
|
||||
private PlayerList playerList;
|
||||
private volatile boolean running;
|
||||
private boolean stopped;
|
||||
@@ -239,6 +264,21 @@
|
||||
@@ -247,6 +273,20 @@
|
||||
protected SaveData worldData;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public final DataPackConfiguration datapackconfiguration;
|
||||
+ public final DynamicOps<NBTBase> registryreadops;
|
||||
+ public final WorldLoader.a worldLoader;
|
||||
+ public org.bukkit.craftbukkit.CraftServer server;
|
||||
+ public OptionSet options;
|
||||
+ public org.bukkit.command.ConsoleCommandSender console;
|
||||
|
@ -63,7 +54,7 @@
|
|||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -252,14 +292,14 @@
|
||||
@@ -260,14 +300,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
|
@ -76,27 +67,26 @@
|
|||
}
|
||||
|
||||
- public MinecraftServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ public MinecraftServer(OptionSet options, WorldLoader.a worldLoader, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, Proxy proxy, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -280,7 +320,7 @@
|
||||
@@ -288,7 +328,7 @@
|
||||
this.frameTimer = new CircularTimer();
|
||||
this.registryHolder = worldstem.registryAccess();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
- if (!this.worldData.worldGenSettings().dimensions().containsKey(WorldDimension.OVERWORLD)) {
|
||||
+ if (false && !this.worldData.worldGenSettings().dimensions().containsKey(WorldDimension.OVERWORLD)) { // CraftBukkit - initialised later
|
||||
- if (!this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM).containsKey(WorldDimension.OVERWORLD)) {
|
||||
+ if (false && !this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM).containsKey(WorldDimension.OVERWORLD)) { // CraftBukkit - initialised later
|
||||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -301,13 +341,41 @@
|
||||
@@ -311,13 +351,40 @@
|
||||
this.serverThread = thread;
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
+ this.datapackconfiguration = datapackconfiguration;
|
||||
+ this.registryreadops = registryreadops;
|
||||
+ this.worldLoader = worldLoader;
|
||||
+ this.vanillaCommandDispatcher = worldstem.dataPackResources().commands; // CraftBukkit
|
||||
+ // Try to see if we're actually running in a terminal, disable jline if not
|
||||
+ if (System.console() == null && System.getProperty("jline.terminal") == null) {
|
||||
|
@ -132,7 +122,7 @@
|
|||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -316,7 +384,7 @@
|
||||
@@ -326,7 +393,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
|
@ -141,7 +131,7 @@
|
|||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -324,12 +392,8 @@
|
||||
@@ -334,12 +401,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
|
@ -155,7 +145,7 @@
|
|||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -344,25 +408,189 @@
|
||||
@@ -354,25 +417,183 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -163,39 +153,10 @@
|
|||
+ // CraftBukkit start
|
||||
+ private void loadWorld0(String s) {
|
||||
+ Convertable.ConversionSession worldSession = this.storageSource;
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registryHolder;
|
||||
+ WorldDataServer overworldData = (WorldDataServer) worldSession.getDataTag(registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
|
||||
+ if (overworldData == null) {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+
|
||||
+ if (this.isDemo()) {
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = WorldPresets.demoSettings(iregistrycustom_dimension);
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getProperties();
|
||||
|
||||
- protected void createLevels(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.worldData.overworldData();
|
||||
- GeneratorSettings generatorsettings = this.worldData.worldGenSettings();
|
||||
- boolean flag = generatorsettings.isDebug();
|
||||
- long i = generatorsettings.seed();
|
||||
- long j = BiomeManager.obfuscateSeed(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- IRegistry<WorldDimension> iregistry = generatorsettings.dimensions();
|
||||
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true);
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
|
||||
+ }
|
||||
+
|
||||
+ overworldData = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
+ }
|
||||
+
|
||||
+ GeneratorSettings overworldSettings = overworldData.worldGenSettings();
|
||||
+ IRegistry<WorldDimension> iregistry = overworldSettings.dimensions();
|
||||
+ for (WorldDimension worldDimension : iregistry) {
|
||||
+ ResourceKey<WorldDimension> dimensionKey = iregistry.getResourceKey(worldDimension).get();
|
||||
+ IRegistry<WorldDimension> dimensions = this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ for (WorldDimension worldDimension : dimensions) {
|
||||
+ ResourceKey<WorldDimension> dimensionKey = dimensions.getResourceKey(worldDimension).get();
|
||||
+
|
||||
+ WorldServer world;
|
||||
+ int dimension = 0;
|
||||
|
@ -215,7 +176,17 @@
|
|||
+ } else if (dimensionKey != WorldDimension.OVERWORLD) {
|
||||
+ dimension = -999;
|
||||
+ }
|
||||
+
|
||||
|
||||
- protected void createLevels(WorldLoadListener worldloadlistener) {
|
||||
- IWorldDataServer iworlddataserver = this.worldData.overworldData();
|
||||
- boolean flag = this.worldData.isDebugWorld();
|
||||
- IRegistry<WorldDimension> iregistry = this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM);
|
||||
- WorldOptions worldoptions = this.worldData.worldGenOptions();
|
||||
- long i = worldoptions.seed();
|
||||
- long j = BiomeManager.obfuscateSeed(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true);
|
||||
+ String worldType = (dimension == -999) ? dimensionKey.location().getNamespace() + "_" + dimensionKey.location().getPath() : org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
+ String name = (dimensionKey == WorldDimension.OVERWORLD) ? s : s + "_" + worldType;
|
||||
+ if (dimension != 0) {
|
||||
|
@ -252,7 +223,9 @@
|
|||
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----");
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+ try {
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey);
|
||||
+ } catch (IOException ex) {
|
||||
|
@ -262,45 +235,60 @@
|
|||
+
|
||||
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
|
||||
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
|
||||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ WorldDataServer worlddata;
|
||||
+ WorldLoader.a worldloader_a = this.worldLoader;
|
||||
+ IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
|
||||
+ Pair<SaveData, WorldDimensions.b> pair = worldSession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
|
||||
+
|
||||
+ WorldDataServer worlddata = (WorldDataServer) worldSession.getDataTag((DynamicOps) registryreadops, datapackconfiguration, iregistrycustom_dimension.allElementsLifecycle());
|
||||
+ if (worlddata == null) {
|
||||
+ if (pair != null) {
|
||||
+ worlddata = (WorldDataServer) pair.getFirst();
|
||||
+ } else {
|
||||
+ WorldSettings worldsettings;
|
||||
+ GeneratorSettings generatorsettings;
|
||||
+ WorldOptions worldoptions;
|
||||
+ WorldDimensions worlddimensions;
|
||||
+
|
||||
+ if (this.isDemo()) {
|
||||
+ worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
+ generatorsettings = WorldPresets.demoSettings(iregistrycustom_dimension);
|
||||
+ worldoptions = WorldOptions.DEMO_OPTIONS;
|
||||
+ worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
|
||||
+ } else {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = ((DedicatedServer) this).getProperties();
|
||||
+
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), datapackconfiguration);
|
||||
+ generatorsettings = options.has("bonusChest") ? dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension).withBonusChest() : dedicatedserverproperties.getWorldGenSettings(iregistrycustom_dimension);
|
||||
+ worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
|
||||
+ worldoptions = options.has("bonusChest") ? dedicatedserverproperties.worldOptions.withBonusChest(true) : dedicatedserverproperties.worldOptions;
|
||||
+ worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
|
||||
+ }
|
||||
+
|
||||
+ worlddata = new WorldDataServer(worldsettings, generatorsettings, Lifecycle.stable());
|
||||
+ WorldDimensions.b worlddimensions_b = worlddimensions.bake(iregistry);
|
||||
+ Lifecycle lifecycle = worlddimensions_b.lifecycle().add(worldloader_a.datapackWorldgen().allRegistriesLifecycle());
|
||||
+
|
||||
+ worlddata = new WorldDataServer(worldsettings, worldoptions, worlddimensions_b.specialWorldProperty(), lifecycle);
|
||||
+ }
|
||||
+ worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
||||
+ if (options.has("forceUpgrade")) {
|
||||
+ net.minecraft.server.Main.forceUpgrade(worldSession, DataConverterRegistry.getDataFixer(), options.has("eraseCache"), () -> {
|
||||
+ return true;
|
||||
+ }, worlddata.worldGenSettings());
|
||||
+ }, iregistry);
|
||||
+ }
|
||||
+
|
||||
+ WorldDataServer iworlddataserver = worlddata;
|
||||
+ GeneratorSettings generatorsettings = worlddata.worldGenSettings();
|
||||
+ boolean flag = generatorsettings.isDebug();
|
||||
+ long i = generatorsettings.seed();
|
||||
+ boolean flag = worlddata.isDebugWorld();
|
||||
+ WorldOptions worldoptions = worlddata.worldGenOptions();
|
||||
+ long i = worldoptions.seed();
|
||||
+ long j = BiomeManager.obfuscateSeed(i);
|
||||
+ List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
+ WorldDimension worlddimension = (WorldDimension) iregistry.get(dimensionKey);
|
||||
+ WorldDimension worlddimension = (WorldDimension) dimensions.get(dimensionKey);
|
||||
+
|
||||
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.typeHolder().value());
|
||||
+ org.bukkit.generator.WorldInfo worldInfo = new org.bukkit.craftbukkit.generator.CraftWorldInfo(iworlddataserver, worldSession, org.bukkit.World.Environment.getEnvironment(dimension), worlddimension.type().value());
|
||||
+ if (biomeProvider == null && gen != null) {
|
||||
+ biomeProvider = gen.getDefaultBiomeProvider(worldInfo);
|
||||
+ }
|
||||
+
|
||||
+ ResourceKey<World> worldKey = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, dimensionKey.location());
|
||||
+ ResourceKey<World> worldKey = ResourceKey.create(Registries.DIMENSION, dimensionKey.location());
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.OVERWORLD) {
|
||||
+ this.worldData = worlddata;
|
||||
|
@ -319,7 +307,7 @@
|
|||
+ }
|
||||
+
|
||||
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
+ this.initWorld(world, worlddata, worldData, worlddata.worldGenSettings());
|
||||
+ this.initWorld(world, worlddata, worldData, worldoptions);
|
||||
+
|
||||
+ this.addLevel(world);
|
||||
+ this.getPlayerList().addWorldborderListener(world);
|
||||
|
@ -340,16 +328,12 @@
|
|||
+ this.connection.acceptConnections();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+
|
||||
+ protected void forceDifficulty() {}
|
||||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, GeneratorSettings generatorsettings) {
|
||||
+ boolean flag = generatorsettings.isDebug();
|
||||
+ public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, WorldOptions worldoptions) {
|
||||
+ boolean flag = saveData.isDebugWorld();
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver.generator != null) {
|
||||
+ worldserver.getWorld().getPopulators().addAll(worldserver.generator.getDefaultPopulators(worldserver.getWorld()));
|
||||
|
@ -360,7 +344,7 @@
|
|||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -386,29 +614,8 @@
|
||||
@@ -396,29 +617,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
|
@ -376,7 +360,7 @@
|
|||
- ResourceKey<WorldDimension> resourcekey = (ResourceKey) entry.getKey();
|
||||
-
|
||||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.create(IRegistry.DIMENSION_REGISTRY, resourcekey.location());
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.create(Registries.DIMENSION, resourcekey.location());
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, (WorldDimension) entry.getValue(), worldloadlistener, flag, j, ImmutableList.of(), false);
|
||||
-
|
||||
|
@ -391,7 +375,7 @@
|
|||
|
||||
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -416,6 +623,21 @@
|
||||
@@ -426,6 +626,21 @@
|
||||
} else {
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
|
||||
|
@ -413,7 +397,7 @@
|
|||
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
|
||||
|
||||
if (i < worldserver.getMinBuildHeight()) {
|
||||
@@ -473,8 +695,11 @@
|
||||
@@ -485,8 +700,11 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
|
@ -427,7 +411,7 @@
|
|||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -484,19 +709,23 @@
|
||||
@@ -496,19 +714,23 @@
|
||||
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(500);
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
|
@ -460,7 +444,7 @@
|
|||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -511,11 +740,18 @@
|
||||
@@ -523,11 +745,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -482,7 +466,7 @@
|
|||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -545,12 +781,16 @@
|
||||
@@ -557,12 +786,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
|
@ -499,7 +483,7 @@
|
|||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -585,12 +825,33 @@
|
||||
@@ -597,12 +830,33 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
|
@ -533,7 +517,7 @@
|
|||
if (this.getConnection() != null) {
|
||||
this.getConnection().stop();
|
||||
}
|
||||
@@ -600,6 +861,7 @@
|
||||
@@ -612,6 +866,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.saveAll();
|
||||
this.playerList.removeAll();
|
||||
|
@ -541,7 +525,7 @@
|
|||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -696,9 +958,10 @@
|
||||
@@ -707,9 +962,10 @@
|
||||
while (this.running) {
|
||||
long i = SystemUtils.getMillis() - this.nextTickTime;
|
||||
|
||||
|
@ -553,7 +537,7 @@
|
|||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -709,6 +972,7 @@
|
||||
@@ -720,6 +976,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
|
@ -561,7 +545,7 @@
|
|||
this.nextTickTime += 50L;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -747,6 +1011,12 @@
|
||||
@@ -758,6 +1015,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
|
@ -574,24 +558,25 @@
|
|||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -780,8 +1050,15 @@
|
||||
@@ -791,9 +1054,16 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
- return this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ // CraftBukkit start
|
||||
+ return this.forceTicks || this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ private void executeModerately() {
|
||||
+ this.runAllTasks();
|
||||
+ java.util.concurrent.locks.LockSupport.parkNanos("executing tasks", 1000L);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
protected void waitUntilNextTick() {
|
||||
this.runAllTasks();
|
||||
@@ -827,7 +1104,7 @@
|
||||
this.managedBlock(() -> {
|
||||
@@ -838,7 +1108,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -600,7 +585,7 @@
|
|||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -898,7 +1175,7 @@
|
||||
@@ -909,7 +1179,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,7 +594,7 @@
|
|||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -917,22 +1194,39 @@
|
||||
@@ -928,22 +1198,39 @@
|
||||
}
|
||||
|
||||
public void tickChildren(BooleanSupplier booleansupplier) {
|
||||
|
@ -649,7 +634,7 @@
|
|||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -995,6 +1289,22 @@
|
||||
@@ -1006,6 +1293,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
|
@ -672,7 +657,7 @@
|
|||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1021,7 +1331,7 @@
|
||||
@@ -1032,7 +1335,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
@ -681,9 +666,9 @@
|
|||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport systemreport) {
|
||||
@@ -1372,11 +1682,11 @@
|
||||
@@ -1370,11 +1673,11 @@
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = this.registryAccess();
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream stream = collection.stream();
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
|
@ -695,15 +680,15 @@
|
|||
}, this).thenCompose((immutablelist) -> {
|
||||
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
|
||||
|
||||
@@ -1391,6 +1701,7 @@
|
||||
@@ -1389,6 +1692,7 @@
|
||||
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
|
||||
this.resources.close();
|
||||
this.resources = minecraftserver_reloadableresources;
|
||||
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
this.packRepository.setSelected(collection);
|
||||
this.worldData.setDataPackConfig(getSelectedPacks(this.packRepository));
|
||||
this.resources.managers.updateRegistryTags(this.registryAccess());
|
||||
@@ -1740,7 +2051,7 @@
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1757,7 +2061,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
|
@ -712,7 +697,7 @@
|
|||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1790,6 +2101,22 @@
|
||||
@@ -1807,6 +2111,22 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -735,7 +720,7 @@
|
|||
private void startMetricsRecordingTick() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
@@ -1912,8 +2239,30 @@
|
||||
@@ -1933,8 +2253,30 @@
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandEffect.java
|
||||
+++ b/net/minecraft/server/commands/CommandEffect.java
|
||||
@@ -72,7 +72,7 @@
|
||||
@@ -76,7 +76,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@
|
||||
@@ -102,7 +102,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
++i;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@
|
||||
@@ -128,7 +128,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandSummon.java
|
||||
+++ b/net/minecraft/server/commands/CommandSummon.java
|
||||
@@ -65,7 +65,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
((EntityInsentient) entity).finalizeSpawn(commandlistenerwrapper.getLevel(), commandlistenerwrapper.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EnumMobSpawn.COMMAND, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -56,6 +56,18 @@
|
||||
@@ -53,6 +53,16 @@
|
||||
import net.minecraft.world.level.storage.Convertable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.serialization.DynamicOps;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
+import net.minecraft.world.level.DataPackConfiguration;
|
||||
+import net.minecraft.server.WorldLoader;
|
||||
+import org.apache.logging.log4j.Level;
|
||||
+import org.apache.logging.log4j.LogManager;
|
||||
+import org.apache.logging.log4j.io.IoBuilder;
|
||||
|
@ -19,20 +17,20 @@
|
|||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -73,8 +85,10 @@
|
||||
@@ -70,8 +80,10 @@
|
||||
@Nullable
|
||||
private final TextFilter textFilterClient;
|
||||
|
||||
- public DedicatedServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- super(thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
|
||||
+ // CraftBukkit start - Signature changed
|
||||
+ public DedicatedServer(joptsimple.OptionSet options, DataPackConfiguration datapackconfiguration, DynamicOps<NBTBase> registryreadops, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ super(options, datapackconfiguration, registryreadops, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
|
||||
+ public DedicatedServer(joptsimple.OptionSet options, WorldLoader.a worldLoader, Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
+ super(options, worldLoader, thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
|
||||
+ // CraftBukkit end
|
||||
this.settings = dedicatedserversettings;
|
||||
this.rconConsoleSource = new RemoteControlCommandListener(this);
|
||||
this.textFilterClient = TextFilter.createFromConfig(dedicatedserversettings.getProperties().textFilteringConfig);
|
||||
@@ -84,13 +98,44 @@
|
||||
@@ -81,13 +93,44 @@
|
||||
public boolean initServer() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
|
@ -80,7 +78,7 @@
|
|||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -99,6 +144,27 @@
|
||||
@@ -96,6 +139,27 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -108,7 +106,7 @@
|
|||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
|
||||
thread.start();
|
||||
@@ -123,7 +189,7 @@
|
||||
@@ -120,7 +184,7 @@
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
|
||||
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
|
||||
|
@ -117,12 +115,12 @@
|
|||
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
@@ -147,6 +213,12 @@
|
||||
@@ -144,6 +208,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ this.setPlayerList(new DedicatedPlayerList(this, this.registryHolder, this.playerDataStorage));
|
||||
+ this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage));
|
||||
+ server.loadPlugins();
|
||||
+ server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.STARTUP);
|
||||
+ // CraftBukkit end
|
||||
|
@ -130,12 +128,12 @@
|
|||
if (!this.usesAuthentication()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -161,13 +233,13 @@
|
||||
@@ -158,13 +228,13 @@
|
||||
if (!NameReferencingFileConverter.serverReadyAfterUserconversion(this)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage));
|
||||
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registryAccess(), this.playerDataStorage)); // CraftBukkit - moved up
|
||||
- this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage));
|
||||
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // CraftBukkit - moved up
|
||||
long i = SystemUtils.getNanos();
|
||||
|
||||
TileEntitySkull.setup(this.services, this);
|
||||
|
@ -146,7 +144,7 @@
|
|||
long j = SystemUtils.getNanos() - i;
|
||||
String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D);
|
||||
|
||||
@@ -184,6 +256,7 @@
|
||||
@@ -181,6 +251,7 @@
|
||||
if (dedicatedserverproperties.enableRcon) {
|
||||
DedicatedServer.LOGGER.info("Starting remote control listener");
|
||||
this.rconThread = RemoteControlListener.create(this);
|
||||
|
@ -154,7 +152,7 @@
|
|||
}
|
||||
|
||||
if (this.getMaxTickLength() > 0L) {
|
||||
@@ -300,6 +373,7 @@
|
||||
@@ -296,6 +367,7 @@
|
||||
this.queryThreadGs4.stop();
|
||||
}
|
||||
|
||||
|
@ -162,7 +160,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -321,7 +395,15 @@
|
||||
@@ -317,7 +389,15 @@
|
||||
while (!this.consoleInput.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
|
||||
|
||||
|
@ -179,7 +177,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -546,14 +628,45 @@
|
||||
@@ -537,14 +617,45 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -227,7 +225,7 @@
|
|||
});
|
||||
return this.rconConsoleSource.getCommandResponse();
|
||||
}
|
||||
@@ -606,4 +719,15 @@
|
||||
@@ -597,4 +708,15 @@
|
||||
public Optional<MinecraftServer.ServerResourcePackInfo> getServerResourcePack() {
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -37,10 +37,15 @@
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
@@ -45,11 +45,16 @@
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -12,13 +12,14 @@
|
|||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final Pattern SHA1 = Pattern.compile("^[a-fA-F0-9]{40}$");
|
||||
private static final Splitter COMMA_SPLITTER = Splitter.on(',').trimResults();
|
||||
+ public final boolean debug = this.get("debug", false); // CraftBukkit
|
||||
public final boolean onlineMode = this.get("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
@@ -95,8 +100,10 @@
|
||||
@Nullable
|
||||
private GeneratorSettings worldGenSettings;
|
||||
@@ -103,8 +108,10 @@
|
||||
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
||||
public final WorldOptions worldOptions;
|
||||
|
||||
- public DedicatedServerProperties(Properties properties) {
|
||||
- super(properties);
|
||||
|
@ -29,8 +30,8 @@
|
|||
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
|
||||
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
|
||||
this.levelName = this.get("level-name", "world");
|
||||
@@ -147,13 +154,15 @@
|
||||
this.serverResourcePackInfo = getServerPackInfo(this.get("resource-pack", ""), this.get("resource-pack-sha1", ""), this.getLegacyString("resource-pack-hash"), this.get("require-resource-pack", false), this.get("resource-pack-prompt", ""));
|
||||
@@ -160,13 +167,15 @@
|
||||
this.initialDataPackConfiguration = getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
|
||||
}
|
||||
|
||||
- public static DedicatedServerProperties fromFile(Path path) {
|
||||
|
@ -42,30 +43,30 @@
|
|||
|
||||
@Override
|
||||
- protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties) {
|
||||
- DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties);
|
||||
- return new DedicatedServerProperties(properties);
|
||||
+ protected DedicatedServerProperties reload(IRegistryCustom iregistrycustom, Properties properties, OptionSet optionset) {
|
||||
+ DedicatedServerProperties dedicatedserverproperties = new DedicatedServerProperties(properties, optionset);
|
||||
+ return new DedicatedServerProperties(properties, optionset);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
dedicatedserverproperties.getWorldGenSettings(iregistrycustom);
|
||||
return dedicatedserverproperties;
|
||||
@@ -222,10 +231,10 @@
|
||||
@Nullable
|
||||
@@ -247,10 +256,10 @@
|
||||
}).orElseThrow(() -> {
|
||||
return new IllegalStateException("Invalid datapack contents: can't find default preset");
|
||||
});
|
||||
- Optional optional = Optional.ofNullable(MinecraftKey.tryParse(this.levelType)).map((minecraftkey) -> {
|
||||
+ Optional<ResourceKey<WorldPreset>> optional = Optional.ofNullable(MinecraftKey.tryParse(this.levelType)).map((minecraftkey) -> { // CraftBukkit - decompile error
|
||||
return ResourceKey.create(IRegistry.WORLD_PRESET_REGISTRY, minecraftkey);
|
||||
return ResourceKey.create(Registries.WORLD_PRESET, minecraftkey);
|
||||
}).or(() -> {
|
||||
- return Optional.ofNullable((ResourceKey) DedicatedServerProperties.a.LEGACY_PRESET_NAMES.get(this.levelType));
|
||||
+ return Optional.ofNullable(DedicatedServerProperties.a.LEGACY_PRESET_NAMES.get(this.levelType)); // CraftBukkit - decompile error
|
||||
- return Optional.ofNullable((ResourceKey) DedicatedServerProperties.WorldDimensionData.LEGACY_PRESET_NAMES.get(this.levelType));
|
||||
+ return Optional.ofNullable(DedicatedServerProperties.WorldDimensionData.LEGACY_PRESET_NAMES.get(this.levelType)); // CraftBukkit - decompile error
|
||||
});
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
@@ -239,7 +248,7 @@
|
||||
@@ -262,7 +271,7 @@
|
||||
|
||||
if (holder1.is(WorldPresets.FLAT)) {
|
||||
RegistryOps<JsonElement> registryops = RegistryOps.create(JsonOps.INSTANCE, iregistrycustom);
|
||||
if (holder.is(WorldPresets.FLAT)) {
|
||||
RegistryOps<JsonElement> registryops = RegistryOps.create(JsonOps.INSTANCE, (HolderLookup.b) iregistrycustom);
|
||||
- DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings()));
|
||||
+ DataResult<GeneratorSettingsFlat> dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings())); // CraftBukkit - decompile error
|
||||
Logger logger = DedicatedServerProperties.LOGGER;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -84,6 +84,16 @@
|
||||
@@ -85,6 +85,16 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -128,7 +138,7 @@
|
||||
@@ -129,7 +139,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
ichunkaccess = this.lastChunk[l];
|
||||
|
@ -26,7 +26,7 @@
|
|||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -176,12 +186,12 @@
|
||||
@@ -177,12 +187,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -41,7 +41,7 @@
|
|||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -229,7 +239,15 @@
|
||||
@@ -230,7 +240,15 @@
|
||||
int l = 33 + ChunkStatus.getDistance(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
|
@ -58,7 +58,7 @@
|
|||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.chunkAbsent(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
@@ -248,7 +266,7 @@
|
||||
@@ -249,7 +267,7 @@
|
||||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -315,7 +333,7 @@
|
||||
@@ -316,7 +334,7 @@
|
||||
} else if (!this.level.shouldTickBlocksAt(i)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
return either != null && either.left().isPresent();
|
||||
}
|
||||
@@ -328,11 +346,31 @@
|
||||
@@ -329,11 +347,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
@ -109,7 +109,7 @@
|
|||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -364,7 +402,7 @@
|
||||
@@ -365,7 +403,7 @@
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
|
@ -118,7 +118,7 @@
|
|||
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
@@ -385,7 +423,7 @@
|
||||
@@ -386,7 +424,7 @@
|
||||
}
|
||||
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
|
@ -127,7 +127,7 @@
|
|||
|
||||
Collections.shuffle(list);
|
||||
Iterator iterator1 = list.iterator();
|
||||
@@ -586,13 +624,19 @@
|
||||
@@ -591,13 +629,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -148,6 +148,35 @@
|
||||
@@ -150,6 +150,35 @@
|
||||
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -202,6 +231,21 @@
|
||||
@@ -207,6 +236,21 @@
|
||||
public int latency;
|
||||
public boolean wonGame;
|
||||
|
||||
|
@ -55,10 +55,10 @@
|
|||
+ public String kickLeaveMessage = null; // SPIGOT-3034: Forward leave message to PlayerQuitEvent
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile, profilepublickey);
|
||||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -264,12 +308,56 @@
|
||||
@@ -270,12 +314,56 @@
|
||||
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
|
||||
this.maxUpStep = 1.0F;
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
|
@ -116,7 +116,16 @@
|
|||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -327,17 +415,26 @@
|
||||
@@ -324,7 +412,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -343,17 +431,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
|
@ -139,12 +148,21 @@
|
|||
this.respawnForced = nbttagcompound.getBoolean("SpawnForced");
|
||||
this.respawnAngle = nbttagcompound.getFloat("SpawnAngle");
|
||||
if (nbttagcompound.contains("SpawnDimension")) {
|
||||
- DataResult dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
|
||||
+ DataResult<ResourceKey<World>> dataresult = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
- DataResult dataresult1 = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension"));
|
||||
+ DataResult<ResourceKey<World>> dataresult1 = World.RESOURCE_KEY_CODEC.parse(DynamicOpsNBT.INSTANCE, nbttagcompound.get("SpawnDimension")); // CraftBukkit - decompile error
|
||||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -364,7 +461,20 @@
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -366,7 +463,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
- DataResult dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker);
|
||||
+ DataResult<NBTBase> dataresult = WardenSpawnTracker.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.wardenSpawnTracker); // CraftBukkit - decompile error
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -387,7 +484,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
|
@ -166,16 +184,7 @@
|
|||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -382,7 +492,7 @@
|
||||
nbttagcompound.putInt("SpawnZ", this.respawnPosition.getZ());
|
||||
nbttagcompound.putBoolean("SpawnForced", this.respawnForced);
|
||||
nbttagcompound.putFloat("SpawnAngle", this.respawnAngle);
|
||||
- DataResult dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.respawnDimension.location());
|
||||
+ DataResult<NBTBase> dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.respawnDimension.location()); // CraftBukkit - decompile error
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -390,9 +500,33 @@
|
||||
@@ -412,9 +522,33 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
|
@ -209,7 +218,7 @@
|
|||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -451,6 +585,11 @@
|
||||
@@ -473,6 +607,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -219,9 +228,9 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
if (this.invulnerableTime > 0) {
|
||||
@@ -506,7 +645,7 @@
|
||||
@@ -529,7 +668,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
|
@ -230,7 +239,7 @@
|
|||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -537,6 +676,12 @@
|
||||
@@ -560,6 +699,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
|
@ -243,7 +252,7 @@
|
|||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -551,6 +696,20 @@
|
||||
@@ -574,6 +719,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
|
@ -264,7 +273,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -593,7 +752,8 @@
|
||||
@@ -616,7 +775,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
|
@ -274,7 +283,7 @@
|
|||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -602,9 +762,47 @@
|
||||
@@ -625,9 +785,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
|
@ -324,7 +333,7 @@
|
|||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -635,12 +833,18 @@
|
||||
@@ -658,12 +856,18 @@
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
|
@ -347,7 +356,7 @@
|
|||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -678,10 +882,12 @@
|
||||
@@ -701,10 +905,12 @@
|
||||
String s = this.getScoreboardName();
|
||||
String s1 = entity.getScoreboardName();
|
||||
|
||||
|
@ -362,7 +371,7 @@
|
|||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -699,7 +905,8 @@
|
||||
@@ -722,7 +928,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
|
@ -372,7 +381,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -743,18 +950,20 @@
|
||||
@@ -766,18 +973,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
|
@ -396,7 +405,7 @@
|
|||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -763,11 +972,20 @@
|
||||
@@ -786,11 +995,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -420,7 +429,7 @@
|
|||
this.unRide();
|
||||
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -778,6 +996,8 @@
|
||||
@@ -801,6 +1019,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
|
@ -428,8 +437,8 @@
|
|||
+ /*
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
|
||||
@@ -787,22 +1007,52 @@
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
@@ -810,20 +1030,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
|
@ -468,7 +477,7 @@
|
|||
+ if (true) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
+
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), true, this.getLastDeathLocation()));
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
|
@ -480,15 +489,12 @@
|
|||
- worldserver1.getProfiler().push("placing");
|
||||
+ // CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
- this.setRot(shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
- this.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z);
|
||||
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
+ this.connection.resetPosition(); // CraftBukkit - sync position after changing it (from PortalTravelAgent#findAndteleport)
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
this.triggerDimensionChangeTriggers(worldserver1);
|
||||
this.connection.send(new PacketPlayOutAbilities(this.getAbilities()));
|
||||
@@ -820,39 +1070,66 @@
|
||||
@@ -843,39 +1093,66 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -561,7 +567,7 @@
|
|||
}
|
||||
|
||||
return optional1;
|
||||
@@ -862,13 +1139,21 @@
|
||||
@@ -885,13 +1162,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level.dimension();
|
||||
|
@ -586,7 +592,7 @@
|
|||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -885,12 +1170,10 @@
|
||||
@@ -908,12 +1193,10 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
|
@ -602,7 +608,7 @@
|
|||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
} else if (!this.bedInRange(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
|
||||
@@ -914,7 +1197,36 @@
|
||||
@@ -937,7 +1220,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -640,7 +646,7 @@
|
|||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -927,9 +1239,8 @@
|
||||
@@ -950,9 +1262,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
|
@ -651,7 +657,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -956,6 +1267,24 @@
|
||||
@@ -979,6 +1290,24 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
|
@ -676,7 +682,7 @@
|
|||
if (this.isSleeping()) {
|
||||
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -1037,8 +1366,9 @@
|
||||
@@ -1060,8 +1389,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
|
||||
}
|
||||
|
||||
|
@ -687,7 +693,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1046,13 +1376,35 @@
|
||||
@@ -1069,13 +1399,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -723,7 +729,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1060,9 +1412,11 @@
|
||||
@@ -1083,9 +1435,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -737,7 +743,7 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1075,13 +1429,24 @@
|
||||
@@ -1098,13 +1452,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
|
@ -764,7 +770,7 @@
|
|||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1104,6 +1469,7 @@
|
||||
@@ -1127,6 +1492,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
|
@ -772,7 +778,7 @@
|
|||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1133,7 +1499,7 @@
|
||||
@@ -1157,7 +1523,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
|
@ -781,7 +787,7 @@
|
|||
scoreboardscore.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1141,7 +1507,7 @@
|
||||
@@ -1165,7 +1531,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
|
@ -790,7 +796,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1157,7 +1523,7 @@
|
||||
@@ -1181,7 +1547,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
|
@ -799,7 +805,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1192,6 +1558,7 @@
|
||||
@@ -1216,6 +1582,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
|
@ -807,7 +813,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1247,7 +1614,7 @@
|
||||
@@ -1274,7 +1641,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -816,7 +822,7 @@
|
|||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
||||
@@ -1390,7 +1757,20 @@
|
||||
@@ -1415,7 +1782,20 @@
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -837,16 +843,16 @@
|
|||
this.chatVisibility = packetplayinsettings.chatVisibility();
|
||||
this.canChatColor = packetplayinsettings.chatColors();
|
||||
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
|
||||
@@ -1461,7 +1841,7 @@
|
||||
@@ -1486,7 +1866,7 @@
|
||||
this.camera = (Entity) (entity == null ? this : entity);
|
||||
if (entity1 != this.camera) {
|
||||
this.connection.send(new PacketPlayOutCamera(this.camera));
|
||||
- this.teleportTo(this.camera.getX(), this.camera.getY(), this.camera.getZ());
|
||||
- this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot());
|
||||
+ this.connection.teleport(this.camera.getX(), this.camera.getY(), this.camera.getZ(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
|
||||
this.connection.resetPosition();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1490,7 +1870,7 @@
|
||||
@@ -1516,7 +1896,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
|
@ -855,7 +861,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1511,9 +1891,16 @@
|
||||
@@ -1537,9 +1917,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
|
@ -872,7 +878,7 @@
|
|||
if (worldserver == this.level) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1533,6 +1920,9 @@
|
||||
@@ -1559,6 +1946,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
|
@ -882,9 +888,9 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1702,4 +2092,146 @@
|
||||
}
|
||||
|
||||
@@ -1743,4 +2133,146 @@
|
||||
public RemoteChatSession getChatSession() {
|
||||
return this.chatSession;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -40,6 +40,12 @@
|
||||
@@ -42,6 +42,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
|||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -59,8 +65,12 @@
|
||||
private List<Entity> lastPassengers;
|
||||
private boolean wasRiding;
|
||||
@@ -63,8 +69,12 @@
|
||||
private boolean wasOnGround;
|
||||
@Nullable
|
||||
private List<DataWatcher.b<?>> trackedDataValues;
|
||||
+ // CraftBukkit start
|
||||
+ private final Set<ServerPlayerConnection> trackedPlayers;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -80,7 +90,7 @@
|
||||
@@ -85,7 +95,7 @@
|
||||
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
this.lastPassengers = list;
|
||||
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
Entity entity = this.entity;
|
||||
@@ -88,18 +98,18 @@
|
||||
@@ -93,18 +103,18 @@
|
||||
if (entity instanceof EntityItemFrame) {
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
|
||||
@@ -204,7 +214,27 @@
|
||||
@@ -209,7 +219,27 @@
|
||||
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
|
@ -88,7 +88,7 @@
|
|||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -219,13 +249,16 @@
|
||||
@@ -224,13 +254,16 @@
|
||||
PlayerConnection playerconnection = entityplayer.connection;
|
||||
|
||||
Objects.requireNonNull(entityplayer.connection);
|
||||
|
@ -107,8 +107,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
Packet<?> packet = this.entity.getAddEntityPacket();
|
||||
@@ -241,6 +274,12 @@
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
|
||||
@@ -246,6 +279,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
|
||||
|
||||
|
@ -121,7 +121,7 @@
|
|||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -272,8 +311,14 @@
|
||||
@@ -277,8 +316,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
|
@ -136,7 +136,7 @@
|
|||
if (this.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.entity;
|
||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||
@@ -314,6 +359,11 @@
|
||||
@@ -321,6 +366,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -103,6 +103,12 @@
|
||||
@@ -106,6 +106,12 @@
|
||||
import org.apache.commons.lang3.mutable.MutableObject;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -145,6 +151,27 @@
|
||||
@@ -149,6 +155,27 @@
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
int viewDistance;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -163,6 +190,11 @@
|
||||
@@ -167,6 +194,11 @@
|
||||
this.storageName = path.getFileName().toString();
|
||||
this.level = worldserver;
|
||||
this.generator = chunkgenerator;
|
||||
|
@ -50,10 +50,10 @@
|
|||
+ chunkgenerator = ((CustomChunkGenerator) chunkgenerator).getDelegate();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (chunkgenerator instanceof ChunkGeneratorAbstract) {
|
||||
ChunkGeneratorAbstract chunkgeneratorabstract = (ChunkGeneratorAbstract) chunkgenerator;
|
||||
IRegistryCustom iregistrycustom = worldserver.registryAccess();
|
||||
long j = worldserver.getSeed();
|
||||
|
||||
@@ -314,9 +346,12 @@
|
||||
@@ -326,9 +358,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
|
@ -68,7 +68,7 @@
|
|||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
|
||||
if (either == null) {
|
||||
@@ -521,7 +556,7 @@
|
||||
@@ -533,7 +568,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
|
@ -77,7 +77,7 @@
|
|||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -610,9 +645,9 @@
|
||||
@@ -622,9 +657,9 @@
|
||||
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
|
||||
|
||||
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
|
||||
|
@ -89,7 +89,7 @@
|
|||
}
|
||||
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
|
||||
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
|
||||
@@ -718,7 +753,21 @@
|
||||
@@ -730,7 +765,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -112,7 +112,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -817,7 +866,7 @@
|
||||
@@ -829,7 +878,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@
|
|||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -979,7 +1028,8 @@
|
||||
@@ -991,7 +1040,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -992,7 +1042,7 @@
|
||||
@@ -1004,7 +1054,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
|
@ -140,7 +140,7 @@
|
|||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -1008,12 +1058,14 @@
|
||||
@@ -1020,12 +1070,14 @@
|
||||
|
||||
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
|
||||
|
@ -158,7 +158,7 @@
|
|||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1434,7 +1486,7 @@
|
||||
@@ -1471,7 +1523,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
|
@ -167,7 +167,7 @@
|
|||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
|
||||
@@ -1493,6 +1545,11 @@
|
||||
@@ -1530,6 +1582,11 @@
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
public class PlayerInteractManager {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -56,6 +77,13 @@
|
||||
@@ -56,9 +77,16 @@
|
||||
if (enumgamemode == this.gameModeForPlayer) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -39,18 +39,13 @@
|
|||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setGameModeForPlayer(enumgamemode, this.gameModeForPlayer);
|
||||
this.setGameModeForPlayer(enumgamemode, this.previousGameModeForPlayer);
|
||||
this.player.onUpdateAbilities();
|
||||
- this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player));
|
||||
+ this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
|
||||
this.level.updateSleepingPlayerList();
|
||||
return true;
|
||||
}
|
||||
@@ -66,7 +94,7 @@
|
||||
this.gameModeForPlayer = enumgamemode;
|
||||
enumgamemode.updatePlayerAbilities(this.player.getAbilities());
|
||||
this.player.onUpdateAbilities();
|
||||
- this.player.server.getPlayerList().broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}));
|
||||
+ this.player.server.getPlayerList().broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_GAME_MODE, new EntityPlayer[]{this.player}), this.player); // CraftBukkit
|
||||
this.level.updateSleepingPlayerList();
|
||||
}
|
||||
|
||||
@@ -88,7 +116,7 @@
|
||||
}
|
||||
|
||||
|
@ -179,8 +174,7 @@
|
|||
+
|
||||
+ // Sword + Creative mode pre-cancel
|
||||
+ event.setCancelled(isSwordNoBreak);
|
||||
|
||||
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
|
||||
+
|
||||
+ // Calculate default block experience
|
||||
+ IBlockData nmsData = this.level.getBlockState(blockposition);
|
||||
+ Block nmsBlock = nmsData.getBlock();
|
||||
|
@ -199,7 +193,8 @@
|
|||
+ }
|
||||
+ // Let the client know the block still exists
|
||||
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+
|
||||
|
||||
- if (!this.player.getMainHandItem().getItem().canAttackBlock(iblockdata, this.level, blockposition, this.player)) {
|
||||
+ // Brute force all possible updates
|
||||
+ for (EnumDirection dir : EnumDirection.values()) {
|
||||
+ this.player.connection.send(new PacketPlayOutBlockChange(level, blockposition.relative(dir)));
|
||||
|
@ -257,20 +252,20 @@
|
|||
+ // CraftBukkit start
|
||||
+ if (event.isDropItems()) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, level.captureDrops);
|
||||
+ }
|
||||
}
|
||||
+ level.captureDrops = null;
|
||||
+
|
||||
+ // Drop event experience
|
||||
+ if (flag && event != null) {
|
||||
+ iblockdata.getBlock().popExperience(this.level, blockposition, event.getExpToDrop());
|
||||
}
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,12 +469,52 @@
|
||||
@@ -313,14 +469,54 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -286,7 +281,9 @@
|
|||
+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
|
||||
+ boolean cancelledBlock = false;
|
||||
|
||||
if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
if (!iblockdata.getBlock().isEnabled(world.enabledFeatures())) {
|
||||
return EnumInteractionResult.FAIL;
|
||||
} else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
ITileInventory itileinventory = iblockdata.getMenuProvider(world, blockposition);
|
||||
+ cancelledBlock = !(itileinventory instanceof ITileInventory);
|
||||
+ }
|
||||
|
@ -323,7 +320,7 @@
|
|||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openMenu(itileinventory);
|
||||
@@ -332,7 +528,7 @@
|
||||
@@ -334,7 +530,7 @@
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -332,7 +329,7 @@
|
|||
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
|
||||
@@ -340,17 +536,17 @@
|
||||
@@ -342,17 +538,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -353,7 +350,7 @@
|
|||
}
|
||||
|
||||
if (enuminteractionresult1.consumesAction()) {
|
||||
@@ -358,10 +554,10 @@
|
||||
@@ -360,10 +556,10 @@
|
||||
}
|
||||
|
||||
return enuminteractionresult1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
@@ -207,7 +207,7 @@
|
||||
@@ -208,7 +208,7 @@
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@
|
|||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
|
||||
|
||||
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
|
||||
@@ -326,6 +326,13 @@
|
||||
@@ -327,6 +327,13 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -153,6 +153,26 @@
|
||||
@@ -156,6 +156,26 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -170,7 +190,7 @@
|
||||
@@ -173,7 +193,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
|
@ -35,13 +35,13 @@
|
|||
+ public final WorldDataServer serverLevelData; // CraftBukkit - type
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
public boolean noSave;
|
||||
@@ -194,11 +214,28 @@
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
@@ -197,11 +217,28 @@
|
||||
private final StructureCheck structureCheck;
|
||||
private final boolean tickTime;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- Holder holder = worlddimension.typeHolder();
|
||||
- Holder holder = worlddimension.type();
|
||||
+ // CraftBukkit start
|
||||
+ public final Convertable.ConversionSession convertable;
|
||||
+ public final UUID uuid;
|
||||
|
@ -59,9 +59,9 @@
|
|||
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
|
||||
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ // Holder holder = worlddimension.typeHolder(); // CraftBukkit - decompile error
|
||||
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
+ super(iworlddataserver, resourcekey, worlddimension.typeHolder(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
|
||||
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
|
||||
+ this.pvpMode = minecraftserver.isPvpAllowed();
|
||||
+ convertable = convertable_conversionsession;
|
||||
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
||||
|
@ -69,7 +69,7 @@
|
|||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -213,6 +250,22 @@
|
||||
@@ -215,6 +252,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
|
@ -77,11 +77,11 @@
|
|||
+ serverLevelData.setWorld(this);
|
||||
+
|
||||
+ if (biomeProvider != null) {
|
||||
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(getWorld(), biomeProvider, server.registryHolder.registryOrThrow(IRegistry.BIOME_REGISTRY));
|
||||
+ WorldChunkManager worldChunkManager = new CustomWorldChunkManager(getWorld(), biomeProvider, server.registryAccess().registryOrThrow(Registries.BIOME));
|
||||
+ if (chunkgenerator instanceof ChunkGeneratorAbstract cga) {
|
||||
+ chunkgenerator = new ChunkGeneratorAbstract(cga.structureSets, cga.noises, worldChunkManager, cga.settings);
|
||||
+ chunkgenerator = new ChunkGeneratorAbstract(worldChunkManager, cga.settings);
|
||||
+ } else if (chunkgenerator instanceof ChunkProviderFlat cpf) {
|
||||
+ chunkgenerator = new ChunkProviderFlat(cpf.structureSets, cpf.settings(), worldChunkManager);
|
||||
+ chunkgenerator = new ChunkProviderFlat(cpf.settings(), worldChunkManager);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -92,26 +92,27 @@
|
|||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -244,14 +297,15 @@
|
||||
long l = minecraftserver.getWorldData().worldGenSettings().seed();
|
||||
@@ -246,15 +299,16 @@
|
||||
long l = minecraftserver.getWorldData().worldGenOptions().seed();
|
||||
|
||||
this.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
|
||||
- this.structureManager = new StructureManager(this, minecraftserver.getWorldData().worldGenSettings(), this.structureCheck);
|
||||
- this.structureManager = new StructureManager(this, minecraftserver.getWorldData().worldGenOptions(), this.structureCheck);
|
||||
- if (this.dimension() == World.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) {
|
||||
- this.dragonFight = new EnderDragonBattle(this, l, minecraftserver.getWorldData().endDragonFightData());
|
||||
+ this.structureManager = new StructureManager(this, this.serverLevelData.worldGenSettings(), structureCheck); // CraftBukkit
|
||||
+ this.structureManager = new StructureManager(this, this.serverLevelData.worldGenOptions(), structureCheck); // CraftBukkit
|
||||
+ if ((this.dimension() == World.END && this.dimensionTypeRegistration().is(BuiltinDimensionTypes.END)) || env == org.bukkit.World.Environment.THE_END) { // CraftBukkit - Allow to create EnderDragonBattle in default and custom END
|
||||
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.worldGenSettings().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
|
||||
+ this.dragonFight = new EnderDragonBattle(this, this.serverLevelData.worldGenOptions().seed(), this.serverLevelData.endDragonFightData()); // CraftBukkit
|
||||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
|
||||
this.sleepStatus = new SleepStatus();
|
||||
this.gameEventDispatcher = new GameEventDispatcher(this);
|
||||
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -283,12 +337,20 @@
|
||||
@@ -286,12 +340,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
|
@ -135,7 +136,7 @@
|
|||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -314,7 +376,7 @@
|
||||
@@ -317,7 +379,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
|
@ -144,7 +145,7 @@
|
|||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -330,7 +392,7 @@
|
||||
@@ -333,7 +395,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
|
@ -153,7 +154,7 @@
|
|||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -404,7 +466,7 @@
|
||||
@@ -405,7 +467,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
|
@ -162,24 +163,25 @@
|
|||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -431,14 +493,14 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
- this.addFreshEntity(entityhorseskeleton);
|
||||
+ this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
@@ -433,7 +495,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
- this.addFreshEntity(entityhorseskeleton);
|
||||
+ this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
EntityLightning entitylightning = (EntityLightning) EntityTypes.LIGHTNING_BOLT.create(this);
|
||||
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
- this.addFreshEntity(entitylightning);
|
||||
+ this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
|
||||
@@ -442,7 +504,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
- this.addFreshEntity(entitylightning);
|
||||
+ this.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.WEATHER); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -449,12 +511,12 @@
|
||||
@@ -456,7 +518,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
|
@ -188,13 +190,20 @@
|
|||
}
|
||||
|
||||
if (flag) {
|
||||
if (biomebase.shouldSnow(this, blockposition)) {
|
||||
- this.setBlockAndUpdate(blockposition, Blocks.SNOW.defaultBlockState());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
|
||||
@@ -471,10 +533,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
|
||||
- this.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, iblockdata1, null); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
- this.setBlockAndUpdate(blockposition, Blocks.SNOW.defaultBlockState());
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition, Blocks.SNOW.defaultBlockState(), null); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
IBlockData iblockdata = this.getBlockState(blockposition1);
|
||||
@@ -650,6 +712,7 @@
|
||||
@@ -671,6 +733,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -202,7 +211,7 @@
|
|||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -668,14 +731,47 @@
|
||||
@@ -689,14 +752,47 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
|
@ -252,7 +261,7 @@
|
|||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -710,6 +806,7 @@
|
||||
@@ -731,6 +827,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
|
@ -260,7 +269,7 @@
|
|||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -733,6 +830,7 @@
|
||||
@@ -754,6 +851,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
|
@ -268,7 +277,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -757,6 +855,7 @@
|
||||
@@ -778,6 +876,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -276,7 +285,7 @@
|
|||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -774,11 +873,19 @@
|
||||
@@ -795,11 +894,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -286,7 +295,7 @@
|
|||
+
|
||||
+ serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||
+ serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
|
||||
+ convertable.saveDataTag(this.server.registryHolder, this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
||||
+ convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -297,7 +306,7 @@
|
|||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -824,15 +931,37 @@
|
||||
@@ -864,15 +971,37 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
@ -338,7 +347,7 @@
|
|||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -863,24 +992,37 @@
|
||||
@@ -903,24 +1032,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
|
@ -380,7 +389,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -894,10 +1036,32 @@
|
||||
@@ -934,10 +1076,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
|
@ -413,7 +422,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -906,6 +1070,12 @@
|
||||
@@ -946,6 +1110,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
|
@ -426,22 +435,7 @@
|
|||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -942,6 +1112,14 @@
|
||||
public void gameEvent(GameEvent gameevent, Vec3D vec3d, GameEvent.a gameevent_a) {
|
||||
int i = gameevent.getNotificationRadius();
|
||||
BlockPosition blockposition = new BlockPosition(vec3d);
|
||||
+ // CraftBukkit start
|
||||
+ GenericGameEvent event = new GenericGameEvent(org.bukkit.GameEvent.getByKey(CraftNamespacedKey.fromMinecraft(IRegistry.GAME_EVENT.getKey(gameevent))), new Location(this.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ()), (gameevent_a.sourceEntity() == null) ? null : gameevent_a.sourceEntity().getBukkitEntity(), i, !Bukkit.isPrimaryThread());
|
||||
+ getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ i = event.getRadius();
|
||||
+ // CraftBukkit end
|
||||
int j = SectionPosition.blockToSectionCoord(blockposition.getX() - i);
|
||||
int k = SectionPosition.blockToSectionCoord(blockposition.getY() - i);
|
||||
int l = SectionPosition.blockToSectionCoord(blockposition.getZ() - i);
|
||||
@@ -1014,7 +1192,18 @@
|
||||
@@ -1005,7 +1175,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -461,28 +455,19 @@
|
|||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1070,10 +1259,20 @@
|
||||
|
||||
@@ -1062,6 +1243,11 @@
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) {
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
|
||||
+ // CraftBukkit start
|
||||
+ Explosion explosion = super.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, explosion_effect);
|
||||
+
|
||||
+ if (explosion.wasCanceled) {
|
||||
+ return explosion;
|
||||
+ }
|
||||
+
|
||||
+ /* Remove
|
||||
Explosion explosion = new Explosion(this, entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, explosion_effect);
|
||||
+ // CraftBukkit end
|
||||
|
||||
explosion.explode();
|
||||
explosion.finalizeExplosion(false);
|
||||
+ */
|
||||
+ // CraftBukkit end - TODO: Check if explosions are still properly implemented
|
||||
if (explosion_effect == Explosion.Effect.NONE) {
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
@@ -1145,13 +1344,20 @@
|
||||
@@ -1134,13 +1320,20 @@
|
||||
}
|
||||
|
||||
public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
|
||||
|
@ -505,16 +490,16 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1202,7 +1408,7 @@
|
||||
@@ -1191,7 +1384,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
- if (!this.server.getWorldData().worldGenSettings().generateStructures()) {
|
||||
+ if (!this.serverLevelData.worldGenSettings().generateStructures()) { // CraftBukkit
|
||||
- if (!this.server.getWorldData().worldGenOptions().generateStructures()) {
|
||||
+ if (!this.serverLevelData.worldGenOptions().generateStructures()) { // CraftBukkit
|
||||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(IRegistry.STRUCTURE_REGISTRY).getTag(tagkey);
|
||||
@@ -1244,11 +1450,21 @@
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1233,11 +1426,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
|
@ -537,7 +522,7 @@
|
|||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1546,6 +1762,11 @@
|
||||
@@ -1535,6 +1738,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
|
@ -549,22 +534,22 @@
|
|||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1565,12 +1786,12 @@
|
||||
@@ -1554,12 +1762,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
- return this.server.getWorldData().worldGenSettings().isFlatWorld();
|
||||
+ return this.serverLevelData.worldGenSettings().isFlatWorld(); // CraftBukkit
|
||||
- return this.server.getWorldData().isFlatWorld();
|
||||
+ return this.serverLevelData.isFlatWorld(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSeed() {
|
||||
- return this.server.getWorldData().worldGenSettings().seed();
|
||||
+ return this.serverLevelData.worldGenSettings().seed(); // CraftBukkit
|
||||
- return this.server.getWorldData().worldGenOptions().seed();
|
||||
+ return this.serverLevelData.worldGenOptions().seed(); // CraftBukkit
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1593,7 +1814,7 @@
|
||||
@@ -1582,7 +1790,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
|
@ -573,7 +558,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1602,7 +1823,7 @@
|
||||
@@ -1591,7 +1799,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
|
@ -582,7 +567,7 @@
|
|||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1613,17 +1834,33 @@
|
||||
@@ -1602,17 +1810,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
|
@ -618,7 +603,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1734,6 +1971,7 @@
|
||||
@@ -1728,6 +1952,7 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
|
@ -626,7 +611,7 @@
|
|||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1770,6 +2008,14 @@
|
||||
@@ -1764,6 +1989,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
MinecraftServer minecraftserver = this.serverConnectionListener.getServer();
|
||||
int i = bytebuf.readableBytes();
|
||||
String s;
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.previewsChat(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
+ org.bukkit.event.server.ServerListPingEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(minecraftserver.server, inetsocketaddress.getAddress(), minecraftserver.getMotd(), minecraftserver.getPlayerCount(), minecraftserver.getMaxPlayers()); // CraftBukkit
|
||||
|
||||
switch (i) {
|
||||
case 0:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -41,6 +41,12 @@
|
||||
@@ -38,6 +38,12 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -10,10 +10,10 @@
|
|||
+import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class LoginListener implements TickablePacketListener, PacketLoginInListener {
|
||||
public class LoginListener implements PacketLoginInListener, TickablePacketListener {
|
||||
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
@@ -88,6 +94,13 @@
|
||||
@@ -83,6 +89,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -27,13 +27,13 @@
|
|||
@Override
|
||||
public NetworkManager getConnection() {
|
||||
return this.connection;
|
||||
@@ -123,10 +136,12 @@
|
||||
}
|
||||
@@ -104,10 +117,12 @@
|
||||
this.gameProfile = this.createFakeProfile(this.gameProfile);
|
||||
}
|
||||
|
||||
- IChatBaseComponent ichatbasecomponent = this.server.getPlayerList().canPlayerLogin(this.connection.getRemoteAddress(), this.gameProfile);
|
||||
+ // CraftBukkit start - fire PlayerLoginEvent
|
||||
+ EntityPlayer s = this.server.getPlayerList().canPlayerLogin(this, this.gameProfile, profilepublickey);
|
||||
+ EntityPlayer s = this.server.getPlayerList().canPlayerLogin(this, this.gameProfile);
|
||||
|
||||
- if (ichatbasecomponent != null) {
|
||||
- this.disconnect(ichatbasecomponent);
|
||||
|
@ -43,25 +43,16 @@
|
|||
} else {
|
||||
this.state = LoginListener.EnumProtocolState.ACCEPTED;
|
||||
if (this.server.getCompressionThreshold() >= 0 && !this.connection.isMemoryConnection()) {
|
||||
@@ -139,7 +154,7 @@
|
||||
@@ -120,7 +135,7 @@
|
||||
EntityPlayer entityplayer = this.server.getPlayerList().getPlayer(this.gameProfile.getId());
|
||||
|
||||
try {
|
||||
- EntityPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, profilepublickey);
|
||||
- EntityPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile);
|
||||
+ EntityPlayer entityplayer1 = this.server.getPlayerList().getPlayerForLogin(this.gameProfile, s); // CraftBukkit - add player reference
|
||||
|
||||
if (entityplayer != null) {
|
||||
this.state = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
@@ -188,7 +203,7 @@
|
||||
public void handleHello(PacketLoginInStart packetlogininstart) {
|
||||
Validate.validState(this.state == LoginListener.EnumProtocolState.HELLO, "Unexpected hello packet", new Object[0]);
|
||||
Validate.validState(isValidUsername(packetlogininstart.name()), "Invalid characters in username", new Object[0]);
|
||||
- this.profilePublicKeyData = (ProfilePublicKey.a) packetlogininstart.publicKey().orElse((Object) null);
|
||||
+ this.profilePublicKeyData = (ProfilePublicKey.a) packetlogininstart.publicKey().orElse(null); // CraftBukkit - decompile error
|
||||
GameProfile gameprofile = this.server.getSingleplayerProfile();
|
||||
|
||||
if (gameprofile != null && packetlogininstart.name().equalsIgnoreCase(gameprofile.getName())) {
|
||||
@@ -249,6 +264,43 @@
|
||||
@@ -210,6 +225,43 @@
|
||||
try {
|
||||
LoginListener.this.gameProfile = LoginListener.this.server.getSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.getAddress());
|
||||
if (LoginListener.this.gameProfile != null) {
|
||||
|
@ -105,7 +96,7 @@
|
|||
LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.gameProfile.getName(), LoginListener.this.gameProfile.getId());
|
||||
LoginListener.this.state = LoginListener.EnumProtocolState.READY_TO_ACCEPT;
|
||||
} else if (LoginListener.this.server.isSingleplayer()) {
|
||||
@@ -268,6 +320,11 @@
|
||||
@@ -229,6 +281,11 @@
|
||||
LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
private static final IChatBaseComponent DISCONNECT_REASON = IChatBaseComponent.translatable("multiplayer.status.request_handled");
|
||||
@@ -35,7 +47,103 @@
|
||||
@@ -35,7 +47,102 @@
|
||||
this.connection.disconnect(PacketStatusListener.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
|
@ -32,7 +32,7 @@
|
|||
+ CraftIconCache icon = server.server.getServerIcon();
|
||||
+
|
||||
+ ServerListPingEvent() {
|
||||
+ super(connection.hostname, ((InetSocketAddress) connection.getRemoteAddress()).getAddress(), server.getMotd(), server.previewsChat(), server.getPlayerList().getMaxPlayers());
|
||||
+ super(connection.hostname, ((InetSocketAddress) connection.getRemoteAddress()).getAddress(), server.getMotd(), server.getPlayerList().getMaxPlayers());
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -112,7 +112,6 @@
|
|||
+ }
|
||||
+
|
||||
+ ServerPing ping = new ServerPing();
|
||||
+ ping.setPreviewsChat(event.shouldSendChatPreviews());
|
||||
+ ping.setFavicon(event.icon.value);
|
||||
+ ping.setDescription(CraftChatMessage.fromString(event.getMotd(), true)[0]);
|
||||
+ ping.setPlayers(playerSample);
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -184,6 +184,67 @@
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -182,6 +182,67 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.datafixers.util.Pair;
|
||||
+import java.util.Arrays;
|
||||
+import java.util.concurrent.ExecutionException;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+import net.minecraft.network.chat.OutgoingPlayerChatMessage;
|
||||
+import net.minecraft.network.chat.OutgoingChatMessage;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnPosition;
|
||||
+import net.minecraft.world.entity.EntityInsentient;
|
||||
|
@ -68,7 +68,7 @@
|
|||
public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -199,7 +260,9 @@
|
||||
@@ -198,7 +259,9 @@
|
||||
private long keepAliveTime;
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
|
@ -79,13 +79,12 @@
|
|||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -250,8 +313,32 @@
|
||||
this.signedMessageDecoder = SignedMessageChain.a.UNSIGNED;
|
||||
}
|
||||
|
||||
@@ -244,8 +307,31 @@
|
||||
this.keepAliveTime = SystemUtils.getMillis();
|
||||
entityplayer.getTextFilter().join();
|
||||
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
|
||||
- this.chatMessageChain = new FutureChain(minecraftserver);
|
||||
+ this.chatMessageChain = new FutureChain(minecraftserver.chatExecutor); // CraftBukkit - async chat
|
||||
+
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ this.cserver = minecraftserver.server;
|
||||
+ }
|
||||
|
@ -113,7 +112,7 @@
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -306,7 +393,7 @@
|
||||
@@ -300,7 +386,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
|
@ -122,7 +121,7 @@
|
|||
if (this.keepAlivePending) {
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.timeout"));
|
||||
} else {
|
||||
@@ -318,15 +405,21 @@
|
||||
@@ -312,15 +398,21 @@
|
||||
}
|
||||
|
||||
this.server.getProfiler().pop();
|
||||
|
@ -144,7 +143,7 @@
|
|||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -351,16 +444,67 @@
|
||||
@@ -344,16 +436,67 @@
|
||||
return this.server.isSingleplayerOwner(this.player.getGameProfile());
|
||||
}
|
||||
|
||||
|
@ -213,7 +212,7 @@
|
|||
}
|
||||
|
||||
private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
|
||||
@@ -424,7 +568,34 @@
|
||||
@@ -417,7 +560,34 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
|
@ -249,7 +248,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.connection.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -456,14 +627,72 @@
|
||||
@@ -449,14 +619,72 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
|
@ -322,7 +321,7 @@
|
|||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
|
||||
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
|
||||
@@ -497,6 +726,7 @@
|
||||
@@ -490,6 +718,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
|
@ -330,7 +329,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -504,7 +734,7 @@
|
||||
@@ -497,7 +726,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
|
||||
|
@ -339,7 +338,7 @@
|
|||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -534,6 +764,12 @@
|
||||
@@ -527,6 +756,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
|
||||
|
@ -352,7 +351,7 @@
|
|||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -543,6 +779,7 @@
|
||||
@@ -536,6 +771,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
|
@ -360,7 +359,7 @@
|
|||
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -792,6 +1029,13 @@
|
||||
@@ -785,6 +1021,13 @@
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
|
@ -374,7 +373,7 @@
|
|||
|
||||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
@@ -806,6 +1050,13 @@
|
||||
@@ -799,6 +1042,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
|
@ -388,7 +387,7 @@
|
|||
int i = packetplayinbedit.getSlot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -814,7 +1065,7 @@
|
||||
@@ -807,7 +1057,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
|
@ -397,7 +396,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -832,7 +1083,7 @@
|
||||
@@ -825,7 +1075,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
|
@ -406,7 +405,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -857,16 +1108,16 @@
|
||||
@@ -850,16 +1100,16 @@
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
|
||||
|
@ -427,7 +426,7 @@
|
|||
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
|
||||
});
|
||||
|
||||
@@ -892,6 +1143,7 @@
|
||||
@@ -885,6 +1135,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
|
@ -435,7 +434,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -928,7 +1180,7 @@
|
||||
@@ -921,7 +1172,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
|
||||
|
@ -444,7 +443,7 @@
|
|||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -938,7 +1190,7 @@
|
||||
@@ -931,7 +1182,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
|
@ -453,7 +452,7 @@
|
|||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
|
||||
@@ -950,7 +1202,15 @@
|
||||
@@ -943,7 +1194,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
|
@ -469,7 +468,7 @@
|
|||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -970,15 +1230,33 @@
|
||||
@@ -963,15 +1222,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
|
@ -505,7 +504,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d7, d8, d9});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -999,6 +1277,7 @@
|
||||
@@ -992,6 +1269,7 @@
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
|
||||
|
@ -513,12 +512,13 @@
|
|||
double d12 = d8;
|
||||
|
||||
d7 = d0 - this.player.getX();
|
||||
@@ -1018,8 +1297,71 @@
|
||||
@@ -1011,9 +1289,72 @@
|
||||
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) {
|
||||
- this.teleport(d3, d4, d5, f, f1);
|
||||
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet(), false); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
} else {
|
||||
+ // CraftBukkit start - fire PlayerMoveEvent
|
||||
+ // Rest to old location first
|
||||
|
@ -586,7 +586,7 @@
|
|||
this.clientIsFloating = d12 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
@@ -1058,19 +1400,80 @@
|
||||
@@ -1052,19 +1393,80 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -612,9 +612,8 @@
|
|||
public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set) {
|
||||
- this.teleport(d0, d1, d2, f, f1, set, false);
|
||||
+ this.teleport(d0, d1, d2, f, f1, set, PlayerTeleportEvent.TeleportCause.UNKNOWN);
|
||||
}
|
||||
|
||||
- public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
|
||||
+ }
|
||||
+
|
||||
+ public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ this.teleport(d0, d1, d2, f, f1, set, false, cause);
|
||||
+ }
|
||||
|
@ -655,8 +654,9 @@
|
|||
+
|
||||
+ public void teleport(Location dest) {
|
||||
+ internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.<PacketPlayOutPosition.EnumPlayerTeleportFlags>emptySet(), true);
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
- public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
|
||||
+ private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
|
||||
+ // CraftBukkit start
|
||||
+ if (Float.isNaN(f)) {
|
||||
|
@ -671,7 +671,7 @@
|
|||
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.getX() : 0.0D;
|
||||
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.getY() : 0.0D;
|
||||
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.getZ() : 0.0D;
|
||||
@@ -1082,6 +1485,14 @@
|
||||
@@ -1076,6 +1478,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
|
@ -686,7 +686,7 @@
|
|||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport, flag));
|
||||
@@ -1090,6 +1501,7 @@
|
||||
@@ -1084,6 +1494,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
|
||||
|
@ -694,7 +694,7 @@
|
|||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1100,14 +1512,46 @@
|
||||
@@ -1094,14 +1505,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
|
@ -743,7 +743,7 @@
|
|||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1145,6 +1589,7 @@
|
||||
@@ -1139,6 +1582,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
|
||||
|
@ -751,15 +751,15 @@
|
|||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1166,6 +1611,7 @@
|
||||
@@ -1162,6 +1606,7 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1193,6 +1639,7 @@
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1190,6 +1635,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
|
||||
|
@ -767,10 +767,10 @@
|
|||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1200,6 +1647,49 @@
|
||||
@@ -1197,6 +1643,49 @@
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty()) {
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
+ // CraftBukkit start
|
||||
+ // Raytrace to look for 'rogue armswings'
|
||||
+ float f1 = this.player.getXRot();
|
||||
|
@ -817,7 +817,7 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1220,7 +1710,7 @@
|
||||
@@ -1217,7 +1706,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -826,7 +826,7 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1235,6 +1725,7 @@
|
||||
@@ -1232,6 +1721,7 @@
|
||||
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
|
@ -834,7 +834,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1254,11 +1745,26 @@
|
||||
@@ -1251,12 +1741,27 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
|
@ -845,6 +845,7 @@
|
|||
+ this.processedDisconnect = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.chatMessageChain.close();
|
||||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
|
||||
+ // CraftBukkit start - Replace vanilla quit message handling with our own.
|
||||
+ /*
|
||||
|
@ -862,7 +863,7 @@
|
|||
this.player.getTextFilter().leave();
|
||||
if (this.isSingleplayerOwner()) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
@@ -1281,6 +1787,15 @@
|
||||
@@ -1279,6 +1784,15 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
|
@ -878,7 +879,7 @@
|
|||
try {
|
||||
this.connection.send(packet, packetsendlistener);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1297,7 +1812,16 @@
|
||||
@@ -1295,7 +1809,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
|
||||
|
@ -895,7 +896,7 @@
|
|||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1306,16 +1830,23 @@
|
||||
@@ -1304,18 +1827,25 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -914,31 +915,31 @@
|
|||
if (isChatMessageIllegal(packetplayinchat.message())) {
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
} else {
|
||||
if (this.tryHandleChat(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.lastSeenMessages())) {
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.lastSeenMessages());
|
||||
|
||||
if (optional.isPresent()) {
|
||||
- this.server.submit(() -> {
|
||||
+ // this.server.submit(() -> { // CraftBukkit - async chat
|
||||
PlayerChatMessage playerchatmessage = this.getSignedMessage(packetplayinchat);
|
||||
PlayerChatMessage playerchatmessage;
|
||||
|
||||
if (this.verifyChatMessage(playerchatmessage)) {
|
||||
@@ -1328,10 +1859,10 @@
|
||||
PlayerChatMessage playerchatmessage1 = ((PlayerChatMessage) completablefuture1.join()).filter(filtermask);
|
||||
try {
|
||||
@@ -1333,9 +1863,9 @@
|
||||
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask());
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
- }, this.server);
|
||||
+ }, this.server.chatExecutor); // CraftBukkit - async chat
|
||||
});
|
||||
}
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
- }, executor);
|
||||
+ }, this.server.chatExecutor); // CraftBukkit - async chat
|
||||
});
|
||||
- });
|
||||
+ // }); // CraftBukkit - async chat
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1353,8 +1884,21 @@
|
||||
@@ -1359,12 +1889,25 @@
|
||||
}
|
||||
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket) {
|
||||
- ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(serverboundchatcommandpacket.command());
|
||||
- Map<String, PlayerChatMessage> map = this.collectSignedArguments(serverboundchatcommandpacket, PreviewableCommand.of(parseresults));
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
|
||||
- ParseResults parseresults = this.parseCommand(serverboundchatcommandpacket.command());
|
||||
+ // CraftBukkit start
|
||||
+ String command = "/" + serverboundchatcommandpacket.command();
|
||||
+ PlayerConnection.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
||||
|
@ -951,31 +952,40 @@
|
|||
+ }
|
||||
+ command = event.getMessage().substring(1);
|
||||
+
|
||||
+ ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(command);
|
||||
+ Map<String, PlayerChatMessage> map = (serverboundchatcommandpacket.command().equals(command)) ? this.collectSignedArguments(serverboundchatcommandpacket, PreviewableCommand.of(parseresults)) : Collections.emptyMap();
|
||||
+ ParseResults parseresults = this.parseCommand(command);
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator = map.values().iterator();
|
||||
|
||||
PlayerChatMessage playerchatmessage;
|
||||
@@ -1366,7 +1910,7 @@
|
||||
parseresults = CommandDispatcher.mapSource(parseresults, (commandlistenerwrapper) -> {
|
||||
return commandlistenerwrapper.withSigningContext(commandsigningcontext_a);
|
||||
});
|
||||
- this.server.getCommands().performCommand(parseresults, serverboundchatcommandpacket.command());
|
||||
+ this.server.getCommands().performCommand(parseresults, command); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
Map map;
|
||||
|
||||
@@ -1415,7 +1959,7 @@
|
||||
try {
|
||||
- map = this.collectSignedArguments(serverboundchatcommandpacket, SignableCommand.of(parseresults), lastseenmessages);
|
||||
+ map = (serverboundchatcommandpacket.command().equals(command)) ? this.collectSignedArguments(serverboundchatcommandpacket, SignableCommand.of(parseresults), lastseenmessages) : Collections.emptyMap(); // CraftBukkit
|
||||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1372,10 +1915,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
- parseresults = CommandDispatcher.mapSource(parseresults, (commandlistenerwrapper) -> {
|
||||
+ parseresults = CommandDispatcher.<CommandListenerWrapper>mapSource(parseresults, (commandlistenerwrapper) -> { // CraftBukkit - decompile error
|
||||
return commandlistenerwrapper.withSigningContext(commandsigningcontext_a);
|
||||
});
|
||||
- this.server.getCommands().performCommand(parseresults, serverboundchatcommandpacket.command());
|
||||
+ this.server.getCommands().performCommand(parseresults, command); // CraftBukkit
|
||||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1413,7 +1956,7 @@
|
||||
PlayerConnection.LOGGER.warn("{} sent out-of-order chat: '{}'", this.player.getName().getString(), s);
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.out_of_order_chat"));
|
||||
return false;
|
||||
return Optional.empty();
|
||||
- } else if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ } else if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return false;
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1459,6 +2003,135 @@
|
||||
@@ -1462,6 +2005,122 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -984,7 +994,7 @@
|
|||
+ if (s.isEmpty() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ return;
|
||||
+ }
|
||||
+ OutgoingPlayerChatMessage outgoing = OutgoingPlayerChatMessage.create(original);
|
||||
+ OutgoingChatMessage outgoing = OutgoingChatMessage.create(original);
|
||||
+
|
||||
+ if (!async && s.startsWith("/")) {
|
||||
+ this.handleCommand(s);
|
||||
|
@ -1006,9 +1016,6 @@
|
|||
+ org.bukkit.Bukkit.getPluginManager().callEvent(queueEvent);
|
||||
+
|
||||
+ if (queueEvent.isCancelled()) {
|
||||
+ if (outgoing != null) {
|
||||
+ outgoing.sendHeadersToRemainingPlayers(PlayerConnection.this.server.getPlayerList());
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
|
@ -1017,7 +1024,7 @@
|
|||
+ if (originalFormat.equals(queueEvent.getFormat()) && originalMessage.equals(queueEvent.getMessage()) && queueEvent.getPlayer().getName().equalsIgnoreCase(queueEvent.getPlayer().getDisplayName())) {
|
||||
+ PlayerConnection.this.server.getPlayerList().broadcastChatMessage(original, PlayerConnection.this.player, ChatMessageType.bind(ChatMessageType.CHAT, (Entity) PlayerConnection.this.player));
|
||||
+ return null;
|
||||
+ } else if (CraftChatMessage.fromComponent(original.serverContent()).equals(message)) {
|
||||
+ } else if (CraftChatMessage.fromComponent(original.decoratedContent()).equals(message)) {
|
||||
+ PlayerConnection.this.server.getPlayerList().broadcastChatMessage(original, PlayerConnection.this.player, ChatMessageType.bind(ChatMessageType.RAW, (Entity) PlayerConnection.this.player));
|
||||
+ return null;
|
||||
+ }
|
||||
|
@ -1032,9 +1039,6 @@
|
|||
+ }
|
||||
+ PlayerConnection.this.server.console.sendMessage(message);
|
||||
+
|
||||
+ if (outgoing != null) {
|
||||
+ outgoing.sendHeadersToRemainingPlayers(PlayerConnection.this.server.getPlayerList());
|
||||
+ }
|
||||
+ return null;
|
||||
+ }};
|
||||
+ if (async) {
|
||||
|
@ -1051,9 +1055,6 @@
|
|||
+ }
|
||||
+ } else {
|
||||
+ if (event.isCancelled()) {
|
||||
+ if (outgoing != null) {
|
||||
+ outgoing.sendHeadersToRemainingPlayers(PlayerConnection.this.server.getPlayerList());
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
|
@ -1062,7 +1063,7 @@
|
|||
+ if (originalFormat.equals(event.getFormat()) && originalMessage.equals(event.getMessage()) && event.getPlayer().getName().equalsIgnoreCase(event.getPlayer().getDisplayName())) {
|
||||
+ PlayerConnection.this.server.getPlayerList().broadcastChatMessage(original, PlayerConnection.this.player, ChatMessageType.bind(ChatMessageType.CHAT, (Entity) PlayerConnection.this.player));
|
||||
+ return;
|
||||
+ } else if (CraftChatMessage.fromComponent(original.serverContent()).equals(s)) {
|
||||
+ } else if (CraftChatMessage.fromComponent(original.decoratedContent()).equals(s)) {
|
||||
+ PlayerConnection.this.server.getPlayerList().broadcastChatMessage(original, PlayerConnection.this.player, ChatMessageType.bind(ChatMessageType.RAW, (Entity) PlayerConnection.this.player));
|
||||
+ return;
|
||||
+ }
|
||||
|
@ -1076,10 +1077,6 @@
|
|||
+ }
|
||||
+ }
|
||||
+ server.console.sendMessage(s);
|
||||
+
|
||||
+ if (outgoing != null) {
|
||||
+ outgoing.sendHeadersToRemainingPlayers(PlayerConnection.this.server.getPlayerList());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
|
@ -1108,22 +1105,19 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat) {
|
||||
MessageSigner messagesigner = packetplayinchat.getSigner(this.player);
|
||||
SignedMessageChain.c signedmessagechain_c = new SignedMessageChain.c(packetplayinchat.signature());
|
||||
@@ -1475,7 +2148,28 @@
|
||||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1469,13 +2128,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
- this.server.getPlayerList().broadcastChatMessage(playerchatmessage, this.player, ChatMessageType.bind(ChatMessageType.CHAT, (Entity) this.player));
|
||||
+ // CraftBukkit start
|
||||
+ String s = playerchatmessage.signedContent().plain();
|
||||
+ String s = playerchatmessage.signedContent();
|
||||
+ if (s.isEmpty()) {
|
||||
+ LOGGER.warn(this.player.getScoreboardName() + " tried to send an empty message");
|
||||
+ } else if (getCraftPlayer().isConversing()) {
|
||||
+ OutgoingPlayerChatMessage outgoing = OutgoingPlayerChatMessage.create(playerchatmessage);
|
||||
+ outgoing.sendHeadersToRemainingPlayers(this.server.getPlayerList());
|
||||
+
|
||||
+ final String conversationInput = s;
|
||||
+ this.server.processQueue.add(new Runnable() {
|
||||
+ @Override
|
||||
|
@ -1141,9 +1135,6 @@
|
|||
this.detectRateSpam();
|
||||
}
|
||||
|
||||
@@ -1503,8 +2197,10 @@
|
||||
}
|
||||
|
||||
private void detectRateSpam() {
|
||||
- this.chatSpamTickCount += 20;
|
||||
- if (this.chatSpamTickCount > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
|
@ -1154,30 +1145,7 @@
|
|||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1568,7 +2264,7 @@
|
||||
List<PreviewableCommand.a<CommandListenerWrapper>> list = previewablecommand.arguments();
|
||||
|
||||
if (list.isEmpty()) {
|
||||
- return CompletableFuture.completedFuture((Object) null);
|
||||
+ return CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
for (int i = list.size() - 1; i >= 0; --i) {
|
||||
PreviewableCommand.a previewablecommand_a = (PreviewableCommand.a) list.get(i);
|
||||
@@ -1580,11 +2276,11 @@
|
||||
return completablefuture;
|
||||
}
|
||||
} catch (CommandSyntaxException commandsyntaxexception) {
|
||||
- return CompletableFuture.completedFuture((Object) null);
|
||||
+ return CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
- return CompletableFuture.completedFuture((Object) null);
|
||||
+ return CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1611,13 +2307,59 @@
|
||||
@@ -1497,13 +2176,59 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel());
|
||||
|
@ -1237,71 +1205,73 @@
|
|||
this.player.resetLastActionTime();
|
||||
IJumpable ijumpable;
|
||||
|
||||
@@ -1702,6 +2444,7 @@
|
||||
@@ -1594,6 +2319,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
final WorldServer worldserver = this.player.getLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1714,10 +2457,49 @@
|
||||
@@ -1606,13 +2332,51 @@
|
||||
|
||||
if (entity.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
|
||||
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(enumhand).copy();
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemInHand = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
+ boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient;
|
||||
+ Item origItem = player.getInventory().getSelected() == null ? null : player.getInventory().getSelected().getItem();
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemInHand = PlayerConnection.this.player.getItemInHand(enumhand);
|
||||
+ boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient;
|
||||
+ Item origItem = player.getInventory().getSelected() == null ? null : player.getInventory().getSelected().getItem();
|
||||
+
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ // Entity in bucket - SPIGOT-4048 and SPIGOT-6859
|
||||
+ if ((entity instanceof Bucketable && entity instanceof EntityLiving && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ send(new PacketPlayOutSpawnEntity(entity));
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+
|
||||
+ if (triggerLeashUpdate && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ // Refresh the current leash state
|
||||
+ send(new PacketPlayOutAttachEntity(entity, ((EntityInsentient) entity).getLeashHolder()));
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem) {
|
||||
+ // Refresh the current entity metadata
|
||||
+ send(new PacketPlayOutEntityMetadata(entity.getId(), entity.getEntityData(), true));
|
||||
+ // SPIGOT-7136 - Allays
|
||||
+ if (entity instanceof Allay) {
|
||||
+ send(new PacketPlayOutEntityEquipment(entity.getId(), Arrays.stream(EnumItemSlot.values()).map((slot) -> Pair.of(slot, ((EntityLiving) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
+ // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
+ if ((entity instanceof Bucketable && entity instanceof EntityLiving && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ send(new PacketPlayOutSpawnEntity(entity));
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ if (triggerLeashUpdate && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ // Refresh the current leash state
|
||||
+ send(new PacketPlayOutAttachEntity(entity, ((EntityInsentient) entity).getLeashHolder()));
|
||||
+ }
|
||||
+
|
||||
EnumInteractionResult enuminteractionresult = playerconnection_a.run(PlayerConnection.this.player, entity, enumhand);
|
||||
+ if (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem) {
|
||||
+ // Refresh the current entity metadata
|
||||
+ entity.getEntityData().refresh(player);
|
||||
+ // SPIGOT-7136 - Allays
|
||||
+ if (entity instanceof Allay) {
|
||||
+ send(new PacketPlayOutEntityEquipment(entity.getId(), Arrays.stream(EnumItemSlot.values()).map((slot) -> Pair.of(slot, ((EntityLiving) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumInteractionResult enuminteractionresult = playerconnection_a.run(PlayerConnection.this.player, entity, enumhand);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1729,20 +2511,27 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1625,23 +2389,29 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
- this.performInteraction(enumhand, EntityHuman::interactOn);
|
||||
+ this.performInteraction(enumhand, EntityHuman::interactOn, new PlayerInteractEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
|
||||
+ this.performInteraction(enumhand, EntityHuman::interactOn, new PlayerInteractEntityEvent(getCraftPlayer(), entity.getBukkitEntity(), (enumhand == EnumHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND)); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1315,19 +1285,21 @@
|
|||
@Override
|
||||
public void onAttack() {
|
||||
- if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && !(entity instanceof EntityArrow) && entity != PlayerConnection.this.player) {
|
||||
+ // CraftBukkit start
|
||||
+ // CraftBukkit
|
||||
+ if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && !(entity instanceof EntityArrow) && (entity != PlayerConnection.this.player || player.isSpectator())) {
|
||||
+ ItemStack itemInHand = PlayerConnection.this.player.getMainHandItem();
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
+
|
||||
+ if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemstack.isEmpty() && itemstack.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
PlayerConnection.LOGGER.warn("Player {} tried to attack an invalid entity", PlayerConnection.this.player.getName().getString());
|
||||
@@ -1787,15 +2576,21 @@
|
||||
@@ -1687,15 +2457,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
|
||||
|
@ -1351,7 +1323,7 @@
|
|||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1808,7 +2603,284 @@
|
||||
@@ -1708,7 +2484,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
|
@ -1637,7 +1609,7 @@
|
|||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1848,6 +2920,7 @@
|
||||
@@ -1748,6 +2801,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
|
||||
|
@ -1645,7 +1617,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1885,6 +2958,43 @@
|
||||
@@ -1790,6 +2844,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
|
@ -1689,7 +1661,7 @@
|
|||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).set(itemstack);
|
||||
@@ -1907,6 +3017,7 @@
|
||||
@@ -1812,6 +2903,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
|
@ -1697,7 +1669,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1923,18 +3034,37 @@
|
||||
@@ -1828,18 +2920,37 @@
|
||||
|
||||
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
|
||||
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
|
||||
|
@ -1737,7 +1709,7 @@
|
|||
|
||||
tileentitysign.setChanged();
|
||||
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -1944,6 +3074,7 @@
|
||||
@@ -1849,6 +2960,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||
|
@ -1745,7 +1717,7 @@
|
|||
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -1958,7 +3089,17 @@
|
||||
@@ -1863,7 +2975,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
|
||||
|
@ -1764,7 +1736,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1967,8 +3108,50 @@
|
||||
@@ -1872,8 +2994,50 @@
|
||||
this.player.updateOptions(packetplayinsettings);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -102,6 +102,24 @@
|
||||
@@ -107,6 +107,25 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import java.util.stream.Collectors;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.network.syncher.DataWatcher;
|
||||
+import net.minecraft.server.dedicated.DedicatedServer;
|
||||
+import net.minecraft.server.network.LoginListener;
|
||||
+import org.bukkit.Location;
|
||||
|
@ -25,7 +26,7 @@
|
|||
public abstract class PlayerList {
|
||||
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -113,14 +131,16 @@
|
||||
@@ -118,14 +137,16 @@
|
||||
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
|
||||
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
|
||||
private final MinecraftServer server;
|
||||
|
@ -44,15 +45,15 @@
|
|||
+ // CraftBukkit end
|
||||
public final WorldNBTStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final IRegistryCustom.Dimension registryHolder;
|
||||
@@ -131,13 +151,23 @@
|
||||
private final LayeredRegistryAccess<RegistryLayer> registries;
|
||||
@@ -137,13 +158,23 @@
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
private int sendAllPlayerInfoIn;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private CraftServer cserver;
|
||||
+
|
||||
public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) {
|
||||
public PlayerList(MinecraftServer minecraftserver, LayeredRegistryAccess<RegistryLayer> layeredregistryaccess, WorldNBTStorage worldnbtstorage, int i) {
|
||||
+ this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this);
|
||||
+ minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance();
|
||||
+ minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server));
|
||||
|
@ -69,9 +70,9 @@
|
|||
+ // this.advancements = Maps.newHashMap();
|
||||
+ // CraftBukkit end
|
||||
this.server = minecraftserver;
|
||||
this.registryHolder = iregistrycustom_dimension;
|
||||
this.maxPlayers = i;
|
||||
@@ -153,9 +183,15 @@
|
||||
this.registries = layeredregistryaccess;
|
||||
this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze();
|
||||
@@ -160,9 +191,15 @@
|
||||
usercache.add(gameprofile);
|
||||
NBTTagCompound nbttagcompound = this.load(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
|
@ -88,7 +89,7 @@
|
|||
Logger logger = PlayerList.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -182,7 +218,8 @@
|
||||
@@ -189,7 +226,8 @@
|
||||
s1 = networkmanager.getRemoteAddress().toString();
|
||||
}
|
||||
|
||||
|
@ -98,15 +99,15 @@
|
|||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer.loadGameTypes(nbttagcompound);
|
||||
@@ -192,6 +229,7 @@
|
||||
@@ -199,6 +237,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.registryHolder, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation()));
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures())));
|
||||
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
||||
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.send(new PacketPlayOutAbilities(entityplayer.getAbilities()));
|
||||
@@ -210,19 +248,66 @@
|
||||
@@ -218,16 +257,68 @@
|
||||
} else {
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
|
||||
}
|
||||
|
@ -116,10 +117,14 @@
|
|||
|
||||
- this.broadcastSystemMessage(ichatmutablecomponent.withStyle(EnumChatFormat.YELLOW), false);
|
||||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
entityplayer.sendServerStatus(this.server.getStatus());
|
||||
entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
|
||||
this.players.add(entityplayer);
|
||||
this.playersByUUID.put(entityplayer.getUUID(), entityplayer);
|
||||
- this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below
|
||||
- this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer)));
|
||||
- worldserver1.addNewPlayer(entityplayer);
|
||||
- this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+ // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ CraftPlayer bukkitPlayer = entityplayer.getBukkitEntity();
|
||||
|
@ -144,10 +149,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit start - sendAll above replaced with this loop
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityplayer);
|
||||
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
- entityplayer.connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{(EntityPlayer) this.players.get(i)}));
|
||||
+ ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer));
|
||||
+
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ if (entityplayer1.getBukkitEntity().canSee(bukkitPlayer)) {
|
||||
|
@ -158,14 +162,12 @@
|
|||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ entityplayer.connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer1}));
|
||||
}
|
||||
+ entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer1)));
|
||||
+ }
|
||||
+ entityplayer.sentListPacket = true;
|
||||
+ // CraftBukkit end
|
||||
|
||||
- worldserver1.addNewPlayer(entityplayer);
|
||||
- this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+ entityplayer.connection.send(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getEntityData(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+
|
||||
+ entityplayer.getEntityData().refresh(entityplayer); // 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.level == worldserver1 && !worldserver1.players().contains(entityplayer)) {
|
||||
|
@ -178,7 +180,7 @@
|
|||
this.sendLevelInfo(entityplayer, worldserver1);
|
||||
this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> {
|
||||
entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt());
|
||||
@@ -238,8 +323,11 @@
|
||||
@@ -242,8 +333,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
|
@ -192,7 +194,7 @@
|
|||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -282,6 +370,8 @@
|
||||
@@ -286,6 +380,8 @@
|
||||
}
|
||||
|
||||
entityplayer.initInventoryMenu();
|
||||
|
@ -201,7 +203,7 @@
|
|||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -314,30 +404,31 @@
|
||||
@@ -318,30 +414,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
|
@ -238,7 +240,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -365,14 +456,15 @@
|
||||
@@ -369,14 +466,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
|
@ -256,7 +258,7 @@
|
|||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -380,10 +472,24 @@
|
||||
@@ -384,10 +482,24 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -282,7 +284,7 @@
|
|||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -407,18 +513,66 @@
|
||||
@@ -411,18 +523,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
|
@ -292,11 +294,12 @@
|
|||
+ // this.stats.remove(uuid);
|
||||
+ // this.advancements.remove(uuid);
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
- this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(entityplayer.getUUID())));
|
||||
+ // CraftBukkit start
|
||||
+ // this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entityplayer);
|
||||
+ // this.broadcastAll(new ClientboundPlayerInfoRemovePacket(List.of(entityplayer.getUUID())));
|
||||
+ ClientboundPlayerInfoRemovePacket packet = new ClientboundPlayerInfoRemovePacket(List.of(entityplayer.getUUID()));
|
||||
+ for (int i = 0; i < players.size(); i++) {
|
||||
+ EntityPlayer entityplayer2 = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
|
@ -305,19 +308,18 @@
|
|||
+ } else {
|
||||
+ entityplayer2.getBukkitEntity().onEntityRemove(entityplayer);
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // This removes the scoreboard (and player reference) for the specific player in the manager
|
||||
+ cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity());
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer}));
|
||||
+
|
||||
+ return playerQuitEvent.getQuitMessage(); // CraftBukkit
|
||||
}
|
||||
|
||||
- @Nullable
|
||||
- public IChatBaseComponent canPlayerLogin(SocketAddress socketaddress, GameProfile gameprofile) {
|
||||
+ // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer
|
||||
+ public EntityPlayer canPlayerLogin(LoginListener loginlistener, GameProfile gameprofile, ProfilePublicKey profilepublickey) {
|
||||
+ public EntityPlayer canPlayerLogin(LoginListener loginlistener, GameProfile gameprofile) {
|
||||
IChatMutableComponent ichatmutablecomponent;
|
||||
|
||||
- if (this.bans.isBanned(gameprofile)) {
|
||||
|
@ -347,7 +349,7 @@
|
|||
+ // depending on the outcome.
|
||||
+ SocketAddress socketaddress = loginlistener.connection.getRemoteAddress();
|
||||
+
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getLevel(World.OVERWORLD), gameprofile, profilepublickey);
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getLevel(World.OVERWORLD), gameprofile);
|
||||
+ Player player = entity.getBukkitEntity();
|
||||
+ PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
|
||||
+
|
||||
|
@ -355,7 +357,7 @@
|
|||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
@@ -426,10 +580,12 @@
|
||||
@@ -430,10 +590,12 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -371,7 +373,7 @@
|
|||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
|
||||
@@ -437,13 +593,25 @@
|
||||
@@ -441,13 +603,25 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -394,16 +396,16 @@
|
|||
+ return entity;
|
||||
}
|
||||
|
||||
- public EntityPlayer getPlayerForLogin(GameProfile gameprofile, @Nullable ProfilePublicKey profilepublickey) {
|
||||
- public EntityPlayer getPlayerForLogin(GameProfile gameprofile) {
|
||||
+ public EntityPlayer getPlayerForLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer
|
||||
+ /* CraftBukkit startMoved up
|
||||
UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -470,14 +638,24 @@
|
||||
@@ -474,14 +648,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, this.server.overworld(), gameprofile, profilepublickey);
|
||||
return new EntityPlayer(this.server, this.server.overworld(), gameprofile);
|
||||
+ */
|
||||
+ return player;
|
||||
+ // CraftBukkit end
|
||||
|
@ -425,10 +427,10 @@
|
|||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -489,6 +667,11 @@
|
||||
@@ -493,6 +677,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile(), entityplayer.getProfilePublicKey());
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile());
|
||||
+ // */
|
||||
+ EntityPlayer entityplayer1 = entityplayer;
|
||||
+ org.bukkit.World fromWorld = entityplayer.getBukkitEntity().getWorld();
|
||||
|
@ -437,7 +439,7 @@
|
|||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -504,49 +687,110 @@
|
||||
@@ -508,50 +697,112 @@
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
|
@ -462,7 +464,8 @@
|
|||
+ } else {
|
||||
+ optional = Optional.empty();
|
||||
+ }
|
||||
+
|
||||
|
||||
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (optional.isPresent()) {
|
||||
+ IBlockData iblockdata = worldserver1.getBlockState(blockposition);
|
||||
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
|
@ -473,8 +476,7 @@
|
|||
+ f1 = f;
|
||||
+ } else {
|
||||
+ Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
|
||||
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+
|
||||
+ f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
+
|
||||
|
@ -516,17 +518,18 @@
|
|||
+ while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
|
||||
}
|
||||
|
||||
int i = flag ? 1 : 0;
|
||||
- WorldData worlddata = entityplayer1.level.getLevelData();
|
||||
+ // CraftBukkit start
|
||||
+ WorldData worlddata = worldserver1.getLevelData();
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), flag, entityplayer1.getLastDeathLocation()));
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.connection.teleport(new Location(worldserver1.getWorld(), entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
- WorldData worlddata = entityplayer1.level.getLevelData();
|
||||
-
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeId(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), flag, entityplayer1.getLastDeathLocation()));
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeId(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
|
||||
|
@ -557,13 +560,13 @@
|
|||
+
|
||||
+ // Fire advancement trigger
|
||||
+ entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle());
|
||||
|
||||
+
|
||||
+ // Don't fire on respawn
|
||||
+ if (fromWorld != location.getWorld()) {
|
||||
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld);
|
||||
+ server.server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
|
||||
+ // Save player file again if they were disconnected
|
||||
+ if (entityplayer.connection.isDisconnected()) {
|
||||
+ this.save(entityplayer);
|
||||
|
@ -572,16 +575,16 @@
|
|||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -559,7 +803,18 @@
|
||||
@@ -564,7 +815,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
- this.broadcastAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players));
|
||||
- this.broadcastAll(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.a.UPDATE_LATENCY), this.players));
|
||||
+ // CraftBukkit start
|
||||
+ for (int i = 0; i < this.players.size(); ++i) {
|
||||
+ final EntityPlayer target = (EntityPlayer) this.players.get(i);
|
||||
+
|
||||
+ target.connection.send(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.UPDATE_LATENCY, this.players.stream().filter(new Predicate<EntityPlayer>() {
|
||||
+ target.connection.send(new ClientboundPlayerInfoUpdatePacket(EnumSet.of(ClientboundPlayerInfoUpdatePacket.a.UPDATE_LATENCY), this.players.stream().filter(new Predicate<EntityPlayer>() {
|
||||
+ @Override
|
||||
+ public boolean test(EntityPlayer input) {
|
||||
+ return target.getBukkitEntity().canSee(input.getBukkitEntity());
|
||||
|
@ -592,7 +595,7 @@
|
|||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -576,6 +831,25 @@
|
||||
@@ -581,6 +843,25 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -618,7 +621,7 @@
|
|||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -654,7 +928,7 @@
|
||||
@@ -659,7 +940,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
|
@ -627,7 +630,7 @@
|
|||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -678,6 +952,7 @@
|
||||
@@ -683,6 +964,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
|
@ -635,7 +638,7 @@
|
|||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -710,6 +985,12 @@
|
||||
@@ -715,6 +997,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
|
@ -648,7 +651,7 @@
|
|||
if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -749,23 +1030,34 @@
|
||||
@@ -754,23 +1042,34 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
|
@ -688,7 +691,7 @@
|
|||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -821,12 +1113,22 @@
|
||||
@@ -826,12 +1125,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
|
@ -713,8 +716,8 @@
|
|||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -902,16 +1204,23 @@
|
||||
return !playerchatmessage.hasExpiredServer(Instant.now()) && playerchatmessage.verify(chatsender);
|
||||
@@ -889,16 +1198,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
- public ServerStatisticManager getPlayerStats(EntityHuman entityhuman) {
|
||||
|
@ -741,7 +744,7 @@
|
|||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -920,7 +1229,7 @@
|
||||
@@ -907,7 +1223,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
|
@ -750,7 +753,7 @@
|
|||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -928,14 +1237,14 @@
|
||||
@@ -915,14 +1231,14 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
|
@ -767,7 +770,7 @@
|
|||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -986,13 +1295,20 @@
|
||||
@@ -973,13 +1289,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
@ -787,5 +790,5 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.broadcastAll(new PacketPlayOutTags(TagNetworkSerialization.serializeTagsToNetwork(this.registryHolder)));
|
||||
this.broadcastAll(new PacketPlayOutTags(TagNetworkSerialization.serializeTagsToNetwork(this.registries)));
|
||||
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getRecipeManager().getRecipes());
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
package net.minecraft.stats;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
@@ -161,13 +162,12 @@
|
||||
@@ -162,13 +163,12 @@
|
||||
}
|
||||
|
||||
private <T> Optional<Statistic<T>> getStat(StatisticWrapper<T> statisticwrapper, String s) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/net/minecraft/util/SpawnUtil.java
|
||||
@@ -18,6 +18,12 @@
|
||||
@@ -17,6 +17,12 @@
|
||||
public SpawnUtil() {}
|
||||
|
||||
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EnumMobSpawn enummobspawn, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a) {
|
||||
|
@ -13,12 +13,12 @@
|
|||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
for (int l = 0; l < i; ++l) {
|
||||
@@ -26,11 +32,11 @@
|
||||
@@ -25,11 +31,11 @@
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
|
||||
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
|
||||
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition_mutableblockposition, enummobspawn, false, false);
|
||||
+ T t0 = entitytypes.create(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
|
||||
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition_mutableblockposition, enummobspawn, false, false);
|
||||
+ T t0 = entitytypes.create(worldserver, (NBTTagCompound) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 != null) {
|
||||
if (t0.checkSpawnRules(worldserver, enummobspawn) && t0.checkSpawnObstruction(worldserver)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -439,6 +439,18 @@
|
||||
@@ -444,6 +444,18 @@
|
||||
datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false));
|
||||
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema47, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema47, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema47, false));
|
||||
@@ -756,12 +768,14 @@
|
||||
@@ -761,12 +773,14 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Squid", DataConverterTypes.ENTITY));
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Item Frame", DataConverterTypes.ENTITY));
|
||||
Schema schema132 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema133, "Rename copper item suffixes", createRenamer(immutablemap1)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema133, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -769,7 +783,8 @@
|
||||
@@ -774,7 +788,8 @@
|
||||
|
||||
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema134, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
|
||||
Schema schema135 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema135, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema135, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
|
||||
@@ -856,10 +871,11 @@
|
||||
@@ -861,10 +876,11 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema160, "Added Allay", DataConverterTypes.ENTITY));
|
||||
Schema schema161 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
|||
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
|
||||
int2objectopenhashmap1.put(0, "minecraft:tabby");
|
||||
int2objectopenhashmap1.put(1, "minecraft:black");
|
||||
@@ -876,7 +892,8 @@
|
||||
@@ -881,7 +897,8 @@
|
||||
|
||||
Objects.requireNonNull(int2objectopenhashmap);
|
||||
datafixerbuilder.addFixer(new EntityVariantFix(schema162, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -40,6 +40,10 @@
|
||||
import net.minecraft.world.level.storage.WorldPersistentData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class WorldUpgrader {
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -55,7 +59,7 @@
|
||||
private static final ThreadFactory THREAD_FACTORY = (new ThreadFactoryBuilder()).setDaemon(true).build();
|
||||
private final IRegistry<WorldDimension> dimensions;
|
||||
- private final Set<ResourceKey<World>> levels;
|
||||
+ private final Set<ResourceKey<WorldDimension>> levels; // CraftBukkit
|
||||
private final boolean eraseCache;
|
||||
private final Convertable.ConversionSession levelStorage;
|
||||
private final Thread thread;
|
||||
@@ -59,14 +59,14 @@
|
||||
private volatile int totalChunks;
|
||||
private volatile int converted;
|
||||
private volatile int skipped;
|
||||
|
@ -20,24 +18,30 @@
|
|||
private volatile IChatBaseComponent status = IChatBaseComponent.translatable("optimizeWorld.stage.counting");
|
||||
private static final Pattern REGEX = Pattern.compile("^r\\.(-?[0-9]+)\\.(-?[0-9]+)\\.mca$");
|
||||
private final WorldPersistentData overworldDataStorage;
|
||||
@@ -88,13 +92,13 @@
|
||||
|
||||
public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, IRegistry<WorldDimension> iregistry, boolean flag) {
|
||||
this.dimensions = iregistry;
|
||||
- this.levels = (Set) iregistry.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet());
|
||||
+ this.levels = (Set) iregistry.registryKeySet().stream().collect(Collectors.toUnmodifiableSet()); // CraftBukkit
|
||||
this.eraseCache = flag;
|
||||
this.dataFixer = datafixer;
|
||||
this.levelStorage = convertable_conversionsession;
|
||||
@@ -93,12 +93,12 @@
|
||||
|
||||
private void work() {
|
||||
this.totalChunks = 0;
|
||||
- Builder<ResourceKey<World>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder();
|
||||
- ImmutableSet<ResourceKey<World>> immutableset = this.worldGenSettings.levels();
|
||||
+ Builder<ResourceKey<WorldDimension>, ListIterator<ChunkCoordIntPair>> builder = ImmutableMap.builder(); // CraftBukkit
|
||||
+ ImmutableSet<ResourceKey<WorldDimension>> immutableset = ImmutableSet.of(levelStorage.dimensionType); // CraftBukkit
|
||||
|
||||
List list;
|
||||
|
||||
for (UnmodifiableIterator unmodifiableiterator = immutableset.iterator(); unmodifiableiterator.hasNext(); this.totalChunks += list.size()) {
|
||||
- ResourceKey<World> resourcekey = (ResourceKey) unmodifiableiterator.next();
|
||||
+ ResourceKey<WorldDimension> resourcekey = (ResourceKey) unmodifiableiterator.next(); // CraftBukkit
|
||||
for (Iterator iterator = this.levels.iterator(); iterator.hasNext(); this.totalChunks += list.size()) {
|
||||
- ResourceKey<World> resourcekey = (ResourceKey) iterator.next();
|
||||
+ ResourceKey<WorldDimension> resourcekey = (ResourceKey) iterator.next(); // CraftBukkit
|
||||
|
||||
list = this.getAllChunkPos(resourcekey);
|
||||
builder.put(resourcekey, list.listIterator());
|
||||
@@ -104,18 +108,18 @@
|
||||
@@ -108,18 +108,18 @@
|
||||
this.finished = true;
|
||||
} else {
|
||||
float f = (float) this.totalChunks;
|
||||
|
@ -45,12 +49,12 @@
|
|||
- Builder<ResourceKey<World>, IChunkLoader> builder1 = ImmutableMap.builder();
|
||||
+ ImmutableMap<ResourceKey<WorldDimension>, ListIterator<ChunkCoordIntPair>> immutablemap = builder.build(); // CraftBukkit
|
||||
+ Builder<ResourceKey<WorldDimension>, IChunkLoader> builder1 = ImmutableMap.builder(); // CraftBukkit
|
||||
UnmodifiableIterator unmodifiableiterator1 = immutableset.iterator();
|
||||
Iterator iterator1 = this.levels.iterator();
|
||||
|
||||
while (unmodifiableiterator1.hasNext()) {
|
||||
- ResourceKey<World> resourcekey1 = (ResourceKey) unmodifiableiterator1.next();
|
||||
while (iterator1.hasNext()) {
|
||||
- ResourceKey<World> resourcekey1 = (ResourceKey) iterator1.next();
|
||||
- Path path = this.levelStorage.getDimensionPath(resourcekey1);
|
||||
+ ResourceKey<WorldDimension> resourcekey1 = (ResourceKey) unmodifiableiterator1.next(); // CraftBukkit
|
||||
+ ResourceKey<WorldDimension> resourcekey1 = (ResourceKey) iterator1.next(); // CraftBukkit
|
||||
+ Path path = this.levelStorage.getDimensionPath((ResourceKey) null); // CraftBukkit
|
||||
|
||||
builder1.put(resourcekey1, new IChunkLoader(path.resolve("region"), this.dataFixer, true));
|
||||
|
@ -61,21 +65,21 @@
|
|||
long i = SystemUtils.getMillis();
|
||||
|
||||
this.status = IChatBaseComponent.translatable("optimizeWorld.stage.upgrading");
|
||||
@@ -127,7 +131,7 @@
|
||||
@@ -131,7 +131,7 @@
|
||||
float f2;
|
||||
|
||||
for (UnmodifiableIterator unmodifiableiterator2 = immutableset.iterator(); unmodifiableiterator2.hasNext(); f1 += f2) {
|
||||
- ResourceKey<World> resourcekey2 = (ResourceKey) unmodifiableiterator2.next();
|
||||
+ ResourceKey<WorldDimension> resourcekey2 = (ResourceKey) unmodifiableiterator2.next(); // CraftBukkit
|
||||
for (Iterator iterator2 = this.levels.iterator(); iterator2.hasNext(); f1 += f2) {
|
||||
- ResourceKey<World> resourcekey2 = (ResourceKey) iterator2.next();
|
||||
+ ResourceKey<WorldDimension> resourcekey2 = (ResourceKey) iterator2.next(); // CraftBukkit
|
||||
ListIterator<ChunkCoordIntPair> listiterator = (ListIterator) immutablemap.get(resourcekey2);
|
||||
IChunkLoader ichunkloader = (IChunkLoader) immutablemap1.get(resourcekey2);
|
||||
|
||||
@@ -140,10 +144,10 @@
|
||||
@@ -144,10 +144,10 @@
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
int j = IChunkLoader.getVersion(nbttagcompound);
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) this.worldGenSettings.dimensions().get(GeneratorSettings.levelToLevelStem(resourcekey2))).generator();
|
||||
+ ChunkGenerator chunkgenerator = ((WorldDimension) this.worldGenSettings.dimensions().get(resourcekey2)).generator(); // CraftBukkit
|
||||
- ChunkGenerator chunkgenerator = ((WorldDimension) this.dimensions.getOrThrow(Registries.levelToLevelStem(resourcekey2))).generator();
|
||||
+ ChunkGenerator chunkgenerator = ((WorldDimension) this.dimensions.getOrThrow(resourcekey2)).generator(); // CraftBukkit
|
||||
NBTTagCompound nbttagcompound1 = ichunkloader.upgradeChunkTag(resourcekey2, () -> {
|
||||
return this.overworldDataStorage;
|
||||
- }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer());
|
||||
|
@ -83,7 +87,7 @@
|
|||
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos"));
|
||||
|
||||
if (!chunkcoordintpair1.equals(chunkcoordintpair)) {
|
||||
@@ -223,8 +227,8 @@
|
||||
@@ -227,8 +227,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,11 +98,11 @@
|
|||
File file1 = new File(file, "region");
|
||||
File[] afile = file1.listFiles((file2, s) -> {
|
||||
return s.endsWith(".mca");
|
||||
@@ -284,7 +288,7 @@
|
||||
@@ -288,7 +288,7 @@
|
||||
}
|
||||
|
||||
public ImmutableSet<ResourceKey<World>> levels() {
|
||||
- return this.worldGenSettings.levels();
|
||||
public Set<ResourceKey<World>> levels() {
|
||||
- return this.levels;
|
||||
+ throw new AssertionError("Unsupported"); // CraftBukkit
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -52,6 +52,18 @@
|
||||
@@ -49,6 +49,18 @@
|
||||
private boolean isFall;
|
||||
private boolean noAggro;
|
||||
public final String msgId;
|
||||
|
@ -17,5 +17,5 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
public static DamageSource sting(EntityLiving entityliving) {
|
||||
return new EntityDamageSource("sting", entityliving);
|
||||
public static DamageSource fallingBlock(Entity entity) {
|
||||
return (new EntityDamageSource("fallingBlock", entity)).damageHelmet();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
|
||||
+++ b/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
|
||||
@@ -37,4 +37,10 @@
|
||||
|
||||
return !itemstack.isEmpty() && itemstack.hasCustomHoverName() ? IChatBaseComponent.translatable(s1, entityliving.getDisplayName(), ichatbasecomponent, itemstack.getDisplayName()) : IChatBaseComponent.translatable(s, entityliving.getDisplayName(), ichatbasecomponent);
|
||||
@@ -53,4 +53,10 @@
|
||||
return IChatBaseComponent.translatable(s, entityliving.getDisplayName(), ichatbasecomponent);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/effect/MobEffectUtil.java
|
||||
+++ b/net/minecraft/world/effect/MobEffectUtil.java
|
||||
@@ -48,13 +48,19 @@
|
||||
@@ -44,13 +44,19 @@
|
||||
}
|
||||
|
||||
public static List<EntityPlayer> addEffectToPlayersAround(WorldServer worldserver, @Nullable Entity entity, Vec3D vec3d, double d0, MobEffect mobeffect, int i) {
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
--- a/net/minecraft/world/effect/MobEffects.java
|
||||
+++ b/net/minecraft/world/effect/MobEffects.java
|
||||
@@ -69,6 +69,14 @@
|
||||
return new MobEffect.a(22);
|
||||
}));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ static {
|
||||
+ for (Object effect : IRegistry.MOB_EFFECT) {
|
||||
+ org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType((MobEffectList) effect));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@@ -73,6 +73,10 @@
|
||||
public MobEffects() {}
|
||||
|
||||
private static MobEffectList register(int i, String s, MobEffectList mobeffectlist) {
|
||||
- return (MobEffectList) IRegistry.registerMapping(BuiltInRegistries.MOB_EFFECT, i, s, mobeffectlist);
|
||||
+ // CraftBukkit start
|
||||
+ mobeffectlist = (MobEffectList) IRegistry.registerMapping(BuiltInRegistries.MOB_EFFECT, i, s, mobeffectlist);
|
||||
+ org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType(mobeffectlist));
|
||||
+ return mobeffectlist;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@
|
|||
if (this.onGround) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -938,6 +1114,20 @@
|
||||
@@ -946,6 +1122,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -273,8 +273,8 @@
|
|||
+
|
||||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 0.001D, axisalignedbb.minY + 0.001D, axisalignedbb.minZ + 0.001D);
|
||||
@@ -1290,6 +1480,7 @@
|
||||
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
@@ -1305,6 +1495,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
|
@ -282,7 +282,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1480,6 +1671,12 @@
|
||||
@@ -1495,6 +1686,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -295,7 +295,7 @@
|
|||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1513,7 +1710,7 @@
|
||||
@@ -1528,7 +1725,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
|
@ -304,7 +304,7 @@
|
|||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1538,6 +1735,18 @@
|
||||
@@ -1553,6 +1750,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
|
@ -323,7 +323,7 @@
|
|||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1546,6 +1755,22 @@
|
||||
@@ -1561,6 +1770,22 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
|
@ -346,7 +346,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1613,6 +1838,11 @@
|
||||
@@ -1628,6 +1853,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,7 +358,7 @@
|
|||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1696,6 +1926,44 @@
|
||||
@@ -1711,6 +1941,44 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
|
@ -403,7 +403,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1771,9 +2039,22 @@
|
||||
@@ -1786,9 +2054,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -426,7 +426,7 @@
|
|||
this.level.addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1867,7 +2148,7 @@
|
||||
@@ -1882,7 +2163,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
|
@ -435,7 +435,7 @@
|
|||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1898,7 +2179,7 @@
|
||||
@@ -1913,7 +2194,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
|
@ -444,7 +444,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1907,10 +2188,31 @@
|
||||
@@ -1926,10 +2207,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
|
@ -477,7 +477,7 @@
|
|||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1926,12 +2228,32 @@
|
||||
@@ -1945,12 +2247,32 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -511,7 +511,7 @@
|
|||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1942,6 +2264,7 @@
|
||||
@@ -1961,6 +2283,7 @@
|
||||
|
||||
entity.boardingCooldown = 60;
|
||||
}
|
||||
|
@ -519,7 +519,7 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2004,14 +2327,20 @@
|
||||
@@ -2023,14 +2346,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
|
@ -543,7 +543,7 @@
|
|||
this.level.getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2129,6 +2458,13 @@
|
||||
@@ -2148,6 +2477,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
|
@ -557,7 +557,7 @@
|
|||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2174,8 +2510,12 @@
|
||||
@@ -2193,8 +2529,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
|
@ -571,7 +571,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2194,7 +2534,7 @@
|
||||
@@ -2213,7 +2553,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -580,7 +580,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2202,7 +2542,18 @@
|
||||
@@ -2221,7 +2561,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
|
@ -600,7 +600,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2229,11 +2580,41 @@
|
||||
@@ -2248,11 +2599,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -644,7 +644,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2391,15 +2772,38 @@
|
||||
@@ -2417,15 +2798,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -685,7 +685,7 @@
|
|||
this.level.getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2408,9 +2812,17 @@
|
||||
@@ -2434,9 +2838,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
|
@ -705,7 +705,7 @@
|
|||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2431,20 +2843,34 @@
|
||||
@@ -2457,20 +2869,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
|
@ -745,18 +745,18 @@
|
|||
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2461,8 +2887,8 @@
|
||||
@@ -2487,8 +2913,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this.getDimensions(this.getPose()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2472,8 +2898,14 @@
|
||||
@@ -2498,8 +2924,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
|
@ -772,7 +772,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -2481,8 +2913,23 @@
|
||||
@@ -2507,8 +2939,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -798,7 +798,7 @@
|
|||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2691,7 +3138,26 @@
|
||||
@@ -2731,7 +3178,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -826,7 +826,7 @@
|
|||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -2979,6 +3445,11 @@
|
||||
@@ -3023,6 +3489,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -32,6 +32,12 @@
|
||||
@@ -31,6 +31,12 @@
|
||||
import net.minecraft.world.level.material.EnumPistonReaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityAreaEffectCloud extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -127,6 +133,22 @@
|
||||
@@ -129,6 +135,22 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -25,18 +25,18 @@
|
|||
+ }
|
||||
+
|
||||
+ public String getPotionType() {
|
||||
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potion)).toString();
|
||||
+ return ((MinecraftKey) BuiltInRegistries.POTION.getKey(this.potion)).toString();
|
||||
+ }
|
||||
+
|
||||
+ public void setPotionType(String string) {
|
||||
+ setPotion(IRegistry.POTION.get(new MinecraftKey(string)));
|
||||
+ setPotion(BuiltInRegistries.POTION.get(new MinecraftKey(string)));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public int getColor() {
|
||||
return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR);
|
||||
}
|
||||
@@ -259,6 +281,7 @@
|
||||
@@ -261,6 +283,7 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
|||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -268,6 +291,17 @@
|
||||
@@ -270,6 +293,17 @@
|
||||
double d8 = d6 * d6 + d7 * d7;
|
||||
|
||||
if (d8 <= (double) (f * f)) {
|
||||
|
@ -62,7 +62,7 @@
|
|||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -277,7 +311,7 @@
|
||||
@@ -279,7 +313,7 @@
|
||||
if (mobeffect1.getEffect().isInstantenous()) {
|
||||
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -20,6 +20,12 @@
|
||||
@@ -21,6 +21,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityExperienceOrb extends Entity {
|
||||
|
||||
private static final int LIFETIME = 6000;
|
||||
@@ -58,6 +64,7 @@
|
||||
@@ -59,6 +65,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -21,7 +21,7 @@
|
|||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -83,7 +90,22 @@
|
||||
@@ -84,7 +91,22 @@
|
||||
this.followingPlayer = null;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@
|
|||
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
|
||||
double d0 = vec3d.lengthSqr();
|
||||
|
||||
@@ -226,7 +248,7 @@
|
||||
@@ -227,7 +249,7 @@
|
||||
int i = this.repairPlayerItems(entityhuman, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -54,7 +54,7 @@
|
|||
}
|
||||
|
||||
--this.count;
|
||||
@@ -244,9 +266,17 @@
|
||||
@@ -245,9 +267,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -271,6 +301,24 @@
|
||||
@@ -272,6 +302,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
|
|
@ -135,26 +135,26 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -577,7 +650,7 @@
|
||||
@@ -576,7 +649,7 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
- ItemStack itemstack1 = this.equipItemIfPossible(itemstack.copy());
|
||||
+ ItemStack itemstack1 = this.equipItemIfPossible(itemstack.copy(), entityitem); // CraftBukkit - add item
|
||||
|
||||
- if (this.equipItemIfPossible(itemstack)) {
|
||||
+ if (this.equipItemIfPossible(itemstack, entityitem)) { // CraftBukkit - add item
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.onItemPickup(entityitem);
|
||||
this.take(entityitem, itemstack.getCount());
|
||||
entityitem.discard();
|
||||
@@ -586,15 +659,29 @@
|
||||
@@ -590,15 +663,29 @@
|
||||
}
|
||||
|
||||
public boolean equipItemIfPossible(ItemStack itemstack) {
|
||||
public ItemStack equipItemIfPossible(ItemStack itemstack) {
|
||||
+ // CraftBukkit start - add item
|
||||
+ return this.equipItemIfPossible(itemstack, null);
|
||||
+ }
|
||||
+
|
||||
+ public boolean equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItemStack(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
|
||||
|
@ -174,8 +174,8 @@
|
|||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
this.setItemSlotAndDropWhenKilled(enumitemslot, itemstack);
|
||||
@@ -732,6 +819,7 @@
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -750,6 +837,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
|
@ -183,7 +183,7 @@
|
|||
this.level.getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level.getProfiler().pop();
|
||||
@@ -1125,6 +1213,12 @@
|
||||
@@ -1143,6 +1231,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
|
@ -196,7 +196,7 @@
|
|||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else {
|
||||
@@ -1148,6 +1242,12 @@
|
||||
@@ -1166,6 +1260,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
|
@ -209,7 +209,7 @@
|
|||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1163,7 +1263,7 @@
|
||||
@@ -1181,7 +1281,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
|
@ -218,7 +218,7 @@
|
|||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1213,12 +1313,19 @@
|
||||
@@ -1231,12 +1331,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
|
@ -237,23 +237,23 @@
|
|||
- T t0 = (EntityInsentient) entitytypes.create(this.level);
|
||||
+ T t0 = entitytypes.create(this.level); // CraftBukkit - decompile error
|
||||
|
||||
t0.copyPosition(this);
|
||||
t0.setBaby(this.isBaby());
|
||||
@@ -1250,7 +1357,12 @@
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1271,7 +1378,12 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- this.level.addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
- this.level.addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1270,6 +1382,7 @@
|
||||
@@ -1292,6 +1404,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
|
@ -261,7 +261,7 @@
|
|||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1281,7 +1394,9 @@
|
||||
@@ -1303,7 +1416,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
|
@ -271,7 +271,7 @@
|
|||
}
|
||||
|
||||
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
|
||||
@@ -1331,6 +1446,7 @@
|
||||
@@ -1353,6 +1468,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
|
@ -279,7 +279,7 @@
|
|||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1355,7 +1471,9 @@
|
||||
@@ -1377,7 +1493,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
|
@ -289,7 +289,7 @@
|
|||
this.leashInfoTag = null;
|
||||
}
|
||||
}
|
||||
@@ -1432,7 +1550,14 @@
|
||||
@@ -1458,7 +1576,14 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -305,7 +305,7 @@
|
|||
}
|
||||
|
||||
boolean flag = entity.hurt(DamageSource.mobAttack(this), f);
|
||||
@@ -1500,9 +1625,10 @@
|
||||
@@ -1532,9 +1657,10 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -31,6 +31,10 @@
|
||||
@@ -29,6 +29,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityLightning extends Entity {
|
||||
|
||||
private static final int START_LIFE = 2;
|
||||
@@ -131,7 +135,7 @@
|
||||
@@ -129,7 +133,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
if (!(this.level instanceof WorldServer)) {
|
||||
this.level.setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -165,8 +169,12 @@
|
||||
@@ -163,8 +167,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level, blockposition);
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -174,8 +182,12 @@
|
||||
@@ -172,8 +180,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.getState(this.level, blockposition1);
|
||||
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
|
||||
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -239,8 +251,9 @@
|
||||
@@ -237,8 +249,9 @@
|
||||
iblockdata = world.getBlockState(blockposition1);
|
||||
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -118,6 +118,30 @@
|
||||
@@ -119,6 +119,30 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
public abstract class EntityLiving extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -228,6 +252,20 @@
|
||||
@@ -229,6 +253,20 @@
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
private boolean skipDropExperience;
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -240,7 +278,9 @@
|
||||
@@ -241,7 +279,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
|
@ -63,7 +63,7 @@
|
|||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -307,7 +347,13 @@
|
||||
@@ -308,7 +348,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
|
||||
|
@ -78,7 +78,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -661,10 +707,16 @@
|
||||
@@ -660,10 +706,16 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
|
@ -90,13 +90,13 @@
|
|||
+ // CraftBukkit end
|
||||
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
if (!flag && !ItemStack.isSameIgnoreDurability(itemstack, itemstack1) && !this.firstTick) {
|
||||
if (!flag && !ItemStack.isSame(itemstack, itemstack1) && !this.firstTick) {
|
||||
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
|
||||
this.playEquipSound(itemstack1);
|
||||
}
|
||||
|
||||
@@ -742,6 +794,17 @@
|
||||
@@ -741,6 +793,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@
|
|||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -779,9 +842,32 @@
|
||||
@@ -778,9 +841,32 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
|||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -791,6 +877,12 @@
|
||||
@@ -790,6 +876,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level.isClientSide) {
|
||||
|
@ -160,7 +160,7 @@
|
|||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -801,6 +893,17 @@
|
||||
@@ -800,6 +892,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@
|
|||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -927,7 +1030,13 @@
|
||||
@@ -926,7 +1029,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@
|
|||
if (this.level.isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -936,7 +1045,14 @@
|
||||
@@ -935,7 +1044,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
|
@ -208,7 +208,7 @@
|
|||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -965,18 +1081,48 @@
|
||||
@@ -964,18 +1080,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,7 @@
|
|||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1013,13 +1159,39 @@
|
||||
@@ -1012,13 +1158,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
|
@ -299,7 +299,7 @@
|
|||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1056,20 +1228,55 @@
|
||||
@@ -1055,20 +1227,55 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@
|
|||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1083,7 +1290,7 @@
|
||||
@@ -1082,7 +1289,7 @@
|
||||
return false;
|
||||
} else if (this.level.isClientSide) {
|
||||
return false;
|
||||
|
@ -365,7 +365,7 @@
|
|||
return false;
|
||||
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1094,10 +1301,11 @@
|
||||
@@ -1093,10 +1300,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
|
@ -379,7 +379,7 @@
|
|||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1115,27 +1323,46 @@
|
||||
@@ -1116,27 +1324,46 @@
|
||||
this.animationSpeed = 1.5F;
|
||||
boolean flag1 = true;
|
||||
|
||||
|
@ -431,7 +431,7 @@
|
|||
this.hurtDir = 0.0F;
|
||||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
@@ -1258,19 +1485,32 @@
|
||||
@@ -1259,19 +1486,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
|
@ -468,7 +468,7 @@
|
|||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1278,14 +1518,16 @@
|
||||
@@ -1279,14 +1519,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
|
@ -490,7 +490,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1390,14 +1632,22 @@
|
||||
@@ -1391,14 +1633,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
|
@ -515,7 +515,7 @@
|
|||
this.level.addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1417,21 +1667,40 @@
|
||||
@@ -1418,21 +1668,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
|
@ -559,7 +559,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1504,6 +1773,28 @@
|
||||
@@ -1517,6 +1786,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
|
@ -588,7 +588,7 @@
|
|||
@Override
|
||||
public void setOnGround(boolean flag) {
|
||||
super.setOnGround(flag);
|
||||
@@ -1559,9 +1850,14 @@
|
||||
@@ -1572,9 +1863,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -604,7 +604,7 @@
|
|||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1610,7 +1906,7 @@
|
||||
@@ -1623,7 +1919,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.isBypassArmor()) {
|
||||
|
@ -613,7 +613,7 @@
|
|||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1623,7 +1919,8 @@
|
||||
@@ -1636,7 +1932,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
|
@ -623,7 +623,7 @@
|
|||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1656,29 +1953,172 @@
|
||||
@@ -1669,29 +1966,172 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -806,7 +806,7 @@
|
|||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1699,9 +2139,19 @@
|
||||
@@ -1712,9 +2152,19 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
|
@ -827,7 +827,7 @@
|
|||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
}
|
||||
@@ -1996,6 +2446,12 @@
|
||||
@@ -2017,6 +2467,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
|
@ -840,7 +840,7 @@
|
|||
@Override
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2239,6 +2695,7 @@
|
||||
@@ -2256,6 +2712,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
|
@ -848,7 +848,7 @@
|
|||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2772,6 +3229,7 @@
|
||||
@@ -2793,6 +3250,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
|
@ -856,7 +856,7 @@
|
|||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2931,14 +3389,21 @@
|
||||
@@ -2956,14 +3414,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
|
@ -880,7 +880,7 @@
|
|||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3133,7 +3598,26 @@
|
||||
@@ -3158,7 +3623,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
|
@ -908,7 +908,7 @@
|
|||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3211,6 +3695,12 @@
|
||||
@@ -3236,6 +3720,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
|
@ -921,7 +921,7 @@
|
|||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3235,16 +3725,41 @@
|
||||
@@ -3260,16 +3750,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
|
@ -966,7 +966,7 @@
|
|||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3254,7 +3769,7 @@
|
||||
@@ -3279,7 +3794,7 @@
|
||||
((EntityCreature) this).getNavigation().stop();
|
||||
}
|
||||
|
||||
|
@ -975,7 +975,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3337,7 +3852,7 @@
|
||||
@@ -3357,7 +3872,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
|
@ -984,7 +984,7 @@
|
|||
World world = this.level;
|
||||
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3369,7 +3884,7 @@
|
||||
@@ -3391,7 +3906,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
|
@ -993,7 +993,7 @@
|
|||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
|
||||
}
|
||||
@@ -3417,7 +3932,7 @@
|
||||
@@ -3439,7 +3954,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
--- a/net/minecraft/world/entity/EntityTypes.java
|
||||
+++ b/net/minecraft/world/entity/EntityTypes.java
|
||||
@@ -159,7 +159,7 @@
|
||||
@@ -156,6 +156,7 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
|
||||
@@ -165,7 +166,7 @@
|
||||
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
|
||||
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
|
||||
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
|
||||
|
@ -9,28 +17,66 @@
|
|||
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
|
||||
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
|
||||
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
|
||||
@@ -293,8 +293,8 @@
|
||||
private MinecraftKey lootTable;
|
||||
@@ -301,8 +302,8 @@
|
||||
private final EntitySize dimensions;
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
|
||||
- private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
- return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, entitytypes_builder.build(s));
|
||||
- return (EntityTypes) IRegistry.register(BuiltInRegistries.ENTITY_TYPE, s, entitytypes_builder.build(s));
|
||||
+ private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder entitytypes_builder) { // CraftBukkit - decompile error
|
||||
+ return (EntityTypes) IRegistry.register(IRegistry.ENTITY_TYPE, s, (EntityTypes<T>) entitytypes_builder.build(s)); // CraftBukkit - decompile error
|
||||
+ return (EntityTypes) IRegistry.register(BuiltInRegistries.ENTITY_TYPE, s, (EntityTypes<T>) entitytypes_builder.build(s)); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
|
||||
@@ -326,10 +326,18 @@
|
||||
@@ -330,8 +331,15 @@
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ return this.spawn(worldserver, itemstack, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
T t0 = this.create(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1);
|
||||
+ public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
NBTTagCompound nbttagcompound;
|
||||
- Consumer consumer;
|
||||
+ Consumer<T> consumer; // CraftBukkit - decompile error
|
||||
|
||||
if (itemstack != null) {
|
||||
nbttagcompound = itemstack.getTag();
|
||||
@@ -363,21 +371,37 @@
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
|
||||
return nbttagcompound != null ? consumer.andThen((entity) -> {
|
||||
- updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
}) : consumer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn) {
|
||||
- return this.spawn(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition, enummobspawn, false, false);
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, blockposition, enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ return this.spawn(worldserver, (NBTTagCompound) null, null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
|
||||
if (t0 != null) {
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
|
@ -40,16 +86,7 @@
|
|||
}
|
||||
|
||||
return t0;
|
||||
@@ -365,7 +373,7 @@
|
||||
t0.setCustomName(ichatbasecomponent);
|
||||
}
|
||||
|
||||
- updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, t0, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -512,7 +520,7 @@
|
||||
@@ -564,7 +588,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
@ -58,7 +95,7 @@
|
|||
}
|
||||
|
||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -569,7 +577,7 @@
|
||||
@@ -621,7 +645,7 @@
|
||||
|
||||
@Nullable
|
||||
public T tryCast(Entity entity) {
|
||||
|
@ -67,7 +104,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -602,7 +610,7 @@
|
||||
@@ -656,7 +680,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java
|
||||
@@ -10,6 +10,12 @@
|
||||
@@ -8,6 +8,12 @@
|
||||
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
|
@ -10,24 +10,25 @@
|
|||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Behavior<E> {
|
||||
public class BehaviorAttackTargetForget {
|
||||
|
||||
private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
|
||||
@@ -83,6 +89,17 @@
|
||||
}
|
||||
|
||||
protected void clearAttackTarget(E e0) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = e0.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, ((CraftLivingEntity) event.getTarget()).getHandle());
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onTargetErased.accept(e0, this.getAttackTarget(e0));
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.ATTACK_TARGET);
|
||||
}
|
||||
@@ -41,6 +47,18 @@
|
||||
if (entityinsentient.canAttack(entityliving) && (!flag || !isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level == entityinsentient.level && !predicate.test(entityliving)) {
|
||||
return true;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ EntityLiving old = entityinsentient.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null);
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityinsentient, null, (old != null && !old.isAlive()) ? EntityTargetEvent.TargetReason.TARGET_DIED : EntityTargetEvent.TargetReason.FORGOT_TARGET);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
biconsumer.accept(entityinsentient, entityliving);
|
||||
memoryaccessor.erase();
|
||||
return true;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet.java
|
||||
@@ -10,6 +10,13 @@
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.entity.ai.behavior.declarative.BehaviorBuilder;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
|
@ -11,30 +11,24 @@
|
|||
+import org.bukkit.event.entity.EntityTargetEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorAttackTargetSet<E extends EntityInsentient> extends Behavior<E> {
|
||||
public class BehaviorAttackTargetSet {
|
||||
|
||||
private final Predicate<E> canAttackPredicate;
|
||||
@@ -42,13 +49,21 @@
|
||||
}
|
||||
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- ((Optional) this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> {
|
||||
+ (this.targetFinderFunction.apply(e0)).ifPresent((entityliving) -> { // CraftBukkit - decompile error
|
||||
setAttackTarget(e0, entityliving);
|
||||
});
|
||||
}
|
||||
|
||||
public static <E extends EntityInsentient> void setAttackTarget(E e0, EntityLiving entityliving) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ entityliving = (event.getTarget() != null) ? ((CraftLivingEntity) event.getTarget()).getHandle() : null;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
e0.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
}
|
||||
public BehaviorAttackTargetSet() {}
|
||||
@@ -35,6 +42,17 @@
|
||||
if (!entityinsentient.canAttack(entityliving)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityinsentient, entityliving, (entityliving instanceof EntityPlayer) ? EntityTargetEvent.TargetReason.CLOSEST_PLAYER : EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityliving = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
memoryaccessor.set(entityliving);
|
||||
memoryaccessor1.erase();
|
||||
return true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorCareer.java
|
||||
@@ -12,6 +12,12 @@
|
||||
@@ -9,6 +9,12 @@
|
||||
import net.minecraft.world.entity.npc.EntityVillager;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
|
||||
|
@ -10,31 +10,22 @@
|
|||
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorCareer extends Behavior<EntityVillager> {
|
||||
public class BehaviorCareer {
|
||||
|
||||
public BehaviorCareer() {
|
||||
@@ -28,7 +34,7 @@
|
||||
GlobalPos globalpos = (GlobalPos) entityvillager.getBrain().getMemory(MemoryModuleType.POTENTIAL_JOB_SITE).get();
|
||||
|
||||
entityvillager.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE);
|
||||
- entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, (Object) globalpos);
|
||||
+ entityvillager.getBrain().setMemory(MemoryModuleType.JOB_SITE, globalpos); // CraftBukkit - decompile error
|
||||
worldserver.broadcastEntityEvent(entityvillager, (byte) 14);
|
||||
if (entityvillager.getVillagerData().getProfession() == VillagerProfession.NONE) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
@@ -40,7 +46,14 @@
|
||||
return villagerprofession.heldJobSite().test(holder);
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
public BehaviorCareer() {}
|
||||
@@ -37,7 +43,14 @@
|
||||
return villagerprofession.heldJobSite().test(holder);
|
||||
}).findFirst();
|
||||
}).ifPresent((villagerprofession) -> {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(villagerprofession));
|
||||
+ // CraftBukkit start - Fire VillagerCareerChangeEvent where Villager gets employed
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(villagerprofession), VillagerCareerChangeEvent.ChangeReason.EMPLOYED);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
}
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
});
|
||||
return true;
|
||||
|
|
|
@ -1,28 +1,23 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFindAdmirableItem.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFindAdmirableItem.java
|
||||
@@ -35,6 +35,25 @@
|
||||
@@ -28,6 +28,20 @@
|
||||
EntityItem entityitem = (EntityItem) behaviorbuilder_b.get(memoryaccessor2);
|
||||
|
||||
@Override
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
+ // CraftBukkit start
|
||||
+ if (e0 instanceof net.minecraft.world.entity.animal.allay.Allay) {
|
||||
+ Entity target = this.getClosestLovedItem(e0);
|
||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(e0, target, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
if (behaviorbuilder_b.tryGet(memoryaccessor3).isEmpty() && predicate.test(entityliving) && entityitem.closerThan(entityliving, (double) i) && entityliving.level.getWorldBorder().isWithinBounds(entityitem.blockPosition())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entityliving instanceof net.minecraft.world.entity.animal.allay.Allay) {
|
||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(entityliving, entityitem, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (!(event.getTarget() instanceof EntityItem)) {
|
||||
+ memoryaccessor2.erase();
|
||||
+ }
|
||||
+
|
||||
+ target = (event.getTarget() == null) ? null : ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ if (target instanceof EntityItem item) {
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, java.util.Optional.of(item));
|
||||
+ BehaviorUtil.setWalkAndLookTargetMemories(e0, target, this.speedModifier, 0);
|
||||
+ } else {
|
||||
+ e0.getBrain().eraseMemory(MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM);
|
||||
+ }
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
BehaviorUtil.setWalkAndLookTargetMemories(e0, (Entity) this.getClosestLovedItem(e0), this.speedModifier, 0);
|
||||
}
|
||||
+ entityitem = (EntityItem) ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entityitem, false), f, 0);
|
||||
|
||||
memoryaccessor.set(new BehaviorPositionEntity(entityitem, true));
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFollowAdult.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFollowAdult.java
|
||||
@@ -10,6 +10,13 @@
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryStatus;
|
||||
import net.minecraft.world.entity.ai.memory.MemoryTarget;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
|
@ -11,25 +11,28 @@
|
|||
+import org.bukkit.event.entity.EntityTargetLivingEntityEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorFollowAdult<E extends EntityAgeable> extends Behavior<E> {
|
||||
public class BehaviorFollowAdult {
|
||||
|
||||
private final UniformInt followRange;
|
||||
@@ -38,7 +45,17 @@
|
||||
}
|
||||
public BehaviorFollowAdult() {}
|
||||
@@ -25,9 +32,20 @@
|
||||
if (!entityageable.isBaby()) {
|
||||
return false;
|
||||
} else {
|
||||
- EntityAgeable entityageable1 = (EntityAgeable) behaviorbuilder_b.get(memoryaccessor);
|
||||
+ EntityLiving entityageable1 = (EntityAgeable) behaviorbuilder_b.get(memoryaccessor); // CraftBukkit - type
|
||||
|
||||
protected void start(WorldServer worldserver, E e0, long i) {
|
||||
- BehaviorUtil.setWalkAndLookTargetMemories(e0, (Entity) this.getNearestAdult(e0), (Float) this.speedModifier.apply(e0), this.followRange.getMinValue() - 1);
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(e0, this.getNearestAdult(e0), EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (event.getTarget() != null) {
|
||||
+ BehaviorUtil.setWalkAndLookTargetMemories(e0, ((CraftLivingEntity) event.getTarget()).getHandle(), this.speedModifier.apply(e0), this.followRange.getMinValue() - 1);
|
||||
+ } else {
|
||||
+ e0.getBrain().eraseMemory(MemoryModuleType.NEAREST_VISIBLE_ADULT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (entityageable.closerThan(entityageable1, (double) (uniformint.getMaxValue() + 1)) && !entityageable.closerThan(entityageable1, (double) uniformint.getMinValue())) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(entityageable, entityageable1, EntityTargetEvent.TargetReason.FOLLOW_LEADER);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ if (event.getTarget() == null) {
|
||||
+ memoryaccessor.erase();
|
||||
+ return true;
|
||||
+ }
|
||||
+ entityageable1 = ((CraftLivingEntity) event.getTarget()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
MemoryTarget memorytarget = new MemoryTarget(new BehaviorPositionEntity(entityageable1, false), (Float) function.apply(entityageable), uniformint.getMinValue() - 1);
|
||||
|
||||
private EntityAgeable getNearestAdult(E e0) {
|
||||
memoryaccessor1.set(new BehaviorPositionEntity(entityageable1, true));
|
||||
|
|
|
@ -1,48 +1,39 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorInteractDoor.java
|
||||
@@ -69,6 +69,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
@@ -61,6 +61,13 @@
|
||||
BlockDoor blockdoor = (BlockDoor) iblockdata.getBlock();
|
||||
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor.setOpen(entityliving, worldserver, iblockdata, blockposition, true);
|
||||
}
|
||||
|
||||
@@ -84,6 +91,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
@@ -76,6 +83,13 @@
|
||||
BlockDoor blockdoor1 = (BlockDoor) iblockdata1.getBlock();
|
||||
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
this.rememberDoorToClose(worldserver, entityliving, blockposition1);
|
||||
}
|
||||
@@ -134,7 +148,7 @@
|
||||
private static boolean areOtherMobsComingThroughDoor(WorldServer worldserver, EntityLiving entityliving, BlockPosition blockposition) {
|
||||
BehaviorController<?> behaviorcontroller = entityliving.getBrain();
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
blockdoor1.setOpen(entityliving, worldserver, iblockdata1, blockposition1, true);
|
||||
optional = rememberDoorToClose(memoryaccessor1, optional, worldserver, blockposition1);
|
||||
}
|
||||
@@ -129,7 +143,7 @@
|
||||
}
|
||||
|
||||
- return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : ((List) behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> {
|
||||
+ return !behaviorcontroller.hasMemoryValue(MemoryModuleType.NEAREST_LIVING_ENTITIES) ? false : (behaviorcontroller.getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES).get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
private static boolean areOtherMobsComingThroughDoor(EntityLiving entityliving, BlockPosition blockposition, Optional<List<EntityLiving>> optional) {
|
||||
- return optional.isEmpty() ? false : ((List) optional.get()).stream().filter((entityliving1) -> {
|
||||
+ return optional.isEmpty() ? false : (optional.get()).stream().filter((entityliving1) -> { // CraftBukkit - decompile error
|
||||
return entityliving1.getType() == entityliving.getType();
|
||||
}).filter((entityliving1) -> {
|
||||
return blockposition.closerToCenterThan(entityliving1.position(), 2.0D);
|
||||
@@ -176,7 +190,7 @@
|
||||
if (behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).isPresent()) {
|
||||
((Set) behaviorcontroller.getMemory(MemoryModuleType.DOORS_TO_CLOSE).get()).add(globalpos);
|
||||
} else {
|
||||
- behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, (Object) Sets.newHashSet(new GlobalPos[]{globalpos}));
|
||||
+ behaviorcontroller.setMemory(MemoryModuleType.DOORS_TO_CLOSE, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorProfession.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorProfession.java
|
||||
@@ -8,6 +8,12 @@
|
||||
@@ -6,6 +6,12 @@
|
||||
import net.minecraft.world.entity.npc.VillagerData;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
|
||||
|
@ -10,22 +10,22 @@
|
|||
+import org.bukkit.event.entity.VillagerCareerChangeEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorProfession extends Behavior<EntityVillager> {
|
||||
public class BehaviorProfession {
|
||||
|
||||
public BehaviorProfession() {
|
||||
@@ -21,7 +27,14 @@
|
||||
}
|
||||
public BehaviorProfession() {}
|
||||
@@ -17,7 +23,14 @@
|
||||
VillagerData villagerdata = entityvillager.getVillagerData();
|
||||
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.LOSING_JOB);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
if (villagerdata.getProfession() != VillagerProfession.NONE && villagerdata.getProfession() != VillagerProfession.NITWIT && entityvillager.getVillagerXp() == 0 && villagerdata.getLevel() <= 1) {
|
||||
- entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(VillagerProfession.NONE));
|
||||
+ // CraftBukkit start
|
||||
+ VillagerCareerChangeEvent event = CraftEventFactory.callVillagerCareerChangeEvent(entityvillager, CraftVillager.nmsToBukkitProfession(VillagerProfession.NONE), VillagerCareerChangeEvent.ChangeReason.LOSING_JOB);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
}
|
||||
}
|
||||
+ entityvillager.setVillagerData(entityvillager.getVillagerData().setProfession(CraftVillager.bukkitToNmsProfession(event.getProfession())));
|
||||
+ // CraftBukkit end
|
||||
entityvillager.refreshBrain(worldserver);
|
||||
return true;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorUtil.java
|
||||
@@ -61,7 +61,7 @@
|
||||
@@ -60,7 +60,7 @@
|
||||
}
|
||||
|
||||
public static void lookAtEntity(EntityLiving entityliving, EntityLiving entityliving1) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -82,8 +82,8 @@
|
||||
@@ -81,8 +81,8 @@
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BehaviorPosition behaviorposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(behaviorposition, f, i);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
@@ -93,6 +93,7 @@
|
||||
@@ -92,6 +92,7 @@
|
||||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
|
||||
|
@ -28,7 +28,7 @@
|
|||
double d0 = entityliving.getEyeY() - (double) f;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
|
||||
@@ -102,12 +103,19 @@
|
||||
@@ -101,12 +102,19 @@
|
||||
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
|
||||
entityitem.setDeltaMovement(vec3d2);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
@@ -82,8 +96,8 @@
|
||||
|
||||
protected void tick(WorldServer worldserver, E e0, long i) {
|
||||
if (this.ramCandidate.isPresent()) {
|
||||
if (!this.ramCandidate.isEmpty()) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (Object) (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0)));
|
||||
- e0.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (Object) (new BehaviorPositionEntity(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget(), true)));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.WALK_TARGET, (new MemoryTarget(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getStartPosition(), this.walkSpeed, 0))); // CraftBukkit - decompile error
|
||||
|
@ -54,7 +54,7 @@
|
|||
if (i - (Long) this.reachedRamPositionTimestamp.get() >= (long) this.ramPrepareTime) {
|
||||
- e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, (Object) this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition()));
|
||||
+ e0.getBrain().setMemory(MemoryModuleType.RAM_TARGET, this.getEdgeOfBlock(blockposition, ((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition())); // CraftBukkit - decompile error
|
||||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.HOSTILE, 1.0F, e0.getVoicePitch());
|
||||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.NEUTRAL, 1.0F, e0.getVoicePitch());
|
||||
this.ramCandidate = Optional.empty();
|
||||
}
|
||||
@@ -152,7 +166,7 @@
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
@@ -17,6 +17,14 @@
|
||||
@@ -18,6 +18,14 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class TemptingSensor extends Sensor<EntityCreature> {
|
||||
|
||||
public static final int TEMPTATION_RANGE = 10;
|
||||
@@ -29,7 +37,7 @@
|
||||
@@ -30,7 +38,7 @@
|
||||
|
||||
protected void doTick(WorldServer worldserver, EntityCreature entitycreature) {
|
||||
BehaviorController<?> behaviorcontroller = entitycreature.getBrain();
|
||||
|
@ -24,7 +24,7 @@
|
|||
return TemptingSensor.TEMPT_TARGETING.test(entitycreature, entityplayer);
|
||||
}).filter((entityplayer) -> {
|
||||
return entitycreature.closerThan(entityplayer, 10.0D);
|
||||
@@ -41,7 +49,17 @@
|
||||
@@ -44,7 +52,17 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityHuman entityhuman = (EntityHuman) list.get(0);
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
public class EntityBat extends EntityAmbient {
|
||||
|
||||
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
|
||||
@@ -137,16 +139,24 @@
|
||||
@@ -140,16 +142,24 @@
|
||||
}
|
||||
|
||||
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
} else {
|
||||
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
@@ -170,7 +180,11 @@
|
||||
@@ -173,7 +183,11 @@
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
|
||||
|
@ -52,7 +52,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +214,11 @@
|
||||
@@ -203,7 +217,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide && this.isResting()) {
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
+ if (playerBucketFishEvent.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutEntityMetadata(t0.getId(), t0.getEntityData(), true)); // Need to send data such as the display name to client
|
||||
+ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -643,11 +643,15 @@
|
||||
@@ -646,11 +646,15 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1223,7 +1227,7 @@
|
||||
@@ -1226,7 +1230,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
EntityBee.this.level.levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1296,7 +1300,7 @@
|
||||
@@ -1299,7 +1303,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1305,7 +1309,7 @@
|
||||
@@ -1308,7 +1312,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -410,7 +410,7 @@
|
||||
@@ -415,7 +415,7 @@
|
||||
}
|
||||
} else if (this.isFood(itemstack)) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -467,7 +467,7 @@
|
||||
@@ -472,7 +472,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
|
@ -18,7 +18,7 @@
|
|||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
|
||||
@@ -608,7 +608,15 @@
|
||||
@@ -613,7 +613,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -640,10 +648,10 @@
|
||||
@@ -645,10 +653,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
@@ -95,7 +95,9 @@
|
||||
@@ -96,7 +96,9 @@
|
||||
this.flap += this.flapping * 2.0F;
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCow.java
|
||||
@@ -30,6 +30,11 @@
|
||||
@@ -31,6 +31,11 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
||||
@@ -82,8 +87,16 @@
|
||||
@@ -83,8 +88,16 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityFox.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityFox.java
|
||||
@@ -511,7 +511,8 @@
|
||||
@@ -516,7 +516,8 @@
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
|||
int i = itemstack.getCount();
|
||||
|
||||
if (i > 1) {
|
||||
@@ -866,6 +867,16 @@
|
||||
@@ -871,6 +872,16 @@
|
||||
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
||||
entityfox.addTrustedUUID(entityplayer1.getUUID());
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
if (entityplayer2 != null) {
|
||||
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -876,12 +887,14 @@
|
||||
@@ -881,12 +892,14 @@
|
||||
this.partner.setAge(6000);
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
|
@ -46,7 +46,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1272,13 +1285,18 @@
|
||||
@@ -1277,13 +1290,18 @@
|
||||
}
|
||||
|
||||
private void pickGlowBerry(IBlockData iblockdata) {
|
||||
|
@ -66,7 +66,7 @@
|
|||
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
||||
|
||||
@@ -1435,7 +1453,7 @@
|
||||
@@ -1440,7 +1458,7 @@
|
||||
private EntityLiving trustedLastHurt;
|
||||
private int timestamp;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
@@ -43,6 +43,13 @@
|
||||
@@ -42,6 +42,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
|||
+import org.bukkit.event.entity.EntityTransformEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityMushroomCow extends EntityCow implements IShearable {
|
||||
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
|
||||
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -116,6 +123,11 @@
|
||||
@@ -115,6 +122,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
|
@ -26,40 +26,40 @@
|
|||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -163,7 +175,7 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.MOOSHROOM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
EntityCow entitycow = (EntityCow) EntityTypes.COW.create(this.level);
|
||||
@@ -165,7 +177,7 @@
|
||||
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
if (entitycow != null) {
|
||||
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
entitycow.setHealth(this.getHealth());
|
||||
entitycow.yBodyRot = this.yBodyRot;
|
||||
@@ -179,10 +191,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock())));
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getMushroomType().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -312,10 +313,10 @@
|
||||
@@ -313,10 +314,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -64,6 +64,8 @@
|
||||
@@ -65,6 +65,8 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -526,7 +528,7 @@
|
||||
@@ -532,7 +534,7 @@
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
this.onItemPickup(entityitem);
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
@@ -872,10 +874,10 @@
|
||||
@@ -863,10 +865,10 @@
|
||||
private final EntityPanda panda;
|
||||
|
||||
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
@ -32,7 +32,7 @@
|
|||
this.panda = entitypanda;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1116,7 @@
|
||||
@@ -1105,7 +1107,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
|
||||
@@ -257,7 +257,7 @@
|
||||
@@ -261,7 +261,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.tame(entityhuman);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -271,7 +271,7 @@
|
||||
@@ -275,7 +275,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -383,7 +383,7 @@
|
||||
@@ -387,7 +387,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -399,7 +399,7 @@
|
||||
@@ -403,7 +403,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide) {
|
||||
|
|
|
@ -11,18 +11,18 @@
|
|||
public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_SADDLE_ID = DataWatcher.defineId(EntityPig.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -249,7 +253,13 @@
|
||||
}
|
||||
@@ -250,7 +254,13 @@
|
||||
}
|
||||
|
||||
entitypigzombie.setPersistenceRequired();
|
||||
- worldserver.addFreshEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
entitypigzombie.setPersistenceRequired();
|
||||
- worldserver.addFreshEntity(entitypigzombie);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit - added a reason for spawning this creature
|
||||
+ worldserver.addFreshEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||
+ // CraftBukkit end
|
||||
this.discard();
|
||||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
@@ -90,8 +90,14 @@
|
||||
@@ -88,8 +88,14 @@
|
||||
super(entitytypes, world);
|
||||
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
|
@ -15,7 +15,7 @@
|
|||
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
@@ -559,9 +565,23 @@
|
||||
@@ -570,9 +576,23 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -222,6 +230,11 @@
|
||||
@@ -243,6 +251,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.readyForShearing()) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -243,7 +256,9 @@
|
||||
@@ -264,7 +277,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
if (entityitem != null) {
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
|
||||
@@ -333,6 +348,12 @@
|
||||
@@ -357,6 +372,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
|
@ -50,7 +50,7 @@
|
|||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -352,7 +373,7 @@
|
||||
@@ -376,7 +397,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
|
||||
|
@ -59,7 +59,7 @@
|
|||
return recipecrafting.assemble(inventorycrafting);
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -375,10 +396,18 @@
|
||||
@@ -399,10 +420,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
|
||||
private static class e extends ControllerMove {
|
||||
@@ -480,8 +484,12 @@
|
||||
@@ -482,8 +486,12 @@
|
||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||
World world = this.turtle.level;
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -303,7 +310,12 @@
|
||||
@@ -306,7 +313,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
|
||||
|
@ -62,7 +62,7 @@
|
|||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
@@ -315,7 +327,7 @@
|
||||
@@ -318,7 +330,7 @@
|
||||
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
|
@ -71,7 +71,7 @@
|
|||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -407,6 +419,7 @@
|
||||
@@ -439,6 +451,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
|
@ -79,25 +79,25 @@
|
|||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -446,7 +459,7 @@
|
||||
@@ -483,7 +496,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.put("Inventory", this.inventory.createTag());
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener());
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener()); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -462,7 +475,7 @@
|
||||
@@ -499,7 +512,7 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
if (nbttagcompound.contains("listener", 10)) {
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationListener> dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -508,7 +521,7 @@
|
||||
@@ -532,7 +545,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@
|
|||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
|
||||
|
||||
if (allay != null) {
|
||||
@@ -516,17 +529,17 @@
|
||||
@@ -540,17 +553,17 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -66,10 +66,17 @@
|
||||
@@ -68,9 +68,16 @@
|
||||
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, Bucketable {
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, VariantHolder<Axolotl.Variant>, Bucketable {
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
+ @Override
|
||||
|
@ -10,7 +10,6 @@
|
|||
+ return AXOLOTL_TOTAL_AIR_SUPPLY;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final int TOTAL_PLAYDEAD_TIME = 200;
|
||||
protected static final ImmutableList<? extends SensorType<? extends Sensor<? super Axolotl>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_ADULT, SensorType.HURT_BY, SensorType.AXOLOTL_ATTACKABLES, SensorType.AXOLOTL_TEMPTATIONS);
|
||||
- protected static final ImmutableList<? extends MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.BREED_TARGET, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.LOOK_TARGET, MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.PATH, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.NEAREST_VISIBLE_ADULT, new MemoryModuleType[]{MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.PLAY_DEAD_TICKS, MemoryModuleType.NEAREST_ATTACKABLE, MemoryModuleType.TEMPTING_PLAYER, MemoryModuleType.TEMPTATION_COOLDOWN_TICKS, MemoryModuleType.IS_TEMPTED, MemoryModuleType.HAS_HUNTING_COOLDOWN, MemoryModuleType.IS_PANICKING});
|
||||
|
@ -19,7 +18,7 @@
|
|||
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -187,7 +194,7 @@
|
||||
@@ -188,7 +195,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -27,8 +26,8 @@
|
|||
+ return maxAirTicks; // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
|
||||
}
|
||||
|
||||
public Axolotl.Variant getVariant() {
|
||||
@@ -423,7 +430,7 @@
|
||||
@Override
|
||||
@@ -418,7 +425,7 @@
|
||||
|
||||
if (i < 2400) {
|
||||
i = Math.min(2400, 100 + i);
|
||||
|
@ -37,7 +36,7 @@
|
|||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -473,7 +480,7 @@
|
||||
@@ -468,7 +475,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -232,8 +232,14 @@
|
||||
@@ -233,8 +233,14 @@
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
|
||||
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
|
||||
this.discard();
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) {
|
||||
+ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
+ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason
|
||||
this.discard();
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
public class Goat extends EntityAnimal {
|
||||
|
||||
public static final EntitySize LONG_JUMPING_DIMENSIONS = EntitySize.scalable(0.9F, 1.3F).scale(0.7F);
|
||||
@@ -156,7 +161,7 @@
|
||||
@@ -181,7 +186,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Goat> getBrain() {
|
||||
|
@ -21,7 +21,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +199,15 @@
|
||||
@@ -219,8 +224,15 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
@@ -72,6 +72,8 @@
|
||||
@@ -74,6 +74,8 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable {
|
||||
|
||||
public static final int EQUIPMENT_SLOT_OFFSET = 400;
|
||||
@@ -111,6 +113,7 @@
|
||||
@@ -113,6 +115,7 @@
|
||||
private float mouthAnimO;
|
||||
protected boolean canGallop = true;
|
||||
protected int gallopSoundCounter;
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -296,7 +299,7 @@
|
||||
@@ -312,7 +315,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.removeListener(this);
|
||||
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
@@ -412,7 +415,7 @@
|
||||
@@ -416,7 +419,7 @@
|
||||
}
|
||||
|
||||
public int getMaxTemper() {
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -483,7 +486,7 @@
|
||||
@@ -487,7 +490,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
||||
|
@ -44,7 +44,7 @@
|
|||
flag = true;
|
||||
}
|
||||
|
||||
@@ -560,7 +563,7 @@
|
||||
@@ -564,7 +567,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
|
@ -53,7 +53,7 @@
|
|||
}
|
||||
|
||||
if (this.canEatGrass()) {
|
||||
@@ -791,6 +794,7 @@
|
||||
@@ -838,6 +841,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
|
@ -61,7 +61,7 @@
|
|||
|
||||
if (!this.inventory.getItem(0).isEmpty()) {
|
||||
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
|
||||
@@ -818,6 +822,11 @@
|
||||
@@ -865,6 +869,11 @@
|
||||
if (uuid != null) {
|
||||
this.setOwnerUUID(uuid);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
if (nbttagcompound.contains("SaddleItem", 10)) {
|
||||
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
|
||||
@@ -895,6 +904,18 @@
|
||||
@@ -942,6 +951,18 @@
|
||||
|
||||
@Override
|
||||
public void handleStartJump(int i) {
|
||||
|
@ -90,5 +90,5 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.allowStandSliding = true;
|
||||
this.stand();
|
||||
this.standIfPossible();
|
||||
this.playJumpSound();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityLlama.java
|
||||
@@ -77,6 +77,12 @@
|
||||
@@ -82,6 +82,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityLlamaTrader.java
|
||||
@@ -152,7 +152,7 @@
|
||||
@@ -153,7 +153,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
|
|
@ -1,28 +1,26 @@
|
|||
--- a/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java
|
||||
@@ -39,19 +39,20 @@
|
||||
@@ -41,12 +41,12 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
|
||||
entitylightning.setVisualOnly(true);
|
||||
- worldserver.addFreshEntity(entitylightning);
|
||||
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
|
||||
|
||||
entitylightning.moveTo(this.horse.getX(), this.horse.getY(), this.horse.getZ());
|
||||
entitylightning.setVisualOnly(true);
|
||||
- worldserver.addFreshEntity(entitylightning);
|
||||
+ worldserver.strikeLightning(entitylightning, org.bukkit.event.weather.LightningStrikeEvent.Cause.TRAP); // CraftBukkit
|
||||
EntitySkeleton entityskeleton = this.createSkeleton(difficultydamagescaler, this.horse);
|
||||
if (entityskeleton != null) {
|
||||
entityskeleton.startRiding(this.horse);
|
||||
- worldserver.addFreshEntityWithPassengers(entityskeleton);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
|
||||
- entityskeleton.startRiding(this.horse);
|
||||
- worldserver.addFreshEntityWithPassengers(entityskeleton);
|
||||
+ if (entityskeleton != null) entityskeleton.startRiding(this.horse); // CraftBukkit
|
||||
+ worldserver.addFreshEntityWithPassengers(entityskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.TRAP); // CraftBukkit
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
|
||||
+ if (entityhorseabstract == null) continue; // CraftBukkit
|
||||
EntitySkeleton entityskeleton1 = this.createSkeleton(difficultydamagescaler, entityhorseabstract);
|
||||
|
||||
- entityskeleton1.startRiding(entityhorseabstract);
|
||||
+ if (entityskeleton1 != null) entityskeleton1.startRiding(entityhorseabstract); // CraftBukkit
|
||||
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
|
||||
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
EntityHorseAbstract entityhorseabstract = this.createHorse(difficultydamagescaler);
|
||||
@@ -57,7 +57,7 @@
|
||||
if (entityskeleton1 != null) {
|
||||
entityskeleton1.startRiding(entityhorseabstract);
|
||||
entityhorseabstract.push(this.horse.getRandom().triangle(0.0D, 1.1485D), 0.0D, this.horse.getRandom().triangle(0.0D, 1.1485D));
|
||||
- worldserver.addFreshEntityWithPassengers(entityhorseabstract);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityhorseabstract, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.JOCKEY); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
|
||||
@@ -21,6 +21,11 @@
|
||||
@@ -19,6 +19,11 @@
|
||||
import net.minecraft.world.level.block.BlockFireAbstract;
|
||||
import net.minecraft.world.level.dimension.end.EnderDragonBattle;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -56,7 +61,11 @@
|
||||
@@ -54,7 +59,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
|
||||
|
@ -25,7 +25,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -96,9 +105,22 @@
|
||||
@@ -94,11 +103,24 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level.isClientSide) {
|
||||
|
@ -36,7 +36,9 @@
|
|||
+ // CraftBukkit end
|
||||
this.remove(Entity.RemovalReason.KILLED);
|
||||
if (!damagesource.isExplosion()) {
|
||||
- this.level.explode((Entity) null, this.getX(), this.getY(), this.getZ(), 6.0F, Explosion.Effect.DESTROY);
|
||||
DamageSource damagesource1 = damagesource.getEntity() != null ? DamageSource.explosion(this, damagesource.getEntity()) : null;
|
||||
|
||||
- this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
|
@ -44,7 +46,7 @@
|
|||
+ this.unsetRemoved();
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.DESTROY);
|
||||
+ this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -55,6 +55,17 @@
|
||||
@@ -54,6 +54,17 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -18,21 +18,21 @@
|
|||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -249,16 +260,40 @@
|
||||
@@ -247,15 +258,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // CraftBukkit start
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, explosion_effect);
|
||||
+
|
||||
if (!this.isSilent()) {
|
||||
- this.level.globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
|
@ -62,7 +62,7 @@
|
|||
}
|
||||
|
||||
} else {
|
||||
@@ -303,6 +338,7 @@
|
||||
@@ -300,6 +336,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -333,6 +369,11 @@
|
||||
@@ -330,6 +367,11 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
|
@ -82,7 +82,7 @@
|
|||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -346,7 +387,7 @@
|
||||
@@ -343,7 +385,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
@@ -93,16 +93,27 @@
|
||||
@@ -94,16 +94,27 @@
|
||||
@Override
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
switch (enumdirection_enumaxis) {
|
||||
case X:
|
||||
@@ -118,9 +129,10 @@
|
||||
@@ -119,9 +130,10 @@
|
||||
d4 /= 32.0D;
|
||||
d5 /= 32.0D;
|
||||
d6 /= 32.0D;
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
@@ -170,6 +182,11 @@
|
||||
@@ -171,6 +183,11 @@
|
||||
return false;
|
||||
} else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) {
|
||||
if (!this.level.isClientSide) {
|
||||
|
@ -61,7 +61,7 @@
|
|||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
}
|
||||
@@ -297,6 +314,12 @@
|
||||
@@ -298,6 +315,12 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack, boolean flag) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
if (!itemstack.isEmpty()) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.setCount(1);
|
||||
@@ -304,7 +327,7 @@
|
||||
@@ -305,7 +328,7 @@
|
||||
|
||||
this.onItemChanged(itemstack);
|
||||
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
@@ -24,6 +24,12 @@
|
||||
@@ -25,6 +25,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityLeash extends EntityHanging {
|
||||
|
||||
public static final double OFFSET_Y = 0.375D;
|
||||
@@ -95,22 +101,42 @@
|
||||
@@ -96,22 +102,42 @@
|
||||
while (iterator.hasNext()) {
|
||||
entityinsentient = (EntityInsentient) iterator.next();
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -46,6 +46,8 @@
|
||||
@@ -48,6 +48,8 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -80,10 +82,17 @@
|
||||
@@ -82,10 +84,17 @@
|
||||
}
|
||||
|
||||
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
@ -28,7 +28,7 @@
|
|||
return entityfallingblock;
|
||||
}
|
||||
|
||||
@@ -166,6 +175,12 @@
|
||||
@@ -168,6 +177,12 @@
|
||||
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
if (this.level.setBlock(blockposition, this.blockState, 3)) {
|
||||
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
|
||||
this.discard();
|
||||
@@ -236,7 +251,7 @@
|
||||
@@ -238,7 +253,7 @@
|
||||
if (i < 0) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -50,7 +50,7 @@
|
|||
DamageSource damagesource1;
|
||||
|
||||
if (this.blockState.getBlock() instanceof Fallable) {
|
||||
@@ -252,7 +267,9 @@
|
||||
@@ -254,7 +269,9 @@
|
||||
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||
|
||||
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -32,6 +32,12 @@
|
||||
@@ -30,6 +30,12 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityItem extends Entity {
|
||||
|
||||
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -46,6 +52,7 @@
|
||||
@@ -44,6 +50,7 @@
|
||||
@Nullable
|
||||
private UUID owner;
|
||||
public final float bobOffs;
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -103,9 +110,12 @@
|
||||
@@ -101,9 +108,12 @@
|
||||
this.discard();
|
||||
} else {
|
||||
super.tick();
|
||||
|
@ -37,7 +37,7 @@
|
|||
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
@@ -155,9 +165,11 @@
|
||||
@@ -153,9 +163,11 @@
|
||||
this.mergeWithNeighbours();
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -169,6 +181,12 @@
|
||||
@@ -167,6 +179,12 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && this.age >= 6000) {
|
||||
|
@ -62,7 +62,7 @@
|
|||
this.discard();
|
||||
}
|
||||
|
||||
@@ -244,10 +262,11 @@
|
||||
@@ -242,10 +260,11 @@
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
|
||||
ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
|||
merge(entityitem, itemstack, itemstack1);
|
||||
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
|
||||
entityitem.age = Math.min(entityitem.age, entityitem1.age);
|
||||
@@ -273,6 +292,11 @@
|
||||
@@ -271,6 +290,11 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -87,7 +87,7 @@
|
|||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
|
||||
@@ -336,6 +360,46 @@
|
||||
@@ -334,6 +358,46 @@
|
||||
Item item = itemstack.getItem();
|
||||
int i = itemstack.getCount();
|
||||
|
||||
|
@ -134,7 +134,7 @@
|
|||
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
|
||||
entityhuman.take(this, i);
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -379,7 +443,9 @@
|
||||
@@ -377,7 +441,9 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -17,12 +17,16 @@
|
||||
import net.minecraft.world.level.Explosion;
|
||||
@@ -14,12 +14,16 @@
|
||||
import net.minecraft.world.entity.EnumMoveType;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
|
||||
|
@ -17,7 +17,7 @@
|
|||
|
||||
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -73,10 +77,13 @@
|
||||
@@ -70,10 +74,13 @@
|
||||
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
|
@ -32,7 +32,7 @@
|
|||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level.isClientSide) {
|
||||
@@ -87,9 +94,16 @@
|
||||
@@ -84,9 +91,16 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
|
@ -40,12 +40,12 @@
|
|||
+ // CraftBukkit start
|
||||
+ // float f = 4.0F;
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, Explosion.Effect.BREAK);
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Explosion.Effect.BREAK);
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityCreeper.java
|
||||
@@ -44,6 +44,12 @@
|
||||
@@ -43,6 +43,12 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityCreeper extends EntityMonster implements PowerableMob {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_SWELL_DIR = DataWatcher.defineId(EntityCreeper.class, DataWatcherRegistry.INT);
|
||||
@@ -219,9 +225,19 @@
|
||||
@@ -218,9 +224,19 @@
|
||||
@Override
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
|
@ -35,11 +35,11 @@
|
|||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -246,10 +262,18 @@
|
||||
Explosion.Effect explosion_effect = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE;
|
||||
if (!this.level.isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.dead = true;
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, explosion_effect);
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.discard();
|
||||
- this.spawnLingeringCloud();
|
||||
+ // CraftBukkit start
|
||||
|
@ -47,7 +47,7 @@
|
|||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.dead = true;
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), explosion_effect);
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.discard();
|
||||
+ this.spawnLingeringCloud();
|
||||
+ } else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -109,7 +109,17 @@
|
||||
@@ -114,7 +114,17 @@
|
||||
|
||||
@Override
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
|
@ -19,7 +19,7 @@
|
|||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -124,6 +134,7 @@
|
||||
@@ -129,6 +139,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -474,9 +485,13 @@
|
||||
@@ -490,9 +501,13 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
|
@ -41,7 +41,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -515,9 +530,13 @@
|
||||
@@ -531,9 +546,13 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
|
||||
@@ -191,7 +191,7 @@
|
||||
entityvex.setOwner(EntityEvoker.this);
|
||||
entityvex.setBoundOrigin(blockposition);
|
||||
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
|
||||
- worldserver.addFreshEntityWithPassengers(entityvex);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
|
||||
@@ -192,7 +192,7 @@
|
||||
entityvex.setOwner(EntityEvoker.this);
|
||||
entityvex.setBoundOrigin(blockposition);
|
||||
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
|
||||
- worldserver.addFreshEntityWithPassengers(entityvex);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerWizard.java
|
||||
@@ -161,6 +161,11 @@
|
||||
@@ -155,6 +155,11 @@
|
||||
public void tick() {
|
||||
--this.attackWarmupDelay;
|
||||
if (this.attackWarmupDelay == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -145,7 +145,7 @@
|
||||
@@ -154,7 +154,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
|
@ -9,7 +9,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@
|
||||
@@ -163,7 +163,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@
|
|||
if (this.getTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
|
||||
@@ -164,12 +164,21 @@
|
||||
@@ -173,12 +173,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityShulker.java
|
||||
@@ -57,6 +57,12 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
@@ -59,6 +59,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.WorldServer;
|
||||
|
@ -10,10 +10,10 @@
|
|||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityShulker extends EntityGolem implements IMonster {
|
||||
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, IMonster {
|
||||
|
||||
private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
|
||||
@@ -405,6 +411,16 @@
|
||||
@@ -407,6 +413,16 @@
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
if (enumdirection != null) {
|
||||
|
@ -30,12 +30,12 @@
|
|||
this.unRide();
|
||||
this.setAttachFace(enumdirection);
|
||||
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
|
||||
@@ -478,7 +494,7 @@
|
||||
@@ -477,7 +493,7 @@
|
||||
if (entityshulker != null) {
|
||||
entityshulker.setVariant(this.getVariant());
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
|
||||
entityshulker.moveTo(vec3d);
|
||||
- this.level.addFreshEntity(entityshulker);
|
||||
+ this.level.addFreshEntity(entityshulker, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - the mysteries of life
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
@@ -86,7 +86,7 @@
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -184,7 +192,7 @@
|
||||
@@ -185,7 +193,7 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
|
@ -24,7 +24,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -198,6 +206,19 @@
|
||||
@@ -199,6 +207,19 @@
|
||||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
|
||||
|
@ -44,14 +44,14 @@
|
|||
for (int l = 0; l < k; ++l) {
|
||||
float f1 = ((float) (l % 2) - 0.5F) * f;
|
||||
float f2 = ((float) (l / 2) - 0.5F) * f;
|
||||
@@ -212,8 +233,18 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.level.addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
+ }
|
||||
+
|
||||
@@ -214,9 +235,18 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f1, this.getY() + 0.5D, this.getZ() + (double) f2, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
- this.level.addFreshEntity(entityslime);
|
||||
+ slimes.add(entityslime); // CraftBukkit
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, slimes, EntityTransformEvent.TransformReason.SPLIT).isCancelled()) {
|
||||
+ super.remove(entity_removalreason);
|
||||
|
@ -59,7 +59,7 @@
|
|||
+ }
|
||||
+ for (EntityLiving living : slimes) {
|
||||
+ this.level.addFreshEntity(living, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SLIME_SPLIT); // CraftBukkit - SpawnReason
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySpider.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySpider.java
|
||||
@@ -177,7 +177,7 @@
|
||||
@@ -179,7 +179,7 @@
|
||||
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect;
|
||||
|
||||
if (mobeffectlist != null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityVex.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityVex.java
|
||||
@@ -373,7 +373,7 @@
|
||||
@@ -386,7 +386,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -85,6 +94,7 @@
|
||||
@@ -86,6 +95,7 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -201,7 +211,10 @@
|
||||
@@ -202,7 +212,10 @@
|
||||
public void tick() {
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isNoAi()) {
|
||||
if (this.isUnderWaterConverting()) {
|
||||
|
@ -36,7 +36,7 @@
|
|||
if (this.conversionTime < 0) {
|
||||
this.doUnderWaterConversion();
|
||||
}
|
||||
@@ -218,6 +231,7 @@
|
||||
@@ -219,6 +232,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -250,6 +264,7 @@
|
||||
@@ -251,6 +265,7 @@
|
||||
}
|
||||
|
||||
public void startUnderWaterConversion(int i) {
|
||||
|
@ -52,7 +52,7 @@
|
|||
this.conversionTime = i;
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -263,11 +278,15 @@
|
||||
@@ -264,11 +279,15 @@
|
||||
}
|
||||
|
||||
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -307,9 +326,9 @@
|
||||
@@ -308,9 +327,9 @@
|
||||
if (SpawnerCreature.isSpawnPositionOk(entitypositiontypes_surface, this.level, blockposition, entitytypes) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level.random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level.hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level.isUnobstructed(entityzombie) && this.level.noCollision((Entity) entityzombie) && !this.level.containsAnyLiquid(entityzombie.getBoundingBox())) {
|
||||
|
@ -81,7 +81,7 @@
|
|||
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION));
|
||||
break;
|
||||
@@ -330,7 +349,14 @@
|
||||
@@ -331,7 +350,14 @@
|
||||
float f = this.level.getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
|
@ -97,49 +97,54 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -412,21 +438,30 @@
|
||||
@@ -413,8 +439,17 @@
|
||||
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
}
|
||||
|
||||
EntityVillager entityvillager = (EntityVillager) entityliving;
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ // CraftBukkit start
|
||||
+ flag = zombifyVillager(worldserver, entityvillager, this.blockPosition(), this.isSilent(), CreatureSpawnEvent.SpawnReason.INFECTION) == null;
|
||||
+ }
|
||||
|
||||
- EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false);
|
||||
+ return flag;
|
||||
+ }
|
||||
+
|
||||
+ public static EntityZombieVillager zombifyVillager(WorldServer worldserver, EntityVillager entityvillager, net.minecraft.core.BlockPosition blockPosition, boolean silent, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
|
||||
+ if (entityzombievillager != null) {
|
||||
+ {
|
||||
+ EntityZombieVillager entityzombievillager = (EntityZombieVillager) entityvillager.convertTo(EntityTypes.ZOMBIE_VILLAGER, false, EntityTransformEvent.TransformReason.INFECTION, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
entityzombievillager.setVillagerData(entityvillager.getVillagerData());
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE).getValue());
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
|
||||
if (entityzombievillager != null) {
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true), (NBTTagCompound) null);
|
||||
@@ -422,15 +457,17 @@
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().createTag());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
- if (!this.isSilent()) {
|
||||
- worldserver.levelEvent((EntityHuman) null, 1026, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start
|
||||
+ if (!silent) {
|
||||
+ worldserver.levelEvent((EntityHuman) null, 1026, blockPosition, 0);
|
||||
}
|
||||
|
||||
- flag = false;
|
||||
+ // flag = false;
|
||||
}
|
||||
-
|
||||
- flag = false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
- }
|
||||
|
||||
- return flag;
|
||||
+ return entityzombievillager; // CraftBukkit
|
||||
+ return entityzombievillager;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -478,7 +513,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
+ worldaccess.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
@@ -483,7 +520,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
- worldaccess.addFreshEntity(entitychicken1);
|
||||
+ worldaccess.addFreshEntity(entitychicken1, CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglin.java
|
||||
@@ -54,6 +54,18 @@
|
||||
@@ -56,6 +56,18 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
|||
+import java.util.stream.Collectors;
|
||||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import net.minecraft.core.IRegistry;
|
||||
+import net.minecraft.core.registries.BuiltInRegistries;
|
||||
+import net.minecraft.nbt.NBTTagList;
|
||||
+import net.minecraft.nbt.NBTTagString;
|
||||
+import net.minecraft.nbt.NBTBase;
|
||||
|
@ -19,10 +19,10 @@
|
|||
public class EntityPiglin extends EntityPiglinAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_BABY_ID = DataWatcher.defineId(EntityPiglin.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -74,6 +86,10 @@
|
||||
@@ -76,6 +88,10 @@
|
||||
public boolean cannotHunt;
|
||||
protected static final ImmutableList<SensorType<? extends Sensor<? super EntityPiglin>>> SENSOR_TYPES = ImmutableList.of(SensorType.NEAREST_LIVING_ENTITIES, SensorType.NEAREST_PLAYERS, SensorType.NEAREST_ITEMS, SensorType.HURT_BY, SensorType.PIGLIN_SPECIFIC_SENSOR);
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
protected static final ImmutableList<MemoryModuleType<?>> MEMORY_TYPES = ImmutableList.of(MemoryModuleType.LOOK_TARGET, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_ADULT_PIGLINS, MemoryModuleType.NEARBY_ADULT_PIGLINS, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.ITEM_PICKUP_COOLDOWN_TICKS, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, new MemoryModuleType[]{MemoryModuleType.WALK_TARGET, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.ATTACK_TARGET, MemoryModuleType.ATTACK_COOLING_DOWN, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.PATH, MemoryModuleType.ANGRY_AT, MemoryModuleType.UNIVERSAL_ANGER, MemoryModuleType.AVOID_TARGET, MemoryModuleType.ADMIRING_ITEM, MemoryModuleType.TIME_TRYING_TO_REACH_ADMIRE_ITEM, MemoryModuleType.ADMIRING_DISABLED, MemoryModuleType.DISABLE_WALK_TO_ADMIRE_ITEM, MemoryModuleType.CELEBRATE_LOCATION, MemoryModuleType.DANCING, MemoryModuleType.HUNTED_RECENTLY, MemoryModuleType.NEAREST_VISIBLE_BABY_HOGLIN, MemoryModuleType.NEAREST_VISIBLE_NEMESIS, MemoryModuleType.NEAREST_VISIBLE_ZOMBIFIED, MemoryModuleType.RIDE_TARGET, MemoryModuleType.VISIBLE_ADULT_PIGLIN_COUNT, MemoryModuleType.VISIBLE_ADULT_HOGLIN_COUNT, MemoryModuleType.NEAREST_VISIBLE_HUNTABLE_HOGLIN, MemoryModuleType.NEAREST_TARGETABLE_PLAYER_NOT_WEARING_GOLD, MemoryModuleType.NEAREST_PLAYER_HOLDING_WANTED_ITEM, MemoryModuleType.ATE_RECENTLY, MemoryModuleType.NEAREST_REPELLENT});
|
||||
+ // CraftBukkit start - Custom bartering and interest list
|
||||
+ public Set<Item> allowedBarterItems = new HashSet<>();
|
||||
+ public Set<Item> interestItems = new HashSet<>();
|
||||
|
@ -30,33 +30,33 @@
|
|||
|
||||
public EntityPiglin(EntityTypes<? extends EntityPiglinAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -92,6 +108,14 @@
|
||||
@@ -94,6 +110,14 @@
|
||||
}
|
||||
|
||||
nbttagcompound.put("Inventory", this.inventory.createTag());
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
+ // CraftBukkit start
|
||||
+ NBTTagList barterList = new NBTTagList();
|
||||
+ allowedBarterItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
||||
+ allowedBarterItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(barterList::add);
|
||||
+ nbttagcompound.put("Bukkit.BarterList", barterList);
|
||||
+ NBTTagList interestList = new NBTTagList();
|
||||
+ interestItems.stream().map(IRegistry.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
|
||||
+ interestItems.stream().map(BuiltInRegistries.ITEM::getKey).map(MinecraftKey::toString).map(NBTTagString::valueOf).forEach(interestList::add);
|
||||
+ nbttagcompound.put("Bukkit.InterestList", interestList);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -100,6 +124,10 @@
|
||||
@@ -102,6 +126,10 @@
|
||||
this.setBaby(nbttagcompound.getBoolean("IsBaby"));
|
||||
this.setCannotHunt(nbttagcompound.getBoolean("CannotHunt"));
|
||||
this.inventory.fromTag(nbttagcompound.getList("Inventory", 10));
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
+ // CraftBukkit start
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(IRegistry.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.allowedBarterItems = nbttagcompound.getList("Bukkit.BarterList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ this.interestItems = nbttagcompound.getList("Bukkit.InterestList", 8).stream().map(NBTBase::getAsString).map(MinecraftKey::tryParse).map(BuiltInRegistries.ITEM::get).collect(Collectors.toCollection(HashSet::new));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@VisibleForDebug
|
||||
@@ -206,7 +234,7 @@
|
||||
@@ -223,7 +251,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<EntityPiglin> getBrain() {
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -349,7 +377,7 @@
|
||||
@@ -368,7 +396,7 @@
|
||||
}
|
||||
|
||||
protected void holdInOffHand(ItemStack itemstack) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
this.setItemSlot(EnumItemSlot.OFFHAND, itemstack);
|
||||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
@@ -394,8 +422,8 @@
|
||||
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -85,7 +85,7 @@
|
|||
|
||||
return flag && !flag1 ? true : (!flag && flag1 ? false : (this.isAdult() && !itemstack.is(Items.CROSSBOW) && itemstack1.is(Items.CROSSBOW) ? false : super.canReplaceCurrentItem(itemstack, itemstack1)));
|
||||
}
|
||||
@@ -405,7 +433,7 @@
|
||||
@@ -424,7 +452,7 @@
|
||||
|
||||
@Override
|
||||
protected SoundEffect getAmbientSound() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/EntityPiglinAbstract.java
|
||||
@@ -100,7 +100,7 @@
|
||||
@@ -108,7 +108,7 @@
|
||||
}
|
||||
|
||||
protected void finishConversion(WorldServer worldserver) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
|
||||
if (entitypigzombie != null) {
|
||||
entitypigzombie.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
@@ -117,7 +117,7 @@
|
||||
@@ -125,7 +125,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public EntityLiving getTarget() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
+++ b/net/minecraft/world/entity/monster/piglin/PiglinAI.java
|
||||
@@ -71,6 +71,13 @@
|
||||
@@ -74,6 +74,13 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -14,7 +14,26 @@
|
|||
public class PiglinAI {
|
||||
|
||||
public static final int REPELLENT_DETECTION_RANGE_HORIZONTAL = 8;
|
||||
@@ -186,13 +193,13 @@
|
||||
@@ -164,7 +171,8 @@
|
||||
}
|
||||
|
||||
private static void initRideHoglinActivity(BehaviorController<EntityPiglin> behaviorcontroller) {
|
||||
- behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ behaviorcontroller.addActivityAndRemoveMemoryWhenStopped(Activity.RIDE, 10, ImmutableList.of(BehaviorStartRiding.create(0.8F), BehaviorLookTarget.create(PiglinAI::isPlayerHoldingLovedItem, 8.0F), BehaviorBuilder.sequence(BehaviorBuilder.triggerIf(Entity::isPassenger), TriggerGate.triggerOneShuffled(ImmutableList.<Pair<? extends net.minecraft.world.entity.ai.behavior.declarative.Trigger<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(BehaviorBuilder.triggerIf((entitypiglin) -> {
|
||||
return true;
|
||||
}), 1)).build())), BehaviorStopRiding.create(8, PiglinAI::wantsToStopRiding)), MemoryModuleType.RIDE_TARGET);
|
||||
}
|
||||
@@ -174,7 +182,7 @@
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityLiving> createIdleLookBehaviors() {
|
||||
- return new BehaviorGateSingle<>(ImmutableList.builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build());
|
||||
+ return new BehaviorGateSingle<>(ImmutableList.<Pair<? extends BehaviorControl<? super EntityLiving>, Integer>>builder().addAll(createLookBehaviors()).add(Pair.of(new BehaviorNop(30, 60), 1)).build()); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static BehaviorGateSingle<EntityPiglin> createIdleMovementBehaviors() {
|
||||
@@ -195,13 +203,13 @@
|
||||
|
||||
protected static void updateActivity(EntityPiglin entitypiglin) {
|
||||
BehaviorController<EntityPiglin> behaviorcontroller = entitypiglin.getBrain();
|
||||
|
@ -31,7 +50,7 @@
|
|||
|
||||
Objects.requireNonNull(entitypiglin);
|
||||
optional.ifPresent(entitypiglin::playSoundEvent);
|
||||
@@ -224,23 +231,27 @@
|
||||
@@ -233,23 +241,27 @@
|
||||
stopWalking(entitypiglin);
|
||||
ItemStack itemstack;
|
||||
|
||||
|
@ -58,12 +77,12 @@
|
|||
} else if (isFood(itemstack) && !hasEatenRecently(entitypiglin)) {
|
||||
eat(entitypiglin);
|
||||
} else {
|
||||
- boolean flag = entitypiglin.equipItemIfPossible(itemstack);
|
||||
+ boolean flag = entitypiglin.equipItemIfPossible(itemstack, entityitem); // CraftBukkit
|
||||
- boolean flag = !entitypiglin.equipItemIfPossible(itemstack).equals(ItemStack.EMPTY);
|
||||
+ boolean flag = !entitypiglin.equipItemIfPossible(itemstack, entityitem).equals(ItemStack.EMPTY); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
putInInventory(entitypiglin, itemstack);
|
||||
@@ -276,9 +287,14 @@
|
||||
@@ -285,9 +297,14 @@
|
||||
boolean flag1;
|
||||
|
||||
if (entitypiglin.isAdult()) {
|
||||
|
@ -78,9 +97,9 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!flag1) {
|
||||
boolean flag2 = entitypiglin.equipItemIfPossible(itemstack);
|
||||
boolean flag2 = !entitypiglin.equipItemIfPossible(itemstack).isEmpty();
|
||||
|
||||
@@ -291,7 +307,7 @@
|
||||
@@ -300,7 +317,7 @@
|
||||
if (!flag1) {
|
||||
ItemStack itemstack1 = entitypiglin.getMainHandItem();
|
||||
|
||||
|
@ -89,7 +108,7 @@
|
|||
putInInventory(entitypiglin, itemstack1);
|
||||
} else {
|
||||
throwItems(entitypiglin, Collections.singletonList(itemstack1));
|
||||
@@ -368,7 +384,7 @@
|
||||
@@ -377,7 +394,7 @@
|
||||
return false;
|
||||
} else if (isAdmiringDisabled(entitypiglin) && entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ATTACK_TARGET)) {
|
||||
return false;
|
||||
|
@ -98,7 +117,7 @@
|
|||
return isNotHoldingLovedItemInOffHand(entitypiglin);
|
||||
} else {
|
||||
boolean flag = entitypiglin.canAddToInventory(itemstack);
|
||||
@@ -377,6 +393,12 @@
|
||||
@@ -386,6 +403,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,7 +130,7 @@
|
|||
protected static boolean isLovedItem(ItemStack itemstack) {
|
||||
return itemstack.is(TagsItem.PIGLIN_LOVED);
|
||||
}
|
||||
@@ -472,7 +494,7 @@
|
||||
@@ -481,7 +504,7 @@
|
||||
}
|
||||
|
||||
protected static boolean canAdmire(EntityPiglin entitypiglin, ItemStack itemstack) {
|
||||
|
@ -120,7 +139,7 @@
|
|||
}
|
||||
|
||||
protected static void wasHurtBy(EntityPiglin entitypiglin, EntityLiving entityliving) {
|
||||
@@ -739,6 +761,12 @@
|
||||
@@ -738,6 +761,12 @@
|
||||
return entitypiglin.getBrain().hasMemoryValue(MemoryModuleType.ADMIRING_ITEM);
|
||||
}
|
||||
|
||||
|
@ -133,7 +152,7 @@
|
|||
private static boolean isBarterCurrency(ItemStack itemstack) {
|
||||
return itemstack.is(PiglinAI.BARTERING_ITEM);
|
||||
}
|
||||
@@ -776,7 +804,7 @@
|
||||
@@ -775,7 +804,7 @@
|
||||
}
|
||||
|
||||
private static boolean isNotHoldingLovedItemInOffHand(EntityPiglin entitypiglin) {
|
||||
|
|
|
@ -61,3 +61,12 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -560,7 +560,7 @@
|
||||
|
||||
public void setAttackTarget(EntityLiving entityliving) {
|
||||
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
|
||||
- this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, (Object) entityliving);
|
||||
+ this.getBrain().setMemory(MemoryModuleType.ATTACK_TARGET, entityliving); // CraftBukkit - decompile error
|
||||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue