13
0
geforkt von Mirrors/Paper

Update to Minecraft 1.19.4

By: md_5 <git@md-5.net>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2023-03-15 03:30:00 +11:00
Ursprung 90a887a912
Commit 40076782ed
227 geänderte Dateien mit 2788 neuen und 1621 gelöschten Zeilen

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/commands/CommandDispatcher.java --- a/net/minecraft/commands/CommandDispatcher.java
+++ b/net/minecraft/commands/CommandDispatcher.java +++ b/net/minecraft/commands/CommandDispatcher.java
@@ -116,6 +116,14 @@ @@ -119,6 +119,14 @@
import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.JvmProfiler;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -15,7 +15,7 @@
public class CommandDispatcher { public class CommandDispatcher {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -127,6 +135,7 @@ @@ -130,6 +138,7 @@
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher(); private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) { public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) {
@ -23,7 +23,7 @@
CommandAdvancement.register(this.dispatcher); CommandAdvancement.register(this.dispatcher);
CommandAttribute.register(this.dispatcher, commandbuildcontext); CommandAttribute.register(this.dispatcher, commandbuildcontext);
CommandExecute.register(this.dispatcher, commandbuildcontext); CommandExecute.register(this.dispatcher, commandbuildcontext);
@@ -212,6 +221,11 @@ @@ -218,6 +227,11 @@
CommandPublish.register(this.dispatcher); CommandPublish.register(this.dispatcher);
} }
@ -35,7 +35,7 @@
this.dispatcher.setConsumer((commandcontext, flag, i) -> { this.dispatcher.setConsumer((commandcontext, flag, i) -> {
((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i); ((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i);
}); });
@@ -224,12 +238,59 @@ @@ -230,12 +244,59 @@
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions()); return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
} }
@ -96,7 +96,7 @@
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource(); CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource();
commandlistenerwrapper.getServer().getProfiler().push(() -> { commandlistenerwrapper.getServer().getProfiler().push(() -> {
@@ -254,7 +315,7 @@ @@ -260,7 +321,7 @@
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) { if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor()); int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> { IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
@ -105,7 +105,7 @@
}); });
if (j > 10) { if (j > 10) {
@@ -304,11 +365,36 @@ @@ -310,11 +371,36 @@
} }
public void sendCommands(EntityPlayer entityplayer) { public void sendCommands(EntityPlayer entityplayer) {
@ -143,7 +143,7 @@
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode)); entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
} }
@@ -319,7 +405,7 @@ @@ -325,7 +411,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next(); CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) { if (commandnode2.canUse(commandlistenerwrapper)) {
@ -152,7 +152,7 @@
argumentbuilder.requires((icompletionprovider) -> { argumentbuilder.requires((icompletionprovider) -> {
return true; return true;
@@ -342,7 +428,7 @@ @@ -348,7 +434,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect())); argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java --- a/net/minecraft/core/dispenser/IDispenseBehavior.java
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java +++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
@@ -77,6 +77,21 @@ @@ -78,6 +78,21 @@
import net.minecraft.world.phys.MovingObjectPositionBlock; import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -22,7 +22,7 @@
public interface IDispenseBehavior { public interface IDispenseBehavior {
Logger LOGGER = LogUtils.getLogger(); Logger LOGGER = LogUtils.getLogger();
@@ -201,14 +216,42 @@ @@ -202,14 +217,42 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING); EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag()); EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
@ -67,7 +67,7 @@
isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos()); isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
return itemstack; return itemstack;
} }
@@ -227,12 +270,40 @@ @@ -228,13 +271,41 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING); EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection); BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
WorldServer worldserver = isourceblock.getLevel(); WorldServer worldserver = isourceblock.getLevel();
@ -99,17 +99,18 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
EntityArmorStand entityarmorstand = new EntityArmorStand(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D); Consumer<EntityArmorStand> consumer = EntityTypes.appendDefaultStackConfig((entityarmorstand) -> {
entityarmorstand.setYRot(enumdirection.toYRot());
}, worldserver, itemstack, (EntityHuman) null);
EntityArmorStand entityarmorstand = (EntityArmorStand) EntityTypes.ARMOR_STAND.spawn(worldserver, itemstack.getTag(), consumer, blockposition, EnumMobSpawn.DISPENSER, false, false);
if (entityarmorstand != null) {
- itemstack.shrink(1);
+ // itemstack.shrink(1); // CraftBukkit - Handled during event processing
}
EntityTypes.updateCustomEntityTag(worldserver, (EntityHuman) null, entityarmorstand, itemstack.getTag());
entityarmorstand.setYRot(enumdirection.toYRot());
worldserver.addFreshEntity(entityarmorstand);
- itemstack.shrink(1);
+ // itemstack.shrink(1); // CraftBukkit - Handled during event processing
return itemstack; return itemstack;
} @@ -255,8 +326,35 @@
});
@@ -251,8 +322,35 @@
}); });
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -146,7 +147,7 @@
this.setSuccess(true); this.setSuccess(true);
return itemstack; return itemstack;
} else { } else {
@@ -279,7 +377,35 @@ @@ -283,7 +381,35 @@
entityhorseabstract = (EntityHorseAbstract) iterator1.next(); entityhorseabstract = (EntityHorseAbstract) iterator1.next();
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed()); } while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
@ -183,7 +184,7 @@
this.setSuccess(true); this.setSuccess(true);
return itemstack; return itemstack;
} }
@@ -322,9 +448,35 @@ @@ -326,9 +452,35 @@
} }
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next(); entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
@ -221,7 +222,7 @@
this.setSuccess(true); this.setSuccess(true);
return itemstack; return itemstack;
} }
@@ -333,12 +485,41 @@ @@ -337,12 +489,41 @@
@Override @Override
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) { public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING); EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
@ -264,7 +265,7 @@
return itemstack; return itemstack;
} }
@@ -360,12 +541,40 @@ @@ -364,12 +545,40 @@
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D); double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D); double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D); double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
@ -310,7 +311,7 @@
return itemstack; return itemstack;
} }
@@ -399,9 +608,52 @@ @@ -405,9 +614,52 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING)); BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
WorldServer worldserver = isourceblock.getLevel(); WorldServer worldserver = isourceblock.getLevel();
@ -364,7 +365,7 @@
} else { } else {
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack); return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
} }
@@ -428,7 +680,7 @@ @@ -434,7 +686,7 @@
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
if (block instanceof IFluidSource) { if (block instanceof IFluidSource) {
@ -373,7 +374,7 @@
if (itemstack1.isEmpty()) { if (itemstack1.isEmpty()) {
return super.execute(isourceblock, itemstack); return super.execute(isourceblock, itemstack);
@@ -436,6 +688,32 @@ @@ -442,6 +694,32 @@
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition); worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
Item item = itemstack1.getItem(); Item item = itemstack1.getItem();
@ -406,7 +407,7 @@
itemstack.shrink(1); itemstack.shrink(1);
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return new ItemStack(item); return new ItemStack(item);
@@ -457,14 +735,42 @@ @@ -463,14 +741,42 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) { protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel(); WorldServer worldserver = isourceblock.getLevel();
@ -451,7 +452,7 @@
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) { } else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
if (iblockdata.getBlock() instanceof BlockTNT) { if (iblockdata.getBlock() instanceof BlockTNT) {
BlockTNT.explode(worldserver, blockposition); BlockTNT.explode(worldserver, blockposition);
@@ -490,12 +796,62 @@ @@ -496,12 +802,62 @@
this.setSuccess(true); this.setSuccess(true);
WorldServer worldserver = isourceblock.getLevel(); WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING)); BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@ -514,7 +515,7 @@
return itemstack; return itemstack;
} }
@@ -505,12 +861,41 @@ @@ -511,12 +867,41 @@
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) { protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
WorldServer worldserver = isourceblock.getLevel(); WorldServer worldserver = isourceblock.getLevel();
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING)); BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
@ -558,7 +559,7 @@
return itemstack; return itemstack;
} }
}); });
@@ -535,6 +920,30 @@ @@ -541,6 +926,30 @@
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING); EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection); BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
@ -589,7 +590,7 @@
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) { if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, RotationSegment.convertToSegment(enumdirection)), 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); worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
@@ -560,6 +969,30 @@ @@ -566,6 +975,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING)); BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN; BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
@ -620,7 +621,7 @@
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) { if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
if (!worldserver.isClientSide) { if (!worldserver.isClientSide) {
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3); worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
@@ -609,6 +1042,30 @@ @@ -615,6 +1048,30 @@
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING)); BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
IBlockData iblockdata = worldserver.getBlockState(blockposition); IBlockData iblockdata = worldserver.getBlockState(blockposition);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/network/NetworkManager.java --- a/net/minecraft/network/NetworkManager.java
+++ b/net/minecraft/network/NetworkManager.java +++ b/net/minecraft/network/NetworkManager.java
@@ -84,6 +84,7 @@ @@ -86,6 +86,7 @@
private float averageSentPackets; private float averageSentPackets;
private int tickCount; private int tickCount;
private boolean handlingFault; private boolean handlingFault;
@ -8,7 +8,7 @@
public NetworkManager(EnumProtocolDirection enumprotocoldirection) { public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
this.receiving = enumprotocoldirection; this.receiving = enumprotocoldirection;
@@ -164,7 +165,7 @@ @@ -167,7 +168,7 @@
} }
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) { private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) {
@ -17,7 +17,7 @@
} }
public void setListener(PacketListener packetlistener) { public void setListener(PacketListener packetlistener) {
@@ -289,7 +290,7 @@ @@ -296,7 +297,7 @@
public void disconnect(IChatBaseComponent ichatbasecomponent) { public void disconnect(IChatBaseComponent ichatbasecomponent) {
if (this.channel.isOpen()) { if (this.channel.isOpen()) {

Datei anzeigen

@ -1,15 +1,15 @@
--- a/net/minecraft/network/PacketDataSerializer.java --- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java +++ b/net/minecraft/network/PacketDataSerializer.java
@@ -74,6 +74,8 @@ @@ -81,6 +81,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock; import org.joml.Quaternionf;
import net.minecraft.world.phys.Vec3D; import org.joml.Vector3f;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit +import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+ +
public class PacketDataSerializer extends ByteBuf { public class PacketDataSerializer extends ByteBuf {
private static final int MAX_VARINT_SIZE = 5; private static final int MAX_VARINT_SIZE = 5;
@@ -195,7 +197,7 @@ @@ -220,7 +222,7 @@
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) { public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) {
int i = this.readVarInt(); int i = this.readVarInt();
@ -18,7 +18,7 @@
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
c0.add(packetdataserializer_a.apply(this)); c0.add(packetdataserializer_a.apply(this));
@@ -206,7 +208,7 @@ @@ -231,7 +233,7 @@
public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) { public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) {
this.writeVarInt(collection.size()); this.writeVarInt(collection.size());
@ -27,7 +27,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
T t0 = iterator.next(); T t0 = iterator.next();
@@ -233,12 +235,12 @@ @@ -258,12 +260,12 @@
public void writeIntIdList(IntList intlist) { public void writeIntIdList(IntList intlist) {
this.writeVarInt(intlist.size()); this.writeVarInt(intlist.size());
@ -42,7 +42,7 @@
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
K k0 = packetdataserializer_a.apply(this); K k0 = packetdataserializer_a.apply(this);
@@ -272,7 +274,7 @@ @@ -297,7 +299,7 @@
} }
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) { public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
@ -51,7 +51,7 @@
BitSet bitset = new BitSet(ae.length); BitSet bitset = new BitSet(ae.length);
for (int i = 0; i < ae.length; ++i) { for (int i = 0; i < ae.length; ++i) {
@@ -283,7 +285,7 @@ @@ -308,7 +310,7 @@
} }
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) { public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
@ -60,7 +60,7 @@
BitSet bitset = this.readFixedBitSet(ae.length); BitSet bitset = this.readFixedBitSet(ae.length);
EnumSet<E> enumset = EnumSet.noneOf(oclass); EnumSet<E> enumset = EnumSet.noneOf(oclass);
@@ -499,7 +501,7 @@ @@ -545,7 +547,7 @@
} }
public <T extends Enum<T>> T readEnum(Class<T> oclass) { public <T extends Enum<T>> T readEnum(Class<T> oclass) {
@ -69,7 +69,7 @@
} }
public PacketDataSerializer writeEnum(Enum<?> oenum) { public PacketDataSerializer writeEnum(Enum<?> oenum) {
@@ -576,7 +578,7 @@ @@ -622,7 +624,7 @@
} else { } else {
try { try {
NBTCompressedStreamTools.write(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this))); NBTCompressedStreamTools.write(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this)));
@ -78,7 +78,7 @@
throw new EncoderException(ioexception); throw new EncoderException(ioexception);
} }
} }
@@ -613,7 +615,7 @@ @@ -659,7 +661,7 @@
} }
public PacketDataSerializer writeItem(ItemStack itemstack) { public PacketDataSerializer writeItem(ItemStack itemstack) {
@ -87,7 +87,7 @@
this.writeBoolean(false); this.writeBoolean(false);
} else { } else {
this.writeBoolean(true); this.writeBoolean(true);
@@ -642,6 +644,11 @@ @@ -688,6 +690,11 @@
ItemStack itemstack = new ItemStack(item, b0); ItemStack itemstack = new ItemStack(item, b0);
itemstack.setTag(this.readNbt()); itemstack.setTag(this.readNbt());

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/network/chat/ChatHexColor.java --- a/net/minecraft/network/chat/ChatHexColor.java
+++ b/net/minecraft/network/chat/ChatHexColor.java +++ b/net/minecraft/network/chat/ChatHexColor.java
@@ -20,7 +20,7 @@ @@ -22,7 +22,7 @@
return chathexcolor != null ? DataResult.success(chathexcolor) : DataResult.error("String is not a valid color name or hex color code"); });
}, ChatHexColor::serialize); }, ChatHexColor::serialize);
private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::isColor).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> { private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::isColor).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
- return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName()); - return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName());
@ -9,7 +9,7 @@
})); }));
private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> { private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
return chathexcolor.name; return chathexcolor.name;
@@ -28,16 +28,22 @@ @@ -30,16 +30,22 @@
private final int value; private final int value;
@Nullable @Nullable
public final String name; public final String name;

Datei anzeigen

@ -17,7 +17,7 @@
if (!iasynctaskhandler.isSameThread()) { if (!iasynctaskhandler.isSameThread()) {
iasynctaskhandler.executeIfPossible(() -> { iasynctaskhandler.executeIfPossible(() -> {
+ if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590
if (t0.getConnection().isConnected()) { if (t0.isAcceptingMessages()) {
try { try {
packet.handle(t0); packet.handle(t0);
@@ -36,6 +42,10 @@ @@ -36,6 +42,10 @@

Datei anzeigen

@ -12,7 +12,7 @@
public class DataWatcher { public class DataWatcher {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -138,6 +143,13 @@ @@ -142,6 +147,13 @@
} }
@ -26,7 +26,7 @@
public boolean isDirty() { public boolean isDirty() {
return this.isDirty; return this.isDirty;
} }
@@ -218,7 +230,7 @@ @@ -223,7 +235,7 @@
if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) { 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())); 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 { } else {
@ -35,7 +35,7 @@
} }
} }
@@ -226,6 +238,18 @@ @@ -231,6 +243,18 @@
return this.itemsById.isEmpty(); return this.itemsById.isEmpty();
} }
@ -54,7 +54,7 @@
public static class Item<T> { public static class Item<T> {
final DataWatcherObject<T> accessor; final DataWatcherObject<T> accessor;
@@ -268,7 +292,7 @@ @@ -273,7 +297,7 @@
} }
} }

Datei anzeigen

@ -1,19 +1,19 @@
--- a/net/minecraft/server/AdvancementDataPlayer.java --- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java +++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -179,7 +179,11 @@ @@ -144,7 +144,11 @@
Advancement advancement = advancementdataworld.getAdvancement((MinecraftKey) entry.getKey()); Advancement advancement = advancementdataworld.getAdvancement((MinecraftKey) entry.getKey());
if (advancement == null) { if (advancement == null) {
- AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file); - AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.playerSavePath);
+ // CraftBukkit start + // CraftBukkit start
+ if (entry.getKey().getNamespace().equals("minecraft")) { + if (entry.getKey().getNamespace().equals("minecraft")) {
+ AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.file); + AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.playerSavePath);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
} else { } else {
this.startProgress(advancement, (AdvancementProgress) entry.getValue()); this.startProgress(advancement, (AdvancementProgress) entry.getValue());
} this.progressChanged.add(advancement);
@@ -274,6 +278,7 @@ @@ -227,6 +231,7 @@
this.progressChanged.add(advancement); this.progressChanged.add(advancement);
flag = true; flag = true;
if (!flag1 && advancementprogress.isDone()) { if (!flag1 && advancementprogress.isDone()) {

Datei anzeigen

@ -1,15 +1,15 @@
--- a/net/minecraft/server/Main.java --- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java
@@ -59,6 +59,16 @@ @@ -64,6 +64,16 @@
import net.minecraft.world.level.storage.WorldInfo; import net.minecraft.world.level.storage.WorldInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
+// CraftBukkit start +// CraftBukkit start
+import com.google.common.base.Charsets; +import com.google.common.base.Charsets;
+import com.mojang.bridge.game.PackType;
+import java.io.InputStreamReader; +import java.io.InputStreamReader;
+import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicReference;
+import net.minecraft.SharedConstants; +import net.minecraft.SharedConstants;
+import net.minecraft.server.packs.EnumResourcePackType;
+import net.minecraft.world.level.dimension.WorldDimension; +import net.minecraft.world.level.dimension.WorldDimension;
+import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.configuration.file.YamlConfiguration;
+// CraftBukkit end +// CraftBukkit end
@ -17,7 +17,7 @@
public class Main { public class Main {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -66,8 +76,9 @@ @@ -71,8 +81,9 @@
public Main() {} public Main() {}
@DontObfuscate @DontObfuscate
@ -28,7 +28,7 @@
OptionParser optionparser = new OptionParser(); OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui"); OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -92,9 +103,12 @@ @@ -98,15 +109,18 @@
optionparser.printHelpOn(System.err); optionparser.printHelpOn(System.err);
return; return;
} }
@ -36,22 +36,29 @@
+ +
+ try { + try {
- Path path = (Path) optionset.valueOf(optionspec14);
+ Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
if (path != null) {
writePidFile(path);
}
CrashReport.preload(); CrashReport.preload();
- if (optionset.has(optionspec13)) { - if (optionset.has(optionspec13)) {
+ if (optionset.has("jfrProfile")) { // CraftBukkit + if (optionset.has("jfrProfile")) { // CraftBukkit
JvmProfiler.INSTANCE.start(Environment.SERVER); JvmProfiler.INSTANCE.start(Environment.SERVER);
} }
@@ -102,13 +116,26 @@ @@ -114,13 +128,26 @@
DispenserRegistry.validate(); DispenserRegistry.validate();
SystemUtils.startTimerHackThread(); SystemUtils.startTimerHackThread();
Path path = Paths.get("server.properties"); Path path1 = Paths.get("server.properties");
- DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path); - DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(path1);
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support + DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
dedicatedserversettings.forceSave(); dedicatedserversettings.forceSave();
Path path1 = Paths.get("eula.txt"); Path path2 = Paths.get("eula.txt");
EULA eula = new EULA(path1); EULA eula = new EULA(path2);
- if (optionset.has(optionspec1)) { - if (optionset.has(optionspec1)) {
+ if (optionset.has("initSettings")) { // CraftBukkit + if (optionset.has("initSettings")) { // CraftBukkit
@ -68,10 +75,10 @@
+ commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(Main.class.getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8))); + commandsConfiguration.setDefaults(YamlConfiguration.loadConfiguration(new InputStreamReader(Main.class.getClassLoader().getResourceAsStream("configurations/commands.yml"), Charsets.UTF_8)));
+ commandsConfiguration.save(commandFile); + commandsConfiguration.save(commandFile);
+ // CraftBukkit end + // CraftBukkit end
Main.LOGGER.info("Initialized '{}' and '{}'", path.toAbsolutePath(), path1.toAbsolutePath()); Main.LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
return; return;
} }
@@ -118,11 +145,12 @@ @@ -130,11 +157,12 @@
return; return;
} }
@ -87,7 +94,7 @@
WorldInfo worldinfo = convertable_conversionsession.getSummary(); WorldInfo worldinfo = convertable_conversionsession.getSummary();
if (worldinfo != null) { if (worldinfo != null) {
@@ -137,13 +165,31 @@ @@ -149,13 +177,31 @@
} }
} }
@ -109,7 +116,7 @@
+ com.google.common.io.Files.write("{\n" + com.google.common.io.Files.write("{\n"
+ + " \"pack\": {\n" + + " \"pack\": {\n"
+ + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n" + + " \"description\": \"Data pack for resources provided by Bukkit plugins\",\n"
+ + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(PackType.DATA) + "\n" + + " \"pack_format\": " + SharedConstants.getCurrentVersion().getPackVersion(EnumResourcePackType.SERVER_DATA) + "\n"
+ + " }\n" + + " }\n"
+ + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8); + + "}\n", mcMeta, com.google.common.base.Charsets.UTF_8);
+ } catch (java.io.IOException ex) { + } catch (java.io.IOException ex) {
@ -120,7 +127,7 @@
WorldStem worldstem; WorldStem worldstem;
@@ -152,6 +198,7 @@ @@ -164,6 +210,7 @@
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> { worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
return WorldLoader.load(worldloader_c, (worldloader_a) -> { return WorldLoader.load(worldloader_c, (worldloader_a) -> {
@ -128,7 +135,7 @@
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen()); 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()); Pair<SaveData, WorldDimensions.b> pair = convertable_conversionsession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
@@ -163,7 +210,7 @@ @@ -175,7 +222,7 @@
WorldOptions worldoptions; WorldOptions worldoptions;
WorldDimensions worlddimensions; WorldDimensions worlddimensions;
@ -137,7 +144,7 @@
worldsettings = MinecraftServer.DEMO_SETTINGS; worldsettings = MinecraftServer.DEMO_SETTINGS;
worldoptions = WorldOptions.DEMO_OPTIONS; worldoptions = WorldOptions.DEMO_OPTIONS;
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen()); worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
@@ -171,7 +218,7 @@ @@ -183,7 +230,7 @@
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties(); DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration()); worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
@ -146,7 +153,7 @@
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen()); worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
} }
@@ -187,6 +234,7 @@ @@ -199,6 +246,7 @@
return; return;
} }
@ -154,7 +161,7 @@
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess(); IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
if (optionset.has(optionspec4)) { if (optionset.has(optionspec4)) {
@@ -198,21 +246,32 @@ @@ -210,21 +258,32 @@
SaveData savedata = worldstem.worldData(); SaveData savedata = worldstem.worldData();
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata); convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
@ -189,7 +196,7 @@
Thread thread = new Thread("Server Shutdown Thread") { Thread thread = new Thread("Server Shutdown Thread") {
public void run() { public void run() {
dedicatedserver.halt(true); dedicatedserver.halt(true);
@@ -221,6 +280,7 @@ @@ -233,6 +292,7 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER)); thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread); Runtime.getRuntime().addShutdownHook(thread);
@ -197,7 +204,7 @@
} catch (Exception exception1) { } catch (Exception exception1) {
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1); Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
} }
@@ -246,7 +306,7 @@ @@ -268,7 +328,7 @@
} }
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) { public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) {

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -165,6 +165,32 @@ @@ -165,6 +165,32 @@
import org.apache.commons.lang3.Validate; import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger; import org.slf4j.Logger;
+// CraftBukkit start +// CraftBukkit start
@ -33,7 +33,7 @@
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable { public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogUtils.getLogger(); public static final Logger LOGGER = LogUtils.getLogger();
@@ -247,6 +273,20 @@ @@ -250,6 +276,20 @@
protected SaveData worldData; protected SaveData worldData;
private volatile boolean isSaving; private volatile boolean isSaving;
@ -54,7 +54,7 @@
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) { public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference(); AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> { Thread thread = new Thread(() -> {
@@ -260,14 +300,14 @@ @@ -263,14 +303,14 @@
thread.setPriority(8); thread.setPriority(8);
} }
@ -71,7 +71,7 @@
super("Server"); super("Server");
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE; this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
this.profiler = this.metricsRecorder.getProfiler(); this.profiler = this.metricsRecorder.getProfiler();
@@ -288,7 +328,7 @@ @@ -290,7 +330,7 @@
this.frameTimer = new CircularTimer(); this.frameTimer = new CircularTimer();
this.registries = worldstem.registries(); this.registries = worldstem.registries();
this.worldData = worldstem.worldData(); this.worldData = worldstem.worldData();
@ -80,7 +80,7 @@
throw new IllegalStateException("Missing Overworld dimension data"); throw new IllegalStateException("Missing Overworld dimension data");
} else { } else {
this.proxy = proxy; this.proxy = proxy;
@@ -311,13 +351,40 @@ @@ -313,13 +353,40 @@
this.serverThread = thread; this.serverThread = thread;
this.executor = SystemUtils.backgroundExecutor(); this.executor = SystemUtils.backgroundExecutor();
} }
@ -122,7 +122,7 @@
ScoreboardServer scoreboardserver1 = this.getScoreboard(); ScoreboardServer scoreboardserver1 = this.getScoreboard();
Objects.requireNonNull(scoreboardserver1); Objects.requireNonNull(scoreboardserver1);
@@ -326,7 +393,7 @@ @@ -328,7 +395,7 @@
protected abstract boolean initServer() throws IOException; protected abstract boolean initServer() throws IOException;
@ -131,7 +131,7 @@
if (!JvmProfiler.INSTANCE.isRunning()) { if (!JvmProfiler.INSTANCE.isRunning()) {
; ;
} }
@@ -334,12 +401,8 @@ @@ -336,12 +403,8 @@
boolean flag = false; boolean flag = false;
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted(); ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
@ -145,7 +145,7 @@
if (profiledduration != null) { if (profiledduration != null) {
profiledduration.finish(); profiledduration.finish();
} }
@@ -354,25 +417,183 @@ @@ -356,25 +419,183 @@
} }
@ -223,9 +223,7 @@
+ MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----"); + MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----");
+ } + }
+ } + }
+
- this.levels.put(World.OVERWORLD, worldserver);
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
+ try { + try {
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey); + worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey);
+ } catch (IOException ex) { + } catch (IOException ex) {
@ -235,9 +233,7 @@
+ +
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name); + org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name); + org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
+
- this.readScoreboard(worldpersistentdata);
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
+ WorldDataServer worlddata; + WorldDataServer worlddata;
+ WorldLoader.a worldloader_a = this.worldLoader; + WorldLoader.a worldloader_a = this.worldLoader;
+ IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM); + IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
@ -293,9 +289,13 @@
+ if (dimensionKey == WorldDimension.OVERWORLD) { + if (dimensionKey == WorldDimension.OVERWORLD) {
+ this.worldData = worlddata; + this.worldData = worlddata;
+ this.worldData.setGameType(((DedicatedServer) this).getProperties().gamemode); // From DedicatedServer.init + this.worldData.setGameType(((DedicatedServer) this).getProperties().gamemode); // From DedicatedServer.init
+
- this.levels.put(World.OVERWORLD, worldserver);
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11); + WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
+
- this.readScoreboard(worldpersistentdata);
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider); + world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
+ WorldPersistentData worldpersistentdata = world.getDataStorage(); + WorldPersistentData worldpersistentdata = world.getDataStorage();
+ this.readScoreboard(worldpersistentdata); + this.readScoreboard(worldpersistentdata);
@ -344,7 +344,7 @@
if (!iworlddataserver.isInitialized()) { if (!iworlddataserver.isInitialized()) {
try { try {
@@ -396,29 +617,8 @@ @@ -398,29 +619,8 @@
iworlddataserver.setInitialized(true); iworlddataserver.setInitialized(true);
} }
@ -375,7 +375,7 @@
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) { private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
if (flag1) { if (flag1) {
@@ -426,6 +626,21 @@ @@ -428,6 +628,21 @@
} else { } else {
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource(); ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition()); ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
@ -397,7 +397,7 @@
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver); int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
if (i < worldserver.getMinBuildHeight()) { if (i < worldserver.getMinBuildHeight()) {
@@ -485,8 +700,11 @@ @@ -487,8 +702,11 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR); iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
} }
@ -411,7 +411,7 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location()); MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
BlockPosition blockposition = worldserver.getSharedSpawnPos(); BlockPosition blockposition = worldserver.getSharedSpawnPos();
@@ -496,19 +714,23 @@ @@ -498,19 +716,23 @@
chunkproviderserver.getLightEngine().setTaskPerBatch(500); chunkproviderserver.getLightEngine().setTaskPerBatch(500);
this.nextTickTime = SystemUtils.getMillis(); this.nextTickTime = SystemUtils.getMillis();
@ -444,7 +444,7 @@
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks"); ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
if (forcedchunk != null) { if (forcedchunk != null) {
@@ -523,11 +745,18 @@ @@ -525,11 +747,18 @@
} }
} }
@ -466,7 +466,7 @@
} }
public EnumGamemode getDefaultGameType() { public EnumGamemode getDefaultGameType() {
@@ -557,12 +786,16 @@ @@ -559,12 +788,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2); worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
} }
@ -483,7 +483,7 @@
if (flag1) { if (flag1) {
Iterator iterator1 = this.getAllLevels().iterator(); Iterator iterator1 = this.getAllLevels().iterator();
@@ -597,12 +830,33 @@ @@ -599,12 +832,33 @@
this.stopServer(); this.stopServer();
} }
@ -517,7 +517,7 @@
if (this.getConnection() != null) { if (this.getConnection() != null) {
this.getConnection().stop(); this.getConnection().stop();
} }
@@ -612,6 +866,7 @@ @@ -614,6 +868,7 @@
MinecraftServer.LOGGER.info("Saving players"); MinecraftServer.LOGGER.info("Saving players");
this.playerList.saveAll(); this.playerList.saveAll();
this.playerList.removeAll(); this.playerList.removeAll();
@ -525,7 +525,14 @@
} }
MinecraftServer.LOGGER.info("Saving worlds"); MinecraftServer.LOGGER.info("Saving worlds");
@@ -707,9 +962,10 @@ @@ -701,15 +956,16 @@
}
this.nextTickTime = SystemUtils.getMillis();
- this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse((Object) null);
+ this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
this.status = this.buildServerStatus();
while (this.running) { while (this.running) {
long i = SystemUtils.getMillis() - this.nextTickTime; long i = SystemUtils.getMillis() - this.nextTickTime;
@ -585,8 +592,8 @@
this.getProfiler().incrementCounter("runTask"); this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask); super.doRunTask(ticktask);
} }
@@ -909,7 +1179,7 @@ @@ -891,7 +1161,7 @@
} this.status = this.buildServerStatus();
} }
- if (this.tickCount % 6000 == 0) { - if (this.tickCount % 6000 == 0) {
@ -594,7 +601,7 @@
MinecraftServer.LOGGER.debug("Autosave started"); MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save"); this.profiler.push("save");
this.saveEverything(true, false, false); this.saveEverything(true, false, false);
@@ -928,22 +1198,39 @@ @@ -938,22 +1208,39 @@
} }
public void tickChildren(BooleanSupplier booleansupplier) { public void tickChildren(BooleanSupplier booleansupplier) {
@ -627,14 +634,14 @@
+ /* Drop global time updates + /* Drop global time updates
if (this.tickCount % 20 == 0) { if (this.tickCount % 20 == 0) {
this.profiler.push("timeSync"); this.profiler.push("timeSync");
this.playerList.broadcastAll(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)), worldserver.dimension()); this.synchronizeTime(worldserver);
this.profiler.pop(); this.profiler.pop();
} }
+ // CraftBukkit end */ + // CraftBukkit end */
this.profiler.push("tick"); this.profiler.push("tick");
@@ -1006,6 +1293,22 @@ @@ -1033,6 +1320,22 @@
return (WorldServer) this.levels.get(resourcekey); return (WorldServer) this.levels.get(resourcekey);
} }
@ -657,7 +664,7 @@
public Set<ResourceKey<World>> levelKeys() { public Set<ResourceKey<World>> levelKeys() {
return this.levels.keySet(); return this.levels.keySet();
} }
@@ -1032,7 +1335,7 @@ @@ -1059,7 +1362,7 @@
@DontObfuscate @DontObfuscate
public String getServerModName() { public String getServerModName() {
@ -666,7 +673,7 @@
} }
public SystemReport fillSystemReport(SystemReport systemreport) { public SystemReport fillSystemReport(SystemReport systemreport) {
@@ -1370,11 +1673,11 @@ @@ -1398,11 +1701,11 @@
public CompletableFuture<Void> reloadResources(Collection<String> collection) { public CompletableFuture<Void> reloadResources(Collection<String> collection) {
IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE); IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> { CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -680,7 +687,7 @@
}, this).thenCompose((immutablelist) -> { }, this).thenCompose((immutablelist) -> {
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist); ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
@@ -1389,6 +1692,7 @@ @@ -1417,6 +1720,7 @@
}).thenAcceptAsync((minecraftserver_reloadableresources) -> { }).thenAcceptAsync((minecraftserver_reloadableresources) -> {
this.resources.close(); this.resources.close();
this.resources = minecraftserver_reloadableresources; this.resources = minecraftserver_reloadableresources;
@ -688,7 +695,7 @@
this.packRepository.setSelected(collection); this.packRepository.setSelected(collection);
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures()); WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
@@ -1757,7 +2061,7 @@ @@ -1785,7 +2089,7 @@
try { try {
label51: label51:
{ {
@ -697,7 +704,7 @@
try { try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules()); arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -1807,6 +2111,22 @@ @@ -1835,6 +2139,22 @@
} }
@ -720,7 +727,7 @@
private void startMetricsRecordingTick() { private void startMetricsRecordingTick() {
if (this.willStartRecordingMetrics) { if (this.willStartRecordingMetrics) {
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
@@ -1933,8 +2253,30 @@ @@ -1961,8 +2281,30 @@
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandEffect.java --- a/net/minecraft/server/commands/CommandEffect.java
+++ b/net/minecraft/server/commands/CommandEffect.java +++ b/net/minecraft/server/commands/CommandEffect.java
@@ -76,7 +76,7 @@ @@ -84,7 +84,7 @@
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag); MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
@ -9,7 +9,7 @@
++j; ++j;
} }
} }
@@ -102,7 +102,7 @@ @@ -110,7 +110,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -18,7 +18,7 @@
++i; ++i;
} }
} }
@@ -128,7 +128,7 @@ @@ -136,7 +136,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandLoot.java --- a/net/minecraft/server/commands/CommandLoot.java
+++ b/net/minecraft/server/commands/CommandLoot.java +++ b/net/minecraft/server/commands/CommandLoot.java
@@ -91,7 +91,7 @@ @@ -90,7 +90,7 @@
} }
private static <T extends ArgumentBuilder<CommandListenerWrapper, T>> T addTargets(T t0, CommandLoot.c commandloot_c) { private static <T extends ArgumentBuilder<CommandListenerWrapper, T>> T addTargets(T t0, CommandLoot.c commandloot_c) {
@ -9,7 +9,7 @@
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), list.size(), list, commandloot_a); return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), list.size(), list, commandloot_a);
}).then(commandloot_c.construct(net.minecraft.commands.CommandDispatcher.argument("count", IntegerArgumentType.integer(0)), (commandcontext, list, commandloot_a) -> { }).then(commandloot_c.construct(net.minecraft.commands.CommandDispatcher.argument("count", IntegerArgumentType.integer(0)), (commandcontext, list, commandloot_a) -> {
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), IntegerArgumentType.getInteger(commandcontext, "count"), list, commandloot_a); return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), IntegerArgumentType.getInteger(commandcontext, "count"), list, commandloot_a);
@@ -248,6 +248,7 @@ @@ -247,6 +247,7 @@
private static int dropInWorld(CommandListenerWrapper commandlistenerwrapper, Vec3D vec3d, List<ItemStack> list, CommandLoot.a commandloot_a) throws CommandSyntaxException { private static int dropInWorld(CommandListenerWrapper commandlistenerwrapper, Vec3D vec3d, List<ItemStack> list, CommandLoot.a commandloot_a) throws CommandSyntaxException {
WorldServer worldserver = commandlistenerwrapper.getLevel(); WorldServer worldserver = commandlistenerwrapper.getLevel();

Datei anzeigen

@ -21,7 +21,7 @@
@@ -312,7 +312,7 @@ @@ -312,7 +312,7 @@
public boolean isSafe(IBlockAccess iblockaccess, int i) { public boolean isSafe(IBlockAccess iblockaccess, int i) {
BlockPosition blockposition = new BlockPosition(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z); BlockPosition blockposition = BlockPosition.containing(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
- IBlockData iblockdata = iblockaccess.getBlockState(blockposition); - IBlockData iblockdata = iblockaccess.getBlockState(blockposition);
+ IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit + IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit
Material material = iblockdata.getMaterial(); Material material = iblockdata.getMaterial();

Datei anzeigen

@ -8,4 +8,4 @@
+ if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND" + if (!worldserver.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
throw CommandSummon.ERROR_DUPLICATE_UUID.create(); throw CommandSummon.ERROR_DUPLICATE_UUID.create();
} else { } else {
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.summon.success", entity.getDisplayName()), true); return entity;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandTeleport.java --- a/net/minecraft/server/commands/CommandTeleport.java
+++ b/net/minecraft/server/commands/CommandTeleport.java +++ b/net/minecraft/server/commands/CommandTeleport.java
@@ -35,6 +35,12 @@ @@ -33,6 +33,13 @@
import net.minecraft.world.phys.Vec2F; import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -8,27 +8,23 @@
+import org.bukkit.Location; +import org.bukkit.Location;
+import org.bukkit.craftbukkit.CraftWorld; +import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.event.entity.EntityTeleportEvent; +import org.bukkit.event.entity.EntityTeleportEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public class CommandTeleport { public class CommandTeleport {
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(IChatBaseComponent.translatable("commands.teleport.invalidPosition")); private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(IChatBaseComponent.translatable("commands.teleport.invalidPosition"));
@@ -159,14 +165,29 @@ @@ -147,7 +154,30 @@
} float f2 = MathHelper.wrapDegrees(f);
float f3 = MathHelper.wrapDegrees(f1);
if (worldserver == entity.level) { - if (entity.teleportTo(worldserver, d0, d1, d2, set, f2, f3)) {
- ((EntityPlayer) entity).connection.teleport(d0, d1, d2, f2, f3, set); + // CraftBukkit start - Teleport event
+ ((EntityPlayer) entity).connection.teleport(d0, d1, d2, f2, f3, set, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit + boolean result;
} else { + if (entity instanceof EntityPlayer player) {
- ((EntityPlayer) entity).teleportTo(worldserver, d0, d1, d2, f2, f3); + result = player.teleportTo(worldserver, d0, d1, d2, set, f2, f3, PlayerTeleportEvent.TeleportCause.COMMAND);
+ ((EntityPlayer) entity).teleportTo(worldserver, d0, d1, d2, f2, f3, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND); // CraftBukkit + } else {
} + Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f3);
entity.setYHeadRot(f2);
} else {
float f4 = MathHelper.clamp(f3, -90.0F, 90.0F);
+ // CraftBukkit start - Teleport event
+ Location to = new Location(worldserver.getWorld(), d0, d1, d2, f2, f4);
+ EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to); + EntityTeleportEvent event = new EntityTeleportEvent(entity.getBukkitEntity(), entity.getBukkitEntity().getLocation(), to);
+ worldserver.getCraftServer().getPluginManager().callEvent(event); + worldserver.getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) { + if (event.isCancelled()) {
@ -39,9 +35,14 @@
+ d1 = to.getY(); + d1 = to.getY();
+ d2 = to.getZ(); + d2 = to.getZ();
+ f2 = to.getYaw(); + f2 = to.getYaw();
+ f4 = to.getPitch(); + f3 = to.getPitch();
+ worldserver = ((CraftWorld) to.getWorld()).getHandle(); + worldserver = ((CraftWorld) to.getWorld()).getHandle();
+
+ result = entity.teleportTo(worldserver, d0, d1, d2, set, f2, f3);
+ }
+
+ if (result) {
+ // CraftBukkit end + // CraftBukkit end
if (commandteleport_a != null) {
if (worldserver == entity.level) { commandteleport_a.perform(commandlistenerwrapper, entity);
entity.moveTo(d0, d1, d2, f2, f4); }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java --- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java +++ b/net/minecraft/server/level/EntityPlayer.java
@@ -150,6 +150,35 @@ @@ -155,6 +155,35 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria; import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -36,7 +36,7 @@
public class EntityPlayer extends EntityHuman { public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -207,6 +236,21 @@ @@ -212,6 +241,21 @@
public int latency; public int latency;
public boolean wonGame; public boolean wonGame;
@ -58,9 +58,9 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) { public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile); super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL; this.chatVisibility = EnumChatVisibility.FULL;
@@ -270,12 +314,56 @@ @@ -275,12 +319,56 @@
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this); this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
this.maxUpStep = 1.0F; this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(worldserver); this.fudgeSpawnLocation(worldserver);
+ +
+ // CraftBukkit start + // CraftBukkit start
@ -116,7 +116,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver)); int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ())); int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -324,7 +412,7 @@ @@ -329,7 +417,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) { public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound); super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) { if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
@ -125,7 +125,7 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -343,17 +431,26 @@ @@ -348,17 +436,26 @@
if (nbttagcompound.contains("recipeBook", 10)) { if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager()); this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
} }
@ -153,7 +153,7 @@
Logger logger1 = EntityPlayer.LOGGER; Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger1); Objects.requireNonNull(logger1);
@@ -366,7 +463,7 @@ @@ -371,7 +468,7 @@
@Override @Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) { public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
@ -162,7 +162,7 @@
Logger logger = EntityPlayer.LOGGER; Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -387,7 +484,20 @@ @@ -392,7 +489,20 @@
Entity entity = this.getRootVehicle(); Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle(); Entity entity1 = this.getVehicle();
@ -184,7 +184,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound(); NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -412,9 +522,33 @@ @@ -417,9 +527,33 @@
nbttagcompound.put("SpawnDimension", nbtbase); nbttagcompound.put("SpawnDimension", nbtbase);
}); });
} }
@ -218,7 +218,7 @@
public void setExperiencePoints(int i) { public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel(); float f = (float) this.getXpNeededForNextLevel();
float f1 = (f - 1.0F) / f; float f1 = (f - 1.0F) / f;
@@ -473,6 +607,11 @@ @@ -478,6 +612,11 @@
@Override @Override
public void tick() { public void tick() {
@ -230,7 +230,7 @@
this.gameMode.tick(); this.gameMode.tick();
this.wardenSpawnTracker.tick(); this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime; --this.spawnInvulnerableTime;
@@ -529,7 +668,7 @@ @@ -534,7 +673,7 @@
} }
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) { if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@ -239,7 +239,7 @@
this.lastSentHealth = this.getHealth(); this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel(); this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F; this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -560,6 +699,12 @@ @@ -565,6 +704,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience)); this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
} }
@ -252,7 +252,7 @@
if (this.experienceLevel != this.lastRecordedLevel) { if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel; this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel)); this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -574,6 +719,20 @@ @@ -579,6 +724,20 @@
CriterionTriggers.LOCATION.trigger(this); CriterionTriggers.LOCATION.trigger(this);
} }
@ -273,7 +273,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked"); CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -616,7 +775,8 @@ @@ -621,7 +780,8 @@
} }
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) { private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
@ -283,7 +283,7 @@
scoreboardscore.setScore(i); scoreboardscore.setScore(i);
}); });
} }
@@ -625,9 +785,47 @@ @@ -630,9 +790,47 @@
public void die(DamageSource damagesource) { public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@ -333,7 +333,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> { this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true; boolean flag1 = true;
@@ -658,12 +856,18 @@ @@ -663,12 +861,18 @@
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) { if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied(); this.tellNeutralMobsThatIDied();
} }
@ -356,7 +356,7 @@
EntityLiving entityliving = this.getKillCredit(); EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) { if (entityliving != null) {
@@ -701,10 +905,12 @@ @@ -706,10 +910,12 @@
String s = this.getScoreboardName(); String s = this.getScoreboardName();
String s1 = entity.getScoreboardName(); String s1 = entity.getScoreboardName();
@ -371,7 +371,7 @@
} else { } else {
this.awardStat(StatisticList.MOB_KILLS); this.awardStat(StatisticList.MOB_KILLS);
} }
@@ -722,7 +928,8 @@ @@ -727,7 +933,8 @@
int i = scoreboardteam.getColor().getId(); int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) { if (i >= 0 && i < aiscoreboardcriteria.length) {
@ -381,7 +381,7 @@
} }
} }
@@ -766,18 +973,20 @@ @@ -777,18 +984,20 @@
} }
private boolean isPvpAllowed() { private boolean isPvpAllowed() {
@ -405,7 +405,7 @@
} else { } else {
return shapedetectorshape; return shapedetectorshape;
} }
@@ -786,11 +995,20 @@ @@ -797,11 +1006,20 @@
@Nullable @Nullable
@Override @Override
public Entity changeDimension(WorldServer worldserver) { public Entity changeDimension(WorldServer worldserver) {
@ -429,7 +429,7 @@
this.unRide(); this.unRide();
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) { if (!this.wonGame) {
@@ -801,6 +1019,8 @@ @@ -812,6 +1030,8 @@
return this; return this;
} else { } else {
@ -438,7 +438,7 @@
WorldData worlddata = worldserver.getLevelData(); 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(), (byte) 3, 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()));
@@ -810,20 +1030,50 @@ @@ -821,20 +1041,50 @@
playerlist.sendPlayerPermissionLevel(this); playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved(); this.unsetRemoved();
@ -455,7 +455,7 @@
this.enteredNetherPosition = this.position(); this.enteredNetherPosition = this.position();
- } else if (worldserver.dimension() == World.END) { - } else if (worldserver.dimension() == World.END) {
+ } else if (worldserver.getTypeKey() == WorldDimension.END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit + } else if (worldserver.getTypeKey() == WorldDimension.END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
this.createEndPlatform(worldserver, new BlockPosition(shapedetectorshape.pos)); this.createEndPlatform(worldserver, BlockPosition.containing(shapedetectorshape.pos));
} }
+ // CraftBukkit start + // CraftBukkit start
+ } else { + } else {
@ -494,7 +494,7 @@
this.connection.resetPosition(); this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this); worldserver.addDuringPortalTeleport(this);
worldserver1.getProfiler().pop(); worldserver1.getProfiler().pop();
@@ -843,39 +1093,66 @@ @@ -854,39 +1104,66 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -567,7 +567,7 @@
} }
return optional1; return optional1;
@@ -885,13 +1162,21 @@ @@ -896,13 +1173,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) { public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension(); ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level.dimension(); ResourceKey<World> resourcekey1 = this.level.dimension();
@ -592,7 +592,7 @@
this.enteredNetherPosition = null; this.enteredNetherPosition = null;
} }
@@ -908,12 +1193,10 @@ @@ -919,12 +1204,10 @@
this.containerMenu.broadcastChanges(); this.containerMenu.broadcastChanges();
} }
@ -608,7 +608,7 @@
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
} else if (!this.bedInRange(blockposition, enumdirection)) { } else if (!this.bedInRange(blockposition, enumdirection)) {
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY); return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
@@ -937,7 +1220,36 @@ @@ -948,7 +1231,36 @@
} }
} }
@ -646,7 +646,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED); this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this); CriterionTriggers.SLEPT_IN_BED.trigger(this);
}); });
@@ -950,9 +1262,8 @@ @@ -961,9 +1273,8 @@
return either; return either;
} }
} }
@ -657,7 +657,7 @@
} }
@Override @Override
@@ -979,6 +1290,24 @@ @@ -990,6 +1301,24 @@
@Override @Override
public void stopSleepInBed(boolean flag, boolean flag1) { public void stopSleepInBed(boolean flag, boolean flag1) {
@ -682,7 +682,7 @@
if (this.isSleeping()) { if (this.isSleeping()) {
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2)); this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
} }
@@ -1060,8 +1389,9 @@ @@ -1038,8 +1367,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos())); this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
} }
@ -693,7 +693,7 @@
} }
@Override @Override
@@ -1069,13 +1399,35 @@ @@ -1047,13 +1377,35 @@
if (itileinventory == null) { if (itileinventory == null) {
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -729,7 +729,7 @@
if (container == null) { if (container == null) {
if (this.isSpectator()) { if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true); this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1083,9 +1435,11 @@ @@ -1061,9 +1413,11 @@
return OptionalInt.empty(); return OptionalInt.empty();
} else { } else {
@ -743,7 +743,7 @@
return OptionalInt.of(this.containerCounter); return OptionalInt.of(this.containerCounter);
} }
} }
@@ -1098,13 +1452,24 @@ @@ -1076,13 +1430,24 @@
@Override @Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) { public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -770,7 +770,7 @@
this.initMenu(this.containerMenu); this.initMenu(this.containerMenu);
} }
@@ -1127,6 +1492,7 @@ @@ -1105,6 +1470,7 @@
@Override @Override
public void closeContainer() { public void closeContainer() {
@ -778,7 +778,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId)); this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer(); this.doCloseContainer();
} }
@@ -1157,7 +1523,7 @@ @@ -1135,7 +1501,7 @@
@Override @Override
public void awardStat(Statistic<?> statistic, int i) { public void awardStat(Statistic<?> statistic, int i) {
this.stats.increment(this, statistic, i); this.stats.increment(this, statistic, i);
@ -787,7 +787,7 @@
scoreboardscore.add(i); scoreboardscore.add(i);
}); });
} }
@@ -1165,7 +1531,7 @@ @@ -1143,7 +1509,7 @@
@Override @Override
public void resetStat(Statistic<?> statistic) { public void resetStat(Statistic<?> statistic) {
this.stats.setValue(this, statistic, 0); this.stats.setValue(this, statistic, 0);
@ -796,7 +796,7 @@
} }
@Override @Override
@@ -1181,7 +1547,7 @@ @@ -1159,7 +1525,7 @@
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
MinecraftKey minecraftkey = aminecraftkey1[j]; MinecraftKey minecraftkey = aminecraftkey1[j];
@ -805,7 +805,7 @@
Objects.requireNonNull(list); Objects.requireNonNull(list);
optional.ifPresent(list::add); optional.ifPresent(list::add);
@@ -1216,6 +1582,7 @@ @@ -1194,6 +1560,7 @@
public void resetSentInfo() { public void resetSentInfo() {
this.lastSentHealth = -1.0E8F; this.lastSentHealth = -1.0E8F;
@ -813,7 +813,7 @@
} }
@Override @Override
@@ -1274,7 +1641,7 @@ @@ -1252,7 +1619,7 @@
this.lastSentExp = -1; this.lastSentExp = -1;
this.lastSentHealth = -1.0F; this.lastSentHealth = -1.0F;
this.lastSentFood = -1; this.lastSentFood = -1;
@ -822,8 +822,33 @@
this.seenCredits = entityplayer.seenCredits; this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition; this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft()); this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
@@ -1415,7 +1782,20 @@ @@ -1302,6 +1669,12 @@
return s;
@Override
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
+ // CraftBukkit start
+ return teleportTo(worldserver, 0, 0, 0, set, 0, 0, TeleportCause.UNKNOWN);
+ }
+
+ public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1, TeleportCause cause) {
+ // CraftBukkit end
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
@@ -1311,9 +1684,9 @@
}
if (worldserver == this.level) {
- this.connection.teleport(d0, d1, d2, f, f1, set);
+ this.connection.teleport(d0, d1, d2, f, f1, set, cause); // CraftBukkit
} else {
- this.teleportTo(worldserver, d0, d1, d2, f, f1);
+ this.teleportTo(worldserver, d0, d1, d2, f, f1, cause); // CraftBukkit
}
this.setYHeadRot(f);
@@ -1417,7 +1790,20 @@
}
} }
+ public String locale = "en_us"; // CraftBukkit - add, lowercase + public String locale = "en_us"; // CraftBukkit - add, lowercase
@ -843,16 +868,16 @@
this.chatVisibility = packetplayinsettings.chatVisibility(); this.chatVisibility = packetplayinsettings.chatVisibility();
this.canChatColor = packetplayinsettings.chatColors(); this.canChatColor = packetplayinsettings.chatColors();
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled(); this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
@@ -1486,7 +1866,7 @@ @@ -1492,7 +1878,7 @@
this.camera = (Entity) (entity == null ? this : entity); if (world instanceof WorldServer) {
if (entity1 != this.camera) { WorldServer worldserver = (WorldServer) world;
this.connection.send(new PacketPlayOutCamera(this.camera));
- 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();
}
@@ -1516,7 +1896,7 @@ - this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot());
+ this.teleportTo(worldserver, this.camera.getX(), this.camera.getY(), this.camera.getZ(), Set.of(), this.getYRot(), this.getXRot(), TeleportCause.SPECTATE); // CraftBukkit
}
if (entity != null) {
@@ -1529,7 +1915,7 @@
@Nullable @Nullable
public IChatBaseComponent getTabListDisplayName() { public IChatBaseComponent getTabListDisplayName() {
@ -861,7 +886,7 @@
} }
@Override @Override
@@ -1537,9 +1917,16 @@ @@ -1550,9 +1936,16 @@
return this.advancements; return this.advancements;
} }
@ -878,7 +903,7 @@
if (worldserver == this.level) { if (worldserver == this.level) {
this.connection.teleport(d0, d1, d2, f, f1); this.connection.teleport(d0, d1, d2, f, f1);
} else { } else {
@@ -1559,6 +1946,9 @@ @@ -1572,6 +1965,9 @@
this.server.getPlayerList().sendLevelInfo(this, worldserver); this.server.getPlayerList().sendLevelInfo(this, worldserver);
this.server.getPlayerList().sendAllPlayerInfo(this); this.server.getPlayerList().sendAllPlayerInfo(this);
} }
@ -888,9 +913,9 @@
} }
@@ -1743,4 +2133,146 @@ @@ -1762,4 +2158,146 @@
public RemoteChatSession getChatSession() { this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
return this.chatSession; this.connection.send(new ClientboundHurtAnimationPacket(this));
} }
+ +
+ // CraftBukkit start - Add per-player time and weather. + // CraftBukkit start - Add per-player time and weather.

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityTrackerEntry.java --- a/net/minecraft/server/level/EntityTrackerEntry.java
+++ b/net/minecraft/server/level/EntityTrackerEntry.java +++ b/net/minecraft/server/level/EntityTrackerEntry.java
@@ -42,6 +42,12 @@ @@ -44,6 +44,12 @@
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -13,7 +13,7 @@
public class EntityTrackerEntry { public class EntityTrackerEntry {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -63,8 +69,12 @@ @@ -65,8 +71,12 @@
private boolean wasOnGround; private boolean wasOnGround;
@Nullable @Nullable
private List<DataWatcher.b<?>> trackedDataValues; private List<DataWatcher.b<?>> trackedDataValues;
@ -27,16 +27,16 @@
this.ap = Vec3D.ZERO; this.ap = Vec3D.ZERO;
this.lastPassengers = Collections.emptyList(); this.lastPassengers = Collections.emptyList();
this.level = worldserver; this.level = worldserver;
@@ -85,7 +95,7 @@ @@ -86,7 +96,7 @@
List<Entity> list = this.entity.getPassengers();
if (!list.equals(this.lastPassengers)) { if (!list.equals(this.lastPassengers)) {
this.lastPassengers = list;
- this.broadcast.accept(new PacketPlayOutMount(this.entity)); - this.broadcast.accept(new PacketPlayOutMount(this.entity));
+ this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit + this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit
} this.changedPassengers(list, this.lastPassengers).forEach((entity) -> {
if (entity instanceof EntityPlayer) {
Entity entity = this.entity; EntityPlayer entityplayer = (EntityPlayer) entity;
@@ -93,18 +103,18 @@ @@ -105,18 +115,18 @@
if (entity instanceof EntityItemFrame) { if (entity instanceof EntityItemFrame) {
EntityItemFrame entityitemframe = (EntityItemFrame) entity; EntityItemFrame entityitemframe = (EntityItemFrame) entity;
@ -59,7 +59,7 @@
worldmap.tickCarriedBy(entityplayer, itemstack); worldmap.tickCarriedBy(entityplayer, itemstack);
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer); Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
@@ -209,7 +219,27 @@ @@ -229,7 +239,27 @@
++this.tickCount; ++this.tickCount;
if (this.entity.hurtMarked) { if (this.entity.hurtMarked) {
@ -88,17 +88,18 @@
this.entity.hurtMarked = false; this.entity.hurtMarked = false;
} }
@@ -224,13 +254,16 @@ @@ -252,14 +282,17 @@
PlayerConnection playerconnection = entityplayer.connection; List<Packet<PacketListenerPlayOut>> list = new ArrayList();
Objects.requireNonNull(entityplayer.connection); Objects.requireNonNull(list);
- this.sendPairingData(playerconnection::send); - this.sendPairingData(list::add);
+ this.sendPairingData(playerconnection::send, entityplayer); // CraftBukkit - add player + this.sendPairingData(list::add, entityplayer); // CraftBukkit - add player
entityplayer.connection.send(new ClientboundBundlePacket(list));
this.entity.startSeenByPlayer(entityplayer); this.entity.startSeenByPlayer(entityplayer);
} }
- public void sendPairingData(Consumer<Packet<?>> consumer) { - public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer) {
+ public void sendPairingData(Consumer<Packet<?>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player + public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
if (this.entity.isRemoved()) { if (this.entity.isRemoved()) {
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity); - EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
+ // CraftBukkit start - Remove useless error spam, just return + // CraftBukkit start - Remove useless error spam, just return
@ -108,7 +109,7 @@
} }
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket(); Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
@@ -246,6 +279,12 @@ @@ -275,6 +308,12 @@
if (this.entity instanceof EntityLiving) { if (this.entity instanceof EntityLiving) {
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes(); Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
@ -121,7 +122,7 @@
if (!collection.isEmpty()) { if (!collection.isEmpty()) {
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection)); consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
} }
@@ -277,8 +316,14 @@ @@ -306,8 +345,14 @@
if (!list.isEmpty()) { if (!list.isEmpty()) {
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list)); consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
} }
@ -136,7 +137,7 @@
if (this.entity instanceof EntityLiving) { if (this.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) this.entity; EntityLiving entityliving = (EntityLiving) this.entity;
Iterator iterator = entityliving.getActiveEffects().iterator(); Iterator iterator = entityliving.getActiveEffects().iterator();
@@ -321,6 +366,11 @@ @@ -350,6 +395,11 @@
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes(); Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
if (!set.isEmpty()) { if (!set.isEmpty()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/PlayerChunkMap.java --- a/net/minecraft/server/level/PlayerChunkMap.java
+++ b/net/minecraft/server/level/PlayerChunkMap.java +++ b/net/minecraft/server/level/PlayerChunkMap.java
@@ -106,6 +106,12 @@ @@ -109,6 +109,12 @@
import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.lang3.mutable.MutableObject;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -13,7 +13,7 @@
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e { public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
private static final byte CHUNK_TYPE_REPLACEABLE = -1; private static final byte CHUNK_TYPE_REPLACEABLE = -1;
@@ -149,6 +155,27 @@ @@ -152,6 +158,27 @@
private final Queue<Runnable> unloadQueue; private final Queue<Runnable> unloadQueue;
int viewDistance; 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) { 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); super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
this.visibleChunkMap = this.updatingChunkMap.clone(); this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -167,6 +194,11 @@ @@ -170,6 +197,11 @@
this.storageName = path.getFileName().toString(); this.storageName = path.getFileName().toString();
this.level = worldserver; this.level = worldserver;
this.generator = chunkgenerator; this.generator = chunkgenerator;
@ -53,7 +53,7 @@
IRegistryCustom iregistrycustom = worldserver.registryAccess(); IRegistryCustom iregistrycustom = worldserver.registryAccess();
long j = worldserver.getSeed(); long j = worldserver.getSeed();
@@ -326,9 +358,12 @@ @@ -329,9 +361,12 @@
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list); CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> { CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
List<IChunkAccess> list3 = Lists.newArrayList(); List<IChunkAccess> list3 = Lists.newArrayList();
@ -68,7 +68,7 @@
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next(); final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
if (either == null) { if (either == null) {
@@ -533,7 +568,7 @@ @@ -536,7 +571,7 @@
private void scheduleUnload(long i, PlayerChunk playerchunk) { private void scheduleUnload(long i, PlayerChunk playerchunk) {
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave(); CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
@ -77,7 +77,7 @@
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave(); CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
if (completablefuture1 != completablefuture) { if (completablefuture1 != completablefuture) {
@@ -622,9 +657,9 @@ @@ -625,9 +660,9 @@
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get()); ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType()); this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
@ -89,7 +89,7 @@
} }
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> { }, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
return this.handleChunkLoadFailure(throwable, chunkcoordintpair); return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
@@ -730,7 +765,21 @@ @@ -733,7 +768,21 @@
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) { private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
if (!list.isEmpty()) { if (!list.isEmpty()) {
@ -112,7 +112,7 @@
} }
} }
@@ -829,7 +878,7 @@ @@ -832,7 +881,7 @@
if (!playerchunk.wasAccessibleSinceLastSave()) { if (!playerchunk.wasAccessibleSinceLastSave()) {
return false; return false;
} else { } else {
@ -121,7 +121,7 @@
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) { if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
return false; return false;
@@ -991,7 +1040,8 @@ @@ -994,7 +1043,8 @@
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
}); });
@ -131,7 +131,7 @@
return chunk.getBlockEntities().size(); return chunk.getBlockEntities().size();
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> { }).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
return chunk.getBlockTicks().count(); return chunk.getBlockTicks().count();
@@ -1004,7 +1054,7 @@ @@ -1007,7 +1057,7 @@
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) { private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
try { try {
@ -140,7 +140,7 @@
return either != null ? (String) either.map((chunk) -> { return either != null ? (String) either.map((chunk) -> {
return "done"; return "done";
@@ -1020,12 +1070,14 @@ @@ -1023,12 +1073,14 @@
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) { private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> { return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
@ -158,7 +158,7 @@
} }
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) { boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
@@ -1471,7 +1523,7 @@ @@ -1482,7 +1534,7 @@
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet(); public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
public EntityTracker(Entity entity, int i, int j, boolean flag) { public EntityTracker(Entity entity, int i, int j, boolean flag) {
@ -167,7 +167,7 @@
this.entity = entity; this.entity = entity;
this.range = i; this.range = i;
this.lastSectionPos = SectionPosition.of((EntityAccess) entity); this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
@@ -1530,6 +1582,11 @@ @@ -1541,6 +1593,11 @@
double d2 = d0 * d0; double d2 = d0 * d0;
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer); boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldServer.java --- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java +++ b/net/minecraft/server/level/WorldServer.java
@@ -156,6 +156,26 @@ @@ -159,6 +159,26 @@
import net.minecraft.world.ticks.TickListServer; import net.minecraft.world.ticks.TickListServer;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -27,7 +27,7 @@
public class WorldServer extends World implements GeneratorAccessSeed { public class WorldServer extends World implements GeneratorAccessSeed {
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0); public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
@@ -173,7 +193,7 @@ @@ -172,7 +192,7 @@
final List<EntityPlayer> players; final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource; private final ChunkProviderServer chunkSource;
private final MinecraftServer server; private final MinecraftServer server;
@ -36,11 +36,12 @@
final EntityTickList entityTickList; final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager; public final PersistentEntitySectionManager<Entity> entityManager;
private final GameEventDispatcher gameEventDispatcher; private final GameEventDispatcher gameEventDispatcher;
@@ -197,11 +217,28 @@ @@ -196,12 +216,30 @@
private final StructureCheck structureCheck; private final StructureCheck structureCheck;
private final boolean tickTime; 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) { - 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) {
- IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess();
- Holder holder = worlddimension.type(); - Holder holder = worlddimension.type();
+ // CraftBukkit start + // CraftBukkit start
+ public final Convertable.ConversionSession convertable; + public final Convertable.ConversionSession convertable;
@ -56,12 +57,14 @@
+ } + }
- Objects.requireNonNull(minecraftserver); - Objects.requireNonNull(minecraftserver);
- super(iworlddataserver, resourcekey, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates()); - super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer + // 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) { + 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) {
+ // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error + // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
+
+ // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error + // Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
+ super(iworlddataserver, resourcekey, worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env); + super(iworlddataserver, resourcekey, minecraftserver.registryAccess(), worlddimension.type(), minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates(), gen, biomeProvider, env);
+ this.pvpMode = minecraftserver.isPvpAllowed(); + this.pvpMode = minecraftserver.isPvpAllowed();
+ convertable = convertable_conversionsession; + convertable = convertable_conversionsession;
+ uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile()); + uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
@ -69,7 +72,7 @@
this.players = Lists.newArrayList(); this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList(); this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier()); this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -215,6 +252,22 @@ @@ -215,6 +253,22 @@
this.customSpawners = list; this.customSpawners = list;
this.serverLevelData = iworlddataserver; this.serverLevelData = iworlddataserver;
ChunkGenerator chunkgenerator = worlddimension.generator(); ChunkGenerator chunkgenerator = worlddimension.generator();
@ -92,7 +95,7 @@
boolean flag2 = minecraftserver.forceSynchronousWrites(); boolean flag2 = minecraftserver.forceSynchronousWrites();
DataFixer datafixer = minecraftserver.getFixerUpper(); DataFixer datafixer = minecraftserver.getFixerUpper();
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver); EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
@@ -246,15 +299,16 @@ @@ -246,15 +300,16 @@
long l = minecraftserver.getWorldData().worldGenOptions().seed(); 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.structureCheck = new StructureCheck(this.chunkSource.chunkScanner(), this.registryAccess(), minecraftserver.getStructureManager(), resourcekey, chunkgenerator, this.chunkSource.randomState(), this, chunkgenerator.getBiomeSource(), l, datafixer);
@ -112,7 +115,7 @@
} }
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) { public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
@@ -286,12 +340,20 @@ @@ -286,12 +341,20 @@
long j; long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@ -136,7 +139,7 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) { if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle(); this.resetWeatherCycle();
} }
@@ -317,7 +379,7 @@ @@ -317,7 +380,7 @@
this.runBlockEvents(); this.runBlockEvents();
this.handlingTick = false; this.handlingTick = false;
gameprofilerfiller.pop(); gameprofilerfiller.pop();
@ -145,7 +148,7 @@
if (flag) { if (flag) {
this.resetEmptyTime(); this.resetEmptyTime();
@@ -333,7 +395,7 @@ @@ -333,7 +396,7 @@
this.entityTickList.forEach((entity) -> { this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) { if (!entity.isRemoved()) {
@ -154,7 +157,7 @@
entity.discard(); entity.discard();
} else { } else {
gameprofilerfiller.push("checkDespawn"); gameprofilerfiller.push("checkDespawn");
@@ -405,7 +467,7 @@ @@ -405,7 +468,7 @@
private void wakeUpAllPlayers() { private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers(); this.sleepStatus.removeAllSleepers();
@ -163,7 +166,7 @@
entityplayer.stopSleepInBed(false, false); entityplayer.stopSleepInBed(false, false);
}); });
} }
@@ -433,7 +495,7 @@ @@ -433,7 +496,7 @@
entityhorseskeleton.setTrap(true); entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0); entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ()); entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -172,7 +175,7 @@
} }
} }
@@ -442,7 +504,7 @@ @@ -442,7 +505,7 @@
if (entitylightning != null) { if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition)); entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1); entitylightning.setVisualOnly(flag1);
@ -181,7 +184,7 @@
} }
} }
} }
@@ -456,7 +518,7 @@ @@ -456,7 +519,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value(); BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
if (biomebase.shouldFreeze(this, blockposition1)) { if (biomebase.shouldFreeze(this, blockposition1)) {
@ -190,7 +193,7 @@
} }
if (flag) { if (flag) {
@@ -471,10 +533,10 @@ @@ -471,10 +534,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1); IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition); Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
@ -203,7 +206,7 @@
} }
} }
@@ -671,6 +733,7 @@ @@ -670,6 +733,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F); this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
} }
@ -211,7 +214,7 @@
if (this.oRainLevel != this.rainLevel) { if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension()); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
} }
@@ -689,14 +752,47 @@ @@ -688,14 +752,47 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel)); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel)); this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
} }
@ -261,7 +264,7 @@
} }
public void resetEmptyTime() { public void resetEmptyTime() {
@@ -731,6 +827,7 @@ @@ -730,6 +827,7 @@
}); });
gameprofilerfiller.incrementCounter("tickNonPassenger"); gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick(); entity.tick();
@ -269,7 +272,7 @@
this.getProfiler().pop(); this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator(); Iterator iterator = entity.getPassengers().iterator();
@@ -754,6 +851,7 @@ @@ -753,6 +851,7 @@
}); });
gameprofilerfiller.incrementCounter("tickPassenger"); gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick(); entity1.rideTick();
@ -277,7 +280,7 @@
gameprofilerfiller.pop(); gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator(); Iterator iterator = entity1.getPassengers().iterator();
@@ -778,6 +876,7 @@ @@ -777,6 +876,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource(); ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) { if (!flag1) {
@ -285,7 +288,7 @@
if (iprogressupdate != null) { if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel")); iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
} }
@@ -795,11 +894,19 @@ @@ -794,11 +894,19 @@
} }
} }
@ -306,7 +309,7 @@
} }
this.getChunkSource().getDataStorage().save(); this.getChunkSource().getDataStorage().save();
@@ -864,15 +971,37 @@ @@ -863,15 +971,37 @@
@Override @Override
public boolean addFreshEntity(Entity entity) { public boolean addFreshEntity(Entity entity) {
@ -347,7 +350,7 @@
} }
public void addDuringCommandTeleport(EntityPlayer entityplayer) { public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -903,24 +1032,37 @@ @@ -902,24 +1032,37 @@
this.entityManager.addNewEntity(entityplayer); this.entityManager.addNewEntity(entityplayer);
} }
@ -389,7 +392,7 @@
return true; return true;
} }
} }
@@ -934,10 +1076,32 @@ @@ -933,10 +1076,32 @@
entityplayer.remove(entity_removalreason); entityplayer.remove(entity_removalreason);
} }
@ -422,7 +425,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next(); EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -946,6 +1110,12 @@ @@ -945,6 +1110,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY(); double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ(); double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@ -435,7 +438,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
} }
@@ -1005,7 +1175,18 @@ @@ -1004,7 +1175,18 @@
Iterator iterator = this.navigatingMobs.iterator(); Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@ -455,7 +458,7 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation(); NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) { if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1062,6 +1243,11 @@ @@ -1066,6 +1248,11 @@
@Override @Override
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) { 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); Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
@ -467,7 +470,7 @@
if (!explosion.interactsWithBlocks()) { if (!explosion.interactsWithBlocks()) {
explosion.clearToBlow(); explosion.clearToBlow();
@@ -1134,13 +1320,20 @@ @@ -1138,13 +1325,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) { public <T extends ParticleParam> int sendParticles(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
@ -490,7 +493,7 @@
++j; ++j;
} }
} }
@@ -1191,7 +1384,7 @@ @@ -1195,7 +1389,7 @@
@Nullable @Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) { public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
@ -499,7 +502,7 @@
return null; return null;
} else { } else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey); Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
@@ -1233,11 +1426,21 @@ @@ -1232,11 +1426,21 @@
@Nullable @Nullable
@Override @Override
public WorldMap getMapData(String s) { public WorldMap getMapData(String s) {
@ -522,7 +525,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap); this.getServer().overworld().getDataStorage().set(s, worldmap);
} }
@@ -1535,6 +1738,11 @@ @@ -1534,6 +1738,11 @@
@Override @Override
public void blockUpdated(BlockPosition blockposition, Block block) { public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) { if (!this.isDebug()) {
@ -534,7 +537,7 @@
this.updateNeighborsAt(blockposition, block); this.updateNeighborsAt(blockposition, block);
} }
@@ -1554,12 +1762,12 @@ @@ -1553,12 +1762,12 @@
} }
public boolean isFlat() { public boolean isFlat() {
@ -549,7 +552,7 @@
} }
@Nullable @Nullable
@@ -1582,7 +1790,7 @@ @@ -1581,7 +1790,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) { private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try { try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap(); Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -558,7 +561,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
T t0 = iterator.next(); T t0 = iterator.next();
@@ -1591,7 +1799,7 @@ @@ -1590,7 +1799,7 @@
object2intopenhashmap.addTo(s, 1); object2intopenhashmap.addTo(s, 1);
} }
@ -567,7 +570,7 @@
String s1 = (String) entry.getKey(); String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue(); return s1 + ":" + entry.getIntValue();
@@ -1602,17 +1810,33 @@ @@ -1601,17 +1810,33 @@
} }
public static void makeObsidianPlatform(WorldServer worldserver) { public static void makeObsidianPlatform(WorldServer worldserver) {
@ -603,7 +606,7 @@
} }
@Override @Override
@@ -1728,6 +1952,7 @@ @@ -1727,6 +1952,7 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::add); entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@ -611,7 +614,7 @@
} }
public void onTrackingEnd(Entity entity) { public void onTrackingEnd(Entity entity) {
@@ -1764,6 +1989,14 @@ @@ -1763,6 +1989,14 @@
} }
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove); entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);

Datei anzeigen

@ -1,7 +1,7 @@
--- a/net/minecraft/server/network/HandshakeListener.java --- a/net/minecraft/server/network/HandshakeListener.java
+++ b/net/minecraft/server/network/HandshakeListener.java +++ b/net/minecraft/server/network/HandshakeListener.java
@@ -10,8 +10,17 @@ @@ -11,8 +11,17 @@
import net.minecraft.network.protocol.login.PacketLoginOutDisconnect; import net.minecraft.network.protocol.status.ServerPing;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
+// CraftBukkit start +// CraftBukkit start
@ -18,7 +18,7 @@
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.literal("Ignoring status request"); private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.literal("Ignoring status request");
private final MinecraftServer server; private final MinecraftServer server;
private final NetworkManager connection; private final NetworkManager connection;
@@ -23,9 +32,44 @@ @@ -24,9 +33,44 @@
@Override @Override
public void handleIntention(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) { public void handleIntention(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {

Datei anzeigen

@ -25,8 +25,8 @@
+ // CraftBukkit end + // CraftBukkit end
+ +
@Override @Override
public NetworkManager getConnection() { public boolean isAcceptingMessages() {
return this.connection; return this.connection.isConnected();
@@ -104,10 +117,12 @@ @@ -104,10 +117,12 @@
this.gameProfile = this.createFakeProfile(this.gameProfile); this.gameProfile = this.createFakeProfile(this.gameProfile);
} }

Datei anzeigen

@ -1,15 +1,18 @@
--- a/net/minecraft/server/network/PacketStatusListener.java --- a/net/minecraft/server/network/PacketStatusListener.java
+++ b/net/minecraft/server/network/PacketStatusListener.java +++ b/net/minecraft/server/network/PacketStatusListener.java
@@ -9,6 +9,18 @@ @@ -9,6 +9,21 @@
import net.minecraft.network.protocol.status.PacketStatusOutServerInfo; import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
import net.minecraft.server.MinecraftServer; import net.minecraft.network.protocol.status.ServerPing;
+// CraftBukkit start +// CraftBukkit start
+import com.mojang.authlib.GameProfile; +import com.mojang.authlib.GameProfile;
+import java.net.InetSocketAddress; +import java.net.InetSocketAddress;
+import java.util.Collections;
+import java.util.Iterator; +import java.util.Iterator;
+import java.util.Optional;
+import net.minecraft.SharedConstants; +import net.minecraft.SharedConstants;
+import net.minecraft.network.protocol.status.ServerPing; +import net.minecraft.network.protocol.status.ServerPing;
+import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.level.EntityPlayer; +import net.minecraft.server.level.EntityPlayer;
+import org.bukkit.craftbukkit.util.CraftChatMessage; +import org.bukkit.craftbukkit.util.CraftChatMessage;
+import org.bukkit.craftbukkit.util.CraftIconCache; +import org.bukkit.craftbukkit.util.CraftIconCache;
@ -19,13 +22,14 @@
public class PacketStatusListener implements PacketStatusInListener { public class PacketStatusListener implements PacketStatusInListener {
private static final IChatBaseComponent DISCONNECT_REASON = IChatBaseComponent.translatable("multiplayer.status.request_handled"); private static final IChatBaseComponent DISCONNECT_REASON = IChatBaseComponent.translatable("multiplayer.status.request_handled");
@@ -35,7 +47,102 @@ @@ -35,7 +50,101 @@
this.connection.disconnect(PacketStatusListener.DISCONNECT_REASON); this.connection.disconnect(PacketStatusListener.DISCONNECT_REASON);
} else { } else {
this.hasRequestedStatus = true; this.hasRequestedStatus = true;
- this.connection.send(new PacketStatusOutServerInfo(this.server.getStatus())); - this.connection.send(new PacketStatusOutServerInfo(this.status));
+ // CraftBukkit start + // CraftBukkit start
+ // this.connection.send(new PacketStatusOutServerInfo(this.server.getStatus())); + // this.connection.send(new PacketStatusOutServerInfo(this.status));
+ MinecraftServer server = MinecraftServer.getServer();
+ final Object[] players = server.getPlayerList().players.toArray(); + final Object[] players = server.getPlayerList().players.toArray();
+ class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent { + class ServerListPingEvent extends org.bukkit.event.server.ServerListPingEvent {
+ +
@ -92,7 +96,7 @@
+ } + }
+ +
+ ServerListPingEvent event = new ServerListPingEvent(); + ServerListPingEvent event = new ServerListPingEvent();
+ this.server.server.getPluginManager().callEvent(event); + server.server.getPluginManager().callEvent(event);
+ +
+ java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length); + java.util.List<GameProfile> profiles = new java.util.ArrayList<GameProfile>(players.length);
+ for (Object player : players) { + for (Object player : players) {
@ -106,17 +110,15 @@
+ } + }
+ } + }
+ +
+ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); + ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size(), (server.hidesOnlinePlayers()) ? Collections.emptyList() : profiles);
+ if (!this.server.hidesOnlinePlayers()) {
+ playerSample.setSample(profiles.toArray(new GameProfile[profiles.size()]));
+ }
+ +
+ ServerPing ping = new ServerPing(); + ServerPing ping = new ServerPing(
+ ping.setFavicon(event.icon.value); + CraftChatMessage.fromString(event.getMotd(), true)[0],
+ ping.setDescription(CraftChatMessage.fromString(event.getMotd(), true)[0]); + Optional.of(playerSample),
+ ping.setPlayers(playerSample); + Optional.of(new ServerPing.ServerData(server.getServerModName() + " " + server.getServerVersion(), SharedConstants.getCurrentVersion().getProtocolVersion())),
+ int version = SharedConstants.getCurrentVersion().getProtocolVersion(); + (event.icon.value != null) ? Optional.of(new ServerPing.a(event.icon.value)) : Optional.empty(),
+ ping.setVersion(new ServerPing.ServerData(server.getServerModName() + " " + server.getServerVersion(), version)); + server.enforceSecureProfile()
+ );
+ +
+ this.connection.send(new PacketStatusOutServerInfo(ping)); + this.connection.send(new PacketStatusOutServerInfo(ping));
+ // CraftBukkit end + // CraftBukkit end

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/PlayerConnection.java --- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java +++ b/net/minecraft/server/network/PlayerConnection.java
@@ -182,6 +182,67 @@ @@ -184,6 +184,67 @@
import net.minecraft.world.phys.shapes.VoxelShapes; import net.minecraft.world.phys.shapes.VoxelShapes;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -68,7 +68,7 @@
public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn { public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn {
static final Logger LOGGER = LogUtils.getLogger(); static final Logger LOGGER = LogUtils.getLogger();
@@ -198,7 +259,9 @@ @@ -200,7 +261,9 @@
private long keepAliveTime; private long keepAliveTime;
private boolean keepAlivePending; private boolean keepAlivePending;
private long keepAliveChallenge; private long keepAliveChallenge;
@ -79,7 +79,7 @@
private int dropSpamTickCount; private int dropSpamTickCount;
private double firstGoodX; private double firstGoodX;
private double firstGoodY; private double firstGoodY;
@@ -244,8 +307,31 @@ @@ -246,8 +309,31 @@
this.keepAliveTime = SystemUtils.getMillis(); this.keepAliveTime = SystemUtils.getMillis();
entityplayer.getTextFilter().join(); entityplayer.getTextFilter().join();
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID()); this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
@ -112,7 +112,7 @@
@Override @Override
public void tick() { public void tick() {
@@ -300,7 +386,7 @@ @@ -302,7 +388,7 @@
this.server.getProfiler().push("keepAlive"); this.server.getProfiler().push("keepAlive");
long i = SystemUtils.getMillis(); long i = SystemUtils.getMillis();
@ -121,7 +121,7 @@
if (this.keepAlivePending) { if (this.keepAlivePending) {
this.disconnect(IChatBaseComponent.translatable("disconnect.timeout")); this.disconnect(IChatBaseComponent.translatable("disconnect.timeout"));
} else { } else {
@@ -312,15 +398,21 @@ @@ -314,15 +400,21 @@
} }
this.server.getProfiler().pop(); this.server.getProfiler().pop();
@ -143,7 +143,7 @@
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling")); this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
} }
@@ -344,16 +436,67 @@ @@ -346,16 +438,67 @@
return this.server.isSingleplayerOwner(this.player.getGameProfile()); return this.server.isSingleplayerOwner(this.player.getGameProfile());
} }
@ -212,7 +212,7 @@
} }
private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) { private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
@@ -417,7 +560,34 @@ @@ -419,7 +562,34 @@
double d9 = entity.getDeltaMovement().lengthSqr(); double d9 = entity.getDeltaMovement().lengthSqr();
double d10 = d6 * d6 + d7 * d7 + d8 * d8; double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -248,7 +248,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); 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)); this.connection.send(new PacketPlayOutVehicleMove(entity));
return; return;
@@ -449,14 +619,72 @@ @@ -451,14 +621,72 @@
} }
entity.absMoveTo(d3, d4, d5, f, f1); entity.absMoveTo(d3, d4, d5, f, f1);
@ -321,7 +321,7 @@
this.player.getLevel().getChunkSource().move(this.player); this.player.getLevel().getChunkSource().move(this.player);
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2); 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); this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
@@ -490,6 +718,7 @@ @@ -492,6 +720,7 @@
} }
this.awaitingPositionFromClient = null; this.awaitingPositionFromClient = null;
@ -329,7 +329,7 @@
} }
} }
@@ -497,7 +726,7 @@ @@ -499,7 +728,7 @@
@Override @Override
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
@ -338,7 +338,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook(); RecipeBookServer recipebookserver = this.player.getRecipeBook();
Objects.requireNonNull(recipebookserver); Objects.requireNonNull(recipebookserver);
@@ -527,6 +756,12 @@ @@ -529,6 +758,12 @@
@Override @Override
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) { public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
@ -351,7 +351,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand()); StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
if (stringreader.canRead() && stringreader.peek() == '/') { if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -536,6 +771,7 @@ @@ -538,6 +773,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -359,7 +359,7 @@
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions)); this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
}); });
} }
@@ -785,6 +1021,13 @@ @@ -787,6 +1023,13 @@
if (container instanceof ContainerMerchant) { if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container; ContainerMerchant containermerchant = (ContainerMerchant) container;
@ -373,7 +373,7 @@
if (!containermerchant.stillValid(this.player)) { if (!containermerchant.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant); PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
@@ -799,6 +1042,13 @@ @@ -801,6 +1044,13 @@
@Override @Override
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) { public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
@ -387,7 +387,7 @@
int i = packetplayinbedit.getSlot(); int i = packetplayinbedit.getSlot();
if (PlayerInventory.isHotbarSlot(i) || i == 40) { if (PlayerInventory.isHotbarSlot(i) || i == 40) {
@@ -807,7 +1057,7 @@ @@ -809,7 +1059,7 @@
Objects.requireNonNull(list); Objects.requireNonNull(list);
optional.ifPresent(list::add); optional.ifPresent(list::add);
@ -396,7 +396,7 @@
Objects.requireNonNull(list); Objects.requireNonNull(list);
stream.forEach(list::add); stream.forEach(list::add);
@@ -825,7 +1075,7 @@ @@ -827,7 +1077,7 @@
ItemStack itemstack = this.player.getInventory().getItem(i); ItemStack itemstack = this.player.getInventory().getItem(i);
if (itemstack.is(Items.WRITABLE_BOOK)) { if (itemstack.is(Items.WRITABLE_BOOK)) {
@ -405,7 +405,7 @@
} }
} }
@@ -850,16 +1100,16 @@ @@ -852,16 +1102,16 @@
this.updateBookPages(list, (s) -> { this.updateBookPages(list, (s) -> {
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s)); return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
@ -426,7 +426,7 @@
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty())); return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
}); });
@@ -885,6 +1135,7 @@ @@ -887,6 +1137,7 @@
} }
itemstack.addTagElement("pages", nbttaglist); itemstack.addTagElement("pages", nbttaglist);
@ -434,7 +434,7 @@
} }
@Override @Override
@@ -921,7 +1172,7 @@ @@ -923,7 +1174,7 @@
} else { } else {
WorldServer worldserver = this.player.getLevel(); WorldServer worldserver = this.player.getLevel();
@ -443,7 +443,7 @@
if (this.tickCount == 0) { if (this.tickCount == 0) {
this.resetPosition(); this.resetPosition();
} }
@@ -931,7 +1182,7 @@ @@ -933,7 +1184,7 @@
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
} }
@ -452,7 +452,7 @@
} else { } else {
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX())); double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
@@ -943,7 +1194,15 @@ @@ -945,7 +1196,15 @@
if (this.player.isPassenger()) { if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
this.player.getLevel().getChunkSource().move(this.player); this.player.getLevel().getChunkSource().move(this.player);
@ -468,7 +468,7 @@
double d3 = this.player.getX(); double d3 = this.player.getX();
double d4 = this.player.getY(); double d4 = this.player.getY();
double d5 = this.player.getZ(); double d5 = this.player.getZ();
@@ -963,15 +1222,33 @@ @@ -965,15 +1224,33 @@
++this.receivedMovePacketCount; ++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount; int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@ -504,7 +504,7 @@
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d7, d8, d9}); 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()); this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return; return;
@@ -992,6 +1269,7 @@ @@ -994,6 +1271,7 @@
boolean flag1 = this.player.verticalCollisionBelow; boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
@ -512,12 +512,12 @@
double d12 = d8; double d12 = d8;
d7 = d0 - this.player.getX(); d7 = d0 - this.player.getX();
@@ -1011,9 +1289,72 @@ @@ -1013,9 +1291,72 @@
this.player.absMoveTo(d0, d1, d2, f, f1); 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))) { 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.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.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // 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()); this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
} else { } else {
+ // CraftBukkit start - fire PlayerMoveEvent + // CraftBukkit start - fire PlayerMoveEvent
@ -586,40 +586,25 @@
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.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.getLevel().getChunkSource().move(this.player);
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround()); this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
@@ -1052,19 +1393,80 @@ @@ -1054,11 +1395,68 @@
return true; return true;
} }
+ // CraftBukkit start - Delegate to teleport(Location) + // CraftBukkit start - Delegate to teleport(Location)
public void dismount(double d0, double d1, double d2, float f, float f1) {
- this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), true);
+ this.dismount(d0, d1, d2, f, f1, PlayerTeleportEvent.TeleportCause.DISMOUNT);
+ }
+
+ public void dismount(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), true, cause);
}
public void teleport(double d0, double d1, double d2, float f, float f1) { public void teleport(double d0, double d1, double d2, float f, float f1) {
- this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), false); - this.teleport(d0, d1, d2, f, f1, Collections.emptySet());
+ this.teleport(d0, d1, d2, f, f1, PlayerTeleportEvent.TeleportCause.UNKNOWN); + this.teleport(d0, d1, d2, f, f1, PlayerTeleportEvent.TeleportCause.UNKNOWN);
+ } + }
+ +
+ public void teleport(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) { + public void teleport(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), false, cause); + this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), cause);
} }
public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set) { public void teleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
- this.teleport(d0, d1, d2, f, f1, set, false);
+ this.teleport(d0, d1, d2, f, f1, set, PlayerTeleportEvent.TeleportCause.UNKNOWN); + 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, PlayerTeleportEvent.TeleportCause cause) { + public boolean teleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set, PlayerTeleportEvent.TeleportCause cause) { // CraftBukkit - Return event status
+ this.teleport(d0, d1, d2, f, f1, set, false, cause);
}
- public void teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag) {
+ public boolean teleport(double d0, double d1, double d2, float f, float f1, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, boolean flag, PlayerTeleportEvent.TeleportCause cause) { // CraftBukkit - Return event status
+ Player player = this.getCraftPlayer(); + Player player = this.getCraftPlayer();
+ Location from = player.getLocation(); + Location from = player.getLocation();
+ +
@ -632,7 +617,7 @@
+ Location to = new Location(this.getCraftPlayer().getWorld(), x, y, z, yaw, pitch); + Location to = new Location(this.getCraftPlayer().getWorld(), x, y, z, yaw, pitch);
+ // SPIGOT-5171: Triggered on join + // SPIGOT-5171: Triggered on join
+ if (from.equals(to)) { + if (from.equals(to)) {
+ this.internalTeleport(d0, d1, d2, f, f1, set, flag); + this.internalTeleport(d0, d1, d2, f, f1, set);
+ return false; // CraftBukkit - Return event status + return false; // CraftBukkit - Return event status
+ } + }
+ +
@ -649,15 +634,15 @@
+ f1 = to.getPitch(); + f1 = to.getPitch();
+ } + }
+ +
+ this.internalTeleport(d0, d1, d2, f, f1, set, flag); + this.internalTeleport(d0, d1, d2, f, f1, set);
+ return event.isCancelled(); // CraftBukkit - Return event status + return event.isCancelled(); // CraftBukkit - Return event status
+ } + }
+ +
+ public void teleport(Location dest) { + public void teleport(Location dest) {
+ internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.<PacketPlayOutPosition.EnumPlayerTeleportFlags>emptySet(), true); + internalTeleport(dest.getX(), dest.getY(), dest.getZ(), dest.getYaw(), dest.getPitch(), Collections.emptySet());
+ } + }
+ +
+ private void internalTeleport(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<RelativeMovement> set) {
+ // CraftBukkit start + // CraftBukkit start
+ if (Float.isNaN(f)) { + if (Float.isNaN(f)) {
+ f = 0; + f = 0;
@ -668,10 +653,10 @@
+ +
+ this.justTeleported = true; + this.justTeleported = true;
+ // CraftBukkit end + // CraftBukkit end
double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.getX() : 0.0D; double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.getY() : 0.0D; double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.getZ() : 0.0D; double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
@@ -1076,6 +1478,14 @@ @@ -1070,6 +1468,14 @@
this.awaitingTeleport = 0; this.awaitingTeleport = 0;
} }
@ -685,8 +670,8 @@
+ +
this.awaitingTeleportTime = this.tickCount; this.awaitingTeleportTime = this.tickCount;
this.player.absMoveTo(d0, d1, d2, f, f1); 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)); this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
@@ -1084,6 +1494,7 @@ @@ -1078,6 +1484,7 @@
@Override @Override
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) { public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
@ -694,7 +679,7 @@
BlockPosition blockposition = packetplayinblockdig.getPos(); BlockPosition blockposition = packetplayinblockdig.getPos();
this.player.resetLastActionTime(); this.player.resetLastActionTime();
@@ -1094,14 +1505,46 @@ @@ -1088,14 +1495,46 @@
if (!this.player.isSpectator()) { if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND); ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
@ -743,7 +728,7 @@
this.player.drop(false); this.player.drop(false);
} }
@@ -1139,6 +1582,7 @@ @@ -1133,6 +1572,7 @@
@Override @Override
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) { public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
@ -751,7 +736,7 @@
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence()); this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
WorldServer worldserver = this.player.getLevel(); WorldServer worldserver = this.player.getLevel();
EnumHand enumhand = packetplayinuseitem.getHand(); EnumHand enumhand = packetplayinuseitem.getHand();
@@ -1162,6 +1606,7 @@ @@ -1156,6 +1596,7 @@
if (blockposition.getY() < i) { 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)) { 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)) {
@ -759,7 +744,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); 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)) { if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
@@ -1190,6 +1635,7 @@ @@ -1184,6 +1625,7 @@
@Override @Override
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) { public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
@ -767,7 +752,7 @@
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence()); this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
WorldServer worldserver = this.player.getLevel(); WorldServer worldserver = this.player.getLevel();
EnumHand enumhand = packetplayinblockplace.getHand(); EnumHand enumhand = packetplayinblockplace.getHand();
@@ -1197,6 +1643,49 @@ @@ -1191,6 +1633,49 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) { if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
@ -817,7 +802,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand); EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.shouldSwing()) { if (enuminteractionresult.shouldSwing()) {
@@ -1217,7 +1706,7 @@ @@ -1211,7 +1696,7 @@
Entity entity = packetplayinspectate.getEntity(worldserver); Entity entity = packetplayinspectate.getEntity(worldserver);
if (entity != null) { if (entity != null) {
@ -826,7 +811,7 @@
return; return;
} }
} }
@@ -1232,6 +1721,7 @@ @@ -1226,6 +1711,7 @@
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName()); PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect")); this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
} }
@ -834,7 +819,7 @@
} }
@@ -1251,12 +1741,27 @@ @@ -1247,12 +1733,27 @@
@Override @Override
public void onDisconnect(IChatBaseComponent ichatbasecomponent) { public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
@ -863,7 +848,7 @@
this.player.getTextFilter().leave(); this.player.getTextFilter().leave();
if (this.isSingleplayerOwner()) { if (this.isSingleplayerOwner()) {
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
@@ -1279,6 +1784,15 @@ @@ -1275,6 +1776,15 @@
} }
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) { public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
@ -879,7 +864,7 @@
try { try {
this.connection.send(packet, packetsendlistener); this.connection.send(packet, packetsendlistener);
} catch (Throwable throwable) { } catch (Throwable throwable) {
@@ -1295,7 +1809,16 @@ @@ -1291,7 +1801,16 @@
@Override @Override
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) { public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
@ -896,7 +881,7 @@
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) { if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
this.player.stopUsingItem(); this.player.stopUsingItem();
} }
@@ -1304,18 +1827,25 @@ @@ -1300,18 +1819,25 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
} else { } else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -923,7 +908,7 @@
PlayerChatMessage playerchatmessage; PlayerChatMessage playerchatmessage;
try { try {
@@ -1333,9 +1863,9 @@ @@ -1329,9 +1855,9 @@
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask()); PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask());
this.broadcastChatMessage(playerchatmessage1); this.broadcastChatMessage(playerchatmessage1);
@ -935,7 +920,7 @@
} }
} }
@@ -1359,12 +1889,25 @@ @@ -1355,12 +1881,25 @@
} }
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) { private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
@ -963,7 +948,7 @@
} catch (SignedMessageChain.a signedmessagechain_a) { } catch (SignedMessageChain.a signedmessagechain_a) {
this.handleMessageDecodeFailure(signedmessagechain_a); this.handleMessageDecodeFailure(signedmessagechain_a);
return; return;
@@ -1372,10 +1915,10 @@ @@ -1368,10 +1907,10 @@
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map); CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
@ -976,16 +961,16 @@
} }
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) { private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
@@ -1413,7 +1956,7 @@ @@ -1412,7 +1951,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 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 Optional.empty();
} else { } else {
@@ -1462,6 +2005,122 @@ Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ 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 Optional.empty();
} else {
@@ -1460,6 +1999,122 @@
return false; return false;
} }
@ -1108,7 +1093,7 @@
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a { private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages); SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
@@ -1469,13 +2128,33 @@ @@ -1467,13 +2122,33 @@
} }
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) { private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
@ -1145,7 +1130,7 @@
this.disconnect(IChatBaseComponent.translatable("disconnect.spam")); this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
} }
@@ -1497,13 +2176,59 @@ @@ -1495,13 +2170,59 @@
@Override @Override
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) { public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel());
@ -1203,9 +1188,9 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.player.resetLastActionTime(); this.player.resetLastActionTime();
Entity entity;
IJumpable ijumpable; IJumpable ijumpable;
@@ -1583,6 +2304,12 @@
@@ -1583,6 +2308,12 @@
} }
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) { public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
@ -1218,7 +1203,7 @@
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level.registryAccess()))); this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level.registryAccess())));
this.addPendingMessage(playerchatmessage); this.addPendingMessage(playerchatmessage);
} }
@@ -1594,6 +2325,7 @@ @@ -1598,6 +2325,7 @@
@Override @Override
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) { public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
@ -1226,9 +1211,9 @@
final WorldServer worldserver = this.player.getLevel(); final WorldServer worldserver = this.player.getLevel();
final Entity entity = packetplayinuseentity.getTarget(worldserver); final Entity entity = packetplayinuseentity.getTarget(worldserver);
@@ -1606,13 +2338,51 @@ @@ -1612,13 +2340,51 @@
if (entity.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) { if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() { packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) { - private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit + private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
@ -1279,7 +1264,7 @@
if (enuminteractionresult.consumesAction()) { if (enuminteractionresult.consumesAction()) {
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity); CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
if (enuminteractionresult.shouldSwing()) { if (enuminteractionresult.shouldSwing()) {
@@ -1625,23 +2395,29 @@ @@ -1631,23 +2397,29 @@
@Override @Override
public void onInteraction(EnumHand enumhand) { public void onInteraction(EnumHand enumhand) {
@ -1312,7 +1297,7 @@
} }
} else { } else {
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked")); PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
@@ -1687,15 +2463,21 @@ @@ -1693,15 +2465,21 @@
@Override @Override
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) { public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
@ -1336,7 +1321,7 @@
this.player.containerMenu.sendAllDataToRemote(); this.player.containerMenu.sendAllDataToRemote();
} else if (!this.player.containerMenu.stillValid(this.player)) { } else if (!this.player.containerMenu.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
@@ -1708,7 +2490,284 @@ @@ -1714,7 +2492,284 @@
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId(); boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates(); this.player.containerMenu.suppressRemoteUpdates();
@ -1622,7 +1607,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator(); ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
while (objectiterator.hasNext()) { while (objectiterator.hasNext()) {
@@ -1748,6 +2807,7 @@ @@ -1754,6 +2809,7 @@
@Override @Override
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) { public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
@ -1630,7 +1615,7 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) { if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) { if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1790,6 +2850,43 @@ @@ -1796,6 +2852,43 @@
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45; boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1673,8 +1658,8 @@
+ // CraftBukkit end + // CraftBukkit end
if (flag1 && flag2) { if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).set(itemstack); this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
@@ -1812,6 +2909,7 @@ @@ -1818,6 +2911,7 @@
} }
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) { private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
@ -1682,7 +1667,7 @@
this.player.resetLastActionTime(); this.player.resetLastActionTime();
WorldServer worldserver = this.player.getLevel(); WorldServer worldserver = this.player.getLevel();
BlockPosition blockposition = packetplayinupdatesign.getPos(); BlockPosition blockposition = packetplayinupdatesign.getPos();
@@ -1828,18 +2926,37 @@ @@ -1834,18 +2928,37 @@
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) { if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString()); PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
@ -1722,7 +1707,7 @@
tileentitysign.setChanged(); tileentitysign.setChanged();
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3); worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
@@ -1849,6 +2966,7 @@ @@ -1855,6 +2968,7 @@
@Override @Override
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) { public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
@ -1730,7 +1715,7 @@
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) { if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime); int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
@@ -1863,7 +2981,17 @@ @@ -1869,7 +2983,17 @@
@Override @Override
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) { public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel()); PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
@ -1749,7 +1734,7 @@
} }
@Override @Override
@@ -1872,8 +3000,50 @@ @@ -1878,8 +3002,50 @@
this.player.updateOptions(packetplayinsettings); this.player.updateOptions(packetplayinsettings);
} }

Datei anzeigen

@ -1,12 +1,14 @@
--- a/net/minecraft/server/network/ServerConnection.java --- a/net/minecraft/server/network/ServerConnection.java
+++ b/net/minecraft/server/network/ServerConnection.java +++ b/net/minecraft/server/network/ServerConnection.java
@@ -98,14 +98,24 @@ @@ -95,16 +95,26 @@
int j = ServerConnection.this.server.getRateLimitPacketsPerSecond();
Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
- ServerConnection.this.connections.add(object); NetworkManager.configureSerialization(channelpipeline, EnumProtocolDirection.SERVERBOUND);
+ ServerConnection.this.connections.add((NetworkManager) object); // CraftBukkit - decompile error int j = ServerConnection.this.server.getRateLimitPacketsPerSecond();
channel.pipeline().addLast("packet_handler", (ChannelHandler) object); - Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
+ NetworkManager object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND); // CraftBukkit - decompile error
ServerConnection.this.connections.add(object);
channelpipeline.addLast("packet_handler", (ChannelHandler) object);
((NetworkManager) object).setListener(new HandshakeListener(ServerConnection.this.server, (NetworkManager) object)); ((NetworkManager) object).setListener(new HandshakeListener(ServerConnection.this.server, (NetworkManager) object));
} }
- }).group((EventLoopGroup) lazyinitvar.get()).localAddress(inetaddress, i)).bind().syncUninterruptibly()); - }).group((EventLoopGroup) lazyinitvar.get()).localAddress(inetaddress, i)).bind().syncUninterruptibly());

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/server/players/PlayerList.java --- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java
@@ -107,6 +107,25 @@ @@ -108,6 +108,25 @@
import net.minecraft.world.scores.ScoreboardTeamBase; import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -26,7 +26,7 @@
public abstract class PlayerList { public abstract class PlayerList {
public static final File USERBANLIST_FILE = new File("banned-players.json"); public static final File USERBANLIST_FILE = new File("banned-players.json");
@@ -118,14 +137,16 @@ @@ -119,14 +138,16 @@
private static final int SEND_PLAYER_INFO_INTERVAL = 600; 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 static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server; private final MinecraftServer server;
@ -46,7 +46,7 @@
public final WorldNBTStorage playerIo; public final WorldNBTStorage playerIo;
private boolean doWhiteList; private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries; private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -137,13 +158,23 @@ @@ -138,13 +159,23 @@
private static final boolean ALLOW_LOGOUTIVATOR = false; private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn; private int sendAllPlayerInfoIn;
@ -72,7 +72,7 @@
this.server = minecraftserver; this.server = minecraftserver;
this.registries = layeredregistryaccess; this.registries = layeredregistryaccess;
this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze(); this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze();
@@ -160,9 +191,15 @@ @@ -161,9 +192,15 @@
usercache.add(gameprofile); usercache.add(gameprofile);
NBTTagCompound nbttagcompound = this.load(entityplayer); NBTTagCompound nbttagcompound = this.load(entityplayer);
ResourceKey resourcekey; ResourceKey resourcekey;
@ -89,7 +89,7 @@
Logger logger = PlayerList.LOGGER; Logger logger = PlayerList.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -189,7 +226,8 @@ @@ -190,7 +227,8 @@
s1 = networkmanager.getRemoteAddress().toString(); s1 = networkmanager.getRemoteAddress().toString();
} }
@ -99,7 +99,7 @@
WorldData worlddata = worldserver1.getLevelData(); WorldData worlddata = worldserver1.getLevelData();
entityplayer.loadGameTypes(nbttagcompound); entityplayer.loadGameTypes(nbttagcompound);
@@ -199,6 +237,7 @@ @@ -200,6 +238,7 @@
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO); 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.synchronizedRegistries, 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()));
@ -107,7 +107,7 @@
playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures()))); 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 PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
@@ -218,16 +257,68 @@ @@ -219,8 +258,10 @@
} else { } else {
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
} }
@ -117,13 +117,13 @@
- this.broadcastSystemMessage(ichatmutablecomponent.withStyle(EnumChatFormat.YELLOW), false); - this.broadcastSystemMessage(ichatmutablecomponent.withStyle(EnumChatFormat.YELLOW), false);
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot()); playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
entityplayer.sendServerStatus(this.server.getStatus()); ServerPing serverping = this.server.getStatus();
@@ -231,10 +272,61 @@
entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
this.players.add(entityplayer); this.players.add(entityplayer);
this.playersByUUID.put(entityplayer.getUUID(), entityplayer); this.playersByUUID.put(entityplayer.getUUID(), entityplayer);
- this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); - 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 + // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(entityplayer))); // CraftBukkit - replaced with loop below
+ +
+ // CraftBukkit start + // CraftBukkit start
@ -135,7 +135,7 @@
+ PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage); + PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(bukkitPlayer, joinMessage);
+ cserver.getPluginManager().callEvent(playerJoinEvent); + cserver.getPluginManager().callEvent(playerJoinEvent);
+ +
+ if (!entityplayer.connection.connection.isConnected()) { + if (!entityplayer.connection.isAcceptingMessages()) {
+ return; + return;
+ } + }
+ +
@ -168,6 +168,10 @@
+ // CraftBukkit end + // CraftBukkit end
+ +
+ entityplayer.getEntityData().refresh(entityplayer); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn + entityplayer.getEntityData().refresh(entityplayer); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
+
this.sendLevelInfo(entityplayer, worldserver1);
- worldserver1.addNewPlayer(entityplayer);
- this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
+ +
+ // CraftBukkit start - Only add if the player wasn't moved in the event + // CraftBukkit start - Only add if the player wasn't moved in the event
+ if (entityplayer.level == worldserver1 && !worldserver1.players().contains(entityplayer)) { + if (entityplayer.level == worldserver1 && !worldserver1.players().contains(entityplayer)) {
@ -177,10 +181,10 @@
+ +
+ worldserver1 = entityplayer.getLevel(); // CraftBukkit - Update in case join event changed it + worldserver1 = entityplayer.getLevel(); // CraftBukkit - Update in case join event changed it
+ // CraftBukkit end + // CraftBukkit end
this.sendLevelInfo(entityplayer, worldserver1);
this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> { this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> {
entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt()); entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt());
@@ -242,8 +333,11 @@ });
@@ -248,8 +340,11 @@
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) { if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@ -194,7 +198,7 @@
}); });
if (entity != null) { if (entity != null) {
@@ -286,6 +380,8 @@ @@ -292,6 +387,8 @@
} }
entityplayer.initInventoryMenu(); entityplayer.initInventoryMenu();
@ -203,7 +207,7 @@
} }
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
@@ -318,30 +414,31 @@ @@ -324,30 +421,31 @@
} }
public void addWorldborderListener(WorldServer worldserver) { public void addWorldborderListener(WorldServer worldserver) {
@ -240,7 +244,7 @@
} }
@Override @Override
@@ -369,14 +466,15 @@ @@ -375,14 +473,15 @@
} }
protected void save(EntityPlayer entityplayer) { protected void save(EntityPlayer entityplayer) {
@ -258,7 +262,7 @@
if (advancementdataplayer != null) { if (advancementdataplayer != null) {
advancementdataplayer.save(); advancementdataplayer.save();
@@ -384,10 +482,24 @@ @@ -390,10 +489,24 @@
} }
@ -284,7 +288,7 @@
this.save(entityplayer); this.save(entityplayer);
if (entityplayer.isPassenger()) { if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle(); Entity entity = entityplayer.getRootVehicle();
@@ -411,18 +523,66 @@ @@ -417,18 +530,66 @@
if (entityplayer1 == entityplayer) { if (entityplayer1 == entityplayer) {
this.playersByUUID.remove(uuid); this.playersByUUID.remove(uuid);
@ -357,7 +361,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile); GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason()); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
@@ -430,10 +590,12 @@ @@ -436,10 +597,12 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires()))); ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
} }
@ -373,7 +377,7 @@
IpBanEntry ipbanentry = this.ipBans.get(socketaddress); IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason()); ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
@@ -441,13 +603,25 @@ @@ -447,13 +610,25 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires()))); ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
} }
@ -402,7 +406,7 @@
UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile); UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile);
List<EntityPlayer> list = Lists.newArrayList(); List<EntityPlayer> list = Lists.newArrayList();
@@ -474,14 +648,24 @@ @@ -480,14 +655,24 @@
} }
return new EntityPlayer(this.server, this.server.overworld(), gameprofile); return new EntityPlayer(this.server, this.server.overworld(), gameprofile);
@ -427,7 +431,7 @@
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension()); WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
Optional optional; Optional optional;
@@ -493,6 +677,11 @@ @@ -499,6 +684,11 @@
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld(); WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile()); EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile());
@ -439,7 +443,7 @@
entityplayer1.connection = entityplayer.connection; entityplayer1.connection = entityplayer.connection;
entityplayer1.restoreFrom(entityplayer, flag); entityplayer1.restoreFrom(entityplayer, flag);
@@ -508,50 +697,112 @@ @@ -514,50 +704,112 @@
boolean flag2 = false; boolean flag2 = false;
@ -464,8 +468,7 @@
+ } else { + } else {
+ optional = Optional.empty(); + optional = Optional.empty();
+ } + }
+
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
+ if (optional.isPresent()) { + if (optional.isPresent()) {
+ IBlockData iblockdata = worldserver1.getBlockState(blockposition); + IBlockData iblockdata = worldserver1.getBlockState(blockposition);
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR); + boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
@ -489,7 +492,8 @@
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed + entityplayer1.setRespawnPosition(null, null, 0f, false, false); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
+ } + }
+ } + }
+
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
+ if (location == null) { + if (location == null) {
+ worldserver1 = this.server.getLevel(World.OVERWORLD); + worldserver1 = this.server.getLevel(World.OVERWORLD);
+ blockposition = entityplayer1.getSpawnPoint(worldserver1); + blockposition = entityplayer1.getSpawnPoint(worldserver1);
@ -560,13 +564,13 @@
+ +
+ // Fire advancement trigger + // Fire advancement trigger
+ entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle()); + entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle());
+
+ // Don't fire on respawn + // Don't fire on respawn
+ if (fromWorld != location.getWorld()) { + if (fromWorld != location.getWorld()) {
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld); + PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld);
+ server.server.getPluginManager().callEvent(event); + server.server.getPluginManager().callEvent(event);
+ } + }
+
+ // Save player file again if they were disconnected + // Save player file again if they were disconnected
+ if (entityplayer.connection.isDisconnected()) { + if (entityplayer.connection.isDisconnected()) {
+ this.save(entityplayer); + this.save(entityplayer);
@ -575,7 +579,7 @@
return entityplayer1; return entityplayer1;
} }
@@ -564,7 +815,18 @@ @@ -570,7 +822,18 @@
public void tick() { public void tick() {
if (++this.sendAllPlayerInfoIn > 600) { if (++this.sendAllPlayerInfoIn > 600) {
@ -595,7 +599,7 @@
this.sendAllPlayerInfoIn = 0; this.sendAllPlayerInfoIn = 0;
} }
@@ -581,6 +843,25 @@ @@ -587,6 +850,25 @@
} }
@ -621,7 +625,7 @@
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) { public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
Iterator iterator = this.players.iterator(); Iterator iterator = this.players.iterator();
@@ -659,7 +940,7 @@ @@ -665,7 +947,7 @@
} }
public void deop(GameProfile gameprofile) { public void deop(GameProfile gameprofile) {
@ -630,7 +634,7 @@
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId()); EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
if (entityplayer != null) { if (entityplayer != null) {
@@ -683,6 +964,7 @@ @@ -689,6 +971,7 @@
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0)); entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
} }
@ -638,7 +642,7 @@
this.server.getCommands().sendCommands(entityplayer); this.server.getCommands().sendCommands(entityplayer);
} }
@@ -715,6 +997,12 @@ @@ -721,6 +1004,12 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i); EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -651,7 +655,7 @@
if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) { if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) {
double d4 = d0 - entityplayer.getX(); double d4 = d0 - entityplayer.getX();
double d5 = d1 - entityplayer.getY(); double d5 = d1 - entityplayer.getY();
@@ -754,23 +1042,35 @@ @@ -760,23 +1049,35 @@
public void reloadWhiteList() {} public void reloadWhiteList() {}
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) { public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
@ -692,7 +696,7 @@
} }
public int getPlayerCount() { public int getPlayerCount() {
@@ -826,12 +1126,22 @@ @@ -832,12 +1133,22 @@
} }
public void removeAll() { public void removeAll() {
@ -717,7 +721,7 @@
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> { this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
return ichatbasecomponent; return ichatbasecomponent;
@@ -889,16 +1199,23 @@ @@ -895,16 +1206,23 @@
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now()); return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
} }
@ -745,7 +749,7 @@
Path path = file2.toPath(); Path path = file2.toPath();
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) { if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -907,7 +1224,7 @@ @@ -913,7 +1231,7 @@
} }
serverstatisticmanager = new ServerStatisticManager(this.server, file1); serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -754,7 +758,7 @@
} }
return serverstatisticmanager; return serverstatisticmanager;
@@ -915,14 +1232,14 @@ @@ -921,13 +1239,13 @@
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) { public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUUID(); UUID uuid = entityplayer.getUUID();
@ -762,16 +766,15 @@
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancements(); // CraftBukkit + AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancements(); // CraftBukkit
if (advancementdataplayer == null) { if (advancementdataplayer == null) {
File file = this.server.getWorldPath(SavedFile.PLAYER_ADVANCEMENTS_DIR).toFile(); Path path = this.server.getWorldPath(SavedFile.PLAYER_ADVANCEMENTS_DIR).resolve(uuid + ".json");
File file1 = new File(file, uuid + ".json");
advancementdataplayer = new AdvancementDataPlayer(this.server.getFixerUpper(), this, this.server.getAdvancements(), file1, entityplayer); advancementdataplayer = new AdvancementDataPlayer(this.server.getFixerUpper(), this, this.server.getAdvancements(), path, entityplayer);
- this.advancements.put(uuid, advancementdataplayer); - this.advancements.put(uuid, advancementdataplayer);
+ // this.advancements.put(uuid, advancementdataplayer); // CraftBukkit + // this.advancements.put(uuid, advancementdataplayer); // CraftBukkit
} }
advancementdataplayer.setPlayer(entityplayer); advancementdataplayer.setPlayer(entityplayer);
@@ -973,13 +1290,20 @@ @@ -978,13 +1296,20 @@
} }
public void reloadResources() { public void reloadResources() {

Datei anzeigen

@ -5,7 +5,7 @@
package net.minecraft.stats; package net.minecraft.stats;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@@ -162,13 +163,12 @@ @@ -158,13 +159,12 @@
} }
private <T> Optional<Statistic<T>> getStat(StatisticWrapper<T> statisticwrapper, String s) { private <T> Optional<Statistic<T>> getStat(StatisticWrapper<T> statisticwrapper, String s) {

Datei anzeigen

@ -1,11 +1,11 @@
--- a/net/minecraft/util/datafix/DataConverterRegistry.java --- a/net/minecraft/util/datafix/DataConverterRegistry.java
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java +++ b/net/minecraft/util/datafix/DataConverterRegistry.java
@@ -444,6 +444,18 @@ @@ -434,6 +434,18 @@
datafixerbuilder.addFixer(new DataConverterItemFrame(schema46, false)); datafixerbuilder.addFixer(new DataConverterItemFrame(schema44, false));
Schema schema47 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED); Schema schema45 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
+ // CraftBukkit start + // CraftBukkit start
+ datafixerbuilder.addFixer(new com.mojang.datafixers.DataFix(schema47, false) { + datafixerbuilder.addFixer(new com.mojang.datafixers.DataFix(schema45, false) {
+ @Override + @Override
+ protected com.mojang.datafixers.TypeRewriteRule makeRule() { + protected com.mojang.datafixers.TypeRewriteRule makeRule() {
+ return this.fixTypeEverywhereTyped("Player CustomName", this.getInputSchema().getType(DataConverterTypes.PLAYER), (typed) -> { + return this.fixTypeEverywhereTyped("Player CustomName", this.getInputSchema().getType(DataConverterTypes.PLAYER), (typed) -> {
@ -16,57 +16,57 @@
+ } + }
+ }); + });
+ // CraftBukkit end + // CraftBukkit end
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema47, false)); datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema45, false));
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema47, false)); datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema45, false));
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema47, false)); datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema45, false));
@@ -761,12 +773,14 @@ @@ -751,12 +763,14 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Squid", DataConverterTypes.ENTITY)); datafixerbuilder.addFixer(new DataConverterAddChoices(schema129, "Added Glow Squid", DataConverterTypes.ENTITY));
datafixerbuilder.addFixer(new DataConverterAddChoices(schema131, "Added Glow Item Frame", DataConverterTypes.ENTITY)); datafixerbuilder.addFixer(new DataConverterAddChoices(schema129, "Added Glow Item Frame", DataConverterTypes.ENTITY));
Schema schema132 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED); Schema schema130 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap = ImmutableMap.builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build(); - ImmutableMap<String, String> immutablemap = ImmutableMap.builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
+ // CraftBukkit - decompile error + // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap = ImmutableMap.<String, String>builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build(); + ImmutableMap<String, String> immutablemap = ImmutableMap.<String, String>builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap))); datafixerbuilder.addFixer(DataConverterItemName.create(schema130, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema132, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap))); datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema130, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap)));
Schema schema133 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED); Schema schema131 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap1 = ImmutableMap.builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build(); - ImmutableMap<String, String> immutablemap1 = ImmutableMap.builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
+ // CraftBukkit - decompile error + // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap1 = ImmutableMap.<String, String>builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build(); + ImmutableMap<String, String> immutablemap1 = ImmutableMap.<String, String>builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema133, "Rename copper item suffixes", createRenamer(immutablemap1))); datafixerbuilder.addFixer(DataConverterItemName.create(schema131, "Rename copper item suffixes", createRenamer(immutablemap1)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema133, "Rename copper blocks suffixes", createRenamer(immutablemap1))); datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema131, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
@@ -774,7 +788,8 @@ @@ -764,7 +778,8 @@
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema134, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false)); datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema132, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
Schema schema135 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED); Schema schema133 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap2 = ImmutableMap.builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build(); - ImmutableMap<String, String> immutablemap2 = ImmutableMap.builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
+ // CraftBukkit - decompile error + // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap2 = ImmutableMap.<String, String>builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build(); + ImmutableMap<String, String> immutablemap2 = ImmutableMap.<String, String>builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema135, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2))); datafixerbuilder.addFixer(DataConverterItemName.create(schema133, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema135, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2))); datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema133, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
@@ -861,10 +876,11 @@ @@ -851,10 +866,11 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema160, "Added Allay", DataConverterTypes.ENTITY)); datafixerbuilder.addFixer(new DataConverterAddChoices(schema158, "Added Allay", DataConverterTypes.ENTITY));
Schema schema161 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED); Schema schema159 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
- datafixerbuilder.addFixer(new SimpleRenameFix(schema161, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build())); - datafixerbuilder.addFixer(new SimpleRenameFix(schema159, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build()));
+ // CraftBukkit - decompile error + // CraftBukkit - decompile error
+ datafixerbuilder.addFixer(new SimpleRenameFix(schema161, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.<String, String>builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build())); + datafixerbuilder.addFixer(new SimpleRenameFix(schema159, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.<String, String>builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build()));
Schema schema162 = datafixerbuilder.addSchema(3086, DataConverterRegistry.SAME_NAMESPACED); Schema schema160 = datafixerbuilder.addSchema(3086, DataConverterRegistry.SAME_NAMESPACED);
TypeReference typereference = DataConverterTypes.ENTITY; TypeReference typereference = DataConverterTypes.ENTITY;
- Int2ObjectOpenHashMap int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> { - Int2ObjectOpenHashMap int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> {
+ Int2ObjectOpenHashMap<String> int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> { // CraftBukkit - decompile error + Int2ObjectOpenHashMap<String> int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> { // CraftBukkit - decompile error
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby"); int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
int2objectopenhashmap1.put(0, "minecraft:tabby"); int2objectopenhashmap1.put(0, "minecraft:tabby");
int2objectopenhashmap1.put(1, "minecraft:black"); int2objectopenhashmap1.put(1, "minecraft:black");
@@ -881,7 +897,8 @@ @@ -871,7 +887,8 @@
Objects.requireNonNull(int2objectopenhashmap); Objects.requireNonNull(int2objectopenhashmap);
datafixerbuilder.addFixer(new EntityVariantFix(schema162, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get)); datafixerbuilder.addFixer(new EntityVariantFix(schema160, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
- ImmutableMap<String, String> immutablemap3 = ImmutableMap.builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build(); - ImmutableMap<String, String> immutablemap3 = ImmutableMap.builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build();
+ // CraftBukkit - decompile error + // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap3 = ImmutableMap.<String, String>builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build(); + ImmutableMap<String, String> immutablemap3 = ImmutableMap.<String, String>builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build();
datafixerbuilder.addFixer(new CriteriaRenameFix(schema162, "Migrate cat variant advancement", "minecraft:husbandry/complete_catalogue", (s) -> { datafixerbuilder.addFixer(new CriteriaRenameFix(schema160, "Migrate cat variant advancement", "minecraft:husbandry/complete_catalogue", (s) -> {
return (String) immutablemap3.getOrDefault(s, s); return (String) immutablemap3.getOrDefault(s, s);

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/IInventory.java --- a/net/minecraft/world/IInventory.java
+++ b/net/minecraft/world/IInventory.java +++ b/net/minecraft/world/IInventory.java
@@ -6,6 +6,11 @@ @@ -9,6 +9,11 @@
import net.minecraft.world.item.Item; import net.minecraft.world.level.World;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.TileEntity;
+// CraftBukkit start +// CraftBukkit start
+import net.minecraft.world.item.crafting.IRecipe; +import net.minecraft.world.item.crafting.IRecipe;
@ -12,7 +12,7 @@
public interface IInventory extends Clearable { public interface IInventory extends Clearable {
int LARGE_MAX_STACK_SIZE = 64; int LARGE_MAX_STACK_SIZE = 64;
@@ -22,9 +27,7 @@ @@ -26,9 +31,7 @@
void setItem(int i, ItemStack itemstack); void setItem(int i, ItemStack itemstack);
@ -23,9 +23,9 @@
void setChanged(); void setChanged();
@@ -69,4 +72,29 @@ @@ -88,4 +91,29 @@
return false; return world == null ? false : (world.getBlockEntity(blockposition) != tileentity ? false : entityhuman.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= (double) (i * i));
} }
+ +
+ // CraftBukkit start + // CraftBukkit start

Datei anzeigen

@ -1,11 +1,13 @@
--- a/net/minecraft/world/damagesource/DamageSource.java --- a/net/minecraft/world/damagesource/DamageSource.java
+++ b/net/minecraft/world/damagesource/DamageSource.java +++ b/net/minecraft/world/damagesource/DamageSource.java
@@ -49,6 +49,18 @@ @@ -20,6 +20,38 @@
private boolean isFall; private final Entity directEntity;
private boolean noAggro; @Nullable
public final String msgId; private final Vec3D damageSourcePosition;
+ // CraftBukkit start + // CraftBukkit start
+ private boolean sweep; + private boolean sweep;
+ private boolean melting;
+ private boolean poison;
+ +
+ public boolean isSweep() { + public boolean isSweep() {
+ return sweep; + return sweep;
@ -15,7 +17,25 @@
+ this.sweep = true; + this.sweep = true;
+ return this; + return this;
+ } + }
+
+ public boolean isMelting() {
+ return melting;
+ }
+
+ public DamageSource melting() {
+ this.melting = true;
+ return this;
+ }
+
+ public boolean isPoison() {
+ return poison;
+ }
+
+ public DamageSource poison() {
+ this.poison = true;
+ return this;
+ }
+ // CraftBukkit end + // CraftBukkit end
public static DamageSource fallingBlock(Entity entity) { public String toString() {
return (new EntityDamageSource("fallingBlock", entity)).damageHelmet(); return "DamageSource (" + this.type().msgId() + ")";

Datei anzeigen

@ -0,0 +1,18 @@
--- a/net/minecraft/world/damagesource/DamageSources.java
+++ b/net/minecraft/world/damagesource/DamageSources.java
@@ -39,9 +39,15 @@
private final DamageSource sweetBerryBush;
private final DamageSource freeze;
private final DamageSource stalagmite;
+ // CraftBukkit start
+ public final DamageSource melting;
+ public final DamageSource poison;
public DamageSources(IRegistryCustom iregistrycustom) {
this.damageTypes = iregistrycustom.registryOrThrow(Registries.DAMAGE_TYPE);
+ this.melting = this.source(DamageTypes.ON_FIRE).melting();
+ this.poison = this.source(DamageTypes.MAGIC).poison();
+ // CraftBukkit end
this.inFire = this.source(DamageTypes.IN_FIRE);
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
this.onFire = this.source(DamageTypes.ON_FIRE);

Datei anzeigen

@ -1,13 +0,0 @@
--- a/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
+++ b/net/minecraft/world/damagesource/EntityDamageSourceIndirect.java
@@ -53,4 +53,10 @@
return IChatBaseComponent.translatable(s, entityliving.getDisplayName(), ichatbasecomponent);
}
}
+
+ // CraftBukkit start
+ public Entity getProximateDamageSource() {
+ return super.getEntity();
+ }
+ // CraftBukkit end
}

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/effect/MobEffectList.java --- a/net/minecraft/world/effect/MobEffectList.java
+++ b/net/minecraft/world/effect/MobEffectList.java +++ b/net/minecraft/world/effect/MobEffectList.java
@@ -20,6 +20,13 @@ @@ -19,6 +19,13 @@
import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.player.EntityHuman; import net.minecraft.world.entity.player.EntityHuman;
@ -14,7 +14,7 @@
public class MobEffectList { public class MobEffectList {
private final Map<AttributeBase, AttributeModifier> attributeModifiers = Maps.newHashMap(); private final Map<AttributeBase, AttributeModifier> attributeModifiers = Maps.newHashMap();
@@ -56,26 +63,37 @@ @@ -55,26 +62,37 @@
public void applyEffectTick(EntityLiving entityliving, int i) { public void applyEffectTick(EntityLiving entityliving, int i) {
if (this == MobEffects.REGENERATION) { if (this == MobEffects.REGENERATION) {
if (entityliving.getHealth() < entityliving.getMaxHealth()) { if (entityliving.getHealth() < entityliving.getMaxHealth()) {
@ -23,11 +23,11 @@
} }
} else if (this == MobEffects.POISON) { } else if (this == MobEffects.POISON) {
if (entityliving.getHealth() > 1.0F) { if (entityliving.getHealth() > 1.0F) {
- entityliving.hurt(DamageSource.MAGIC, 1.0F); - entityliving.hurt(entityliving.damageSources().magic(), 1.0F);
+ entityliving.hurt(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON + entityliving.hurt(entityliving.damageSources().poison, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
} }
} else if (this == MobEffects.WITHER) { } else if (this == MobEffects.WITHER) {
entityliving.hurt(DamageSource.WITHER, 1.0F); entityliving.hurt(entityliving.damageSources().wither(), 1.0F);
} else if (this == MobEffects.HUNGER && entityliving instanceof EntityHuman) { } else if (this == MobEffects.HUNGER && entityliving instanceof EntityHuman) {
- ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1)); - ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1));
+ ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent + ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
@ -49,7 +49,7 @@
} }
} else if ((this != MobEffects.HEAL || entityliving.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entityliving.isInvertedHealAndHarm())) { } else if ((this != MobEffects.HEAL || entityliving.isInvertedHealAndHarm()) && (this != MobEffects.HARM || !entityliving.isInvertedHealAndHarm())) {
if (this == MobEffects.HARM && !entityliving.isInvertedHealAndHarm() || this == MobEffects.HEAL && entityliving.isInvertedHealAndHarm()) { if (this == MobEffects.HARM && !entityliving.isInvertedHealAndHarm() || this == MobEffects.HEAL && entityliving.isInvertedHealAndHarm()) {
entityliving.hurt(DamageSource.MAGIC, (float) (6 << i)); entityliving.hurt(entityliving.damageSources().magic(), (float) (6 << i));
} }
} else { } else {
- entityliving.heal((float) Math.max(4 << i, 0)); - entityliving.heal((float) Math.max(4 << i, 0));
@ -57,7 +57,7 @@
} }
} }
@@ -96,7 +114,7 @@ @@ -95,7 +113,7 @@
} }
} else { } else {
j = (int) (d0 * (double) (4 << i) + 0.5D); j = (int) (d0 * (double) (4 << i) + 0.5D);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/effect/MobEffectUtil.java --- a/net/minecraft/world/effect/MobEffectUtil.java
+++ b/net/minecraft/world/effect/MobEffectUtil.java +++ b/net/minecraft/world/effect/MobEffectUtil.java
@@ -44,13 +44,19 @@ @@ -49,13 +49,19 @@
} }
public static List<EntityPlayer> addEffectToPlayersAround(WorldServer worldserver, @Nullable Entity entity, Vec3D vec3d, double d0, MobEffect mobeffect, int i) { public static List<EntityPlayer> addEffectToPlayersAround(WorldServer worldserver, @Nullable Entity entity, Vec3D vec3d, double d0, MobEffect mobeffect, int i) {
@ -12,7 +12,7 @@
+ // CraftBukkit end + // CraftBukkit end
MobEffectList mobeffectlist = mobeffect.getEffect(); MobEffectList mobeffectlist = mobeffect.getEffect();
List<EntityPlayer> list = worldserver.getPlayers((entityplayer) -> { List<EntityPlayer> list = worldserver.getPlayers((entityplayer) -> {
return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).getDuration() < i); return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
}); });
list.forEach((entityplayer) -> { list.forEach((entityplayer) -> {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -122,8 +122,65 @@ @@ -124,8 +124,65 @@
import net.minecraft.world.scores.ScoreboardTeamBase; import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -66,7 +66,7 @@
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id"; public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers"; public static final String PASSENGERS_TAG = "Passengers";
@@ -234,6 +291,25 @@ @@ -236,6 +293,25 @@
public boolean hasVisualFire; public boolean hasVisualFire;
@Nullable @Nullable
private IBlockData feetBlockState; private IBlockData feetBlockState;
@ -92,7 +92,7 @@
public Entity(EntityTypes<?> entitytypes, World world) { public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet(); this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -365,6 +441,12 @@ @@ -367,6 +443,12 @@
public void onClientRemoval() {} public void onClientRemoval() {}
public void setPose(EntityPose entitypose) { public void setPose(EntityPose entitypose) {
@ -105,7 +105,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose); this.entityData.set(Entity.DATA_POSE, entitypose);
} }
@@ -389,6 +471,33 @@ @@ -391,6 +473,33 @@
} }
protected void setRot(float f, float f1) { protected void setRot(float f, float f1) {
@ -139,7 +139,7 @@
this.setYRot(f % 360.0F); this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F); this.setXRot(f1 % 360.0F);
} }
@@ -430,6 +539,15 @@ @@ -432,6 +541,15 @@
this.baseTick(); this.baseTick();
} }
@ -155,7 +155,7 @@
public void baseTick() { public void baseTick() {
this.level.getProfiler().push("entityBaseTick"); this.level.getProfiler().push("entityBaseTick");
this.feetBlockState = null; this.feetBlockState = null;
@@ -444,7 +562,7 @@ @@ -446,7 +564,7 @@
this.walkDistO = this.walkDist; this.walkDistO = this.walkDist;
this.xRotO = this.getXRot(); this.xRotO = this.getXRot();
this.yRotO = this.getYRot(); this.yRotO = this.getYRot();
@ -164,7 +164,7 @@
if (this.canSpawnSprintParticle()) { if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle(); this.spawnSprintParticle();
} }
@@ -479,6 +597,10 @@ @@ -481,6 +599,10 @@
if (this.isInLava()) { if (this.isInLava()) {
this.lavaHurt(); this.lavaHurt();
this.fallDistance *= 0.5F; this.fallDistance *= 0.5F;
@ -175,7 +175,7 @@
} }
this.checkOutOfWorld(); this.checkOutOfWorld();
@@ -522,15 +644,48 @@ @@ -524,15 +646,48 @@
public void lavaHurt() { public void lavaHurt() {
if (!this.fireImmune()) { if (!this.fireImmune()) {
@ -196,7 +196,7 @@
+ this.setSecondsOnFire(15, false); + this.setSecondsOnFire(15, false);
+ } + }
+ CraftEventFactory.blockDamage = (lastLavaContact) == null ? null : org.bukkit.craftbukkit.block.CraftBlock.at(level, lastLavaContact); + CraftEventFactory.blockDamage = (lastLavaContact) == null ? null : org.bukkit.craftbukkit.block.CraftBlock.at(level, lastLavaContact);
if (this.hurt(DamageSource.LAVA, 4.0F)) { if (this.hurt(this.damageSources().lava(), 4.0F)) {
this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F); this.playSound(SoundEffects.GENERIC_BURN, 0.4F, 2.0F + this.random.nextFloat() * 0.4F);
} }
+ CraftEventFactory.blockDamage = null; + CraftEventFactory.blockDamage = null;
@ -225,7 +225,7 @@
int j = i * 20; int j = i * 20;
if (this instanceof EntityLiving) { if (this instanceof EntityLiving) {
@@ -644,6 +799,28 @@ @@ -646,6 +801,28 @@
block.updateEntityAfterFallOn(this.level, this); block.updateEntityAfterFallOn(this.level, this);
} }
@ -254,7 +254,7 @@
if (this.onGround) { if (this.onGround) {
block.stepOn(this.level, blockposition, iblockdata, this); block.stepOn(this.level, blockposition, iblockdata, this);
} }
@@ -946,6 +1123,20 @@ @@ -948,6 +1125,20 @@
return SoundEffects.GENERIC_SPLASH; return SoundEffects.GENERIC_SPLASH;
} }
@ -274,8 +274,8 @@
+ +
protected void checkInsideBlocks() { protected void checkInsideBlocks() {
AxisAlignedBB axisalignedbb = this.getBoundingBox(); AxisAlignedBB axisalignedbb = this.getBoundingBox();
BlockPosition blockposition = new BlockPosition(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D); BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
@@ -1305,6 +1496,7 @@ @@ -1311,6 +1502,7 @@
this.yo = d1; this.yo = d1;
this.zo = d4; this.zo = d4;
this.setPos(d3, d1, d4); this.setPos(d3, d1, d4);
@ -283,7 +283,7 @@
} }
public void moveTo(Vec3D vec3d) { public void moveTo(Vec3D vec3d) {
@@ -1495,6 +1687,12 @@ @@ -1505,6 +1697,12 @@
return false; return false;
} }
@ -296,7 +296,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) { public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) { if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource); CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1528,7 +1726,7 @@ @@ -1538,7 +1736,7 @@
} else { } else {
String s = this.getEncodeId(); String s = this.getEncodeId();
@ -305,7 +305,7 @@
return false; return false;
} else { } else {
nbttagcompound.putString("id", s); nbttagcompound.putString("id", s);
@@ -1553,6 +1751,18 @@ @@ -1563,6 +1761,18 @@
Vec3D vec3d = this.getDeltaMovement(); Vec3D vec3d = this.getDeltaMovement();
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z)); nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
@ -324,7 +324,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot())); nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance); nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks); nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1561,6 +1771,25 @@ @@ -1571,6 +1781,25 @@
nbttagcompound.putBoolean("Invulnerable", this.invulnerable); nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown); nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
nbttagcompound.putUUID("UUID", this.getUUID()); nbttagcompound.putUUID("UUID", this.getUUID());
@ -350,7 +350,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName(); IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) { if (ichatbasecomponent != null) {
@@ -1628,6 +1857,11 @@ @@ -1638,6 +1867,11 @@
} }
} }
@ -362,7 +362,7 @@
return nbttagcompound; return nbttagcompound;
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1711,6 +1945,45 @@ @@ -1721,6 +1955,45 @@
} else { } else {
throw new IllegalStateException("Entity has invalid position"); throw new IllegalStateException("Entity has invalid position");
} }
@ -408,7 +408,7 @@
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT"); CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded"); CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1786,9 +2059,22 @@ @@ -1796,9 +2069,22 @@
} else if (this.level.isClientSide) { } else if (this.level.isClientSide) {
return null; return null;
} else { } else {
@ -431,7 +431,7 @@
this.level.addFreshEntity(entityitem); this.level.addFreshEntity(entityitem);
return entityitem; return entityitem;
} }
@@ -1882,7 +2168,7 @@ @@ -1894,7 +2180,7 @@
this.setPose(EntityPose.STANDING); this.setPose(EntityPose.STANDING);
this.vehicle = entity; this.vehicle = entity;
@ -440,7 +440,7 @@
entity.getIndirectPassengersStream().filter((entity2) -> { entity.getIndirectPassengersStream().filter((entity2) -> {
return entity2 instanceof EntityPlayer; return entity2 instanceof EntityPlayer;
}).forEach((entity2) -> { }).forEach((entity2) -> {
@@ -1913,7 +2199,7 @@ @@ -1925,7 +2211,7 @@
Entity entity = this.vehicle; Entity entity = this.vehicle;
this.vehicle = null; this.vehicle = null;
@ -449,7 +449,7 @@
} }
} }
@@ -1926,10 +2212,31 @@ @@ -1934,10 +2220,31 @@
this.removeVehicle(); this.removeVehicle();
} }
@ -482,9 +482,9 @@
if (this.passengers.isEmpty()) { if (this.passengers.isEmpty()) {
this.passengers = ImmutableList.of(entity); this.passengers = ImmutableList.of(entity);
} else { } else {
@@ -1945,12 +2252,32 @@ @@ -1954,12 +2261,32 @@
}
this.gameEvent(GameEvent.ENTITY_MOUNT, entity);
} }
+ return true; // CraftBukkit + return true; // CraftBukkit
} }
@ -516,15 +516,15 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) { if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of(); this.passengers = ImmutableList.of();
} else { } else {
@@ -1961,6 +2288,7 @@ @@ -1971,6 +2298,7 @@
entity.boardingCooldown = 60; entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
} }
+ return true; // CraftBukkit + return true; // CraftBukkit
} }
protected boolean canAddPassenger(Entity entity) { protected boolean canAddPassenger(Entity entity) {
@@ -2023,14 +2351,20 @@ @@ -2037,14 +2365,20 @@
if (this.isInsidePortal) { if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer(); MinecraftServer minecraftserver = worldserver.getServer();
@ -548,7 +548,7 @@
this.level.getProfiler().pop(); this.level.getProfiler().pop();
} }
@@ -2148,6 +2482,13 @@ @@ -2164,6 +2498,13 @@
} }
public void setSwimming(boolean flag) { public void setSwimming(boolean flag) {
@ -562,7 +562,7 @@
this.setSharedFlag(4, flag); this.setSharedFlag(4, flag);
} }
@@ -2193,8 +2534,12 @@ @@ -2209,8 +2550,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false; return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
} }
@ -576,7 +576,7 @@
} }
public boolean getSharedFlag(int i) { public boolean getSharedFlag(int i) {
@@ -2213,7 +2558,7 @@ @@ -2229,7 +2574,7 @@
} }
public int getMaxAirSupply() { public int getMaxAirSupply() {
@ -585,7 +585,7 @@
} }
public int getAirSupply() { public int getAirSupply() {
@@ -2221,7 +2566,18 @@ @@ -2237,7 +2582,18 @@
} }
public void setAirSupply(int i) { public void setAirSupply(int i) {
@ -605,7 +605,7 @@
} }
public int getTicksFrozen() { public int getTicksFrozen() {
@@ -2248,11 +2604,41 @@ @@ -2264,11 +2620,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) { public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1); this.setRemainingFireTicks(this.remainingFireTicks + 1);
@ -624,9 +624,8 @@
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false); + this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
} + }
+
- this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F);
+ // CraftBukkit start + // CraftBukkit start
+ if (thisBukkitEntity instanceof Hanging) { + if (thisBukkitEntity instanceof Hanging) {
+ HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity); + HangingBreakByEntityEvent hangingEvent = new HangingBreakByEntityEvent((Hanging) thisBukkitEntity, stormBukkitEntity);
@ -635,13 +634,14 @@
+ if (hangingEvent.isCancelled()) { + if (hangingEvent.isCancelled()) {
+ return; + return;
+ } + }
+ } }
+
- this.hurt(this.damageSources().lightningBolt(), 5.0F);
+ if (this.fireImmune()) { + if (this.fireImmune()) {
+ return; + return;
+ } + }
+ CraftEventFactory.entityDamage = entitylightning; + CraftEventFactory.entityDamage = entitylightning;
+ if (!this.hurt(DamageSource.LIGHTNING_BOLT, 5.0F)) { + if (!this.hurt(this.damageSources().lightningBolt(), 5.0F)) {
+ CraftEventFactory.entityDamage = null; + CraftEventFactory.entityDamage = null;
+ return; + return;
+ } + }
@ -649,7 +649,7 @@
} }
public void onAboveBubbleCol(boolean flag) { public void onAboveBubbleCol(boolean flag) {
@@ -2417,15 +2803,38 @@ @@ -2433,15 +2819,38 @@
@Nullable @Nullable
public Entity changeDimension(WorldServer worldserver) { public Entity changeDimension(WorldServer worldserver) {
@ -690,7 +690,7 @@
this.level.getProfiler().popPush("reloading"); this.level.getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver); Entity entity = this.getType().create(worldserver);
@@ -2434,9 +2843,17 @@ @@ -2450,9 +2859,17 @@
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot()); entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed); entity.setDeltaMovement(shapedetectorshape.speed);
worldserver.addDuringTeleport(entity); worldserver.addDuringTeleport(entity);
@ -710,7 +710,7 @@
} }
this.removeAfterChangingDimensions(); this.removeAfterChangingDimensions();
@@ -2457,20 +2874,34 @@ @@ -2473,20 +2890,34 @@
@Nullable @Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) { protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@ -750,7 +750,7 @@
IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos); IBlockData iblockdata = this.level.getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis; EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d; Vec3D vec3d;
@@ -2487,8 +2918,8 @@ @@ -2503,8 +2934,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D); vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
} }
@ -761,7 +761,7 @@
} }
} else { } else {
BlockPosition blockposition1; BlockPosition blockposition1;
@@ -2498,8 +2929,14 @@ @@ -2514,8 +2945,14 @@
} else { } else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos()); blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
} }
@ -777,7 +777,7 @@
} }
} }
@@ -2507,8 +2944,23 @@ @@ -2523,8 +2960,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose())); return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
} }
@ -803,7 +803,7 @@
} }
public boolean canChangeDimensions() { public boolean canChangeDimensions() {
@@ -2731,7 +3183,26 @@ @@ -2773,7 +3225,26 @@
} }
public final void setBoundingBox(AxisAlignedBB axisalignedbb) { public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@ -831,7 +831,7 @@
} }
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) { protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3023,6 +3494,11 @@ @@ -3084,6 +3555,11 @@
vec3d = vec3d.add(vec3d1); vec3d = vec3d.add(vec3d1);
++k1; ++k1;
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityAgeable.java --- a/net/minecraft/world/entity/EntityAgeable.java
+++ b/net/minecraft/world/entity/EntityAgeable.java +++ b/net/minecraft/world/entity/EntityAgeable.java
@@ -19,6 +19,7 @@ @@ -20,6 +20,7 @@
protected int age; protected int age;
protected int forcedAge; protected int forcedAge;
protected int forcedAgeTimer; protected int forcedAgeTimer;
@ -8,7 +8,7 @@
protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) { protected EntityAgeable(EntityTypes<? extends EntityAgeable> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -102,6 +103,7 @@ @@ -103,6 +104,7 @@
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("Age", this.getAge()); nbttagcompound.putInt("Age", this.getAge());
nbttagcompound.putInt("ForcedAge", this.forcedAge); nbttagcompound.putInt("ForcedAge", this.forcedAge);
@ -16,7 +16,7 @@
} }
@Override @Override
@@ -109,6 +111,7 @@ @@ -110,6 +112,7 @@
super.readAdditionalSaveData(nbttagcompound); super.readAdditionalSaveData(nbttagcompound);
this.setAge(nbttagcompound.getInt("Age")); this.setAge(nbttagcompound.getInt("Age"));
this.forcedAge = nbttagcompound.getInt("ForcedAge"); this.forcedAge = nbttagcompound.getInt("ForcedAge");
@ -24,7 +24,7 @@
} }
@Override @Override
@@ -123,7 +126,7 @@ @@ -124,7 +127,7 @@
@Override @Override
public void aiStep() { public void aiStep() {
super.aiStep(); super.aiStep();

Datei anzeigen

@ -10,7 +10,7 @@
+import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.LivingEntity;
+// CraftBukkit end +// CraftBukkit end
+ +
public class EntityAreaEffectCloud extends Entity { public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -129,6 +135,22 @@ @@ -129,6 +135,22 @@
@ -36,7 +36,7 @@
public int getColor() { public int getColor() {
return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR); return (Integer) this.getEntityData().get(EntityAreaEffectCloud.DATA_COLOR);
} }
@@ -261,6 +283,7 @@ @@ -263,6 +285,7 @@
if (!list1.isEmpty()) { if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator(); Iterator iterator1 = list1.iterator();
@ -44,7 +44,7 @@
while (iterator1.hasNext()) { while (iterator1.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator1.next(); EntityLiving entityliving = (EntityLiving) iterator1.next();
@@ -270,6 +293,17 @@ @@ -272,6 +295,17 @@
double d8 = d6 * d6 + d7 * d7; double d8 = d6 * d6 + d7 * d7;
if (d8 <= (double) (f * f)) { if (d8 <= (double) (f * f)) {
@ -62,7 +62,7 @@
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay); this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
Iterator iterator2 = list.iterator(); Iterator iterator2 = list.iterator();
@@ -279,7 +313,7 @@ @@ -281,7 +315,7 @@
if (mobeffect1.getEffect().isInstantenous()) { if (mobeffect1.getEffect().isInstantenous()) {
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D); mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
} else { } else {

Datei anzeigen

@ -17,7 +17,7 @@
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; +import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
+// CraftBukkit end +// CraftBukkit end
+ +
public abstract class EntityInsentient extends EntityLiving { public abstract class EntityInsentient extends EntityLiving implements Targeting {
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE); private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
@@ -121,6 +134,8 @@ @@ -121,6 +134,8 @@
@ -42,7 +42,7 @@
protected void registerGoals() {} protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() { public static AttributeProvider.Builder createMobAttributes() {
@@ -224,7 +245,38 @@ @@ -254,7 +275,38 @@
} }
public void setTarget(@Nullable EntityLiving entityliving) { public void setTarget(@Nullable EntityLiving entityliving) {
@ -81,7 +81,7 @@
} }
@Override @Override
@@ -364,6 +416,12 @@ @@ -394,6 +446,12 @@
return null; return null;
} }
@ -94,7 +94,7 @@
@Override @Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) { public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
@@ -453,16 +511,26 @@ @@ -483,16 +541,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi()); nbttagcompound.putBoolean("NoAI", this.isNoAi());
} }
@ -123,7 +123,7 @@
NBTTagList nbttaglist; NBTTagList nbttaglist;
int i; int i;
@@ -509,6 +577,11 @@ @@ -539,6 +607,11 @@
} }
this.setNoAi(nbttagcompound.getBoolean("NoAI")); this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@ -135,7 +135,7 @@
} }
@Override @Override
@@ -576,7 +649,7 @@ @@ -606,7 +679,7 @@
protected void pickUpItem(EntityItem entityitem) { protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem(); ItemStack itemstack = entityitem.getItem();
@ -144,7 +144,7 @@
if (!itemstack1.isEmpty()) { if (!itemstack1.isEmpty()) {
this.onItemPickup(entityitem); this.onItemPickup(entityitem);
@@ -590,15 +663,29 @@ @@ -620,6 +693,12 @@
} }
public ItemStack equipItemIfPossible(ItemStack itemstack) { public ItemStack equipItemIfPossible(ItemStack itemstack) {
@ -154,9 +154,12 @@
+ +
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) { + public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
+ // CraftBukkit end + // CraftBukkit end
EnumItemSlot enumitemslot = this.getEquipmentSlotForItemStack(itemstack); EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot); ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1); boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -630,11 +709,19 @@
flag = this.canReplaceCurrentItem(itemstack, itemstack1);
}
- if (flag && this.canHoldItem(itemstack)) { - if (flag && this.canHoldItem(itemstack)) {
+ // CraftBukkit start + // CraftBukkit start
@ -175,7 +178,7 @@
} }
if (enumitemslot.isArmor() && itemstack.getCount() > 1) { if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -750,6 +837,7 @@ @@ -779,6 +866,7 @@
@Override @Override
protected final void serverAiStep() { protected final void serverAiStep() {
++this.noActionTime; ++this.noActionTime;
@ -183,7 +186,7 @@
this.level.getProfiler().push("sensing"); this.level.getProfiler().push("sensing");
this.sensing.tick(); this.sensing.tick();
this.level.getProfiler().pop(); this.level.getProfiler().pop();
@@ -1143,6 +1231,12 @@ @@ -1172,6 +1260,12 @@
if (!this.isAlive()) { if (!this.isAlive()) {
return EnumInteractionResult.PASS; return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) { } else if (this.getLeashHolder() == entityhuman) {
@ -194,9 +197,9 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.dropLeash(true, !entityhuman.getAbilities().instabuild); this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide); return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
} else { @@ -1197,6 +1291,12 @@
@@ -1166,6 +1260,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand); ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) { if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@ -209,7 +212,7 @@
this.setLeashedTo(entityhuman, true); this.setLeashedTo(entityhuman, true);
itemstack.shrink(1); itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level.isClientSide); return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
@@ -1181,7 +1281,7 @@ @@ -1212,7 +1312,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) { if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level instanceof WorldServer) { if (this.level instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem(); ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@ -218,7 +221,7 @@
optional.ifPresent((entityinsentient) -> { optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient); this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1231,12 +1331,19 @@ @@ -1262,12 +1362,19 @@
return this.restrictRadius != -1.0F; return this.restrictRadius != -1.0F;
} }
@ -239,7 +242,7 @@
if (t0 == null) { if (t0 == null) {
return null; return null;
@@ -1271,7 +1378,12 @@ @@ -1302,7 +1409,12 @@
} }
} }
@ -253,7 +256,7 @@
if (this.isPassenger()) { if (this.isPassenger()) {
Entity entity = this.getVehicle(); Entity entity = this.getVehicle();
@@ -1292,6 +1404,7 @@ @@ -1323,6 +1435,7 @@
if (this.leashHolder != null) { if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) { if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -261,7 +264,7 @@
this.dropLeash(true, true); this.dropLeash(true, true);
} }
@@ -1303,7 +1416,9 @@ @@ -1334,7 +1447,9 @@
this.leashHolder = null; this.leashHolder = null;
this.leashInfoTag = null; this.leashInfoTag = null;
if (!this.level.isClientSide && flag1) { if (!this.level.isClientSide && flag1) {
@ -271,7 +274,7 @@
} }
if (!this.level.isClientSide && flag && this.level instanceof WorldServer) { if (!this.level.isClientSide && flag && this.level instanceof WorldServer) {
@@ -1353,6 +1468,7 @@ @@ -1384,6 +1499,7 @@
boolean flag1 = super.startRiding(entity, flag); boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) { if (flag1 && this.isLeashed()) {
@ -279,7 +282,7 @@
this.dropLeash(true, true); this.dropLeash(true, true);
} }
@@ -1377,7 +1493,9 @@ @@ -1408,7 +1524,9 @@
} }
if (this.tickCount > 100) { if (this.tickCount > 100) {
@ -289,7 +292,7 @@
this.leashInfoTag = null; this.leashInfoTag = null;
} }
} }
@@ -1458,7 +1576,14 @@ @@ -1484,7 +1602,14 @@
int i = EnchantmentManager.getFireAspect(this); int i = EnchantmentManager.getFireAspect(this);
if (i > 0) { if (i > 0) {
@ -304,8 +307,8 @@
+ // CraftBukkit end + // CraftBukkit end
} }
boolean flag = entity.hurt(DamageSource.mobAttack(this), f); boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
@@ -1532,9 +1657,10 @@ @@ -1558,9 +1683,10 @@
@Override @Override
protected void removeAfterChangingDimensions() { protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions(); super.removeAfterChangingDimensions();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLiving.java --- a/net/minecraft/world/entity/EntityLiving.java
+++ b/net/minecraft/world/entity/EntityLiving.java +++ b/net/minecraft/world/entity/EntityLiving.java
@@ -119,6 +119,30 @@ @@ -117,6 +117,30 @@
import net.minecraft.world.scores.ScoreboardTeam; import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -28,10 +28,10 @@
+import org.bukkit.event.player.PlayerItemConsumeEvent; +import org.bukkit.event.player.PlayerItemConsumeEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public abstract class EntityLiving extends Entity { public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -229,6 +253,20 @@ @@ -224,6 +248,20 @@
private float swimAmountO; private float swimAmountO;
protected BehaviorController<?> brain; protected BehaviorController<?> brain;
private boolean skipDropExperience; private boolean skipDropExperience;
@ -52,7 +52,7 @@
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) { protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -241,7 +279,9 @@ @@ -236,7 +274,9 @@
this.useItem = ItemStack.EMPTY; this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty(); this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes)); this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
@ -63,7 +63,7 @@
this.blocksBuilding = true; this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition(); this.reapplyPosition();
@@ -308,7 +348,13 @@ @@ -303,7 +343,13 @@
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D); double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d1); int i = (int) (150.0D * d1);
@ -78,7 +78,7 @@
} }
} }
@@ -660,10 +706,16 @@ @@ -655,13 +701,19 @@
} }
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) { public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
@ -90,13 +90,16 @@
+ // CraftBukkit end + // CraftBukkit end
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty(); boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
if (!flag && !ItemStack.isSame(itemstack, itemstack1) && !this.firstTick) { if (!flag && !ItemStack.isSameItemSameTags(itemstack, itemstack1) && !this.firstTick) {
- if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) { Equipable equipable = Equipable.get(itemstack1);
+ if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR && !silent) { // CraftBukkit
this.playEquipSound(itemstack1);
}
@@ -741,6 +793,17 @@ if (equipable != null && !this.isSpectator() && equipable.getEquipmentSlot() == enumitemslot) {
- if (!this.level.isClientSide() && !this.isSilent()) {
+ if (!this.level.isClientSide() && !this.isSilent() && !silent) { // CraftBukkit
this.level.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
}
@@ -735,6 +787,17 @@
} }
} }
@ -114,7 +117,7 @@
if (nbttagcompound.contains("Health", 99)) { if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health")); this.setHealth(nbttagcompound.getFloat("Health"));
} }
@@ -778,9 +841,32 @@ @@ -772,9 +835,32 @@
} }
@ -147,7 +150,7 @@
try { try {
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next(); MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -790,6 +876,12 @@ @@ -784,6 +870,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null); this.onEffectUpdated(mobeffect, true, (Entity) null);
})) { })) {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -160,7 +163,7 @@
iterator.remove(); iterator.remove();
this.onEffectRemoved(mobeffect); this.onEffectRemoved(mobeffect);
} }
@@ -800,6 +892,17 @@ @@ -794,6 +886,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) { } catch (ConcurrentModificationException concurrentmodificationexception) {
; ;
} }
@ -178,7 +181,7 @@
if (this.effectsDirty) { if (this.effectsDirty) {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@@ -926,7 +1029,13 @@ @@ -920,7 +1023,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0); this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
} }
@ -192,7 +195,7 @@
if (this.level.isClientSide) { if (this.level.isClientSide) {
return false; return false;
} else { } else {
@@ -935,7 +1044,14 @@ @@ -929,7 +1038,14 @@
boolean flag; boolean flag;
for (flag = false; iterator.hasNext(); flag = true) { for (flag = false; iterator.hasNext(); flag = true) {
@ -208,7 +211,7 @@
iterator.remove(); iterator.remove();
} }
@@ -964,18 +1080,48 @@ @@ -958,18 +1074,48 @@
return this.addEffect(mobeffect, (Entity) null); return this.addEffect(mobeffect, (Entity) null);
} }
@ -258,7 +261,7 @@
return true; return true;
} else { } else {
return false; return false;
@@ -1012,13 +1158,39 @@ @@ -1006,13 +1152,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD; return this.getMobType() == EnumMonsterType.UNDEAD;
} }
@ -299,7 +302,7 @@
if (mobeffect != null) { if (mobeffect != null) {
this.onEffectRemoved(mobeffect); this.onEffectRemoved(mobeffect);
@@ -1055,20 +1227,55 @@ @@ -1049,20 +1221,55 @@
} }
@ -356,16 +359,16 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth())); this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
} }
@@ -1082,7 +1289,7 @@ @@ -1076,7 +1283,7 @@
return false; return false;
} else if (this.level.isClientSide) { } else if (this.level.isClientSide) {
return false; return false;
- } else if (this.isDeadOrDying()) { - } else if (this.isDeadOrDying()) {
+ } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die + } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
return false; return false;
} else if (damagesource.isFire() && this.hasEffect(MobEffects.FIRE_RESISTANCE)) { } else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false; return false;
@@ -1093,10 +1300,11 @@ @@ -1087,10 +1294,11 @@
this.noActionTime = 0; this.noActionTime = 0;
float f1 = f; float f1 = f;
@ -379,12 +382,12 @@
this.hurtCurrentlyUsedShield(f); this.hurtCurrentlyUsedShield(f);
f2 = f; f2 = f;
f = 0.0F; f = 0.0F;
@@ -1116,27 +1324,46 @@ @@ -1114,27 +1322,46 @@
this.animationSpeed = 1.5F; this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true; boolean flag1 = true;
- if ((float) this.invulnerableTime > 10.0F) { - if ((float) this.invulnerableTime > 10.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN)) {
+ if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F) { // CraftBukkit - restore use of maxNoDamageTicks + if ((float) this.invulnerableTime > (float) this.invulnerableDuration / 2.0F && !damagesource.is(DamageTypeTags.BYPASSES_COOLDOWN)) { // CraftBukkit - restore use of maxNoDamageTicks
if (f <= this.lastHurt) { if (f <= this.lastHurt) {
return false; return false;
} }
@ -412,9 +415,9 @@
this.hurtTime = this.hurtDuration; this.hurtTime = this.hurtDuration;
} }
- if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { - if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ // CraftBukkit - Moved into damageEntity0(DamageSource, float) + // CraftBukkit - Moved into damageEntity0(DamageSource, float)
+ if (false && damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { + if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
this.hurtHelmet(damagesource, f); this.hurtHelmet(damagesource, f);
f *= 0.75F; f *= 0.75F;
} }
@ -428,10 +431,10 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
this.hurtDir = 0.0F;
Entity entity1 = damagesource.getEntity(); Entity entity1 = damagesource.getEntity();
@@ -1259,19 +1486,32 @@ if (entity1 != null) {
@@ -1248,19 +1475,32 @@
EnumHand[] aenumhand = EnumHand.values(); EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length; int i = aenumhand.length;
@ -468,7 +471,7 @@
EntityPlayer entityplayer = (EntityPlayer) this; EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING)); entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1279,14 +1519,16 @@ @@ -1268,14 +1508,16 @@
} }
this.setHealth(1.0F); this.setHealth(1.0F);
@ -490,7 +493,7 @@
} }
} }
@@ -1391,14 +1633,22 @@ @@ -1380,14 +1622,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState(); IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) { if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
@ -515,7 +518,7 @@
this.level.addFreshEntity(entityitem); this.level.addFreshEntity(entityitem);
} }
} }
@@ -1418,21 +1668,40 @@ @@ -1407,21 +1657,40 @@
boolean flag = this.lastHurtByPlayerTime > 0; boolean flag = this.lastHurtByPlayerTime > 0;
@ -559,7 +562,7 @@
} }
@@ -1517,6 +1786,28 @@ @@ -1512,6 +1781,28 @@
return itemstack.getEatingSound(); return itemstack.getEatingSound();
} }
@ -588,7 +591,7 @@
@Override @Override
public void setOnGround(boolean flag) { public void setOnGround(boolean flag) {
super.setOnGround(flag); super.setOnGround(flag);
@@ -1572,9 +1863,14 @@ @@ -1567,9 +1858,14 @@
int i = this.calculateFallDamage(f, f1); int i = this.calculateFallDamage(f, f1);
if (i > 0) { if (i > 0) {
@ -604,26 +607,26 @@
return true; return true;
} else { } else {
return flag; return flag;
@@ -1623,7 +1919,7 @@ @@ -1621,7 +1917,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) { protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.isBypassArmor()) { if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
- this.hurtArmor(damagesource, f); - this.hurtArmor(damagesource, f);
+ // this.damageArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float) + // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into damageEntity0(DamageSource, float)
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS)); f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
} }
@@ -1636,7 +1932,8 @@ @@ -1634,7 +1930,8 @@
} else { } else {
int i; int i;
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { - if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
+ // CraftBukkit - Moved to damageEntity0(DamageSource, float) + // CraftBukkit - Moved to damageEntity0(DamageSource, float)
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { + if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5; i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i; int j = 25 - i;
float f1 = f * (float) j; float f1 = f * (float) j;
@@ -1669,29 +1966,172 @@ @@ -1667,16 +1964,125 @@
} }
} }
@ -640,7 +643,7 @@
+ Function<Double, Double> hardHat = new Function<Double, Double>() { + Function<Double, Double> hardHat = new Function<Double, Double>() {
+ @Override + @Override
+ public Double apply(Double f) { + public Double apply(Double f) {
+ if (damagesource.isDamageHelmet() && !EntityLiving.this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { + if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !EntityLiving.this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ return -(f - (f * 0.75F)); + return -(f - (f * 0.75F));
+ +
+ } + }
@ -671,7 +674,7 @@
+ Function<Double, Double> resistance = new Function<Double, Double>() { + Function<Double, Double> resistance = new Function<Double, Double>() {
+ @Override + @Override
+ public Double apply(Double f) { + public Double apply(Double f) {
+ if (!damagesource.isBypassMagic() && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { + if (!damagesource.is(DamageTypeTags.BYPASSES_EFFECTS) && EntityLiving.this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
+ int i = (EntityLiving.this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5; + int i = (EntityLiving.this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
+ int j = 25 - i; + int j = 25 - i;
+ float f1 = f.floatValue() * (float) j; + float f1 = f.floatValue() * (float) j;
@ -723,12 +726,12 @@
+ } + }
+ +
+ // Apply damage to helmet + // Apply damage to helmet
+ if (damagesource.isDamageHelmet() && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) { + if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
+ this.hurtHelmet(damagesource, f); + this.hurtHelmet(damagesource, f);
+ } + }
+ +
+ // Apply damage to armor + // Apply damage to armor
+ if (!damagesource.isBypassArmor()) { + if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT)); + float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
+ this.hurtArmor(damagesource, armorDamage); + this.hurtArmor(damagesource, armorDamage);
+ } + }
@ -754,8 +757,11 @@
+ if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) { + if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) {
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F)); + ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
+ } + }
if (f2 > 0.0F && f2 < 3.4028235E37F && damagesource.getEntity() instanceof EntityPlayer) { if (f2 > 0.0F && f2 < 3.4028235E37F) {
((EntityPlayer) damagesource.getEntity()).awardStat(StatisticList.DAMAGE_DEALT_ABSORBED, Math.round(f2 * 10.0F)); Entity entity = damagesource.getEntity();
@@ -1687,15 +2093,49 @@
}
} }
- if (f != 0.0F) { - if (f != 0.0F) {
@ -770,8 +776,8 @@
+ // CraftBukkit end + // CraftBukkit end
float f3 = this.getHealth(); float f3 = this.getHealth();
this.setHealth(f3 - f);
this.getCombatTracker().recordDamage(damagesource, f3, f); this.getCombatTracker().recordDamage(damagesource, f3, f);
this.setHealth(f3 - f);
- this.setAbsorptionAmount(this.getAbsorptionAmount() - f); - this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
+ // CraftBukkit start + // CraftBukkit start
+ if (!human) { + if (!human) {
@ -806,7 +812,7 @@
} }
public CombatTracker getCombatTracker() { public CombatTracker getCombatTracker() {
@@ -1712,9 +2152,19 @@ @@ -1716,9 +2156,19 @@
} }
public final void setArrowCount(int i) { public final void setArrowCount(int i) {
@ -827,7 +833,7 @@
public final int getStingerCount() { public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID); return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
} }
@@ -2017,6 +2467,12 @@ @@ -1959,6 +2409,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot); public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@ -840,7 +846,7 @@
@Override @Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack); public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2256,6 +2712,7 @@ @@ -2198,6 +2654,7 @@
} }
if (this.onGround && !this.level.isClientSide) { if (this.onGround && !this.level.isClientSide) {
@ -848,7 +854,7 @@
this.setSharedFlag(7, false); this.setSharedFlag(7, false);
} }
} else { } else {
@@ -2793,6 +3250,7 @@ @@ -2757,6 +3214,7 @@
} }
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -856,7 +862,7 @@
this.setSharedFlag(7, flag); this.setSharedFlag(7, flag);
} }
@@ -2956,14 +3414,21 @@ @@ -2916,14 +3374,21 @@
@Override @Override
public boolean isPickable() { public boolean isPickable() {
@ -880,7 +886,7 @@
@Override @Override
public float getYHeadRot() { public float getYHeadRot() {
return this.yHeadRot; return this.yHeadRot;
@@ -3158,7 +3623,26 @@ @@ -3118,7 +3583,26 @@
} else { } else {
if (!this.useItem.isEmpty() && this.isUsingItem()) { if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16); this.triggerItemUseEffects(this.useItem, 16);
@ -908,7 +914,7 @@
if (itemstack != this.useItem) { if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack); this.setItemInHand(enumhand, itemstack);
@@ -3236,6 +3720,12 @@ @@ -3196,6 +3680,12 @@
} }
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) { public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@ -921,7 +927,7 @@
double d3 = this.getX(); double d3 = this.getX();
double d4 = this.getY(); double d4 = this.getY();
double d5 = this.getZ(); double d5 = this.getZ();
@@ -3260,16 +3750,41 @@ @@ -3220,16 +3710,41 @@
} }
if (flag2) { if (flag2) {
@ -949,7 +955,7 @@
+ } + }
+ } else { + } else {
+ // player teleport event is called in the underlining code + // player teleport event is called in the underlining code
+ if (((EntityPlayer) this).connection.teleport(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), false, cause)) { + if (((EntityPlayer) this).connection.teleport(d0, d6, d2, this.getYRot(), this.getXRot(), java.util.Collections.emptySet(), cause)) {
+ return Optional.empty(); + return Optional.empty();
+ } + }
+ } + }
@ -966,7 +972,7 @@
} else { } else {
if (flag) { if (flag) {
world.broadcastEntityEvent(this, (byte) 46); world.broadcastEntityEvent(this, (byte) 46);
@@ -3279,7 +3794,7 @@ @@ -3239,7 +3754,7 @@
((EntityCreature) this).getNavigation().stop(); ((EntityCreature) this).getNavigation().stop();
} }
@ -975,7 +981,7 @@
} }
} }
@@ -3357,7 +3872,7 @@ @@ -3322,7 +3837,7 @@
} }
public void stopSleeping() { public void stopSleeping() {
@ -984,7 +990,7 @@
World world = this.level; World world = this.level;
java.util.Objects.requireNonNull(this.level); java.util.Objects.requireNonNull(this.level);
@@ -3391,7 +3906,7 @@ @@ -3356,7 +3871,7 @@
@Nullable @Nullable
public EnumDirection getBedOrientation() { public EnumDirection getBedOrientation() {
@ -993,7 +999,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null; return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
} }
@@ -3439,7 +3954,7 @@ @@ -3404,7 +3919,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next(); Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) { if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityTypes.java --- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java +++ b/net/minecraft/world/entity/EntityTypes.java
@@ -156,6 +156,7 @@ @@ -157,6 +157,7 @@
import net.minecraft.world.phys.AxisAlignedBB; import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes; import net.minecraft.world.phys.shapes.VoxelShapes;
@ -8,16 +8,16 @@
import org.slf4j.Logger; import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> { public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -165,7 +166,7 @@ @@ -167,7 +168,7 @@
private final Holder.c<EntityTypes<?>> builtInRegistryHolder;
private static final float MAGIC_HORSE_WIDTH = 1.3964844F; private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2)); public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE)); - public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds + public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
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<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<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)); public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -301,8 +302,8 @@ @@ -308,8 +309,8 @@
private final EntitySize dimensions; private final EntitySize dimensions;
private final FeatureFlagSet requiredFeatures; private final FeatureFlagSet requiredFeatures;
@ -28,7 +28,7 @@
} }
public static MinecraftKey getKey(EntityTypes<?> entitytypes) { public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -330,8 +331,15 @@ @@ -337,8 +338,15 @@
@Nullable @Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @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) {
@ -45,7 +45,7 @@
if (itemstack != null) { if (itemstack != null) {
nbttagcompound = itemstack.getTag(); nbttagcompound = itemstack.getTag();
@@ -342,7 +350,7 @@ @@ -349,7 +357,7 @@
nbttagcompound = null; nbttagcompound = null;
} }
@ -54,7 +54,7 @@
} }
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) { public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -363,21 +371,37 @@ @@ -371,21 +379,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag(); NBTTagCompound nbttagcompound = itemstack.getTag();
return nbttagcompound != null ? consumer.andThen((entity) -> { return nbttagcompound != null ? consumer.andThen((entity) -> {
@ -95,7 +95,7 @@
} }
return t0; return t0;
@@ -564,7 +588,7 @@ @@ -572,7 +596,7 @@
} }
return entity; return entity;
@ -104,7 +104,7 @@
} }
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) { public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -621,7 +645,7 @@ @@ -629,7 +653,7 @@
@Nullable @Nullable
public T tryCast(Entity entity) { public T tryCast(Entity entity) {
@ -113,7 +113,7 @@
} }
@Override @Override
@@ -656,7 +680,7 @@ @@ -664,7 +688,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC; this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
} }

Datei anzeigen

@ -1,15 +1,14 @@
--- a/net/minecraft/world/entity/SaddleStorage.java --- a/net/minecraft/world/entity/SaddleStorage.java
+++ b/net/minecraft/world/entity/SaddleStorage.java +++ b/net/minecraft/world/entity/SaddleStorage.java
@@ -40,6 +40,15 @@ @@ -53,6 +53,14 @@
} return (Integer) this.entityData.get(this.boostTimeAccessor);
} }
+ // CraftBukkit add setBoostTicks(int) + // CraftBukkit add setBoostTicks(int)
+ public void setBoostTicks(int ticks) { + public void setBoostTicks(int ticks) {
+ this.boosting = true; + this.boosting = true;
+ this.boostTime = 0; + this.boostTime = 0;
+ this.boostTimeTotal = ticks; + this.entityData.set(this.boostTimeAccessor, ticks);
+ this.entityData.set(this.boostTimeAccessor, this.boostTimeTotal);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +

Datei anzeigen

@ -1,20 +0,0 @@
--- a/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorWorkComposter.java
@@ -42,7 +42,7 @@
BlockPosition blockposition = globalpos.pos();
if ((Integer) iblockdata.getValue(BlockComposter.LEVEL) == 8) {
- iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition);
+ iblockdata = BlockComposter.extractProduce(iblockdata, worldserver, blockposition, entityvillager); // CraftBukkit
}
int i = 20;
@@ -67,7 +67,7 @@
i -= k1;
for (int l1 = 0; l1 < k1; ++l1) {
- iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition);
+ iblockdata1 = BlockComposter.insertItem(iblockdata1, worldserver, itemstack, blockposition, entityvillager); // CraftBukkit
if ((Integer) iblockdata1.getValue(BlockComposter.LEVEL) == 7) {
this.spawnComposterFillEffects(worldserver, iblockdata, blockposition, iblockdata1);
return;

Datei anzeigen

@ -13,7 +13,7 @@
public class PathfinderGoalFollowOwner extends PathfinderGoal { public class PathfinderGoalFollowOwner extends PathfinderGoal {
public static final int TELEPORT_WHEN_DISTANCE_IS = 12; public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
@@ -120,7 +126,18 @@ @@ -122,7 +128,18 @@
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) { } else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
return false; return false;
} else { } else {

Datei anzeigen

@ -12,7 +12,7 @@
public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget {
private final Block blockToRemove; private final Block blockToRemove;
@@ -100,6 +105,14 @@ @@ -96,6 +101,14 @@
} }
if (this.ticksSinceReachedGoal > 60) { if (this.ticksSinceReachedGoal > 60) {

Datei anzeigen

@ -52,7 +52,7 @@
} }
} }
@@ -203,7 +217,11 @@ @@ -198,7 +212,11 @@
return false; return false;
} else { } else {
if (!this.level.isClientSide && this.isResting()) { if (!this.level.isClientSide && this.isResting()) {

Datei anzeigen

@ -9,7 +9,7 @@
} }
} }
@@ -646,11 +646,15 @@ @@ -641,11 +641,15 @@
if (this.isInvulnerableTo(damagesource)) { if (this.isInvulnerableTo(damagesource)) {
return false; return false;
} else { } else {
@ -27,7 +27,7 @@
} }
} }
@@ -1226,7 +1230,7 @@ @@ -1221,7 +1225,7 @@
} }
} }
@ -36,7 +36,7 @@
EntityBee.this.level.levelEvent(2005, blockposition, 0); EntityBee.this.level.levelEvent(2005, blockposition, 0);
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1)); EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
EntityBee.this.incrementNumCropsGrownSincePollination(); EntityBee.this.incrementNumCropsGrownSincePollination();
@@ -1299,7 +1303,7 @@ @@ -1294,7 +1298,7 @@
@Override @Override
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) { protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) { if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
@ -45,7 +45,7 @@
} }
} }
@@ -1308,7 +1312,7 @@ @@ -1303,7 +1307,7 @@
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> { private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
c(EntityBee entitybee) { c(EntityBee entitybee) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityCat.java --- a/net/minecraft/world/entity/animal/EntityCat.java
+++ b/net/minecraft/world/entity/animal/EntityCat.java +++ b/net/minecraft/world/entity/animal/EntityCat.java
@@ -415,7 +415,7 @@ @@ -412,7 +412,7 @@
} }
} else if (this.isFood(itemstack)) { } else if (this.isFood(itemstack)) {
this.usePlayerItem(entityhuman, enumhand, itemstack); this.usePlayerItem(entityhuman, enumhand, itemstack);
@ -9,7 +9,7 @@
this.tame(entityhuman); this.tame(entityhuman);
this.setOrderedToSit(true); this.setOrderedToSit(true);
this.level.broadcastEntityEvent(this, (byte) 7); this.level.broadcastEntityEvent(this, (byte) 7);
@@ -472,7 +472,7 @@ @@ -469,7 +469,7 @@
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt { private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
@Nullable @Nullable
@ -18,7 +18,7 @@
private final EntityCat cat; private final EntityCat cat;
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) { public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
@@ -613,7 +613,15 @@ @@ -610,7 +610,15 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next(); ItemStack itemstack = (ItemStack) iterator.next();
@ -35,7 +35,7 @@
} }
} }
@@ -645,10 +653,10 @@ @@ -642,10 +650,10 @@
private final EntityCat cat; private final EntityCat cat;
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) { public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityFox.java --- a/net/minecraft/world/entity/animal/EntityFox.java
+++ b/net/minecraft/world/entity/animal/EntityFox.java +++ b/net/minecraft/world/entity/animal/EntityFox.java
@@ -516,7 +516,8 @@ @@ -517,7 +517,8 @@
protected void pickUpItem(EntityItem entityitem) { protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem(); ItemStack itemstack = entityitem.getItem();
@ -10,7 +10,7 @@
int i = itemstack.getCount(); int i = itemstack.getCount();
if (i > 1) { if (i > 1) {
@@ -871,6 +872,16 @@ @@ -872,6 +873,16 @@
if (entityplayer1 != null && entityplayer != entityplayer1) { if (entityplayer1 != null && entityplayer != entityplayer1) {
entityfox.addTrustedUUID(entityplayer1.getUUID()); entityfox.addTrustedUUID(entityplayer1.getUUID());
} }
@ -27,7 +27,7 @@
if (entityplayer2 != null) { if (entityplayer2 != null) {
entityplayer2.awardStat(StatisticList.ANIMALS_BRED); entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
@@ -881,12 +892,14 @@ @@ -882,12 +893,14 @@
this.partner.setAge(6000); this.partner.setAge(6000);
this.animal.resetLove(); this.animal.resetLove();
this.partner.resetLove(); this.partner.resetLove();
@ -46,15 +46,7 @@
} }
} }
@@ -1277,13 +1290,18 @@ @@ -1285,6 +1298,11 @@
}
private void pickGlowBerry(IBlockData iblockdata) {
- CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos);
+ CaveVines.use(iblockdata, EntityFox.this.level, this.blockPos, EntityFox.this); // CraftBukkit
}
private void pickSweetBerries(IBlockData iblockdata) {
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE); int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
iblockdata.setValue(BlockSweetBerryBush.AGE, 1); iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
@ -66,7 +58,7 @@
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0); int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND); ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
@@ -1440,7 +1458,7 @@ @@ -1441,7 +1459,7 @@
private EntityLiving trustedLastHurt; private EntityLiving trustedLastHurt;
private int timestamp; private int timestamp;

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityOcelot.java --- a/net/minecraft/world/entity/animal/EntityOcelot.java
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java +++ b/net/minecraft/world/entity/animal/EntityOcelot.java
@@ -182,7 +182,8 @@ @@ -177,7 +177,8 @@
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) { if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
this.usePlayerItem(entityhuman, enumhand, itemstack); this.usePlayerItem(entityhuman, enumhand, itemstack);
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -10,7 +10,7 @@
this.setTrusting(true); this.setTrusting(true);
this.spawnTrustingParticles(true); this.spawnTrustingParticles(true);
this.level.broadcastEntityEvent(this, (byte) 41); this.level.broadcastEntityEvent(this, (byte) 41);
@@ -313,10 +314,10 @@ @@ -308,10 +309,10 @@
private final EntityOcelot ocelot; private final EntityOcelot ocelot;
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) { public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {

Datei anzeigen

@ -16,9 +16,9 @@
- this.addEffect(new MobEffect(MobEffects.POISON, 900)); - this.addEffect(new MobEffect(MobEffects.POISON, 900));
+ this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit + this.addEffect(new MobEffect(MobEffects.POISON, 900), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
if (entityhuman.isCreative() || !this.isInvulnerable()) { if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(DamageSource.playerAttack(entityhuman), Float.MAX_VALUE); this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
} }
@@ -387,7 +387,7 @@ @@ -382,7 +382,7 @@
@Override @Override
public boolean isPushable() { public boolean isPushable() {
@ -27,7 +27,7 @@
} }
@Override @Override
@@ -403,7 +403,7 @@ @@ -398,7 +398,7 @@
return false; return false;
} else { } else {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {

Datei anzeigen

@ -3,7 +3,7 @@
@@ -144,7 +144,7 @@ @@ -144,7 +144,7 @@
int i = this.getPuffState(); int i = this.getPuffState();
if (entityinsentient.hurt(DamageSource.mobAttack(this), (float) (1 + i))) { if (entityinsentient.hurt(this.damageSources().mobAttack(this), (float) (1 + i))) {
- entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this); - entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this);
+ entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit + entityinsentient.addEffect(new MobEffect(MobEffects.POISON, 60 * i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F); this.playSound(SoundEffects.PUFFER_FISH_STING, 1.0F, 1.0F);

Datei anzeigen

@ -56,7 +56,7 @@
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1); InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
- Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { - Optional optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> {
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error + Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
return recipecrafting.assemble(inventorycrafting); return recipecrafting.assemble(inventorycrafting, this.level.registryAccess());
}).map(ItemStack::getItem); }).map(ItemStack::getItem);
@@ -399,10 +420,18 @@ @@ -399,10 +420,18 @@

Datei anzeigen

@ -11,29 +11,29 @@
public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity { public class EntitySnowman extends EntityGolem implements IShearable, IRangedEntity {
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE); private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
@@ -103,7 +107,7 @@ @@ -97,7 +101,7 @@
BiomeBase biomebase = (BiomeBase) this.level.getBiome(blockposition).value(); super.aiStep();
if (!this.level.isClientSide) {
if (biomebase.shouldSnowGolemBurn(blockposition)) { if (this.level.getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
- this.hurt(DamageSource.ON_FIRE, 1.0F); - this.hurt(this.damageSources().onFire(), 1.0F);
+ this.hurt(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING + this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
} }
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) { if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
@@ -119,7 +123,11 @@ @@ -113,7 +117,11 @@
BlockPosition blockposition1 = new BlockPosition(i, j, k); BlockPosition blockposition = new BlockPosition(j, k, l);
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) { if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
- this.level.setBlockAndUpdate(blockposition1, iblockdata); - this.level.setBlockAndUpdate(blockposition, iblockdata);
+ // CraftBukkit start + // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition1, iblockdata, this)) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this)) {
+ continue; + continue;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this, iblockdata)); this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
} }
} }
@@ -151,6 +159,11 @@ @@ -145,6 +153,11 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand); ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.SHEARS) && this.readyForShearing()) { if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
@ -45,7 +45,7 @@
this.shear(SoundCategory.PLAYERS); this.shear(SoundCategory.PLAYERS);
this.gameEvent(GameEvent.SHEAR, entityhuman); this.gameEvent(GameEvent.SHEAR, entityhuman);
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@@ -170,7 +183,9 @@ @@ -164,7 +177,9 @@
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F); this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
if (!this.level.isClientSide()) { if (!this.level.isClientSide()) {
this.setPumpkin(false); this.setPumpkin(false);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java --- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java +++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -307,7 +307,9 @@ @@ -308,7 +308,9 @@
protected void ageBoundaryReached() { protected void ageBoundaryReached() {
super.ageBoundaryReached(); super.ageBoundaryReached();
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) { if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@ -10,24 +10,28 @@
} }
} }
@@ -334,7 +336,9 @@ @@ -335,7 +337,9 @@
@Override @Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) { public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE); this.hurt(this.damageSources().lightningBolt(), Float.MAX_VALUE);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
} }
private static class e extends ControllerMove { private static class e extends ControllerMove {
@@ -482,8 +486,12 @@ @@ -487,12 +491,16 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) { } else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level; World world = this.turtle.level;
+ // CraftBukkit start + // CraftBukkit start
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) { + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
world.setBlock(this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3); BlockPosition blockposition1 = this.blockPos.above();
IBlockData iblockdata = (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1);
world.setBlock(blockposition1, iblockdata, 3);
world.gameEvent(GameEvent.BLOCK_PLACE, blockposition1, GameEvent.a.of(this.turtle, iblockdata));
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.turtle.setHasEgg(false); this.turtle.setHasEgg(false);

Datei anzeigen

@ -39,7 +39,7 @@
} }
public static AttributeProvider.Builder createAttributes() { public static AttributeProvider.Builder createAttributes() {
@@ -236,7 +243,7 @@ @@ -231,7 +238,7 @@
public void aiStep() { public void aiStep() {
super.aiStep(); super.aiStep();
if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) { if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
@ -48,7 +48,7 @@
} }
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) { if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
@@ -306,7 +313,12 @@ @@ -301,7 +308,12 @@
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND); ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) { if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
@ -62,7 +62,7 @@
this.level.broadcastEntityEvent(this, (byte) 18); this.level.broadcastEntityEvent(this, (byte) 18);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F); this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
this.removeInteractionItem(entityhuman, itemstack); this.removeInteractionItem(entityhuman, itemstack);
@@ -318,7 +330,7 @@ @@ -313,7 +325,7 @@
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2); this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
this.removeInteractionItem(entityhuman, itemstack); this.removeInteractionItem(entityhuman, itemstack);
this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F); this.level.playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
@ -71,7 +71,7 @@
return EnumInteractionResult.SUCCESS; return EnumInteractionResult.SUCCESS;
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) { } else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY); this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
@@ -439,6 +451,7 @@ @@ -434,6 +446,7 @@
} }
private boolean shouldStopDancing() { private boolean shouldStopDancing() {
@ -79,7 +79,7 @@
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX); return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
} }
@@ -483,7 +496,7 @@ @@ -478,7 +491,7 @@
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) { public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
this.writeInventoryToTag(nbttagcompound); this.writeInventoryToTag(nbttagcompound);
@ -88,7 +88,7 @@
Logger logger = Allay.LOGGER; Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -499,7 +512,7 @@ @@ -494,7 +507,7 @@
super.readAdditionalSaveData(nbttagcompound); super.readAdditionalSaveData(nbttagcompound);
this.readInventoryFromTag(nbttagcompound); this.readInventoryFromTag(nbttagcompound);
if (nbttagcompound.contains("listener", 10)) { if (nbttagcompound.contains("listener", 10)) {
@ -97,7 +97,7 @@
Logger logger = Allay.LOGGER; Logger logger = Allay.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -532,7 +545,7 @@ @@ -527,7 +540,7 @@
return Allay.DUPLICATION_ITEM.test(itemstack); return Allay.DUPLICATION_ITEM.test(itemstack);
} }
@ -106,7 +106,7 @@
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level); Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
if (allay != null) { if (allay != null) {
@@ -540,17 +553,17 @@ @@ -535,17 +548,17 @@
allay.setPersistenceRequired(); allay.setPersistenceRequired();
allay.resetDuplicationCooldown(); allay.resetDuplicationCooldown();
this.resetDuplicationCooldown(); this.resetDuplicationCooldown();

Datei anzeigen

@ -27,16 +27,16 @@
} }
@Override @Override
@@ -418,7 +425,7 @@ @@ -419,7 +426,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
if (i < 2400) { - entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this);
i = Math.min(2400, 100 + i); + entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, j, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
- entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this);
+ entityhuman.addEffect(new MobEffect(MobEffects.REGENERATION, i, 0), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AXOLOTL); // CraftBukkit
} }
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN); entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -468,7 +475,7 @@ @@ -469,7 +476,7 @@
@Override @Override
public BehaviorController<Axolotl> getBrain() { public BehaviorController<Axolotl> getBrain() {

Datei anzeigen

@ -1,23 +1,23 @@
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java --- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
@@ -74,6 +74,8 @@ @@ -78,6 +78,8 @@
import net.minecraft.world.phys.AxisAlignedBB; import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
+import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit +import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; // CraftBukkit
+ +
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, IJumpable, ISaddleable { public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
public static final int EQUIPMENT_SLOT_OFFSET = 400; public static final int EQUIPMENT_SLOT_OFFSET = 400;
@@ -113,6 +115,7 @@ @@ -139,6 +141,7 @@
private float mouthAnimO;
protected boolean canGallop = true;
protected int gallopSoundCounter; protected int gallopSoundCounter;
@Nullable
private UUID owner;
+ public int maxDomestication = 100; // CraftBukkit - store max domestication value + public int maxDomestication = 100; // CraftBukkit - store max domestication value
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) { protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -312,7 +315,7 @@ @@ -338,7 +341,7 @@
public void createInventory() { public void createInventory() {
InventorySubcontainer inventorysubcontainer = this.inventory; InventorySubcontainer inventorysubcontainer = this.inventory;
@ -26,7 +26,7 @@
if (inventorysubcontainer != null) { if (inventorysubcontainer != null) {
inventorysubcontainer.removeListener(this); inventorysubcontainer.removeListener(this);
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize()); int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
@@ -416,7 +419,7 @@ @@ -442,7 +445,7 @@
} }
public int getMaxTemper() { public int getMaxTemper() {
@ -35,7 +35,7 @@
} }
@Override @Override
@@ -487,7 +490,7 @@ @@ -513,7 +516,7 @@
} }
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
@ -44,7 +44,7 @@
flag = true; flag = true;
} }
@@ -564,7 +567,7 @@ @@ -590,7 +593,7 @@
super.aiStep(); super.aiStep();
if (!this.level.isClientSide && this.isAlive()) { if (!this.level.isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) { if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@ -53,7 +53,7 @@
} }
if (this.canEatGrass()) { if (this.canEatGrass()) {
@@ -838,6 +841,7 @@ @@ -857,6 +860,7 @@
if (this.getOwnerUUID() != null) { if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID()); nbttagcompound.putUUID("Owner", this.getOwnerUUID());
} }
@ -61,7 +61,7 @@
if (!this.inventory.getItem(0).isEmpty()) { if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound())); nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -865,6 +869,11 @@ @@ -884,6 +888,11 @@
if (uuid != null) { if (uuid != null) {
this.setOwnerUUID(uuid); this.setOwnerUUID(uuid);
} }
@ -73,7 +73,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) { if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem")); ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -942,6 +951,18 @@ @@ -986,6 +995,18 @@
@Override @Override
public void handleStartJump(int i) { public void handleStartJump(int i) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java --- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java +++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderCrystal.java
@@ -19,6 +19,11 @@ @@ -20,6 +20,11 @@
import net.minecraft.world.level.block.BlockFireAbstract; import net.minecraft.world.level.block.BlockFireAbstract;
import net.minecraft.world.level.dimension.end.EnderDragonBattle; import net.minecraft.world.level.dimension.end.EnderDragonBattle;
@ -12,7 +12,7 @@
public class EntityEnderCrystal extends Entity { public class EntityEnderCrystal extends Entity {
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS); private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
@@ -54,7 +59,11 @@ @@ -55,7 +60,11 @@
BlockPosition blockposition = this.blockPosition(); BlockPosition blockposition = this.blockPosition();
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) { if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
@ -25,7 +25,7 @@
} }
} }
@@ -94,11 +103,24 @@ @@ -95,11 +104,24 @@
return false; return false;
} else { } else {
if (!this.isRemoved() && !this.level.isClientSide) { if (!this.isRemoved() && !this.level.isClientSide) {
@ -35,8 +35,8 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.remove(Entity.RemovalReason.KILLED); this.remove(Entity.RemovalReason.KILLED);
if (!damagesource.isExplosion()) { if (!damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
DamageSource damagesource1 = damagesource.getEntity() != null ? DamageSource.explosion(this, damagesource.getEntity()) : null; DamageSource damagesource1 = damagesource.getEntity() != null ? this.damageSources().explosion(this, damagesource.getEntity()) : null;
- this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK); - this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
+ // CraftBukkit start + // CraftBukkit start

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java --- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
@@ -50,6 +50,18 @@ @@ -51,6 +51,18 @@
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -19,15 +19,23 @@
public class EntityEnderDragon extends EntityInsentient implements IMonster { public class EntityEnderDragon extends EntityInsentient implements IMonster {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -86,6 +98,7 @@ @@ -87,6 +99,7 @@
private final PathPoint[] nodes = new PathPoint[24]; private final PathPoint[] nodes = new PathPoint[24];
private final int[] nodeAdjacency = new int[24]; private final int[] nodeAdjacency = new int[24];
private final Path openSet = new Path(); private final Path openSet = new Path();
+ private Explosion explosionSource = new Explosion(null, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() + private final Explosion explosionSource; // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) { public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
super(EntityTypes.ENDER_DRAGON, world); super(EntityTypes.ENDER_DRAGON, world);
@@ -233,7 +246,7 @@ @@ -101,6 +114,7 @@
}
this.phaseManager = new DragonControllerManager(this);
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit
}
public static AttributeProvider.Builder createAttributes() {
@@ -234,7 +248,7 @@
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation(); Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
@ -36,7 +44,7 @@
d0 = vec3d1.x - this.getX(); d0 = vec3d1.x - this.getX();
d1 = vec3d1.y - this.getY(); d1 = vec3d1.y - this.getY();
d2 = vec3d1.z - this.getZ(); d2 = vec3d1.z - this.getZ();
@@ -374,7 +387,14 @@ @@ -375,7 +389,14 @@
if (this.nearestCrystal.isRemoved()) { if (this.nearestCrystal.isRemoved()) {
this.nearestCrystal = null; this.nearestCrystal = null;
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) { } else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
@ -52,7 +60,7 @@
} }
} }
@@ -449,6 +469,9 @@ @@ -450,6 +471,9 @@
int j1 = MathHelper.floor(axisalignedbb.maxZ); int j1 = MathHelper.floor(axisalignedbb.maxZ);
boolean flag = false; boolean flag = false;
boolean flag1 = false; boolean flag1 = false;
@ -62,7 +70,7 @@
for (int k1 = i; k1 <= l; ++k1) { for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) { for (int l1 = j; l1 <= i1; ++l1) {
@@ -458,7 +481,11 @@ @@ -459,7 +483,11 @@
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) { if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) { if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
@ -75,7 +83,7 @@
} else { } else {
flag = true; flag = true;
} }
@@ -467,6 +494,51 @@ @@ -468,6 +496,51 @@
} }
} }
@ -127,7 +135,7 @@
if (flag1) { if (flag1) {
BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1)); BlockPosition blockposition1 = new BlockPosition(i + this.random.nextInt(l - i + 1), j + this.random.nextInt(i1 - j + 1), k + this.random.nextInt(j1 - k + 1));
@@ -531,6 +603,21 @@ @@ -532,6 +605,21 @@
} }
@ -149,7 +157,7 @@
@Override @Override
protected void tickDeath() { protected void tickDeath() {
if (this.dragonFight != null) { if (this.dragonFight != null) {
@@ -546,15 +633,20 @@ @@ -547,15 +635,20 @@
this.level.addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D); this.level.addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
} }
@ -171,16 +179,16 @@
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.08F)); EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.08F));
} }
@@ -567,7 +659,7 @@ @@ -566,7 +659,7 @@
this.setYRot(this.getYRot() + 20.0F);
this.yBodyRot = this.getYRot(); this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
if (this.dragonDeathTime == 200 && this.level instanceof WorldServer) { if (this.dragonDeathTime == 200 && this.level instanceof WorldServer) {
- if (flag) { - if (flag) {
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp + if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.2F)); EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.2F));
} }
@@ -788,6 +880,7 @@ @@ -787,6 +880,7 @@
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId()); nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime); nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
@ -188,7 +196,7 @@
} }
@Override @Override
@@ -801,6 +894,11 @@ @@ -800,6 +894,11 @@
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime"); this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java --- a/net/minecraft/world/entity/boss/wither/EntityWither.java
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java +++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
@@ -54,6 +54,17 @@ @@ -55,6 +55,17 @@
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -18,7 +18,7 @@
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity { public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT); private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
@@ -247,15 +258,40 @@ @@ -248,15 +259,40 @@
i = this.getInvulnerableTicks() - 1; i = this.getInvulnerableTicks() - 1;
this.bossEvent.setProgress(1.0F - (float) i / 220.0F); this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
if (i <= 0) { if (i <= 0) {
@ -62,7 +62,7 @@
} }
} else { } else {
@@ -300,6 +336,7 @@ @@ -301,6 +337,7 @@
if (!list.isEmpty()) { if (!list.isEmpty()) {
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size())); EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
@ -70,7 +70,7 @@
this.setAlternativeTarget(i, entityliving1.getId()); this.setAlternativeTarget(i, entityliving1.getId());
} }
} }
@@ -330,6 +367,11 @@ @@ -331,6 +368,11 @@
IBlockData iblockdata = this.level.getBlockState(blockposition); IBlockData iblockdata = this.level.getBlockState(blockposition);
if (canDestroy(iblockdata)) { if (canDestroy(iblockdata)) {
@ -82,7 +82,7 @@
flag = this.level.destroyBlock(blockposition, true, this) || flag; flag = this.level.destroyBlock(blockposition, true, this) || flag;
} }
} }
@@ -343,7 +385,7 @@ @@ -344,7 +386,7 @@
} }
if (this.tickCount % 20 == 0) { if (this.tickCount % 20 == 0) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java --- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java +++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -43,6 +43,15 @@ @@ -44,6 +44,15 @@
import net.minecraft.world.phys.AxisAlignedBB; import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -16,7 +16,7 @@
public class EntityArmorStand extends EntityLiving { public class EntityArmorStand extends EntityLiving {
public static final int WOBBLE_TIME = 5; public static final int WOBBLE_TIME = 5;
@@ -105,6 +114,13 @@ @@ -106,6 +115,13 @@
this.setPos(d0, d1, d2); this.setPos(d0, d1, d2);
} }
@ -30,7 +30,7 @@
@Override @Override
public void refreshDimensions() { public void refreshDimensions() {
double d0 = this.getX(); double d0 = this.getX();
@@ -160,13 +176,20 @@ @@ -161,13 +177,20 @@
@Override @Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) { public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@ -53,7 +53,7 @@
} }
} }
@@ -402,6 +425,22 @@ @@ -403,6 +426,22 @@
return false; return false;
} else { } else {
ItemStack itemstack2; ItemStack itemstack2;
@ -76,10 +76,10 @@
if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) { if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
itemstack2 = itemstack.copy(); itemstack2 = itemstack.copy();
@@ -430,9 +469,19 @@ @@ -431,9 +470,19 @@
public boolean hurt(DamageSource damagesource, float f) { public boolean hurt(DamageSource damagesource, float f) {
if (!this.level.isClientSide && !this.isRemoved()) { if (!this.level.isClientSide && !this.isRemoved()) {
if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
+ // CraftBukkit start + // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
+ return false; + return false;
@ -94,24 +94,24 @@
+ return false; + return false;
+ } + }
+ // CraftBukkit end + // CraftBukkit end
if (damagesource.isExplosion()) { if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource); this.brokenByAnything(damagesource);
this.kill(); this.kill();
@@ -472,7 +521,7 @@ @@ -482,7 +531,7 @@
} else { } else {
this.brokenByPlayer(damagesource); this.brokenByPlayer(damagesource);
this.showBreakingParticles(); this.showBreakingParticles();
- this.kill(); - this.kill();
+ this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.die() since above damagesource method will call death event + this.discard(); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
} }
return true; return true;
@@ -533,13 +582,13 @@ @@ -550,13 +599,13 @@
} itemstack.setHoverName(this.getCustomName());
}
private void brokenByPlayer(DamageSource damagesource) { - Block.popResource(this.level, this.blockPosition(), itemstack);
- Block.popResource(this.level, this.blockPosition(), new ItemStack(Items.ARMOR_STAND)); + drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(new ItemStack(Items.ARMOR_STAND))); // CraftBukkit - add to drops
this.brokenByAnything(damagesource); this.brokenByAnything(damagesource);
} }
@ -122,7 +122,7 @@
ItemStack itemstack; ItemStack itemstack;
int i; int i;
@@ -547,7 +596,7 @@ @@ -564,7 +613,7 @@
for (i = 0; i < this.handItems.size(); ++i) { for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i); itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
@ -131,7 +131,7 @@
this.handItems.set(i, ItemStack.EMPTY); this.handItems.set(i, ItemStack.EMPTY);
} }
} }
@@ -555,10 +604,11 @@ @@ -572,10 +621,11 @@
for (i = 0; i < this.armorItems.size(); ++i) { for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i); itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
@ -144,7 +144,7 @@
} }
@@ -659,8 +709,16 @@ @@ -676,8 +726,16 @@
return this.isSmall(); return this.isSmall();
} }

Datei anzeigen

@ -5,7 +5,7 @@
import org.slf4j.Logger; import org.slf4j.Logger;
+// CraftBukkit start +// CraftBukkit start
+import net.minecraft.world.damagesource.EntityDamageSourceIndirect; +import net.minecraft.tags.DamageTypeTags;
+import net.minecraft.world.level.material.Material; +import net.minecraft.world.level.material.Material;
+import org.bukkit.entity.Hanging; +import org.bukkit.entity.Hanging;
+import org.bukkit.event.hanging.HangingBreakByEntityEvent; +import org.bukkit.event.hanging.HangingBreakByEntityEvent;
@ -111,12 +111,12 @@
} else { } else {
if (!this.isRemoved() && !this.level.isClientSide) { if (!this.isRemoved() && !this.level.isClientSide) {
+ // CraftBukkit start - fire break events + // CraftBukkit start - fire break events
+ Entity damager = (damagesource instanceof EntityDamageSourceIndirect) ? ((EntityDamageSourceIndirect) damagesource).getProximateDamageSource() : damagesource.getEntity(); + Entity damager = (damagesource.isIndirect()) ? damagesource.getEntity() : damagesource.getDirectEntity();
+ HangingBreakEvent event; + HangingBreakEvent event;
+ if (damager != null) { + if (damager != null) {
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY); + event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
+ } else { + } else {
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.isExplosion() ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT); + event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT);
+ } + }
+ +
+ this.level.getCraftServer().getPluginManager().callEvent(event); + this.level.getCraftServer().getPluginManager().callEvent(event);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java --- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java +++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
@@ -94,16 +94,27 @@ @@ -96,16 +96,27 @@
@Override @Override
protected void recalculateBoundingBox() { protected void recalculateBoundingBox() {
if (this.direction != null) { if (this.direction != null) {
@ -37,7 +37,7 @@
switch (enumdirection_enumaxis) { switch (enumdirection_enumaxis) {
case X: case X:
@@ -119,9 +130,10 @@ @@ -121,9 +132,10 @@
d4 /= 32.0D; d4 /= 32.0D;
d5 /= 32.0D; d5 /= 32.0D;
d6 /= 32.0D; d6 /= 32.0D;
@ -49,9 +49,9 @@
@Override @Override
public boolean survives() { public boolean survives() {
@@ -171,6 +183,11 @@ @@ -173,6 +185,11 @@
return false; return false;
} else if (!damagesource.isExplosion() && !this.getItem().isEmpty()) { } else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
+ // CraftBukkit start - fire EntityDamageEvent + // CraftBukkit start - fire EntityDamageEvent
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.isRemoved()) { + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.isRemoved()) {
@ -59,9 +59,9 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
this.dropItem(damagesource.getEntity(), false); this.dropItem(damagesource.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F); this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
} @@ -302,6 +319,12 @@
@@ -298,6 +315,12 @@
} }
public void setItem(ItemStack itemstack, boolean flag) { public void setItem(ItemStack itemstack, boolean flag) {
@ -74,7 +74,7 @@
if (!itemstack.isEmpty()) { if (!itemstack.isEmpty()) {
itemstack = itemstack.copy(); itemstack = itemstack.copy();
itemstack.setCount(1); itemstack.setCount(1);
@@ -305,7 +328,7 @@ @@ -309,7 +332,7 @@
this.onItemChanged(itemstack); this.onItemChanged(itemstack);
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack); this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/decoration/EntityLeash.java --- a/net/minecraft/world/entity/decoration/EntityLeash.java
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java +++ b/net/minecraft/world/entity/decoration/EntityLeash.java
@@ -25,6 +25,12 @@ @@ -26,6 +26,12 @@
import net.minecraft.world.phys.AxisAlignedBB; import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -13,9 +13,9 @@
public class EntityLeash extends EntityHanging { public class EntityLeash extends EntityHanging {
public static final double OFFSET_Y = 0.375D; public static final double OFFSET_Y = 0.375D;
@@ -96,22 +102,42 @@ @@ -96,6 +102,12 @@
while (iterator.hasNext()) { EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
entityinsentient = (EntityInsentient) iterator.next();
if (entityinsentient.getLeashHolder() == entityhuman) { if (entityinsentient.getLeashHolder() == entityhuman) {
+ // CraftBukkit start + // CraftBukkit start
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) { + if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) {
@ -26,7 +26,8 @@
entityinsentient.setLeashedTo(this, true); entityinsentient.setLeashedTo(this, true);
flag = true; flag = true;
} }
} @@ -104,18 +116,32 @@
boolean flag1 = false;
if (!flag) { if (!flag) {
- this.discard(); - this.discard();
@ -36,19 +37,21 @@
+ boolean die = true; + boolean die = true;
+ // CraftBukkit end + // CraftBukkit end
+ if (true || entityhuman.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well + if (true || entityhuman.getAbilities().instabuild) { // CraftBukkit - Process for non-creative as well
iterator = list.iterator(); Iterator iterator1 = list.iterator();
while (iterator.hasNext()) { while (iterator1.hasNext()) {
entityinsentient = (EntityInsentient) iterator.next(); EntityInsentient entityinsentient1 = (EntityInsentient) iterator1.next();
if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) {
- entityinsentient.dropLeash(true, false); if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
- entityinsentient1.dropLeash(true, false);
+ // CraftBukkit start + // CraftBukkit start
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman, enumhand).isCancelled()) { + if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, entityhuman, enumhand).isCancelled()) {
+ die = false; + die = false;
+ continue; + continue;
+ } + }
+ entityinsentient.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean + entityinsentient1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
+ // CraftBukkit end + // CraftBukkit end
flag1 = true;
} }
} }
+ // CraftBukkit start + // CraftBukkit start

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java --- a/net/minecraft/world/entity/item/EntityFallingBlock.java
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java +++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
@@ -48,6 +48,8 @@ @@ -49,6 +49,8 @@
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -9,7 +9,7 @@
public class EntityFallingBlock extends Entity { public class EntityFallingBlock extends Entity {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -82,10 +84,17 @@ @@ -83,10 +85,17 @@
} }
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) { public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
@ -28,7 +28,7 @@
return entityfallingblock; return entityfallingblock;
} }
@@ -168,6 +177,12 @@ @@ -169,6 +178,12 @@
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true); this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
} }
@ -41,7 +41,7 @@
if (this.level.setBlock(blockposition, this.blockState, 3)) { if (this.level.setBlock(blockposition, this.blockState, 3)) {
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition))); ((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
this.discard(); this.discard();
@@ -238,7 +253,7 @@ @@ -239,7 +254,7 @@
if (i < 0) { if (i < 0) {
return false; return false;
} else { } else {
@ -50,7 +50,7 @@
DamageSource damagesource1; DamageSource damagesource1;
if (this.blockState.getBlock() instanceof Fallable) { if (this.blockState.getBlock() instanceof Fallable) {
@@ -254,7 +269,9 @@ @@ -255,7 +270,9 @@
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax); float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> { this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/EntityItem.java --- a/net/minecraft/world/entity/item/EntityItem.java
+++ b/net/minecraft/world/entity/item/EntityItem.java +++ b/net/minecraft/world/entity/item/EntityItem.java
@@ -30,6 +30,12 @@ @@ -31,6 +31,12 @@
import net.minecraft.world.level.gameevent.GameEvent; import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -10,18 +10,18 @@
+import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.event.player.PlayerPickupItemEvent;
+// CraftBukkit end +// CraftBukkit end
+ +
public class EntityItem extends Entity { public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK); private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -44,6 +50,7 @@ @@ -45,6 +51,7 @@
@Nullable @Nullable
private UUID owner; public UUID target;
public final float bobOffs; public final float bobOffs;
+ private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit + private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) { public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -101,9 +108,12 @@ @@ -110,9 +117,12 @@
this.discard(); this.discard();
} else { } else {
super.tick(); super.tick();
@ -37,7 +37,7 @@
this.xo = this.getX(); this.xo = this.getX();
this.yo = this.getY(); this.yo = this.getY();
@@ -153,9 +163,11 @@ @@ -162,9 +172,11 @@
this.mergeWithNeighbours(); this.mergeWithNeighbours();
} }
@ -49,7 +49,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing(); this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@@ -167,6 +179,12 @@ @@ -176,6 +188,12 @@
} }
if (!this.level.isClientSide && this.age >= 6000) { if (!this.level.isClientSide && this.age >= 6000) {
@ -62,7 +62,7 @@
this.discard(); this.discard();
} }
@@ -242,10 +260,11 @@ @@ -251,10 +269,11 @@
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) { private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
ItemStack itemstack2 = merge(itemstack, itemstack1, 64); ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
@ -75,7 +75,7 @@
merge(entityitem, itemstack, itemstack1); merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay); entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age); entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -271,6 +290,11 @@ @@ -280,6 +299,11 @@
} else if (this.level.isClientSide) { } else if (this.level.isClientSide) {
return true; return true;
} else { } else {
@ -87,7 +87,7 @@
this.markHurt(); this.markHurt();
this.health = (int) ((float) this.health - f); this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity()); this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
@@ -334,6 +358,46 @@ @@ -343,6 +367,46 @@
Item item = itemstack.getItem(); Item item = itemstack.getItem();
int i = itemstack.getCount(); int i = itemstack.getCount();
@ -131,10 +131,10 @@
+ } + }
+ // CraftBukkit end + // CraftBukkit end
+ +
if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) { if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
entityhuman.take(this, i); entityhuman.take(this, i);
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
@@ -377,7 +441,9 @@ @@ -386,7 +450,9 @@
} }
public void setItem(ItemStack itemstack) { public void setItem(ItemStack itemstack) {

Datei anzeigen

@ -1,12 +1,12 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java --- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java +++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -14,12 +14,16 @@ @@ -15,12 +15,16 @@
import net.minecraft.world.entity.EnumMoveType; import net.minecraft.world.entity.TraceableEntity;
import net.minecraft.world.level.World; import net.minecraft.world.level.World;
+import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit +import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
+ +
public class EntityTNTPrimed extends Entity { public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT); private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
private static final int DEFAULT_FUSE_TIME = 80; private static final int DEFAULT_FUSE_TIME = 80;
@ -17,7 +17,7 @@
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) { public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@@ -70,10 +74,13 @@ @@ -71,10 +75,13 @@
this.setFuse(i); this.setFuse(i);
if (i <= 0) { if (i <= 0) {
@ -32,7 +32,7 @@
} else { } else {
this.updateInWaterStateAndDoFluidPushing(); this.updateInWaterStateAndDoFluidPushing();
if (this.level.isClientSide) { if (this.level.isClientSide) {
@@ -84,9 +91,16 @@ @@ -85,9 +92,16 @@
} }
private void explode() { private void explode() {

Datei anzeigen

@ -34,7 +34,7 @@
@Override @Override
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) { protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
ItemStack itemstack = entityhuman.getItemInHand(enumhand); ItemStack itemstack = entityhuman.getItemInHand(enumhand);
@@ -246,10 +262,18 @@ @@ -250,10 +266,18 @@
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
float f = this.isPowered() ? 2.0F : 1.0F; float f = this.isPowered() ? 2.0F : 1.0F;
@ -57,7 +57,7 @@
} }
} }
@@ -260,6 +284,7 @@ @@ -264,6 +288,7 @@
if (!collection.isEmpty()) { if (!collection.isEmpty()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ()); EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
@ -65,7 +65,7 @@
entityareaeffectcloud.setRadius(2.5F); entityareaeffectcloud.setRadius(2.5F);
entityareaeffectcloud.setRadiusOnUse(-0.5F); entityareaeffectcloud.setRadiusOnUse(-0.5F);
entityareaeffectcloud.setWaitTime(10); entityareaeffectcloud.setWaitTime(10);
@@ -273,7 +298,7 @@ @@ -277,7 +302,7 @@
entityareaeffectcloud.addEffect(new MobEffect(mobeffect)); entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityDrowned.java --- a/net/minecraft/world/entity/monster/EntityDrowned.java
+++ b/net/minecraft/world/entity/monster/EntityDrowned.java +++ b/net/minecraft/world/entity/monster/EntityDrowned.java
@@ -239,7 +239,7 @@ @@ -244,7 +244,7 @@
@Override @Override
public void performRangedAttack(EntityLiving entityliving, float f) { public void performRangedAttack(EntityLiving entityliving, float f) {

Datei anzeigen

@ -27,7 +27,7 @@
} }
@@ -490,9 +501,13 @@ @@ -487,9 +498,13 @@
if (iblockdata2 != null) { if (iblockdata2 != null) {
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition); iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) { if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
@ -41,7 +41,7 @@
} }
} }
@@ -531,9 +546,13 @@ @@ -528,9 +543,13 @@
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition); boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) { if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityPhantom.java --- a/net/minecraft/world/entity/monster/EntityPhantom.java
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java +++ b/net/minecraft/world/entity/monster/EntityPhantom.java
@@ -533,14 +533,14 @@ @@ -538,14 +538,14 @@
List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D)); List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
if (!list.isEmpty()) { if (!list.isEmpty()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityRavager.java --- a/net/minecraft/world/entity/monster/EntityRavager.java
+++ b/net/minecraft/world/entity/monster/EntityRavager.java +++ b/net/minecraft/world/entity/monster/EntityRavager.java
@@ -171,7 +171,7 @@ @@ -170,7 +170,7 @@
IBlockData iblockdata = this.level.getBlockState(blockposition); IBlockData iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityShulker.java --- a/net/minecraft/world/entity/monster/EntityShulker.java
+++ b/net/minecraft/world/entity/monster/EntityShulker.java +++ b/net/minecraft/world/entity/monster/EntityShulker.java
@@ -59,6 +59,12 @@ @@ -60,6 +60,12 @@
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f; import org.joml.Vector3f;
@ -13,7 +13,7 @@
public class EntityShulker extends EntityGolem implements VariantHolder<Optional<EnumColor>>, 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"); private static final UUID COVERED_ARMOR_MODIFIER_UUID = UUID.fromString("7E0292F2-9434-48D5-A29F-9583AF7DF27F");
@@ -407,6 +413,16 @@ @@ -408,6 +414,16 @@
EnumDirection enumdirection = this.findAttachableSurface(blockposition1); EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
if (enumdirection != null) { if (enumdirection != null) {
@ -22,7 +22,7 @@
+ this.level.getCraftServer().getPluginManager().callEvent(teleport); + this.level.getCraftServer().getPluginManager().callEvent(teleport);
+ if (!teleport.isCancelled()) { + if (!teleport.isCancelled()) {
+ Location to = teleport.getTo(); + Location to = teleport.getTo();
+ blockposition1 = new BlockPosition(to.getX(), to.getY(), to.getZ()); + blockposition1 = BlockPosition.containing(to.getX(), to.getY(), to.getZ());
+ } else { + } else {
+ return false; + return false;
+ } + }
@ -30,7 +30,7 @@
this.unRide(); this.unRide();
this.setAttachFace(enumdirection); this.setAttachFace(enumdirection);
this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F); this.playSound(SoundEffects.SHULKER_TELEPORT, 1.0F, 1.0F);
@@ -477,7 +493,7 @@ @@ -478,7 +494,7 @@
if (entityshulker != null) { if (entityshulker != null) {
entityshulker.setVariant(this.getVariant()); entityshulker.setVariant(this.getVariant());
entityshulker.moveTo(vec3d); entityshulker.moveTo(vec3d);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java --- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java +++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
@@ -197,8 +197,19 @@ @@ -200,8 +200,19 @@
double d3 = Math.sqrt(d0 * d0 + d2 * d2); double d3 = Math.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4)); entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.level.getDifficulty().getId() * 4));

Datei anzeigen

@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/monster/EntitySpider.java --- a/net/minecraft/world/entity/monster/EntitySpider.java
+++ b/net/minecraft/world/entity/monster/EntitySpider.java +++ b/net/minecraft/world/entity/monster/EntitySpider.java
@@ -179,7 +179,7 @@ @@ -180,7 +180,7 @@
MobEffectList mobeffectlist = ((EntitySpider.GroupDataSpider) object).effect; MobEffectList mobeffectlist = entityspider_groupdataspider.effect;
if (mobeffectlist != null) { if (mobeffectlist != null) {
- this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE)); - this.addEffect(new MobEffect(mobeffectlist, -1));
+ this.addEffect(new MobEffect(mobeffectlist, Integer.MAX_VALUE), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit + this.addEffect(new MobEffect(mobeffectlist, -1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.SPIDER_SPAWN); // CraftBukkit
} }
} }

Datei anzeigen

@ -1,14 +1,15 @@
--- a/net/minecraft/world/entity/monster/EntityStrider.java --- a/net/minecraft/world/entity/monster/EntityStrider.java
+++ b/net/minecraft/world/entity/monster/EntityStrider.java +++ b/net/minecraft/world/entity/monster/EntityStrider.java
@@ -320,7 +320,13 @@ @@ -349,7 +349,14 @@
IBlockData iblockdata1 = this.getBlockStateOnLegacy();
boolean flag = iblockdata.is(TagsBlock.STRIDER_WARM_BLOCKS) || iblockdata1.is(TagsBlock.STRIDER_WARM_BLOCKS) || this.getFluidHeight(TagsFluid.LAVA) > 0.0D;
- this.setSuffocating(!flag); boolean flag2 = flag1;
- this.setSuffocating(!flag || flag2);
+ // CraftBukkit start + // CraftBukkit start
+ if (!flag ^ this.isSuffocating()) { + boolean suffocating = !flag || flag2;
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, !flag)) { + if (suffocating ^ this.isSuffocating()) {
+ this.setSuffocating(!flag); + if (org.bukkit.craftbukkit.event.CraftEventFactory.callStriderTemperatureChangeEvent(this, suffocating)) {
+ this.setSuffocating(suffocating);
+ } + }
+ } + }
+ // CraftBukkit end + // CraftBukkit end

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityVex.java --- a/net/minecraft/world/entity/monster/EntityVex.java
+++ b/net/minecraft/world/entity/monster/EntityVex.java +++ b/net/minecraft/world/entity/monster/EntityVex.java
@@ -386,7 +386,7 @@ @@ -388,7 +388,7 @@
@Override @Override
public void start() { public void start() {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/EntityWitch.java --- a/net/minecraft/world/entity/monster/EntityWitch.java
+++ b/net/minecraft/world/entity/monster/EntityWitch.java +++ b/net/minecraft/world/entity/monster/EntityWitch.java
@@ -131,7 +131,7 @@ @@ -132,7 +132,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
MobEffect mobeffect = (MobEffect) iterator.next(); MobEffect mobeffect = (MobEffect) iterator.next();

Datei anzeigen

@ -47,8 +47,8 @@
+ // CraftBukkit end + // CraftBukkit end
} }
this.lastRestockGameTime = this.level.getGameTime(); this.resendOffersToTradingPlayer();
@@ -417,7 +431,13 @@ @@ -428,7 +442,13 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
@ -63,7 +63,7 @@
} }
} }
@@ -476,7 +496,7 @@ @@ -488,7 +508,7 @@
@Override @Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) { public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound); super.addAdditionalSaveData(nbttagcompound);
@ -72,7 +72,7 @@
Logger logger = EntityVillager.LOGGER; Logger logger = EntityVillager.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -820,7 +840,12 @@ @@ -832,7 +852,12 @@
} }
entitywitch.setPersistenceRequired(); entitywitch.setPersistenceRequired();
@ -86,7 +86,7 @@
this.releaseAllPois(); this.releaseAllPois();
this.discard(); this.discard();
} else { } else {
@@ -909,7 +934,7 @@ @@ -921,7 +946,7 @@
}).limit(5L).collect(Collectors.toList()); }).limit(5L).collect(Collectors.toList());
if (list1.size() >= j) { if (list1.size() >= j) {
@ -95,7 +95,7 @@
list.forEach(SensorGolemLastSeen::golemDetected); list.forEach(SensorGolemLastSeen::golemDetected);
} }
} }
@@ -966,7 +991,7 @@ @@ -978,7 +1003,7 @@
@Override @Override
public void startSleeping(BlockPosition blockposition) { public void startSleeping(BlockPosition blockposition) {
super.startSleeping(blockposition); super.startSleeping(blockposition);
@ -104,7 +104,7 @@
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET); this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE); this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
} }
@@ -974,7 +999,7 @@ @@ -986,7 +1011,7 @@
@Override @Override
public void stopSleeping() { public void stopSleeping() {
super.stopSleeping(); super.stopSleeping();

Datei anzeigen

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java --- a/net/minecraft/world/entity/npc/EntityVillagerTrader.java
+++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java +++ b/net/minecraft/world/entity/npc/EntityVillagerTrader.java
@@ -44,6 +44,13 @@ @@ -46,6 +46,13 @@
import net.minecraft.world.level.World;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
import org.apache.commons.lang3.ArrayUtils;
+// CraftBukkit start +// CraftBukkit start
+import org.bukkit.Bukkit; +import org.bukkit.Bukkit;
@ -14,7 +14,7 @@
public class EntityVillagerTrader extends EntityVillagerAbstract { public class EntityVillagerTrader extends EntityVillagerAbstract {
private static final int NUMBER_OF_TRADE_OFFERS = 5; private static final int NUMBER_OF_TRADE_OFFERS = 5;
@@ -53,6 +60,7 @@ @@ -55,6 +62,7 @@
public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) { public EntityVillagerTrader(EntityTypes<? extends EntityVillagerTrader> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
@ -22,7 +22,7 @@
} }
@Override @Override
@@ -130,7 +138,16 @@ @@ -140,7 +148,16 @@
MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random); MerchantRecipe merchantrecipe = villagertrades_imerchantrecipeoption.getOffer(this, this.random);
if (merchantrecipe != null) { if (merchantrecipe != null) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java --- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java +++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -115,6 +115,20 @@ @@ -117,6 +117,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase; import net.minecraft.world.scores.ScoreboardTeamBase;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -21,7 +21,7 @@
public abstract class EntityHuman extends EntityLiving { public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
@@ -128,7 +142,8 @@ @@ -130,7 +144,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F; public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F; public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F); public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
@ -31,7 +31,7 @@
private static final int FLY_ACHIEVEMENT_SPEED = 25; private static final int FLY_ACHIEVEMENT_SPEED = 25;
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT); private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT); private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
@@ -138,10 +153,10 @@ @@ -140,10 +155,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG); protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder; private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this); private final PlayerInventory inventory = new PlayerInventory(this);
@ -44,18 +44,9 @@
protected int jumpTriggerTime; protected int jumpTriggerTime;
public float oBob; public float oBob;
public float bob; public float bob;
@@ -158,7 +173,7 @@ @@ -172,6 +187,16 @@
public int experienceLevel;
public int totalExperience;
public float experienceProgress;
- protected int enchantmentSeed;
+ public int enchantmentSeed;
protected final float defaultFlySpeed = 0.02F;
private int lastLevelUpTime;
private final GameProfile gameProfile;
@@ -169,6 +184,16 @@
@Nullable
public EntityFishingHook fishing; public EntityFishingHook fishing;
protected float hurtDir;
+ // CraftBukkit start + // CraftBukkit start
+ public boolean fauxSleeping; + public boolean fauxSleeping;
@ -70,7 +61,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) { public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world); super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY; this.lastItemInMainHand = ItemStack.EMPTY;
@@ -308,7 +333,7 @@ @@ -311,7 +336,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD); ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) { if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@ -79,7 +70,7 @@
} }
} }
@@ -502,7 +527,8 @@ @@ -505,7 +530,8 @@
if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) { if (this.level.getDifficulty() == EnumDifficulty.PEACEFUL && this.level.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) { if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@ -89,7 +80,7 @@
} }
if (this.foodData.needsFood() && this.tickCount % 10 == 0) { if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -666,6 +692,13 @@ @@ -664,6 +690,13 @@
@Nullable @Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) { public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@ -103,7 +94,7 @@
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
return null; return null;
} else { } else {
@@ -700,6 +733,33 @@ @@ -698,6 +731,33 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6); entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
} }
@ -137,7 +128,7 @@
return entityitem; return entityitem;
} }
} }
@@ -790,7 +850,7 @@ @@ -788,7 +848,7 @@
} }
if (nbttagcompound.contains("LastDeathLocation", 10)) { if (nbttagcompound.contains("LastDeathLocation", 10)) {
@ -146,7 +137,7 @@
Logger logger = EntityHuman.LOGGER; Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -823,7 +883,7 @@ @@ -821,7 +881,7 @@
} }
this.getLastDeathLocation().flatMap((globalpos) -> { this.getLastDeathLocation().flatMap((globalpos) -> {
@ -155,7 +146,7 @@
Logger logger = EntityHuman.LOGGER; Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger); Objects.requireNonNull(logger);
@@ -850,12 +910,12 @@ @@ -848,12 +908,12 @@
return false; return false;
} else { } else {
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -170,7 +161,7 @@
} }
if (this.level.getDifficulty() == EnumDifficulty.EASY) { if (this.level.getDifficulty() == EnumDifficulty.EASY) {
@@ -867,7 +927,13 @@ @@ -865,7 +925,13 @@
} }
} }
@ -185,7 +176,7 @@
} }
} }
} }
@@ -887,10 +953,29 @@ @@ -885,10 +951,29 @@
} }
public boolean canHarmPlayer(EntityHuman entityhuman) { public boolean canHarmPlayer(EntityHuman entityhuman) {
@ -218,7 +209,7 @@
} }
@Override @Override
@@ -932,8 +1017,13 @@ @@ -930,8 +1015,13 @@
} }
} }
@ -233,7 +224,7 @@
if (!this.isInvulnerableTo(damagesource)) { if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f); f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f); f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -948,7 +1038,7 @@ @@ -946,7 +1036,7 @@
} }
if (f != 0.0F) { if (f != 0.0F) {
@ -241,8 +232,8 @@
+ this.causeFoodExhaustion(damagesource.getFoodExhaustion(), EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent + this.causeFoodExhaustion(damagesource.getFoodExhaustion(), EntityExhaustionEvent.ExhaustionReason.DAMAGED); // CraftBukkit - EntityExhaustionEvent
float f3 = this.getHealth(); float f3 = this.getHealth();
this.setHealth(this.getHealth() - f); this.getCombatTracker().recordDamage(damagesource, f3, f);
@@ -959,6 +1049,7 @@ @@ -957,6 +1047,7 @@
} }
} }
@ -250,7 +241,7 @@
} }
@Override @Override
@@ -1122,7 +1213,7 @@ @@ -1121,7 +1212,7 @@
f *= 0.2F + f2 * f2 * 0.8F; f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2; f1 *= f2;
@ -259,7 +250,7 @@
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F; boolean flag = f2 > 0.9F;
boolean flag1 = false; boolean flag1 = false;
@@ -1161,8 +1252,15 @@ @@ -1160,8 +1251,15 @@
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth(); f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) { if (j > 0 && !entity.isOnFire()) {
@ -277,20 +268,20 @@
} }
} }
@@ -1190,8 +1288,11 @@ @@ -1189,8 +1287,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next(); EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) { if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
+ // CraftBukkit start - Only apply knockback if the damage hits + // CraftBukkit start - Only apply knockback if the damage hits
+ if (entityliving.hurt(DamageSource.playerAttack(this).sweep(), f4)) { + if (entityliving.hurt(this.damageSources().playerAttack(this).sweep(), f4)) {
entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F))); entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
- entityliving.hurt(DamageSource.playerAttack(this), f4); - entityliving.hurt(this.damageSources().playerAttack(this), f4);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
} }
} }
@@ -1200,9 +1301,26 @@ @@ -1199,9 +1300,26 @@
} }
if (entity instanceof EntityPlayer && entity.hurtMarked) { if (entity instanceof EntityPlayer && entity.hurtMarked) {
@ -317,7 +308,7 @@
} }
if (flag2) { if (flag2) {
@@ -1247,7 +1365,14 @@ @@ -1246,7 +1364,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) { if (j > 0) {
@ -333,7 +324,7 @@
} }
if (this.level instanceof WorldServer && f5 > 2.0F) { if (this.level instanceof WorldServer && f5 > 2.0F) {
@@ -1257,12 +1382,17 @@ @@ -1256,12 +1381,17 @@
} }
} }
@ -352,7 +343,7 @@
} }
} }
@@ -1339,6 +1469,12 @@ @@ -1338,6 +1468,12 @@
} }
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) { public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@ -365,7 +356,7 @@
this.startSleeping(blockposition); this.startSleeping(blockposition);
this.sleepCounter = 0; this.sleepCounter = 0;
return Either.right(Unit.INSTANCE); return Either.right(Unit.INSTANCE);
@@ -1423,9 +1559,9 @@ @@ -1422,9 +1558,9 @@
super.jumpFromGround(); super.jumpFromGround();
this.awardStat(StatisticList.JUMP); this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) { if (this.isSprinting()) {
@ -377,9 +368,9 @@
} }
} }
@@ -1459,7 +1595,11 @@ @@ -1454,7 +1590,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z); this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.flyingSpeed = f;
this.resetFallDistance(); this.resetFallDistance();
- this.setSharedFlag(7, false); - this.setSharedFlag(7, false);
+ // CraftBukkit start + // CraftBukkit start
@ -390,7 +381,7 @@
} else { } else {
super.travel(vec3d); super.travel(vec3d);
} }
@@ -1494,19 +1634,19 @@ @@ -1489,19 +1629,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F); i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) { if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i); this.awardStat(StatisticList.SWIM_ONE_CM, i);
@ -413,7 +404,7 @@
} }
} else if (this.onClimbable()) { } else if (this.onClimbable()) {
if (d1 > 0.0D) { if (d1 > 0.0D) {
@@ -1517,13 +1657,13 @@ @@ -1512,13 +1652,13 @@
if (i > 0) { if (i > 0) {
if (this.isSprinting()) { if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i); this.awardStat(StatisticList.SPRINT_ONE_CM, i);
@ -430,7 +421,7 @@
} }
} }
} else if (this.isFallFlying()) { } else if (this.isFallFlying()) {
@@ -1589,12 +1729,24 @@ @@ -1584,12 +1724,24 @@
} }
public void startFallFlying() { public void startFallFlying() {
@ -456,7 +447,7 @@
} }
@Override @Override
@@ -1685,10 +1837,21 @@ @@ -1680,10 +1832,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2); return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
} }
@ -479,7 +470,7 @@
} }
} }
@@ -1774,13 +1937,20 @@ @@ -1769,13 +1932,20 @@
@Override @Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) { public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@ -503,7 +494,7 @@
} }
} }
@@ -1819,26 +1989,31 @@ @@ -1814,26 +1984,31 @@
protected void removeEntitiesOnShoulder() { protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) { if (this.timeEntitySatOnShoulder + 20L < this.level.getGameTime()) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/PlayerInventory.java --- a/net/minecraft/world/entity/player/PlayerInventory.java
+++ b/net/minecraft/world/entity/player/PlayerInventory.java +++ b/net/minecraft/world/entity/player/PlayerInventory.java
@@ -25,6 +25,13 @@ @@ -26,6 +26,13 @@
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
@ -14,7 +14,7 @@
public class PlayerInventory implements IInventory, INamableTileEntity { public class PlayerInventory implements IInventory, INamableTileEntity {
public static final int POP_TIME_DURATION = 5; public static final int POP_TIME_DURATION = 5;
@@ -42,6 +49,54 @@ @@ -43,6 +50,54 @@
public final EntityHuman player; public final EntityHuman player;
private int timesChanged; private int timesChanged;
@ -69,7 +69,7 @@
public PlayerInventory(EntityHuman entityhuman) { public PlayerInventory(EntityHuman entityhuman) {
this.items = NonNullList.withSize(36, ItemStack.EMPTY); this.items = NonNullList.withSize(36, ItemStack.EMPTY);
this.armor = NonNullList.withSize(4, ItemStack.EMPTY); this.armor = NonNullList.withSize(4, ItemStack.EMPTY);
@@ -62,6 +117,28 @@ @@ -63,6 +118,28 @@
return !itemstack.isEmpty() && ItemStack.isSameItemSameTags(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < itemstack.getMaxStackSize() && itemstack.getCount() < this.getMaxStackSize(); return !itemstack.isEmpty() && ItemStack.isSameItemSameTags(itemstack, itemstack1) && itemstack.isStackable() && itemstack.getCount() < itemstack.getMaxStackSize() && itemstack.getCount() < this.getMaxStackSize();
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEgg.java --- a/net/minecraft/world/entity/projectile/EntityEgg.java
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java +++ b/net/minecraft/world/entity/projectile/EntityEgg.java
@@ -12,6 +12,15 @@ @@ -11,6 +11,15 @@
import net.minecraft.world.phys.MovingObjectPosition; import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -16,7 +16,7 @@
public class EntityEgg extends EntityProjectileThrowable { public class EntityEgg extends EntityProjectileThrowable {
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) { public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
@@ -48,22 +57,42 @@ @@ -47,22 +56,42 @@
protected void onHit(MovingObjectPosition movingobjectposition) { protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition); super.onHit(movingobjectposition);
if (!this.level.isClientSide) { if (!this.level.isClientSide) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java --- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java +++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
@@ -17,6 +17,13 @@ @@ -16,6 +16,13 @@
import net.minecraft.world.phys.MovingObjectPosition; import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -14,10 +14,10 @@
public class EntityEnderPearl extends EntityProjectileThrowable { public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) { public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -53,23 +60,36 @@ @@ -52,23 +59,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity; EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.getConnection().isConnected() && entityplayer.level == this.level && !entityplayer.isSleeping()) { if (entityplayer.connection.isAcceptingMessages() && entityplayer.level == this.level && !entityplayer.isSleeping()) {
- if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { - if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level); - EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
+ // CraftBukkit start - Fire PlayerTeleportEvent + // CraftBukkit start - Fire PlayerTeleportEvent
@ -29,7 +29,7 @@
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL); + PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
+ Bukkit.getPluginManager().callEvent(teleEvent); + Bukkit.getPluginManager().callEvent(teleEvent);
+ +
+ if (!teleEvent.isCancelled() && !entityplayer.connection.isDisconnected()) { + if (!teleEvent.isCancelled() && !entityplayer.connection.isAcceptingMessages()) {
+ if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) { + if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level); + EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level);
+ +
@ -54,17 +54,17 @@
+ entityplayer.connection.teleport(teleEvent.getTo()); + entityplayer.connection.teleport(teleEvent.getTo());
+ entity.resetFallDistance(); + entity.resetFallDistance();
+ CraftEventFactory.entityDamage = this; + CraftEventFactory.entityDamage = this;
+ entity.hurt(DamageSource.FALL, 5.0F); + entity.hurt(this.damageSources().fall(), 5.0F);
+ CraftEventFactory.entityDamage = null; + CraftEventFactory.entityDamage = null;
} }
- -
- entity.resetFallDistance(); - entity.resetFallDistance();
- entity.hurt(DamageSource.FALL, 5.0F); - entity.hurt(this.damageSources().fall(), 5.0F);
+ // CraftBukkit end + // CraftBukkit end
} }
} else if (entity != null) { } else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ()); entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -98,7 +118,7 @@ @@ -97,7 +117,7 @@
public Entity changeDimension(WorldServer worldserver) { public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner(); Entity entity = this.getOwner();

Datei anzeigen

@ -1,11 +1,11 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java --- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java +++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -128,7 +128,9 @@ @@ -129,7 +129,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) { if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
if (entityliving1 == null) { if (entityliving1 == null) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.hurt(DamageSource.MAGIC, 6.0F); entityliving.hurt(this.damageSources().magic(), 6.0F);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit + org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
} else { } else {
if (entityliving1.isAlliedTo((Entity) entityliving)) { if (entityliving1.isAlliedTo((Entity) entityliving)) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireworks.java --- a/net/minecraft/world/entity/projectile/EntityFireworks.java
+++ b/net/minecraft/world/entity/projectile/EntityFireworks.java +++ b/net/minecraft/world/entity/projectile/EntityFireworks.java
@@ -29,6 +29,8 @@ @@ -28,6 +28,8 @@
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -9,7 +9,7 @@
public class EntityFireworks extends IProjectile implements ItemSupplier { public class EntityFireworks extends IProjectile implements ItemSupplier {
public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK); public static final DataWatcherObject<ItemStack> DATA_ID_FIREWORKS_ITEM = DataWatcher.defineId(EntityFireworks.class, DataWatcherRegistry.ITEM_STACK);
@@ -144,7 +146,7 @@ @@ -143,7 +145,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity); MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (!this.noPhysics) { if (!this.noPhysics) {
@ -18,7 +18,7 @@
this.hasImpulse = true; this.hasImpulse = true;
} }
@@ -159,7 +161,11 @@ @@ -158,7 +160,11 @@
} }
if (!this.level.isClientSide && this.life > this.lifetime) { if (!this.level.isClientSide && this.life > this.lifetime) {
@ -31,7 +31,7 @@
} }
} }
@@ -175,7 +181,11 @@ @@ -174,7 +180,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) { protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {
super.onHitEntity(movingobjectpositionentity); super.onHitEntity(movingobjectpositionentity);
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
@ -44,7 +44,7 @@
} }
} }
@@ -185,7 +195,11 @@ @@ -184,7 +194,11 @@
this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this); this.level.getBlockState(blockposition).entityInside(this.level, blockposition, this);
if (!this.level.isClientSide() && this.hasExplosion()) { if (!this.level.isClientSide() && this.hasExplosion()) {
@ -57,22 +57,22 @@
} }
super.onHitBlock(movingobjectpositionblock); super.onHitBlock(movingobjectpositionblock);
@@ -211,7 +225,9 @@ @@ -210,7 +224,9 @@
if (f > 0.0F) { if (f > 0.0F) {
if (this.attachedToEntity != null) { if (this.attachedToEntity != null) {
+ CraftEventFactory.entityDamage = this; // CraftBukkit + CraftEventFactory.entityDamage = this; // CraftBukkit
this.attachedToEntity.hurt(DamageSource.fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2)); this.attachedToEntity.hurt(this.damageSources().fireworks(this, this.getOwner()), 5.0F + (float) (nbttaglist.size() * 2));
+ CraftEventFactory.entityDamage = null; // CraftBukkit + CraftEventFactory.entityDamage = null; // CraftBukkit
} }
double d0 = 5.0D; double d0 = 5.0D;
@@ -238,7 +254,9 @@ @@ -237,7 +253,9 @@
if (flag) { if (flag) {
float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D); float f1 = f * (float) Math.sqrt((5.0D - (double) this.distanceTo(entityliving)) / 5.0D);
+ CraftEventFactory.entityDamage = this; // CraftBukkit + CraftEventFactory.entityDamage = this; // CraftBukkit
entityliving.hurt(DamageSource.fireworks(this, this.getOwner()), f1); entityliving.hurt(this.damageSources().fireworks(this, this.getOwner()), f1);
+ CraftEventFactory.entityDamage = null; // CraftBukkit + CraftEventFactory.entityDamage = null; // CraftBukkit
} }
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java --- a/net/minecraft/world/entity/projectile/EntityLargeFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java +++ b/net/minecraft/world/entity/projectile/EntityLargeFireball.java
@@ -10,17 +10,21 @@ @@ -9,17 +9,21 @@
import net.minecraft.world.phys.MovingObjectPosition; import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -22,7 +22,7 @@
} }
@Override @Override
@@ -29,7 +33,15 @@ @@ -28,7 +32,15 @@
if (!this.level.isClientSide) { if (!this.level.isClientSide) {
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING); boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
@ -39,7 +39,7 @@
this.discard(); this.discard();
} }
@@ -60,7 +72,8 @@ @@ -59,7 +71,8 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) { public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound); super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("ExplosionPower", 99)) { if (nbttagcompound.contains("ExplosionPower", 99)) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java --- a/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
+++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java +++ b/net/minecraft/world/entity/projectile/EntityLlamaSpit.java
@@ -33,7 +33,7 @@ @@ -32,7 +32,7 @@
Vec3D vec3d = this.getDeltaMovement(); Vec3D vec3d = this.getDeltaMovement();
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity); MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityPotion.java --- a/net/minecraft/world/entity/projectile/EntityPotion.java
+++ b/net/minecraft/world/entity/projectile/EntityPotion.java +++ b/net/minecraft/world/entity/projectile/EntityPotion.java
@@ -32,6 +32,16 @@ @@ -31,6 +31,16 @@
import net.minecraft.world.phys.MovingObjectPositionBlock; import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -17,7 +17,7 @@
public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier { public class EntityPotion extends EntityProjectileThrowable implements ItemSupplier {
public static final double SPLASH_RANGE = 4.0D; public static final double SPLASH_RANGE = 4.0D;
@@ -100,7 +110,7 @@ @@ -99,7 +109,7 @@
if (flag) { if (flag) {
this.applyWater(); this.applyWater();
@ -26,7 +26,7 @@
if (this.isLingering()) { if (this.isLingering()) {
this.makeAreaOfEffectCloud(itemstack, potionregistry); this.makeAreaOfEffectCloud(itemstack, potionregistry);
} else { } else {
@@ -149,6 +159,7 @@ @@ -148,6 +158,7 @@
private void applySplash(List<MobEffect> list, @Nullable Entity entity) { private void applySplash(List<MobEffect> list, @Nullable Entity entity) {
AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D); AxisAlignedBB axisalignedbb = this.getBoundingBox().inflate(4.0D, 2.0D, 4.0D);
List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb); List<EntityLiving> list1 = this.level.getEntitiesOfClass(EntityLiving.class, axisalignedbb);
@ -34,8 +34,8 @@
if (!list1.isEmpty()) { if (!list1.isEmpty()) {
Entity entity1 = this.getEffectSource(); Entity entity1 = this.getEffectSource();
@@ -167,21 +178,47 @@ @@ -168,24 +179,50 @@
d1 = 1.0D; d1 = 1.0D - Math.sqrt(d0) / 4.0D;
} }
- Iterator iterator1 = list.iterator(); - Iterator iterator1 = list.iterator();
@ -76,7 +76,10 @@
+ if (mobeffectlist.isInstantenous()) { + if (mobeffectlist.isInstantenous()) {
+ mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1); + mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
+ } else { + } else {
+ int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); + int i = mobeffect.mapDuration((j) -> {
+ return (int) (d1 * (double) j + 0.5D);
+ });
+ MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
- while (iterator1.hasNext()) { - while (iterator1.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator1.next(); - MobEffect mobeffect = (MobEffect) iterator1.next();
@ -85,18 +88,21 @@
- if (mobeffectlist.isInstantenous()) { - if (mobeffectlist.isInstantenous()) {
- mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1); - mobeffectlist.applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect.getAmplifier(), d1);
- } else { - } else {
- int i = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); - int i = mobeffect.mapDuration((j) -> {
- return (int) (d1 * (double) j + 0.5D);
- });
- MobEffect mobeffect1 = new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible());
- -
- if (i > 20) { - if (!mobeffect1.endsWithin(20)) {
- entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity1); - entityliving.addEffect(mobeffect1, entity1);
- } - }
- } - }
+ if (i > 20) { + if (!mobeffect1.endsWithin(20)) {
+ entityliving.addEffect(new MobEffect(mobeffectlist, i, mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit + entityliving.addEffect(mobeffect1, entity1, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_SPLASH); // CraftBukkit
} }
} }
} }
@@ -217,7 +254,14 @@ @@ -221,7 +258,14 @@
entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor")); entityareaeffectcloud.setFixedColor(nbttagcompound.getInt("CustomPotionColor"));
} }
@ -112,7 +118,7 @@
} }
public boolean isLingering() { public boolean isLingering() {
@@ -228,13 +272,25 @@ @@ -232,13 +276,25 @@
IBlockData iblockdata = this.level.getBlockState(blockposition); IBlockData iblockdata = this.level.getBlockState(blockposition);
if (iblockdata.is(TagsBlock.FIRE)) { if (iblockdata.is(TagsBlock.FIRE)) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java --- a/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
+++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java +++ b/net/minecraft/world/entity/projectile/EntityShulkerBullet.java
@@ -59,8 +59,21 @@ @@ -60,8 +60,21 @@
this.finalTarget = entity; this.finalTarget = entity;
this.currentMoveDirection = EnumDirection.UP; this.currentMoveDirection = EnumDirection.UP;
this.selectNextMoveDirection(enumdirection_enumaxis); this.selectNextMoveDirection(enumdirection_enumaxis);
@ -22,7 +22,7 @@
@Override @Override
public SoundCategory getSoundSource() { public SoundCategory getSoundSource() {
return SoundCategory.HOSTILE; return SoundCategory.HOSTILE;
@@ -224,7 +237,7 @@ @@ -225,7 +238,7 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity); MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResult(this, this::canHitEntity);
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) { if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
@ -31,16 +31,16 @@
} }
} }
@@ -291,7 +304,7 @@ @@ -294,7 +307,7 @@
if (flag) {
this.doEnchantDamageEffects(entityliving, entity);
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this)); EntityLiving entityliving1 = (EntityLiving) entity;
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
- entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this));
+ entityliving1.addEffect(new MobEffect(MobEffects.LEVITATION, 200), (Entity) MoreObjects.firstNonNull(entity1, this), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
} }
} }
@@ -317,6 +330,11 @@ @@ -325,6 +338,11 @@
@Override @Override
public boolean hurt(DamageSource damagesource, float f) { public boolean hurt(DamageSource damagesource, float f) {

Datei anzeigen

@ -34,7 +34,7 @@
+ entity.setSecondsOnFire(event.getDuration(), false); + entity.setSecondsOnFire(event.getDuration(), false);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
if (!entity.hurt(DamageSource.fireball(this, entity1), 5.0F)) { if (!entity.hurt(this.damageSources().fireball(this, entity1), 5.0F)) {
entity.setRemainingFireTicks(i); entity.setRemainingFireTicks(i);
} else if (entity1 instanceof EntityLiving) { } else if (entity1 instanceof EntityLiving) {
@@ -51,10 +65,10 @@ @@ -51,10 +65,10 @@

Datei anzeigen

@ -26,16 +26,16 @@
public int getColor() { public int getColor() {
return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR); return (Integer) this.entityData.get(EntityTippedArrow.ID_EFFECT_COLOR);
} }
@@ -210,7 +229,7 @@ @@ -212,7 +231,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next(); mobeffect = (MobEffect) iterator.next();
- entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity); entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
+ entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.getDuration() / 8, 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit return i / 8;
- }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity);
+ }), 1), mobeffect.getAmplifier(), mobeffect.isAmbient(), mobeffect.isVisible()), entity, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ARROW); // CraftBukkit
} }
if (!this.effects.isEmpty()) { if (!this.effects.isEmpty()) {
@@ -218,7 +237,7 @@ @@ -220,7 +239,7 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next(); mobeffect = (MobEffect) iterator.next();

Datei anzeigen

@ -18,16 +18,16 @@
} }
} }
} else { } else {
@@ -80,7 +82,7 @@ @@ -81,7 +83,7 @@
} }
if (b0 > 0) { if (b0 > 0) {
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource()); - entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource());
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit + entityliving.addEffect(new MobEffect(MobEffects.WITHER, 20 * b0, 1), this.getEffectSource(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
} }
} }
@@ -91,7 +93,15 @@ @@ -92,7 +94,15 @@
protected void onHit(MovingObjectPosition movingobjectposition) { protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition); super.onHit(movingobjectposition);
if (!this.level.isClientSide) { if (!this.level.isClientSide) {

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/IProjectile.java --- a/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/net/minecraft/world/entity/projectile/IProjectile.java +++ b/net/minecraft/world/entity/projectile/IProjectile.java
@@ -23,6 +23,10 @@ @@ -24,6 +24,10 @@
import net.minecraft.world.phys.MovingObjectPositionEntity; import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D; import net.minecraft.world.phys.Vec3D;
@ -8,10 +8,10 @@
+import org.bukkit.projectiles.ProjectileSource; +import org.bukkit.projectiles.ProjectileSource;
+// CraftBukkit end +// CraftBukkit end
+ +
public abstract class IProjectile extends Entity { public abstract class IProjectile extends Entity implements TraceableEntity {
@Nullable @Nullable
@@ -32,6 +36,10 @@ @@ -33,6 +37,10 @@
private boolean leftOwner; private boolean leftOwner;
private boolean hasBeenShot; private boolean hasBeenShot;
@ -22,7 +22,7 @@
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) { IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
super(entitytypes, world); super(entitytypes, world);
} }
@@ -41,6 +49,7 @@ @@ -42,6 +50,7 @@
this.ownerUUID = entity.getUUID(); this.ownerUUID = entity.getUUID();
this.cachedOwner = entity; this.cachedOwner = entity;
} }
@ -30,7 +30,7 @@
} }
@@ -144,6 +153,16 @@ @@ -146,6 +155,16 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z)); this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.isOnGround() ? 0.0D : vec3d.y, vec3d.z));
} }
@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) { protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType(); MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -164,6 +183,11 @@ @@ -166,6 +185,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {} protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) { protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {

Datei anzeigen

@ -14,9 +14,9 @@
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity { public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
@@ -218,4 +225,51 @@ @@ -237,4 +244,51 @@
public void clearItemStacks() { public void stopOpen(EntityHuman entityhuman) {
this.itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); this.level.gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
} }
+ +
+ // CraftBukkit start + // CraftBukkit start

Datei anzeigen

@ -97,7 +97,7 @@
super.push(entity); super.push(entity);
} }
@@ -276,6 +335,7 @@ @@ -279,6 +338,7 @@
return this.getDirection().getClockWise(); return this.getDirection().getClockWise();
} }
@ -105,7 +105,7 @@
@Override @Override
public void tick() { public void tick() {
this.oldStatus = this.status; this.oldStatus = this.status;
@@ -316,6 +376,22 @@ @@ -319,6 +379,22 @@
this.setDeltaMovement(Vec3D.ZERO); this.setDeltaMovement(Vec3D.ZERO);
} }
@ -128,9 +128,9 @@
this.tickBubbleColumn(); this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) { for (int i = 0; i <= 1; ++i) {
@@ -823,6 +899,11 @@ @@ -830,6 +906,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL); this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level.isClientSide && !this.isRemoved()) { if (!this.level.isClientSide && !this.isRemoved()) {
+ // CraftBukkit start + // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + Vehicle vehicle = (Vehicle) this.getBukkitEntity();
@ -140,7 +140,7 @@
this.kill(); this.kill();
if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i; int i;
@@ -836,6 +917,7 @@ @@ -843,6 +924,7 @@
} }
} }
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java --- a/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +++ b/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java
@@ -22,6 +22,10 @@ @@ -23,6 +23,10 @@
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.material.Fluid; import net.minecraft.world.level.material.Fluid;
@ -11,7 +11,7 @@
public class EntityMinecartTNT extends EntityMinecartAbstract { public class EntityMinecartTNT extends EntityMinecartAbstract {
private static final byte EVENT_PRIME = 10; private static final byte EVENT_PRIME = 10;
@@ -114,7 +118,15 @@ @@ -115,7 +119,15 @@
d1 = 5.0D; d1 = 5.0D;
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/food/FoodMetaData.java --- a/net/minecraft/world/food/FoodMetaData.java
+++ b/net/minecraft/world/food/FoodMetaData.java +++ b/net/minecraft/world/food/FoodMetaData.java
@@ -8,15 +8,33 @@ @@ -7,15 +7,33 @@
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.GameRules; import net.minecraft.world.level.GameRules;
@ -35,7 +35,7 @@
public void eat(int i, float f) { public void eat(int i, float f) {
this.foodLevel = Math.min(i + this.foodLevel, 20); this.foodLevel = Math.min(i + this.foodLevel, 20);
@@ -26,8 +44,17 @@ @@ -25,8 +43,17 @@
public void eat(Item item, ItemStack itemstack) { public void eat(Item item, ItemStack itemstack) {
if (item.isEdible()) { if (item.isEdible()) {
FoodInfo foodinfo = item.getFoodProperties(); FoodInfo foodinfo = item.getFoodProperties();
@ -54,7 +54,7 @@
} }
} }
@@ -41,7 +68,15 @@ @@ -40,7 +67,15 @@
if (this.saturationLevel > 0.0F) { if (this.saturationLevel > 0.0F) {
this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F); this.saturationLevel = Math.max(this.saturationLevel - 1.0F, 0.0F);
} else if (enumdifficulty != EnumDifficulty.PEACEFUL) { } else if (enumdifficulty != EnumDifficulty.PEACEFUL) {
@ -71,7 +71,7 @@
} }
} }
@@ -49,23 +84,25 @@ @@ -48,23 +83,25 @@
if (flag && this.saturationLevel > 0.0F && entityhuman.isHurt() && this.foodLevel >= 20) { if (flag && this.saturationLevel > 0.0F && entityhuman.isHurt() && this.foodLevel >= 20) {
++this.tickTimer; ++this.tickTimer;
@ -102,5 +102,5 @@
- if (this.tickTimer >= 80) { - if (this.tickTimer >= 80) {
+ if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation + if (this.tickTimer >= this.starvationRate) { // CraftBukkit - add regen rate manipulation
if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) { if (entityhuman.getHealth() > 10.0F || enumdifficulty == EnumDifficulty.HARD || entityhuman.getHealth() > 1.0F && enumdifficulty == EnumDifficulty.NORMAL) {
entityhuman.hurt(DamageSource.STARVE, 1.0F); entityhuman.hurt(entityhuman.damageSources().starve(), 1.0F);
} }

Datei anzeigen

@ -86,8 +86,8 @@
} }
l -= itemstack3.getCount() - j1; l -= itemstack3.getCount() - j1;
- slot1.set(itemstack3); - slot1.setByPlayer(itemstack3);
+ // slot1.set(itemstack3); + // slot1.setByPlayer(itemstack3);
+ draggedSlots.put(slot1.index, itemstack3); // CraftBukkit - Put in map instead of setting + draggedSlots.put(slot1.index, itemstack3); // CraftBukkit - Put in map instead of setting
} }
} }

Datei anzeigen

@ -10,11 +10,11 @@
+ +
public class ContainerAnvil extends ContainerAnvilAbstract { public class ContainerAnvil extends ContainerAnvilAbstract {
private static final Logger LOGGER = LogUtils.getLogger(); public static final int INPUT_SLOT = 0;
@@ -32,6 +36,11 @@ @@ -39,6 +43,11 @@
private static final int COST_REPAIR_SACRIFICE = 2; private static final int ADDITIONAL_SLOT_X_PLACEMENT = 76;
private static final int COST_INCOMPATIBLE_PENALTY = 1; private static final int RESULT_SLOT_X_PLACEMENT = 134;
private static final int COST_RENAME = 1; private static final int SLOT_Y_PLACEMENT = 47;
+ // CraftBukkit start + // CraftBukkit start
+ public static final int DEFAULT_DENIED_COST = -1; + public static final int DEFAULT_DENIED_COST = -1;
+ public int maximumRepairCost = 40; + public int maximumRepairCost = 40;
@ -23,7 +23,7 @@
public ContainerAnvil(int i, PlayerInventory playerinventory) { public ContainerAnvil(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL); this(i, playerinventory, ContainerAccess.NULL);
@@ -50,7 +59,7 @@ @@ -66,7 +75,7 @@
@Override @Override
protected boolean mayPickup(EntityHuman entityhuman, boolean flag) { protected boolean mayPickup(EntityHuman entityhuman, boolean flag) {
@ -32,7 +32,7 @@
} }
@Override @Override
@@ -73,7 +82,7 @@ @@ -89,7 +98,7 @@
this.inputSlots.setItem(1, ItemStack.EMPTY); this.inputSlots.setItem(1, ItemStack.EMPTY);
} }
@ -41,7 +41,7 @@
this.access.execute((world, blockposition) -> { this.access.execute((world, blockposition) -> {
IBlockData iblockdata = world.getBlockState(blockposition); IBlockData iblockdata = world.getBlockState(blockposition);
@@ -104,8 +113,8 @@ @@ -120,8 +129,8 @@
byte b1 = 0; byte b1 = 0;
if (itemstack.isEmpty()) { if (itemstack.isEmpty()) {
@ -52,7 +52,7 @@
} else { } else {
ItemStack itemstack1 = itemstack.copy(); ItemStack itemstack1 = itemstack.copy();
ItemStack itemstack2 = this.inputSlots.getItem(1); ItemStack itemstack2 = this.inputSlots.getItem(1);
@@ -122,8 +131,8 @@ @@ -138,8 +147,8 @@
if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) { if (itemstack1.isDamageableItem() && itemstack1.getItem().isValidRepairItem(itemstack, itemstack2)) {
k = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4); k = Math.min(itemstack1.getDamageValue(), itemstack1.getMaxDamage() / 4);
if (k <= 0) { if (k <= 0) {
@ -63,7 +63,7 @@
return; return;
} }
@@ -137,8 +146,8 @@ @@ -153,8 +162,8 @@
this.repairItemCountCost = i1; this.repairItemCountCost = i1;
} else { } else {
if (!flag && (!itemstack1.is(itemstack2.getItem()) || !itemstack1.isDamageableItem())) { if (!flag && (!itemstack1.is(itemstack2.getItem()) || !itemstack1.isDamageableItem())) {
@ -74,7 +74,7 @@
return; return;
} }
@@ -227,8 +236,8 @@ @@ -243,8 +252,8 @@
} }
if (flag2 && !flag1) { if (flag2 && !flag1) {
@ -85,7 +85,7 @@
return; return;
} }
} }
@@ -251,11 +260,11 @@ @@ -267,11 +276,11 @@
itemstack1 = ItemStack.EMPTY; itemstack1 = ItemStack.EMPTY;
} }
@ -100,7 +100,7 @@
itemstack1 = ItemStack.EMPTY; itemstack1 = ItemStack.EMPTY;
} }
@@ -274,7 +283,8 @@ @@ -290,7 +299,8 @@
EnchantmentManager.setEnchantments(map, itemstack1); EnchantmentManager.setEnchantments(map, itemstack1);
} }
@ -110,7 +110,7 @@
this.broadcastChanges(); this.broadcastChanges();
} }
} }
@@ -301,4 +311,18 @@ @@ -317,4 +327,18 @@
public int getCost() { public int getCost() {
return this.cost.get(); return this.cost.get();
} }

Datei anzeigen

@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java --- a/net/minecraft/world/inventory/ContainerAnvilAbstract.java
+++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java +++ b/net/minecraft/world/inventory/ContainerAnvilAbstract.java
@@ -92,6 +92,7 @@ @@ -124,6 +124,7 @@
@Override @Override
public boolean stillValid(EntityHuman entityhuman) { public boolean stillValid(EntityHuman entityhuman) {

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden Mehr anzeigen