mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Update to Minecraft 1.21
By: md_5 <git@md-5.net>
This commit is contained in:
parent
7c6204e1a9
commit
eed041d629
255 changed files with 3585 additions and 3261 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -136,6 +136,14 @@
|
||||
@@ -135,6 +135,14 @@
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class CommandDispatcher {
|
||||
|
||||
private static final ThreadLocal<ExecutionContext<CommandListenerWrapper>> CURRENT_EXECUTION_CONTEXT = new ThreadLocal();
|
||||
@@ -148,6 +156,7 @@
|
||||
@@ -147,6 +155,7 @@
|
||||
private final com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> dispatcher = new com.mojang.brigadier.CommandDispatcher();
|
||||
|
||||
public CommandDispatcher(CommandDispatcher.ServerType commanddispatcher_servertype, CommandBuildContext commandbuildcontext) {
|
||||
|
@ -23,7 +23,7 @@
|
|||
CommandAdvancement.register(this.dispatcher);
|
||||
CommandAttribute.register(this.dispatcher, commandbuildcontext);
|
||||
CommandExecute.register(this.dispatcher, commandbuildcontext);
|
||||
@@ -249,6 +258,11 @@
|
||||
@@ -247,6 +256,11 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
|
||||
}
|
||||
|
||||
@@ -259,18 +273,65 @@
|
||||
@@ -257,18 +271,65 @@
|
||||
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@
|
|||
|
||||
try {
|
||||
if (contextchain != null) {
|
||||
@@ -304,7 +365,7 @@
|
||||
@@ -302,7 +363,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -112,7 +112,7 @@
|
|||
try {
|
||||
validateParseResults(parseresults);
|
||||
return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> {
|
||||
@@ -315,7 +376,7 @@
|
||||
@@ -313,7 +374,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
|
@ -121,7 +121,7 @@
|
|||
});
|
||||
|
||||
if (i > 10) {
|
||||
@@ -365,7 +426,7 @@
|
||||
@@ -363,7 +424,7 @@
|
||||
|
||||
executioncontext1.close();
|
||||
} finally {
|
||||
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
} else {
|
||||
consumer.accept(executioncontext);
|
||||
@@ -374,11 +435,36 @@
|
||||
@@ -372,11 +433,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
|
@ -168,7 +168,7 @@
|
|||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -389,7 +475,7 @@
|
||||
@@ -387,7 +473,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
|
@ -177,7 +177,7 @@
|
|||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -412,7 +498,7 @@
|
||||
@@ -410,7 +496,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
|
||||
map.put(commandnode2, commandnode3);
|
||||
commandnode1.addChild(commandnode3);
|
||||
@@ -473,7 +559,7 @@
|
||||
@@ -471,7 +557,7 @@
|
||||
}
|
||||
|
||||
private <T> HolderLookup.b.a<T> createLookup(final HolderLookup.b<T> holderlookup_b) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
- private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newHashMap();
|
||||
+ private final Map<IBlockState<?>, Comparable<?>> properties = Maps.newLinkedHashMap(); // CraftBukkit - stable
|
||||
private final Map<String, String> vagueProperties = Maps.newHashMap();
|
||||
private MinecraftKey id = new MinecraftKey("");
|
||||
private MinecraftKey id = MinecraftKey.withDefaultNamespace("");
|
||||
@Nullable
|
||||
@@ -275,7 +275,7 @@
|
||||
Iterator iterator = iblockstate.getPossibleValues().iterator();
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
this.suggestions = this::suggestSelector;
|
||||
if (!this.reader.canRead()) {
|
||||
throw ArgumentParserSelector.ERROR_MISSING_SELECTOR_TYPE.createWithContext(this.reader);
|
||||
@@ -463,6 +465,12 @@
|
||||
@@ -494,6 +496,12 @@
|
||||
}
|
||||
|
||||
public EntitySelector parse() throws CommandSyntaxException {
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.startPosition = this.reader.getCursor();
|
||||
this.suggestions = this::suggestNameOrSelector;
|
||||
if (this.reader.canRead() && this.reader.peek() == '@') {
|
||||
@@ -471,7 +479,7 @@
|
||||
@@ -502,7 +510,7 @@
|
||||
}
|
||||
|
||||
this.reader.skip();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
+++ b/net/minecraft/commands/arguments/selector/EntitySelector.java
|
||||
@@ -92,7 +92,7 @@
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
|
||||
private void checkPermissions(CommandListenerWrapper commandlistenerwrapper) throws CommandSyntaxException {
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -227,47 +260,55 @@
|
||||
@@ -227,76 +260,89 @@
|
||||
return ItemInteractionResult.sidedSuccess(world.isClientSide);
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,9 @@
|
|||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.setItemInHand(enumhand, itemstack.transmuteCopy(Blocks.SHULKER_BOX, 1));
|
||||
ItemStack itemstack1 = itemstack.transmuteCopy(Blocks.SHULKER_BOX, 1);
|
||||
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false));
|
||||
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
|
@ -190,9 +192,7 @@
|
|||
ItemStack itemstack1 = itemstack.copyWithCount(1);
|
||||
|
||||
itemstack1.set(DataComponents.BANNER_PATTERNS, bannerpatternlayers.removeLast());
|
||||
@@ -281,28 +322,33 @@
|
||||
}
|
||||
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false));
|
||||
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
});
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch> STREAM_CODEC = new StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch>() {
|
||||
public DataComponentPatch decode(RegistryFriendlyByteBuf registryfriendlybytebuf) {
|
||||
@@ -143,7 +143,7 @@
|
||||
@@ -144,7 +144,7 @@
|
||||
}
|
||||
|
||||
private static <T> void encodeComponent(RegistryFriendlyByteBuf registryfriendlybytebuf, DataComponentType<T> datacomponenttype, Object object) {
|
||||
|
@ -18,7 +18,7 @@
|
|||
}
|
||||
};
|
||||
private static final String REMOVED_PREFIX = "!";
|
||||
@@ -270,6 +270,42 @@
|
||||
@@ -271,6 +271,42 @@
|
||||
|
||||
a() {}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/DispenseBehaviorItem.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorItem.java
|
||||
@@ -7,8 +7,23 @@
|
||||
@@ -7,10 +7,25 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
|
||||
|
@ -13,6 +13,8 @@
|
|||
+
|
||||
public class DispenseBehaviorItem implements IDispenseBehavior {
|
||||
|
||||
private static final int DEFAULT_ACCURACY = 6;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private boolean dropper;
|
||||
+
|
||||
|
@ -24,7 +26,7 @@
|
|||
public DispenseBehaviorItem() {}
|
||||
|
||||
@Override
|
||||
@@ -25,11 +40,22 @@
|
||||
@@ -27,11 +42,22 @@
|
||||
IPosition iposition = BlockDispenser.getDispensePosition(sourceblock);
|
||||
ItemStack itemstack1 = itemstack.split(1);
|
||||
|
||||
|
@ -48,7 +50,7 @@
|
|||
double d0 = iposition.x();
|
||||
double d1 = iposition.y();
|
||||
double d2 = iposition.z();
|
||||
@@ -44,7 +70,47 @@
|
||||
@@ -46,7 +72,47 @@
|
||||
double d3 = world.random.nextDouble() * 0.1D + 0.2D;
|
||||
|
||||
entityitem.setDeltaMovement(world.random.triangle((double) enumdirection.getStepX() * d3, 0.0172275D * (double) i), world.random.triangle(0.2D, 0.0172275D * (double) i), world.random.triangle((double) enumdirection.getStepZ() * d3, 0.0172275D * (double) i));
|
||||
|
|
|
@ -48,9 +48,9 @@
|
|||
- this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.isSuccess()) {
|
||||
itemstack.hurtAndBreak(1, worldserver.getRandom(), (EntityPlayer) null, () -> {
|
||||
itemstack.setCount(0);
|
||||
@@ -65,7 +95,7 @@
|
||||
itemstack.hurtAndBreak(1, worldserver, (EntityPlayer) null, (item) -> {
|
||||
});
|
||||
@@ -64,7 +94,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
List<EntityLiving> list = worldserver.getEntitiesOfClass(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -74,6 +104,11 @@
|
||||
@@ -73,6 +103,11 @@
|
||||
|
||||
if (entityliving instanceof IShearable ishearable) {
|
||||
if (ishearable.readyForShearing()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -66,6 +66,22 @@
|
||||
@@ -67,6 +67,22 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -93,14 +109,42 @@
|
||||
@@ -94,14 +110,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack);
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
sourceblock.level().gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, sourceblock.pos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -119,13 +163,41 @@
|
||||
@@ -120,13 +164,41 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = sourceblock.pos().relative(enumdirection);
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
@ -111,10 +111,11 @@
|
|||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -144,8 +216,35 @@
|
||||
@@ -145,7 +217,34 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
- ((ISaddleable) list.get(0)).equipSaddle(itemstack.split(1), SoundCategory.BLOCKS);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ WorldServer world = sourceblock.level();
|
||||
|
@ -141,10 +142,8 @@
|
|||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ ((ISaddleable) list.get(0)).equipSaddle(itemstack1, SoundCategory.BLOCKS);
|
||||
+ // CraftBukkit end
|
||||
((ISaddleable) list.get(0)).equipSaddle(SoundCategory.BLOCKS);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled above
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
|
@ -223,7 +222,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -249,9 +402,51 @@
|
||||
@@ -249,6 +402,38 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
||||
|
@ -261,22 +260,8 @@
|
|||
+
|
||||
if (dispensiblecontaineritem.emptyContents((EntityHuman) null, worldserver, blockposition, (MovingObjectPositionBlock) null)) {
|
||||
dispensiblecontaineritem.checkExtraContent((EntityHuman) null, worldserver, itemstack, blockposition);
|
||||
- return new ItemStack(Items.BUCKET);
|
||||
+ // CraftBukkit start - Handle stacked buckets
|
||||
+ Item item = Items.BUCKET;
|
||||
+ itemstack.shrink(1);
|
||||
+ if (itemstack.isEmpty()) {
|
||||
+ itemstack.setItem(Items.BUCKET);
|
||||
+ itemstack.setCount(1);
|
||||
+ } else if (sourceblock.blockEntity().addItem(new ItemStack(item)) < 0) {
|
||||
+ this.defaultDispenseItemBehavior.dispense(sourceblock, new ItemStack(item));
|
||||
+ }
|
||||
+ return itemstack;
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(sourceblock, itemstack);
|
||||
}
|
||||
@@ -278,7 +473,7 @@
|
||||
return this.consumeWithRemainder(sourceblock, itemstack, new ItemStack(Items.BUCKET));
|
||||
@@ -276,7 +461,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource ifluidsource) {
|
||||
|
@ -285,7 +270,7 @@
|
|||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.execute(sourceblock, itemstack);
|
||||
@@ -286,6 +481,32 @@
|
||||
@@ -284,6 +469,32 @@
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
|
@ -315,10 +300,10 @@
|
|||
+ itemstack1 = ifluidsource.pickupBlock((EntityHuman) null, worldserver, blockposition, iblockdata); // From above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -307,16 +528,44 @@
|
||||
return this.consumeWithRemainder(sourceblock, itemstack, new ItemStack(item));
|
||||
}
|
||||
} else {
|
||||
@@ -296,16 +507,44 @@
|
||||
protected ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
||||
|
@ -366,7 +351,7 @@
|
|||
BlockTNT.explode(worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
} else {
|
||||
@@ -342,12 +591,62 @@
|
||||
@@ -330,12 +569,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
|
@ -429,7 +414,7 @@
|
|||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -357,12 +656,41 @@
|
||||
@@ -345,12 +634,41 @@
|
||||
protected ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
|
@ -473,7 +458,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -387,6 +715,30 @@
|
||||
@@ -375,6 +693,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = sourceblock.pos().relative(enumdirection);
|
||||
|
||||
|
@ -504,7 +489,7 @@
|
|||
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.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -412,6 +764,30 @@
|
||||
@@ -400,6 +742,30 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
|
@ -535,7 +520,7 @@
|
|||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -461,6 +837,30 @@
|
||||
@@ -438,6 +804,30 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
|
@ -566,7 +551,7 @@
|
|||
if (iblockdata.is(TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
|
||||
return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BlockBeehive;
|
||||
}) && (Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL) >= 5) {
|
||||
@@ -510,6 +910,31 @@
|
||||
@@ -487,6 +877,31 @@
|
||||
this.setSuccess(false);
|
||||
return itemstack;
|
||||
} else {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
--- a/net/minecraft/network/NetworkManager.java
|
||||
+++ b/net/minecraft/network/NetworkManager.java
|
||||
@@ -114,6 +114,7 @@
|
||||
private volatile IChatBaseComponent delayedDisconnect;
|
||||
private volatile DisconnectionDetails delayedDisconnect;
|
||||
@Nullable
|
||||
BandwidthDebugMonitor bandwidthDebugMonitor;
|
||||
+ public String hostname = ""; // CraftBukkit - add field
|
||||
|
||||
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
|
||||
this.receiving = enumprotocoldirection;
|
||||
@@ -197,7 +198,7 @@
|
||||
@@ -205,7 +206,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) {
|
||||
|
@ -17,16 +17,16 @@
|
|||
}
|
||||
|
||||
private void validateListener(ProtocolInfo<?> protocolinfo, PacketListener packetlistener) {
|
||||
@@ -457,7 +458,7 @@
|
||||
@@ -469,7 +470,7 @@
|
||||
}
|
||||
|
||||
if (this.isConnected()) {
|
||||
- this.channel.close().awaitUninterruptibly();
|
||||
+ this.channel.close(); // We can't wait as this may be called from an event loop.
|
||||
this.disconnectedReason = ichatbasecomponent;
|
||||
this.disconnectionDetails = disconnectiondetails;
|
||||
}
|
||||
|
||||
@@ -525,7 +526,7 @@
|
||||
@@ -537,7 +538,7 @@
|
||||
}
|
||||
|
||||
public void configurePacketHandler(ChannelPipeline channelpipeline) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
|
||||
@@ -35,7 +35,22 @@
|
||||
@@ -36,7 +36,22 @@
|
||||
import net.minecraft.util.FormattedString;
|
||||
import net.minecraft.world.level.ChunkCoordIntPair;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
@@ -10,6 +10,11 @@
|
||||
@@ -11,6 +11,11 @@
|
||||
import net.minecraft.util.thread.IAsyncTaskHandler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class PlayerConnectionUtils {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -23,6 +28,7 @@
|
||||
@@ -24,6 +29,7 @@
|
||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isSameThread()) {
|
||||
iasynctaskhandler.executeIfPossible(() -> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/AdvancementDataWorld.java
|
||||
+++ b/net/minecraft/server/AdvancementDataWorld.java
|
||||
@@ -28,11 +28,15 @@
|
||||
@@ -27,11 +27,15 @@
|
||||
import net.minecraft.util.profiling.GameProfilerFiller;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
private AdvancementTree tree = new AdvancementTree();
|
||||
private final HolderLookup.a registries;
|
||||
|
||||
@@ -56,7 +60,7 @@
|
||||
@@ -55,7 +59,7 @@
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -29,6 +29,12 @@
|
||||
@@ -28,6 +28,12 @@
|
||||
import net.minecraft.world.level.block.BlockFire;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -40,6 +46,23 @@
|
||||
@@ -39,6 +45,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
DispenserRegistry.isBootstrapped = true;
|
||||
Instant instant = Instant.now();
|
||||
|
||||
@@ -59,6 +82,69 @@
|
||||
@@ -58,6 +81,69 @@
|
||||
wrapStreams();
|
||||
DispenserRegistry.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -168,13 +168,37 @@
|
||||
@@ -173,13 +173,38 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import com.mojang.serialization.Dynamic;
|
||||
+import com.mojang.serialization.Lifecycle;
|
||||
+import java.io.File;
|
||||
+import java.util.Random;
|
||||
+import jline.console.ConsoleReader;
|
||||
+import joptsimple.OptionSet;
|
||||
|
@ -28,7 +29,7 @@
|
|||
+import org.bukkit.event.server.ServerLoadEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ServerInfo, ICommandListener, AutoCloseable {
|
||||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ServerInfo, ChunkIOErrorReporter, ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String VANILLA_BRAND = "vanilla";
|
||||
|
@ -39,9 +40,9 @@
|
|||
private static final int OVERLOADED_TICKS_THRESHOLD = 20;
|
||||
private static final long OVERLOADED_WARNING_INTERVAL_NANOS = 10L * TimeRange.NANOSECONDS_PER_SECOND;
|
||||
private static final int OVERLOADED_TICKS_WARNING_INTERVAL = 100;
|
||||
@@ -260,6 +284,19 @@
|
||||
private final PotionBrewer potionBrewing;
|
||||
@@ -266,6 +291,19 @@
|
||||
private volatile boolean isSaving;
|
||||
private static final AtomicReference<RuntimeException> fatalException = new AtomicReference();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public final WorldLoader.a worldLoader;
|
||||
|
@ -59,7 +60,7 @@
|
|||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -273,14 +310,14 @@
|
||||
@@ -279,14 +317,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
|
@ -76,7 +77,7 @@
|
|||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -303,7 +340,7 @@
|
||||
@@ -309,7 +347,7 @@
|
||||
this.customBossEvents = new BossBattleCustomData();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
|
@ -85,7 +86,7 @@
|
|||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -328,6 +365,33 @@
|
||||
@@ -334,6 +372,33 @@
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
this.potionBrewing = PotionBrewer.bootstrap(this.worldData.enabledFeatures());
|
||||
}
|
||||
|
@ -119,7 +120,7 @@
|
|||
}
|
||||
|
||||
private void readScoreboard(WorldPersistentData worldpersistentdata) {
|
||||
@@ -336,7 +400,7 @@
|
||||
@@ -342,7 +407,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
|
@ -128,7 +129,7 @@
|
|||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -344,12 +408,8 @@
|
||||
@@ -350,12 +415,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
|
@ -142,7 +143,7 @@
|
|||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -366,23 +426,217 @@
|
||||
@@ -372,23 +433,217 @@
|
||||
|
||||
protected void forceDifficulty() {}
|
||||
|
||||
|
@ -173,7 +174,7 @@
|
|||
+ int dimension = 0;
|
||||
+
|
||||
+ if (dimensionKey == WorldDimension.NETHER) {
|
||||
+ if (isNetherEnabled()) {
|
||||
+ if (server.getAllowNether()) {
|
||||
+ dimension = -1;
|
||||
+ } else {
|
||||
+ continue;
|
||||
|
@ -374,7 +375,7 @@
|
|||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -406,30 +660,8 @@
|
||||
@@ -412,30 +667,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
|
@ -406,7 +407,7 @@
|
|||
|
||||
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -437,6 +669,21 @@
|
||||
@@ -443,6 +676,21 @@
|
||||
} else {
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
|
||||
|
@ -428,7 +429,7 @@
|
|||
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
|
||||
|
||||
if (i < worldserver.getMinBuildHeight()) {
|
||||
@@ -495,8 +742,11 @@
|
||||
@@ -501,8 +749,11 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
|
@ -442,7 +443,7 @@
|
|||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -506,20 +756,22 @@
|
||||
@@ -512,20 +763,22 @@
|
||||
|
||||
this.nextTickTimeNanos = SystemUtils.getNanos();
|
||||
worldserver.setDefaultSpawnPos(blockposition, worldserver.getSharedSpawnAngle());
|
||||
|
@ -473,7 +474,7 @@
|
|||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk.factory(), "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -534,10 +786,17 @@
|
||||
@@ -540,10 +793,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,7 +495,7 @@
|
|||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -567,12 +826,16 @@
|
||||
@@ -573,12 +833,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
|
@ -511,7 +512,7 @@
|
|||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -607,18 +870,40 @@
|
||||
@@ -613,18 +877,40 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
|
@ -552,7 +553,7 @@
|
|||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -706,7 +991,7 @@
|
||||
@@ -712,7 +998,7 @@
|
||||
}
|
||||
|
||||
this.nextTickTimeNanos = SystemUtils.getNanos();
|
||||
|
@ -561,7 +562,7 @@
|
|||
this.status = this.buildServerStatus();
|
||||
|
||||
while (this.running) {
|
||||
@@ -723,6 +1008,7 @@
|
||||
@@ -729,6 +1015,7 @@
|
||||
if (j > MinecraftServer.OVERLOADED_THRESHOLD_NANOS + 20L * i && this.nextTickTimeNanos - this.lastOverloadWarningNanos >= MinecraftServer.OVERLOADED_WARNING_INTERVAL_NANOS + 100L * i) {
|
||||
long k = j / i;
|
||||
|
||||
|
@ -569,7 +570,7 @@
|
|||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", j / TimeRange.NANOSECONDS_PER_MILLISECOND, k);
|
||||
this.nextTickTimeNanos += k * i;
|
||||
this.lastOverloadWarningNanos = this.nextTickTimeNanos;
|
||||
@@ -736,6 +1022,7 @@
|
||||
@@ -742,6 +1029,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
|
@ -577,7 +578,7 @@
|
|||
this.nextTickTimeNanos += i;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -783,6 +1070,12 @@
|
||||
@@ -789,6 +1077,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
|
@ -590,7 +591,7 @@
|
|||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -842,7 +1135,14 @@
|
||||
@@ -848,7 +1142,14 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
|
@ -605,8 +606,17 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected void waitUntilNextTick() {
|
||||
@@ -901,7 +1201,7 @@
|
||||
public static boolean throwIfFatalException() {
|
||||
@@ -862,7 +1163,7 @@
|
||||
}
|
||||
|
||||
public static void setFatalException(RuntimeException runtimeexception) {
|
||||
- MinecraftServer.fatalException.compareAndSet((Object) null, runtimeexception);
|
||||
+ MinecraftServer.fatalException.compareAndSet(null, runtimeexception); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -928,7 +1229,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +625,7 @@
|
|||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -960,8 +1260,10 @@
|
||||
@@ -987,8 +1288,10 @@
|
||||
}
|
||||
|
||||
--this.ticksUntilAutosave;
|
||||
|
@ -628,7 +638,7 @@
|
|||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -1049,11 +1351,26 @@
|
||||
@@ -1076,11 +1379,26 @@
|
||||
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
|
||||
entityplayer.connection.suspendFlushing();
|
||||
});
|
||||
|
@ -655,7 +665,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
@@ -1062,11 +1379,13 @@
|
||||
@@ -1089,11 +1407,13 @@
|
||||
|
||||
return s + " " + String.valueOf(worldserver.dimension().location());
|
||||
});
|
||||
|
@ -669,7 +679,7 @@
|
|||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1156,6 +1475,22 @@
|
||||
@@ -1183,6 +1503,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
|
@ -692,7 +702,7 @@
|
|||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1185,7 +1520,7 @@
|
||||
@@ -1212,7 +1548,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
@ -701,7 +711,7 @@
|
|||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport systemreport) {
|
||||
@@ -1527,11 +1862,11 @@
|
||||
@@ -1554,11 +1890,11 @@
|
||||
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
|
@ -715,7 +725,7 @@
|
|||
}, this).thenCompose((immutablelist) -> {
|
||||
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
|
||||
|
||||
@@ -1546,6 +1881,7 @@
|
||||
@@ -1573,6 +1909,7 @@
|
||||
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
|
||||
this.resources.close();
|
||||
this.resources = minecraftserver_reloadableresources;
|
||||
|
@ -723,7 +733,7 @@
|
|||
this.packRepository.setSelected(collection);
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1846,7 +2182,7 @@
|
||||
@@ -1873,7 +2210,7 @@
|
||||
final List<String> list = Lists.newArrayList();
|
||||
final GameRules gamerules = this.getGameRules();
|
||||
|
||||
|
@ -732,7 +742,7 @@
|
|||
@Override
|
||||
public <T extends GameRules.GameRuleValue<T>> void visit(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules.GameRuleDefinition<T> gamerules_gameruledefinition) {
|
||||
list.add(String.format(Locale.ROOT, "%s=%s\n", gamerules_gamerulekey.getId(), gamerules.getRule(gamerules_gamerulekey)));
|
||||
@@ -1952,7 +2288,7 @@
|
||||
@@ -1979,7 +2316,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
|
@ -741,7 +751,7 @@
|
|||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -2002,6 +2338,22 @@
|
||||
@@ -2029,6 +2366,22 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -764,7 +774,7 @@
|
|||
private void startMetricsRecordingTick() {
|
||||
if (this.willStartRecordingMetrics) {
|
||||
this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> {
|
||||
@@ -2132,6 +2484,11 @@
|
||||
@@ -2159,6 +2512,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -58,6 +58,18 @@
|
||||
@@ -60,6 +60,18 @@
|
||||
import net.minecraft.world.level.storage.Convertable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -66,7 +78,7 @@
|
||||
@@ -68,7 +80,7 @@
|
||||
private final List<ServerCommand> consoleInput = Collections.synchronizedList(Lists.newArrayList());
|
||||
@Nullable
|
||||
private RemoteStatusListener queryThreadGs4;
|
||||
|
@ -28,9 +28,9 @@
|
|||
@Nullable
|
||||
private RemoteControlListener rconThread;
|
||||
public DedicatedServerSettings settings;
|
||||
@@ -79,10 +91,12 @@
|
||||
@Nullable
|
||||
@@ -82,10 +94,12 @@
|
||||
private DebugSampleSubscriptionTracker debugSampleSubscriptionTracker;
|
||||
public ServerLinks serverLinks;
|
||||
|
||||
- public DedicatedServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- super(thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
|
||||
|
@ -42,9 +42,9 @@
|
|||
- this.rconConsoleSource = new RemoteControlCommandListener(this);
|
||||
+ // this.rconConsoleSource = new RemoteControlCommandListener(this); // CraftBukkit - remove field
|
||||
this.textFilterClient = TextFilter.createFromConfig(dedicatedserversettings.getProperties().textFilteringConfig);
|
||||
this.serverLinks = createServerLinks(dedicatedserversettings);
|
||||
}
|
||||
|
||||
@@ -90,13 +104,44 @@
|
||||
@@ -94,13 +108,44 @@
|
||||
public boolean initServer() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -105,6 +150,29 @@
|
||||
@@ -109,6 +154,29 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@
|
|||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
|
||||
thread.start();
|
||||
@@ -129,7 +197,7 @@
|
||||
@@ -133,7 +201,7 @@
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
|
||||
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
|
||||
|
@ -131,7 +131,7 @@
|
|||
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
@@ -153,6 +221,12 @@
|
||||
@@ -157,6 +225,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@
|
|||
if (!this.usesAuthentication()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -167,7 +241,7 @@
|
||||
@@ -171,7 +245,7 @@
|
||||
if (!NameReferencingFileConverter.serverReadyAfterUserconversion(this)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -153,7 +153,7 @@
|
|||
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
|
||||
this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME);
|
||||
long i = SystemUtils.getNanos();
|
||||
@@ -175,13 +249,13 @@
|
||||
@@ -179,13 +253,13 @@
|
||||
TileEntitySkull.setup(this.services, this);
|
||||
UserCache.setUsesAuthentication(this.usesAuthentication());
|
||||
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
|
||||
|
@ -169,7 +169,7 @@
|
|||
}
|
||||
|
||||
if (dedicatedserverproperties.enableQuery) {
|
||||
@@ -307,6 +381,7 @@
|
||||
@@ -311,6 +385,7 @@
|
||||
this.queryThreadGs4.stop();
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -328,7 +403,15 @@
|
||||
@@ -332,7 +407,15 @@
|
||||
while (!this.consoleInput.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
|
||||
|
||||
|
@ -194,7 +194,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -555,16 +638,52 @@
|
||||
@@ -559,16 +642,52 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -251,9 +251,9 @@
|
|||
}
|
||||
|
||||
public void storeUsingWhiteList(boolean flag) {
|
||||
@@ -641,4 +760,15 @@
|
||||
public boolean acceptsTransfers() {
|
||||
return this.settings.getProperties().acceptsTransfers;
|
||||
@@ -673,4 +792,15 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
public final boolean onlineMode = this.get("online-mode", true);
|
||||
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
|
||||
public final String serverIp = this.get("server-ip", "");
|
||||
@@ -104,8 +109,10 @@
|
||||
@@ -105,8 +110,10 @@
|
||||
public final WorldOptions worldOptions;
|
||||
public boolean acceptsTransfers;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
|
||||
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
|
||||
this.levelName = this.get("level-name", "world");
|
||||
@@ -164,13 +171,15 @@
|
||||
@@ -165,13 +172,15 @@
|
||||
this.initialDataPackConfiguration = getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -251,10 +260,10 @@
|
||||
@@ -252,10 +261,10 @@
|
||||
}).orElseThrow(() -> {
|
||||
return new IllegalStateException("Invalid datapack contents: can't find default preset");
|
||||
});
|
||||
|
@ -63,7 +63,7 @@
|
|||
});
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
@@ -266,7 +275,7 @@
|
||||
@@ -267,7 +276,7 @@
|
||||
|
||||
if (holder.is(WorldPresets.FLAT)) {
|
||||
RegistryOps<JsonElement> registryops = iregistrycustom.createSerializationContext(JsonOps.INSTANCE);
|
||||
|
|
|
@ -1,35 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -121,10 +121,25 @@
|
||||
}
|
||||
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
- this.chunksToUpdateFutures.forEach((playerchunk) -> {
|
||||
+ // CraftBukkit start
|
||||
+ // Iterate pending chunk updates with protection against concurrent modification exceptions
|
||||
+ java.util.Iterator<PlayerChunk> iter = this.chunksToUpdateFutures.iterator();
|
||||
+ int expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ do {
|
||||
+ PlayerChunk playerchunk = iter.next();
|
||||
+ iter.remove();
|
||||
+ expectedSize--;
|
||||
+
|
||||
playerchunk.updateFutures(playerchunkmap, this.mainThreadExecutor);
|
||||
- });
|
||||
- this.chunksToUpdateFutures.clear();
|
||||
+
|
||||
+ // Reset iterator if set was modified using add()
|
||||
+ if (this.chunksToUpdateFutures.size() != expectedSize) {
|
||||
+ expectedSize = this.chunksToUpdateFutures.size();
|
||||
+ iter = this.chunksToUpdateFutures.iterator();
|
||||
+ }
|
||||
+ } while (iter.hasNext());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
return true;
|
||||
} else {
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -160,7 +175,7 @@
|
||||
@@ -163,7 +163,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +9,7 @@
|
|||
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
|
||||
int j = getTicketLevelAt(arraysetsorted);
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
|
||||
@@ -170,13 +185,15 @@
|
||||
@@ -173,13 +173,15 @@
|
||||
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
|
||||
}
|
||||
|
||||
|
@ -56,7 +27,7 @@
|
|||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -184,6 +201,7 @@
|
||||
@@ -187,6 +189,7 @@
|
||||
}
|
||||
|
||||
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
||||
|
@ -64,7 +35,7 @@
|
|||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -197,19 +215,33 @@
|
||||
@@ -200,19 +203,33 @@
|
||||
}
|
||||
|
||||
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
|
@ -100,7 +71,7 @@
|
|||
}
|
||||
|
||||
private ArraySetSorted<Ticket<?>> getTickets(long i) {
|
||||
@@ -248,6 +280,7 @@
|
||||
@@ -251,6 +268,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
||||
long i = chunkcoordintpair.toLong();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
|
@ -108,7 +79,7 @@
|
|||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -377,6 +410,26 @@
|
||||
@@ -380,6 +398,26 @@
|
||||
return !this.tickets.isEmpty();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -81,6 +81,16 @@
|
||||
@@ -82,6 +82,16 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -124,7 +134,7 @@
|
||||
@@ -125,7 +135,7 @@
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
IChunkAccess ichunkaccess = this.lastChunk[l];
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +147,7 @@
|
||||
@@ -138,7 +148,7 @@
|
||||
Objects.requireNonNull(completablefuture);
|
||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||
ChunkResult<IChunkAccess> chunkresult = (ChunkResult) completablefuture.join();
|
||||
|
@ -35,22 +35,7 @@
|
|||
|
||||
if (ichunkaccess1 == null && flag) {
|
||||
throw (IllegalStateException) SystemUtils.pauseInIde(new IllegalStateException("Chunk not there when requested: " + chunkresult.getError()));
|
||||
@@ -170,12 +180,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
- ChunkResult<IChunkAccess> chunkresult = (ChunkResult) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow((Object) null);
|
||||
+ ChunkResult<IChunkAccess> chunkresult = (ChunkResult) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (chunkresult == null) {
|
||||
return null;
|
||||
} else {
|
||||
- IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -223,7 +233,15 @@
|
||||
@@ -218,7 +228,15 @@
|
||||
int l = ChunkLevel.byStatus(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
|
@ -67,16 +52,7 @@
|
|||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.chunkAbsent(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
@@ -242,7 +260,7 @@
|
||||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
|
||||
- return playerchunk == null || playerchunk.getTicketLevel() > i;
|
||||
+ return playerchunk == null || playerchunk.oldTicketLevel > i; // CraftBukkit using oldTicketLevel for isLoaded checks
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -315,11 +333,31 @@
|
||||
@@ -292,11 +310,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
@ -109,7 +85,7 @@
|
|||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -369,11 +407,11 @@
|
||||
@@ -346,11 +384,11 @@
|
||||
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
|
@ -123,7 +99,7 @@
|
|||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -576,13 +614,19 @@
|
||||
@@ -560,13 +598,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -165,6 +165,39 @@
|
||||
@@ -166,6 +166,42 @@
|
||||
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
|||
+import net.minecraft.world.damagesource.CombatTracker;
|
||||
+import net.minecraft.world.food.FoodMetaData;
|
||||
+import net.minecraft.world.inventory.ContainerPlayer;
|
||||
+import net.minecraft.world.item.enchantment.EnchantmentEffectComponents;
|
||||
+import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
+import net.minecraft.world.level.block.BlockChest;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
|
@ -24,12 +25,14 @@
|
|||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
+import org.bukkit.craftbukkit.util.CraftDimensionUtil;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.Player;
|
||||
+import org.bukkit.event.entity.EntityExhaustionEvent;
|
||||
+import org.bukkit.event.player.PlayerBedLeaveEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
|
||||
+import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
+import org.bukkit.event.player.PlayerLocaleChangeEvent;
|
||||
+import org.bukkit.event.player.PlayerPortalEvent;
|
||||
+import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
+import org.bukkit.event.player.PlayerSpawnChangeEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
|
||||
|
@ -40,7 +43,7 @@
|
|||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -203,7 +236,7 @@
|
||||
@@ -204,7 +240,7 @@
|
||||
private int levitationStartTime;
|
||||
private boolean disconnected;
|
||||
private int requestedViewDistance;
|
||||
|
@ -49,7 +52,7 @@
|
|||
@Nullable
|
||||
private Vec3D startingToFallPosition;
|
||||
@Nullable
|
||||
@@ -233,6 +266,21 @@
|
||||
@@ -235,6 +271,21 @@
|
||||
private int containerCounter;
|
||||
public boolean wonGame;
|
||||
|
||||
|
@ -71,8 +74,8 @@
|
|||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -299,12 +347,65 @@
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
@@ -302,14 +353,67 @@
|
||||
this.moveTo(this.adjustSpawnLocation(worldserver, worldserver.getSharedSpawnPos()).getBottomCenter(), 0.0F, 0.0F);
|
||||
this.updateOptions(clientinformation);
|
||||
this.object = null;
|
||||
+
|
||||
|
@ -130,15 +133,17 @@
|
|||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
private void fudgeSpawnLocation(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@Override
|
||||
public BlockPosition adjustSpawnLocation(WorldServer worldserver, BlockPosition blockposition) {
|
||||
AxisAlignedBB axisalignedbb = this.getDimensions(EntityPose.STANDING).makeBoundingBox(Vec3D.ZERO);
|
||||
BlockPosition blockposition1 = blockposition;
|
||||
|
||||
- if (worldserver.dimensionType().hasSkyLight() && worldserver.getServer().getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
|
||||
+ if (worldserver.dimensionType().hasSkyLight() && worldserver.serverLevelData.getGameType() != EnumGamemode.ADVENTURE) { // CraftBukkit
|
||||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -359,7 +460,7 @@
|
||||
@@ -366,7 +470,7 @@
|
||||
dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
|
@ -147,7 +152,7 @@
|
|||
this.wardenSpawnTracker = wardenspawntracker;
|
||||
});
|
||||
}
|
||||
@@ -374,17 +475,26 @@
|
||||
@@ -381,17 +485,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
|
@ -175,7 +180,7 @@
|
|||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -399,7 +509,7 @@
|
||||
@@ -406,7 +519,7 @@
|
||||
dataresult = BlockPosition.CODEC.parse(DynamicOpsNBT.INSTANCE, nbtbase);
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
|
@ -184,7 +189,7 @@
|
|||
this.raidOmenPosition = blockposition;
|
||||
});
|
||||
}
|
||||
@@ -409,7 +519,7 @@
|
||||
@@ -416,7 +529,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -193,7 +198,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -430,7 +540,20 @@
|
||||
@@ -437,7 +550,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
|
@ -215,7 +220,7 @@
|
|||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -455,6 +578,7 @@
|
||||
@@ -462,6 +588,7 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
|
@ -223,7 +228,7 @@
|
|||
|
||||
nbttagcompound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
|
||||
if (this.raidOmenPosition != null) {
|
||||
@@ -468,6 +592,29 @@
|
||||
@@ -475,6 +602,29 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -236,7 +241,7 @@
|
|||
+ if (this.respawnDimension != null) {
|
||||
+ world = this.server.getLevel(this.respawnDimension);
|
||||
+ if (world != null && this.getRespawnPosition() != null) {
|
||||
+ position = EntityHuman.findRespawnPositionAndUseSpawnBlock((WorldServer) world, this.getRespawnPosition(), this.getRespawnAngle(), false, false).orElse(null);
|
||||
+ position = EntityPlayer.findRespawnAndUseSpawnBlock((WorldServer) world, this.getRespawnPosition(), this.getRespawnAngle(), false, false).map(EntityPlayer.RespawnPosAngle::position).orElse(null);
|
||||
+ }
|
||||
+ }
|
||||
+ if (world == null || position == null) {
|
||||
|
@ -253,7 +258,7 @@
|
|||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -526,6 +673,11 @@
|
||||
@@ -533,6 +683,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -265,7 +270,7 @@
|
|||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -606,7 +758,7 @@
|
||||
@@ -613,7 +768,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
|
@ -274,7 +279,7 @@
|
|||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -637,6 +789,12 @@
|
||||
@@ -644,6 +799,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
|
@ -287,7 +292,7 @@
|
|||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -651,6 +809,20 @@
|
||||
@@ -658,6 +819,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
|
@ -308,7 +313,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -696,7 +868,8 @@
|
||||
@@ -703,7 +878,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
|
@ -318,7 +323,7 @@
|
|||
scoreaccess.set(i);
|
||||
});
|
||||
}
|
||||
@@ -705,9 +878,47 @@
|
||||
@@ -712,9 +888,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
|
@ -333,7 +338,7 @@
|
|||
- IChatBaseComponent ichatbasecomponent = this.getCombatTracker().getDeathMessage();
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.getInventory().getContents()) {
|
||||
+ if (!item.isEmpty() && !EnchantmentManager.hasVanishingCurse(item)) {
|
||||
+ if (!item.isEmpty() && EnchantmentManager.has(item, EnchantmentEffectComponents.PREVENT_EQUIPMENT_DROP)) {
|
||||
+ loot.add(CraftItemStack.asCraftMirror(item));
|
||||
+ }
|
||||
+ }
|
||||
|
@ -368,15 +373,15 @@
|
|||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -738,12 +949,18 @@
|
||||
@@ -745,12 +959,18 @@
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
-
|
||||
- if (!this.isSpectator()) {
|
||||
- this.dropAllDeathLoot(damagesource);
|
||||
- this.dropAllDeathLoot(this.serverLevel(), damagesource);
|
||||
+ // SPIGOT-5478 must be called manually now
|
||||
+ this.dropExperience();
|
||||
+ this.dropExperience(damagesource.getEntity());
|
||||
+ // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
|
||||
+ if (!event.getKeepInventory()) {
|
||||
+ this.getInventory().clearContent();
|
||||
|
@ -391,7 +396,7 @@
|
|||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -778,10 +995,12 @@
|
||||
@@ -785,10 +1005,12 @@
|
||||
if (entity != this) {
|
||||
super.awardKillScore(entity, i, damagesource);
|
||||
this.increaseScore(i);
|
||||
|
@ -406,7 +411,7 @@
|
|||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -799,7 +1018,8 @@
|
||||
@@ -806,7 +1028,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
|
@ -416,7 +421,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -849,18 +1069,20 @@
|
||||
@@ -856,10 +1079,16 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
|
@ -425,111 +430,152 @@
|
|||
+ return this.level().pvpMode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
ShapeDetectorShape shapedetectorshape = super.findDimensionEntryPoint(worldserver);
|
||||
+ worldserver = (shapedetectorshape == null) ? worldserver : shapedetectorshape.world; // CraftBukkit
|
||||
|
||||
- if (shapedetectorshape != null && this.level().dimension() == World.OVERWORLD && worldserver.dimension() == World.END) {
|
||||
+ if (shapedetectorshape != null && this.level().getTypeKey() == WorldDimension.OVERWORLD && worldserver != null && worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
Vec3D vec3d = shapedetectorshape.pos.add(0.0D, -1.0D, 0.0D);
|
||||
|
||||
- return new ShapeDetectorShape(vec3d, Vec3D.ZERO, 90.0F, 0.0F);
|
||||
+ return new ShapeDetectorShape(vec3d, Vec3D.ZERO, 90.0F, 0.0F, worldserver, shapedetectorshape.portalEventInfo); // CraftBukkit
|
||||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -869,11 +1091,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
- this.isChangingDimension = true;
|
||||
+ // CraftBukkit start
|
||||
+ return changeDimension(worldserver, TeleportCause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity changeDimension(WorldServer worldserver, PlayerTeleportEvent.TeleportCause cause) {
|
||||
- public DimensionTransition findRespawnPositionAndUseSpawnBlock(boolean flag, DimensionTransition.a dimensiontransition_a) {
|
||||
+ // CraftBukkit start
|
||||
+ public DimensionTransition findRespawnPositionAndUseSpawnBlock(boolean flag, DimensionTransition.a dimensiontransition_a, PlayerRespawnEvent.RespawnReason reason) {
|
||||
+ DimensionTransition dimensionTransition;
|
||||
+ boolean isBedSpawn = false;
|
||||
+ boolean isAnchorSpawn = false;
|
||||
+ // CraftBukkit end
|
||||
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
|
||||
+ // this.isChangingDimension = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
WorldServer worldserver1 = this.serverLevel();
|
||||
- ResourceKey<World> resourcekey = worldserver1.dimension();
|
||||
+ ResourceKey<WorldDimension> resourcekey = worldserver1.getTypeKey(); // CraftBukkit
|
||||
BlockPosition blockposition = this.getRespawnPosition();
|
||||
float f = this.getRespawnAngle();
|
||||
boolean flag1 = this.isRespawnForced();
|
||||
@@ -871,13 +1100,32 @@
|
||||
if (optional.isPresent()) {
|
||||
EntityPlayer.RespawnPosAngle entityplayer_respawnposangle = (EntityPlayer.RespawnPosAngle) optional.get();
|
||||
|
||||
- if (resourcekey == World.END && worldserver.dimension() == World.OVERWORLD) {
|
||||
+ if (resourcekey == WorldDimension.END && worldserver != null && worldserver.getTypeKey() == WorldDimension.OVERWORLD) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Moved down from above
|
||||
this.unRide();
|
||||
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -884,6 +1115,8 @@
|
||||
|
||||
return this;
|
||||
- return new DimensionTransition(worldserver, entityplayer_respawnposangle.position(), Vec3D.ZERO, entityplayer_respawnposangle.yaw(), 0.0F, dimensiontransition_a);
|
||||
+ // CraftBukkit start
|
||||
+ isBedSpawn = entityplayer_respawnposangle.isBedSpawn();
|
||||
+ isAnchorSpawn = entityplayer_respawnposangle.isAnchorSpawn();
|
||||
+ dimensionTransition = new DimensionTransition(worldserver, entityplayer_respawnposangle.position(), Vec3D.ZERO, entityplayer_respawnposangle.yaw(), 0.0F, dimensiontransition_a);
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
- return DimensionTransition.missingRespawnBlock(this.server.overworld(), this, dimensiontransition_a);
|
||||
+ dimensionTransition = DimensionTransition.missingRespawnBlock(this.server.overworld(), this, dimensiontransition_a); // CraftBukkit
|
||||
}
|
||||
} else {
|
||||
- return new DimensionTransition(this.server.overworld(), this, dimensiontransition_a);
|
||||
+ dimensionTransition = new DimensionTransition(this.server.overworld(), this, dimensiontransition_a); // CraftBukkit
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ if (reason == null) {
|
||||
+ return dimensionTransition;
|
||||
+ }
|
||||
+
|
||||
+ Player respawnPlayer = this.getBukkitEntity();
|
||||
+ Location location = CraftLocation.toBukkit(dimensionTransition.pos(), dimensionTransition.newLevel().getWorld(), dimensionTransition.yRot(), dimensionTransition.xRot());
|
||||
+
|
||||
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn, isAnchorSpawn, reason);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(respawnEvent);
|
||||
+
|
||||
+ location = respawnEvent.getRespawnLocation();
|
||||
+
|
||||
+ return new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), dimensionTransition.speed(), location.getYaw(), location.getPitch(), dimensionTransition.missingRespawnBlock(), dimensionTransition.postDimensionTransition(), dimensionTransition.cause());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static Optional<EntityPlayer.RespawnPosAngle> findRespawnAndUseSpawnBlock(WorldServer worldserver, BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
@@ -892,11 +1140,11 @@
|
||||
}
|
||||
|
||||
return optional.map((vec3d) -> {
|
||||
- return EntityPlayer.RespawnPosAngle.of(vec3d, blockposition);
|
||||
+ return EntityPlayer.RespawnPosAngle.of(vec3d, blockposition, false, true); // CraftBukkit
|
||||
});
|
||||
} else if (block instanceof BlockBed && BlockBed.canSetSpawn(worldserver)) {
|
||||
return BlockBed.findStandUpPosition(EntityTypes.PLAYER, worldserver, blockposition, (EnumDirection) iblockdata.getValue(BlockBed.FACING), f).map((vec3d) -> {
|
||||
- return EntityPlayer.RespawnPosAngle.of(vec3d, blockposition);
|
||||
+ return EntityPlayer.RespawnPosAngle.of(vec3d, blockposition, true, false); // CraftBukkit
|
||||
});
|
||||
} else if (!flag) {
|
||||
return Optional.empty();
|
||||
@@ -905,7 +1153,7 @@
|
||||
IBlockData iblockdata1 = worldserver.getBlockState(blockposition.above());
|
||||
boolean flag3 = iblockdata1.getBlock().isPossibleToRespawnInThis(iblockdata1);
|
||||
|
||||
- return flag2 && flag3 ? Optional.of(new EntityPlayer.RespawnPosAngle(new Vec3D((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.1D, (double) blockposition.getZ() + 0.5D), f)) : Optional.empty();
|
||||
+ return flag2 && flag3 ? Optional.of(new EntityPlayer.RespawnPosAngle(new Vec3D((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.1D, (double) blockposition.getZ() + 0.5D), f, false, false)) : Optional.empty(); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,6 +1171,7 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(DimensionTransition dimensiontransition) {
|
||||
+ if (this.isSleeping()) return null; // CraftBukkit - SPIGOT-3154
|
||||
if (this.isRemoved()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -932,14 +1181,21 @@
|
||||
|
||||
WorldServer worldserver = dimensiontransition.newLevel();
|
||||
WorldServer worldserver1 = this.serverLevel();
|
||||
- ResourceKey<World> resourcekey = worldserver1.dimension();
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
+ ResourceKey<WorldDimension> resourcekey = worldserver1.getTypeKey();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(this.createCommonSpawnInfo(worldserver), (byte) 3));
|
||||
@@ -893,20 +1126,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
ShapeDetectorShape shapedetectorshape = this.findDimensionEntryPoint(worldserver);
|
||||
- if (worldserver.dimension() == resourcekey) {
|
||||
- this.connection.teleport(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ if (worldserver != null && worldserver.dimension() == worldserver1.dimension()) { // CraftBukkit
|
||||
+ boolean result = this.connection.teleport(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot(), dimensiontransition.cause());
|
||||
+ if (!result) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.connection.resetPosition();
|
||||
dimensiontransition.postDimensionTransition().onTransition(this);
|
||||
return this;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ /*
|
||||
this.isChangingDimension = true;
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
if (shapedetectorshape != null) {
|
||||
@@ -950,15 +1206,40 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
worldserver1.getProfiler().push("moving");
|
||||
- if (resourcekey == World.OVERWORLD && worldserver.dimension() == World.NETHER) {
|
||||
+ worldserver = shapedetectorshape.world; // CraftBukkit
|
||||
+ if (worldserver == null) { } else // CraftBukkit - empty to fall through to null to event
|
||||
+ if (resourcekey == WorldDimension.OVERWORLD && worldserver.getTypeKey() == WorldDimension.NETHER) { // CraftBukkit
|
||||
+ if (worldserver != null && resourcekey == WorldDimension.OVERWORLD && worldserver.getTypeKey() == WorldDimension.NETHER) { // CraftBukkit - empty to fall through to null to event
|
||||
this.enteredNetherPosition = this.position();
|
||||
- } else if (worldserver.dimension() == World.END) {
|
||||
+ } else if (worldserver.getTypeKey() == WorldDimension.END && shapedetectorshape.portalEventInfo != null && shapedetectorshape.portalEventInfo.getCanCreatePortal()) { // CraftBukkit
|
||||
this.createEndPlatform(worldserver, BlockPosition.containing(shapedetectorshape.pos));
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ return null;
|
||||
+ }
|
||||
+ Location enter = this.getBukkitEntity().getLocation();
|
||||
+ Location exit = (worldserver == null) ? null : CraftLocation.toBukkit(shapedetectorshape.pos, worldserver.getWorld(), shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, cause);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
||||
+ if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ exit = tpEvent.getTo();
|
||||
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
+ Location enter = this.getBukkitEntity().getLocation();
|
||||
+ Location exit = (worldserver == null) ? null : CraftLocation.toBukkit(dimensiontransition.pos(), worldserver.getWorld(), dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ PlayerTeleportEvent tpEvent = new PlayerTeleportEvent(this.getBukkitEntity(), enter, exit, dimensiontransition.cause());
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(tpEvent);
|
||||
+ if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ exit = tpEvent.getTo();
|
||||
+ worldserver = ((CraftWorld) exit.getWorld()).getHandle();
|
||||
+ // CraftBukkit end
|
||||
|
||||
- worldserver1.getProfiler().pop();
|
||||
- worldserver1.getProfiler().push("placing");
|
||||
+ worldserver1.getProfiler().pop();
|
||||
+ worldserver1.getProfiler().push("placing");
|
||||
+ if (true) { // CraftBukkit
|
||||
worldserver1.getProfiler().pop();
|
||||
worldserver1.getProfiler().push("placing");
|
||||
+ // CraftBukkit start
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
+ WorldData worlddata = worldserver.getLevelData();
|
||||
+
|
||||
+ this.connection.send(new PacketPlayOutRespawn(this.createCommonSpawnInfo(worldserver), (byte) 3));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level().getDifficulty(), this.level().getLevelData().isDifficultyLocked()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
+ playerlist.sendPlayerPermissionLevel(this);
|
||||
+ worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.unsetRemoved();
|
||||
+
|
||||
+ // CraftBukkit end
|
||||
this.setServerLevel(worldserver);
|
||||
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
- this.connection.teleport(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver.addDuringTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
@@ -926,39 +1189,66 @@
|
||||
@@ -971,21 +1252,47 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -538,17 +584,15 @@
|
|||
+ PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
+ // CraftBukkit end
|
||||
return this;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Vec3D exitPosition, TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ Location enter = this.getBukkitEntity().getLocation();
|
||||
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld(), getYRot(), getXRot());
|
||||
+ PlayerPortalEvent event = new PlayerPortalEvent(this.getBukkitEntity(), enter, exit, cause, searchRadius, true, creationRadius);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled() || event.getTo() == null || event.getTo().getWorld() == null) {
|
||||
|
@ -558,51 +602,6 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
private void createEndPlatform(WorldServer worldserver, BlockPosition blockposition) {
|
||||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldserver); // CraftBukkit
|
||||
|
||||
for (int i = -2; i <= 2; ++i) {
|
||||
for (int j = -2; j <= 2; ++j) {
|
||||
for (int k = -1; k < 3; ++k) {
|
||||
IBlockData iblockdata = k == -1 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState();
|
||||
|
||||
- worldserver.setBlockAndUpdate(blockposition_mutableblockposition.set(blockposition).move(j, k, i), iblockdata);
|
||||
+ blockList.setBlock(blockposition_mutableblockposition.set(blockposition).move(j, k, i), iblockdata, 3); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit start - call portal event
|
||||
+ org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((List<org.bukkit.block.BlockState>) (List) blockList.getList(), worldserver.getWorld(), this.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM);
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(portalEvent);
|
||||
+ if (!portalEvent.isCancelled()) {
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
- Optional<BlockUtil.Rectangle> optional = super.getExitPortal(worldserver, blockposition, flag, worldborder);
|
||||
+ protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) { // CraftBukkit
|
||||
+ Optional<BlockUtil.Rectangle> optional = super.getExitPortal(worldserver, blockposition, flag, worldborder, searchRadius, canCreatePortal, createRadius); // CraftBukkit
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
+ if (optional.isPresent() || !canCreatePortal) { // CraftBukkit
|
||||
return optional;
|
||||
} else {
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = (EnumDirection.EnumAxis) this.level().getBlockState(this.portalEntrancePos).getOptionalValue(BlockPortal.AXIS).orElse(EnumDirection.EnumAxis.X);
|
||||
- Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition, enumdirection_enumaxis);
|
||||
+ Optional<BlockUtil.Rectangle> optional1 = worldserver.getPortalForcer().createPortal(blockposition, enumdirection_enumaxis, this, createRadius); // CraftBukkit
|
||||
|
||||
if (optional1.isEmpty()) {
|
||||
- EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder");
|
||||
+ // EntityPlayer.LOGGER.error("Unable to create a portal, likely target out of worldborder"); // CraftBukkit
|
||||
}
|
||||
|
||||
return optional1;
|
||||
@@ -968,13 +1258,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
|
@ -627,7 +626,7 @@
|
|||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -991,19 +1289,17 @@
|
||||
@@ -1002,19 +1309,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
|
@ -651,7 +650,7 @@
|
|||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -1020,7 +1316,36 @@
|
||||
@@ -1031,7 +1336,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,7 +688,7 @@
|
|||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -1033,9 +1358,8 @@
|
||||
@@ -1044,9 +1378,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
|
@ -700,7 +699,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1062,13 +1386,31 @@
|
||||
@@ -1073,13 +1406,31 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
|
@ -733,7 +732,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1135,8 +1477,9 @@
|
||||
@@ -1146,8 +1497,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
|
@ -744,7 +743,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1144,13 +1487,35 @@
|
||||
@@ -1155,13 +1507,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -780,7 +779,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1158,9 +1523,11 @@
|
||||
@@ -1169,9 +1543,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -794,13 +793,13 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1173,13 +1540,24 @@
|
||||
@@ -1184,15 +1560,26 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
+ // CraftBukkit start - Inventory open hook
|
||||
+ this.nextContainerCounter();
|
||||
+ Container container = new ContainerHorse(this.containerCounter, this.getInventory(), iinventory, entityhorseabstract);
|
||||
+ Container container = new ContainerHorse(this.containerCounter, this.getInventory(), iinventory, entityhorseabstract, entityhorseabstract.getInventoryColumns());
|
||||
+ container.setTitle(entityhorseabstract.getDisplayName());
|
||||
+ container = CraftEventFactory.callInventoryOpenEvent(this, container);
|
||||
+
|
||||
|
@ -815,13 +814,15 @@
|
|||
|
||||
- this.nextContainerCounter();
|
||||
+ // this.nextContainerCounter(); // CraftBukkit - moved up
|
||||
this.connection.send(new PacketPlayOutOpenWindowHorse(this.containerCounter, iinventory.getContainerSize(), entityhorseabstract.getId()));
|
||||
- this.containerMenu = new ContainerHorse(this.containerCounter, this.getInventory(), iinventory, entityhorseabstract);
|
||||
int i = entityhorseabstract.getInventoryColumns();
|
||||
|
||||
this.connection.send(new PacketPlayOutOpenWindowHorse(this.containerCounter, i, entityhorseabstract.getId()));
|
||||
- this.containerMenu = new ContainerHorse(this.containerCounter, this.getInventory(), iinventory, entityhorseabstract, i);
|
||||
+ this.containerMenu = container; // CraftBukkit
|
||||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1202,6 +1580,7 @@
|
||||
@@ -1215,6 +1602,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
|
@ -829,7 +830,7 @@
|
|||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1224,6 +1603,16 @@
|
||||
@@ -1237,6 +1625,16 @@
|
||||
}
|
||||
|
||||
this.jumping = flag;
|
||||
|
@ -846,7 +847,7 @@
|
|||
this.setShiftKeyDown(flag1);
|
||||
}
|
||||
|
||||
@@ -1257,19 +1646,19 @@
|
||||
@@ -1270,19 +1668,19 @@
|
||||
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
|
||||
if (i > 0) {
|
||||
this.awardStat(StatisticList.SWIM_ONE_CM, i);
|
||||
|
@ -869,7 +870,7 @@
|
|||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (d1 > 0.0D) {
|
||||
@@ -1280,13 +1669,13 @@
|
||||
@@ -1293,13 +1691,13 @@
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
||||
|
@ -886,7 +887,7 @@
|
|||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -1329,7 +1718,7 @@
|
||||
@@ -1342,7 +1740,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
|
@ -895,7 +896,7 @@
|
|||
scoreaccess.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1337,7 +1726,7 @@
|
||||
@@ -1350,7 +1748,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
|
@ -904,7 +905,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1385,6 +1774,7 @@
|
||||
@@ -1398,6 +1796,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
|
@ -912,7 +913,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1442,7 +1832,7 @@
|
||||
@@ -1465,7 +1864,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -921,7 +922,7 @@
|
|||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.chunkTrackingView = entityplayer.chunkTrackingView;
|
||||
@@ -1493,6 +1883,12 @@
|
||||
@@ -1516,6 +1915,12 @@
|
||||
|
||||
@Override
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
|
@ -934,7 +935,7 @@
|
|||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1502,9 +1898,9 @@
|
||||
@@ -1525,9 +1930,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == this.level()) {
|
||||
|
@ -946,7 +947,7 @@
|
|||
}
|
||||
|
||||
this.setYHeadRot(f);
|
||||
@@ -1606,6 +2002,16 @@
|
||||
@@ -1635,6 +2040,16 @@
|
||||
}
|
||||
|
||||
public void updateOptions(ClientInformation clientinformation) {
|
||||
|
@ -963,7 +964,7 @@
|
|||
this.language = clientinformation.language();
|
||||
this.requestedViewDistance = clientinformation.viewDistance();
|
||||
this.chatVisibility = clientinformation.chatVisibility();
|
||||
@@ -1689,7 +2095,7 @@
|
||||
@@ -1718,7 +2133,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -972,7 +973,7 @@
|
|||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1726,7 +2132,7 @@
|
||||
@@ -1755,7 +2170,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
|
@ -981,7 +982,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1747,9 +2153,16 @@
|
||||
@@ -1776,14 +2191,24 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
|
@ -998,9 +999,7 @@
|
|||
if (worldserver == this.level()) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1769,6 +2182,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
this.changeDimension(new DimensionTransition(worldserver, new Vec3D(d0, d1, d2), Vec3D.ZERO, f, f1, DimensionTransition.DO_NOTHING));
|
||||
}
|
||||
+ */
|
||||
+ this.getBukkitEntity().teleport(new Location(worldserver.getWorld(), d0, d1, d2, f, f1), cause);
|
||||
|
@ -1008,7 +1007,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1790,6 +2206,32 @@
|
||||
@@ -1809,6 +2234,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
|
@ -1041,9 +1040,25 @@
|
|||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -2011,4 +2453,147 @@
|
||||
public BlockPosition getRaidOmenPosition() {
|
||||
return this.raidOmenPosition;
|
||||
@@ -2049,10 +2500,12 @@
|
||||
this.awardStat(StatisticList.ITEM_BROKEN.get(item));
|
||||
}
|
||||
|
||||
- public static record RespawnPosAngle(Vec3D position, float yaw) {
|
||||
+ // CraftBukkit start
|
||||
+ public static record RespawnPosAngle(Vec3D position, float yaw, boolean isBedSpawn, boolean isAnchorSpawn) {
|
||||
|
||||
- public static EntityPlayer.RespawnPosAngle of(Vec3D vec3d, BlockPosition blockposition) {
|
||||
- return new EntityPlayer.RespawnPosAngle(vec3d, calculateLookAtYaw(vec3d, blockposition));
|
||||
+ public static EntityPlayer.RespawnPosAngle of(Vec3D vec3d, BlockPosition blockposition, boolean isBedSpawn, boolean isAnchorSpawn) {
|
||||
+ return new EntityPlayer.RespawnPosAngle(vec3d, calculateLookAtYaw(vec3d, blockposition), isBedSpawn, isAnchorSpawn);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
private static float calculateLookAtYaw(Vec3D vec3d, BlockPosition blockposition) {
|
||||
@@ -2061,4 +2514,147 @@
|
||||
return (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
+ public EntityTrackerEntry(WorldServer worldserver, Entity entity, int i, boolean flag, Consumer<Packet<?>> consumer, Set<ServerPlayerConnection> trackedPlayers) {
|
||||
+ this.trackedPlayers = trackedPlayers;
|
||||
+ // CraftBukkit end
|
||||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -91,7 +101,7 @@
|
||||
this.broadcast = consumer;
|
||||
this.entity = entity;
|
||||
@@ -90,7 +100,7 @@
|
||||
List<Entity> list = this.entity.getPassengers();
|
||||
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
|
@ -36,7 +36,7 @@
|
|||
removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof EntityPlayer entityplayer) {
|
||||
entityplayer.connection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
@@ -104,18 +114,18 @@
|
||||
@@ -103,18 +113,18 @@
|
||||
Entity entity = this.entity;
|
||||
|
||||
if (entity instanceof EntityItemFrame entityitemframe) {
|
||||
|
@ -59,11 +59,10 @@
|
|||
|
||||
worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(mapid, entityplayer);
|
||||
@@ -228,7 +238,27 @@
|
||||
@@ -232,6 +242,27 @@
|
||||
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
- this.broadcastAndSend(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ // CraftBukkit start - Create PlayerVelocity event
|
||||
+ boolean cancelled = false;
|
||||
+
|
||||
|
@ -81,14 +80,14 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!cancelled) {
|
||||
+ this.broadcastAndSend(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ if (cancelled) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entity = this.entity;
|
||||
if (entity instanceof EntityFireball) {
|
||||
EntityFireball entityfireball = (EntityFireball) entity;
|
||||
@@ -263,7 +293,10 @@
|
||||
this.entity.hurtMarked = false;
|
||||
this.broadcastAndSend(new PacketPlayOutEntityVelocity(this.entity));
|
||||
}
|
||||
@@ -260,7 +291,10 @@
|
||||
|
||||
public void sendPairingData(EntityPlayer entityplayer, Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
if (this.entity.isRemoved()) {
|
||||
|
@ -99,8 +98,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
|
||||
@@ -279,6 +312,12 @@
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket(this);
|
||||
@@ -275,6 +309,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
|
||||
|
||||
|
@ -113,7 +112,7 @@
|
|||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -310,6 +349,7 @@
|
||||
@@ -305,6 +345,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
|
@ -121,8 +120,8 @@
|
|||
}
|
||||
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
@@ -343,6 +383,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
@@ -358,6 +399,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getAttributesToSync();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
+ // CraftBukkit start - Send scaled max health
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -34,6 +34,10 @@
|
||||
@@ -28,6 +28,10 @@
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
|
@ -8,47 +8,40 @@
|
|||
+import net.minecraft.server.MinecraftServer;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PlayerChunk {
|
||||
public class PlayerChunk extends GenerationChunkHolder {
|
||||
|
||||
public static final ChunkResult<IChunkAccess> UNLOADED_CHUNK = ChunkResult.error("Unloaded chunk");
|
||||
@@ -70,12 +74,12 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
public static final ChunkResult<Chunk> UNLOADED_LEVEL_CHUNK = ChunkResult.error("Unloaded level chunk");
|
||||
@@ -58,9 +62,9 @@
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
- this.chunkToSave = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.chunkToSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.chunkToSaveHistory = null;
|
||||
this.blockChangedLightSectionFilter = new BitSet();
|
||||
this.skyChangedLightSectionFilter = new BitSet();
|
||||
- this.pendingFullStateConfirmation = CompletableFuture.completedFuture((Object) null);
|
||||
- this.sendSync = CompletableFuture.completedFuture((Object) null);
|
||||
- this.saveSync = CompletableFuture.completedFuture((Object) null);
|
||||
+ this.pendingFullStateConfirmation = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
+ this.sendSync = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.pos = chunkcoordintpair;
|
||||
+ this.saveSync = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = levellightengine;
|
||||
@@ -88,6 +92,20 @@
|
||||
this.onLevelChange = playerchunk_a;
|
||||
@@ -72,6 +76,16 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Chunk getFullChunkNow() {
|
||||
+ // Note: We use the oldTicketLevel for isLoaded checks.
|
||||
+ if (!ChunkLevel.fullStatus(this.oldTicketLevel).isOrAfter(FullChunkStatus.FULL)) return null;
|
||||
+ return this.getFullChunkNowUnchecked();
|
||||
+ return (Chunk) this.getChunkIfPresent(ChunkStatus.FULL);
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getFullChunkNowUnchecked() {
|
||||
+ CompletableFuture<ChunkResult<IChunkAccess>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
|
||||
+ ChunkResult<IChunkAccess> either = statusFuture.getNow(null);
|
||||
+ return (either == null) ? null : (Chunk) either.orElse(null);
|
||||
+ return (Chunk) this.getChunkIfPresentUnchecked(ChunkStatus.FULL);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CompletableFuture<ChunkResult<IChunkAccess>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<ChunkResult<IChunkAccess>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
|
||||
|
||||
@@ -112,7 +130,7 @@
|
||||
public CompletableFuture<ChunkResult<Chunk>> getTickingChunkFuture() {
|
||||
return this.tickingChunkFuture;
|
||||
}
|
||||
@@ -86,7 +100,7 @@
|
||||
|
||||
@Nullable
|
||||
public Chunk getTickingChunk() {
|
||||
|
@ -56,8 +49,8 @@
|
|||
+ return (Chunk) ((ChunkResult) this.getTickingChunkFuture().getNow(PlayerChunk.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public CompletableFuture<?> getChunkSendSyncFuture() {
|
||||
@@ -166,6 +184,7 @@
|
||||
@Nullable
|
||||
@@ -134,6 +148,7 @@
|
||||
if (chunk != null) {
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
|
@ -65,16 +58,7 @@
|
|||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
|
||||
@@ -176,7 +195,7 @@
|
||||
}
|
||||
|
||||
public void sectionLightChanged(EnumSkyBlock enumskyblock, int i) {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) ((ChunkResult) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(PlayerChunk.UNLOADED_CHUNK)).orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) ((ChunkResult) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(PlayerChunk.UNLOADED_CHUNK)).orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess != null) {
|
||||
ichunkaccess.setUnsaved(true);
|
||||
@@ -240,8 +259,11 @@
|
||||
@@ -208,8 +223,11 @@
|
||||
PacketPlayOutMultiBlockChange packetplayoutmultiblockchange = new PacketPlayOutMultiBlockChange(sectionposition, shortset, chunksection);
|
||||
|
||||
this.broadcast(list, packetplayoutmultiblockchange);
|
||||
|
@ -87,7 +71,7 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
@@ -374,7 +396,7 @@
|
||||
@@ -275,7 +293,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((chunkresult) -> {
|
||||
chunkresult.ifSuccess((chunk) -> {
|
||||
|
@ -96,14 +80,14 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
@@ -391,6 +413,30 @@
|
||||
boolean flag1 = ChunkLevel.isLoaded(this.ticketLevel);
|
||||
FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||
@@ -290,6 +308,30 @@
|
||||
FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
||||
boolean flag = fullchunkstatus.isOrAfter(FullChunkStatus.FULL);
|
||||
boolean flag1 = fullchunkstatus1.isOrAfter(FullChunkStatus.FULL);
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
+ if (fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && !fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ if (flag && !flag1) {
|
||||
+ this.getFullChunkFuture().thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk) either.orElse(null);
|
||||
+ if (chunk != null) {
|
||||
+ playerchunkmap.callbackExecutor.execute(() -> {
|
||||
|
@ -125,16 +109,16 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (flag) {
|
||||
ChunkResult<IChunkAccess> chunkresult = ChunkResult.error(() -> {
|
||||
@@ -459,6 +505,26 @@
|
||||
this.wasAccessibleSinceLastSave |= flag1;
|
||||
if (!flag && flag1) {
|
||||
@@ -341,6 +383,26 @@
|
||||
|
||||
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
+ if (!fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ this.getFullChunkFuture().thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk) either.orElse(null);
|
||||
+ if (chunk != null) {
|
||||
+ playerchunkmap.callbackExecutor.execute(() -> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -104,6 +104,10 @@
|
||||
@@ -102,6 +102,10 @@
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -8,12 +8,12 @@
|
|||
+import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.c {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.b, GeneratingChunkMap {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -146,6 +150,27 @@
|
||||
private static final ChunkResult<List<IChunkAccess>> UNLOADED_CHUNK_LIST_RESULT = ChunkResult.error("Unloaded chunks found in range");
|
||||
@@ -145,6 +149,27 @@
|
||||
public int serverViewDistance;
|
||||
private WorldGenContext worldGenContext;
|
||||
private final WorldGenContext worldGenContext;
|
||||
|
||||
+ // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||
+ public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
||||
|
@ -39,7 +39,7 @@
|
|||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(new RegionStorageInfo(convertable_conversionsession.getLevelId(), worldserver.dimension(), "chunk"), convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -166,7 +191,13 @@
|
||||
@@ -164,7 +189,13 @@
|
||||
IRegistryCustom iregistrycustom = worldserver.registryAccess();
|
||||
long j = worldserver.getSeed();
|
||||
|
||||
|
@ -54,21 +54,7 @@
|
|||
this.randomState = RandomState.create((GeneratorSettingBase) chunkgeneratorabstract.generatorSettings().value(), (HolderGetter) iregistrycustom.lookupOrThrow(Registries.NOISE), j);
|
||||
} else {
|
||||
this.randomState = RandomState.create(GeneratorSettingBase.dummy(), (HolderGetter) iregistrycustom.lookupOrThrow(Registries.NOISE), j);
|
||||
@@ -332,16 +363,19 @@
|
||||
CompletableFuture<List<ChunkResult<IChunkAccess>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<ChunkResult<List<IChunkAccess>>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- int l1 = 0;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ int cnt = 0;
|
||||
|
||||
- for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++l1) {
|
||||
+ for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++cnt) {
|
||||
+ final int l1 = cnt;
|
||||
+ // CraftBukkit end
|
||||
ChunkResult<IChunkAccess> chunkresult = (ChunkResult) iterator.next();
|
||||
|
||||
if (chunkresult == null) {
|
||||
@@ -318,7 +349,7 @@
|
||||
throw this.debugFuturesAndCreateReportedException(new IllegalStateException("At least one of the chunk futures were null"), "n/a");
|
||||
}
|
||||
|
||||
|
@ -76,68 +62,18 @@
|
|||
+ IChunkAccess ichunkaccess = (IChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess == null) {
|
||||
return ChunkResult.error(() -> {
|
||||
@@ -538,7 +572,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
- Consumer consumer = (ichunkaccess) -> {
|
||||
+ Consumer<IChunkAccess> consumer = (ichunkaccess) -> { // CraftBukkit - decompile error
|
||||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -708,7 +742,7 @@
|
||||
};
|
||||
|
||||
return completablefuture.thenComposeAsync((chunkresult) -> {
|
||||
- List<IChunkAccess> list = (List) chunkresult.orElse((Object) null);
|
||||
+ List<IChunkAccess> list = (List) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (list == null) {
|
||||
this.releaseLightTicket(chunkcoordintpair);
|
||||
@@ -773,7 +807,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
- worldserver.addWorldGenChunkEntities(EntityTypes.loadEntitiesRecursive(list, worldserver));
|
||||
+ // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities
|
||||
+ worldserver.addWorldGenChunkEntities(EntityTypes.loadEntitiesRecursive(list, worldserver).filter((entity) -> {
|
||||
+ boolean needsRemoval = false;
|
||||
+ net.minecraft.server.dedicated.DedicatedServer server = worldserver.getCraftServer().getServer();
|
||||
+ if (!server.areNpcsEnabled() && entity instanceof net.minecraft.world.entity.npc.NPC) {
|
||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ if (!server.isSpawningAnimals() && (entity instanceof net.minecraft.world.entity.animal.EntityAnimal || entity instanceof net.minecraft.world.entity.animal.EntityWaterAnimal)) {
|
||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
+ needsRemoval = true;
|
||||
+ }
|
||||
+ return !needsRemoval;
|
||||
+ }));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
@@ -879,7 +927,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkToSave().getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -1040,7 +1088,8 @@
|
||||
return PlayerChunkMap.UNLOADED_CHUNK_LIST_RESULT;
|
||||
@@ -937,7 +968,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
- csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getStatus).orElse((Object) null), optional1.map(Chunk::getFullStatus).orElse((Object) null), printFuture(playerchunk.getFullChunkFuture()), printFuture(playerchunk.getTickingChunkFuture()), printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
- csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getPersistedStatus).orElse((Object) null), optional1.map(Chunk::getFullStatus).orElse((Object) null), printFuture(playerchunk.getFullChunkFuture()), printFuture(playerchunk.getTickingChunkFuture()), printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
+ // CraftBukkit - decompile error
|
||||
+ csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getStatus).orElse(null), optional1.map(Chunk::getFullStatus).orElse(null), printFuture(playerchunk.getFullChunkFuture()), printFuture(playerchunk.getTickingChunkFuture()), printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
+ csvwriter.writeRow(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getPersistedStatus).orElse(null), optional1.map(Chunk::getFullStatus).orElse(null), printFuture(playerchunk.getFullChunkFuture()), printFuture(playerchunk.getTickingChunkFuture()), printFuture(playerchunk.getEntityTickingChunkFuture()), this.distanceManager.getTicketDebugString(i), this.anyPlayerCloseEnoughForSpawning(chunkcoordintpair), optional1.map((chunk) -> {
|
||||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -1053,7 +1102,7 @@
|
||||
@@ -950,7 +982,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<ChunkResult<Chunk>> completablefuture) {
|
||||
try {
|
||||
|
@ -146,7 +82,7 @@
|
|||
|
||||
return chunkresult != null ? (chunkresult.isSuccess() ? "done" : "unloaded") : "not completed";
|
||||
} catch (CompletionException completionexception) {
|
||||
@@ -1065,12 +1114,14 @@
|
||||
@@ -962,12 +994,14 @@
|
||||
|
||||
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
|
||||
|
@ -156,15 +92,15 @@
|
|||
}
|
||||
|
||||
- private NBTTagCompound upgradeChunkTag(NBTTagCompound nbttagcompound) {
|
||||
- return this.upgradeChunkTag(this.level.dimension(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer());
|
||||
- return this.upgradeChunkTag(this.level.dimension(), this.overworldDataStorage, nbttagcompound, this.generator().getTypeNameForDataFixer());
|
||||
+ // CraftBukkit start
|
||||
+ private NBTTagCompound upgradeChunkTag(NBTTagCompound nbttagcompound, ChunkCoordIntPair chunkcoordintpair) {
|
||||
+ return this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator.getTypeNameForDataFixer(), chunkcoordintpair, level);
|
||||
+ return this.upgradeChunkTag(this.level.getTypeKey(), this.overworldDataStorage, nbttagcompound, this.generator().getTypeNameForDataFixer(), chunkcoordintpair, level);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1473,7 +1524,7 @@
|
||||
@@ -1370,7 +1404,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(final Entity entity, final int i, final int j, final boolean flag) {
|
||||
|
@ -173,7 +109,7 @@
|
|||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
|
||||
@@ -1533,6 +1584,11 @@
|
||||
@@ -1430,6 +1464,11 @@
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer) && PlayerChunkMap.this.isChunkTracked(entityplayer, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/level/PlayerInteractManager.java
|
||||
+++ b/net/minecraft/server/level/PlayerInteractManager.java
|
||||
@@ -25,6 +25,27 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
@@ -28,6 +28,27 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -28,7 +28,7 @@
|
|||
public class PlayerInteractManager {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -55,9 +76,16 @@
|
||||
@@ -58,9 +79,16 @@
|
||||
if (enumgamemode == this.gameModeForPlayer) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -46,7 +46,7 @@
|
|||
this.level.updateSleepingPlayerList();
|
||||
if (enumgamemode == EnumGamemode.CREATIVE) {
|
||||
this.player.resetCurrentImpulseContext();
|
||||
@@ -91,7 +119,7 @@
|
||||
@@ -94,7 +122,7 @@
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
|
@ -55,7 +55,7 @@
|
|||
IBlockData iblockdata;
|
||||
|
||||
if (this.hasDelayedDestroy) {
|
||||
@@ -145,11 +173,33 @@
|
||||
@@ -148,11 +176,33 @@
|
||||
|
||||
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
|
||||
if (!this.level.mayInteract(this.player, blockposition)) {
|
||||
|
@ -89,7 +89,7 @@
|
|||
if (this.isCreative()) {
|
||||
this.destroyAndAck(blockposition, j, "creative destroy");
|
||||
return;
|
||||
@@ -165,11 +215,43 @@
|
||||
@@ -168,7 +218,19 @@
|
||||
float f = 1.0F;
|
||||
|
||||
iblockdata = this.level.getBlockState(blockposition);
|
||||
|
@ -107,7 +107,10 @@
|
|||
+ this.player.connection.send(new PacketPlayOutBlockChange(this.level, blockposition));
|
||||
+ }
|
||||
+ } else if (!iblockdata.isAir()) {
|
||||
iblockdata.attack(this.level, blockposition, this.player);
|
||||
EnchantmentManager.onHitBlock(this.level, this.player.getMainHandItem(), this.player, this.player, EnumItemSlot.MAINHAND, Vec3D.atCenterOf(blockposition), iblockdata, (item) -> {
|
||||
this.player.onEquippedItemBroken(item, EnumItemSlot.MAINHAND);
|
||||
});
|
||||
@@ -176,6 +238,26 @@
|
||||
f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition);
|
||||
}
|
||||
|
||||
|
@ -134,7 +137,7 @@
|
|||
if (!iblockdata.isAir() && f >= 1.0F) {
|
||||
this.destroyAndAck(blockposition, j, "insta mine");
|
||||
} else {
|
||||
@@ -214,13 +296,15 @@
|
||||
@@ -220,13 +302,15 @@
|
||||
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
|
||||
this.isDestroyingBlock = false;
|
||||
if (!Objects.equals(this.destroyPos, blockposition)) {
|
||||
|
@ -151,7 +154,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -238,10 +322,65 @@
|
||||
@@ -244,10 +328,65 @@
|
||||
|
||||
public boolean destroyBlock(BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
@ -218,7 +221,7 @@
|
|||
TileEntity tileentity = this.level.getBlockEntity(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
@@ -251,6 +390,10 @@
|
||||
@@ -257,6 +396,10 @@
|
||||
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -229,7 +232,7 @@
|
|||
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(blockposition, false);
|
||||
|
||||
@@ -259,19 +402,32 @@
|
||||
@@ -265,19 +408,32 @@
|
||||
}
|
||||
|
||||
if (this.isCreative()) {
|
||||
|
@ -265,7 +268,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -309,14 +465,53 @@
|
||||
@@ -315,14 +471,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -319,7 +322,7 @@
|
|||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openMenu(itileinventory);
|
||||
@@ -347,7 +542,7 @@
|
||||
@@ -353,7 +548,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
@@ -216,7 +216,7 @@
|
||||
@@ -217,7 +217,7 @@
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@
|
|||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
|
||||
|
||||
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
|
||||
@@ -335,6 +335,13 @@
|
||||
@@ -336,6 +336,13 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/TicketType.java
|
||||
+++ b/net/minecraft/server/level/TicketType.java
|
||||
@@ -23,6 +23,8 @@
|
||||
@@ -22,6 +22,8 @@
|
||||
public static final TicketType<BlockPosition> PORTAL = create("portal", BaseBlockPosition::compareTo, 300);
|
||||
public static final TicketType<Integer> POST_TELEPORT = create("post_teleport", Integer::compareTo, 5);
|
||||
public static final TicketType<ChunkCoordIntPair> UNKNOWN = create("unknown", Comparator.comparingLong(ChunkCoordIntPair::toLong), 1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -170,6 +170,23 @@
|
||||
@@ -171,6 +171,23 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -183,7 +200,7 @@
|
||||
@@ -184,7 +201,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
|
@ -33,7 +33,7 @@
|
|||
private int lastSpawnChunkRadius;
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
@@ -210,12 +227,30 @@
|
||||
@@ -211,12 +228,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
|
@ -69,7 +69,7 @@
|
|||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -230,6 +265,22 @@
|
||||
@@ -231,6 +266,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
|
@ -92,7 +92,7 @@
|
|||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||
@@ -257,9 +308,9 @@
|
||||
@@ -258,9 +309,9 @@
|
||||
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);
|
||||
|
@ -105,7 +105,7 @@
|
|||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
@@ -269,6 +320,7 @@
|
||||
@@ -270,6 +321,7 @@
|
||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||
});
|
||||
|
@ -113,7 +113,7 @@
|
|||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -313,12 +365,20 @@
|
||||
@@ -314,12 +366,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
|
@ -137,7 +137,7 @@
|
|||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -353,7 +413,7 @@
|
||||
@@ -354,7 +414,7 @@
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
|
@ -146,7 +146,7 @@
|
|||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
||||
@@ -369,7 +429,7 @@
|
||||
@@ -370,7 +430,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
|
@ -155,7 +155,7 @@
|
|||
entity.discard();
|
||||
} else if (!tickratemanager.isEntityFrozen(entity)) {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -441,7 +501,7 @@
|
||||
@@ -442,7 +502,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
|
@ -164,7 +164,7 @@
|
|||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -468,7 +528,7 @@
|
||||
@@ -469,7 +529,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
|
@ -173,7 +173,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +537,7 @@
|
||||
@@ -478,7 +538,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
|
@ -182,7 +182,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -533,7 +593,7 @@
|
||||
@@ -534,7 +594,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition2)) {
|
||||
|
@ -191,7 +191,7 @@
|
|||
}
|
||||
|
||||
if (this.isRaining()) {
|
||||
@@ -549,10 +609,10 @@
|
||||
@@ -550,10 +610,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
|
||||
|
@ -204,7 +204,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -713,6 +773,7 @@
|
||||
@@ -714,6 +774,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -212,7 +212,7 @@
|
|||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -731,15 +792,48 @@
|
||||
@@ -732,15 +793,48 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
|
@ -263,7 +263,7 @@
|
|||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -774,6 +868,7 @@
|
||||
@@ -775,6 +869,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
|
@ -271,7 +271,7 @@
|
|||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -797,6 +892,7 @@
|
||||
@@ -798,6 +893,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
|
@ -279,7 +279,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -821,6 +917,7 @@
|
||||
@@ -822,6 +918,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -287,7 +287,7 @@
|
|||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -838,11 +935,19 @@
|
||||
@@ -839,11 +936,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -308,7 +308,7 @@
|
|||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -907,15 +1012,37 @@
|
||||
@@ -908,18 +1013,40 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
@ -335,7 +335,6 @@
|
|||
}
|
||||
|
||||
public void addDuringTeleport(Entity entity) {
|
||||
- this.addEntity(entity);
|
||||
+ // CraftBukkit start
|
||||
+ // SPIGOT-6415: Don't call spawn event for entities which travel trough worlds,
|
||||
+ // since it is only an implementation detail, that a new entity is created when
|
||||
|
@ -344,12 +343,16 @@
|
|||
+ }
|
||||
+
|
||||
+ public void addDuringTeleport(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ this.addEntity(entity, reason);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
if (entity instanceof EntityPlayer entityplayer) {
|
||||
this.addPlayer(entityplayer);
|
||||
} else {
|
||||
- this.addEntity(entity);
|
||||
+ this.addEntity(entity, reason); // CraftBukkit
|
||||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -946,24 +1073,37 @@
|
||||
}
|
||||
@@ -944,24 +1071,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
|
@ -391,14 +394,14 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -974,13 +1114,35 @@
|
||||
@@ -972,13 +1112,35 @@
|
||||
}
|
||||
|
||||
public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) {
|
||||
- entityplayer.remove(entity_removalreason);
|
||||
+ entityplayer.remove(entity_removalreason, null); // CraftBukkit - add Bukkit remove cause
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean strikeLightning(Entity entitylightning) {
|
||||
+ return this.strikeLightning(entitylightning, LightningStrikeEvent.Cause.UNKNOWN);
|
||||
|
@ -412,9 +415,9 @@
|
|||
+ }
|
||||
+
|
||||
+ return this.addFreshEntity(entitylightning);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
@Override
|
||||
public void destroyBlockProgress(int i, BlockPosition blockposition, int j) {
|
||||
Iterator iterator = this.server.getPlayerList().getPlayers().iterator();
|
||||
|
@ -428,7 +431,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -989,6 +1151,12 @@
|
||||
@@ -987,6 +1149,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
|
@ -441,7 +444,7 @@
|
|||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1049,7 +1217,18 @@
|
||||
@@ -1047,7 +1215,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -461,7 +464,7 @@
|
|||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1111,6 +1290,11 @@
|
||||
@@ -1109,6 +1288,11 @@
|
||||
@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, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, holder);
|
||||
|
@ -473,7 +476,7 @@
|
|||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1183,13 +1367,20 @@
|
||||
@@ -1181,13 +1365,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) {
|
||||
|
@ -496,7 +499,7 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1240,7 +1431,7 @@
|
||||
@@ -1238,7 +1429,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
|
@ -505,7 +508,7 @@
|
|||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1282,11 +1473,22 @@
|
||||
@@ -1280,11 +1471,22 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(MapId mapid) {
|
||||
|
@ -529,7 +532,7 @@
|
|||
this.getServer().overworld().getDataStorage().set(mapid.key(), worldmap);
|
||||
}
|
||||
|
||||
@@ -1597,6 +1799,11 @@
|
||||
@@ -1595,6 +1797,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
|
@ -541,7 +544,7 @@
|
|||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1616,12 +1823,12 @@
|
||||
@@ -1614,12 +1821,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
|
@ -556,7 +559,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1644,7 +1851,7 @@
|
||||
@@ -1642,7 +1849,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
|
@ -565,7 +568,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1653,7 +1860,7 @@
|
||||
@@ -1651,7 +1858,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
|
@ -574,43 +577,7 @@
|
|||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1664,17 +1871,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, null);
|
||||
+ }
|
||||
+
|
||||
+ public static void makeObsidianPlatform(WorldServer worldserver, Entity entity) {
|
||||
+ // CraftBukkit end
|
||||
BlockPosition blockposition = WorldServer.END_SPAWN_POINT;
|
||||
int i = blockposition.getX();
|
||||
int j = blockposition.getY() - 2;
|
||||
int k = blockposition.getZ();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(worldserver);
|
||||
BlockPosition.betweenClosed(i - 2, j + 1, k - 2, i + 2, j + 3, k + 2).forEach((blockposition1) -> {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, Blocks.AIR.defaultBlockState());
|
||||
+ blockList.setBlock(blockposition1, Blocks.AIR.defaultBlockState(), 3);
|
||||
});
|
||||
BlockPosition.betweenClosed(i - 2, j, k - 2, i + 2, j, k + 2).forEach((blockposition1) -> {
|
||||
- worldserver.setBlockAndUpdate(blockposition1, Blocks.OBSIDIAN.defaultBlockState());
|
||||
+ blockList.setBlock(blockposition1, Blocks.OBSIDIAN.defaultBlockState(), 3);
|
||||
});
|
||||
+ org.bukkit.World bworld = worldserver.getWorld();
|
||||
+ org.bukkit.event.world.PortalCreateEvent portalEvent = new org.bukkit.event.world.PortalCreateEvent((List<org.bukkit.block.BlockState>) (List) blockList.getList(), bworld, (entity == null) ? null : entity.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM);
|
||||
+
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(portalEvent);
|
||||
+ if (!portalEvent.isCancelled()) {
|
||||
+ blockList.updateList();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1812,6 +2035,8 @@
|
||||
@@ -1796,6 +2003,8 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
|
@ -619,7 +586,7 @@
|
|||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1843,6 +2068,14 @@
|
||||
@@ -1827,6 +2036,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -12,8 +12,17 @@
|
||||
@@ -13,8 +13,17 @@
|
||||
import net.minecraft.network.protocol.status.StatusProtocols;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.translatable("disconnect.ignoring_status_request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -25,6 +34,7 @@
|
||||
@@ -26,6 +35,7 @@
|
||||
|
||||
@Override
|
||||
public void handleIntention(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {
|
||||
|
@ -26,7 +26,7 @@
|
|||
switch (packethandshakinginsetprotocol.intention()) {
|
||||
case LOGIN:
|
||||
this.beginLogin(packethandshakinginsetprotocol, false);
|
||||
@@ -58,6 +68,40 @@
|
||||
@@ -59,6 +69,40 @@
|
||||
|
||||
private void beginLogin(PacketHandshakingInSetProtocol packethandshakinginsetprotocol, boolean flag) {
|
||||
this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -42,8 +42,33 @@
|
||||
@@ -44,8 +44,33 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
||||
@@ -58,6 +83,7 @@
|
||||
@@ -60,6 +85,7 @@
|
||||
private GameProfile authenticatedProfile;
|
||||
private final String serverId;
|
||||
private final boolean transferred;
|
||||
|
@ -43,7 +43,7 @@
|
|||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager, boolean flag) {
|
||||
this.state = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -74,6 +100,12 @@
|
||||
@@ -76,6 +102,12 @@
|
||||
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
if (this.state == LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
|
||||
this.finishLoginAndWaitForClient(this.authenticatedProfile);
|
||||
}
|
||||
@@ -84,6 +116,13 @@
|
||||
@@ -86,6 +118,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
@Override
|
||||
public boolean isAcceptingMessages() {
|
||||
return this.connection.isConnected();
|
||||
@@ -129,7 +168,27 @@
|
||||
@@ -131,7 +170,27 @@
|
||||
this.state = LoginListener.EnumProtocolState.KEY;
|
||||
this.connection.send(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true));
|
||||
} else {
|
||||
|
@ -99,7 +99,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -142,10 +201,24 @@
|
||||
@@ -144,10 +203,24 @@
|
||||
|
||||
private void verifyLoginAndFinishConnectionSetup(GameProfile gameprofile) {
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
|
@ -127,7 +127,7 @@
|
|||
} else {
|
||||
if (this.server.getCompressionThreshold() >= 0 && !this.connection.isMemoryConnection()) {
|
||||
this.connection.send(new PacketLoginOutSetCompression(this.server.getCompressionThreshold()), PacketSendListener.thenRun(() -> {
|
||||
@@ -153,7 +226,7 @@
|
||||
@@ -155,7 +228,7 @@
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@
|
|||
|
||||
if (flag) {
|
||||
this.state = LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT;
|
||||
@@ -203,6 +276,12 @@
|
||||
@@ -205,6 +278,12 @@
|
||||
if (profileresult != null) {
|
||||
GameProfile gameprofile = profileresult.profile();
|
||||
|
||||
|
@ -149,7 +149,7 @@
|
|||
LoginListener.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
|
||||
LoginListener.this.startClientVerification(gameprofile);
|
||||
} else if (LoginListener.this.server.isSingleplayer()) {
|
||||
@@ -220,6 +299,11 @@
|
||||
@@ -222,6 +301,11 @@
|
||||
LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
|
@ -161,7 +161,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -236,6 +320,43 @@
|
||||
@@ -238,6 +322,43 @@
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,11 @@
|
|||
@Override
|
||||
public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket serverboundcustomqueryanswerpacket) {
|
||||
this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
@@ -246,7 +367,7 @@
|
||||
@@ -245,10 +366,11 @@
|
||||
|
||||
@Override
|
||||
public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket serverboundloginacknowledgedpacket) {
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(serverboundloginacknowledgedpacket, this, this.server); // CraftBukkit
|
||||
Validate.validState(this.state == LoginListener.EnumProtocolState.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet", new Object[0]);
|
||||
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
||||
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile), this.transferred);
|
||||
|
@ -214,7 +218,7 @@
|
|||
|
||||
this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, serverconfigurationpacketlistenerimpl);
|
||||
serverconfigurationpacketlistenerimpl.startConfiguration();
|
||||
@@ -262,12 +383,18 @@
|
||||
@@ -264,12 +386,18 @@
|
||||
|
||||
@Override
|
||||
public void handleCookieResponse(ServerboundCookieResponsePacket serverboundcookieresponsepacket) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/PacketStatusListener.java
|
||||
+++ b/net/minecraft/server/network/PacketStatusListener.java
|
||||
@@ -9,6 +9,21 @@
|
||||
@@ -10,6 +10,21 @@
|
||||
import net.minecraft.network.protocol.status.PacketStatusOutServerInfo;
|
||||
import net.minecraft.network.protocol.status.ServerPing;
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
public class PacketStatusListener implements PacketStatusInListener {
|
||||
|
||||
private static final IChatBaseComponent DISCONNECT_REASON = IChatBaseComponent.translatable("multiplayer.status.request_handled");
|
||||
@@ -35,7 +50,101 @@
|
||||
@@ -36,7 +51,101 @@
|
||||
this.connection.disconnect(PacketStatusListener.DISCONNECT_REASON);
|
||||
} else {
|
||||
this.hasRequestedStatus = true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -190,6 +190,67 @@
|
||||
@@ -191,6 +191,67 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -68,7 +68,7 @@
|
|||
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -203,7 +264,9 @@
|
||||
@@ -204,7 +265,9 @@
|
||||
public final PlayerChunkSender chunkSender;
|
||||
private int tickCount;
|
||||
private int ackBlockChangesUpTo = -1;
|
||||
|
@ -79,7 +79,7 @@
|
|||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -238,7 +301,7 @@
|
||||
@@ -239,7 +302,7 @@
|
||||
private boolean waitingForSwitchToConfig;
|
||||
|
||||
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
|
||||
|
@ -88,7 +88,7 @@
|
|||
this.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
|
||||
this.player = entityplayer;
|
||||
entityplayer.connection = this;
|
||||
@@ -247,9 +310,25 @@
|
||||
@@ -248,9 +311,25 @@
|
||||
|
||||
Objects.requireNonNull(minecraftserver);
|
||||
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
|
||||
|
@ -115,7 +115,7 @@
|
|||
@Override
|
||||
public void tick() {
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
@@ -301,15 +380,21 @@
|
||||
@@ -302,15 +381,21 @@
|
||||
}
|
||||
|
||||
this.keepConnectionAlive();
|
||||
|
@ -134,10 +134,10 @@
|
|||
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && SystemUtils.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L) {
|
||||
+ this.player.resetLastActionTime(); // CraftBukkit - SPIGOT-854
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -398,6 +483,13 @@
|
||||
@@ -399,6 +484,13 @@
|
||||
|
||||
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
@ -151,7 +151,7 @@
|
|||
double d0 = entity.getX();
|
||||
double d1 = entity.getY();
|
||||
double d2 = entity.getZ();
|
||||
@@ -412,7 +504,33 @@
|
||||
@@ -413,7 +505,33 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
|
@ -186,7 +186,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -452,14 +570,76 @@
|
||||
@@ -453,14 +571,76 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
|
@ -261,9 +261,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
this.player.checkMovementStatistics(this.player.getX() - d0, this.player.getY() - d1, this.player.getZ() - d2);
|
||||
this.clientVehicleIsFloating = d11 >= -0.03125D && !flag1 && !this.server.isFlightAllowed() && !entity.isNoGravity() && this.noBlocksAround(entity);
|
||||
@@ -493,6 +673,7 @@
|
||||
Vec3D vec3d = new Vec3D(entity.getX() - d0, entity.getY() - d1, entity.getZ() - d2);
|
||||
|
||||
@@ -497,6 +677,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
|
@ -271,7 +271,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -500,7 +681,7 @@
|
||||
@@ -504,7 +685,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
|
||||
|
@ -280,7 +280,7 @@
|
|||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -510,6 +691,7 @@
|
||||
@@ -514,6 +695,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
|
||||
|
@ -288,7 +288,7 @@
|
|||
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
|
||||
}
|
||||
|
||||
@@ -530,6 +712,12 @@
|
||||
@@ -534,6 +716,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
|
@ -301,7 +301,7 @@
|
|||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -539,6 +727,7 @@
|
||||
@@ -543,6 +731,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
|
@ -309,7 +309,7 @@
|
|||
Suggestions suggestions1 = suggestions.getList().size() <= 1000 ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, 1000));
|
||||
|
||||
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions1));
|
||||
@@ -783,6 +972,13 @@
|
||||
@@ -787,6 +976,13 @@
|
||||
Container container = this.player.containerMenu;
|
||||
|
||||
if (container instanceof ContainerMerchant containermerchant) {
|
||||
|
@ -323,13 +323,13 @@
|
|||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
return;
|
||||
@@ -796,6 +992,13 @@
|
||||
@@ -800,6 +996,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
+ // CraftBukkit start
|
||||
+ if (this.lastBookTick + 20 > MinecraftServer.currentTick) {
|
||||
+ this.disconnect("Book edited too quickly!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("Book edited too quickly!"));
|
||||
+ return;
|
||||
+ }
|
||||
+ this.lastBookTick = MinecraftServer.currentTick;
|
||||
|
@ -337,7 +337,7 @@
|
|||
int i = packetplayinbedit.slot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -804,7 +1007,7 @@
|
||||
@@ -808,7 +1011,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
|
@ -346,7 +346,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -819,12 +1022,16 @@
|
||||
@@ -823,12 +1026,16 @@
|
||||
}
|
||||
|
||||
private void updateBookContents(List<FilteredText> list, int i) {
|
||||
|
@ -364,8 +364,8 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -835,12 +1042,13 @@
|
||||
ItemStack itemstack1 = itemstack.transmuteCopy(Items.WRITTEN_BOOK, 1);
|
||||
@@ -839,12 +1046,13 @@
|
||||
ItemStack itemstack1 = itemstack.transmuteCopy(Items.WRITTEN_BOOK);
|
||||
|
||||
itemstack1.remove(DataComponents.WRITABLE_BOOK_CONTENT);
|
||||
- List<Filterable<IChatBaseComponent>> list1 = list.stream().map((filteredtext1) -> {
|
||||
|
@ -380,7 +380,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -902,7 +1110,7 @@
|
||||
@@ -906,7 +1114,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
|
@ -389,15 +389,7 @@
|
|||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -912,6 +1120,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
+ this.allowedPlayerTicks = 20; // CraftBukkit
|
||||
|
||||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
@@ -924,7 +1133,15 @@
|
||||
@@ -921,7 +1129,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
|
@ -413,7 +405,7 @@
|
|||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -946,15 +1163,33 @@
|
||||
@@ -943,15 +1159,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
|
@ -449,7 +441,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -976,6 +1211,7 @@
|
||||
@@ -973,6 +1207,7 @@
|
||||
boolean flag2 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
|
@ -457,7 +449,7 @@
|
|||
double d11 = d7;
|
||||
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -994,9 +1230,75 @@
|
||||
@@ -991,9 +1226,75 @@
|
||||
}
|
||||
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag3 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
|
@ -534,7 +526,15 @@
|
|||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
boolean flag4 = this.player.isAutoSpinAttack();
|
||||
|
||||
@@ -1043,11 +1345,68 @@
|
||||
@@ -1030,6 +1331,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
+ this.allowedPlayerTicks = 20; // CraftBukkit
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -1057,11 +1359,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -544,8 +544,8 @@
|
|||
+ 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) {
|
||||
+ this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), cause);
|
||||
+ public boolean teleport(double d0, double d1, double d2, float f, float f1, PlayerTeleportEvent.TeleportCause cause) {
|
||||
+ return this.teleport(d0, d1, d2, f, f1, Collections.emptySet(), cause);
|
||||
}
|
||||
|
||||
public void teleport(double d0, double d1, double d2, float f, float f1, Set<RelativeMovement> set) {
|
||||
|
@ -604,7 +604,7 @@
|
|||
double d3 = set.contains(RelativeMovement.X) ? this.player.getX() : 0.0D;
|
||||
double d4 = set.contains(RelativeMovement.Y) ? this.player.getY() : 0.0D;
|
||||
double d5 = set.contains(RelativeMovement.Z) ? this.player.getZ() : 0.0D;
|
||||
@@ -1059,6 +1418,14 @@
|
||||
@@ -1073,6 +1432,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
|
@ -617,9 +617,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.resetCurrentImpulseContext();
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
@@ -1068,6 +1435,7 @@
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
||||
@@ -1081,6 +1448,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
|
@ -627,7 +627,7 @@
|
|||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1078,14 +1446,46 @@
|
||||
@@ -1091,14 +1459,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
|
@ -668,7 +668,7 @@
|
|||
+ this.dropCount++;
|
||||
+ if (this.dropCount >= 20) {
|
||||
+ LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!");
|
||||
+ this.disconnect("You dropped your items too quickly (Hacking?)");
|
||||
+ this.disconnect(IChatBaseComponent.literal("You dropped your items too quickly (Hacking?)"));
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
|
@ -676,7 +676,7 @@
|
|||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1123,6 +1523,7 @@
|
||||
@@ -1136,6 +1536,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
|
@ -684,7 +684,7 @@
|
|||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1145,6 +1546,7 @@
|
||||
@@ -1158,6 +1559,7 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
|
||||
|
@ -692,7 +692,7 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
@@ -1177,6 +1579,7 @@
|
||||
@@ -1190,6 +1592,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
|
@ -700,21 +700,19 @@
|
|||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1184,6 +1587,49 @@
|
||||
@@ -1204,6 +1607,47 @@
|
||||
this.player.absRotateTo(f, f1);
|
||||
}
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
+ // CraftBukkit start
|
||||
+ // Raytrace to look for 'rogue armswings'
|
||||
+ float f1 = this.player.getXRot();
|
||||
+ float f2 = this.player.getYRot();
|
||||
+ double d0 = this.player.getX();
|
||||
+ double d1 = this.player.getY() + (double) this.player.getEyeHeight();
|
||||
+ double d2 = this.player.getZ();
|
||||
+ Vec3D vec3d = new Vec3D(d0, d1, d2);
|
||||
+
|
||||
+ float f3 = MathHelper.cos(-f2 * 0.017453292F - 3.1415927F);
|
||||
+ float f4 = MathHelper.sin(-f2 * 0.017453292F - 3.1415927F);
|
||||
+ float f3 = MathHelper.cos(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f4 = MathHelper.sin(-f * 0.017453292F - 3.1415927F);
|
||||
+ float f5 = -MathHelper.cos(-f1 * 0.017453292F);
|
||||
+ float f6 = MathHelper.sin(-f1 * 0.017453292F);
|
||||
+ float f7 = f4 * f5;
|
||||
|
@ -750,7 +748,7 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1204,7 +1650,7 @@
|
||||
@@ -1224,7 +1668,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -759,10 +757,10 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1225,6 +1671,13 @@
|
||||
@@ -1245,6 +1689,13 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
public void onDisconnect(DisconnectionDetails disconnectiondetails) {
|
||||
+ // CraftBukkit start - Rarely it would send a disconnect line twice
|
||||
+ if (this.processedDisconnect) {
|
||||
+ return;
|
||||
|
@ -770,10 +768,10 @@
|
|||
+ this.processedDisconnect = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
|
||||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), disconnectiondetails.reason().getString());
|
||||
this.removePlayerFromWorld();
|
||||
super.onDisconnect(ichatbasecomponent);
|
||||
@@ -1232,10 +1685,18 @@
|
||||
super.onDisconnect(disconnectiondetails);
|
||||
@@ -1252,10 +1703,18 @@
|
||||
|
||||
private void removePlayerFromWorld() {
|
||||
this.chatMessageChain.close();
|
||||
|
@ -793,7 +791,7 @@
|
|||
this.player.getTextFilter().leave();
|
||||
}
|
||||
|
||||
@@ -1250,7 +1711,16 @@
|
||||
@@ -1270,7 +1729,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
|
@ -810,11 +808,11 @@
|
|||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1259,11 +1729,18 @@
|
||||
@@ -1279,11 +1747,18 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
+ this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit
|
||||
+ this.disconnect(IChatBaseComponent.literal("Invalid hotbar selection (Hacking?)")); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -829,7 +827,7 @@
|
|||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packetplayinchat.lastSeenMessages());
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
@@ -1277,7 +1754,7 @@
|
||||
@@ -1297,7 +1772,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -838,7 +836,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
|
||||
|
||||
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
|
||||
@@ -1285,19 +1762,36 @@
|
||||
@@ -1305,19 +1780,36 @@
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
|
@ -877,7 +875,7 @@
|
|||
ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(s);
|
||||
|
||||
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseresults)) {
|
||||
@@ -1314,19 +1808,37 @@
|
||||
@@ -1334,19 +1826,37 @@
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
this.tryHandleChat(serverboundchatcommandsignedpacket.command(), () -> {
|
||||
|
@ -918,7 +916,7 @@
|
|||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1334,10 +1846,10 @@
|
||||
@@ -1354,10 +1864,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
|
@ -931,14 +929,14 @@
|
|||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1413,14 +1925,20 @@
|
||||
@@ -1433,14 +1943,20 @@
|
||||
return com_mojang_brigadier_commanddispatcher.parse(s, this.player.createCommandSourceStack());
|
||||
}
|
||||
|
||||
- private void tryHandleChat(String s, Runnable runnable) {
|
||||
+ private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
|
||||
if (isChatMessageIllegal(s)) {
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
- } 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));
|
||||
|
@ -955,7 +953,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1449,6 +1967,116 @@
|
||||
@@ -1469,6 +1985,116 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1072,7 +1070,7 @@
|
|||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1456,13 +2084,33 @@
|
||||
@@ -1476,13 +2102,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
|
@ -1101,15 +1099,15 @@
|
|||
|
||||
private void detectRateSpam() {
|
||||
- this.chatSpamTickCount += 20;
|
||||
- if (this.chatSpamTickCount > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
- if (this.chatSpamTickCount > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
|
||||
+ // CraftBukkit start - replaced with thread safe throttle
|
||||
+ // this.chatSpamTickCount += 20;
|
||||
+ if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
+ if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) {
|
||||
+ // CraftBukkit end
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1484,13 +2132,62 @@
|
||||
@@ -1504,13 +2150,62 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
|
@ -1172,7 +1170,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
|
||||
@@ -1567,6 +2264,12 @@
|
||||
@@ -1587,6 +2282,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
|
@ -1185,7 +1183,7 @@
|
|||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1594,6 +2297,7 @@
|
||||
@@ -1614,6 +2315,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
|
@ -1193,7 +1191,7 @@
|
|||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1608,13 +2312,51 @@
|
||||
@@ -1628,13 +2330,51 @@
|
||||
|
||||
if (this.player.canInteractWithEntity(axisalignedbb, 1.0D)) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
|
@ -1212,7 +1210,7 @@
|
|||
+
|
||||
+ // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a
|
||||
+ if ((entity instanceof Bucketable && entity instanceof EntityLiving && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem)) {
|
||||
+ send(new PacketPlayOutSpawnEntity(entity));
|
||||
+ entity.getBukkitEntity().update(player);
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+
|
||||
|
@ -1246,7 +1244,7 @@
|
|||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, enuminteractionresult.indicateItemUse() ? itemstack1 : ItemStack.EMPTY, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1627,19 +2369,20 @@
|
||||
@@ -1647,19 +2387,20 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
|
@ -1270,7 +1268,7 @@
|
|||
label23:
|
||||
{
|
||||
if (entity instanceof EntityArrow) {
|
||||
@@ -1657,6 +2400,11 @@
|
||||
@@ -1677,6 +2418,11 @@
|
||||
}
|
||||
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
|
@ -1282,20 +1280,20 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1680,17 +2428,17 @@
|
||||
@@ -1700,17 +2446,17 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
- this.player = this.server.getPlayerList().respawn(this.player, true);
|
||||
+ this.player = this.server.getPlayerList().respawn(this.player, true, RespawnReason.END_PORTAL);
|
||||
- this.player = this.server.getPlayerList().respawn(this.player, true, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.player = this.server.getPlayerList().respawn(this.player, true, Entity.RemovalReason.CHANGED_DIMENSION, RespawnReason.END_PORTAL); // CraftBukkit
|
||||
CriterionTriggers.CHANGED_DIMENSION.trigger(this.player, World.END, World.OVERWORLD);
|
||||
} else {
|
||||
if (this.player.getHealth() > 0.0F) {
|
||||
return;
|
||||
}
|
||||
|
||||
- this.player = this.server.getPlayerList().respawn(this.player, false);
|
||||
+ this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
|
||||
- this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED);
|
||||
+ this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED, RespawnReason.DEATH); // CraftBukkit
|
||||
if (this.server.isHardcore()) {
|
||||
this.player.setGameMode(EnumGamemode.SPECTATOR);
|
||||
- ((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
|
@ -1303,7 +1301,7 @@
|
|||
}
|
||||
}
|
||||
break;
|
||||
@@ -1703,15 +2451,21 @@
|
||||
@@ -1723,15 +2469,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
|
@ -1327,7 +1325,7 @@
|
|||
this.player.containerMenu.sendAllDataToRemote();
|
||||
} else if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
@@ -1724,7 +2478,284 @@
|
||||
@@ -1744,7 +2496,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
|
@ -1613,7 +1611,7 @@
|
|||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1754,9 +2785,18 @@
|
||||
@@ -1774,9 +2803,18 @@
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
} else {
|
||||
|
@ -1634,7 +1632,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -1764,6 +2804,7 @@
|
||||
@@ -1784,6 +2822,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
|
@ -1642,7 +1640,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.containerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1806,6 +2847,43 @@
|
||||
@@ -1826,6 +2865,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.slotNum() >= 1 && packetplayinsetcreativeslot.slotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
||||
|
@ -1686,7 +1684,7 @@
|
|||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).setByPlayer(itemstack);
|
||||
@@ -1828,6 +2906,7 @@
|
||||
@@ -1848,6 +2924,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
|
@ -1694,7 +1692,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1849,7 +2928,17 @@
|
||||
@@ -1869,7 +2946,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
|
@ -1713,7 +1711,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1908,7 +2997,7 @@
|
||||
@@ -1928,7 +3015,7 @@
|
||||
if (!this.waitingForSwitchToConfig) {
|
||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||
} else {
|
||||
|
@ -1722,7 +1720,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1933,8 +3022,10 @@
|
||||
@@ -1953,8 +3040,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -27,8 +27,39 @@
|
||||
@@ -28,8 +28,39 @@
|
||||
import net.minecraft.util.thread.IAsyncTaskHandler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -20,14 +20,14 @@
|
|||
+import org.bukkit.craftbukkit.util.Waitable;
|
||||
+import org.bukkit.event.player.PlayerKickEvent;
|
||||
+import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
+
|
||||
|
||||
+public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, CraftPlayer.TransferCookieConnection {
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTransferred() {
|
||||
+ return this.transferred;
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumProtocol getProtocol() {
|
||||
+ return protocol();
|
||||
|
@ -41,7 +41,7 @@
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final int LATENCY_CHECK_INTERVAL = 15000;
|
||||
private static final int CLOSED_LISTENER_TIMEOUT = 15000;
|
||||
@@ -45,12 +76,24 @@
|
||||
@@ -46,12 +77,24 @@
|
||||
private int latency;
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
|
||||
private void close() {
|
||||
@@ -72,6 +115,7 @@
|
||||
@@ -73,6 +116,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket serverboundkeepalivepacket) {
|
||||
|
@ -75,13 +75,13 @@
|
|||
if (this.keepAlivePending && serverboundkeepalivepacket.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -86,8 +130,56 @@
|
||||
@@ -87,8 +131,56 @@
|
||||
@Override
|
||||
public void handlePong(ServerboundPongPacket serverboundpongpacket) {}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private static final MinecraftKey CUSTOM_REGISTER = new MinecraftKey("register");
|
||||
+ private static final MinecraftKey CUSTOM_UNREGISTER = new MinecraftKey("unregister");
|
||||
+ private static final MinecraftKey CUSTOM_REGISTER = MinecraftKey.withDefaultNamespace("register");
|
||||
+ private static final MinecraftKey CUSTOM_UNREGISTER = MinecraftKey.withDefaultNamespace("unregister");
|
||||
+
|
||||
@Override
|
||||
- public void handleCustomPayload(ServerboundCustomPayloadPacket serverboundcustompayloadpacket) {}
|
||||
|
@ -101,7 +101,7 @@
|
|||
+ }
|
||||
+ } catch (Exception ex) {
|
||||
+ PlayerConnection.LOGGER.error("Couldn\'t register custom payload", ex);
|
||||
+ this.disconnect("Invalid payload REGISTER!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("Invalid payload REGISTER!"));
|
||||
+ }
|
||||
+ } else if (identifier.equals(CUSTOM_UNREGISTER)) {
|
||||
+ try {
|
||||
|
@ -111,7 +111,7 @@
|
|||
+ }
|
||||
+ } catch (Exception ex) {
|
||||
+ PlayerConnection.LOGGER.error("Couldn\'t unregister custom payload", ex);
|
||||
+ this.disconnect("Invalid payload UNREGISTER!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("Invalid payload UNREGISTER!"));
|
||||
+ }
|
||||
+ } else {
|
||||
+ try {
|
||||
|
@ -120,7 +120,7 @@
|
|||
+ cserver.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), identifier.toString(), data);
|
||||
+ } catch (Exception ex) {
|
||||
+ PlayerConnection.LOGGER.error("Couldn\'t dispatch custom payload", ex);
|
||||
+ this.disconnect("Invalid custom payload!");
|
||||
+ this.disconnect(IChatBaseComponent.literal("Invalid custom payload!"));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -133,9 +133,9 @@
|
|||
|
||||
@Override
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket serverboundresourcepackpacket) {
|
||||
@@ -96,11 +188,18 @@
|
||||
@@ -97,11 +189,18 @@
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), serverboundresourcepackpacket.id());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
this.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getCraftPlayer(), serverboundresourcepackpacket.id(), PlayerResourcePackStatusEvent.Status.values()[serverboundresourcepackpacket.action().ordinal()])); // CraftBukkit
|
||||
|
||||
|
@ -152,7 +152,7 @@
|
|||
this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
}
|
||||
|
||||
@@ -108,7 +207,7 @@
|
||||
@@ -109,7 +208,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
|
@ -161,7 +161,7 @@
|
|||
if (this.keepAlivePending) {
|
||||
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
|
||||
} else if (this.checkIfClosed(i)) {
|
||||
@@ -148,6 +247,14 @@
|
||||
@@ -149,6 +248,14 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
|
@ -176,18 +176,10 @@
|
|||
if (packet.isTerminal()) {
|
||||
this.close();
|
||||
}
|
||||
@@ -167,16 +274,67 @@
|
||||
}
|
||||
@@ -173,15 +280,61 @@
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Deprecated
|
||||
public void disconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
+ disconnect(CraftChatMessage.fromComponent(ichatbasecomponent));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ public void disconnect(String s) {
|
||||
public void disconnect(DisconnectionDetails disconnectiondetails) {
|
||||
+ // CraftBukkit start - fire PlayerKickEvent
|
||||
+ if (this.processedDisconnect) {
|
||||
+ return;
|
||||
|
@ -196,7 +188,7 @@
|
|||
+ Waitable waitable = new Waitable() {
|
||||
+ @Override
|
||||
+ protected Object evaluate() {
|
||||
+ ServerCommonPacketListenerImpl.this.disconnect(s);
|
||||
+ ServerCommonPacketListenerImpl.this.disconnect(disconnectiondetails);
|
||||
+ return null;
|
||||
+ }
|
||||
+ };
|
||||
|
@ -215,7 +207,7 @@
|
|||
+
|
||||
+ String leaveMessage = EnumChatFormat.YELLOW + this.player.getScoreboardName() + " left the game.";
|
||||
+
|
||||
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), s, leaveMessage);
|
||||
+ PlayerKickEvent event = new PlayerKickEvent(this.player.getBukkitEntity(), CraftChatMessage.fromComponent(disconnectiondetails.reason()), leaveMessage);
|
||||
+
|
||||
+ if (this.cserver.getServer().isRunning()) {
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
|
@ -227,13 +219,15 @@
|
|||
+ }
|
||||
+ this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
|
||||
+ // Send the possibly modified leave message
|
||||
+ final IChatBaseComponent ichatbasecomponent = CraftChatMessage.fromString(event.getReason(), true)[0];
|
||||
+ // CraftBukkit end
|
||||
+ disconnect0(new DisconnectionDetails(CraftChatMessage.fromString(event.getReason(), true)[0], disconnectiondetails.report(), disconnectiondetails.bugReportLink()));
|
||||
+ }
|
||||
+
|
||||
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
|
||||
this.connection.disconnect(ichatbasecomponent);
|
||||
+ private void disconnect0(DisconnectionDetails disconnectiondetails) {
|
||||
+ // CraftBukkit end
|
||||
this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> {
|
||||
this.connection.disconnect(disconnectiondetails);
|
||||
}));
|
||||
+ this.onDisconnect(ichatbasecomponent); // CraftBukkit - fire quit instantly
|
||||
+ this.onDisconnect(disconnectiondetails); // CraftBukkit - fire quit instantly
|
||||
this.connection.setReadOnly();
|
||||
MinecraftServer minecraftserver = this.server;
|
||||
NetworkManager networkmanager = this.connection;
|
||||
|
|
|
@ -1,6 +1,18 @@
|
|||
--- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -47,8 +47,10 @@
|
||||
@@ -38,6 +38,11 @@
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.CraftServerLinks;
|
||||
+import org.bukkit.event.player.PlayerLinksSendEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketListenerImpl implements ServerConfigurationPacketListener, TickablePacketListener {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -50,8 +55,10 @@
|
||||
@Nullable
|
||||
private SynchronizeRegistriesTask synchronizeRegistriesTask;
|
||||
|
||||
|
@ -13,7 +25,20 @@
|
|||
this.gameProfile = commonlistenercookie.gameProfile();
|
||||
this.clientInformation = commonlistenercookie.clientInformation();
|
||||
}
|
||||
@@ -134,14 +136,14 @@
|
||||
@@ -75,6 +82,12 @@
|
||||
public void startConfiguration() {
|
||||
this.send(new ClientboundCustomPayloadPacket(new BrandPayload(this.server.getServerModName())));
|
||||
ServerLinks serverlinks = this.server.serverLinks();
|
||||
+ // CraftBukkit start
|
||||
+ CraftServerLinks wrapper = new CraftServerLinks(serverlinks);
|
||||
+ PlayerLinksSendEvent event = new PlayerLinksSendEvent(player.getBukkitEntity(), wrapper);
|
||||
+ player.getBukkitEntity().getServer().getPluginManager().callEvent(event);
|
||||
+ serverlinks = wrapper.getServerLinks();
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!serverlinks.isEmpty()) {
|
||||
this.send(new ClientboundServerLinksPacket(serverlinks.untrust()));
|
||||
@@ -143,14 +156,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@
|
|||
+ entityplayer.loadGameTypes((NBTTagCompound) optional.orElse(null)); // CraftBukkit - decompile error
|
||||
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer, commonlistenercookie);
|
||||
|
||||
networkmanager.setupInboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())), playerconnection);
|
||||
networkmanager.setupInboundProtocol(GameProtocols.SERVERBOUND_TEMPLATE.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())), playerconnection);
|
||||
@@ -194,6 +237,7 @@
|
||||
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
|
||||
|
||||
|
@ -148,7 +148,7 @@
|
|||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
ServerPing serverping = this.server.getStatus();
|
||||
|
||||
@@ -219,13 +265,64 @@
|
||||
@@ -219,18 +265,70 @@
|
||||
entityplayer.sendServerStatus(serverping);
|
||||
}
|
||||
|
||||
|
@ -214,11 +214,7 @@
|
|||
+
|
||||
+ worldserver1 = entityplayer.serverLevel(); // CraftBukkit - Update in case join event changed it
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator = entityplayer.getActiveEffects().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -236,8 +333,9 @@
|
||||
|
||||
this.sendActivePlayerEffects(entityplayer);
|
||||
if (optional.isPresent() && ((NBTTagCompound) optional.get()).contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound = ((NBTTagCompound) optional.get()).getCompound("RootVehicle");
|
||||
+ WorldServer finalWorldServer = worldserver1; // CraftBukkit - decompile error
|
||||
|
@ -228,16 +224,16 @@
|
|||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -268,18 +366,20 @@
|
||||
@@ -261,18 +359,20 @@
|
||||
|
||||
if (!entityplayer.isPassenger()) {
|
||||
PlayerList.LOGGER.warn("Couldn't reattach entity to player");
|
||||
- entity.discard();
|
||||
+ entity.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
iterator1 = entity.getIndirectPassengers().iterator();
|
||||
iterator = entity.getIndirectPassengers().iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
entity1 = (Entity) iterator1.next();
|
||||
while (iterator.hasNext()) {
|
||||
entity1 = (Entity) iterator.next();
|
||||
- entity1.discard();
|
||||
+ entity1.discard(null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
@ -251,7 +247,7 @@
|
|||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -316,30 +416,31 @@
|
||||
@@ -309,30 +409,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
|
@ -288,7 +284,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -366,14 +467,15 @@
|
||||
@@ -359,14 +460,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
|
@ -306,7 +302,7 @@
|
|||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -381,10 +483,24 @@
|
||||
@@ -374,10 +476,24 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -332,7 +328,7 @@
|
|||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -393,7 +509,7 @@
|
||||
@@ -386,7 +502,7 @@
|
||||
PlayerList.LOGGER.debug("Removing player mount");
|
||||
entityplayer.stopRiding();
|
||||
entity.getPassengersAndSelf().forEach((entity1) -> {
|
||||
|
@ -341,7 +337,7 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
@@ -408,17 +524,66 @@
|
||||
@@ -401,17 +517,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
|
@ -413,7 +409,7 @@
|
|||
if (this.bans.isBanned(gameprofile)) {
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
@@ -427,9 +592,11 @@
|
||||
@@ -420,9 +585,11 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -427,7 +423,7 @@
|
|||
} else if (this.ipBans.isBanned(socketaddress)) {
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
@@ -438,17 +605,32 @@
|
||||
@@ -431,17 +598,32 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -465,7 +461,7 @@
|
|||
UUID uuid = gameprofile.getId();
|
||||
Set<EntityPlayer> set = Sets.newIdentityHashSet();
|
||||
Iterator iterator = this.players.iterator();
|
||||
@@ -476,14 +658,24 @@
|
||||
@@ -469,22 +651,41 @@
|
||||
}
|
||||
|
||||
return !set.isEmpty();
|
||||
|
@ -474,142 +470,96 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
- public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag) {
|
||||
- public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, Entity.RemovalReason entity_removalreason) {
|
||||
+ // CraftBukkit start
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, RespawnReason reason) {
|
||||
+ return this.respawn(entityplayer, this.server.getLevel(entityplayer.getRespawnDimension()), flag, null, true, reason);
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, Entity.RemovalReason entity_removalreason, RespawnReason reason) {
|
||||
+ return this.respawn(entityplayer, flag, entity_removalreason, reason, null);
|
||||
+ }
|
||||
+
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
||||
+ public EntityPlayer respawn(EntityPlayer entityplayer, boolean flag, Entity.RemovalReason entity_removalreason, RespawnReason reason, Location location) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
entityplayer.serverLevel().removePlayerImmediately(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
BlockPosition blockposition = entityplayer.getRespawnPosition();
|
||||
float f = entityplayer.getRespawnAngle();
|
||||
boolean flag1 = entityplayer.isRespawnForced();
|
||||
entityplayer.serverLevel().removePlayerImmediately(entityplayer, entity_removalreason);
|
||||
+ /* CraftBukkit start
|
||||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -495,6 +687,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile(), entityplayer.clientInformation());
|
||||
DimensionTransition dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING);
|
||||
WorldServer worldserver = dimensiontransition.newLevel();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver, entityplayer.getGameProfile(), entityplayer.clientInformation());
|
||||
+ // */
|
||||
+ EntityPlayer entityplayer1 = entityplayer;
|
||||
+ org.bukkit.World fromWorld = entityplayer.getBukkitEntity().getWorld();
|
||||
+ World fromWorld = entityplayer.level();
|
||||
+ entityplayer.wonGame = false;
|
||||
+ // CraftBukkit end
|
||||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -510,28 +707,66 @@
|
||||
entityplayer1.setId(entityplayer.getId());
|
||||
entityplayer1.setMainArm(entityplayer.getMainArm());
|
||||
+ // CraftBukkit - not required, just copies old location into reused entity
|
||||
+ /*
|
||||
if (!dimensiontransition.missingRespawnBlock()) {
|
||||
entityplayer1.copyRespawnPosition(entityplayer);
|
||||
}
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
|
||||
boolean flag2 = false;
|
||||
Iterator iterator = entityplayer.getTags().iterator();
|
||||
|
||||
@@ -494,11 +695,26 @@
|
||||
entityplayer1.addTag(s);
|
||||
}
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
- IBlockData iblockdata = worldserver1.getBlockState(blockposition);
|
||||
- boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
- Vec3D vec3d = (Vec3D) optional.get();
|
||||
- float f1;
|
||||
+ // CraftBukkit start - fire PlayerRespawnEvent
|
||||
+ DimensionTransition dimensiontransition;
|
||||
+ if (location == null) {
|
||||
+ boolean isBedSpawn = false;
|
||||
+ WorldServer worldserver1 = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
+ if (worldserver1 != null) {
|
||||
+ Optional optional;
|
||||
|
||||
- if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
|
||||
- f1 = f;
|
||||
- } else {
|
||||
- Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
+ if (blockposition != null) {
|
||||
+ optional = EntityHuman.findRespawnPositionAndUseSpawnBlock(worldserver1, blockposition, f, flag1, flag);
|
||||
+ } else {
|
||||
+ optional = Optional.empty();
|
||||
+ }
|
||||
|
||||
- f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ if (optional.isPresent()) {
|
||||
+ IBlockData iblockdata = worldserver1.getBlockState(blockposition);
|
||||
+ boolean flag3 = iblockdata.is(Blocks.RESPAWN_ANCHOR);
|
||||
+ Vec3D vec3d = (Vec3D) optional.get();
|
||||
+ float f1;
|
||||
+ dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING, reason);
|
||||
+
|
||||
+ if (!iblockdata.is(TagsBlock.BEDS) && !flag3) {
|
||||
+ f1 = f;
|
||||
+ } else {
|
||||
+ Vec3D vec3d1 = Vec3D.atBottomCenterOf(blockposition).subtract(vec3d).normalize();
|
||||
+
|
||||
+ f1 = (float) MathHelper.wrapDegrees(MathHelper.atan2(vec3d1.z, vec3d1.x) * 57.2957763671875D - 90.0D);
|
||||
+ }
|
||||
+
|
||||
+ // entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false); // CraftBukkit - not required, just copies old location into reused entity
|
||||
+ flag2 = !flag && flag3;
|
||||
+ isBedSpawn = true;
|
||||
+ location = CraftLocation.toBukkit(vec3d, worldserver1.getWorld(), f1, 0.0F);
|
||||
+ } else if (blockposition != null) {
|
||||
+ entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
|
||||
+ }
|
||||
}
|
||||
|
||||
- entityplayer1.moveTo(vec3d.x, vec3d.y, vec3d.z, f1, 0.0F);
|
||||
- entityplayer1.setRespawnPosition(worldserver1.dimension(), blockposition, f, flag1, false);
|
||||
- flag2 = !flag && flag3;
|
||||
- } else if (blockposition != null) {
|
||||
- entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ if (location == null) {
|
||||
+ worldserver1 = this.server.getLevel(World.OVERWORLD);
|
||||
+ blockposition = entityplayer1.getSpawnPoint(worldserver1);
|
||||
+ location = CraftLocation.toBukkit(blockposition, worldserver1.getWorld()).add(0.5F, 0.1F, 0.5F);
|
||||
+ }
|
||||
+
|
||||
+ Player respawnPlayer = entityplayer1.getBukkitEntity();
|
||||
+ PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn && !flag2, flag2, reason);
|
||||
+ cserver.getPluginManager().callEvent(respawnEvent);
|
||||
+
|
||||
+ location = respawnEvent.getRespawnLocation();
|
||||
+ if (!flag) entityplayer.reset(); // SPIGOT-4785
|
||||
+ } else {
|
||||
+ location.setWorld(worldserver.getWorld());
|
||||
}
|
||||
+ WorldServer worldserver1 = ((CraftWorld) location.getWorld()).getHandle();
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ dimensiontransition = new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3D.ZERO, location.getYaw(), location.getPitch(), DimensionTransition.DO_NOTHING);
|
||||
+ }
|
||||
+ WorldServer worldserver = dimensiontransition.newLevel();
|
||||
+ entityplayer1.spawnIn(worldserver);
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.setShiftKeyDown(false);
|
||||
+ entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
Vec3D vec3d = dimensiontransition.pos();
|
||||
|
||||
- while (!worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
+ while (avoidSuffocation && !worldserver1.noCollision((Entity) entityplayer1) && entityplayer1.getY() < (double) worldserver1.getMaxBuildHeight()) {
|
||||
+ // CraftBukkit end
|
||||
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
|
||||
- entityplayer1.moveTo(vec3d.x, vec3d.y, vec3d.z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ // CraftBukkit end
|
||||
if (dimensiontransition.missingRespawnBlock()) {
|
||||
entityplayer1.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F));
|
||||
+ entityplayer1.setRespawnPosition(null, null, 0f, false, false, PlayerSpawnChangeEvent.Cause.RESET); // CraftBukkit - SPIGOT-5988: Clear respawn location when obstructed
|
||||
}
|
||||
|
||||
@@ -540,21 +775,43 @@
|
||||
WorldData worlddata = worldserver2.getLevelData();
|
||||
int i = flag ? 1 : 0;
|
||||
@@ -506,17 +722,19 @@
|
||||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
|
||||
entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.createCommonSpawnInfo(worldserver1), (byte) i));
|
||||
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver2.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit
|
||||
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
|
||||
+ entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot())); // CraftBukkit
|
||||
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle()));
|
||||
entityplayer1.connection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
entityplayer1.connection.send(new PacketPlayOutExperience(entityplayer1.experienceProgress, entityplayer1.totalExperience, entityplayer1.experienceLevel));
|
||||
this.sendLevelInfo(entityplayer1, worldserver1);
|
||||
this.sendActivePlayerEffects(entityplayer1);
|
||||
this.sendLevelInfo(entityplayer1, worldserver);
|
||||
this.sendPlayerPermissionLevel(entityplayer1);
|
||||
- worldserver1.addRespawnedPlayer(entityplayer1);
|
||||
- worldserver.addRespawnedPlayer(entityplayer1);
|
||||
- this.players.add(entityplayer1);
|
||||
- this.playersByUUID.put(entityplayer1.getUUID(), entityplayer1);
|
||||
- entityplayer1.initInventoryMenu();
|
||||
+ if (!entityplayer.connection.isDisconnected()) {
|
||||
+ worldserver1.addRespawnedPlayer(entityplayer1);
|
||||
+ worldserver.addRespawnedPlayer(entityplayer1);
|
||||
+ this.players.add(entityplayer1);
|
||||
+ this.playersByUUID.put(entityplayer1.getUUID(), entityplayer1);
|
||||
+ }
|
||||
+ // entityplayer1.initInventoryMenu();
|
||||
entityplayer1.setHealth(entityplayer1.getHealth());
|
||||
if (flag2) {
|
||||
entityplayer1.connection.send(new PacketPlayOutNamedSoundEffect(SoundEffects.RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver1.getRandom().nextLong()));
|
||||
if (!flag) {
|
||||
BlockPosition blockposition = BlockPosition.containing(dimensiontransition.pos());
|
||||
@@ -526,6 +744,27 @@
|
||||
entityplayer1.connection.send(new PacketPlayOutNamedSoundEffect(SoundEffects.RESPAWN_ANCHOR_DEPLETE, SoundCategory.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver.getRandom().nextLong()));
|
||||
}
|
||||
}
|
||||
+ // Added from changeDimension
|
||||
+ sendAllPlayerInfo(entityplayer); // Update health, etc...
|
||||
|
@ -619,23 +569,23 @@
|
|||
+ }
|
||||
+
|
||||
+ // Fire advancement trigger
|
||||
+ entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle());
|
||||
+ entityplayer.triggerDimensionChangeTriggers(worldserver);
|
||||
+
|
||||
+ // Don't fire on respawn
|
||||
+ if (fromWorld != location.getWorld()) {
|
||||
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld);
|
||||
+ if (fromWorld != worldserver) {
|
||||
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld.getWorld());
|
||||
+ server.server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ // Save player file again if they were disconnected
|
||||
+ if (entityplayer.connection.isDisconnected()) {
|
||||
+ this.save(entityplayer);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -567,7 +824,18 @@
|
||||
@@ -554,7 +793,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
|
@ -655,7 +605,7 @@
|
|||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -584,6 +852,25 @@
|
||||
@@ -571,6 +821,25 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -681,7 +631,7 @@
|
|||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -662,7 +949,7 @@
|
||||
@@ -649,7 +918,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
|
@ -690,7 +640,7 @@
|
|||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -686,6 +973,7 @@
|
||||
@@ -673,6 +942,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
|
@ -698,7 +648,7 @@
|
|||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -716,6 +1004,12 @@
|
||||
@@ -703,6 +973,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
|
@ -711,7 +661,7 @@
|
|||
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -755,15 +1049,19 @@
|
||||
@@ -742,15 +1018,19 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
|
@ -735,7 +685,7 @@
|
|||
}
|
||||
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.LEVEL_CHUNKS_LOAD_START, 0.0F));
|
||||
@@ -772,8 +1070,16 @@
|
||||
@@ -759,8 +1039,16 @@
|
||||
|
||||
public void sendAllPlayerInfo(EntityPlayer entityplayer) {
|
||||
entityplayer.inventoryMenu.sendAllDataToRemote();
|
||||
|
@ -753,15 +703,15 @@
|
|||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -829,12 +1135,22 @@
|
||||
@@ -816,12 +1104,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
- for (int i = 0; i < this.players.size(); ++i) {
|
||||
- ((EntityPlayer) this.players.get(i)).connection.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.server_shutdown"));
|
||||
- ((EntityPlayer) this.players.get(i)).connection.disconnect((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.server_shutdown"));
|
||||
+ // CraftBukkit start - disconnect safely
|
||||
+ for (EntityPlayer player : this.players) {
|
||||
+ player.connection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message
|
||||
+ player.connection.disconnect(CraftChatMessage.fromStringOrEmpty(this.server.server.getShutdownMessage())); // CraftBukkit - add custom shutdown message
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
|
@ -778,7 +728,7 @@
|
|||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -892,16 +1208,23 @@
|
||||
@@ -879,16 +1177,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
|
@ -806,7 +756,7 @@
|
|||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -910,7 +1233,7 @@
|
||||
@@ -897,7 +1202,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
|
@ -815,7 +765,7 @@
|
|||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -918,13 +1241,13 @@
|
||||
@@ -905,13 +1210,13 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
|
@ -831,7 +781,7 @@
|
|||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -975,13 +1298,20 @@
|
||||
@@ -962,13 +1267,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -484,6 +484,18 @@
|
||||
@@ -495,6 +495,18 @@
|
||||
datafixerbuilder.addFixer(new DataConverterItemFrame(schema44, false));
|
||||
Schema schema45 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema45, false));
|
||||
@@ -742,7 +754,8 @@
|
||||
@@ -753,7 +765,8 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema110, "Added Zoglin", DataConverterTypes.ENTITY));
|
||||
Schema schema111 = datafixerbuilder.addSchema(2523, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
Schema schema112 = datafixerbuilder.addSchema(2527, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
datafixerbuilder.addFixer(new DataConverterBitStorageAlign(schema112));
|
||||
@@ -805,12 +818,14 @@
|
||||
@@ -816,12 +829,14 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Squid", DataConverterTypes.ENTITY));
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Item Frame", DataConverterTypes.ENTITY));
|
||||
Schema schema131 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Rename copper item suffixes", createRenamer(immutablemap1)));
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -818,7 +833,8 @@
|
||||
@@ -829,7 +844,8 @@
|
||||
|
||||
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema133, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
|
||||
Schema schema134 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema134, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.create(schema134, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
|
||||
@@ -905,10 +921,11 @@
|
||||
@@ -916,10 +932,11 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema159, "Added Allay", DataConverterTypes.ENTITY));
|
||||
Schema schema160 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
|
||||
int2objectopenhashmap1.put(0, "minecraft:tabby");
|
||||
int2objectopenhashmap1.put(1, "minecraft:black");
|
||||
@@ -925,7 +942,8 @@
|
||||
@@ -936,7 +953,8 @@
|
||||
|
||||
Objects.requireNonNull(int2objectopenhashmap);
|
||||
datafixerbuilder.addFixer(new EntityVariantFix(schema161, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
default int getMaxStackSize(ItemStack itemstack) {
|
||||
return Math.min(this.getMaxStackSize(), itemstack.getMaxStackSize());
|
||||
@@ -91,4 +94,29 @@
|
||||
@@ -91,4 +94,22 @@
|
||||
|
||||
return world == null ? false : (world.getBlockEntity(blockposition) != tileentity ? false : entityhuman.canInteractWithBlock(blockposition, (double) f));
|
||||
}
|
||||
|
@ -43,13 +43,6 @@
|
|||
+
|
||||
+ org.bukkit.Location getLocation();
|
||||
+
|
||||
+ default RecipeHolder<?> getCurrentRecipe() {
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ default void setCurrentRecipe(RecipeHolder<?> recipe) {
|
||||
+ }
|
||||
+
|
||||
+ int MAX_STACK = 99;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -41,9 +41,15 @@
|
||||
@@ -42,9 +42,15 @@
|
||||
private final DamageSource stalagmite;
|
||||
private final DamageSource outsideBorder;
|
||||
private final DamageSource genericKill;
|
||||
|
@ -14,9 +14,9 @@
|
|||
+ this.poison = this.source(DamageTypes.MAGIC).poison();
|
||||
+ // CraftBukkit end
|
||||
this.inFire = this.source(DamageTypes.IN_FIRE);
|
||||
this.campfire = this.source(DamageTypes.CAMPFIRE);
|
||||
this.lightningBolt = this.source(DamageTypes.LIGHTNING_BOLT);
|
||||
this.onFire = this.source(DamageTypes.ON_FIRE);
|
||||
@@ -81,6 +87,16 @@
|
||||
@@ -83,6 +89,16 @@
|
||||
return new DamageSource(this.damageTypes.getHolderOrThrow(resourcekey), entity, entity1);
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
|||
public DamageSource inFire() {
|
||||
return this.inFire;
|
||||
}
|
||||
@@ -242,7 +258,13 @@
|
||||
@@ -248,7 +264,13 @@
|
||||
}
|
||||
|
||||
public DamageSource explosion(@Nullable Entity entity, @Nullable Entity entity1) {
|
||||
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
|
||||
public DamageSource sonicBoom(Entity entity) {
|
||||
@@ -250,7 +272,13 @@
|
||||
@@ -256,7 +278,13 @@
|
||||
}
|
||||
|
||||
public DamageSource badRespawnPointExplosion(Vec3D vec3d) {
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -128,8 +128,69 @@
|
||||
@@ -131,8 +131,72 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.Server;
|
||||
+import org.bukkit.block.BlockFace;
|
||||
+import org.bukkit.command.CommandSender;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Vehicle;
|
||||
|
@ -25,6 +24,7 @@
|
|||
+import org.bukkit.craftbukkit.entity.CraftEntity;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.event.CraftPortalEvent;
|
||||
+import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
+import org.bukkit.entity.Pose;
|
||||
+import org.bukkit.event.entity.EntityAirChangeEvent;
|
||||
|
@ -35,6 +35,9 @@
|
|||
+import org.bukkit.event.entity.EntityPortalEvent;
|
||||
+import org.bukkit.event.entity.EntityPoseChangeEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
+import org.bukkit.plugin.PluginManager;
|
||||
+// CraftBukkit end
|
||||
|
@ -70,11 +73,12 @@
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -243,6 +304,29 @@
|
||||
@@ -245,6 +309,30 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData inBlockState;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean forceDrops;
|
||||
+ public boolean persist = true;
|
||||
+ public boolean visibleByDefault = true;
|
||||
+ public boolean valid;
|
||||
|
@ -100,7 +104,7 @@
|
|||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -349,12 +433,18 @@
|
||||
@@ -351,12 +439,18 @@
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
|
@ -121,7 +125,7 @@
|
|||
}
|
||||
|
||||
protected abstract void defineSynchedData(DataWatcher.a datawatcher_a);
|
||||
@@ -363,6 +453,16 @@
|
||||
@@ -365,6 +459,16 @@
|
||||
return this.entityData;
|
||||
}
|
||||
|
||||
|
@ -138,7 +142,7 @@
|
|||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -372,12 +472,24 @@
|
||||
@@ -374,12 +478,24 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -164,7 +168,7 @@
|
|||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -402,6 +514,33 @@
|
||||
@@ -404,6 +520,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
|
@ -198,7 +202,7 @@
|
|||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -443,6 +582,15 @@
|
||||
@@ -445,6 +588,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
|
@ -206,7 +210,7 @@
|
|||
+ public void postTick() {
|
||||
+ // No clean way to break out of ticking once the entity has been copied to a new world, so instead we move the portalling later in the tick cycle
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
+ this.handleNetherPortal();
|
||||
+ this.handlePortal();
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -214,16 +218,16 @@
|
|||
public void baseTick() {
|
||||
this.level().getProfiler().push("entityBaseTick");
|
||||
this.inBlockState = null;
|
||||
@@ -457,7 +605,7 @@
|
||||
@@ -459,7 +611,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
- this.handleNetherPortal();
|
||||
+ if (this instanceof EntityPlayer) this.handleNetherPortal(); // CraftBukkit - // Moved up to postTick
|
||||
- this.handlePortal();
|
||||
+ if (this instanceof EntityPlayer) this.handlePortal(); // CraftBukkit - // Moved up to postTick
|
||||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -492,6 +640,10 @@
|
||||
@@ -494,6 +646,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
|
@ -234,11 +238,20 @@
|
|||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -543,15 +695,47 @@
|
||||
@@ -503,7 +659,7 @@
|
||||
|
||||
this.firstTick = false;
|
||||
if (!this.level().isClientSide && this instanceof Leashable) {
|
||||
- Leashable.tickLeash((Entity) ((Leashable) this));
|
||||
+ Leashable.tickLeash((Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
this.level().getProfiler().pop();
|
||||
@@ -545,15 +701,47 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
- this.igniteForSeconds(15);
|
||||
- this.igniteForSeconds(15.0F);
|
||||
- if (this.hurt(this.damageSources().lava(), 4.0F)) {
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
|
@ -253,7 +266,7 @@
|
|||
+ }
|
||||
+ } else {
|
||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||
+ this.igniteForSeconds(15, false);
|
||||
+ this.igniteForSeconds(15.0F, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.hurt(this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F)) {
|
||||
|
@ -264,27 +277,27 @@
|
|||
}
|
||||
}
|
||||
|
||||
public final void igniteForSeconds(int i) {
|
||||
public final void igniteForSeconds(float f) {
|
||||
+ // CraftBukkit start
|
||||
+ this.igniteForSeconds(i, true);
|
||||
+ this.igniteForSeconds(f, true);
|
||||
+ }
|
||||
+
|
||||
+ public final void igniteForSeconds(int i, boolean callEvent) {
|
||||
+ public final void igniteForSeconds(float f, boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), f);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ i = event.getDuration();
|
||||
+ f = event.getDuration();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.igniteForTicks(i * 20);
|
||||
this.igniteForTicks(MathHelper.floor(f * 20.0F));
|
||||
}
|
||||
|
||||
@@ -575,7 +759,7 @@
|
||||
@@ -577,7 +765,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
|
@ -293,7 +306,7 @@
|
|||
}
|
||||
|
||||
public boolean isFree(double d0, double d1, double d2) {
|
||||
@@ -700,6 +884,28 @@
|
||||
@@ -702,6 +890,28 @@
|
||||
block.updateEntityAfterFallOn(this.level(), this);
|
||||
}
|
||||
|
||||
|
@ -322,7 +335,7 @@
|
|||
if (this.onGround()) {
|
||||
block.stepOn(this.level(), blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1027,6 +1233,20 @@
|
||||
@@ -1073,6 +1283,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -343,7 +356,7 @@
|
|||
protected void checkInsideBlocks() {
|
||||
AxisAlignedBB axisalignedbb = this.getBoundingBox();
|
||||
BlockPosition blockposition = BlockPosition.containing(axisalignedbb.minX + 1.0E-7D, axisalignedbb.minY + 1.0E-7D, axisalignedbb.minZ + 1.0E-7D);
|
||||
@@ -1454,6 +1674,7 @@
|
||||
@@ -1512,6 +1736,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
|
@ -351,7 +364,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1652,6 +1873,12 @@
|
||||
@@ -1718,6 +1943,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -364,7 +377,7 @@
|
|||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1680,16 +1907,22 @@
|
||||
@@ -1746,16 +1977,22 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
|
||||
|
@ -389,7 +402,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1700,16 +1933,38 @@
|
||||
@@ -1766,16 +2003,38 @@
|
||||
}
|
||||
|
||||
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
|
||||
|
@ -432,7 +445,7 @@
|
|||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1717,7 +1972,28 @@
|
||||
@@ -1783,7 +2042,28 @@
|
||||
nbttagcompound.putBoolean("OnGround", this.onGround());
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
|
@ -462,7 +475,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1766,7 +2042,7 @@
|
||||
@@ -1832,7 +2112,7 @@
|
||||
nbttagcompound.put("Tags", nbttaglist);
|
||||
}
|
||||
|
||||
|
@ -471,7 +484,7 @@
|
|||
if (this.isVehicle()) {
|
||||
nbttaglist = new NBTTagList();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1775,7 +2051,7 @@
|
||||
@@ -1841,7 +2121,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
|
@ -480,7 +493,7 @@
|
|||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -1785,6 +2061,11 @@
|
||||
@@ -1851,6 +2131,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,7 +505,7 @@
|
|||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1868,6 +2149,45 @@
|
||||
@@ -1934,6 +2219,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
|
@ -538,7 +551,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1889,6 +2209,12 @@
|
||||
@@ -1955,6 +2279,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
|
@ -551,7 +564,7 @@
|
|||
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
@@ -1943,9 +2269,22 @@
|
||||
@@ -2009,9 +2339,22 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -574,7 +587,34 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2046,6 +2385,27 @@
|
||||
@@ -2040,6 +2383,12 @@
|
||||
if (this.isAlive() && this instanceof Leashable leashable) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
if (!this.level().isClientSide()) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, leashable.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
leashable.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
}
|
||||
@@ -2051,6 +2400,13 @@
|
||||
|
||||
if (itemstack.is(Items.LEAD) && leashable.canHaveALeashAttachedToIt()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, leashable.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
leashable.setLeashedTo(entityhuman, true);
|
||||
}
|
||||
|
||||
@@ -2134,6 +2490,27 @@
|
||||
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -602,7 +642,7 @@
|
|||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -2079,7 +2439,7 @@
|
||||
@@ -2167,7 +2544,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
|
@ -611,7 +651,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -2110,10 +2470,38 @@
|
||||
@@ -2198,10 +2575,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -651,7 +691,7 @@
|
|||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -2125,6 +2513,7 @@
|
||||
@@ -2213,6 +2618,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
|
@ -659,31 +699,16 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2210,14 +2599,20 @@
|
||||
@@ -2307,7 +2713,7 @@
|
||||
if (dimensiontransition != null) {
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
- ResourceKey<World> resourcekey = this.level().dimension() == World.NETHER ? World.OVERWORLD : World.NETHER;
|
||||
+ ResourceKey<World> resourcekey = this.level().getTypeKey() == WorldDimension.NETHER ? World.OVERWORLD : World.NETHER; // CraftBukkit
|
||||
WorldServer worldserver1 = minecraftserver.getLevel(resourcekey);
|
||||
|
||||
- if (worldserver1 != null && minecraftserver.isNetherEnabled() && !this.isPassenger() && this.portalTime++ >= i) {
|
||||
+ if (true && !this.isPassenger() && this.portalTime++ >= i) { // CraftBukkit
|
||||
this.level().getProfiler().push("portal");
|
||||
this.portalTime = i;
|
||||
this.setPortalCooldown();
|
||||
- this.changeDimension(worldserver1);
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).changeDimension(worldserver1, PlayerTeleportEvent.TeleportCause.NETHER_PORTAL);
|
||||
+ } else {
|
||||
+ this.changeDimension(worldserver1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2327,6 +2722,13 @@
|
||||
- if (worldserver.getServer().isLevelEnabled(worldserver1) && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1))) {
|
||||
+ if (this instanceof EntityPlayer || (worldserver1 != null && (worldserver1.dimension() == worldserver.dimension() || this.canChangeDimensions(worldserver, worldserver1)))) { // CraftBukkit - always call event for players
|
||||
this.changeDimension(dimensiontransition);
|
||||
}
|
||||
}
|
||||
@@ -2414,6 +2820,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
|
@ -697,7 +722,7 @@
|
|||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2376,8 +2778,12 @@
|
||||
@@ -2463,8 +2876,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
|
@ -711,7 +736,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2396,7 +2802,7 @@
|
||||
@@ -2483,7 +2900,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -720,7 +745,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2404,7 +2810,18 @@
|
||||
@@ -2491,7 +2908,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
|
@ -740,7 +765,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2431,11 +2848,40 @@
|
||||
@@ -2518,11 +2946,40 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -751,9 +776,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.igniteForSeconds(8);
|
||||
- this.igniteForSeconds(8.0F);
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8.0F);
|
||||
+ pluginManager.callEvent(entityCombustEvent);
|
||||
+ if (!entityCombustEvent.isCancelled()) {
|
||||
+ this.igniteForSeconds(entityCombustEvent.getDuration(), false);
|
||||
|
@ -783,157 +808,58 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2600,15 +3046,38 @@
|
||||
@@ -2691,6 +3148,15 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
+ // CraftBukkit start
|
||||
+ return teleportTo(worldserver, null);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public Entity teleportTo(WorldServer worldserver, Vec3D location) {
|
||||
+ // CraftBukkit end
|
||||
if (this.level() instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level().getProfiler().push("changeDimension");
|
||||
- this.unRide();
|
||||
+ // CraftBukkit start
|
||||
+ // this.unRide();
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().getProfiler().push("reposition");
|
||||
- ShapeDetectorShape shapedetectorshape = this.findDimensionEntryPoint(worldserver);
|
||||
+ ShapeDetectorShape shapedetectorshape = (location == null) ? this.findDimensionEntryPoint(worldserver) : new ShapeDetectorShape(new Vec3D(location.x(), location.y(), location.z()), Vec3D.ZERO, this.yRot, this.xRot, worldserver, null); // CraftBukkit
|
||||
|
||||
if (shapedetectorshape == null) {
|
||||
return null;
|
||||
} else {
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.isRemoved()) {
|
||||
+ // CraftBukkit start
|
||||
+ worldserver = shapedetectorshape.world;
|
||||
+ if (worldserver == level) {
|
||||
+ // SPIGOT-6782: Just move the entity if a plugin changed the world to the one the entity is already in
|
||||
+ moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ setDeltaMovement(shapedetectorshape.speed);
|
||||
+ return this;
|
||||
+ Location to = new Location(dimensiontransition.newLevel().getWorld(), dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), dimensiontransition.xRot());
|
||||
+ EntityTeleportEvent teleEvent = CraftEventFactory.callEntityTeleportEvent(this, to);
|
||||
+ if (teleEvent.isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.unRide();
|
||||
+ to = teleEvent.getTo();
|
||||
+ dimensiontransition = new DimensionTransition(((CraftWorld) to.getWorld()).getHandle(), CraftLocation.toVec3D(to), dimensiontransition.speed(), to.getYaw(), to.getPitch(), dimensiontransition.missingRespawnBlock(), dimensiontransition.postDimensionTransition(), dimensiontransition.cause());
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.level().getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
WorldServer worldserver1 = dimensiontransition.newLevel();
|
||||
List<Entity> list = this.getPassengers();
|
||||
|
||||
@@ -2616,10 +3085,22 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
- worldserver.addDuringTeleport(entity);
|
||||
- if (worldserver.dimension() == World.END) {
|
||||
- WorldServer.makeObsidianPlatform(worldserver);
|
||||
+ // CraftBukkit start - Don't spawn the new entity if the current entity isn't spawned
|
||||
+ if (this.inWorld) {
|
||||
+ worldserver.addDuringTeleport(entity);
|
||||
+ if (worldserver.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
+ WorldServer.makeObsidianPlatform(worldserver, this); // CraftBukkit
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity);
|
||||
+ entity.bukkitEntity = this.getBukkitEntity();
|
||||
+
|
||||
+ if (this instanceof EntityInsentient) {
|
||||
+ ((EntityInsentient) this).dropLeash(true, false); // Unleash to prevent duping of leads.
|
||||
@@ -2716,11 +3182,15 @@
|
||||
if (this != entity2) {
|
||||
entity2.restoreFrom(this);
|
||||
this.removeAfterChangingDimensions();
|
||||
+ // CraftBukkit start - Forward the CraftEntity to the new entity
|
||||
+ this.getBukkitEntity().setHandle(entity2);
|
||||
+ entity2.bukkitEntity = this.getBukkitEntity();
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2635,25 +3116,39 @@
|
||||
entity2.moveTo(dimensiontransition.pos().x, dimensiontransition.pos().y, dimensiontransition.pos().z, dimensiontransition.yRot(), entity2.getXRot());
|
||||
entity2.setDeltaMovement(dimensiontransition.speed());
|
||||
- if (this != entity2) {
|
||||
+ if (this != entity2 && this.inWorld) { // CraftBukkit - Don't spawn the new entity if the current entity isn't spawned
|
||||
worldserver1.addDuringTeleport(entity2);
|
||||
}
|
||||
|
||||
@@ -2754,8 +3224,9 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
- this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
+ this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
- boolean flag = this.level().dimension() == World.END && worldserver.dimension() == World.OVERWORLD;
|
||||
- boolean flag1 = worldserver.dimension() == World.END;
|
||||
+ // CraftBukkit start
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ boolean flag = this.level().getTypeKey() == WorldDimension.END && worldserver.getTypeKey() == WorldDimension.OVERWORLD; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == WorldDimension.END; // targetIsEnd
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!flag && !flag1) {
|
||||
- boolean flag2 = worldserver.dimension() == World.NETHER;
|
||||
+ boolean flag2 = worldserver.getTypeKey() == WorldDimension.NETHER; // CraftBukkit
|
||||
|
||||
- if (this.level().dimension() != World.NETHER && !flag2) {
|
||||
+ if (this.level().getTypeKey() != WorldDimension.NETHER && !flag2) { // CraftBukkit
|
||||
return null;
|
||||
} else {
|
||||
WorldBorder worldborder = worldserver.getWorldBorder();
|
||||
double d0 = DimensionManager.getTeleportationScale(this.level().dimensionType(), worldserver.dimensionType());
|
||||
BlockPosition blockposition = worldborder.clampToBounds(this.getX() * d0, this.getY(), this.getZ() * d0);
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ final WorldServer worldserverFinal = worldserver = ((CraftWorld) event.getTo().getWorld()).getHandle();
|
||||
+ worldborder = worldserverFinal.getWorldBorder();
|
||||
+ blockposition = worldborder.clampToBounds(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ());
|
||||
|
||||
- return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder).map((blockutil_rectangle) -> {
|
||||
+ return (ShapeDetectorShape) this.getExitPortal(worldserver, blockposition, flag2, worldborder, event.getSearchRadius(), event.getCanCreatePortal(), event.getCreationRadius()).map((blockutil_rectangle) -> {
|
||||
+ // CraftBukkit end
|
||||
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2670,8 +3165,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
- return BlockPortalShape.createPortalInfo(worldserver, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- }).orElse((Object) null);
|
||||
+ return BlockPortalShape.createPortalInfo(worldserverFinal, blockutil_rectangle, enumdirection_enumaxis, vec3d, this, this.getDeltaMovement(), this.getYRot(), this.getXRot(), event); // CraftBukkit
|
||||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1 = flag1 ? WorldServer.END_SPAWN_POINT : worldserver.getSharedSpawnPos();
|
||||
@@ -2684,8 +3179,14 @@
|
||||
} else {
|
||||
i = worldserver.getChunkAt(blockposition1).getHeight(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, blockposition1.getX(), blockposition1.getZ()) + 1;
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, i, blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) i, (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
+ return new ShapeDetectorShape(new Vec3D(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
+ // CraftBukkit end
|
||||
if (this instanceof Leashable leashable) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
leashable.dropLeash(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2693,8 +3194,23 @@
|
||||
@@ -2765,6 +3236,20 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
- protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder) {
|
||||
- return worldserver.getPortalForcer().findPortalAround(blockposition, flag, worldborder);
|
||||
+ // CraftBukkit start
|
||||
+ protected CraftPortalEvent callPortalEvent(Entity entity, WorldServer exitWorldServer, Vec3D exitPosition, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ public CraftPortalEvent callPortalEvent(Entity entity, Location exit, PlayerTeleportEvent.TeleportCause cause, int searchRadius, int creationRadius) {
|
||||
+ org.bukkit.entity.Entity bukkitEntity = entity.getBukkitEntity();
|
||||
+ Location enter = bukkitEntity.getLocation();
|
||||
+ Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld());
|
||||
+
|
||||
+ EntityPortalEvent event = new EntityPortalEvent(bukkitEntity, enter, exit, searchRadius);
|
||||
+ event.getEntity().getServer().getPluginManager().callEvent(event);
|
||||
|
@ -942,15 +868,13 @@
|
|||
+ }
|
||||
+ return new CraftPortalEvent(event);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ protected Optional<BlockUtil.Rectangle> getExitPortal(WorldServer worldserver, BlockPosition blockposition, boolean flag, WorldBorder worldborder, int searchRadius, boolean canCreatePortal, int createRadius) {
|
||||
+ return worldserver.getPortalForcer().findPortalAround(blockposition, worldborder, searchRadius);
|
||||
+ // CraftBukkit end
|
||||
public boolean canUsePortal(boolean flag) {
|
||||
return (flag || !this.isPassenger()) && this.isAlive();
|
||||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2815,6 +3331,12 @@
|
||||
}
|
||||
@@ -2877,6 +3362,12 @@
|
||||
return (Boolean) this.entityData.get(Entity.DATA_CUSTOM_NAME_VISIBLE);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -962,7 +886,7 @@
|
|||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
float f2 = MathHelper.clamp(f1, -90.0F, 90.0F);
|
||||
|
||||
@@ -2833,8 +3355,12 @@
|
||||
@@ -2895,8 +3386,12 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(d0, d1, d2, f, f2);
|
||||
entity.setYHeadRot(f);
|
||||
|
@ -977,7 +901,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -2942,7 +3468,26 @@
|
||||
@@ -3023,7 +3518,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -1005,7 +929,7 @@
|
|||
}
|
||||
|
||||
public final float getEyeHeight(EntityPose entitypose) {
|
||||
@@ -3263,6 +3808,11 @@
|
||||
@@ -3332,6 +3846,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -1017,7 +941,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -3532,6 +4082,14 @@
|
||||
@@ -3601,6 +4120,14 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason entity_removalreason) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -30,6 +30,12 @@
|
||||
@@ -32,6 +32,12 @@
|
||||
import net.minecraft.world.level.material.EnumPistonReaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -186,7 +192,7 @@
|
||||
@@ -188,7 +194,7 @@
|
||||
}
|
||||
} else {
|
||||
if (this.tickCount >= this.waitTime + this.duration) {
|
||||
|
@ -22,7 +22,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -203,7 +209,7 @@
|
||||
@@ -205,7 +211,7 @@
|
||||
if (this.radiusPerTick != 0.0F) {
|
||||
f += this.radiusPerTick;
|
||||
if (f < 0.5F) {
|
||||
|
@ -31,7 +31,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -237,6 +243,7 @@
|
||||
@@ -239,11 +245,12 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
|
@ -39,47 +39,55 @@
|
|||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -246,6 +253,17 @@
|
||||
double d5 = d3 * d3 + d4 * d4;
|
||||
if (!this.victims.containsKey(entityliving) && entityliving.isAffectedByPotions()) {
|
||||
- Stream stream = list.stream();
|
||||
+ Stream<MobEffect> stream = list.stream(); // CraftBukkit - decompile error
|
||||
|
||||
if (d5 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
Objects.requireNonNull(entityliving);
|
||||
if (!stream.noneMatch(entityliving::canBeAffected)) {
|
||||
@@ -252,6 +259,19 @@
|
||||
double d5 = d3 * d3 + d4 * d4;
|
||||
|
||||
if (d5 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
||||
+ if (entity instanceof CraftLivingEntity) {
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
+ {
|
||||
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
||||
+ if (entity instanceof CraftLivingEntity) {
|
||||
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
||||
+ // CraftBukkit end
|
||||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -255,14 +273,14 @@
|
||||
if (((MobEffectList) mobeffect1.getEffect().value()).isInstantenous()) {
|
||||
((MobEffectList) mobeffect1.getEffect().value()).applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
if (this.radiusOnUse != 0.0F) {
|
||||
f += this.radiusOnUse;
|
||||
if (f < 0.5F) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
@@ -261,14 +281,14 @@
|
||||
if (((MobEffectList) mobeffect1.getEffect().value()).isInstantenous()) {
|
||||
((MobEffectList) mobeffect1.getEffect().value()).applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,7 +290,7 @@
|
||||
if (this.durationOnUse != 0) {
|
||||
this.duration += this.durationOnUse;
|
||||
if (this.duration <= 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
if (this.radiusOnUse != 0.0F) {
|
||||
f += this.radiusOnUse;
|
||||
if (f < 0.5F) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -278,7 +298,7 @@
|
||||
if (this.durationOnUse != 0) {
|
||||
this.duration += this.durationOnUse;
|
||||
if (this.duration <= 0) {
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,19 +11,3 @@
|
|||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
|
||||
@@ -67,6 +71,7 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
|
||||
if (f > 10.0F) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -75,6 +80,7 @@
|
||||
|
||||
this.onLeashDistance(f);
|
||||
if (f > 10.0F) {
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
this.goalSelector.disableControlFlag(PathfinderGoal.Type.MOVE);
|
||||
} else if (f > 6.0F) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -22,6 +22,14 @@
|
||||
@@ -25,6 +25,14 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class EntityExperienceOrb extends Entity {
|
||||
|
||||
private static final int LIFETIME = 6000;
|
||||
@@ -65,6 +73,7 @@
|
||||
@@ -68,6 +76,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -23,7 +23,7 @@
|
|||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -90,7 +99,22 @@
|
||||
@@ -93,7 +102,22 @@
|
||||
this.followingPlayer = null;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
|
||||
double d0 = vec3d.lengthSqr();
|
||||
|
||||
@@ -115,7 +139,7 @@
|
||||
@@ -118,7 +142,7 @@
|
||||
|
||||
++this.age;
|
||||
if (this.age >= 6000) {
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -184,7 +208,7 @@
|
||||
@@ -187,7 +211,7 @@
|
||||
private void merge(EntityExperienceOrb entityexperienceorb) {
|
||||
this.count += entityexperienceorb.count;
|
||||
this.age = Math.min(this.age, entityexperienceorb.age);
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
private void setUnderwaterMovement() {
|
||||
@@ -206,7 +230,7 @@
|
||||
@@ -209,7 +233,7 @@
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
if (this.health <= 0) {
|
||||
|
@ -74,14 +74,14 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -233,17 +257,17 @@
|
||||
@@ -236,17 +260,17 @@
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (entityhuman instanceof EntityPlayer entityplayer) {
|
||||
if (entityhuman.takeXpDelay == 0) {
|
||||
- entityhuman.takeXpDelay = 2;
|
||||
+ entityhuman.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(entityhuman, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
|
||||
entityhuman.take(this, 1);
|
||||
int i = this.repairPlayerItems(entityhuman, this.value);
|
||||
int i = this.repairPlayerItems(entityplayer, this.value);
|
||||
|
||||
if (i > 0) {
|
||||
- entityhuman.giveExperiencePoints(i);
|
||||
|
@ -95,25 +95,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -256,9 +280,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
|
||||
@@ -260,12 +284,20 @@
|
||||
ItemStack itemstack = ((EnchantedItemInUse) optional.get()).itemStack();
|
||||
int j = EnchantmentManager.modifyDurabilityToRepairFromXp(entityplayer.serverLevel(), itemstack, i);
|
||||
int k = Math.min(j, itemstack.getDamageValue());
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, entry.getKey(), j);
|
||||
+ j = event.getRepairAmount();
|
||||
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityplayer, this, itemstack, optional.get().inSlot(), k);
|
||||
+ k = event.getRepairAmount();
|
||||
+ if (event.isCancelled()) {
|
||||
+ return i;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
itemstack.setDamageValue(itemstack.getDamageValue() - j);
|
||||
int k = i - this.durabilityToXp(j);
|
||||
+ this.value = k; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls
|
||||
itemstack.setDamageValue(itemstack.getDamageValue() - k);
|
||||
if (k > 0) {
|
||||
int l = i - k * i / j;
|
||||
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -283,6 +315,24 @@
|
||||
if (l > 0) {
|
||||
+ this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls
|
||||
return this.repairPlayerItems(entityplayer, l);
|
||||
}
|
||||
}
|
||||
@@ -285,6 +317,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -89,6 +89,20 @@
|
||||
@@ -87,6 +87,20 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
|
@ -18,10 +18,10 @@
|
|||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Targeting {
|
||||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Leashable, Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -138,6 +152,8 @@
|
||||
@@ -134,6 +148,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -165,6 +181,12 @@
|
||||
@@ -161,6 +177,12 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
|||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -269,11 +291,42 @@
|
||||
@@ -265,11 +287,42 @@
|
||||
|
||||
@Nullable
|
||||
protected final EntityLiving getTargetFromBrain() {
|
||||
|
@ -87,7 +87,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -412,6 +465,12 @@
|
||||
@@ -405,6 +458,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -100,19 +100,7 @@
|
|||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -486,7 +545,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (either != null) {
|
||||
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
+ Entity leashHolder = this.leashHolder;
|
||||
+ if (either != null && (leashHolder == null || !leashHolder.pluginRemoved)) {
|
||||
+ // CraftBukkit end
|
||||
nbttagcompound.put("leash", (NBTBase) either.map((uuid) -> {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -507,16 +569,26 @@
|
||||
@@ -478,16 +537,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
|
@ -141,16 +129,7 @@
|
|||
NBTTagList nbttaglist;
|
||||
NBTTagCompound nbttagcompound1;
|
||||
int i;
|
||||
@@ -565,7 +637,7 @@
|
||||
if (nbttagcompound.contains("leash", 10)) {
|
||||
this.delayedLeashInfo = Either.left(nbttagcompound.getCompound("leash").getUUID("UUID"));
|
||||
} else if (nbttagcompound.contains("leash", 11)) {
|
||||
- this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
|
||||
+ this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
this.delayedLeashInfo = null;
|
||||
}
|
||||
@@ -577,6 +649,11 @@
|
||||
@@ -541,6 +610,11 @@
|
||||
}
|
||||
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
|
@ -162,7 +141,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -651,20 +728,26 @@
|
||||
@@ -615,20 +689,26 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
@ -188,10 +167,10 @@
|
|||
+
|
||||
+ public ItemStack equipItemIfPossible(ItemStack itemstack, EntityItem entityitem) {
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
EnumItemSlot enumitemslot = this.getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -675,11 +758,19 @@
|
||||
@@ -639,11 +719,19 @@
|
||||
flag = itemstack1.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -211,8 +190,8 @@
|
|||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -813,7 +904,7 @@
|
||||
ItemStack itemstack2 = enumitemslot.limit(itemstack);
|
||||
@@ -772,7 +860,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
@ -221,7 +200,7 @@
|
|||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
||||
|
||||
@@ -823,14 +914,14 @@
|
||||
@@ -782,14 +870,14 @@
|
||||
int j = i * i;
|
||||
|
||||
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||
|
@ -238,7 +217,7 @@
|
|||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
}
|
||||
@@ -844,6 +935,7 @@
|
||||
@@ -803,6 +891,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
|
@ -246,43 +225,16 @@
|
|||
GameProfilerFiller gameprofilerfiller = this.level().getProfiler();
|
||||
|
||||
gameprofilerfiller.push("sensing");
|
||||
@@ -1311,6 +1403,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start - fire PlayerUnleashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1336,6 +1434,13 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -1354,7 +1443,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, this.getType(), (WorldServer) this.level(), this.position(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getType(), (WorldServer) this.level(), this.position(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
+ // CraftBukkit start - fire PlayerLeashEntityEvent
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).resendItemInHands(); // SPIGOT-7615: Resend to fix client desync with used item
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(this, this.getLeashHolder()));
|
||||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1351,7 +1456,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
- Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, this.getType(), (WorldServer) this.level(), this.position(), itemstack);
|
||||
+ Optional<EntityInsentient> optional = itemmonsteregg.spawnOffspringFromSpawnEgg(entityhuman, this, (EntityTypes<? extends EntityInsentient>) this.getType(), (WorldServer) this.level(), this.position(), itemstack); // CraftBukkit - decompile error
|
||||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1401,12 +1506,19 @@
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1403,12 +1492,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
|
@ -303,7 +255,7 @@
|
|||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1440,7 +1552,12 @@
|
||||
@@ -1442,7 +1538,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -317,7 +269,7 @@
|
|||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1448,7 +1565,7 @@
|
||||
@@ -1450,7 +1551,7 @@
|
||||
t0.startRiding(entity, true);
|
||||
}
|
||||
|
||||
|
@ -326,27 +278,7 @@
|
|||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -1461,7 +1578,8 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
- this.dropLeash(true, true);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ this.dropLeash(true, !this.leashHolder.pluginRemoved);// CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1473,7 +1591,9 @@
|
||||
this.delayedLeashInfo = null;
|
||||
this.clearRestriction();
|
||||
if (!this.level().isClientSide && flag1) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
|
||||
@@ -1527,6 +1647,7 @@
|
||||
@@ -1492,6 +1593,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
|
@ -354,45 +286,12 @@
|
|||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1555,7 +1676,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.delayedLeashInfo = null;
|
||||
}
|
||||
}
|
||||
@@ -1638,14 +1761,21 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
- entity.igniteForSeconds(i * 4);
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), i * 4);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
|
||||
|
||||
if (flag) {
|
||||
@@ -1578,7 +1680,7 @@
|
||||
if (f1 > 0.0F && entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot())) * 0.017453292F, this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
EntityLiving entityliving = (EntityLiving) entity;
|
||||
|
||||
- entityliving.knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
+ entityliving.knockback((double) (f1 * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, org.bukkit.event.entity.EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
@@ -1695,6 +1825,7 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.dropLeash(true, false);
|
||||
this.getAllSlots().forEach((itemstack) -> {
|
||||
if (!itemstack.isEmpty()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -126,6 +126,32 @@
|
||||
@@ -132,6 +132,32 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -9,9 +9,9 @@
|
|||
+import java.util.HashSet;
|
||||
+import java.util.Set;
|
||||
+import com.google.common.base.Function;
|
||||
+import java.util.UUID;
|
||||
+import net.minecraft.nbt.NBTTagFloat;
|
||||
+import net.minecraft.nbt.NBTTagInt;
|
||||
+import net.minecraft.world.entity.animal.EntityAnimal;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.attribute.CraftAttributeMap;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -33,13 +33,12 @@
|
|||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -237,6 +263,20 @@
|
||||
protected BehaviorController<?> brain;
|
||||
@@ -249,6 +275,19 @@
|
||||
protected boolean skipDropExperience;
|
||||
private final Reference2ObjectMap<Enchantment, Set<EnchantmentLocationBasedEffect>> activeLocationDependentEnchantments;
|
||||
protected float appliedScale;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public boolean forceDrops;
|
||||
+ public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
+ public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
|
||||
+ public boolean collides = true;
|
||||
|
@ -54,8 +53,8 @@
|
|||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -251,7 +291,9 @@
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
@@ -264,7 +303,9 @@
|
||||
this.activeLocationDependentEnchantments = new Reference2ObjectArrayMap();
|
||||
this.appliedScale = 1.0F;
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
- this.setHealth(this.getMaxHealth());
|
||||
|
@ -65,22 +64,22 @@
|
|||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -329,7 +371,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
@@ -344,7 +385,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
|
||||
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.level()).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.level()).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,7 +642,7 @@
|
||||
@@ -555,7 +602,7 @@
|
||||
++this.deathTime;
|
||||
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||
|
@ -89,7 +88,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -693,13 +741,19 @@
|
||||
@@ -661,13 +708,19 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
|
@ -110,7 +109,7 @@
|
|||
this.level().playSeededSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||
}
|
||||
|
||||
@@ -713,6 +767,13 @@
|
||||
@@ -681,11 +734,18 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -122,10 +121,7 @@
|
|||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (entity_removalreason == Entity.RemovalReason.KILLED || entity_removalreason == Entity.RemovalReason.DISCARDED) {
|
||||
Iterator iterator = this.getActiveEffects().iterator();
|
||||
|
||||
@@ -723,7 +784,7 @@
|
||||
}
|
||||
this.triggerOnDeathMobEffects(entity_removalreason);
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
|
@ -133,7 +129,7 @@
|
|||
this.brain.clearMemories();
|
||||
}
|
||||
|
||||
@@ -783,6 +844,17 @@
|
||||
@@ -757,6 +817,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -151,7 +147,7 @@
|
|||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -821,9 +893,32 @@
|
||||
@@ -795,9 +866,32 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -184,7 +180,7 @@
|
|||
try {
|
||||
while (iterator.hasNext()) {
|
||||
Holder<MobEffectList> holder = (Holder) iterator.next();
|
||||
@@ -833,6 +928,12 @@
|
||||
@@ -807,6 +901,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -197,7 +193,7 @@
|
|||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -843,6 +944,17 @@
|
||||
@@ -817,6 +917,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
|
@ -215,7 +211,7 @@
|
|||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -958,7 +1070,13 @@
|
||||
@@ -932,7 +1043,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_PARTICLES, List.of());
|
||||
}
|
||||
|
||||
|
@ -229,7 +225,7 @@
|
|||
if (this.level().isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -967,7 +1085,14 @@
|
||||
@@ -941,7 +1058,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
|
@ -245,7 +241,7 @@
|
|||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -996,20 +1121,50 @@
|
||||
@@ -970,20 +1094,50 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
|
@ -297,7 +293,7 @@
|
|||
flag = true;
|
||||
}
|
||||
|
||||
@@ -1040,13 +1195,39 @@
|
||||
@@ -1014,13 +1168,39 @@
|
||||
return this.getType().is(TagsEntity.INVERTED_HEALING_AND_HARM);
|
||||
}
|
||||
|
||||
|
@ -338,7 +334,7 @@
|
|||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1142,20 +1323,55 @@
|
||||
@@ -1118,20 +1298,55 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -395,7 +391,7 @@
|
|||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1169,7 +1385,7 @@
|
||||
@@ -1145,7 +1360,7 @@
|
||||
return false;
|
||||
} else if (this.level().isClientSide) {
|
||||
return false;
|
||||
|
@ -404,7 +400,7 @@
|
|||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1180,10 +1396,11 @@
|
||||
@@ -1156,10 +1371,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
|
@ -418,7 +414,7 @@
|
|||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1204,7 +1421,8 @@
|
||||
@@ -1180,7 +1396,8 @@
|
||||
f *= 5.0F;
|
||||
}
|
||||
|
||||
|
@ -428,7 +424,7 @@
|
|||
this.hurtHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
@@ -1212,18 +1430,27 @@
|
||||
@@ -1188,18 +1405,27 @@
|
||||
this.walkAnimation.setSpeed(1.5F);
|
||||
boolean flag1 = true;
|
||||
|
||||
|
@ -460,7 +456,7 @@
|
|||
this.hurtDuration = 10;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
@@ -1269,7 +1496,7 @@
|
||||
@@ -1245,7 +1471,7 @@
|
||||
this.level().broadcastDamageEvent(this, damagesource);
|
||||
}
|
||||
|
||||
|
@ -469,8 +465,8 @@
|
|||
this.markHurt();
|
||||
}
|
||||
|
||||
@@ -1282,7 +1509,7 @@
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
@@ -1265,7 +1491,7 @@
|
||||
d1 = damagesource.getSourcePosition().z() - this.getZ();
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1);
|
||||
|
@ -478,7 +474,7 @@
|
|||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1301,7 +1528,7 @@
|
||||
@@ -1284,7 +1510,7 @@
|
||||
this.playHurtSound(damagesource);
|
||||
}
|
||||
|
||||
|
@ -487,7 +483,7 @@
|
|||
|
||||
if (flag2) {
|
||||
this.lastDamageSource = damagesource;
|
||||
@@ -1335,7 +1562,7 @@
|
||||
@@ -1318,7 +1544,7 @@
|
||||
}
|
||||
|
||||
protected void blockedByShield(EntityLiving entityliving) {
|
||||
|
@ -496,7 +492,7 @@
|
|||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource damagesource) {
|
||||
@@ -1346,19 +1573,32 @@
|
||||
@@ -1329,19 +1555,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
|
@ -533,7 +529,7 @@
|
|||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1367,14 +1607,16 @@
|
||||
@@ -1350,14 +1589,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
|
@ -555,7 +551,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1481,14 +1723,22 @@
|
||||
@@ -1464,14 +1705,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
|
@ -580,14 +576,14 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1508,21 +1758,40 @@
|
||||
|
||||
@@ -1482,26 +1731,41 @@
|
||||
protected void dropAllDeathLoot(WorldServer worldserver, DamageSource damagesource) {
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
+ this.dropEquipment(); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
if (this.shouldDropLoot() && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.dropFromLootTable(damagesource, flag);
|
||||
this.dropCustomDeathLoot(damagesource, i, flag);
|
||||
this.dropCustomDeathLoot(worldserver, damagesource, flag);
|
||||
}
|
||||
+ // CraftBukkit start - Call death event
|
||||
+ CraftEventFactory.callEntityDeathEvent(this, damagesource, this.drops);
|
||||
|
@ -595,36 +591,37 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
- this.dropEquipment();
|
||||
+ // this.dropInventory();// CraftBukkit - moved up
|
||||
this.dropExperience();
|
||||
+ // this.dropEquipment();// CraftBukkit - moved up
|
||||
this.dropExperience(damagesource.getEntity());
|
||||
}
|
||||
|
||||
protected void dropEquipment() {}
|
||||
|
||||
- protected void dropExperience() {
|
||||
+ // CraftBukkit start
|
||||
+ public int getExpReward() {
|
||||
if (this.level() instanceof WorldServer && !this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.getExperienceReward());
|
||||
+ int i = this.getExperienceReward();
|
||||
+ return i;
|
||||
+ } else {
|
||||
+ return 0;
|
||||
- protected void dropExperience(@Nullable Entity entity) {
|
||||
+ public int getExpReward(@Nullable Entity entity) { // CraftBukkit
|
||||
World world = this.level();
|
||||
|
||||
if (world instanceof WorldServer worldserver) {
|
||||
if (!this.wasExperienceConsumed() && (this.isAlwaysExperienceDropper() || this.lastHurtByPlayerTime > 0 && this.shouldDropExperience() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT))) {
|
||||
- EntityExperienceOrb.award(worldserver, this.position(), this.getExperienceReward(worldserver, entity));
|
||||
+ return this.getExperienceReward(worldserver, entity); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
+ return 0; // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ protected void dropExperience() {
|
||||
+ protected void dropExperience(@Nullable Entity entity) {
|
||||
+ // CraftBukkit start - Update getExpReward() above if the removed if() changes!
|
||||
+ if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||
+ if (!(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time
|
||||
+ EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.expToDrop);
|
||||
+ this.expToDrop = 0;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1551,13 +1820,25 @@
|
||||
protected void dropCustomDeathLoot(WorldServer worldserver, DamageSource damagesource, boolean flag) {}
|
||||
@@ -1540,9 +1804,14 @@
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2) {
|
||||
|
@ -638,7 +635,11 @@
|
|||
- this.hasImpulse = true;
|
||||
+ if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
+ //this.hasImpulse = true; // CraftBukkit - Move down
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
Vec3D vec3d;
|
||||
|
||||
@@ -1552,7 +1821,14 @@
|
||||
|
||||
Vec3D vec3d1 = (new Vec3D(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
|
||||
- this.setDeltaMovement(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
|
@ -653,7 +654,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1614,6 +1895,28 @@
|
||||
@@ -1613,6 +1889,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
|
@ -682,7 +683,7 @@
|
|||
public Optional<BlockPosition> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1669,9 +1972,14 @@
|
||||
@@ -1666,9 +1964,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -698,26 +699,26 @@
|
|||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1741,7 +2049,7 @@
|
||||
@@ -1738,7 +2041,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
- this.hurtArmor(damagesource, f);
|
||||
+ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
f = CombatMath.getDamageAfterAbsorb(f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
f = CombatMath.getDamageAfterAbsorb(this, f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1754,7 +2062,8 @@
|
||||
@@ -1749,7 +2052,8 @@
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_EFFECTS)) {
|
||||
return f;
|
||||
} else {
|
||||
int i;
|
||||
|
||||
- if (this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
|
||||
+ // CraftBukkit - Moved to actuallyHurt(DamageSource, float)
|
||||
+ if (false && this.hasEffect(MobEffects.DAMAGE_RESISTANCE) && !damagesource.is(DamageTypeTags.BYPASSES_RESISTANCE)) {
|
||||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1787,16 +2096,125 @@
|
||||
@@ -1792,16 +2096,125 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,7 +765,7 @@
|
|||
+ };
|
||||
+ float armorModifier = armor.apply((double) f).floatValue();
|
||||
+ f += armorModifier;
|
||||
+
|
||||
|
||||
+ Function<Double, Double> resistance = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
|
@ -823,7 +824,7 @@
|
|||
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.hurtHelmet(damagesource, f);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ // Apply damage to armor
|
||||
+ if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||
|
@ -851,7 +852,7 @@
|
|||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@@ -1807,13 +2225,47 @@
|
||||
@@ -1812,13 +2225,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -901,7 +902,7 @@
|
|||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1838,8 +2290,18 @@
|
||||
@@ -1843,8 +2290,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
|
@ -921,7 +922,7 @@
|
|||
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -2075,6 +2537,12 @@
|
||||
@@ -2086,6 +2543,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
|
@ -934,7 +935,7 @@
|
|||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2328,6 +2796,7 @@
|
||||
@@ -2336,6 +2799,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround() && !this.level().isClientSide) {
|
||||
|
@ -942,7 +943,7 @@
|
|||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2498,7 +2967,7 @@
|
||||
@@ -2506,7 +2970,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -951,7 +952,7 @@
|
|||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2602,7 +3071,7 @@
|
||||
@@ -2610,7 +3074,7 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -960,7 +961,7 @@
|
|||
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -2924,6 +3393,7 @@
|
||||
@@ -2949,6 +3413,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -968,7 +969,7 @@
|
|||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -3114,14 +3584,21 @@
|
||||
@@ -3141,14 +3606,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
|
@ -992,7 +993,7 @@
|
|||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3314,7 +3791,26 @@
|
||||
@@ -3346,7 +3818,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
|
@ -1020,7 +1021,7 @@
|
|||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3392,6 +3888,12 @@
|
||||
@@ -3424,6 +3915,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
|
@ -1033,7 +1034,7 @@
|
|||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3416,16 +3918,41 @@
|
||||
@@ -3448,16 +3945,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
|
@ -1078,7 +1079,7 @@
|
|||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3437,7 +3964,7 @@
|
||||
@@ -3469,7 +3991,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
|
@ -1087,7 +1088,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3530,7 +4057,7 @@
|
||||
@@ -3562,7 +4084,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
|
@ -1096,7 +1097,7 @@
|
|||
World world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3564,7 +4091,7 @@
|
||||
@@ -3596,7 +4118,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
|
@ -1105,7 +1106,7 @@
|
|||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3600,7 +4127,7 @@
|
||||
@@ -3633,7 +4155,7 @@
|
||||
FoodInfo.b foodinfo_b = (FoodInfo.b) iterator.next();
|
||||
|
||||
if (this.random.nextFloat() < foodinfo_b.probability()) {
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
--- a/net/minecraft/world/entity/EntityTameableAnimal.java
|
||||
+++ b/net/minecraft/world/entity/EntityTameableAnimal.java
|
||||
@@ -27,6 +27,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityTameableAnimal extends EntityAnimal implements OwnableEntity {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS_SQ = 144;
|
||||
@@ -281,7 +287,14 @@
|
||||
if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.getYRot(), this.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) i + 0.5D, (double) j, (double) k + 0.5D);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+ this.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
--- a/net/minecraft/world/entity/Leashable.java
|
||||
+++ b/net/minecraft/world/entity/Leashable.java
|
||||
@@ -15,6 +15,11 @@
|
||||
import net.minecraft.world.level.IMaterial;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent;
|
||||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public interface Leashable {
|
||||
|
||||
String LEASH_TAG = "leash";
|
||||
@@ -44,7 +49,7 @@
|
||||
|
||||
default void setDelayedLeashHolderId(int i) {
|
||||
this.setLeashData(new Leashable.a(i));
|
||||
- dropLeash((Entity) this, false, false);
|
||||
+ dropLeash((Entity & Leashable) this, false, false); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -53,7 +58,7 @@
|
||||
return new Leashable.a(Either.left(nbttagcompound.getCompound("leash").getUUID("UUID")));
|
||||
} else {
|
||||
if (nbttagcompound.contains("leash", 11)) {
|
||||
- Either<UUID, BlockPosition> either = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
|
||||
+ Either<UUID, BlockPosition> either = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either != null) {
|
||||
return new Leashable.a(either);
|
||||
@@ -68,6 +73,11 @@
|
||||
if (leashable_a != null) {
|
||||
Either<UUID, BlockPosition> either = leashable_a.delayedLeashInfo;
|
||||
Entity entity = leashable_a.leashHolder;
|
||||
+ // CraftBukkit start - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
+ if (entity != null && entity.pluginRemoved) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entity instanceof EntityLeash) {
|
||||
EntityLeash entityleash = (EntityLeash) entity;
|
||||
@@ -110,7 +120,9 @@
|
||||
}
|
||||
|
||||
if (e0.tickCount > 100) {
|
||||
+ e0.forceDrops = true; // CraftBukkit
|
||||
e0.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ e0.forceDrops = false; // CraftBukkit
|
||||
((Leashable) e0).setLeashData((Leashable.a) null);
|
||||
}
|
||||
}
|
||||
@@ -119,7 +131,7 @@
|
||||
}
|
||||
|
||||
default void dropLeash(boolean flag, boolean flag1) {
|
||||
- dropLeash((Entity) this, flag, flag1);
|
||||
+ dropLeash((Entity & Leashable) this, flag, flag1); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void dropLeash(E e0, boolean flag, boolean flag1) {
|
||||
@@ -128,7 +140,9 @@
|
||||
if (leashable_a != null && leashable_a.leashHolder != null) {
|
||||
((Leashable) e0).setLeashData((Leashable.a) null);
|
||||
if (!e0.level().isClientSide && flag1) {
|
||||
+ e0.forceDrops = true; // CraftBukkit
|
||||
e0.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ e0.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -153,7 +167,8 @@
|
||||
|
||||
if (leashable_a != null && leashable_a.leashHolder != null) {
|
||||
if (!e0.isAlive() || !leashable_a.leashHolder.isAlive()) {
|
||||
- dropLeash(e0, true, true);
|
||||
+ e0.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(e0.getBukkitEntity(), (!e0.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ dropLeash(e0, true, !e0.pluginRemoved); // CraftBukkit - SPIGOT-7487: Don't drop leash, when the holder was removed by a plugin
|
||||
}
|
||||
|
||||
Entity entity = ((Leashable) e0).getLeashHolder();
|
||||
@@ -183,13 +198,18 @@
|
||||
}
|
||||
|
||||
default void leashTooFarBehaviour() {
|
||||
+ // CraftBukkit start
|
||||
+ if (this instanceof Entity entity) {
|
||||
+ entity.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(entity.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
default void closeRangeLeashBehaviour(Entity entity) {}
|
||||
|
||||
default void elasticRangeLeashBehaviour(Entity entity, float f) {
|
||||
- legacyElasticRangeLeashBehaviour((Entity) this, entity, f);
|
||||
+ legacyElasticRangeLeashBehaviour((Entity & Leashable) this, entity, f); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void legacyElasticRangeLeashBehaviour(E e0, Entity entity, float f) {
|
||||
@@ -201,7 +221,7 @@
|
||||
}
|
||||
|
||||
default void setLeashedTo(Entity entity, boolean flag) {
|
||||
- setLeashedTo((Entity) this, entity, flag);
|
||||
+ setLeashedTo((Entity & Leashable) this, entity, flag); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static <E extends Entity & Leashable> void setLeashedTo(E e0, Entity entity, boolean flag) {
|
||||
@@ -232,7 +252,7 @@
|
||||
|
||||
@Nullable
|
||||
default Entity getLeashHolder() {
|
||||
- return getLeashHolder((Entity) this);
|
||||
+ return getLeashHolder((Entity & Leashable) this); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
|
@ -1,31 +0,0 @@
|
|||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
@@ -15,6 +15,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.EntityTeleportEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -123,7 +129,14 @@
|
||||
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
- this.tamable.moveTo((double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ // CraftBukkit start
|
||||
+ EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this.tamable, (double) i + 0.5D, (double) j, (double) k + 0.5D);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ Location to = event.getTo();
|
||||
+ this.tamable.moveTo(to.getX(), to.getY(), to.getZ(), to.getYaw(), to.getPitch());
|
||||
+ // CraftBukkit end
|
||||
this.navigation.stop();
|
||||
return true;
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
--- a/net/minecraft/world/entity/animal/Bucketable.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bucketable.java
|
||||
@@ -17,6 +17,15 @@
|
||||
@@ -17,6 +17,14 @@
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
|
@ -16,7 +15,7 @@
|
|||
public interface Bucketable {
|
||||
|
||||
boolean fromBucket();
|
||||
@@ -93,10 +102,22 @@
|
||||
@@ -93,10 +101,22 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {
|
||||
|
@ -31,7 +30,7 @@
|
|||
+ itemstack1 = CraftItemStack.asNMSCopy(playerBucketFishEvent.getEntityBucket());
|
||||
+ if (playerBucketFishEvent.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ t0.getBukkitEntity().update((EntityPlayer) entityhuman); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ t0.refreshEntityData((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
|
@ -40,7 +39,7 @@
|
|||
ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false);
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack2);
|
||||
@@ -106,7 +127,7 @@
|
||||
@@ -106,7 +126,7 @@
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -86,6 +86,12 @@
|
||||
@@ -87,6 +87,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityBird {
|
||||
|
||||
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
|
||||
@@ -185,12 +191,19 @@
|
||||
@@ -186,12 +192,19 @@
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
|
@ -35,7 +35,7 @@
|
|||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
|
||||
}
|
||||
|
||||
@@ -204,8 +217,8 @@
|
||||
@@ -205,8 +218,8 @@
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
|
@ -46,16 +46,16 @@
|
|||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.setHasNectar(nbttagcompound.getBoolean("HasNectar"));
|
||||
this.setHasStung(nbttagcompound.getBoolean("HasStung"));
|
||||
@@ -232,7 +245,7 @@
|
||||
@@ -243,7 +256,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
- ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this);
|
||||
+ ((EntityLiving) entity).addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this, EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
- entityliving.addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this);
|
||||
+ entityliving.addEffect(new MobEffect(MobEffects.POISON, b0 * 20, 0), this, EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -625,11 +638,14 @@
|
||||
@@ -636,11 +649,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -981,7 +997,7 @@
|
||||
@@ -992,7 +1008,7 @@
|
||||
|
||||
e() {
|
||||
super();
|
||||
|
@ -81,7 +81,7 @@
|
|||
this.blacklistedTargets = Lists.newArrayList();
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -1098,7 +1114,7 @@
|
||||
@@ -1109,7 +1125,7 @@
|
||||
|
||||
f() {
|
||||
super();
|
||||
|
@ -90,7 +90,7 @@
|
|||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
|
||||
@@ -1198,7 +1214,7 @@
|
||||
@@ -1209,7 +1225,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
|||
EntityBee.this.level().levelEvent(2011, blockposition, 15);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1271,7 +1287,7 @@
|
||||
@@ -1282,7 +1298,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
|
@ -108,7 +108,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1280,7 +1296,7 @@
|
||||
@@ -1291,7 +1307,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -182,10 +182,10 @@
|
||||
@@ -181,10 +181,10 @@
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
Objects.requireNonNull(iregistry);
|
||||
optional.flatMap(iregistry::getHolder).ifPresent(this::setVariant);
|
||||
@@ -462,7 +462,7 @@
|
||||
@@ -452,7 +452,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
|
@ -22,7 +22,7 @@
|
|||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -480,7 +480,7 @@
|
||||
@@ -470,7 +470,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
|
@ -31,7 +31,7 @@
|
|||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
|
||||
@@ -621,7 +621,15 @@
|
||||
@@ -611,7 +611,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -653,10 +661,10 @@
|
||||
@@ -643,10 +651,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
|
||||
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
|
||||
@@ -183,7 +195,7 @@
|
||||
@@ -176,7 +188,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -219,11 +231,17 @@
|
||||
@@ -212,11 +224,17 @@
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
if (this.canHoldItem(itemstack)) {
|
||||
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -474,7 +492,7 @@
|
||||
@@ -467,7 +485,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
@ -58,7 +58,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -493,7 +511,7 @@
|
||||
@@ -486,7 +504,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -97,7 +97,7 @@
|
||||
@@ -98,7 +98,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
@@ -177,7 +177,7 @@
|
||||
@@ -168,7 +168,7 @@
|
||||
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -308,10 +308,10 @@
|
||||
@@ -299,10 +299,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -72,6 +72,12 @@
|
||||
@@ -73,6 +73,12 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -553,14 +559,14 @@
|
||||
@@ -558,14 +564,14 @@
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
if (entityhuman.isCreative() || !this.isInvulnerable()) {
|
||||
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
|
||||
}
|
||||
@@ -368,7 +368,7 @@
|
||||
@@ -363,7 +363,7 @@
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -383,11 +383,14 @@
|
||||
@@ -378,11 +378,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
|
||||
@@ -66,6 +66,10 @@
|
||||
@@ -67,6 +67,10 @@
|
||||
import net.minecraft.world.level.pathfinder.PathEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityRabbit extends EntityAnimal implements VariantHolder<EntityRabbit.Variant> {
|
||||
|
||||
public static final double STROLL_SPEED_MOD = 0.6D;
|
||||
@@ -88,7 +92,6 @@
|
||||
@@ -91,7 +95,6 @@
|
||||
super(entitytypes, world);
|
||||
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
|
||||
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
|
||||
|
@ -19,7 +19,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -574,9 +577,19 @@
|
||||
@@ -578,9 +581,19 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
|
|
@ -1,21 +1,19 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -64,6 +64,14 @@
|
||||
@@ -63,6 +63,12 @@
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.inventory.InventoryCraftResult;
|
||||
+import net.minecraft.world.item.Item;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.event.entity.SheepRegrowWoolEvent;
|
||||
+import org.bukkit.inventory.InventoryView;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -251,6 +259,11 @@
|
||||
@@ -250,6 +256,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level().isClientSide && this.readyForShearing()) {
|
||||
|
@ -27,7 +25,7 @@
|
|||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -270,7 +283,9 @@
|
||||
@@ -269,7 +280,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
|
@ -37,7 +35,7 @@
|
|||
|
||||
if (entityitem != null) {
|
||||
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add((double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (this.random.nextFloat() * 0.05F), (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F)));
|
||||
@@ -363,6 +378,12 @@
|
||||
@@ -362,6 +375,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
|
@ -50,31 +48,12 @@
|
|||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -382,7 +403,7 @@
|
||||
@@ -381,7 +400,7 @@
|
||||
EnumColor enumcolor = ((EntitySheep) entityanimal).getColor();
|
||||
EnumColor enumcolor1 = ((EntitySheep) entityanimal1).getColor();
|
||||
InventoryCrafting inventorycrafting = makeContainer(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
return ((RecipeCrafting) recipeholder.value()).assemble(inventorycrafting, this.level().registryAccess());
|
||||
CraftingInput craftinginput = makeCraftInput(enumcolor, enumcolor1);
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, craftinginput, this.level()).map((recipeholder) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, craftinginput, this.level()).map((recipeholder) -> { // CraftBukkit - decompile error
|
||||
return ((RecipeCrafting) recipeholder.value()).assemble(craftinginput, this.level().registryAccess());
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -405,10 +426,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public InventoryView getBukkitView() {
|
||||
+ return null; // TODO: O.O
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}, 2, 1);
|
||||
|
||||
transientcraftingcontainer.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
|
||||
transientcraftingcontainer.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
|
||||
+ transientcraftingcontainer.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
||||
return transientcraftingcontainer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityWolf.java
|
||||
@@ -88,6 +88,12 @@
|
||||
@@ -90,6 +90,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityWolf extends EntityTameableAnimal implements IEntityAngerable, VariantHolder<Holder<WolfVariant>> {
|
||||
|
||||
private static final DataWatcherObject<Boolean> DATA_INTERESTED_ID = DataWatcher.defineId(EntityWolf.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -350,18 +356,21 @@
|
||||
@@ -360,11 +366,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -30,6 +30,9 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -374,9 +383,9 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
- protected void actuallyHurt(DamageSource damagesource, float f) {
|
||||
+ public boolean actuallyHurt(DamageSource damagesource, float f) { // CraftBukkit - void -> boolean
|
||||
|
@ -39,7 +42,7 @@
|
|||
} else {
|
||||
ItemStack itemstack = this.getBodyArmorItem();
|
||||
int i = itemstack.getDamageValue();
|
||||
@@ -380,6 +389,7 @@
|
||||
@@ -395,6 +404,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,7 +50,7 @@
|
|||
}
|
||||
|
||||
private boolean canArmorAbsorb(DamageSource damagesource) {
|
||||
@@ -401,7 +411,7 @@
|
||||
@@ -405,7 +415,7 @@
|
||||
protected void applyTamingSideEffects() {
|
||||
if (this.isTame()) {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(40.0D);
|
||||
|
@ -56,7 +59,7 @@
|
|||
} else {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -428,7 +438,7 @@
|
||||
@@ -432,7 +442,7 @@
|
||||
FoodInfo foodinfo = (FoodInfo) itemstack.get(DataComponents.FOOD);
|
||||
float f = foodinfo != null ? (float) foodinfo.nutrition() : 1.0F;
|
||||
|
||||
|
@ -65,7 +68,7 @@
|
|||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
} else {
|
||||
if (item instanceof ItemDye) {
|
||||
@@ -476,7 +486,7 @@
|
||||
@@ -480,7 +490,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
|
@ -74,7 +77,7 @@
|
|||
return EnumInteractionResult.SUCCESS_NO_ITEM_USED;
|
||||
} else {
|
||||
return enuminteractionresult;
|
||||
@@ -494,7 +504,8 @@
|
||||
@@ -498,7 +508,8 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -99,6 +99,7 @@
|
||||
@@ -101,6 +101,7 @@
|
||||
private float dancingAnimationTicks;
|
||||
private float spinningAnimationTicks;
|
||||
private float spinningAnimationTicks0;
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -110,6 +111,12 @@
|
||||
@@ -112,6 +113,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()));
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
@Override
|
||||
protected BehaviorController.b<Allay> brainProvider() {
|
||||
return BehaviorController.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
|
||||
@@ -122,7 +129,7 @@
|
||||
@@ -124,7 +131,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Allay> getBrain() {
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -223,7 +230,7 @@
|
||||
@@ -225,7 +232,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -293,7 +300,12 @@
|
||||
@@ -295,7 +302,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
|
||||
|
@ -53,7 +53,7 @@
|
|||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
@@ -304,7 +316,7 @@
|
||||
@@ -306,7 +318,7 @@
|
||||
this.setItemInHand(EnumHand.MAIN_HAND, itemstack2);
|
||||
this.removeInteractionItem(entityhuman, itemstack);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
|
@ -62,7 +62,7 @@
|
|||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -405,6 +417,7 @@
|
||||
@@ -407,6 +419,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
|
@ -70,25 +70,7 @@
|
|||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) ((GameEvent) GameEvent.JUKEBOX_PLAY.value()).notificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -449,7 +462,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
this.writeInventoryToTag(nbttagcompound, this.registryAccess());
|
||||
- DataResult dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData);
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationSystem.a.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.vibrationData); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -465,7 +478,7 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.readInventoryFromTag(nbttagcompound, this.registryAccess());
|
||||
if (nbttagcompound.contains("listener", 10)) {
|
||||
- DataResult dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationSystem.a> dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
Logger logger = Allay.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -498,7 +511,7 @@
|
||||
@@ -500,7 +513,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
|
@ -97,7 +79,7 @@
|
|||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
|
||||
|
||||
if (allay != null) {
|
||||
@@ -506,9 +519,9 @@
|
||||
@@ -508,9 +521,9 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
+++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java
|
||||
@@ -131,14 +131,16 @@
|
||||
@@ -132,14 +132,16 @@
|
||||
@Override
|
||||
protected void customServerAiStep() {
|
||||
this.level().getProfiler().push("armadilloBrain");
|
||||
|
@ -18,7 +18,7 @@
|
|||
this.gameEvent(GameEvent.ENTITY_PLACE);
|
||||
this.scuteTime = this.pickNextScuteDropTime();
|
||||
}
|
||||
@@ -285,8 +287,13 @@
|
||||
@@ -286,8 +288,13 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,15 +34,15 @@
|
|||
if (!this.isNoAi() && !this.isDeadOrDying()) {
|
||||
if (damagesource.getEntity() instanceof EntityLiving) {
|
||||
this.getBrain().setMemoryWithExpiry(MemoryModuleType.DANGER_DETECTED_RECENTLY, true, 80L);
|
||||
@@ -298,6 +305,7 @@
|
||||
@@ -299,6 +306,7 @@
|
||||
}
|
||||
|
||||
}
|
||||
+ return hurt; // CraftBukkit
|
||||
}
|
||||
|
||||
public boolean shouldPanic() {
|
||||
@@ -329,7 +337,9 @@
|
||||
@Override
|
||||
@@ -326,7 +334,9 @@
|
||||
if (this.isBaby()) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
+++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java
|
||||
@@ -67,9 +67,16 @@
|
||||
@@ -68,9 +68,16 @@
|
||||
|
||||
public class Axolotl extends EntityAnimal implements LerpingModel, VariantHolder<Axolotl.Variant>, Bucketable {
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
private static final DataWatcherObject<Integer> DATA_VARIANT = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.INT);
|
||||
private static final DataWatcherObject<Boolean> DATA_PLAYING_DEAD = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Boolean> FROM_BUCKET = DataWatcher.defineId(Axolotl.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -186,7 +193,7 @@
|
||||
@@ -187,7 +194,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -397,7 +404,7 @@
|
||||
@@ -391,7 +398,7 @@
|
||||
int i = mobeffect != null ? mobeffect.getDuration() : 0;
|
||||
int j = Math.min(2400, 100 + i);
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
|||
}
|
||||
|
||||
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
|
||||
@@ -447,7 +454,7 @@
|
||||
@@ -441,7 +448,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Axolotl> getBrain() {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
behaviorcontroller.tick((WorldServer) this.level(), this);
|
||||
this.level().getProfiler().pop();
|
||||
@@ -451,9 +451,15 @@
|
||||
@@ -452,9 +452,15 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -232,9 +236,15 @@
|
||||
@@ -232,10 +236,16 @@
|
||||
}
|
||||
|
||||
frog.setPersistenceRequired();
|
||||
|
@ -30,6 +30,7 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
frog.fudgePositionAfterSizeChange(this.getDimensions(this.getPose()));
|
||||
this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F);
|
||||
- worldserver.addFreshEntityWithPassengers(frog);
|
||||
- this.discard();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
+++ b/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java
|
||||
@@ -79,6 +79,18 @@
|
||||
@@ -81,6 +81,18 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.ticks.ContainerSingleItem;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public abstract class EntityHorseAbstract extends EntityAnimal implements IInventoryListener, HasCustomInventoryScreen, OwnableEntity, IJumpable, ISaddleable {
|
||||
|
||||
public static final int EQUIPMENT_SLOT_OFFSET = 400;
|
||||
@@ -156,7 +168,53 @@
|
||||
@@ -158,7 +170,53 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return entityhuman.getVehicle() == EntityHorseAbstract.this || entityhuman.canInteractWithEntity((Entity) EntityHorseAbstract.this, 4.0D);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@
|
|||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -346,7 +404,7 @@
|
||||
@@ -353,7 +411,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
|
@ -82,7 +82,7 @@
|
|||
if (inventorysubcontainer != null) {
|
||||
inventorysubcontainer.removeListener(this);
|
||||
int i = Math.min(inventorysubcontainer.getContainerSize(), this.inventory.getContainerSize());
|
||||
@@ -450,7 +508,7 @@
|
||||
@@ -457,7 +515,7 @@
|
||||
}
|
||||
|
||||
public int getMaxTemper() {
|
||||
|
@ -91,7 +91,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -521,7 +579,7 @@
|
||||
@@ -528,7 +586,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() < this.getMaxHealth() && f > 0.0F) {
|
||||
|
@ -100,7 +100,7 @@
|
|||
flag = true;
|
||||
}
|
||||
|
||||
@@ -595,7 +653,7 @@
|
||||
@@ -602,7 +660,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level().isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
|
@ -109,7 +109,7 @@
|
|||
}
|
||||
|
||||
if (this.canEatGrass()) {
|
||||
@@ -857,6 +915,7 @@
|
||||
@@ -864,6 +922,7 @@
|
||||
if (this.getOwnerUUID() != null) {
|
||||
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
|
@ -117,7 +117,7 @@
|
|||
|
||||
if (!this.inventory.getItem(0).isEmpty()) {
|
||||
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(this.registryAccess()));
|
||||
@@ -884,6 +943,11 @@
|
||||
@@ -891,6 +950,11 @@
|
||||
if (uuid != null) {
|
||||
this.setOwnerUUID(uuid);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@
|
|||
|
||||
if (nbttagcompound.contains("SaddleItem", 10)) {
|
||||
ItemStack itemstack = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("SaddleItem")).orElse(ItemStack.EMPTY);
|
||||
@@ -986,6 +1050,17 @@
|
||||
@@ -993,6 +1057,17 @@
|
||||
|
||||
@Override
|
||||
public void handleStartJump(int i) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
public class EntityEnderCrystal extends Entity {
|
||||
|
||||
private static final DataWatcherObject<Optional<BlockPosition>> DATA_BEAM_TARGET = DataWatcher.defineId(EntityEnderCrystal.class, DataWatcherRegistry.OPTIONAL_BLOCK_POS);
|
||||
@@ -55,7 +61,11 @@
|
||||
@@ -57,7 +63,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level()).getDragonFight() != null && this.level().getBlockState(blockposition).isAir()) {
|
||||
|
@ -26,7 +26,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +102,26 @@
|
||||
@@ -94,12 +104,26 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -51,6 +51,20 @@
|
||||
@@ -52,6 +52,20 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -88,6 +102,7 @@
|
||||
@@ -89,6 +103,7 @@
|
||||
private final PathPoint[] nodes;
|
||||
private final int[] nodeAdjacency;
|
||||
private final Path openSet;
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
|
||||
super(EntityTypes.ENDER_DRAGON, world);
|
||||
@@ -109,6 +124,7 @@
|
||||
@@ -110,6 +125,7 @@
|
||||
this.noPhysics = true;
|
||||
this.noCulling = true;
|
||||
this.phaseManager = new DragonControllerManager(this);
|
||||
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
|
||||
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
|
||||
@@ -256,7 +272,7 @@
|
||||
@@ -257,7 +273,7 @@
|
||||
|
||||
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
double d0 = vec3d1.x - this.getX();
|
||||
double d1 = vec3d1.y - this.getY();
|
||||
double d2 = vec3d1.z - this.getZ();
|
||||
@@ -397,7 +413,14 @@
|
||||
@@ -404,7 +420,14 @@
|
||||
if (this.nearestCrystal.isRemoved()) {
|
||||
this.nearestCrystal = null;
|
||||
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
|
@ -62,7 +62,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -472,6 +495,9 @@
|
||||
@@ -489,6 +512,9 @@
|
||||
int j1 = MathHelper.floor(axisalignedbb.maxZ);
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
@ -72,7 +72,7 @@
|
|||
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
@@ -481,7 +507,11 @@
|
||||
@@ -498,7 +524,11 @@
|
||||
|
||||
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
|
||||
|
@ -85,7 +85,7 @@
|
|||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -490,6 +520,51 @@
|
||||
@@ -507,6 +537,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@
|
|||
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));
|
||||
|
||||
@@ -545,7 +620,7 @@
|
||||
@@ -562,7 +637,7 @@
|
||||
|
||||
@Override
|
||||
public void kill() {
|
||||
|
@ -146,13 +146,13 @@
|
|||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
if (this.dragonFight != null) {
|
||||
this.dragonFight.updateDragon(this);
|
||||
@@ -554,6 +629,21 @@
|
||||
@@ -571,6 +646,21 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-2420: Special case, the ender dragon drops 12000 xp for the first kill and 500 xp for every other kill and this over time.
|
||||
+ @Override
|
||||
+ public int getExpReward() {
|
||||
+ public int getExpReward(Entity entity) {
|
||||
+ // CraftBukkit - Moved from #tickDeath method
|
||||
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
+ short short0 = 500;
|
||||
|
@ -168,7 +168,7 @@
|
|||
@Override
|
||||
protected void tickDeath() {
|
||||
if (this.dragonFight != null) {
|
||||
@@ -569,15 +659,20 @@
|
||||
@@ -586,15 +676,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);
|
||||
}
|
||||
|
||||
|
@ -190,7 +190,7 @@
|
|||
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
|
||||
}
|
||||
|
||||
@@ -588,7 +683,7 @@
|
||||
@@ -605,7 +700,7 @@
|
||||
|
||||
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
|
||||
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
|
||||
|
@ -199,7 +199,7 @@
|
|||
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
|
||||
}
|
||||
|
||||
@@ -596,7 +691,7 @@
|
||||
@@ -613,7 +708,7 @@
|
||||
this.dragonFight.setDragonKilled(this);
|
||||
}
|
||||
|
||||
|
@ -208,7 +208,7 @@
|
|||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
}
|
||||
|
||||
@@ -809,6 +904,7 @@
|
||||
@@ -826,6 +921,7 @@
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
|
||||
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
|
||||
|
@ -216,7 +216,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -822,6 +918,11 @@
|
||||
@@ -839,6 +935,11 @@
|
||||
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
+++ b/net/minecraft/world/entity/boss/wither/EntityWither.java
|
||||
@@ -58,6 +58,18 @@
|
||||
@@ -59,6 +59,18 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public class EntityWither extends EntityMonster implements PowerableMob, IRangedEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TARGET_A = DataWatcher.defineId(EntityWither.class, DataWatcherRegistry.INT);
|
||||
@@ -254,15 +266,40 @@
|
||||
@@ -255,15 +267,40 @@
|
||||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
|
||||
} else {
|
||||
@@ -307,6 +344,7 @@
|
||||
@@ -308,6 +345,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
EntityLiving entityliving1 = (EntityLiving) list.get(this.random.nextInt(list.size()));
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
this.setAlternativeTarget(i, entityliving1.getId());
|
||||
}
|
||||
}
|
||||
@@ -333,6 +371,11 @@
|
||||
@@ -334,6 +372,11 @@
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
|
@ -83,7 +83,7 @@
|
|||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -344,7 +387,7 @@
|
||||
@@ -345,7 +388,7 @@
|
||||
}
|
||||
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
|
||||
this.bossEvent.setProgress(this.getHealth() / this.getMaxHealth());
|
||||
@@ -500,7 +543,7 @@
|
||||
@@ -502,7 +545,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
|
|
@ -1,87 +1,22 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
@@ -27,6 +27,14 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
--- a/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
+++ b/net/minecraft/world/entity/decoration/BlockAttachedEntity.java
|
||||
@@ -15,6 +15,15 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.tags.DamageTypeTags;
|
||||
+import net.minecraft.world.level.block.state.IBlockData;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityHanging extends Entity {
|
||||
public abstract class BlockAttachedEntity extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -61,26 +69,37 @@
|
||||
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
- double d0 = (double) this.pos.getX() + 0.5D;
|
||||
- double d1 = (double) this.pos.getY() + 0.5D;
|
||||
- double d2 = (double) this.pos.getZ() + 0.5D;
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ {
|
||||
+ double d0 = (double) blockPosition.getX() + 0.5D;
|
||||
+ double d1 = (double) blockPosition.getY() + 0.5D;
|
||||
+ double d2 = (double) blockPosition.getZ() + 0.5D;
|
||||
double d3 = 0.46875D;
|
||||
- double d4 = this.offs(this.getWidth());
|
||||
- double d5 = this.offs(this.getHeight());
|
||||
+ double d4 = offs(width);
|
||||
+ double d5 = offs(height);
|
||||
|
||||
- d0 -= (double) this.direction.getStepX() * 0.46875D;
|
||||
- d2 -= (double) this.direction.getStepZ() * 0.46875D;
|
||||
+ d0 -= (double) direction.getStepX() * 0.46875D;
|
||||
+ d2 -= (double) direction.getStepZ() * 0.46875D;
|
||||
d1 += d5;
|
||||
- EnumDirection enumdirection = this.direction.getCounterClockWise();
|
||||
+ EnumDirection enumdirection = direction.getCounterClockWise();
|
||||
|
||||
d0 += d4 * (double) enumdirection.getStepX();
|
||||
d2 += d4 * (double) enumdirection.getStepZ();
|
||||
- this.setPosRaw(d0, d1, d2);
|
||||
- double d6 = (double) this.getWidth();
|
||||
- double d7 = (double) this.getHeight();
|
||||
- double d8 = (double) this.getWidth();
|
||||
+ if (entity != null) {
|
||||
+ entity.setPosRaw(d0, d1, d2);
|
||||
+ }
|
||||
+ double d6 = (double) width;
|
||||
+ double d7 = (double) height;
|
||||
+ double d8 = (double) width;
|
||||
|
||||
- if (this.direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
+ if (direction.getAxis() == EnumDirection.EnumAxis.Z) {
|
||||
d8 = 1.0D;
|
||||
} else {
|
||||
d6 = 1.0D;
|
||||
@@ -89,11 +108,12 @@
|
||||
d6 /= 32.0D;
|
||||
d7 /= 32.0D;
|
||||
d8 /= 32.0D;
|
||||
- this.setBoundingBox(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8));
|
||||
+ return new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
- private double offs(int i) {
|
||||
+ private static double offs(int i) { // CraftBukkit - static
|
||||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -104,7 +124,25 @@
|
||||
@@ -39,7 +48,25 @@
|
||||
if (this.checkInterval++ == 100) {
|
||||
this.checkInterval = 0;
|
||||
if (!this.isRemoved() && !this.survives()) {
|
||||
|
@ -108,12 +43,12 @@
|
|||
this.dropItem((Entity) null);
|
||||
}
|
||||
}
|
||||
@@ -165,6 +203,22 @@
|
||||
@@ -69,6 +96,22 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Entity damager = (damagesource.isIndirect()) ? damagesource.getEntity() : damagesource.getDirectEntity();
|
||||
+ Entity damager = (damagesource.isDirect()) ? damagesource.getDirectEntity() : damagesource.getEntity();
|
||||
+ HangingBreakEvent event;
|
||||
+ if (damager != null) {
|
||||
+ event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damager.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.ENTITY);
|
||||
|
@ -131,7 +66,7 @@
|
|||
this.kill();
|
||||
this.markHurt();
|
||||
this.dropItem(damagesource.getEntity());
|
||||
@@ -177,6 +231,18 @@
|
||||
@@ -81,6 +124,18 @@
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
if (!this.level().isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
|
||||
|
@ -150,7 +85,7 @@
|
|||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -185,13 +251,22 @@
|
||||
@@ -89,13 +144,22 @@
|
||||
|
||||
@Override
|
||||
public void push(double d0, double d1, double d2) {
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||||
@@ -47,6 +47,16 @@
|
||||
@@ -46,6 +46,16 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
|||
public class EntityArmorStand extends EntityLiving {
|
||||
|
||||
public static final int WOBBLE_TIME = 5;
|
||||
@@ -112,6 +122,13 @@
|
||||
@@ -111,6 +121,13 @@
|
||||
return createLivingAttributes().add(GenericAttributes.STEP_HEIGHT, 0.0D);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
@Override
|
||||
public void refreshDimensions() {
|
||||
double d0 = this.getX();
|
||||
@@ -172,13 +189,20 @@
|
||||
@@ -171,13 +188,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
|
@ -48,13 +48,13 @@
|
|||
- this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.handItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
break;
|
||||
case ARMOR:
|
||||
case HUMANOID_ARMOR:
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.armorItems.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -408,7 +432,25 @@
|
||||
@@ -407,7 +431,25 @@
|
||||
return false;
|
||||
} else if (itemstack1.isEmpty() && (this.disabledSlots & 1 << enumitemslot.getFilterFlag() + 16) != 0) {
|
||||
return false;
|
||||
|
@ -81,7 +81,7 @@
|
|||
this.setItemSlot(enumitemslot, itemstack.copyWithCount(1));
|
||||
return true;
|
||||
} else if (!itemstack.isEmpty() && itemstack.getCount() > 1) {
|
||||
@@ -423,18 +465,29 @@
|
||||
@@ -422,6 +464,7 @@
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return true;
|
||||
}
|
||||
|
@ -89,75 +89,76 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (!this.level().isClientSide && !this.isRemoved()) {
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
||||
- this.kill();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
- } else if (!this.isInvulnerableTo(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerableTo(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.invisible)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
this.brokenByAnything(damagesource);
|
||||
@@ -435,12 +478,22 @@
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
||||
- this.kill();
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
+ // CraftBukkit end
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
|
||||
if (this.isOnFire()) {
|
||||
@@ -467,7 +520,7 @@
|
||||
if (damagesource.isCreativePlayer()) {
|
||||
this.playBrokenSound();
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return true;
|
||||
} else {
|
||||
long i = this.level().getGameTime();
|
||||
@@ -479,7 +532,7 @@
|
||||
} else {
|
||||
this.brokenByPlayer(damagesource);
|
||||
- } else if (!this.isInvulnerableTo(damagesource) && !this.invisible && !this.isMarker()) {
|
||||
+ } else if (!this.isInvulnerableTo(damagesource) && (true || !this.invisible) && !this.isMarker()) { // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, true, this.invisible)) {
|
||||
+ return false;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IGNITES_ARMOR_STANDS)) {
|
||||
if (this.isOnFire()) {
|
||||
@@ -473,7 +526,7 @@
|
||||
if (damagesource.isCreativePlayer()) {
|
||||
this.playBrokenSound();
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
|
||||
}
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
return true;
|
||||
} else {
|
||||
long i = worldserver.getGameTime();
|
||||
@@ -485,7 +538,7 @@
|
||||
} else {
|
||||
this.brokenByPlayer(worldserver, damagesource);
|
||||
this.showBreakingParticles();
|
||||
- this.kill();
|
||||
+ this.discard(EntityRemoveEvent.Cause.DEATH); // CraftBukkit - SPIGOT-4890: remain as this.discard() since above damagesource method will call death event
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -532,7 +585,7 @@
|
||||
return true;
|
||||
@@ -539,7 +592,7 @@
|
||||
f1 -= f;
|
||||
if (f1 <= 0.5F) {
|
||||
this.brokenByAnything(damagesource);
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
- this.kill();
|
||||
+ this.kill(damagesource); // CraftBukkit
|
||||
} else {
|
||||
this.setHealth(f1);
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
|
||||
@@ -544,13 +597,13 @@
|
||||
@@ -551,13 +604,13 @@
|
||||
ItemStack itemstack = new ItemStack(Items.ARMOR_STAND);
|
||||
|
||||
itemstack.set(DataComponents.CUSTOM_NAME, this.getCustomName());
|
||||
- Block.popResource(this.level(), this.blockPosition(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.brokenByAnything(damagesource);
|
||||
this.brokenByAnything(worldserver, damagesource);
|
||||
}
|
||||
|
||||
private void brokenByAnything(DamageSource damagesource) {
|
||||
private void brokenByAnything(WorldServer worldserver, DamageSource damagesource) {
|
||||
this.playBrokenSound();
|
||||
- this.dropAllDeathLoot(damagesource);
|
||||
+ // this.dropAllDeathLoot(damagesource); // CraftBukkit - moved down
|
||||
- this.dropAllDeathLoot(worldserver, damagesource);
|
||||
+ // this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved down
|
||||
|
||||
ItemStack itemstack;
|
||||
int i;
|
||||
@@ -558,7 +611,7 @@
|
||||
@@ -565,7 +618,7 @@
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
|
@ -166,7 +167,7 @@
|
|||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -566,10 +619,11 @@
|
||||
@@ -573,10 +626,11 @@
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
|
@ -175,11 +176,11 @@
|
|||
this.armorItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
+ this.dropAllDeathLoot(damagesource); // CraftBukkit - moved from above
|
||||
+ this.dropAllDeathLoot(worldserver, damagesource); // CraftBukkit - moved from above
|
||||
|
||||
}
|
||||
|
||||
@@ -660,9 +714,23 @@
|
||||
@@ -667,9 +721,23 @@
|
||||
return this.isSmall();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,54 +1,19 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityItemFrame.java
|
||||
@@ -90,16 +90,27 @@
|
||||
@@ -90,6 +90,12 @@
|
||||
|
||||
@Override
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
+ // CraftBukkit start code moved in to calculateBoundingBox
|
||||
+ this.setBoundingBox(calculateBoundingBox(this, this.pos, this.direction, this.getWidth(), this.getHeight()));
|
||||
+ // CraftBukkit end
|
||||
+ }
|
||||
protected AxisAlignedBB calculateBoundingBox(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ return calculateBoundingBoxStatic(blockposition, enumdirection);
|
||||
+ }
|
||||
+
|
||||
+ // CraftBukkit start - break out BB calc into own method
|
||||
+ public static AxisAlignedBB calculateBoundingBox(@Nullable Entity entity, BlockPosition blockPosition, EnumDirection direction, int width, int height) {
|
||||
+ {
|
||||
double d0 = 0.46875D;
|
||||
- double d1 = (double) this.pos.getX() + 0.5D - (double) this.direction.getStepX() * 0.46875D;
|
||||
- double d2 = (double) this.pos.getY() + 0.5D - (double) this.direction.getStepY() * 0.46875D;
|
||||
- double d3 = (double) this.pos.getZ() + 0.5D - (double) this.direction.getStepZ() * 0.46875D;
|
||||
+ double d1 = (double) blockPosition.getX() + 0.5D - (double) direction.getStepX() * 0.46875D;
|
||||
+ double d2 = (double) blockPosition.getY() + 0.5D - (double) direction.getStepY() * 0.46875D;
|
||||
+ double d3 = (double) blockPosition.getZ() + 0.5D - (double) direction.getStepZ() * 0.46875D;
|
||||
|
||||
- this.setPosRaw(d1, d2, d3);
|
||||
- double d4 = (double) this.getWidth();
|
||||
- double d5 = (double) this.getHeight();
|
||||
- double d6 = (double) this.getWidth();
|
||||
- EnumDirection.EnumAxis enumdirection_enumaxis = this.direction.getAxis();
|
||||
+ if (entity != null) {
|
||||
+ entity.setPosRaw(d1, d2, d3);
|
||||
+ }
|
||||
+ double d4 = (double) width;
|
||||
+ double d5 = (double) height;
|
||||
+ double d6 = (double) width;
|
||||
+ EnumDirection.EnumAxis enumdirection_enumaxis = direction.getAxis();
|
||||
|
||||
switch (enumdirection_enumaxis) {
|
||||
case X:
|
||||
@@ -115,9 +126,10 @@
|
||||
d4 /= 32.0D;
|
||||
d5 /= 32.0D;
|
||||
d6 /= 32.0D;
|
||||
- this.setBoundingBox(new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6));
|
||||
+ return new AxisAlignedBB(d1 - d4, d2 - d5, d3 - d6, d1 + d4, d2 + d5, d3 + d6);
|
||||
}
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
@Override
|
||||
public boolean survives() {
|
||||
@@ -162,6 +174,11 @@
|
||||
+ public static AxisAlignedBB calculateBoundingBoxStatic(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit end
|
||||
float f = 0.46875F;
|
||||
Vec3D vec3d = Vec3D.atCenterOf(blockposition).relative(enumdirection, -0.46875D);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = enumdirection.getAxis();
|
||||
@@ -143,6 +149,11 @@
|
||||
return false;
|
||||
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -60,7 +25,7 @@
|
|||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
@@ -284,13 +301,19 @@
|
||||
@@ -255,13 +266,19 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack, boolean flag) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityLeash.java
|
||||
@@ -24,6 +24,13 @@
|
||||
@@ -26,6 +26,13 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,24 +11,26 @@
|
|||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class EntityLeash extends EntityHanging {
|
||||
public class EntityLeash extends BlockAttachedEntity {
|
||||
|
||||
public static final double OFFSET_Y = 0.375D;
|
||||
@@ -89,6 +96,13 @@
|
||||
EntityInsentient entityinsentient = (EntityInsentient) iterator.next();
|
||||
@@ -84,6 +91,15 @@
|
||||
Leashable leashable = (Leashable) iterator.next();
|
||||
|
||||
if (entityinsentient.getLeashHolder() == entityhuman) {
|
||||
if (leashable.getLeashHolder() == entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(entityinsentient, entityinsentient.getLeashHolder()));
|
||||
+ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities
|
||||
+ continue;
|
||||
+ if (leashable instanceof Entity leashed) {
|
||||
+ if (CraftEventFactory.callPlayerLeashEntityEvent(leashed, this, entityhuman, enumhand).isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutAttachEntity(leashed, leashable.getLeashHolder()));
|
||||
+ flag = true; // Also set true when the event is cancelled otherwise it tries to unleash the entities
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityinsentient.setLeashedTo(this, true);
|
||||
leashable.setLeashedTo(this, true);
|
||||
flag = true;
|
||||
}
|
||||
@@ -97,18 +111,32 @@
|
||||
@@ -92,18 +108,34 @@
|
||||
boolean flag1 = false;
|
||||
|
||||
if (!flag) {
|
||||
|
@ -42,16 +44,18 @@
|
|||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
EntityInsentient entityinsentient1 = (EntityInsentient) iterator1.next();
|
||||
Leashable leashable1 = (Leashable) iterator1.next();
|
||||
|
||||
if (entityinsentient1.isLeashed() && entityinsentient1.getLeashHolder() == this) {
|
||||
- entityinsentient1.dropLeash(true, false);
|
||||
if (leashable1.isLeashed() && leashable1.getLeashHolder() == this) {
|
||||
- leashable1.dropLeash(true, false);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient1, entityhuman, enumhand).isCancelled()) {
|
||||
+ die = false;
|
||||
+ continue;
|
||||
+ if (leashable1 instanceof Entity leashed) {
|
||||
+ if (CraftEventFactory.callPlayerUnleashEntityEvent(leashed, entityhuman, enumhand).isCancelled()) {
|
||||
+ die = false;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+ entityinsentient1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ leashable1.dropLeash(true, !entityhuman.getAbilities().instabuild); // false -> survival mode boolean
|
||||
+ // CraftBukkit end
|
||||
flag1 = true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityPainting.java
|
||||
@@ -71,7 +71,7 @@
|
||||
public static Optional<EntityPainting> create(World world, BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
EntityPainting entitypainting = new EntityPainting(world, blockposition);
|
||||
List<Holder<PaintingVariant>> list = new ArrayList();
|
||||
- Iterable iterable = world.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE);
|
||||
+ Iterable<Holder<PaintingVariant>> iterable = world.registryAccess().registryOrThrow(Registries.PAINTING_VARIANT).getTagOrEmpty(PaintingVariantTags.PLACEABLE); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
iterable.forEach(list::add);
|
||||
@@ -137,22 +137,32 @@
|
||||
|
||||
@Override
|
||||
protected AxisAlignedBB calculateBoundingBox(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
+ // CraftBukkit start
|
||||
+ PaintingVariant paintingvariant = (PaintingVariant) this.getVariant().value();
|
||||
+ return calculateBoundingBoxStatic(blockposition, enumdirection, paintingvariant.width(), paintingvariant.height());
|
||||
+ }
|
||||
+
|
||||
+ public static AxisAlignedBB calculateBoundingBoxStatic(BlockPosition blockposition, EnumDirection enumdirection, int width, int height) {
|
||||
+ // CraftBukkit end
|
||||
float f = 0.46875F;
|
||||
Vec3D vec3d = Vec3D.atCenterOf(blockposition).relative(enumdirection, -0.46875D);
|
||||
- PaintingVariant paintingvariant = (PaintingVariant) this.getVariant().value();
|
||||
- double d0 = this.offsetForPaintingSize(paintingvariant.width());
|
||||
- double d1 = this.offsetForPaintingSize(paintingvariant.height());
|
||||
+ // CraftBukkit start
|
||||
+ double d0 = offsetForPaintingSize(width);
|
||||
+ double d1 = offsetForPaintingSize(height);
|
||||
+ // CraftBukkit end
|
||||
EnumDirection enumdirection1 = enumdirection.getCounterClockWise();
|
||||
Vec3D vec3d1 = vec3d.relative(enumdirection1, d0).relative(EnumDirection.UP, d1);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis = enumdirection.getAxis();
|
||||
- double d2 = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? 0.0625D : (double) paintingvariant.width();
|
||||
- double d3 = (double) paintingvariant.height();
|
||||
- double d4 = enumdirection_enumaxis == EnumDirection.EnumAxis.Z ? 0.0625D : (double) paintingvariant.width();
|
||||
+ // CraftBukkit start
|
||||
+ double d2 = enumdirection_enumaxis == EnumDirection.EnumAxis.X ? 0.0625D : (double) width;
|
||||
+ double d3 = (double) height;
|
||||
+ double d4 = enumdirection_enumaxis == EnumDirection.EnumAxis.Z ? 0.0625D : (double) width;
|
||||
+ // CraftBukkit end
|
||||
|
||||
return AxisAlignedBB.ofSize(vec3d1, d2, d3, d4);
|
||||
}
|
||||
|
||||
- private double offsetForPaintingSize(int i) {
|
||||
+ private static double offsetForPaintingSize(int i) { // CraftBukkit - static
|
||||
return i % 2 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityFallingBlock.java
|
||||
@@ -49,6 +49,11 @@
|
||||
@@ -52,6 +52,11 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -83,10 +88,17 @@
|
||||
@@ -87,10 +92,17 @@
|
||||
}
|
||||
|
||||
public static EntityFallingBlock fall(World world, BlockPosition blockposition, IBlockData iblockdata) {
|
||||
|
@ -31,7 +31,7 @@
|
|||
return entityfallingblock;
|
||||
}
|
||||
|
||||
@@ -126,7 +138,7 @@
|
||||
@@ -130,7 +142,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.blockState.isAir()) {
|
||||
|
@ -40,7 +40,7 @@
|
|||
} else {
|
||||
Block block = this.blockState.getBlock();
|
||||
|
||||
@@ -154,7 +166,7 @@
|
||||
@@ -159,7 +171,7 @@
|
||||
this.spawnAtLocation((IMaterial) block);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
} else {
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
@@ -171,9 +183,15 @@
|
||||
@@ -176,9 +188,15 @@
|
||||
this.blockState = (IBlockData) this.blockState.setValue(BlockProperties.WATERLOGGED, true);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@
|
|||
if (block instanceof Fallable) {
|
||||
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
|
||||
}
|
||||
@@ -201,19 +219,19 @@
|
||||
@@ -206,19 +224,19 @@
|
||||
}
|
||||
}
|
||||
} else if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityItem.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityItem.java
|
||||
@@ -33,6 +33,15 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
@@ -34,6 +34,15 @@
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -16,7 +16,7 @@
|
|||
public class EntityItem extends Entity implements TraceableEntity {
|
||||
|
||||
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
|
||||
@@ -51,6 +60,7 @@
|
||||
@@ -52,6 +61,7 @@
|
||||
@Nullable
|
||||
public UUID target;
|
||||
public final float bobOffs;
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -132,12 +142,15 @@
|
||||
@@ -133,12 +143,15 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.getItem().isEmpty()) {
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
@@ -186,9 +199,11 @@
|
||||
@@ -187,9 +200,11 @@
|
||||
this.mergeWithNeighbours();
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -200,7 +215,13 @@
|
||||
@@ -201,7 +216,13 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide && this.age >= 6000) {
|
||||
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -283,11 +304,16 @@
|
||||
@@ -284,11 +305,16 @@
|
||||
}
|
||||
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
|
||||
|
@ -89,7 +89,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -308,12 +334,17 @@
|
||||
@@ -309,12 +335,17 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -108,7 +108,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -365,7 +396,7 @@
|
||||
@@ -366,7 +397,7 @@
|
||||
}
|
||||
|
||||
if (this.getItem().isEmpty()) {
|
||||
|
@ -117,7 +117,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -377,10 +408,50 @@
|
||||
@@ -378,10 +409,50 @@
|
||||
Item item = itemstack.getItem();
|
||||
int i = itemstack.getCount();
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
|
||||
@@ -17,6 +17,12 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
@@ -24,6 +24,12 @@
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.portal.DimensionTransition;
|
||||
|
||||
+// CraftBukkit start;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -13,16 +13,16 @@
|
|||
public class EntityTNTPrimed extends Entity implements TraceableEntity {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
|
||||
@@ -26,6 +32,8 @@
|
||||
public static final String TAG_FUSE = "fuse";
|
||||
@@ -45,6 +51,8 @@
|
||||
@Nullable
|
||||
public EntityLiving owner;
|
||||
private boolean usedPortal;
|
||||
+ public float yield = 4; // CraftBukkit - add field
|
||||
+ public boolean isIncendiary = false; // CraftBukkit - add field
|
||||
|
||||
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -79,10 +87,13 @@
|
||||
@@ -99,10 +107,13 @@
|
||||
|
||||
this.setFuse(i);
|
||||
if (i <= 0) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level().isClientSide) {
|
||||
@@ -93,9 +104,14 @@
|
||||
@@ -113,9 +124,14 @@
|
||||
}
|
||||
|
||||
private void explode() {
|
||||
|
@ -46,9 +46,9 @@
|
|||
+ // float f = 4.0F;
|
||||
+ ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
|
||||
|
||||
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
- this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, false, World.a.TNT);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? EntityTNTPrimed.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
itemstack.shrink(1);
|
||||
} else {
|
||||
itemstack.hurtAndBreak(1, entityhuman, getSlotForHand(enumhand));
|
||||
@@ -246,10 +266,19 @@
|
||||
@@ -246,11 +266,20 @@
|
||||
if (!this.level().isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
|
@ -64,10 +64,11 @@
|
|||
+ // CraftBukkit end
|
||||
this.dead = true;
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.discard();
|
||||
+ this.level().explode(this, this.level().damageSources().explosion(this, this.entityIgniter, net.minecraft.world.damagesource.DamageTypes.EXPLOSION), null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB); // CraftBukkit
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
this.spawnLingeringCloud();
|
||||
this.triggerOnDeathMobEffects(Entity.RemovalReason.KILLED);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.EXPLODE); // CraftBukkit - add Bukkit remove cause
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ swell = 0;
|
||||
|
@ -76,7 +77,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -260,6 +289,7 @@
|
||||
@@ -261,6 +290,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
|
||||
|
@ -84,7 +85,7 @@
|
|||
entityareaeffectcloud.setRadius(2.5F);
|
||||
entityareaeffectcloud.setRadiusOnUse(-0.5F);
|
||||
entityareaeffectcloud.setWaitTime(10);
|
||||
@@ -273,7 +303,7 @@
|
||||
@@ -274,7 +304,7 @@
|
||||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityEnderman.java
|
||||
@@ -68,6 +68,11 @@
|
||||
@@ -70,6 +70,11 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
|||
+
|
||||
public class EntityEnderman extends EntityMonster implements IEntityAngerable {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_ATTACKING_UUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
@@ -111,7 +116,17 @@
|
||||
private static final MinecraftKey SPEED_MODIFIER_ATTACKING_ID = MinecraftKey.withDefaultNamespace("attacking");
|
||||
@@ -113,7 +118,17 @@
|
||||
|
||||
@Override
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
|
@ -31,7 +31,7 @@
|
|||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.MOVEMENT_SPEED);
|
||||
|
||||
if (entityliving == null) {
|
||||
@@ -126,6 +141,7 @@
|
||||
@@ -128,6 +143,7 @@
|
||||
attributemodifiable.addTransientModifier(EntityEnderman.SPEED_MODIFIER_ATTACKING);
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -477,9 +493,11 @@
|
||||
@@ -479,9 +495,11 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
|
@ -51,7 +51,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -518,9 +536,11 @@
|
||||
@@ -520,9 +538,11 @@
|
||||
boolean flag = movingobjectpositionblock.getBlockPos().equals(blockposition);
|
||||
|
||||
if (iblockdata.is(TagsBlock.ENDERMAN_HOLDABLE) && flag) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityGhast.java
|
||||
@@ -331,6 +331,8 @@
|
||||
@@ -332,6 +332,8 @@
|
||||
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, d2, d3, d4, this.ghast.getExplosionPower());
|
||||
EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.ghast, vec3d1.normalize(), this.ghast.getExplosionPower());
|
||||
|
||||
+ // CraftBukkit - set bukkitYield when setting explosionpower
|
||||
+ entitylargefireball.bukkitYield = entitylargefireball.explosionPower = this.ghast.getExplosionPower();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java
|
||||
@@ -215,7 +215,7 @@
|
||||
@@ -217,7 +217,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -266,7 +266,7 @@
|
||||
@@ -268,7 +268,7 @@
|
||||
|
||||
@Override
|
||||
protected void performSpellCasting() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPigZombie.java
|
||||
@@ -148,7 +148,7 @@
|
||||
@@ -149,7 +149,7 @@
|
||||
}).filter((entitypigzombie) -> {
|
||||
return !entitypigzombie.isAlliedTo((Entity) this.getTarget());
|
||||
}).forEach((entitypigzombie) -> {
|
||||
|
@ -9,7 +9,7 @@
|
|||
});
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
@@ -158,7 +158,7 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,7 +18,7 @@
|
|||
if (this.getTarget() == null && entityliving != null) {
|
||||
this.playFirstAngerSoundIn = EntityPigZombie.FIRST_ANGER_SOUND_DELAY.sample(this.random);
|
||||
this.ticksUntilNextAlert = EntityPigZombie.ALERT_INTERVAL.sample(this.random);
|
||||
@@ -167,12 +167,21 @@
|
||||
@@ -168,12 +168,21 @@
|
||||
this.setLastHurtByPlayer((EntityHuman) entityliving);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPillager.java
|
||||
@@ -44,6 +44,10 @@
|
||||
@@ -48,6 +48,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.WorldAccess;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityPillager extends EntityIllagerAbstract implements ICrossbow, InventoryCarrier {
|
||||
|
||||
private static final DataWatcherObject<Boolean> IS_CHARGING_CROSSBOW = DataWatcher.defineId(EntityPillager.class, DataWatcherRegistry.BOOLEAN);
|
||||
@@ -192,7 +196,7 @@
|
||||
@@ -195,7 +199,7 @@
|
||||
ItemStack itemstack1 = this.inventory.addItem(itemstack);
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -42,6 +42,10 @@
|
||||
@@ -43,6 +43,10 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityRavager extends EntityRaider {
|
||||
|
||||
private static final Predicate<Entity> NO_RAVAGER_AND_ALIVE = (entity) -> {
|
||||
@@ -146,6 +150,11 @@
|
||||
@@ -147,6 +151,11 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof BlockLeaves) {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
+
|
||||
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 MinecraftKey COVERED_ARMOR_MODIFIER_ID = MinecraftKey.withDefaultNamespace("covered");
|
||||
@@ -401,6 +407,14 @@
|
||||
EnumDirection enumdirection = this.findAttachableSurface(blockposition1);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeleton.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
protected void doFreezeConversion() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java
|
||||
@@ -200,8 +200,19 @@
|
||||
@@ -204,8 +204,19 @@
|
||||
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));
|
||||
|
@ -20,4 +20,4 @@
|
|||
+ // this.level().addFreshEntity(entityarrow); // CraftBukkit - moved up
|
||||
}
|
||||
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f) {
|
||||
protected EntityArrow getArrow(ItemStack itemstack, float f, @Nullable ItemStack itemstack1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySkeletonWither.java
|
||||
@@ -96,7 +96,7 @@
|
||||
@@ -97,7 +97,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (entity instanceof EntityLiving) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntitySlime.java
|
||||
@@ -43,6 +43,15 @@
|
||||
@@ -45,6 +45,15 @@
|
||||
import net.minecraft.world.level.levelgen.SeededRandom;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
public class EntitySlime extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final DataWatcherObject<Integer> ID_SIZE = DataWatcher.defineId(EntitySlime.class, DataWatcherRegistry.INT);
|
||||
@@ -193,11 +202,18 @@
|
||||
@@ -195,11 +204,18 @@
|
||||
|
||||
@Override
|
||||
public EntityTypes<? extends EntitySlime> getType() {
|
||||
|
@ -36,7 +36,7 @@
|
|||
int i = this.getSize();
|
||||
|
||||
if (!this.level().isClientSide && i > 1 && this.isDeadOrDying()) {
|
||||
@@ -208,6 +224,19 @@
|
||||
@@ -210,6 +226,19 @@
|
||||
int j = i / 2;
|
||||
int k = 2 + this.random.nextInt(3);
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
for (int l = 0; l < k; ++l) {
|
||||
float f2 = ((float) (l % 2) - 0.5F) * f1;
|
||||
float f3 = ((float) (l / 2) - 0.5F) * f1;
|
||||
@@ -223,12 +252,21 @@
|
||||
@@ -225,12 +254,21 @@
|
||||
entityslime.setInvulnerable(this.isInvulnerable());
|
||||
entityslime.setSize(j, true);
|
||||
entityslime.moveTo(this.getX() + (double) f2, this.getY() + 0.5D, this.getZ() + (double) f3, this.random.nextFloat() * 360.0F, 0.0F);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityWitch.java
|
||||
@@ -124,7 +124,7 @@
|
||||
@@ -125,7 +125,7 @@
|
||||
PotionContents potioncontents = (PotionContents) itemstack.get(DataComponents.POTION_CONTENTS);
|
||||
|
||||
if (itemstack.is(Items.POTION) && potioncontents != null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombie.java
|
||||
@@ -64,6 +64,15 @@
|
||||
@@ -65,6 +65,15 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
|||
+
|
||||
public class EntityZombie extends EntityMonster {
|
||||
|
||||
private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
|
||||
@@ -84,6 +93,7 @@
|
||||
private static final MinecraftKey SPEED_MODIFIER_BABY_ID = MinecraftKey.withDefaultNamespace("baby");
|
||||
@@ -89,6 +98,7 @@
|
||||
private boolean canBreakDoors;
|
||||
private int inWaterTime;
|
||||
public int conversionTime;
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
public EntityZombie(EntityTypes<? extends EntityZombie> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -200,7 +210,10 @@
|
||||
@@ -205,7 +215,10 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && !this.isNoAi()) {
|
||||
if (this.isUnderWaterConverting()) {
|
||||
|
@ -36,7 +36,7 @@
|
|||
if (this.conversionTime < 0) {
|
||||
this.doUnderWaterConversion();
|
||||
}
|
||||
@@ -217,6 +230,7 @@
|
||||
@@ -222,6 +235,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
|
@ -44,7 +44,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -249,6 +263,7 @@
|
||||
@@ -256,6 +270,7 @@
|
||||
}
|
||||
|
||||
public void startUnderWaterConversion(int i) {
|
||||
|
@ -52,7 +52,7 @@
|
|||
this.conversionTime = i;
|
||||
this.getEntityData().set(EntityZombie.DATA_DROWNED_CONVERSION_ID, true);
|
||||
}
|
||||
@@ -262,11 +277,15 @@
|
||||
@@ -269,11 +284,15 @@
|
||||
}
|
||||
|
||||
protected void convertToZombieType(EntityTypes<? extends EntityZombie> entitytypes) {
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -305,9 +324,9 @@
|
||||
@@ -312,9 +331,9 @@
|
||||
if (EntityPositionTypes.isSpawnPositionOk(entitytypes, this.level(), blockposition) && EntityPositionTypes.checkSpawnRules(entitytypes, worldserver, EnumMobSpawn.REINFORCEMENT, blockposition, this.level().random)) {
|
||||
entityzombie.setPos((double) i1, (double) j1, (double) k1);
|
||||
if (!this.level().hasNearbyAlivePlayer((double) i1, (double) j1, (double) k1, 7.0D) && this.level().isUnobstructed(entityzombie) && this.level().noCollision((Entity) entityzombie) && !this.level().containsAnyLiquid(entityzombie.getBoundingBox())) {
|
||||
|
@ -78,16 +78,16 @@
|
|||
entityzombie.finalizeSpawn(worldserver, this.level().getCurrentDifficultyAt(entityzombie.blockPosition()), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null);
|
||||
- worldserver.addFreshEntityWithPassengers(entityzombie);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit
|
||||
this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
|
||||
entityzombie.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE).addPermanentModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADD_VALUE));
|
||||
break;
|
||||
@@ -328,7 +347,14 @@
|
||||
AttributeModifiable attributemodifiable = this.getAttribute(GenericAttributes.SPAWN_REINFORCEMENTS_CHANCE);
|
||||
AttributeModifier attributemodifier = attributemodifiable.getModifier(EntityZombie.REINFORCEMENT_CALLER_CHARGE_ID);
|
||||
double d0 = attributemodifier != null ? attributemodifier.amount() : 0.0D;
|
||||
@@ -340,7 +359,14 @@
|
||||
float f = this.level().getCurrentDifficultyAt(this.blockPosition()).getEffectiveDifficulty();
|
||||
|
||||
if (this.getMainHandItem().isEmpty() && this.isOnFire() && this.random.nextFloat() < f * 0.3F) {
|
||||
- entity.igniteForSeconds(2 * (int) f);
|
||||
- entity.igniteForSeconds((float) (2 * (int) f));
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * (int) f); // PAIL: fixme
|
||||
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), (float) (2 * (int) f)); // PAIL: fixme
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -403,8 +429,17 @@
|
||||
@@ -415,8 +441,17 @@
|
||||
if (worldserver.getDifficulty() != EnumDifficulty.HARD && this.random.nextBoolean()) {
|
||||
return flag;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@
|
|||
|
||||
if (entityzombievillager != null) {
|
||||
entityzombievillager.finalizeSpawn(worldserver, worldserver.getCurrentDifficultyAt(entityzombievillager.blockPosition()), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false, true));
|
||||
@@ -412,15 +447,17 @@
|
||||
@@ -424,15 +459,17 @@
|
||||
entityzombievillager.setGossips((NBTBase) entityvillager.getGossips().store(DynamicOpsNBT.INSTANCE));
|
||||
entityzombievillager.setTradeOffers(entityvillager.getOffers().copy());
|
||||
entityzombievillager.setVillagerXp(entityvillager.getVillagerXp());
|
||||
|
@ -139,7 +139,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -471,7 +508,7 @@
|
||||
@@ -483,7 +520,7 @@
|
||||
entitychicken1.finalizeSpawn(worldaccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null);
|
||||
entitychicken1.setChickenJockey(true);
|
||||
this.startRiding(entitychicken1);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityZombieVillager.java
|
||||
@@ -48,6 +48,13 @@
|
||||
@@ -51,6 +51,13 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -65,6 +72,7 @@
|
||||
@@ -68,6 +75,7 @@
|
||||
@Nullable
|
||||
private MerchantRecipeList tradeOffers;
|
||||
private int villagerXp;
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
public EntityZombieVillager(EntityTypes<? extends EntityZombieVillager> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -83,7 +91,7 @@
|
||||
@@ -86,7 +94,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -31,7 +31,7 @@
|
|||
Logger logger = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -118,7 +126,7 @@
|
||||
@@ -121,7 +129,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("Offers")) {
|
||||
|
@ -40,7 +40,7 @@
|
|||
Logger logger1 = EntityZombieVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -145,6 +153,10 @@
|
||||
@@ -148,6 +156,10 @@
|
||||
public void tick() {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.isConverting()) {
|
||||
int i = this.getConversionProgress();
|
||||
|
@ -51,7 +51,7 @@
|
|||
|
||||
this.villagerConversionTime -= i;
|
||||
if (this.villagerConversionTime <= 0) {
|
||||
@@ -153,6 +165,7 @@
|
||||
@@ -156,6 +168,7 @@
|
||||
}
|
||||
|
||||
super.tick();
|
||||
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -193,8 +206,10 @@
|
||||
@@ -196,8 +209,10 @@
|
||||
this.conversionStarter = uuid;
|
||||
this.villagerConversionTime = i;
|
||||
this.getEntityData().set(EntityZombieVillager.DATA_CONVERTING_ID, true);
|
||||
|
@ -72,7 +72,7 @@
|
|||
this.level().broadcastEntityEvent(this, (byte) 16);
|
||||
}
|
||||
|
||||
@@ -211,7 +226,13 @@
|
||||
@@ -214,12 +229,20 @@
|
||||
}
|
||||
|
||||
private void finishConversion(WorldServer worldserver) {
|
||||
|
@ -84,25 +84,22 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EnumItemSlot[] aenumitemslot = EnumItemSlot.values();
|
||||
int i = aenumitemslot.length;
|
||||
|
||||
@@ -226,7 +247,9 @@
|
||||
double d0 = (double) this.getEquipmentDropChance(enumitemslot);
|
||||
if (entityvillager != null) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
Iterator iterator = this.dropPreservedEquipment((itemstack) -> {
|
||||
return !EnchantmentManager.has(itemstack, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE);
|
||||
}).iterator();
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
|
||||
if (d0 > 1.0D) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(itemstack);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
}
|
||||
while (iterator.hasNext()) {
|
||||
EnumItemSlot enumitemslot = (EnumItemSlot) iterator.next();
|
||||
@@ -249,7 +272,7 @@
|
||||
}
|
||||
}
|
||||
@@ -253,7 +276,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
||||
if (!this.isSilent()) {
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
- entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0));
|
||||
+ entityvillager.addEffect(new MobEffect(MobEffects.CONFUSION, 200, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.CONVERSION); // CraftBukkit
|
||||
if (!this.isSilent()) {
|
||||
worldserver.levelEvent((EntityHuman) null, 1027, this.blockPosition(), 0);
|
||||
}
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
this.setGuaranteedDrop(EnumItemSlot.OFFHAND);
|
||||
} else {
|
||||
@@ -375,8 +403,8 @@
|
||||
if (EnchantmentManager.hasBindingCurse(itemstack1)) {
|
||||
if (EnchantmentManager.has(itemstack1, EnchantmentEffectComponents.PREVENT_ARMOR_CHANGE)) {
|
||||
return false;
|
||||
} else {
|
||||
- boolean flag = PiglinAI.isLovedItem(itemstack) || itemstack.is(Items.CROSSBOW);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
|
||||
@@ -371,7 +371,7 @@
|
||||
@@ -372,7 +372,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Warden> getBrain() {
|
||||
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -408,13 +408,13 @@
|
||||
@@ -409,7 +409,7 @@
|
||||
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
|
||||
|
||||
|
@ -18,32 +18,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
- DataResult dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement);
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = AngerManagement.codec(this::canTargetEntity).encodeStart(DynamicOpsNBT.INSTANCE, this.angerManagement); // CraftBukkit - decompile error
|
||||
Logger logger = Warden.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -439,7 +439,7 @@
|
||||
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
|
||||
logger = Warden.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((angermanagement) -> {
|
||||
+ ((DataResult<AngerManagement>) dataresult).resultOrPartial(logger::error).ifPresent((angermanagement) -> { // CraftBukkit - decompile error
|
||||
this.angerManagement = angermanagement;
|
||||
});
|
||||
this.syncClientAngerLevel();
|
||||
@@ -449,7 +449,7 @@
|
||||
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
logger = Warden.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((vibrationsystem_a) -> {
|
||||
+ ((DataResult<VibrationSystem.a>) dataresult).resultOrPartial(logger::error).ifPresent((vibrationsystem_a) -> { // CraftBukkit - decompile error
|
||||
this.vibrationData = vibrationsystem_a;
|
||||
});
|
||||
}
|
||||
@@ -547,7 +547,7 @@
|
||||
@@ -544,7 +544,7 @@
|
||||
|
||||
public void setAttackTarget(EntityLiving entityliving) {
|
||||
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);
|
||||
|
@ -52,7 +27,7 @@
|
|||
this.getBrain().eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
SonicBoom.setCooldown(this, 200);
|
||||
}
|
||||
@@ -582,12 +582,12 @@
|
||||
@@ -579,12 +579,12 @@
|
||||
|
||||
@Override
|
||||
protected NavigationAbstract createNavigation(World world) {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -361,7 +370,13 @@
|
||||
@@ -363,7 +372,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
|
||||
this.resendOffersToTradingPlayer();
|
||||
@@ -430,7 +445,13 @@
|
||||
@@ -432,7 +447,13 @@
|
||||
while (iterator.hasNext()) {
|
||||
MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next();
|
||||
|
||||
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +511,7 @@
|
||||
@@ -492,7 +513,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -73,7 +73,7 @@
|
|||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -513,7 +534,7 @@
|
||||
@@ -515,7 +536,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("VillagerData", 10)) {
|
||||
|
@ -82,7 +82,7 @@
|
|||
Logger logger = EntityVillager.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -826,9 +847,14 @@
|
||||
@@ -828,9 +849,14 @@
|
||||
}
|
||||
|
||||
entitywitch.setPersistenceRequired();
|
||||
|
@ -99,7 +99,7 @@
|
|||
} else {
|
||||
super.thunderHit(worldserver, entitylightning);
|
||||
}
|
||||
@@ -925,7 +951,7 @@
|
||||
@@ -927,7 +953,7 @@
|
||||
}).limit(5L).collect(Collectors.toList());
|
||||
|
||||
if (list1.size() >= j) {
|
||||
|
@ -108,7 +108,7 @@
|
|||
list.forEach(SensorGolemLastSeen::golemDetected);
|
||||
}
|
||||
}
|
||||
@@ -982,7 +1008,7 @@
|
||||
@@ -984,7 +1010,7 @@
|
||||
@Override
|
||||
public void startSleeping(BlockPosition blockposition) {
|
||||
super.startSleeping(blockposition);
|
||||
|
@ -117,7 +117,7 @@
|
|||
this.brain.eraseMemory(MemoryModuleType.WALK_TARGET);
|
||||
this.brain.eraseMemory(MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE);
|
||||
}
|
||||
@@ -990,7 +1016,7 @@
|
||||
@@ -992,7 +1018,7 @@
|
||||
@Override
|
||||
public void stopSleeping() {
|
||||
super.stopSleeping();
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
public EntityVillagerAbstract(EntityTypes<? extends EntityVillagerAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -173,7 +189,7 @@
|
||||
@@ -179,7 +195,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("Offers")) {
|
||||
|
@ -43,7 +43,7 @@
|
|||
Logger logger = EntityVillagerAbstract.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -240,7 +256,16 @@
|
||||
@@ -246,7 +262,16 @@
|
||||
MerchantRecipe merchantrecipe = ((VillagerTrades.IMerchantRecipeOption) arraylist.remove(this.random.nextInt(arraylist.size()))).getOffer(this, this.random);
|
||||
|
||||
if (merchantrecipe != null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/player/EntityHuman.java
|
||||
+++ b/net/minecraft/world/entity/player/EntityHuman.java
|
||||
@@ -116,6 +116,22 @@
|
||||
@@ -115,6 +115,22 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
|||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -135,7 +151,8 @@
|
||||
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
|
||||
private static final int CURRENT_IMPULSE_CONTEXT_RESET_GRACE_TIME_TICKS = 40;
|
||||
public static final Vec3D DEFAULT_VEHICLE_ATTACHMENT = new Vec3D(0.0D, 0.6D, 0.0D);
|
||||
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F).withEyeHeight(1.62F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT));
|
||||
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F).withEyeHeight(0.4F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F).withEyeHeight(1.27F).withAttachments(EntityAttachments.builder().attach(EntityAttachment.VEHICLE, EntityHuman.DEFAULT_VEHICLE_ATTACHMENT))).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F).withEyeHeight(1.62F)).build();
|
||||
|
@ -46,9 +46,9 @@
|
|||
protected int jumpTriggerTime;
|
||||
public float oBob;
|
||||
public float bob;
|
||||
@@ -181,6 +198,16 @@
|
||||
public Entity currentExplosionCause;
|
||||
public boolean ignoreFallDamageFromCurrentImpulse;
|
||||
@@ -182,6 +199,16 @@
|
||||
private boolean ignoreFallDamageFromCurrentImpulse;
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public boolean fauxSleeping;
|
||||
|
@ -63,7 +63,7 @@
|
|||
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
|
||||
super(EntityTypes.PLAYER, world);
|
||||
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||
@@ -325,7 +352,7 @@
|
||||
@@ -330,7 +357,7 @@
|
||||
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
|
||||
|
||||
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
|
||||
|
@ -98,8 +98,8 @@
|
|||
+ this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
|
||||
}
|
||||
|
||||
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
|
||||
@@ -665,6 +699,13 @@
|
||||
if (this.foodData.getSaturationLevel() < 20.0F && this.tickCount % 20 == 0) {
|
||||
@@ -683,6 +717,13 @@
|
||||
|
||||
@Nullable
|
||||
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
|
||||
|
@ -113,7 +113,7 @@
|
|||
if (itemstack.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
@@ -699,6 +740,33 @@
|
||||
@@ -717,6 +758,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);
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@
|
|||
return entityitem;
|
||||
}
|
||||
}
|
||||
@@ -790,7 +858,7 @@
|
||||
@@ -803,7 +871,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("LastDeathLocation", 10)) {
|
||||
|
@ -156,7 +156,7 @@
|
|||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -798,7 +866,7 @@
|
||||
@@ -811,7 +879,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("current_explosion_impact_pos", 9)) {
|
||||
|
@ -165,7 +165,7 @@
|
|||
Logger logger1 = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -834,7 +902,7 @@
|
||||
@@ -848,7 +916,7 @@
|
||||
}
|
||||
|
||||
this.getLastDeathLocation().flatMap((globalpos) -> {
|
||||
|
@ -174,7 +174,7 @@
|
|||
Logger logger = EntityHuman.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -866,12 +934,12 @@
|
||||
@@ -881,12 +949,12 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -189,7 +189,7 @@
|
|||
}
|
||||
|
||||
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
|
||||
@@ -883,7 +951,13 @@
|
||||
@@ -898,7 +966,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -903,10 +977,29 @@
|
||||
@@ -918,10 +992,29 @@
|
||||
}
|
||||
|
||||
public boolean canHarmPlayer(EntityHuman entityhuman) {
|
||||
|
@ -237,7 +237,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -946,8 +1039,13 @@
|
||||
@@ -961,8 +1054,13 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -252,7 +252,7 @@
|
|||
if (!this.isInvulnerableTo(damagesource)) {
|
||||
f = this.getDamageAfterArmorAbsorb(damagesource, f);
|
||||
f = this.getDamageAfterMagicAbsorb(damagesource, f);
|
||||
@@ -962,7 +1060,7 @@
|
||||
@@ -977,7 +1075,7 @@
|
||||
}
|
||||
|
||||
if (f != 0.0F) {
|
||||
|
@ -261,15 +261,15 @@
|
|||
this.getCombatTracker().recordDamage(damagesource, f);
|
||||
this.setHealth(this.getHealth() - f);
|
||||
if (f < 3.4028235E37F) {
|
||||
@@ -972,6 +1070,7 @@
|
||||
@@ -987,6 +1085,7 @@
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE);
|
||||
}
|
||||
}
|
||||
+ return false; // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1127,10 +1226,16 @@
|
||||
public boolean isTextFilteringEnabled() {
|
||||
@@ -1139,10 +1238,15 @@
|
||||
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
|
@ -279,118 +279,71 @@
|
|||
IProjectile iprojectile = (IProjectile) entity;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ DamageSource damagesource = this.damageSources().playerAttack(this);
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(entity, damagesource, f1, false)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true);
|
||||
} else {
|
||||
if (f > 0.0F || f1 > 0.0F) {
|
||||
@@ -1171,8 +1276,15 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
f3 = ((EntityLiving) entity).getHealth();
|
||||
if (j > 0 && !entity.isOnFire()) {
|
||||
- flag4 = true;
|
||||
- entity.igniteForSeconds(1);
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 1);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ flag4 = true;
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
if (iprojectile.deflect(ProjectileDeflection.AIM_DEFLECT, this, this, true)) {
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource());
|
||||
return;
|
||||
@@ -1218,8 +1322,11 @@
|
||||
if (entityliving2 != this && entityliving2 != entity && !this.isAlliedTo((Entity) entityliving2) && (!(entityliving2 instanceof EntityArmorStand) || !((EntityArmorStand) entityliving2).isMarker()) && this.distanceToSqr((Entity) entityliving2) < 9.0D) {
|
||||
float f7 = this.getEnchantedDamage(entityliving2, f6, damagesource) * f2;
|
||||
|
||||
@@ -1182,7 +1294,7 @@
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
if (entity instanceof EntityLiving) {
|
||||
- ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
+ ((EntityLiving) entity).knockback((double) ((float) i * 0.5F), (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.ENTITY_ATTACK); // CraftBukkit
|
||||
} else {
|
||||
entity.push((double) (-MathHelper.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F));
|
||||
}
|
||||
@@ -1200,8 +1312,11 @@
|
||||
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) {
|
||||
- entityliving.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
- entityliving.hurt(this.damageSources().playerAttack(this), f4);
|
||||
+ // CraftBukkit start - Only apply knockback if the damage hits
|
||||
+ 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)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1210,9 +1325,26 @@
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer && entity.hurtMarked) {
|
||||
+ // CraftBukkit start - Add Velocity Event
|
||||
+ boolean cancelled = false;
|
||||
+ Player player = (Player) entity.getBukkitEntity();
|
||||
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
+ } else if (!velocity.equals(event.getVelocity())) {
|
||||
+ player.setVelocity(event.getVelocity());
|
||||
+ }
|
||||
+
|
||||
+ if (!cancelled) {
|
||||
((EntityPlayer) entity).connection.send(new PacketPlayOutEntityVelocity(entity));
|
||||
entity.hurtMarked = false;
|
||||
entity.setDeltaMovement(vec3d);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
@@ -1257,7 +1389,14 @@
|
||||
|
||||
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
|
||||
if (j > 0) {
|
||||
- entity.igniteForSeconds(j * 4);
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
- entityliving2.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)));
|
||||
- entityliving2.hurt(damagesource, f7);
|
||||
+ // CraftBukkit start - Only apply knockback if the damage hits
|
||||
+ if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep(), f7)) {
|
||||
+ entityliving2.knockback(0.4000000059604645D, (double) MathHelper.sin(this.getYRot() * 0.017453292F), (double) (-MathHelper.cos(this.getYRot() * 0.017453292F)), this, EntityKnockbackEvent.KnockbackCause.SWEEP_ATTACK); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
World world = this.level();
|
||||
|
||||
if (this.level() instanceof WorldServer && f5 > 2.0F) {
|
||||
@@ -1267,12 +1406,17 @@
|
||||
}
|
||||
}
|
||||
if (world instanceof WorldServer) {
|
||||
@@ -1235,9 +1342,26 @@
|
||||
}
|
||||
|
||||
- this.causeFoodExhaustion(0.1F);
|
||||
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
|
||||
} else {
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
|
||||
if (flag4) {
|
||||
entity.clearFire();
|
||||
}
|
||||
+ // CraftBukkit start - resync on cancelled event
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
if (entity instanceof EntityPlayer && entity.hurtMarked) {
|
||||
+ // CraftBukkit start - Add Velocity Event
|
||||
+ boolean cancelled = false;
|
||||
+ Player player = (Player) entity.getBukkitEntity();
|
||||
+ org.bukkit.util.Vector velocity = CraftVector.toBukkit(vec3d);
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
+ } else if (!velocity.equals(event.getVelocity())) {
|
||||
+ player.setVelocity(event.getVelocity());
|
||||
+ }
|
||||
+
|
||||
+ if (!cancelled) {
|
||||
((EntityPlayer) entity).connection.send(new PacketPlayOutEntityVelocity(entity));
|
||||
entity.hurtMarked = false;
|
||||
entity.setDeltaMovement(vec3d);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1310,7 +1454,14 @@
|
||||
if (flag2) {
|
||||
@@ -1303,9 +1427,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.causeFoodExhaustion(0.1F);
|
||||
+ this.causeFoodExhaustion(0.1F, EntityExhaustionEvent.ExhaustionReason.ATTACK); // CraftBukkit - EntityExhaustionEvent
|
||||
} else {
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_ATTACK_NODAMAGE, this.getSoundSource(), 1.0F, 1.0F);
|
||||
+ // CraftBukkit start - resync on cancelled event
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((EntityPlayer) this).getBukkitEntity().updateInventory();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1346,7 +1475,14 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -406,7 +359,7 @@
|
|||
this.inventoryMenu.removed(this);
|
||||
if (this.containerMenu != null && this.hasContainerOpen()) {
|
||||
this.doCloseContainer();
|
||||
@@ -1346,6 +1497,12 @@
|
||||
@@ -1382,6 +1518,12 @@
|
||||
}
|
||||
|
||||
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
|
@ -419,7 +372,7 @@
|
|||
this.startSleeping(blockposition);
|
||||
this.sleepCounter = 0;
|
||||
return Either.right(Unit.INSTANCE);
|
||||
@@ -1433,9 +1590,9 @@
|
||||
@@ -1444,9 +1586,9 @@
|
||||
super.jumpFromGround();
|
||||
this.awardStat(StatisticList.JUMP);
|
||||
if (this.isSprinting()) {
|
||||
|
@ -431,7 +384,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1462,7 +1619,11 @@
|
||||
@@ -1473,7 +1615,11 @@
|
||||
|
||||
this.setDeltaMovement(vec3d2.x, d0 * 0.6D, vec3d2.z);
|
||||
this.resetFallDistance();
|
||||
|
@ -444,7 +397,7 @@
|
|||
} else {
|
||||
super.travel(vec3d);
|
||||
}
|
||||
@@ -1522,12 +1683,24 @@
|
||||
@@ -1547,12 +1693,24 @@
|
||||
}
|
||||
|
||||
public void startFallFlying() {
|
||||
|
@ -470,7 +423,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1642,10 +1815,21 @@
|
||||
@@ -1667,10 +1825,21 @@
|
||||
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
|
||||
}
|
||||
|
||||
|
@ -493,7 +446,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1731,13 +1915,20 @@
|
||||
@@ -1756,13 +1925,20 @@
|
||||
|
||||
@Override
|
||||
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
|
||||
|
@ -511,13 +464,13 @@
|
|||
} else if (enumitemslot == EnumItemSlot.OFFHAND) {
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.offhand.set(0, itemstack), itemstack, silent); // CraftBukkit
|
||||
} else if (enumitemslot.getType() == EnumItemSlot.Function.ARMOR) {
|
||||
} else if (enumitemslot.getType() == EnumItemSlot.Function.HUMANOID_ARMOR) {
|
||||
- this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack);
|
||||
+ this.onEquipItem(enumitemslot, (ItemStack) this.inventory.armor.set(enumitemslot.getIndex(), itemstack), itemstack, silent); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1781,26 +1972,31 @@
|
||||
@@ -1806,26 +1982,31 @@
|
||||
|
||||
protected void removeEntitiesOnShoulder() {
|
||||
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {
|
||||
|
@ -557,3 +510,12 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -2040,7 +2221,7 @@
|
||||
|
||||
@Override
|
||||
public ItemStack eat(World world, ItemStack itemstack, FoodInfo foodinfo) {
|
||||
- this.getFoodData().eat(foodinfo);
|
||||
+ this.getFoodData().eat(itemstack, foodinfo); // CraftBukkit
|
||||
this.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
world.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_BURP, SoundCategory.PLAYERS, 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
|
||||
if (this instanceof EntityPlayer) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
||||
@@ -49,6 +49,13 @@
|
||||
@@ -52,6 +52,13 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
public abstract class EntityArrow extends IProjectile {
|
||||
|
||||
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
||||
@@ -225,7 +232,7 @@
|
||||
@@ -242,7 +249,7 @@
|
||||
}
|
||||
|
||||
if (object != null && !flag) {
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
this.hasImpulse = true;
|
||||
if (projectiledeflection != ProjectileDeflection.NONE) {
|
||||
@@ -316,7 +323,7 @@
|
||||
@@ -333,7 +340,7 @@
|
||||
protected void tickDespawn() {
|
||||
++this.life;
|
||||
if (this.life >= 1200) {
|
||||
|
@ -32,7 +32,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -349,7 +356,7 @@
|
||||
@@ -380,7 +387,7 @@
|
||||
}
|
||||
|
||||
if (this.piercingIgnoreEntityIds.size() >= this.getPierceLevel() + 1) {
|
||||
|
@ -41,13 +41,13 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -378,7 +385,13 @@
|
||||
@@ -401,7 +408,13 @@
|
||||
int k = entity.getRemainingFireTicks();
|
||||
|
||||
if (this.isOnFire() && !flag) {
|
||||
- entity.igniteForSeconds(5);
|
||||
- entity.igniteForSeconds(5.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5.0F);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
if (entity.hurt(damagesource, (float) i)) {
|
||||
@@ -429,7 +442,7 @@
|
||||
@@ -447,7 +460,7 @@
|
||||
|
||||
this.playSound(this.soundEvent, 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
|
||||
if (this.getPierceLevel() <= 0) {
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
} else {
|
||||
entity.setRemainingFireTicks(k);
|
||||
@@ -440,7 +453,7 @@
|
||||
@@ -458,7 +471,7 @@
|
||||
this.spawnAtLocation(this.getPickupItem(), 0.1F);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,56 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -547,9 +560,24 @@
|
||||
@@ -614,7 +627,7 @@
|
||||
}
|
||||
|
||||
if (nbttagcompound.contains("weapon", 10)) {
|
||||
- this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse((Object) null);
|
||||
+ this.firedFromWeapon = (ItemStack) ItemStack.parse(this.registryAccess(), nbttagcompound.getCompound("weapon")).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
this.firedFromWeapon = null;
|
||||
}
|
||||
@@ -630,17 +643,10 @@
|
||||
EntityArrow.PickupStatus entityarrow_pickupstatus;
|
||||
|
||||
label16:
|
||||
- while(true) {
|
||||
- //$FF: b0->value
|
||||
- //0->net/minecraft/world/entity/player/EntityHuman
|
||||
- //1->net/minecraft/world/entity/OminousItemSpawner
|
||||
- switch (entity1.typeSwitch<invokedynamic>(entity1, b0)) {
|
||||
- case -1:
|
||||
- default:
|
||||
- entityarrow_pickupstatus = this.pickup;
|
||||
- break label16;
|
||||
- case 0:
|
||||
- EntityHuman entityhuman = (EntityHuman)entity1;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ while (true) {
|
||||
+ switch (entity1) {
|
||||
+ case EntityHuman entityhuman:
|
||||
|
||||
if (this.pickup != EntityArrow.PickupStatus.DISALLOWED) {
|
||||
b0 = 1;
|
||||
@@ -649,12 +655,15 @@
|
||||
|
||||
entityarrow_pickupstatus = EntityArrow.PickupStatus.ALLOWED;
|
||||
break label16;
|
||||
- case 1:
|
||||
- OminousItemSpawner ominousitemspawner = (OminousItemSpawner)entity1;
|
||||
+ case OminousItemSpawner ominousitemspawner:
|
||||
|
||||
entityarrow_pickupstatus = EntityArrow.PickupStatus.DISALLOWED;
|
||||
break label16;
|
||||
+ default:
|
||||
+ entityarrow_pickupstatus = this.pickup;
|
||||
+ break label16;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.pickup = entityarrow_pickupstatus;
|
||||
@@ -663,9 +672,24 @@
|
||||
@Override
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityDragonFireball.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -16,6 +16,10 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityDragonFireball extends EntityFireball {
|
||||
|
||||
public static final float SPLASH_RANGE = 4.0F;
|
||||
@@ -61,7 +65,7 @@
|
||||
@@ -62,7 +66,7 @@
|
||||
|
||||
this.level().levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
||||
this.level().addFreshEntity(entityareaeffectcloud);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEgg.java
|
||||
@@ -11,6 +11,16 @@
|
||||
@@ -12,6 +12,16 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
|
||||
|
@ -16,8 +16,8 @@
|
|||
+
|
||||
public class EntityEgg extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEgg(EntityTypes<? extends EntityEgg> entitytypes, World world) {
|
||||
@@ -47,26 +57,53 @@
|
||||
private static final EntitySize ZERO_SIZED_DIMENSIONS = EntitySize.fixed(0.0F, 0.0F);
|
||||
@@ -50,30 +60,58 @@
|
||||
protected void onHit(MovingObjectPosition movingobjectposition) {
|
||||
super.onHit(movingobjectposition);
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -59,14 +59,18 @@
|
|||
|
||||
if (entitychicken != null) {
|
||||
- entitychicken.setAge(-24000);
|
||||
- entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
- this.level().addFreshEntity(entitychicken);
|
||||
+ // CraftBukkit start
|
||||
+ if (entitychicken.getBukkitEntity() instanceof Ageable) {
|
||||
+ ((Ageable) entitychicken.getBukkitEntity()).setBaby();
|
||||
+ }
|
||||
+ this.level().addFreshEntity(entitychicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG);
|
||||
+ // CraftBukkit end
|
||||
entitychicken.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
||||
if (!entitychicken.fudgePositionAfterSizeChange(EntityEgg.ZERO_SIZED_DIMENSIONS)) {
|
||||
break;
|
||||
}
|
||||
|
||||
- this.level().addFreshEntity(entitychicken);
|
||||
+ this.level().addFreshEntity(entitychicken, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
|
||||
@@ -18,6 +18,13 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
@@ -21,6 +21,13 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.Bukkit;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
+import org.bukkit.event.player.PlayerTeleportEvent;
|
||||
|
@ -14,64 +14,51 @@
|
|||
public class EntityEnderPearl extends EntityProjectileThrowable {
|
||||
|
||||
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
|
||||
@@ -54,23 +61,34 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
@@ -65,19 +72,26 @@
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
|
||||
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
|
||||
- if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
- EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level());
|
||||
+ // CraftBukkit start - Fire PlayerTeleportEvent
|
||||
+ org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity();
|
||||
+ org.bukkit.Location location = getBukkitEntity().getLocation();
|
||||
+ location.setPitch(player.getLocation().getPitch());
|
||||
+ location.setYaw(player.getLocation().getYaw());
|
||||
|
||||
- if (entityendermite != null) {
|
||||
- entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- this.level().addFreshEntity(entityendermite);
|
||||
+ PlayerTeleportEvent teleEvent = new PlayerTeleportEvent(player, player.getLocation(), location, PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||
+ Bukkit.getPluginManager().callEvent(teleEvent);
|
||||
+
|
||||
+ if (!teleEvent.isCancelled() && entityplayer.connection.isAcceptingMessages()) {
|
||||
+ if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
+ EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(this.level());
|
||||
+
|
||||
+ if (entityendermite != null) {
|
||||
+ entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
+ this.level().addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
if (entityplayer.connection.isAcceptingMessages()) {
|
||||
+ // CraftBukkit start
|
||||
+ Entity tp = entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING, PlayerTeleportEvent.TeleportCause.ENDER_PEARL));
|
||||
+ if (tp == null) {
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT);
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.random.nextFloat() < 0.05F && worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
|
||||
EntityEndermite entityendermite = (EntityEndermite) EntityTypes.ENDERMITE.create(worldserver);
|
||||
|
||||
if (entityendermite != null) {
|
||||
entityendermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
|
||||
- worldserver.addFreshEntity(entityendermite);
|
||||
+ worldserver.addFreshEntity(entityendermite, CreatureSpawnEvent.SpawnReason.ENDER_PEARL);
|
||||
}
|
||||
}
|
||||
|
||||
- entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING));
|
||||
+ // entity.changeDimension(new DimensionTransition(worldserver, this.position(), entity.getDeltaMovement(), entity.getYRot(), entity.getXRot(), DimensionTransition.DO_NOTHING)); // CraftBukkit - moved up
|
||||
entity.resetFallDistance();
|
||||
entityplayer.resetCurrentImpulseContext();
|
||||
- entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
this.playSound(worldserver, this.position());
|
||||
}
|
||||
- }
|
||||
} else {
|
||||
@@ -86,11 +100,11 @@
|
||||
this.playSound(worldserver, this.position());
|
||||
}
|
||||
|
||||
- if (entity.isPassenger()) {
|
||||
- entityplayer.dismountTo(this.getX(), this.getY(), this.getZ());
|
||||
- } else {
|
||||
- entity.teleportTo(this.getX(), this.getY(), this.getZ());
|
||||
- }
|
||||
+ if (entity.isPassenger()) {
|
||||
+ entity.stopRiding();
|
||||
+ }
|
||||
|
||||
- entity.resetFallDistance();
|
||||
- entity.hurt(this.damageSources().fall(), 5.0F);
|
||||
+ entityplayer.connection.teleport(teleEvent.getTo());
|
||||
+ entity.resetFallDistance();
|
||||
+ entity.hurt(this.damageSources().fall().customEntityDamager(this), 5.0F); // CraftBukkit
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_TELEPORT, SoundCategory.PLAYERS);
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
} else if (entity != null) {
|
||||
@@ -78,7 +96,7 @@
|
||||
entity.resetFallDistance();
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
return;
|
||||
}
|
||||
|
||||
- this.discard();
|
||||
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
||||
}
|
||||
|
||||
}
|
||||
@@ -88,7 +106,7 @@
|
||||
@@ -116,7 +130,7 @@
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity instanceof EntityPlayer && !entity.isAlive() && this.level().getGameRules().getBoolean(GameRules.RULE_ENDER_PEARLS_VANISH_ON_DEATH)) {
|
||||
|
@ -80,12 +67,12 @@
|
|||
} else {
|
||||
super.tick();
|
||||
}
|
||||
@@ -100,7 +118,7 @@
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
Entity entity = this.getOwner();
|
||||
@@ -129,7 +143,7 @@
|
||||
|
||||
- if (entity != null && entity.level().dimension() != worldserver.dimension()) {
|
||||
+ if (entity != null && worldserver != null && entity.level().dimension() != worldserver.dimension()) { // CraftBukkit - SPIGOT-6113
|
||||
this.setOwner((Entity) null);
|
||||
}
|
||||
@Override
|
||||
public boolean canChangeDimensions(World world, World world1) {
|
||||
- if (world.dimension() == World.END) {
|
||||
+ if (world.getTypeKey() == WorldDimension.END) { // CraftBukkit
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (entity instanceof EntityPlayer) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
|
||||
@@ -15,6 +15,10 @@
|
||||
import net.minecraft.world.entity.TraceableEntity;
|
||||
@@ -17,6 +17,10 @@
|
||||
import net.minecraft.world.item.enchantment.EnchantmentManager;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityEvokerFangs extends Entity implements TraceableEntity {
|
||||
|
||||
public static final int ATTACK_DURATION = 20;
|
||||
@@ -119,7 +123,7 @@
|
||||
@@ -121,7 +125,7 @@
|
||||
}
|
||||
|
||||
if (--this.lifeTicks < 0) {
|
||||
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +134,7 @@
|
||||
@@ -132,7 +136,7 @@
|
||||
|
||||
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {
|
||||
if (entityliving1 == null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
|
||||
@@ -18,6 +18,11 @@
|
||||
@@ -18,11 +18,18 @@
|
||||
import net.minecraft.world.phys.MovingObjectPosition;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,17 +11,15 @@
|
|||
+
|
||||
public abstract class EntityFireball extends IProjectile {
|
||||
|
||||
public static final double ATTACK_DEFLECTION_SCALE = 0.1D;
|
||||
@@ -25,6 +30,8 @@
|
||||
public double xPower;
|
||||
public double yPower;
|
||||
public double zPower;
|
||||
public static final double INITAL_ACCELERATION_POWER = 0.1D;
|
||||
public static final double DEFLECTION_SCALE = 0.5D;
|
||||
public double accelerationPower;
|
||||
+ public float bukkitYield = 1; // CraftBukkit
|
||||
+ public boolean isIncendiary = true; // CraftBukkit
|
||||
|
||||
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -72,7 +79,7 @@
|
||||
@@ -71,7 +78,7 @@
|
||||
Entity entity = this.getOwner();
|
||||
|
||||
if (!this.level().isClientSide && (entity != null && entity.isRemoved() || !this.level().hasChunkAt(this.blockPosition()))) {
|
||||
|
@ -30,7 +28,7 @@
|
|||
} else {
|
||||
super.tick();
|
||||
if (this.shouldBurn()) {
|
||||
@@ -82,7 +89,13 @@
|
||||
@@ -81,7 +88,13 @@
|
||||
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
|
||||
|
||||
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue