mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-04 18:12:09 +01:00
Update to Minecraft 1.20
By: md_5 <git@md-5.net>
This commit is contained in:
parent
bac55e67d6
commit
9d740b84b0
269 changed files with 2605 additions and 2568 deletions
|
@ -1,10 +1,10 @@
|
|||
--- a/net/minecraft/advancements/Advancement.java
|
||||
+++ b/net/minecraft/advancements/Advancement.java
|
||||
@@ -40,6 +40,7 @@
|
||||
private final String[][] requirements;
|
||||
@@ -41,6 +41,7 @@
|
||||
private final Set<Advancement> children = Sets.newLinkedHashSet();
|
||||
private final IChatBaseComponent chatComponent;
|
||||
private final boolean sendsTelemetryEvent;
|
||||
+ public final org.bukkit.advancement.Advancement bukkit = new org.bukkit.craftbukkit.advancement.CraftAdvancement(this); // CraftBukkit
|
||||
|
||||
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring) {
|
||||
public Advancement(MinecraftKey minecraftkey, @Nullable Advancement advancement, @Nullable AdvancementDisplay advancementdisplay, AdvancementRewards advancementrewards, Map<String, Criterion> map, String[][] astring, boolean flag) {
|
||||
this.id = minecraftkey;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -119,6 +119,14 @@
|
||||
@@ -120,6 +120,14 @@
|
||||
import net.minecraft.util.profiling.jfr.JvmProfiler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class CommandDispatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -130,6 +138,7 @@
|
||||
@@ -131,6 +139,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);
|
||||
@@ -218,6 +227,11 @@
|
||||
@@ -220,6 +229,11 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.dispatcher.setConsumer((commandcontext, flag, i) -> {
|
||||
((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i);
|
||||
});
|
||||
@@ -230,12 +244,59 @@
|
||||
@@ -232,12 +246,59 @@
|
||||
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@
|
|||
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource();
|
||||
|
||||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
@@ -260,7 +321,7 @@
|
||||
@@ -262,7 +323,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int j = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
|
@ -105,7 +105,7 @@
|
|||
});
|
||||
|
||||
if (j > 10) {
|
||||
@@ -310,11 +371,36 @@
|
||||
@@ -312,11 +373,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
|
@ -143,7 +143,7 @@
|
|||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -325,7 +411,7 @@
|
||||
@@ -327,7 +413,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
|
@ -152,7 +152,7 @@
|
|||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -348,7 +434,7 @@
|
||||
@@ -350,7 +436,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandListenerWrapper.java
|
||||
+++ b/net/minecraft/commands/CommandListenerWrapper.java
|
||||
@@ -40,6 +40,8 @@
|
||||
@@ -42,6 +42,8 @@
|
||||
import net.minecraft.world.phys.Vec2F;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -9,15 +9,15 @@
|
|||
public class CommandListenerWrapper implements ICompletionProvider {
|
||||
|
||||
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(IChatBaseComponent.translatable("permissions.requires.player"));
|
||||
@@ -60,6 +62,7 @@
|
||||
private final Vec2F rotation;
|
||||
@@ -63,6 +65,7 @@
|
||||
private final CommandSigningContext signingContext;
|
||||
private final TaskChainer chatMessageChainer;
|
||||
private final IntConsumer returnValueConsumer;
|
||||
+ public volatile CommandNode currentCommand; // CraftBukkit
|
||||
|
||||
public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) {
|
||||
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> {
|
||||
@@ -170,9 +173,23 @@
|
||||
@@ -179,9 +182,23 @@
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(int i) {
|
||||
|
@ -41,7 +41,7 @@
|
|||
public Vec3D getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -298,7 +315,7 @@
|
||||
@@ -318,7 +335,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
entityplayer.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
}
|
||||
@@ -371,4 +388,10 @@
|
||||
@@ -391,4 +408,10 @@
|
||||
public FeatureFlagSet enabledFeatures() {
|
||||
return this.level.enabledFeatures();
|
||||
}
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
ItemStack itemstack1 = itemstack.copyWithCount(1);
|
||||
|
||||
itemstack1.setCount(1);
|
||||
@@ -87,7 +101,7 @@
|
||||
TileEntityBanner.removeLastPattern(itemstack1);
|
||||
@@ -86,7 +100,7 @@
|
||||
}
|
||||
|
||||
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
||||
|
@ -53,7 +53,7 @@
|
|||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -105,9 +119,14 @@
|
||||
@@ -104,9 +118,14 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -116,7 +135,7 @@
|
||||
@@ -115,7 +134,7 @@
|
||||
};
|
||||
|
||||
static Object2ObjectOpenHashMap<Item, CauldronInteraction> newInteractionMap() {
|
||||
|
@ -78,7 +78,7 @@
|
|||
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
return EnumInteractionResult.PASS;
|
||||
});
|
||||
@@ -132,12 +151,17 @@
|
||||
@@ -131,12 +150,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -97,7 +97,7 @@
|
|||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -153,12 +177,17 @@
|
||||
@@ -152,12 +176,17 @@
|
||||
});
|
||||
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -116,7 +116,7 @@
|
|||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -168,10 +197,15 @@
|
||||
@@ -167,10 +196,15 @@
|
||||
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
|
||||
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.getPotion(itemstack) == Potions.WATER) {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -133,7 +133,7 @@
|
|||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -243,12 +277,17 @@
|
||||
@@ -242,12 +276,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
|
@ -152,7 +152,7 @@
|
|||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -259,12 +298,17 @@
|
||||
@@ -258,12 +297,17 @@
|
||||
|
||||
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
if (!world.isClientSide) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
|
||||
@@ -11,6 +11,11 @@
|
||||
@@ -12,6 +12,11 @@
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
|
||||
|
@ -12,18 +12,18 @@
|
|||
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
|
||||
|
||||
private final DispenseBehaviorItem defaultDispenseItemBehavior;
|
||||
@@ -47,12 +52,40 @@
|
||||
d3 = 0.0D;
|
||||
@@ -49,12 +54,40 @@
|
||||
d4 = 0.0D;
|
||||
}
|
||||
|
||||
- Object object = this.isChestBoat ? new ChestBoat(worldserver, d0, d1 + d3, d2) : new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
+ // EntityBoat entityboat = new EntityBoat(worldserver, d0, d1 + d3, d2);
|
||||
- Object object = this.isChestBoat ? new ChestBoat(worldserver, d1, d2 + d4, d3) : new EntityBoat(worldserver, d1, d2 + d4, d3);
|
||||
+ // Object object = this.isChestBoat ? new ChestBoat(worldserver, d1, d2 + d4, d3) : new EntityBoat(worldserver, d1, d2 + d4, d3);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d1, d2 + d4, d3));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
|
|
@ -44,8 +44,8 @@
|
|||
if (!worldserver.isClientSide()) {
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
||||
- this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive((WorldServer) worldserver, blockposition) || tryShearLivingEntity((WorldServer) worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
- this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.isSuccess() && itemstack.hurt(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -78,6 +78,22 @@
|
||||
@@ -78,6 +78,21 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
|||
+import net.minecraft.world.item.ItemBucket;
|
||||
+import net.minecraft.world.level.block.BlockSapling;
|
||||
+import net.minecraft.world.level.block.IFluidContainer;
|
||||
+import net.minecraft.world.level.material.Material;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.TreeType;
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
|
||||
|
@ -23,7 +22,7 @@
|
|||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -202,14 +218,42 @@
|
||||
@@ -202,14 +217,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
|
||||
|
||||
|
@ -68,7 +67,7 @@
|
|||
isourceblock.getLevel().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, isourceblock.getPos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -228,13 +272,41 @@
|
||||
@@ -228,13 +271,41 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
@ -111,7 +110,7 @@
|
|||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -255,8 +327,35 @@
|
||||
@@ -255,8 +326,35 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -148,7 +147,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
@@ -283,7 +382,35 @@
|
||||
@@ -283,7 +381,35 @@
|
||||
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
|
||||
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
|
||||
|
||||
|
@ -185,7 +184,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -326,9 +453,35 @@
|
||||
@@ -326,9 +452,35 @@
|
||||
}
|
||||
|
||||
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
|
||||
|
@ -223,7 +222,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -337,12 +490,41 @@
|
||||
@@ -337,12 +489,41 @@
|
||||
@Override
|
||||
public ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
|
@ -266,7 +265,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -364,12 +546,40 @@
|
||||
@@ -364,12 +545,40 @@
|
||||
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
|
||||
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
|
||||
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
|
||||
|
@ -312,7 +311,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -405,9 +615,52 @@
|
||||
@@ -405,9 +614,51 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
|
@ -321,8 +320,7 @@
|
|||
+ int y = blockposition.getY();
|
||||
+ int z = blockposition.getZ();
|
||||
+ IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
+ Material material = iblockdata.getMaterial();
|
||||
+ if (worldserver.isEmptyBlock(blockposition) || !material.isSolid() || material.isReplaceable() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlaceLiquid(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ if (iblockdata.isAir() || iblockdata.canBeReplaced() || (dispensiblecontaineritem instanceof ItemBucket && iblockdata.getBlock() instanceof IFluidContainer && ((IFluidContainer) iblockdata.getBlock()).canPlaceLiquid(worldserver, blockposition, iblockdata, ((ItemBucket) dispensiblecontaineritem).content))) {
|
||||
+ org.bukkit.block.Block block = worldserver.getWorld().getBlockAt(isourceblock.getPos().getX(), isourceblock.getPos().getY(), isourceblock.getPos().getZ());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
|
@ -366,7 +364,7 @@
|
|||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(isourceblock, itemstack);
|
||||
}
|
||||
@@ -434,7 +687,7 @@
|
||||
@@ -434,7 +685,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
|
@ -375,7 +373,7 @@
|
|||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.execute(isourceblock, itemstack);
|
||||
@@ -442,6 +695,32 @@
|
||||
@@ -442,6 +693,32 @@
|
||||
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
|
@ -408,7 +406,7 @@
|
|||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -463,16 +742,44 @@
|
||||
@@ -463,16 +740,44 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
|
||||
|
@ -456,7 +454,7 @@
|
|||
BlockTNT.explode(worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
} else {
|
||||
@@ -496,12 +803,62 @@
|
||||
@@ -496,12 +801,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
@ -519,7 +517,7 @@
|
|||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -511,12 +868,41 @@
|
||||
@@ -511,12 +866,41 @@
|
||||
protected ItemStack execute(ISourceBlock isourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = isourceblock.getLevel();
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
|
@ -563,7 +561,7 @@
|
|||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -541,6 +927,30 @@
|
||||
@@ -541,6 +925,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = isourceblock.getPos().relative(enumdirection);
|
||||
|
||||
|
@ -594,7 +592,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, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -566,6 +976,30 @@
|
||||
@@ -566,6 +974,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
|
@ -625,7 +623,7 @@
|
|||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -615,6 +1049,30 @@
|
||||
@@ -615,6 +1047,30 @@
|
||||
BlockPosition blockposition = isourceblock.getPos().relative((EnumDirection) isourceblock.getBlockState().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
@@ -32,11 +32,20 @@
|
||||
@@ -30,11 +30,19 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.positions[j] = short0;
|
||||
|
@ -11,9 +11,8 @@
|
|||
}
|
||||
|
||||
+ // CraftBukkit start - Add constructor
|
||||
+ public PacketPlayOutMultiBlockChange(SectionPosition sectionposition, ShortSet shortset, IBlockData[] states, boolean flag) {
|
||||
+ public PacketPlayOutMultiBlockChange(SectionPosition sectionposition, ShortSet shortset, IBlockData[] states) {
|
||||
+ this.sectionPos = sectionposition;
|
||||
+ this.suppressLightUpdates = flag;
|
||||
+ this.positions = shortset.toShortArray();
|
||||
+ this.states = states;
|
||||
+ }
|
||||
|
@ -21,4 +20,4 @@
|
|||
+
|
||||
public PacketPlayOutMultiBlockChange(PacketDataSerializer packetdataserializer) {
|
||||
this.sectionPos = SectionPosition.of(packetdataserializer.readLong());
|
||||
this.suppressLightUpdates = packetdataserializer.readBoolean();
|
||||
int i = packetdataserializer.readVarInt();
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
public class DataWatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -142,6 +147,13 @@
|
||||
@@ -146,6 +151,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
|||
public boolean isDirty() {
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -223,7 +235,7 @@
|
||||
@@ -227,7 +239,7 @@
|
||||
if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_b.value, datawatcher_b.value.getClass()));
|
||||
} else {
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -231,6 +243,18 @@
|
||||
@@ -235,6 +247,18 @@
|
||||
return this.itemsById.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
|||
public static class Item<T> {
|
||||
|
||||
final DataWatcherObject<T> accessor;
|
||||
@@ -273,7 +297,7 @@
|
||||
@@ -277,7 +301,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
this.progressChanged.add(advancement);
|
||||
flag = true;
|
||||
if (!flag1 && advancementprogress.isDone()) {
|
||||
+ this.player.level.getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
+ this.player.level().getCraftServer().getPluginManager().callEvent(new org.bukkit.event.player.PlayerAdvancementDoneEvent(this.player.getBukkitEntity(), advancement.bukkit)); // CraftBukkit
|
||||
advancement.getRewards().grant(this.player);
|
||||
if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level.getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
if (advancement.getDisplay() != null && advancement.getDisplay().shouldAnnounceChat() && this.player.level().getGameRules().getBoolean(GameRules.RULE_ANNOUNCE_ADVANCEMENTS)) {
|
||||
this.playerList.broadcastSystemMessage(IChatBaseComponent.translatable("chat.type.advancement." + advancement.getDisplay().getFrame().getName(), this.player.getDisplayName(), advancement.getChatComponent()), false);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/CustomFunctionData.java
|
||||
+++ b/net/minecraft/server/CustomFunctionData.java
|
||||
@@ -42,7 +42,7 @@
|
||||
@@ -43,7 +43,7 @@
|
||||
}
|
||||
|
||||
public CommandDispatcher<CommandListenerWrapper> getDispatcher() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -26,6 +26,12 @@
|
||||
@@ -30,6 +30,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;
|
||||
@@ -36,6 +42,23 @@
|
||||
@@ -41,6 +47,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
|
@ -35,11 +35,11 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
DispenserRegistry.isBootstrapped = true;
|
||||
if (BuiltInRegistries.REGISTRY.keySet().isEmpty()) {
|
||||
throw new IllegalStateException("Unable to load registries");
|
||||
@@ -52,6 +75,69 @@
|
||||
BuiltInRegistries.bootStrap();
|
||||
Instant instant = Instant.now();
|
||||
|
||||
@@ -61,6 +84,69 @@
|
||||
wrapStreams();
|
||||
DispenserRegistry.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
|
||||
}
|
||||
+ // CraftBukkit start - easier than fixing the decompile
|
||||
+ DataConverterFlattenData.register(1008, "{Name:'minecraft:oak_sign',Properties:{rotation:'0'}}", "{Name:'minecraft:standing_sign',Properties:{rotation:'0'}}");
|
||||
|
|
|
@ -89,8 +89,8 @@
|
|||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.createDefault(file.toPath());
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.createAccess(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.createAccess(s, WorldDimension.OVERWORLD);
|
||||
- Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s);
|
||||
+ Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s, WorldDimension.OVERWORLD);
|
||||
WorldInfo worldinfo = convertable_conversionsession.getSummary();
|
||||
|
||||
if (worldinfo != null) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -165,6 +165,32 @@
|
||||
@@ -164,6 +164,33 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
|||
+import net.minecraft.world.level.levelgen.WorldDimensions;
|
||||
+import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import net.minecraft.world.level.validation.ContentValidationException;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.Main;
|
||||
|
@ -33,7 +34,7 @@
|
|||
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ICommandListener, AutoCloseable {
|
||||
|
||||
public static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -250,6 +276,20 @@
|
||||
@@ -249,6 +276,20 @@
|
||||
protected SaveData worldData;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
|
@ -54,7 +55,7 @@
|
|||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -263,14 +303,14 @@
|
||||
@@ -262,14 +303,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
|
@ -71,7 +72,7 @@
|
|||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -290,7 +330,7 @@
|
||||
@@ -289,7 +330,7 @@
|
||||
this.frameTimer = new CircularTimer();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
|
@ -80,7 +81,7 @@
|
|||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -313,13 +353,40 @@
|
||||
@@ -312,13 +353,40 @@
|
||||
this.serverThread = thread;
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
}
|
||||
|
@ -122,7 +123,7 @@
|
|||
ScoreboardServer scoreboardserver1 = this.getScoreboard();
|
||||
|
||||
Objects.requireNonNull(scoreboardserver1);
|
||||
@@ -328,7 +395,7 @@
|
||||
@@ -327,7 +395,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
|
@ -131,7 +132,7 @@
|
|||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -336,12 +403,8 @@
|
||||
@@ -335,12 +403,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
|
@ -145,7 +146,7 @@
|
|||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -356,25 +419,183 @@
|
||||
@@ -355,25 +419,183 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -186,7 +187,7 @@
|
|||
- long j = BiomeManager.obfuscateSeed(i);
|
||||
- List<MobSpawner> list = ImmutableList.of(new MobSpawnerPhantom(), new MobSpawnerPatrol(), new MobSpawnerCat(), new VillageSiege(), new MobSpawnerTrader(iworlddataserver));
|
||||
- WorldDimension worlddimension = (WorldDimension) iregistry.get(WorldDimension.OVERWORLD);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true);
|
||||
- WorldServer worldserver = new WorldServer(this, this.executor, this.storageSource, iworlddataserver, World.OVERWORLD, worlddimension, worldloadlistener, flag, j, list, true, (RandomSequences) null);
|
||||
+ String worldType = (dimension == -999) ? dimensionKey.location().getNamespace() + "_" + dimensionKey.location().getPath() : org.bukkit.World.Environment.getEnvironment(dimension).toString().toLowerCase();
|
||||
+ String name = (dimensionKey == WorldDimension.OVERWORLD) ? s : s + "_" + worldType;
|
||||
+ if (dimension != 0) {
|
||||
|
@ -225,8 +226,8 @@
|
|||
+ }
|
||||
+
|
||||
+ try {
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).createAccess(name, dimensionKey);
|
||||
+ } catch (IOException ex) {
|
||||
+ worldSession = Convertable.createDefault(server.getWorldContainer().toPath()).validateAndCreateAccess(name, dimensionKey);
|
||||
+ } catch (IOException | ContentValidationException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ }
|
||||
|
@ -296,14 +297,14 @@
|
|||
|
||||
- this.readScoreboard(worldpersistentdata);
|
||||
- this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, (RandomSequences) null, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
|
||||
+ this.readScoreboard(worldpersistentdata);
|
||||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, this.overworld().getRandomSequences(), org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ }
|
||||
+
|
||||
+ worlddata.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
|
@ -344,7 +345,7 @@
|
|||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -398,29 +619,8 @@
|
||||
@@ -397,30 +619,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
|
@ -353,6 +354,7 @@
|
|||
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
|
||||
- }
|
||||
-
|
||||
- RandomSequences randomsequences = worldserver.getRandomSequences();
|
||||
- Iterator iterator = iregistry.entrySet().iterator();
|
||||
-
|
||||
- while (iterator.hasNext()) {
|
||||
|
@ -362,7 +364,7 @@
|
|||
- if (resourcekey != WorldDimension.OVERWORLD) {
|
||||
- ResourceKey<World> resourcekey1 = ResourceKey.create(Registries.DIMENSION, resourcekey.location());
|
||||
- SecondaryWorldData secondaryworlddata = new SecondaryWorldData(this.worldData, iworlddataserver);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, (WorldDimension) entry.getValue(), worldloadlistener, flag, j, ImmutableList.of(), false);
|
||||
- WorldServer worldserver1 = new WorldServer(this, this.executor, this.storageSource, secondaryworlddata, resourcekey1, (WorldDimension) entry.getValue(), worldloadlistener, flag, j, ImmutableList.of(), false, randomsequences);
|
||||
-
|
||||
- worldborder.addListener(new IWorldBorderListener.a(worldserver1.getWorldBorder()));
|
||||
- this.levels.put(resourcekey1, worldserver1);
|
||||
|
@ -411,9 +413,9 @@
|
|||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -498,19 +716,23 @@
|
||||
@@ -497,19 +715,23 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(500);
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
|
||||
+ // CraftBukkit start
|
||||
|
@ -444,7 +446,7 @@
|
|||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk::load, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -525,11 +747,18 @@
|
||||
@@ -524,10 +746,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -455,7 +457,6 @@
|
|||
+ this.executeModerately();
|
||||
+ // CraftBukkit end
|
||||
worldloadlistener.stop();
|
||||
chunkproviderserver.getLightEngine().setTaskPerBatch(5);
|
||||
- this.updateMobSpawningFlags();
|
||||
+ // CraftBukkit start
|
||||
+ // this.updateMobSpawningFlags();
|
||||
|
@ -466,7 +467,7 @@
|
|||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -559,12 +788,16 @@
|
||||
@@ -557,12 +786,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
|
@ -483,7 +484,7 @@
|
|||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -599,12 +832,33 @@
|
||||
@@ -597,12 +830,33 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
|
@ -517,7 +518,7 @@
|
|||
if (this.getConnection() != null) {
|
||||
this.getConnection().stop();
|
||||
}
|
||||
@@ -614,6 +868,7 @@
|
||||
@@ -612,6 +866,7 @@
|
||||
MinecraftServer.LOGGER.info("Saving players");
|
||||
this.playerList.saveAll();
|
||||
this.playerList.removeAll();
|
||||
|
@ -525,7 +526,7 @@
|
|||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -701,15 +956,16 @@
|
||||
@@ -699,15 +954,16 @@
|
||||
}
|
||||
|
||||
this.nextTickTime = SystemUtils.getMillis();
|
||||
|
@ -544,7 +545,7 @@
|
|||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", i, j);
|
||||
this.nextTickTime += j * 50L;
|
||||
this.lastOverloadWarning = this.nextTickTime;
|
||||
@@ -720,6 +976,7 @@
|
||||
@@ -718,6 +974,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
|
@ -552,7 +553,7 @@
|
|||
this.nextTickTime += 50L;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -758,6 +1015,12 @@
|
||||
@@ -756,6 +1013,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
|
@ -565,7 +566,7 @@
|
|||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -791,9 +1054,16 @@
|
||||
@@ -789,9 +1052,16 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
|
@ -583,7 +584,7 @@
|
|||
protected void waitUntilNextTick() {
|
||||
this.runAllTasks();
|
||||
this.managedBlock(() -> {
|
||||
@@ -838,7 +1108,7 @@
|
||||
@@ -836,7 +1106,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -592,7 +593,7 @@
|
|||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -891,7 +1161,7 @@
|
||||
@@ -889,7 +1159,7 @@
|
||||
this.status = this.buildServerStatus();
|
||||
}
|
||||
|
||||
|
@ -601,7 +602,7 @@
|
|||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -938,22 +1208,39 @@
|
||||
@@ -936,22 +1206,39 @@
|
||||
}
|
||||
|
||||
public void tickChildren(BooleanSupplier booleansupplier) {
|
||||
|
@ -621,7 +622,7 @@
|
|||
+ if (this.tickCount % 20 == 0) {
|
||||
+ for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
|
||||
+ EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
|
||||
+ entityplayer.connection.send(new PacketPlayOutUpdateTime(entityplayer.level.getGameTime(), entityplayer.getPlayerTime(), entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ entityplayer.connection.send(new PacketPlayOutUpdateTime(entityplayer.level().getGameTime(), entityplayer.getPlayerTime(), entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DAYLIGHT))); // Add support for per player time
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -641,7 +642,7 @@
|
|||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1033,6 +1320,22 @@
|
||||
@@ -1031,6 +1318,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
|
@ -664,7 +665,7 @@
|
|||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1059,7 +1362,7 @@
|
||||
@@ -1057,7 +1360,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
@ -695,7 +696,7 @@
|
|||
this.packRepository.setSelected(collection);
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1785,7 +2089,7 @@
|
||||
@@ -1777,7 +2081,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
|
@ -704,7 +705,7 @@
|
|||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1835,6 +2139,22 @@
|
||||
@@ -1827,6 +2131,22 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -727,7 +728,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) -> {
|
||||
@@ -1961,8 +2281,30 @@
|
||||
@@ -1953,8 +2273,30 @@
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandDifficulty.java
|
||||
+++ b/net/minecraft/server/commands/CommandDifficulty.java
|
||||
@@ -42,11 +42,12 @@
|
||||
@@ -44,11 +44,12 @@
|
||||
|
||||
public static int setDifficulty(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException {
|
||||
MinecraftServer minecraftserver = commandlistenerwrapper.getServer();
|
||||
|
@ -12,6 +12,6 @@
|
|||
} else {
|
||||
- minecraftserver.setDifficulty(enumdifficulty, true);
|
||||
+ worldServer.serverLevelData.setDifficulty(enumdifficulty); // CraftBukkit
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.difficulty.success", enumdifficulty.getDisplayName()), true);
|
||||
return 0;
|
||||
}
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.difficulty.success", enumdifficulty.getDisplayName());
|
||||
}, true);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@
|
||||
@@ -114,7 +114,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
++i;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@
|
||||
@@ -144,7 +144,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
t0.setFromArgument(commandcontext, "value");
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.gamerule.set", gamerules_gamerulekey.getId(), t0.toString()), true);
|
||||
@@ -39,7 +39,7 @@
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
@@ -41,7 +41,7 @@
|
||||
}
|
||||
|
||||
static <T extends GameRules.GameRuleValue<T>> int queryRule(CommandListenerWrapper commandlistenerwrapper, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
|
||||
- T t0 = commandlistenerwrapper.getServer().getGameRules().getRule(gamerules_gamerulekey);
|
||||
+ T t0 = commandlistenerwrapper.getLevel().getGameRules().getRule(gamerules_gamerulekey); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.gamerule.query", gamerules_gamerulekey.getId(), t0.toString()), false);
|
||||
return t0.getCommandResult();
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.gamerule.query", gamerules_gamerulekey.getId(), t0.toString());
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/server/commands/CommandGive.java
|
||||
+++ b/net/minecraft/server/commands/CommandGive.java
|
||||
@@ -60,7 +60,7 @@
|
||||
@@ -61,7 +61,7 @@
|
||||
|
||||
if (flag && itemstack.isEmpty()) {
|
||||
itemstack.setCount(1);
|
||||
- entityitem = entityplayer.drop(itemstack, false);
|
||||
+ entityitem = entityplayer.drop(itemstack, false, false, false); // SPIGOT-2942: Add boolean to call event
|
||||
if (flag && itemstack1.isEmpty()) {
|
||||
itemstack1.setCount(1);
|
||||
- entityitem = entityplayer.drop(itemstack1, false);
|
||||
+ entityitem = entityplayer.drop(itemstack1, false, false, false); // SPIGOT-2942: Add boolean to call event
|
||||
if (entityitem != null) {
|
||||
entityitem.makeFakeItem();
|
||||
}
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
--- a/net/minecraft/server/commands/CommandList.java
|
||||
+++ b/net/minecraft/server/commands/CommandList.java
|
||||
@@ -36,6 +36,12 @@
|
||||
@@ -35,7 +35,14 @@
|
||||
|
||||
private static int format(CommandListenerWrapper commandlistenerwrapper, Function<EntityPlayer, IChatBaseComponent> function) {
|
||||
PlayerList playerlist = commandlistenerwrapper.getServer().getPlayerList();
|
||||
List<EntityPlayer> list = playerlist.getPlayers();
|
||||
- List<EntityPlayer> list = playerlist.getPlayers();
|
||||
+ // CraftBukkit start
|
||||
+ List<EntityPlayer> players = playerlist.getPlayers();
|
||||
+ if (commandlistenerwrapper.getBukkitSender() instanceof org.bukkit.entity.Player) {
|
||||
+ org.bukkit.entity.Player sender = (org.bukkit.entity.Player) commandlistenerwrapper.getBukkitSender();
|
||||
+ list = list.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ players = players.stream().filter((ep) -> sender.canSee(ep.getBukkitEntity())).collect(java.util.stream.Collectors.toList());
|
||||
+ }
|
||||
+ List<EntityPlayer> list = players;
|
||||
+ // CraftBukkit end
|
||||
IChatBaseComponent ichatbasecomponent = ChatComponentUtils.formatList(list, function);
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.list.players", list.size(), playerlist.getMaxPlayers(), ichatbasecomponent), false);
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -92,7 +92,7 @@
|
||||
if (entity instanceof EntityHuman) {
|
||||
set.add(entity.getTeam());
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
@@ -202,7 +202,7 @@
|
||||
commandspreadplayers_a = acommandspreadplayers_a[j++];
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
|||
d1 = Double.MAX_VALUE;
|
||||
CommandSpreadPlayers.a[] acommandspreadplayers_a1 = acommandspreadplayers_a;
|
||||
int k = acommandspreadplayers_a.length;
|
||||
@@ -299,7 +299,7 @@
|
||||
@@ -301,7 +301,7 @@
|
||||
|
||||
for (boolean flag2 = iblockaccess.getBlockState(blockposition_mutableblockposition).isAir(); blockposition_mutableblockposition.getY() > iblockaccess.getMinBuildHeight(); flag2 = flag1) {
|
||||
blockposition_mutableblockposition.move(EnumDirection.DOWN);
|
||||
|
@ -27,16 +27,16 @@
|
|||
if (!flag1 && flag2 && flag) {
|
||||
return blockposition_mutableblockposition.getY() + 1;
|
||||
}
|
||||
@@ -312,7 +312,7 @@
|
||||
@@ -314,7 +314,7 @@
|
||||
|
||||
public boolean isSafe(IBlockAccess iblockaccess, int i) {
|
||||
BlockPosition blockposition = BlockPosition.containing(this.x, (double) (this.getSpawnY(iblockaccess, i) - 1), this.z);
|
||||
- IBlockData iblockdata = iblockaccess.getBlockState(blockposition);
|
||||
+ IBlockData iblockdata = getBlockState(iblockaccess, blockposition); // CraftBukkit
|
||||
Material material = iblockdata.getMaterial();
|
||||
|
||||
return blockposition.getY() < i && !material.isLiquid() && material != Material.FIRE;
|
||||
@@ -322,5 +322,12 @@
|
||||
return blockposition.getY() < i && !iblockdata.liquid() && !iblockdata.is(TagsBlock.FIRE);
|
||||
}
|
||||
@@ -323,5 +323,12 @@
|
||||
this.x = MathHelper.nextDouble(randomsource, d0, d2);
|
||||
this.z = MathHelper.nextDouble(randomsource, d1, d3);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
public class CommandTeleport {
|
||||
|
||||
private static final SimpleCommandExceptionType INVALID_POSITION = new SimpleCommandExceptionType(IChatBaseComponent.translatable("commands.teleport.invalidPosition"));
|
||||
@@ -147,7 +154,30 @@
|
||||
@@ -155,7 +162,30 @@
|
||||
float f2 = MathHelper.wrapDegrees(f);
|
||||
float f3 = MathHelper.wrapDegrees(f1);
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
public class CommandTime {
|
||||
|
||||
public CommandTime() {}
|
||||
@@ -47,12 +52,18 @@
|
||||
@@ -49,12 +54,18 @@
|
||||
}
|
||||
|
||||
public static int setTime(CommandListenerWrapper commandlistenerwrapper, int i) {
|
||||
|
@ -32,8 +32,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.time.set", i), true);
|
||||
@@ -60,12 +71,18 @@
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
@@ -64,12 +75,18 @@
|
||||
}
|
||||
|
||||
public static int addTime(CommandListenerWrapper commandlistenerwrapper, int i) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandTrigger.java
|
||||
+++ b/net/minecraft/server/commands/CommandTrigger.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -96,7 +96,7 @@
|
||||
if (scoreboardobjective.getCriteria() != IScoreboardCriteria.TRIGGER) {
|
||||
throw CommandTrigger.ERROR_INVALID_OBJECTIVE.create();
|
||||
} else {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
if (worldborder.getDamageSafeZone() == (double) f) {
|
||||
throw CommandWorldBorder.ERROR_SAME_DAMAGE_BUFFER.create();
|
||||
@@ -69,7 +69,7 @@
|
||||
@@ -71,7 +71,7 @@
|
||||
}
|
||||
|
||||
private static int setDamageAmount(CommandListenerWrapper commandlistenerwrapper, float f) throws CommandSyntaxException {
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
if (worldborder.getDamagePerBlock() == (double) f) {
|
||||
throw CommandWorldBorder.ERROR_SAME_DAMAGE_AMOUNT.create();
|
||||
@@ -81,7 +81,7 @@
|
||||
@@ -85,7 +85,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningTime(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
|
||||
|
@ -27,7 +27,7 @@
|
|||
|
||||
if (worldborder.getWarningTime() == i) {
|
||||
throw CommandWorldBorder.ERROR_SAME_WARNING_TIME.create();
|
||||
@@ -93,7 +93,7 @@
|
||||
@@ -99,7 +99,7 @@
|
||||
}
|
||||
|
||||
private static int setWarningDistance(CommandListenerWrapper commandlistenerwrapper, int i) throws CommandSyntaxException {
|
||||
|
@ -36,15 +36,16 @@
|
|||
|
||||
if (worldborder.getWarningBlocks() == i) {
|
||||
throw CommandWorldBorder.ERROR_SAME_WARNING_DISTANCE.create();
|
||||
@@ -105,14 +105,14 @@
|
||||
@@ -113,7 +113,7 @@
|
||||
}
|
||||
|
||||
private static int getSize(CommandListenerWrapper commandlistenerwrapper) {
|
||||
- double d0 = commandlistenerwrapper.getServer().overworld().getWorldBorder().getSize();
|
||||
+ double d0 = commandlistenerwrapper.getLevel().getWorldBorder().getSize(); // CraftBukkit
|
||||
|
||||
commandlistenerwrapper.sendSuccess(IChatBaseComponent.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0)), false);
|
||||
return MathHelper.floor(d0 + 0.5D);
|
||||
commandlistenerwrapper.sendSuccess(() -> {
|
||||
return IChatBaseComponent.translatable("commands.worldborder.get", String.format(Locale.ROOT, "%.0f", d0));
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
private static int setCenter(CommandListenerWrapper commandlistenerwrapper, Vec2F vec2f) throws CommandSyntaxException {
|
||||
|
@ -53,7 +54,7 @@
|
|||
|
||||
if (worldborder.getCenterX() == (double) vec2f.x && worldborder.getCenterZ() == (double) vec2f.y) {
|
||||
throw CommandWorldBorder.ERROR_SAME_CENTER.create();
|
||||
@@ -126,7 +126,7 @@
|
||||
@@ -138,7 +138,7 @@
|
||||
}
|
||||
|
||||
private static int setSize(CommandListenerWrapper commandlistenerwrapper, double d0, long i) throws CommandSyntaxException {
|
||||
|
|
|
@ -177,7 +177,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -537,14 +617,45 @@
|
||||
@@ -539,14 +619,45 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -225,7 +225,7 @@
|
|||
});
|
||||
return this.rconConsoleSource.getCommandResponse();
|
||||
}
|
||||
@@ -597,4 +708,15 @@
|
||||
@@ -599,4 +710,15 @@
|
||||
public Optional<MinecraftServer.ServerResourcePackInfo> getServerResourcePack() {
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/dedicated/PropertyManager.java
|
||||
+++ b/net/minecraft/server/dedicated/PropertyManager.java
|
||||
@@ -17,13 +17,28 @@
|
||||
@@ -23,13 +23,28 @@
|
||||
import net.minecraft.core.IRegistryCustom;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
public static Properties loadFromFile(Path path) {
|
||||
@@ -58,6 +73,11 @@
|
||||
@@ -97,6 +112,11 @@
|
||||
|
||||
public void store(Path path) {
|
||||
try {
|
||||
|
@ -39,10 +39,10 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
OutputStream outputstream = Files.newOutputStream(path);
|
||||
BufferedWriter bufferedwriter = Files.newBufferedWriter(path, StandardCharsets.UTF_8);
|
||||
|
||||
try {
|
||||
@@ -86,7 +106,7 @@
|
||||
@@ -125,7 +145,7 @@
|
||||
private static <V extends Number> Function<String, V> wrapNumberDeserializer(Function<String, V> function) {
|
||||
return (s) -> {
|
||||
try {
|
||||
|
@ -51,7 +51,7 @@
|
|||
} catch (NumberFormatException numberformatexception) {
|
||||
return null;
|
||||
}
|
||||
@@ -105,7 +125,7 @@
|
||||
@@ -144,7 +164,7 @@
|
||||
|
||||
@Nullable
|
||||
private String getStringRaw(String s) {
|
||||
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -121,6 +141,16 @@
|
||||
@@ -160,6 +180,16 @@
|
||||
}
|
||||
|
||||
protected <V> V get(String s, Function<String, V> function, Function<V, String> function1, V v0) {
|
||||
|
@ -77,7 +77,7 @@
|
|||
String s1 = this.getStringRaw(s);
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
@@ -133,7 +163,7 @@
|
||||
@@ -172,7 +202,7 @@
|
||||
V v1 = MoreObjects.firstNonNull(s1 != null ? function.apply(s1) : null, v0);
|
||||
|
||||
this.properties.put(s, function1.apply(v1));
|
||||
|
@ -86,7 +86,7 @@
|
|||
}
|
||||
|
||||
protected <V> V get(String s, Function<String, V> function, UnaryOperator<V> unaryoperator, Function<V, String> function1, V v0) {
|
||||
@@ -197,7 +227,7 @@
|
||||
@@ -236,7 +266,7 @@
|
||||
return properties;
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@
|
|||
|
||||
public class EditableProperty<V> implements Supplier<V> {
|
||||
|
||||
@@ -205,7 +235,7 @@
|
||||
@@ -244,7 +274,7 @@
|
||||
private final V value;
|
||||
private final Function<V, String> serializer;
|
||||
|
||||
|
@ -104,7 +104,7 @@
|
|||
this.key = s;
|
||||
this.value = object;
|
||||
this.serializer = function;
|
||||
@@ -219,7 +249,7 @@
|
||||
@@ -258,7 +288,7 @@
|
||||
Properties properties = PropertyManager.this.cloneProperties();
|
||||
|
||||
properties.put(this.key, this.serializer.apply(v0));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -126,10 +126,25 @@
|
||||
@@ -122,10 +122,25 @@
|
||||
}
|
||||
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
|
@ -29,7 +29,7 @@
|
|||
return true;
|
||||
} else {
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -165,7 +180,7 @@
|
||||
@@ -161,7 +176,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
|||
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
|
||||
int j = getTicketLevelAt(arraysetsorted);
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
|
||||
@@ -175,13 +190,15 @@
|
||||
@@ -171,13 +186,15 @@
|
||||
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -189,6 +206,7 @@
|
||||
@@ -185,6 +202,7 @@
|
||||
}
|
||||
|
||||
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
||||
|
@ -64,7 +64,7 @@
|
|||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -202,19 +220,33 @@
|
||||
@@ -198,19 +216,33 @@
|
||||
}
|
||||
|
||||
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
+
|
||||
+ public <T> boolean addRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
+ // CraftBukkit end
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, ChunkLevel.byStatus(FullChunkStatus.FULL) - i, t0);
|
||||
long j = chunkcoordintpair.toLong();
|
||||
|
||||
- this.addTicket(j, ticket);
|
||||
|
@ -90,7 +90,7 @@
|
|||
+
|
||||
+ public <T> boolean removeRegionTicketAtDistance(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
+ // CraftBukkit end
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, 33 - i, t0);
|
||||
Ticket<T> ticket = new Ticket<>(tickettype, ChunkLevel.byStatus(FullChunkStatus.FULL) - i, t0);
|
||||
long j = chunkcoordintpair.toLong();
|
||||
|
||||
- this.removeTicket(j, ticket);
|
||||
|
@ -100,7 +100,7 @@
|
|||
}
|
||||
|
||||
private ArraySetSorted<Ticket<?>> getTickets(long i) {
|
||||
@@ -253,6 +285,7 @@
|
||||
@@ -249,6 +281,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
||||
long i = chunkcoordintpair.toLong();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
|
@ -108,7 +108,7 @@
|
|||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -382,6 +415,26 @@
|
||||
@@ -378,6 +411,26 @@
|
||||
return !this.tickets.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -134,4 +134,4 @@
|
|||
+
|
||||
private class a extends ChunkMap {
|
||||
|
||||
public a() {
|
||||
private static final int MAX_LEVEL = ChunkLevel.MAX_LEVEL + 1;
|
||||
|
|
|
@ -42,16 +42,16 @@
|
|||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -230,7 +240,15 @@
|
||||
int l = 33 + ChunkStatus.getDistance(chunkstatus);
|
||||
int l = ChunkLevel.byStatus(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
- if (flag) {
|
||||
+ // CraftBukkit start - don't add new ticket for currently unloading chunk
|
||||
+ boolean currentlyUnloading = false;
|
||||
+ if (playerchunk != null) {
|
||||
+ PlayerChunk.State oldChunkState = PlayerChunk.getFullChunkStatus(playerchunk.oldTicketLevel);
|
||||
+ PlayerChunk.State currentChunkState = PlayerChunk.getFullChunkStatus(playerchunk.getTicketLevel());
|
||||
+ currentlyUnloading = (oldChunkState.isOrAfter(PlayerChunk.State.BORDER) && !currentChunkState.isOrAfter(PlayerChunk.State.BORDER));
|
||||
+ FullChunkStatus oldChunkState = ChunkLevel.fullStatus(playerchunk.oldTicketLevel);
|
||||
+ FullChunkStatus currentChunkState = ChunkLevel.fullStatus(playerchunk.getTicketLevel());
|
||||
+ currentlyUnloading = (oldChunkState.isOrAfter(FullChunkStatus.FULL) && !currentChunkState.isOrAfter(FullChunkStatus.FULL));
|
||||
+ }
|
||||
+ if (flag && !currentlyUnloading) {
|
||||
+ // CraftBukkit end
|
||||
|
@ -67,7 +67,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -316,7 +334,7 @@
|
||||
@@ -317,7 +335,7 @@
|
||||
} else if (!this.level.shouldTickBlocksAt(i)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -76,7 +76,7 @@
|
|||
|
||||
return either != null && either.left().isPresent();
|
||||
}
|
||||
@@ -329,11 +347,31 @@
|
||||
@@ -330,11 +348,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
@ -109,7 +109,7 @@
|
|||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -365,7 +403,7 @@
|
||||
@@ -366,7 +404,7 @@
|
||||
|
||||
gameprofilerfiller.push("pollingChunks");
|
||||
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
|
||||
|
@ -118,7 +118,7 @@
|
|||
|
||||
gameprofilerfiller.push("naturalSpawnCount");
|
||||
int l = this.distanceManager.getNaturalSpawnChunkCount();
|
||||
@@ -386,7 +424,7 @@
|
||||
@@ -387,7 +425,7 @@
|
||||
}
|
||||
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
|
@ -127,7 +127,7 @@
|
|||
|
||||
Collections.shuffle(list);
|
||||
Iterator iterator1 = list.iterator();
|
||||
@@ -591,13 +629,19 @@
|
||||
@@ -592,13 +630,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -275,12 +322,56 @@
|
||||
@@ -274,12 +321,56 @@
|
||||
this.advancements = minecraftserver.getPlayerList().getPlayerAdvancements(this);
|
||||
this.setMaxUpStep(1.0F);
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
|
@ -119,7 +119,7 @@
|
|||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -329,7 +420,7 @@
|
||||
@@ -328,7 +419,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
|
@ -128,7 +128,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -348,17 +439,26 @@
|
||||
@@ -347,17 +438,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
|
@ -156,7 +156,7 @@
|
|||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -371,7 +471,7 @@
|
||||
@@ -370,7 +470,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -165,7 +165,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -392,7 +492,20 @@
|
||||
@@ -391,7 +491,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
|
@ -187,7 +187,7 @@
|
|||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -417,8 +530,32 @@
|
||||
@@ -416,8 +529,32 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
|
@ -197,7 +197,7 @@
|
|||
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
+ this.level = world;
|
||||
+ this.setLevel(world);
|
||||
+ if (world == null) {
|
||||
+ this.unsetRemoved();
|
||||
+ Vec3D position = null;
|
||||
|
@ -211,7 +211,7 @@
|
|||
+ world = ((CraftWorld) Bukkit.getServer().getWorlds().get(0)).getHandle();
|
||||
+ position = Vec3D.atCenterOf(world.getSharedSpawnPos());
|
||||
+ }
|
||||
+ this.level = world;
|
||||
+ this.setLevel(world);
|
||||
+ this.setPos(position);
|
||||
+ }
|
||||
+ this.gameMode.setLevel((WorldServer) world);
|
||||
|
@ -220,7 +220,7 @@
|
|||
|
||||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
@@ -478,6 +615,11 @@
|
||||
@@ -477,6 +614,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -232,7 +232,7 @@
|
|||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -534,7 +676,7 @@
|
||||
@@ -533,7 +675,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
|
@ -241,7 +241,7 @@
|
|||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -565,6 +707,12 @@
|
||||
@@ -564,6 +706,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
|
@ -254,7 +254,7 @@
|
|||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -579,6 +727,20 @@
|
||||
@@ -578,6 +726,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
|
@ -275,26 +275,26 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -621,7 +783,8 @@
|
||||
@@ -620,7 +782,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ // CraftBukkit - Use our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
scoreboardscore.setScore(i);
|
||||
});
|
||||
}
|
||||
@@ -630,9 +793,47 @@
|
||||
@@ -629,9 +792,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
+ // CraftBukkit start - fire PlayerDeathEvent
|
||||
+ if (this.isRemoved()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(this.getInventory().getContainerSize());
|
||||
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY) || this.isSpectator();
|
||||
+
|
||||
+ if (!keepInventory) {
|
||||
+ for (ItemStack item : this.getInventory().getContents()) {
|
||||
|
@ -333,10 +333,10 @@
|
|||
+ ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage);
|
||||
+ }
|
||||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getCombatTracker(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -663,12 +864,18 @@
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
@@ -662,12 +863,18 @@
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
-
|
||||
|
@ -354,42 +354,42 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
|
||||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -706,10 +913,12 @@
|
||||
@@ -705,10 +912,12 @@
|
||||
String s = this.getScoreboardName();
|
||||
String s1 = entity.getScoreboardName();
|
||||
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
|
||||
if (entity instanceof EntityHuman) {
|
||||
this.awardStat(StatisticList.PLAYER_KILLS);
|
||||
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
|
||||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -727,7 +936,8 @@
|
||||
@@ -726,7 +935,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
+ // CraftBukkit - Get our scores instead
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,18 +987,20 @@
|
||||
@@ -776,18 +986,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
- return this.server.isPvpAllowed();
|
||||
+ // CraftBukkit - this.server.isPvpAllowed() -> this.world.pvpMode
|
||||
+ return this.level.pvpMode;
|
||||
+ return this.level().pvpMode;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -398,8 +398,8 @@
|
|||
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
|
||||
- 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);
|
||||
|
@ -407,7 +407,7 @@
|
|||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -797,11 +1009,20 @@
|
||||
@@ -796,11 +1008,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -421,7 +421,7 @@
|
|||
+ // CraftBukkit end
|
||||
+ if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154
|
||||
+ // this.isChangingDimension = true; // CraftBukkit - Moved down and into PlayerList#changeDimension
|
||||
WorldServer worldserver1 = this.getLevel();
|
||||
WorldServer worldserver1 = this.serverLevel();
|
||||
- ResourceKey<World> resourcekey = worldserver1.dimension();
|
||||
+ ResourceKey<WorldDimension> resourcekey = worldserver1.getTypeKey(); // CraftBukkit
|
||||
|
||||
|
@ -429,9 +429,9 @@
|
|||
+ if (resourcekey == WorldDimension.END && worldserver != null && worldserver.getTypeKey() == WorldDimension.OVERWORLD) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Moved down from above
|
||||
this.unRide();
|
||||
this.getLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -812,6 +1033,8 @@
|
||||
@@ -811,6 +1032,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
|
@ -439,8 +439,8 @@
|
|||
+ /*
|
||||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
@@ -821,20 +1044,50 @@
|
||||
this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation(), this.getPortalCooldown()));
|
||||
@@ -820,20 +1043,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
|
@ -479,8 +479,8 @@
|
|||
+ if (true) { // CraftBukkit
|
||||
+ this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds
|
||||
+
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level.getDifficulty(), this.level.getLevelData().isDifficultyLocked()));
|
||||
+ this.connection.send(new PacketPlayOutRespawn(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), (byte) 3, this.getLastDeathLocation(), this.getPortalCooldown()));
|
||||
+ this.connection.send(new PacketPlayOutServerDifficulty(this.level().getDifficulty(), this.level().getLevelData().isDifficultyLocked()));
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
+ playerlist.sendPlayerPermissionLevel(this);
|
||||
|
@ -490,20 +490,20 @@
|
|||
- worldserver1.getProfiler().pop();
|
||||
- worldserver1.getProfiler().push("placing");
|
||||
+ // CraftBukkit end
|
||||
this.setLevel(worldserver);
|
||||
this.setServerLevel(worldserver);
|
||||
- this.connection.teleport(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, shapedetectorshape.xRot);
|
||||
+ this.connection.teleport(exit); // CraftBukkit - use internal teleport without event
|
||||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
@@ -854,39 +1107,66 @@
|
||||
@@ -853,39 +1106,66 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(changeEvent);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
@ -559,7 +559,7 @@
|
|||
+ 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);
|
||||
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
|
||||
|
||||
|
@ -569,13 +569,13 @@
|
|||
}
|
||||
|
||||
return optional1;
|
||||
@@ -896,13 +1176,21 @@
|
||||
@@ -895,13 +1175,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
+ // CraftBukkit start
|
||||
+ ResourceKey<World> maindimensionkey = CraftDimensionUtil.getMainDimensionKey(worldserver);
|
||||
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level);
|
||||
+ ResourceKey<World> maindimensionkey1 = CraftDimensionUtil.getMainDimensionKey(this.level());
|
||||
+
|
||||
+ CriterionTriggers.CHANGED_DIMENSION.trigger(this, maindimensionkey, maindimensionkey1);
|
||||
+ if (maindimensionkey != resourcekey || maindimensionkey1 != resourcekey1) {
|
||||
|
@ -594,31 +594,31 @@
|
|||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -919,19 +1207,17 @@
|
||||
@@ -918,19 +1206,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
- @Override
|
||||
- public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
|
||||
- EnumDirection enumdirection = (EnumDirection) this.level.getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
- EnumDirection enumdirection = (EnumDirection) this.level().getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
-
|
||||
+ // CraftBukkit start - moved bed result checks from below into separate method
|
||||
+ private Either<EntityHuman.EnumBedResult, Unit> getBedResult(BlockPosition blockposition, EnumDirection enumdirection) {
|
||||
if (!this.isSleeping() && this.isAlive()) {
|
||||
- if (!this.level.dimensionType().natural()) {
|
||||
+ if (!this.level.dimensionType().natural() || !this.level.dimensionType().bedWorks()) {
|
||||
- if (!this.level().dimensionType().natural()) {
|
||||
+ if (!this.level().dimensionType().natural() || !this.level().dimensionType().bedWorks()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE);
|
||||
} else if (!this.bedInRange(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.TOO_FAR_AWAY);
|
||||
} else if (this.bedBlocked(blockposition, enumdirection)) {
|
||||
return Either.left(EntityHuman.EnumBedResult.OBSTRUCTED);
|
||||
} else {
|
||||
- this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true);
|
||||
+ this.setRespawnPosition(this.level.dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
|
||||
if (this.level.isDay()) {
|
||||
- this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true);
|
||||
+ this.setRespawnPosition(this.level().dimension(), blockposition, this.getYRot(), false, true, PlayerSpawnChangeEvent.Cause.BED); // CraftBukkit
|
||||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -948,7 +1234,36 @@
|
||||
@@ -947,7 +1233,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@
|
|||
+
|
||||
+ @Override
|
||||
+ public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition, boolean force) {
|
||||
+ EnumDirection enumdirection = (EnumDirection) this.level.getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
+ EnumDirection enumdirection = (EnumDirection) this.level().getBlockState(blockposition).getValue(BlockFacingHorizontal.FACING);
|
||||
+ Either<EntityHuman.EnumBedResult, Unit> bedResult = this.getBedResult(blockposition, enumdirection);
|
||||
+
|
||||
+ if (bedResult.left().orElse(null) == EntityHuman.EnumBedResult.OTHER_PROBLEM) {
|
||||
|
@ -656,7 +656,7 @@
|
|||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -961,9 +1276,8 @@
|
||||
@@ -960,9 +1275,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
|
@ -667,7 +667,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -990,6 +1304,24 @@
|
||||
@@ -989,6 +1303,24 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
|
@ -678,22 +678,22 @@
|
|||
+
|
||||
+ org.bukkit.block.Block bed;
|
||||
+ if (bedPosition != null) {
|
||||
+ bed = this.level.getWorld().getBlockAt(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ());
|
||||
+ bed = this.level().getWorld().getBlockAt(bedPosition.getX(), bedPosition.getY(), bedPosition.getZ());
|
||||
+ } else {
|
||||
+ bed = this.level.getWorld().getBlockAt(player.getLocation());
|
||||
+ bed = this.level().getWorld().getBlockAt(player.getLocation());
|
||||
+ }
|
||||
+
|
||||
+ PlayerBedLeaveEvent event = new PlayerBedLeaveEvent(player, bed, true);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.isSleeping()) {
|
||||
this.getLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
this.serverLevel().getChunkSource().broadcastAndSend(this, new PacketPlayOutAnimation(this, 2));
|
||||
}
|
||||
@@ -1038,8 +1370,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos()));
|
||||
@@ -1037,8 +1369,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
- public void nextContainerCounter() {
|
||||
|
@ -703,7 +703,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1047,13 +1380,35 @@
|
||||
@@ -1046,13 +1379,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -739,7 +739,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1061,9 +1416,11 @@
|
||||
@@ -1060,9 +1415,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -753,7 +753,7 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1076,13 +1433,24 @@
|
||||
@@ -1075,13 +1432,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
|
@ -780,7 +780,7 @@
|
|||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1105,6 +1473,7 @@
|
||||
@@ -1104,6 +1472,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
|
@ -788,7 +788,7 @@
|
|||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1127,6 +1496,16 @@
|
||||
@@ -1126,6 +1495,16 @@
|
||||
}
|
||||
|
||||
this.jumping = flag;
|
||||
|
@ -805,25 +805,25 @@
|
|||
this.setShiftKeyDown(flag1);
|
||||
}
|
||||
|
||||
@@ -1135,7 +1514,7 @@
|
||||
@@ -1134,7 +1513,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), (scoreboardscore) -> {
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), (scoreboardscore) -> { // CraftBukkit - Get our scores instead
|
||||
scoreboardscore.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1143,7 +1522,7 @@
|
||||
@@ -1142,7 +1521,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
- this.getScoreboard().forAllObjectives(statistic, this.getScoreboardName(), ScoreboardScore::reset);
|
||||
+ this.level.getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), ScoreboardScore::reset); // CraftBukkit - Get our scores instead
|
||||
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(statistic, this.getScoreboardName(), ScoreboardScore::reset); // CraftBukkit - Get our scores instead
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1159,7 +1538,7 @@
|
||||
@@ -1163,7 +1542,7 @@
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
MinecraftKey minecraftkey = aminecraftkey1[j];
|
||||
|
@ -832,7 +832,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
@@ -1194,6 +1573,7 @@
|
||||
@@ -1198,6 +1577,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
|
@ -840,7 +840,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1252,7 +1632,7 @@
|
||||
@@ -1256,7 +1636,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -849,7 +849,7 @@
|
|||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.setShoulderEntityLeft(entityplayer.getShoulderEntityLeft());
|
||||
@@ -1302,6 +1682,12 @@
|
||||
@@ -1306,6 +1686,12 @@
|
||||
|
||||
@Override
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
|
@ -862,10 +862,10 @@
|
|||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1311,9 +1697,9 @@
|
||||
@@ -1315,9 +1701,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == this.level) {
|
||||
if (worldserver == this.level()) {
|
||||
- this.connection.teleport(d0, d1, d2, f, f1, set);
|
||||
+ this.connection.teleport(d0, d1, d2, f, f1, set, cause); // CraftBukkit
|
||||
} else {
|
||||
|
@ -874,7 +874,7 @@
|
|||
}
|
||||
|
||||
this.setYHeadRot(f);
|
||||
@@ -1417,7 +1803,20 @@
|
||||
@@ -1420,7 +1806,20 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -895,7 +895,7 @@
|
|||
this.chatVisibility = packetplayinsettings.chatVisibility();
|
||||
this.canChatColor = packetplayinsettings.chatColors();
|
||||
this.textFilteringEnabled = packetplayinsettings.textFilteringEnabled();
|
||||
@@ -1492,7 +1891,7 @@
|
||||
@@ -1495,7 +1894,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -904,7 +904,7 @@
|
|||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1529,7 +1928,7 @@
|
||||
@@ -1532,7 +1931,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
|
@ -913,7 +913,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1550,9 +1949,16 @@
|
||||
@@ -1553,9 +1952,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
|
@ -927,10 +927,10 @@
|
|||
this.setCamera(this);
|
||||
this.stopRiding();
|
||||
+ /* CraftBukkit start - replace with bukkit handling for multi-world
|
||||
if (worldserver == this.level) {
|
||||
if (worldserver == this.level()) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1572,6 +1978,9 @@
|
||||
@@ -1575,6 +1981,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
|
@ -940,7 +940,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1593,6 +2002,32 @@
|
||||
@@ -1596,6 +2005,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
|
@ -973,9 +973,9 @@
|
|||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -1762,4 +2197,146 @@
|
||||
this.hurtDir = (float) (MathHelper.atan2(d1, d0) * 57.2957763671875D - (double) this.getYRot());
|
||||
this.connection.send(new ClientboundHurtAnimationPacket(this));
|
||||
@@ -1805,4 +2240,146 @@
|
||||
}
|
||||
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
@ -985,10 +985,10 @@
|
|||
+ public long getPlayerTime() {
|
||||
+ if (this.relativeTime) {
|
||||
+ // Adds timeOffset to the current server time.
|
||||
+ return this.level.getDayTime() + this.timeOffset;
|
||||
+ return this.level().getDayTime() + this.timeOffset;
|
||||
+ } else {
|
||||
+ // Adds timeOffset to the beginning of this day.
|
||||
+ return this.level.getDayTime() - (this.level.getDayTime() % 24000) + this.timeOffset;
|
||||
+ return this.level().getDayTime() - (this.level().getDayTime() % 24000) + this.timeOffset;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
@ -1054,7 +1054,7 @@
|
|||
+
|
||||
+ public void resetPlayerWeather() {
|
||||
+ this.weather = null;
|
||||
+ this.setPlayerWeather(this.level.getLevelData().isRaining() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
+ this.setPlayerWeather(this.level().getLevelData().isRaining() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
|
@ -1080,7 +1080,7 @@
|
|||
+
|
||||
+ public void reset() {
|
||||
+ float exp = 0;
|
||||
+ boolean keepInventory = this.level.getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||
+ boolean keepInventory = this.level().getGameRules().getBoolean(GameRules.RULE_KEEPINVENTORY);
|
||||
+
|
||||
+ if (this.keepLevel) { // CraftBukkit - SPIGOT-6687: Only use keepLevel (was pre-set with RULE_KEEPINVENTORY value in PlayerDeathEvent)
|
||||
+ exp = this.experienceProgress;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -44,6 +44,12 @@
|
||||
@@ -42,6 +42,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -65,8 +71,12 @@
|
||||
@@ -63,8 +69,12 @@
|
||||
private boolean wasOnGround;
|
||||
@Nullable
|
||||
private List<DataWatcher.b<?>> trackedDataValues;
|
||||
|
@ -27,16 +27,16 @@
|
|||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -86,7 +96,7 @@
|
||||
@@ -84,7 +94,7 @@
|
||||
List<Entity> list = this.entity.getPassengers();
|
||||
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
|
||||
+ this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit
|
||||
this.changedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
@@ -105,18 +115,18 @@
|
||||
@@ -101,18 +111,18 @@
|
||||
if (entity instanceof EntityItemFrame) {
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
|||
|
||||
worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
|
||||
@@ -229,7 +239,27 @@
|
||||
@@ -225,7 +235,27 @@
|
||||
|
||||
++this.tickCount;
|
||||
if (this.entity.hurtMarked) {
|
||||
|
@ -72,7 +72,7 @@
|
|||
+ org.bukkit.util.Vector velocity = player.getVelocity();
|
||||
+
|
||||
+ PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
|
||||
+ this.entity.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.entity.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ cancelled = true;
|
||||
|
@ -88,18 +88,9 @@
|
|||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -252,14 +282,17 @@
|
||||
List<Packet<PacketListenerPlayOut>> list = new ArrayList();
|
||||
@@ -253,7 +283,10 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
- this.sendPairingData(list::add);
|
||||
+ this.sendPairingData(list::add, entityplayer); // CraftBukkit - add player
|
||||
entityplayer.connection.send(new ClientboundBundlePacket(list));
|
||||
this.entity.startSeenByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
- public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
+ public void sendPairingData(Consumer<Packet<PacketListenerPlayOut>> consumer, EntityPlayer entityplayer) { // CraftBukkit - add player
|
||||
public void sendPairingData(EntityPlayer entityplayer, Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
if (this.entity.isRemoved()) {
|
||||
- EntityTrackerEntry.LOGGER.warn("Fetching packet for removed entity {}", this.entity);
|
||||
+ // CraftBukkit start - Remove useless error spam, just return
|
||||
|
@ -109,7 +100,7 @@
|
|||
}
|
||||
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
|
||||
@@ -275,6 +308,12 @@
|
||||
@@ -269,6 +302,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
|
||||
|
||||
|
@ -122,7 +113,7 @@
|
|||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -306,8 +345,14 @@
|
||||
@@ -300,8 +339,14 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
|
@ -134,10 +125,10 @@
|
|||
+ consumer.accept(new PacketPlayOutEntityHeadRotation(this.entity, (byte) yHeadRotp));
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
EntityLiving entityliving = (EntityLiving) this.entity;
|
||||
Iterator iterator = entityliving.getActiveEffects().iterator();
|
||||
@@ -350,6 +395,11 @@
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutMount(this.entity));
|
||||
}
|
||||
@@ -333,6 +378,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -37,6 +37,10 @@
|
||||
@@ -36,6 +36,10 @@
|
||||
import net.minecraft.world.level.chunk.ProtoChunkExtension;
|
||||
import net.minecraft.world.level.lighting.LightEngine;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class PlayerChunk {
|
||||
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
|
||||
@@ -75,11 +79,11 @@
|
||||
@@ -71,11 +75,11 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
|
@ -24,15 +24,15 @@
|
|||
+ this.pendingFullStateConfirmation = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
||||
this.pos = chunkcoordintpair;
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = lightengine;
|
||||
@@ -92,6 +96,20 @@
|
||||
this.lightEngine = levellightengine;
|
||||
@@ -88,6 +92,20 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public Chunk getFullChunkNow() {
|
||||
+ // Note: We use the oldTicketLevel for isLoaded checks.
|
||||
+ if (!getFullChunkStatus(this.oldTicketLevel).isOrAfter(PlayerChunk.State.BORDER)) return null;
|
||||
+ if (!ChunkLevel.fullStatus(this.oldTicketLevel).isOrAfter(FullChunkStatus.FULL)) return null;
|
||||
+ return this.getFullChunkNowUnchecked();
|
||||
+ }
|
||||
+
|
||||
|
@ -46,7 +46,7 @@
|
|||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
|
||||
|
||||
@@ -117,17 +135,17 @@
|
||||
@@ -113,17 +131,17 @@
|
||||
@Nullable
|
||||
public Chunk getTickingChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getTickingChunkFuture();
|
||||
|
@ -68,7 +68,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -172,6 +190,7 @@
|
||||
@@ -168,6 +186,7 @@
|
||||
if (chunk != null) {
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
|
@ -76,12 +76,12 @@
|
|||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
|
||||
@@ -182,10 +201,10 @@
|
||||
@@ -178,10 +197,10 @@
|
||||
}
|
||||
|
||||
public void sectionLightChanged(EnumSkyBlock enumskyblock, int i) {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.FEATURES).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.FEATURES).getNow(null); // CraftBukkit - decompile error
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either != null) {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) either.left().orElse((Object) null);
|
||||
|
@ -89,7 +89,20 @@
|
|||
|
||||
if (ichunkaccess != null) {
|
||||
ichunkaccess.setUnsaved(true);
|
||||
@@ -372,7 +391,7 @@
|
||||
@@ -246,8 +265,11 @@
|
||||
PacketPlayOutMultiBlockChange packetplayoutmultiblockchange = new PacketPlayOutMultiBlockChange(sectionposition, shortset, chunksection);
|
||||
|
||||
this.broadcast(list, packetplayoutmultiblockchange);
|
||||
+ // CraftBukkit start
|
||||
+ List finalList = list;
|
||||
packetplayoutmultiblockchange.runUpdates((blockposition1, iblockdata1) -> {
|
||||
- this.broadcastBlockEntityIfNeeded(list, world, blockposition1, iblockdata1);
|
||||
+ this.broadcastBlockEntityIfNeeded(finalList, world, blockposition1, iblockdata1);
|
||||
+ // CraftBukkit end
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -372,7 +394,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((either) -> {
|
||||
either.ifLeft((chunk) -> {
|
||||
|
@ -98,13 +111,13 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
@@ -389,6 +408,30 @@
|
||||
boolean flag1 = this.ticketLevel <= PlayerChunkMap.MAX_CHUNK_DISTANCE;
|
||||
PlayerChunk.State playerchunk_state = getFullChunkStatus(this.oldTicketLevel);
|
||||
PlayerChunk.State playerchunk_state1 = getFullChunkStatus(this.ticketLevel);
|
||||
@@ -389,6 +411,30 @@
|
||||
boolean flag1 = ChunkLevel.isLoaded(this.ticketLevel);
|
||||
FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||
FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
||||
+ // CraftBukkit start
|
||||
+ // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
+ if (playerchunk_state.isOrAfter(PlayerChunk.State.BORDER) && !playerchunk_state1.isOrAfter(PlayerChunk.State.BORDER)) {
|
||||
+ if (fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && !fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ if (chunk != null) {
|
||||
|
@ -129,13 +142,13 @@
|
|||
|
||||
if (flag) {
|
||||
Either<IChunkAccess, PlayerChunk.Failure> either = Either.right(new PlayerChunk.Failure() {
|
||||
@@ -459,6 +502,26 @@
|
||||
@@ -459,6 +505,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 (!playerchunk_state.isOrAfter(PlayerChunk.State.BORDER) && playerchunk_state1.isOrAfter(PlayerChunk.State.BORDER)) {
|
||||
+ if (!fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ if (chunk != null) {
|
||||
|
@ -155,4 +168,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public static ChunkStatus getStatus(int i) {
|
||||
public boolean wasAccessibleSinceLastSave() {
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
+import org.bukkit.entity.Player;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.e {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -152,6 +158,27 @@
|
||||
@@ -151,6 +157,27 @@
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
int viewDistance;
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
|||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -170,6 +197,11 @@
|
||||
@@ -169,6 +196,11 @@
|
||||
this.storageName = path.getFileName().toString();
|
||||
this.level = worldserver;
|
||||
this.generator = chunkgenerator;
|
||||
|
@ -53,22 +53,22 @@
|
|||
IRegistryCustom iregistrycustom = worldserver.registryAccess();
|
||||
long j = worldserver.getSeed();
|
||||
|
||||
@@ -329,9 +361,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- final int l1 = 0;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ int cnt = 0;
|
||||
@@ -335,9 +367,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- final 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
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
- for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++l1) {
|
||||
+ for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++cnt) {
|
||||
+ final int l1 = cnt;
|
||||
+ // CraftBukkit end
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
|
||||
if (either == null) {
|
||||
@@ -536,7 +571,7 @@
|
||||
if (either == null) {
|
||||
@@ -543,7 +578,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
|
@ -77,7 +77,7 @@
|
|||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -625,9 +660,9 @@
|
||||
@@ -634,9 +669,9 @@
|
||||
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
|
||||
|
||||
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
|
||||
|
@ -89,7 +89,7 @@
|
|||
}
|
||||
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
|
||||
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
|
||||
@@ -733,7 +768,21 @@
|
||||
@@ -751,7 +786,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -112,7 +112,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -832,7 +881,7 @@
|
||||
@@ -852,7 +901,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -121,7 +121,7 @@
|
|||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -994,7 +1043,8 @@
|
||||
@@ -1014,7 +1063,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -1007,7 +1057,7 @@
|
||||
@@ -1027,7 +1077,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
try {
|
||||
|
@ -140,7 +140,7 @@
|
|||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -1023,12 +1073,14 @@
|
||||
@@ -1043,12 +1093,14 @@
|
||||
|
||||
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
|
||||
|
@ -158,7 +158,7 @@
|
|||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1482,7 +1534,7 @@
|
||||
@@ -1503,7 +1555,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
|
@ -167,7 +167,7 @@
|
|||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
|
||||
@@ -1541,6 +1593,11 @@
|
||||
@@ -1562,6 +1614,11 @@
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@
|
|||
+ }
|
||||
+ } else if (!iblockdata.isAir()) {
|
||||
iblockdata.attack(this.level, blockposition, this.player);
|
||||
f = iblockdata.getDestroyProgress(this.player, this.player.level, blockposition);
|
||||
f = iblockdata.getDestroyProgress(this.player, this.player.level(), blockposition);
|
||||
}
|
||||
|
||||
+ if (event.useItemInHand() == Event.Result.DENY) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -159,6 +159,26 @@
|
||||
@@ -162,6 +162,26 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -172,7 +192,7 @@
|
||||
@@ -175,7 +195,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
|
@ -36,11 +36,11 @@
|
|||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
@@ -196,12 +216,30 @@
|
||||
private final StructureCheck structureCheck;
|
||||
@@ -200,12 +220,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1) {
|
||||
- public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences) {
|
||||
- IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess();
|
||||
- Holder holder = worlddimension.type();
|
||||
+ // CraftBukkit start
|
||||
|
@ -59,7 +59,7 @@
|
|||
- Objects.requireNonNull(minecraftserver);
|
||||
- super(iworlddataserver, resourcekey, iregistrycustom_dimension, holder, minecraftserver::getProfiler, false, flag, i, minecraftserver.getMaxChainedNeighborUpdates());
|
||||
+ // Add env and gen to constructor, IWorldDataServer -> WorldDataServer
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, WorldDataServer iworlddataserver, ResourceKey<World> resourcekey, WorldDimension worlddimension, WorldLoadListener worldloadlistener, boolean flag, long i, List<MobSpawner> list, boolean flag1, @Nullable RandomSequences randomsequences, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider) {
|
||||
+ // IRegistryCustom.Dimension iregistrycustom_dimension = minecraftserver.registryAccess(); // CraftBukkit - decompile error
|
||||
+ // Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||
+
|
||||
|
@ -72,7 +72,7 @@
|
|||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -215,6 +253,22 @@
|
||||
@@ -219,6 +257,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
|
@ -95,7 +95,7 @@
|
|||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -246,15 +300,16 @@
|
||||
@@ -250,9 +304,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);
|
||||
|
@ -108,14 +108,15 @@
|
|||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
|
||||
this.sleepStatus = new SleepStatus();
|
||||
this.gameEventDispatcher = new GameEventDispatcher(this);
|
||||
@@ -266,6 +320,7 @@
|
||||
return new RandomSequences(l);
|
||||
}, "random_sequences");
|
||||
});
|
||||
+ this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
|
||||
}
|
||||
|
||||
public void setWeatherParameters(int i, int j, boolean flag, boolean flag1) {
|
||||
@@ -286,12 +341,20 @@
|
||||
/** @deprecated */
|
||||
@@ -304,12 +359,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
|
@ -139,7 +140,7 @@
|
|||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -317,7 +380,7 @@
|
||||
@@ -335,7 +398,7 @@
|
||||
this.runBlockEvents();
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
|
@ -148,7 +149,7 @@
|
|||
|
||||
if (flag) {
|
||||
this.resetEmptyTime();
|
||||
@@ -333,7 +396,7 @@
|
||||
@@ -351,7 +414,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
|
@ -157,7 +158,7 @@
|
|||
entity.discard();
|
||||
} else {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -405,7 +468,7 @@
|
||||
@@ -423,7 +486,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
|
@ -166,7 +167,7 @@
|
|||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -433,7 +496,7 @@
|
||||
@@ -451,7 +514,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
|
@ -175,7 +176,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -442,7 +505,7 @@
|
||||
@@ -460,7 +523,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
|
@ -184,7 +185,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -456,7 +519,7 @@
|
||||
@@ -475,7 +538,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition1)) {
|
||||
|
@ -193,8 +194,8 @@
|
|||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -471,10 +534,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, l + 1);
|
||||
@@ -489,10 +552,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, i1 + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition);
|
||||
- this.setBlockAndUpdate(blockposition, iblockdata1);
|
||||
|
@ -206,7 +207,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -670,6 +733,7 @@
|
||||
@@ -688,6 +751,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -214,13 +215,13 @@
|
|||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -688,14 +752,47 @@
|
||||
@@ -706,14 +770,47 @@
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
|
||||
}
|
||||
+ // */
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).tickWeather();
|
||||
+ }
|
||||
+ }
|
||||
|
@ -228,13 +229,13 @@
|
|||
+ if (flag != this.isRaining()) {
|
||||
+ // Only send weather packets to those affected
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).setPlayerWeather((!flag ? WeatherType.DOWNFALL : WeatherType.CLEAR), false);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ for (int idx = 0; idx < this.players.size(); ++idx) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level == this) {
|
||||
+ if (((EntityPlayer) this.players.get(idx)).level() == this) {
|
||||
+ ((EntityPlayer) this.players.get(idx)).updateWeather(this.oRainLevel, this.rainLevel, this.oThunderLevel, this.thunderLevel);
|
||||
+ }
|
||||
+ }
|
||||
|
@ -264,7 +265,7 @@
|
|||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -730,6 +827,7 @@
|
||||
@@ -748,6 +845,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
|
@ -272,7 +273,7 @@
|
|||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -753,6 +851,7 @@
|
||||
@@ -771,6 +869,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
|
@ -280,7 +281,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -777,6 +876,7 @@
|
||||
@@ -795,6 +894,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -288,7 +289,7 @@
|
|||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -794,11 +894,19 @@
|
||||
@@ -812,11 +912,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -309,7 +310,7 @@
|
|||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -863,15 +971,37 @@
|
||||
@@ -881,15 +989,37 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
@ -350,7 +351,7 @@
|
|||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -902,24 +1032,37 @@
|
||||
@@ -920,24 +1050,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
|
@ -392,7 +393,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -933,10 +1076,32 @@
|
||||
@@ -951,10 +1094,32 @@
|
||||
entityplayer.remove(entity_removalreason);
|
||||
}
|
||||
|
||||
|
@ -425,7 +426,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -945,6 +1110,12 @@
|
||||
@@ -963,6 +1128,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
|
@ -438,7 +439,7 @@
|
|||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1004,7 +1175,18 @@
|
||||
@@ -1022,7 +1193,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -458,7 +459,7 @@
|
|||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1066,6 +1248,11 @@
|
||||
@@ -1084,6 +1266,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) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false);
|
||||
|
@ -470,7 +471,7 @@
|
|||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1138,13 +1325,20 @@
|
||||
@@ -1156,13 +1343,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) {
|
||||
|
@ -493,7 +494,7 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1195,7 +1389,7 @@
|
||||
@@ -1213,7 +1407,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
|
@ -502,7 +503,7 @@
|
|||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1232,11 +1426,21 @@
|
||||
@@ -1250,11 +1444,21 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
|
@ -525,7 +526,7 @@
|
|||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
}
|
||||
|
||||
@@ -1534,6 +1738,11 @@
|
||||
@@ -1552,6 +1756,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
|
@ -537,7 +538,7 @@
|
|||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1553,12 +1762,12 @@
|
||||
@@ -1571,12 +1780,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
|
@ -552,7 +553,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1581,7 +1790,7 @@
|
||||
@@ -1599,7 +1808,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
|
@ -561,7 +562,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1590,7 +1799,7 @@
|
||||
@@ -1608,7 +1817,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
|
@ -570,7 +571,7 @@
|
|||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1601,17 +1810,33 @@
|
||||
@@ -1619,17 +1828,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
|
@ -606,7 +607,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1727,6 +1952,7 @@
|
||||
@@ -1753,6 +1978,7 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
|
@ -614,7 +615,7 @@
|
|||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1763,6 +1989,14 @@
|
||||
@@ -1789,6 +2015,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
+ private static final HashMap<InetAddress, Long> throttleTracker = new HashMap<InetAddress, Long>();
|
||||
+ private static int throttleCounter = 0;
|
||||
+ // CraftBukkit end
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.literal("Ignoring status request");
|
||||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.translatable("disconnect.ignoring_status_request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -24,9 +33,44 @@
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -184,6 +184,69 @@
|
||||
@@ -185,6 +185,69 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -70,7 +70,7 @@
|
|||
public class PlayerConnection implements ServerPlayerConnection, TickablePacketListener, PacketListenerPlayIn {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -200,7 +263,9 @@
|
||||
@@ -201,7 +264,9 @@
|
||||
private long keepAliveTime;
|
||||
private boolean keepAlivePending;
|
||||
private long keepAliveChallenge;
|
||||
|
@ -81,7 +81,7 @@
|
|||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -246,8 +311,31 @@
|
||||
@@ -247,8 +312,31 @@
|
||||
this.keepAliveTime = SystemUtils.getMillis();
|
||||
entityplayer.getTextFilter().join();
|
||||
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
|
||||
|
@ -114,7 +114,7 @@
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -302,7 +390,7 @@
|
||||
@@ -303,7 +391,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
|
@ -123,7 +123,7 @@
|
|||
if (this.keepAlivePending) {
|
||||
this.disconnect(IChatBaseComponent.translatable("disconnect.timeout"));
|
||||
} else {
|
||||
@@ -314,15 +402,21 @@
|
||||
@@ -315,15 +403,21 @@
|
||||
}
|
||||
|
||||
this.server.getProfiler().pop();
|
||||
|
@ -140,12 +140,12 @@
|
|||
--this.dropSpamTickCount;
|
||||
}
|
||||
|
||||
if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && SystemUtils.getMillis() - this.player.getLastActionTime() > (long) (this.server.getPlayerIdleTimeout() * 1000 * 60)) {
|
||||
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"));
|
||||
}
|
||||
|
||||
@@ -346,16 +440,67 @@
|
||||
@@ -347,16 +441,67 @@
|
||||
return this.server.isSingleplayerOwner(this.player.getGameProfile());
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@
|
|||
}
|
||||
|
||||
private <T, R> CompletableFuture<R> filterTextPacket(T t0, BiFunction<ITextFilter, T, CompletableFuture<R>> bifunction) {
|
||||
@@ -419,7 +564,34 @@
|
||||
@@ -420,7 +565,34 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
|
@ -250,7 +250,7 @@
|
|||
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
|
||||
this.connection.send(new PacketPlayOutVehicleMove(entity));
|
||||
return;
|
||||
@@ -451,14 +623,72 @@
|
||||
@@ -460,14 +632,72 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
|
@ -320,30 +320,30 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
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);
|
||||
@@ -492,6 +722,7 @@
|
||||
@@ -501,6 +731,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
+ this.player.getLevel().getChunkSource().move(this.player); // CraftBukkit
|
||||
+ this.player.serverLevel().getChunkSource().move(this.player); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
@@ -499,7 +730,7 @@
|
||||
@@ -508,7 +739,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
|
||||
- Optional optional = this.server.getRecipeManager().byKey(packetplayinrecipedisplayed.getRecipe());
|
||||
+ Optional<? extends IRecipe<?>> optional = this.server.getRecipeManager().byKey(packetplayinrecipedisplayed.getRecipe()); // CraftBukkit - decompile error
|
||||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -529,6 +760,12 @@
|
||||
@@ -538,6 +769,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
+ // CraftBukkit start
|
||||
+ if (chatSpamTickCount.addAndGet(1) > 500 && !this.server.getPlayerList().isOp(this.player.getGameProfile())) {
|
||||
+ this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
|
@ -353,7 +353,7 @@
|
|||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -538,6 +775,7 @@
|
||||
@@ -547,6 +784,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
|
@ -361,7 +361,7 @@
|
|||
this.connection.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -787,6 +1025,13 @@
|
||||
@@ -792,6 +1030,13 @@
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
|
@ -375,7 +375,7 @@
|
|||
|
||||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
@@ -801,6 +1046,13 @@
|
||||
@@ -806,6 +1051,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
|
@ -389,7 +389,7 @@
|
|||
int i = packetplayinbedit.getSlot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -809,7 +1061,7 @@
|
||||
@@ -814,7 +1066,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
|
@ -398,7 +398,7 @@
|
|||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -827,7 +1079,7 @@
|
||||
@@ -832,7 +1084,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
|
@ -407,7 +407,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -852,16 +1104,16 @@
|
||||
@@ -857,16 +1109,16 @@
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
|
||||
|
@ -428,7 +428,7 @@
|
|||
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
|
||||
});
|
||||
|
||||
@@ -887,6 +1139,7 @@
|
||||
@@ -892,6 +1144,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
|
@ -436,16 +436,16 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -923,7 +1176,7 @@
|
||||
@@ -928,7 +1181,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
- if (!this.player.wonGame) {
|
||||
+ if (!this.player.wonGame && !this.player.isImmobile()) { // CraftBukkit
|
||||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -933,7 +1186,7 @@
|
||||
@@ -938,7 +1191,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
|
@ -454,10 +454,10 @@
|
|||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
|
||||
@@ -945,7 +1198,15 @@
|
||||
@@ -950,7 +1203,15 @@
|
||||
if (this.player.isPassenger()) {
|
||||
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
+ this.allowedPlayerTicks = 20; // CraftBukkit
|
||||
} else {
|
||||
+ // CraftBukkit - Make sure the move is valid but then reset it for plugins to modify
|
||||
|
@ -470,7 +470,7 @@
|
|||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -965,15 +1226,33 @@
|
||||
@@ -969,15 +1230,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
|
@ -485,7 +485,7 @@
|
|||
i = 1;
|
||||
}
|
||||
|
||||
+ if (packetplayinflying.hasRot || d11 > 0) {
|
||||
+ if (packetplayinflying.hasRot || d10 > 0) {
|
||||
+ allowedPlayerTicks -= 1;
|
||||
+ } else {
|
||||
+ allowedPlayerTicks = 20;
|
||||
|
@ -497,35 +497,32 @@
|
|||
+ speed = player.getAbilities().walkingSpeed * 10f;
|
||||
+ }
|
||||
+
|
||||
if (!this.player.isChangingDimension() && (!this.player.getLevel().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
if (!this.player.isChangingDimension() && (!this.player.level().getGameRules().getBoolean(GameRules.RULE_DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isFallFlying())) {
|
||||
float f2 = this.player.isFallFlying() ? 300.0F : 100.0F;
|
||||
|
||||
- if (d11 - d10 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d11 - d10 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
- if (d10 - d9 > (double) (f2 * (float) i) && !this.isSingleplayerOwner()) {
|
||||
+ if (d10 - d9 > Math.max(f2, Math.pow((double) (10.0F * (float) i * speed), 2)) && !this.isSingleplayerOwner()) {
|
||||
+ // CraftBukkit end
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d7, d8, d9});
|
||||
PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8});
|
||||
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
|
||||
return;
|
||||
@@ -994,6 +1273,7 @@
|
||||
@@ -998,6 +1277,7 @@
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9));
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
+ this.player.onGround = packetplayinflying.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
|
||||
double d12 = d8;
|
||||
double d11 = d7;
|
||||
|
||||
d7 = d0 - this.player.getX();
|
||||
@@ -1013,9 +1293,72 @@
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -1016,9 +1296,67 @@
|
||||
}
|
||||
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb))) {
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
- this.teleport(d3, d4, d5, f, f1);
|
||||
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packetplayinflying.isOnGround());
|
||||
} else {
|
||||
+ // CraftBukkit start - fire PlayerMoveEvent
|
||||
+ // Rest to old location first
|
||||
+ this.player.absMoveTo(prevX, prevY, prevZ, prevYaw, prevPitch);
|
||||
+
|
||||
+ Player player = this.getCraftPlayer();
|
||||
+ Location from = new Location(player.getWorld(), lastPosX, lastPosY, lastPosZ, lastYaw, lastPitch); // Get the Players previous Event location.
|
||||
+ Location to = player.getLocation().clone(); // Start off the To location as the Players current location.
|
||||
|
@ -582,13 +579,11 @@
|
|||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ this.player.absMoveTo(d0, d1, d2, f, f1); // Copied from above
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.clientIsFloating = d12 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.getLevel().getChunkSource().move(this.player);
|
||||
this.player.doCheckFallDamage(this.player.getY() - d6, packetplayinflying.isOnGround());
|
||||
@@ -1054,11 +1397,68 @@
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.clientIsFloating = d11 >= -0.03125D && !flag1 && this.player.gameMode.getGameModeForPlayer() != EnumGamemode.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isFallFlying() && !this.player.isAutoSpinAttack() && this.noBlocksAround(this.player);
|
||||
this.player.serverLevel().getChunkSource().move(this.player);
|
||||
@@ -1059,11 +1397,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -658,7 +653,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;
|
||||
@@ -1070,6 +1470,14 @@
|
||||
@@ -1075,6 +1470,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
|
@ -673,15 +668,15 @@
|
|||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.absMoveTo(d0, d1, d2, f, f1);
|
||||
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
|
||||
@@ -1078,6 +1486,7 @@
|
||||
@@ -1083,6 +1486,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1088,14 +1497,46 @@
|
||||
@@ -1093,14 +1497,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
|
@ -730,15 +725,15 @@
|
|||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1133,6 +1574,7 @@
|
||||
@@ -1138,6 +1574,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1156,6 +1598,7 @@
|
||||
@@ -1161,6 +1598,7 @@
|
||||
|
||||
if (blockposition.getY() < i) {
|
||||
if (this.awaitingPositionFromClient == null && this.player.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.mayInteract(this.player, blockposition)) {
|
||||
|
@ -746,15 +741,15 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1184,6 +1627,7 @@
|
||||
@@ -1189,6 +1627,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1191,6 +1635,49 @@
|
||||
@@ -1196,6 +1635,49 @@
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
|
@ -775,7 +770,7 @@
|
|||
+ float f8 = f3 * f5;
|
||||
+ double d3 = player.gameMode.getGameModeForPlayer()== EnumGamemode.CREATIVE ? 5.0D : 4.5D;
|
||||
+ Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3);
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level.clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+ MovingObjectPosition movingobjectposition = this.player.level().clip(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player));
|
||||
+
|
||||
+ boolean cancelled;
|
||||
+ if (movingobjectposition == null || movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.BLOCK) {
|
||||
|
@ -783,7 +778,7 @@
|
|||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ } else {
|
||||
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.tagMatches(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameTags(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand);
|
||||
|
@ -804,7 +799,7 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1211,7 +1698,7 @@
|
||||
@@ -1216,7 +1698,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -813,7 +808,7 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1226,6 +1713,7 @@
|
||||
@@ -1231,6 +1713,7 @@
|
||||
PlayerConnection.LOGGER.info("Disconnecting {} due to resource pack rejection", this.player.getName());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
|
@ -821,7 +816,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1247,12 +1735,27 @@
|
||||
@@ -1252,12 +1735,27 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
|
@ -850,7 +845,7 @@
|
|||
this.player.getTextFilter().leave();
|
||||
if (this.isSingleplayerOwner()) {
|
||||
PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out");
|
||||
@@ -1275,6 +1778,15 @@
|
||||
@@ -1280,6 +1778,15 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
|
@ -866,10 +861,10 @@
|
|||
try {
|
||||
this.connection.send(packet, packetsendlistener);
|
||||
} catch (Throwable throwable) {
|
||||
@@ -1291,7 +1803,16 @@
|
||||
@@ -1296,7 +1803,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
if (packetplayinhelditemslot.getSlot() >= 0 && packetplayinhelditemslot.getSlot() < PlayerInventory.getSelectionSize()) {
|
||||
+ PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getCraftPlayer(), this.player.getInventory().selected, packetplayinhelditemslot.getSlot());
|
||||
|
@ -883,7 +878,7 @@
|
|||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1300,18 +1821,25 @@
|
||||
@@ -1305,18 +1821,25 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -910,7 +905,7 @@
|
|||
PlayerChatMessage playerchatmessage;
|
||||
|
||||
try {
|
||||
@@ -1329,9 +1857,9 @@
|
||||
@@ -1334,9 +1857,9 @@
|
||||
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent((IChatBaseComponent) completablefuture1.join()).filter(((FilteredText) completablefuture.join()).mask());
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
|
@ -922,7 +917,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1346,6 +1874,12 @@
|
||||
@@ -1351,6 +1874,12 @@
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
|
@ -935,7 +930,7 @@
|
|||
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam();
|
||||
});
|
||||
@@ -1355,12 +1889,25 @@
|
||||
@@ -1360,12 +1889,25 @@
|
||||
}
|
||||
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
|
||||
|
@ -963,7 +958,7 @@
|
|||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1368,10 +1915,10 @@
|
||||
@@ -1373,10 +1915,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
|
@ -976,7 +971,7 @@
|
|||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1412,7 +1959,7 @@
|
||||
@@ -1417,7 +1959,7 @@
|
||||
} else {
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
|
||||
|
||||
|
@ -985,7 +980,7 @@
|
|||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1460,6 +2007,122 @@
|
||||
@@ -1465,6 +2007,122 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1108,7 +1103,7 @@
|
|||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1467,13 +2130,33 @@
|
||||
@@ -1472,13 +2130,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
|
@ -1145,10 +1140,10 @@
|
|||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1495,13 +2178,59 @@
|
||||
@@ -1500,13 +2178,59 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
+ // CraftBukkit start - Raytrace to look for 'rogue armswings'
|
||||
|
@ -1157,11 +1152,11 @@
|
|||
+ double d0 = this.player.getX();
|
||||
+ double d1 = this.player.getY() + (double) this.player.getEyeHeight();
|
||||
+ double d2 = this.player.getZ();
|
||||
+ Location origin = new Location(this.player.level.getWorld(), d0, d1, d2, f2, f1);
|
||||
+ Location origin = new Location(this.player.level().getWorld(), d0, d1, d2, f2, f1);
|
||||
+
|
||||
+ double d3 = player.gameMode.getGameModeForPlayer() == EnumGamemode.CREATIVE ? 5.0D : 4.5D;
|
||||
+ // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
|
||||
+ org.bukkit.util.RayTraceResult result = this.player.level.getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
|
||||
+ org.bukkit.util.RayTraceResult result = this.player.level().getWorld().rayTrace(origin, origin.getDirection(), d3, org.bukkit.FluidCollisionMode.NEVER, false, 0.1, entity -> entity != this.player.getBukkitEntity() && this.player.getBukkitEntity().canSee(entity));
|
||||
+
|
||||
+ if (result == null) {
|
||||
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.getInventory().getSelected(), EnumHand.MAIN_HAND);
|
||||
|
@ -1178,7 +1173,7 @@
|
|||
|
||||
@Override
|
||||
public void handlePlayerCommand(PacketPlayInEntityAction packetplayinentityaction) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinentityaction, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinentityaction, this, this.player.serverLevel());
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.isRemoved()) return;
|
||||
+ switch (packetplayinentityaction.getAction()) {
|
||||
|
@ -1205,7 +1200,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
IJumpable ijumpable;
|
||||
@@ -1583,6 +2312,12 @@
|
||||
@@ -1588,6 +2312,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
|
@ -1215,18 +1210,18 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level.registryAccess())));
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1598,6 +2333,7 @@
|
||||
@@ -1603,6 +2333,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
final WorldServer worldserver = this.player.getLevel();
|
||||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1612,13 +2348,51 @@
|
||||
@@ -1617,13 +2348,51 @@
|
||||
|
||||
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
|
@ -1279,7 +1274,7 @@
|
|||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1631,23 +2405,29 @@
|
||||
@@ -1636,23 +2405,29 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
|
@ -1312,7 +1307,7 @@
|
|||
}
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
@@ -1670,14 +2450,14 @@
|
||||
@@ -1675,14 +2450,14 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
|
@ -1328,11 +1323,11 @@
|
|||
+ this.player = this.server.getPlayerList().respawn(this.player, false, RespawnReason.DEATH);
|
||||
if (this.server.isHardcore()) {
|
||||
this.player.setGameMode(EnumGamemode.SPECTATOR);
|
||||
((GameRules.GameRuleBoolean) this.player.getLevel().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
@@ -1693,15 +2473,21 @@
|
||||
((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
|
||||
@@ -1698,15 +2473,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
+
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
+ CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
|
||||
|
@ -1342,7 +1337,7 @@
|
|||
|
||||
@Override
|
||||
public void handleContainerClick(PacketPlayInWindowClick packetplayinwindowclick) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinwindowclick, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinwindowclick, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
- if (this.player.containerMenu.containerId == packetplayinwindowclick.getContainerId()) {
|
||||
|
@ -1353,7 +1348,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);
|
||||
@@ -1714,7 +2500,284 @@
|
||||
@@ -1719,7 +2500,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
|
@ -1400,7 +1395,7 @@
|
|||
+ if (cursor.isEmpty()) {
|
||||
+ action = packetplayinwindowclick.getButtonNum() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
|
||||
+ } else if (slot.mayPlace(cursor)) {
|
||||
+ if (clickedItem.sameItem(cursor) && ItemStack.tagMatches(clickedItem, cursor)) {
|
||||
+ if (ItemStack.isSameItemSameTags(clickedItem, cursor)) {
|
||||
+ int toPlace = packetplayinwindowclick.getButtonNum() == 0 ? cursor.getCount() : 1;
|
||||
+ toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.getCount());
|
||||
+ toPlace = Math.min(toPlace, slot.container.getMaxStackSize() - clickedItem.getCount());
|
||||
|
@ -1416,7 +1411,7 @@
|
|||
+ } else if (cursor.getCount() <= slot.getMaxStackSize()) {
|
||||
+ action = InventoryAction.SWAP_WITH_CURSOR;
|
||||
+ }
|
||||
+ } else if (cursor.getItem() == clickedItem.getItem() && ItemStack.tagMatches(cursor, clickedItem)) {
|
||||
+ } else if (ItemStack.isSameItemSameTags(cursor, clickedItem)) {
|
||||
+ if (clickedItem.getCount() >= 0) {
|
||||
+ if (clickedItem.getCount() + cursor.getCount() <= cursor.getMaxStackSize()) {
|
||||
+ // As of 1.5, this is result slots only
|
||||
|
@ -1639,15 +1634,15 @@
|
|||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1754,6 +2817,7 @@
|
||||
@@ -1759,6 +2817,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1796,6 +2860,43 @@
|
||||
@@ -1801,6 +2860,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
|
@ -1691,66 +1686,26 @@
|
|||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
|
||||
@@ -1818,6 +2919,7 @@
|
||||
@@ -1823,6 +2919,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.getLevel();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1834,18 +2936,37 @@
|
||||
|
||||
if (!tileentitysign.isEditable() || !this.player.getUUID().equals(tileentitysign.getPlayerWhoMayEdit())) {
|
||||
PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getName().getString());
|
||||
+ this.send(tileentity.getUpdatePacket()); // CraftBukkit
|
||||
return;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ Player player = this.player.getBukkitEntity();
|
||||
+ int x = packetplayinupdatesign.getPos().getX();
|
||||
+ int y = packetplayinupdatesign.getPos().getY();
|
||||
+ int z = packetplayinupdatesign.getPos().getZ();
|
||||
+ String[] lines = new String[4];
|
||||
+
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
FilteredText filteredtext = (FilteredText) list.get(i);
|
||||
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- tileentitysign.setMessage(i, IChatBaseComponent.literal(filteredtext.filteredOrEmpty()));
|
||||
+ lines[i] = EnumChatFormat.stripFormatting(filteredtext.filteredOrEmpty());
|
||||
} else {
|
||||
- tileentitysign.setMessage(i, IChatBaseComponent.literal(filteredtext.raw()), IChatBaseComponent.literal(filteredtext.filteredOrEmpty()));
|
||||
+ lines[i] = EnumChatFormat.stripFormatting(filteredtext.raw());
|
||||
+ }
|
||||
+ }
|
||||
+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.player.getBukkitEntity(), lines);
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ IChatBaseComponent[] components = org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines());
|
||||
+ for (int i = 0; i < components.length; i++) {
|
||||
+ tileentitysign.setMessage(i, components[i]);
|
||||
}
|
||||
+ tileentitysign.isEditable = false;
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
|
||||
tileentitysign.setChanged();
|
||||
worldserver.sendBlockUpdated(blockposition, iblockdata, iblockdata, 3);
|
||||
@@ -1855,6 +2976,7 @@
|
||||
@@ -1843,6 +2940,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(PacketPlayInKeepAlive packetplayinkeepalive) {
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinkeepalive, this, this.player.getLevel()); // CraftBukkit
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinkeepalive, this, this.player.serverLevel()); // CraftBukkit
|
||||
if (this.keepAlivePending && packetplayinkeepalive.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -1869,7 +2991,17 @@
|
||||
@@ -1857,7 +2955,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.getLevel());
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
- this.player.getAbilities().flying = packetplayinabilities.isFlying() && this.player.getAbilities().mayfly;
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player.getAbilities().mayfly && this.player.getAbilities().flying != packetplayinabilities.isFlying()) {
|
||||
|
@ -1766,7 +1721,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1878,8 +3010,50 @@
|
||||
@@ -1866,8 +2974,50 @@
|
||||
this.player.updateOptions(packetplayinsettings);
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1733,7 @@
|
|||
+
|
||||
+ @Override
|
||||
+ public void handleCustomPayload(PacketPlayInCustomPayload packetplayincustompayload) {
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayincustompayload, this, this.player.getLevel());
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(packetplayincustompayload, this, this.player.serverLevel());
|
||||
+ if (packetplayincustompayload.identifier.equals(CUSTOM_REGISTER)) {
|
||||
+ try {
|
||||
+ String channels = packetplayincustompayload.data.toString(com.google.common.base.Charsets.UTF_8);
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
--- a/net/minecraft/server/packs/repository/ResourcePackLoader.java
|
||||
+++ b/net/minecraft/server/packs/repository/ResourcePackLoader.java
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
private final String id;
|
||||
- private final ResourcePackLoader.c resources;
|
||||
+ public final ResourcePackLoader.c resources; // PAIL private -> public
|
||||
private final IChatBaseComponent title;
|
||||
private final IChatBaseComponent description;
|
||||
private final EnumResourcePackVersion compatibility;
|
||||
@@ -59,7 +59,7 @@
|
||||
try {
|
||||
IResourcePack iresourcepack = resourcepackloader_c.open(s);
|
||||
|
||||
- ResourcePackLoader.a resourcepackloader_a;
|
||||
+ ResourcePackLoader.a resourcepackloader_a = null; // CraftBukkit - decompile fix
|
||||
label53:
|
||||
{
|
||||
FeatureFlagsMetadataSection featureflagsmetadatasection;
|
||||
@@ -93,7 +93,7 @@
|
||||
iresourcepack.close();
|
||||
}
|
||||
|
||||
- return featureflagsmetadatasection;
|
||||
+ return resourcepackloader_a; // CraftBukkit - decompile fix
|
||||
}
|
||||
|
||||
if (iresourcepack != null) {
|
|
@ -73,8 +73,8 @@
|
|||
this.server = minecraftserver;
|
||||
this.registries = layeredregistryaccess;
|
||||
this.synchronizedRegistries = (new IRegistryCustom.c(RegistrySynchronization.networkedRegistries(layeredregistryaccess))).freeze();
|
||||
@@ -161,9 +193,15 @@
|
||||
usercache.add(gameprofile);
|
||||
@@ -168,9 +200,15 @@
|
||||
|
||||
NBTTagCompound nbttagcompound = this.load(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
+ // CraftBukkit start - Better rename detection
|
||||
|
@ -90,7 +90,7 @@
|
|||
Logger logger = PlayerList.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -190,7 +228,8 @@
|
||||
@@ -197,7 +235,8 @@
|
||||
s1 = networkmanager.getRemoteAddress().toString();
|
||||
}
|
||||
|
||||
|
@ -100,15 +100,15 @@
|
|||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer.loadGameTypes(nbttagcompound);
|
||||
@@ -200,6 +239,7 @@
|
||||
@@ -207,6 +246,7 @@
|
||||
boolean flag1 = gamerules.getBoolean(GameRules.RULE_REDUCEDDEBUGINFO);
|
||||
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation()));
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), entityplayer.gameMode.getGameModeForPlayer(), entityplayer.gameMode.getPreviousGameModeForPlayer(), this.server.levelKeys(), this.synchronizedRegistries, worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, worldserver1.isDebug(), worldserver1.isFlat(), entityplayer.getLastDeathLocation(), entityplayer.getPortalCooldown()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.send(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(worldserver1.enabledFeatures())));
|
||||
playerconnection.send(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.BRAND, (new PacketDataSerializer(Unpooled.buffer())).writeUtf(this.getServer().getServerModName())));
|
||||
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
@@ -219,8 +259,10 @@
|
||||
@@ -226,8 +266,10 @@
|
||||
} else {
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
|
||||
}
|
||||
|
@ -120,7 +120,7 @@
|
|||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
ServerPing serverping = this.server.getStatus();
|
||||
|
||||
@@ -231,10 +273,61 @@
|
||||
@@ -238,10 +280,61 @@
|
||||
entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players));
|
||||
this.players.add(entityplayer);
|
||||
this.playersByUUID.put(entityplayer.getUUID(), entityplayer);
|
||||
|
@ -175,17 +175,17 @@
|
|||
- this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+
|
||||
+ // CraftBukkit start - Only add if the player wasn't moved in the event
|
||||
+ if (entityplayer.level == worldserver1 && !worldserver1.players().contains(entityplayer)) {
|
||||
+ if (entityplayer.level() == worldserver1 && !worldserver1.players().contains(entityplayer)) {
|
||||
+ worldserver1.addNewPlayer(entityplayer);
|
||||
+ this.server.getCustomBossEvents().onPlayerConnect(entityplayer);
|
||||
+ }
|
||||
+
|
||||
+ worldserver1 = entityplayer.getLevel(); // CraftBukkit - Update in case join event changed it
|
||||
+ worldserver1 = entityplayer.serverLevel(); // CraftBukkit - Update in case join event changed it
|
||||
+ // CraftBukkit end
|
||||
this.server.getServerResourcePack().ifPresent((minecraftserver_serverresourcepackinfo) -> {
|
||||
entityplayer.sendTexturePack(minecraftserver_serverresourcepackinfo.url(), minecraftserver_serverresourcepackinfo.hash(), minecraftserver_serverresourcepackinfo.isRequired(), minecraftserver_serverresourcepackinfo.prompt());
|
||||
});
|
||||
@@ -248,8 +341,11 @@
|
||||
@@ -255,8 +348,11 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
|
@ -199,7 +199,7 @@
|
|||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -292,6 +388,8 @@
|
||||
@@ -299,6 +395,8 @@
|
||||
}
|
||||
|
||||
entityplayer.initInventoryMenu();
|
||||
|
@ -208,7 +208,7 @@
|
|||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -324,30 +422,31 @@
|
||||
@@ -331,30 +429,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
|
@ -245,7 +245,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -375,14 +474,15 @@
|
||||
@@ -382,14 +481,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
|
@ -263,13 +263,13 @@
|
|||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -390,10 +490,24 @@
|
||||
@@ -397,10 +497,24 @@
|
||||
|
||||
}
|
||||
|
||||
- public void remove(EntityPlayer entityplayer) {
|
||||
+ public String remove(EntityPlayer entityplayer) { // CraftBukkit - return string
|
||||
WorldServer worldserver = entityplayer.getLevel();
|
||||
WorldServer worldserver = entityplayer.serverLevel();
|
||||
|
||||
entityplayer.awardStat(StatisticList.LEAVE_GAME);
|
||||
+
|
||||
|
@ -289,7 +289,7 @@
|
|||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -417,18 +531,66 @@
|
||||
@@ -424,18 +538,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
|
@ -362,7 +362,7 @@
|
|||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
|
||||
@@ -436,10 +598,12 @@
|
||||
@@ -443,10 +605,12 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@
|
|||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
|
||||
@@ -447,13 +611,25 @@
|
||||
@@ -454,13 +618,25 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -407,7 +407,7 @@
|
|||
UUID uuid = UUIDUtil.getOrCreatePlayerUUID(gameprofile);
|
||||
List<EntityPlayer> list = Lists.newArrayList();
|
||||
|
||||
@@ -480,14 +656,24 @@
|
||||
@@ -487,14 +663,24 @@
|
||||
}
|
||||
|
||||
return new EntityPlayer(this.server, this.server.overworld(), gameprofile);
|
||||
|
@ -425,7 +425,7 @@
|
|||
+ public EntityPlayer respawn(EntityPlayer entityplayer, WorldServer worldserver, boolean flag, Location location, boolean avoidSuffocation, RespawnReason reason) {
|
||||
+ entityplayer.stopRiding(); // CraftBukkit
|
||||
this.players.remove(entityplayer);
|
||||
entityplayer.getLevel().removePlayerImmediately(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
entityplayer.serverLevel().removePlayerImmediately(entityplayer, Entity.RemovalReason.DISCARDED);
|
||||
BlockPosition blockposition = entityplayer.getRespawnPosition();
|
||||
float f = entityplayer.getRespawnAngle();
|
||||
boolean flag1 = entityplayer.isRespawnForced();
|
||||
|
@ -433,7 +433,7 @@
|
|||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -499,6 +685,11 @@
|
||||
@@ -506,6 +692,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile());
|
||||
|
@ -445,7 +445,7 @@
|
|||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -514,50 +705,112 @@
|
||||
@@ -521,50 +712,112 @@
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
|
@ -526,16 +526,16 @@
|
|||
}
|
||||
|
||||
int i = flag ? 1 : 0;
|
||||
- WorldData worlddata = entityplayer1.level.getLevelData();
|
||||
- WorldData worlddata = entityplayer1.level().getLevelData();
|
||||
+ // CraftBukkit start
|
||||
+ WorldData worlddata = worldserver1.getLevelData();
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
+ entityplayer1.connection.send(new PacketPlayOutRespawn(worldserver1.dimensionTypeId(), worldserver1.dimension(), BiomeManager.obfuscateSeed(worldserver1.getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), worldserver1.isDebug(), worldserver1.isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
+ entityplayer1.spawnIn(worldserver1);
|
||||
+ entityplayer1.unsetRemoved();
|
||||
+ entityplayer1.connection.teleport(CraftLocation.toBukkit(entityplayer1.position(), worldserver1.getWorld(), entityplayer1.getYRot(), entityplayer1.getXRot()));
|
||||
+ entityplayer1.setShiftKeyDown(false);
|
||||
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level.dimensionTypeId(), entityplayer1.level.dimension(), BiomeManager.obfuscateSeed(entityplayer1.getLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.getLevel().isDebug(), entityplayer1.getLevel().isFlat(), (byte) i, entityplayer1.getLastDeathLocation()));
|
||||
- entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.level().dimensionTypeId(), entityplayer1.level().dimension(), BiomeManager.obfuscateSeed(entityplayer1.serverLevel().getSeed()), entityplayer1.gameMode.getGameModeForPlayer(), entityplayer1.gameMode.getPreviousGameModeForPlayer(), entityplayer1.level().isDebug(), entityplayer1.serverLevel().isFlat(), (byte) i, entityplayer1.getLastDeathLocation(), entityplayer1.getPortalCooldown()));
|
||||
- entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
+ // entityplayer1.connection.teleport(entityplayer1.getX(), entityplayer1.getY(), entityplayer1.getZ(), entityplayer1.getYRot(), entityplayer1.getXRot());
|
||||
entityplayer1.connection.send(new PacketPlayOutSpawnPosition(worldserver1.getSharedSpawnPos(), worldserver1.getSharedSpawnAngle()));
|
||||
|
@ -581,7 +581,7 @@
|
|||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -570,7 +823,18 @@
|
||||
@@ -577,7 +830,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
|
@ -601,7 +601,7 @@
|
|||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -587,6 +851,25 @@
|
||||
@@ -594,6 +858,25 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@
|
|||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -665,7 +948,7 @@
|
||||
@@ -672,7 +955,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
|
@ -636,7 +636,7 @@
|
|||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -689,6 +972,7 @@
|
||||
@@ -696,6 +979,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
|
@ -644,7 +644,7 @@
|
|||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -721,6 +1005,12 @@
|
||||
@@ -728,6 +1012,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
|
@ -654,15 +654,15 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (entityplayer != entityhuman && entityplayer.level.dimension() == resourcekey) {
|
||||
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -760,23 +1050,35 @@
|
||||
@@ -767,23 +1057,35 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
- WorldBorder worldborder = this.server.overworld().getWorldBorder();
|
||||
+ WorldBorder worldborder = entityplayer.level.getWorldBorder(); // CraftBukkit
|
||||
+ WorldBorder worldborder = entityplayer.level().getWorldBorder(); // CraftBukkit
|
||||
|
||||
entityplayer.connection.send(new ClientboundInitializeBorderPacket(worldborder));
|
||||
entityplayer.connection.send(new PacketPlayOutUpdateTime(worldserver.getGameTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)));
|
||||
|
@ -690,15 +690,15 @@
|
|||
+ entityplayer.getEntityData().refresh(entityplayer); // CraftBukkkit - SPIGOT-7218: sync metadata
|
||||
entityplayer.connection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ int i = entityplayer.level().getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
+ entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, (byte) i));
|
||||
+ float immediateRespawn = entityplayer.level.getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ float immediateRespawn = entityplayer.level().getGameRules().getBoolean(GameRules.RULE_DO_IMMEDIATE_RESPAWN) ? 1.0F: 0.0F;
|
||||
+ entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.IMMEDIATE_RESPAWN, immediateRespawn));
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -832,12 +1134,22 @@
|
||||
@@ -839,12 +1141,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
|
@ -723,7 +723,7 @@
|
|||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -895,16 +1207,23 @@
|
||||
@@ -902,16 +1214,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
|
@ -751,7 +751,7 @@
|
|||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -913,7 +1232,7 @@
|
||||
@@ -920,7 +1239,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
|
@ -760,7 +760,7 @@
|
|||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -921,13 +1240,13 @@
|
||||
@@ -928,13 +1247,13 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
|
@ -776,7 +776,7 @@
|
|||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -978,13 +1297,20 @@
|
||||
@@ -985,13 +1304,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
this.add(minecraftkey);
|
||||
this.addHighlight(minecraftkey);
|
||||
list.add(minecraftkey);
|
||||
@@ -70,6 +72,7 @@
|
||||
@@ -73,6 +75,7 @@
|
||||
}
|
||||
|
||||
private void sendRecipes(PacketPlayOutRecipes.Action packetplayoutrecipes_action, EntityPlayer entityplayer, List<MinecraftKey> list) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/net/minecraft/util/SpawnUtil.java
|
||||
@@ -17,6 +17,12 @@
|
||||
@@ -21,6 +21,12 @@
|
||||
public SpawnUtil() {}
|
||||
|
||||
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EnumMobSpawn enummobspawn, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a) {
|
||||
|
@ -13,7 +13,7 @@
|
|||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
for (int l = 0; l < i; ++l) {
|
||||
@@ -25,11 +31,11 @@
|
||||
@@ -29,11 +35,11 @@
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
|
||||
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -434,6 +434,18 @@
|
||||
@@ -445,6 +445,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));
|
||||
@@ -751,12 +763,14 @@
|
||||
@@ -762,12 +774,14 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema129, "Added Glow Squid", DataConverterTypes.ENTITY));
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema129, "Added Glow Item Frame", DataConverterTypes.ENTITY));
|
||||
Schema schema130 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -36,7 +36,7 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema131, "Rename copper item suffixes", createRenamer(immutablemap1)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema131, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -764,7 +778,8 @@
|
||||
@@ -775,7 +789,8 @@
|
||||
|
||||
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema132, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
|
||||
Schema schema133 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -46,13 +46,13 @@
|
|||
|
||||
datafixerbuilder.addFixer(DataConverterItemName.create(schema133, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema133, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
|
||||
@@ -851,10 +866,11 @@
|
||||
@@ -862,10 +877,11 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema158, "Added Allay", DataConverterTypes.ENTITY));
|
||||
Schema schema159 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
- datafixerbuilder.addFixer(new SimpleRenameFix(schema159, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build()));
|
||||
- datafixerbuilder.addFixer(new NamespacedTypeRenameFix(schema159, "game_event_renames_3084", DataConverterTypes.GAME_EVENT_NAME, createRenamer(ImmutableMap.builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build())));
|
||||
+ // CraftBukkit - decompile error
|
||||
+ datafixerbuilder.addFixer(new SimpleRenameFix(schema159, DataConverterTypes.GAME_EVENT_NAME, ImmutableMap.<String, String>builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build()));
|
||||
+ datafixerbuilder.addFixer(new NamespacedTypeRenameFix(schema159, "game_event_renames_3084", DataConverterTypes.GAME_EVENT_NAME, createRenamer(ImmutableMap.<String, String>builder().put("minecraft:block_press", "minecraft:block_activate").put("minecraft:block_switch", "minecraft:block_activate").put("minecraft:block_unpress", "minecraft:block_deactivate").put("minecraft:block_unswitch", "minecraft:block_deactivate").put("minecraft:drinking_finish", "minecraft:drink").put("minecraft:elytra_free_fall", "minecraft:elytra_glide").put("minecraft:entity_damaged", "minecraft:entity_damage").put("minecraft:entity_dying", "minecraft:entity_die").put("minecraft:entity_killed", "minecraft:entity_die").put("minecraft:mob_interact", "minecraft:entity_interact").put("minecraft:ravager_roar", "minecraft:entity_roar").put("minecraft:ring_bell", "minecraft:block_change").put("minecraft:shulker_close", "minecraft:container_close").put("minecraft:shulker_open", "minecraft:container_open").put("minecraft:wolf_shaking", "minecraft:entity_shake").build())));
|
||||
Schema schema160 = datafixerbuilder.addSchema(3086, DataConverterRegistry.SAME_NAMESPACED);
|
||||
TypeReference typereference = DataConverterTypes.ENTITY;
|
||||
- Int2ObjectOpenHashMap int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> {
|
||||
|
@ -60,7 +60,7 @@
|
|||
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
|
||||
int2objectopenhashmap1.put(0, "minecraft:tabby");
|
||||
int2objectopenhashmap1.put(1, "minecraft:black");
|
||||
@@ -871,7 +887,8 @@
|
||||
@@ -882,7 +898,8 @@
|
||||
|
||||
Objects.requireNonNull(int2objectopenhashmap);
|
||||
datafixerbuilder.addFixer(new EntityVariantFix(schema160, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
--- a/net/minecraft/world/damagesource/DamageSources.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSources.java
|
||||
@@ -39,9 +39,15 @@
|
||||
private final DamageSource sweetBerryBush;
|
||||
private final DamageSource freeze;
|
||||
@@ -41,9 +41,15 @@
|
||||
private final DamageSource stalagmite;
|
||||
private final DamageSource outsideBorder;
|
||||
private final DamageSource genericKill;
|
||||
+ // CraftBukkit start
|
||||
+ public final DamageSource melting;
|
||||
+ public final DamageSource poison;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
- ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1));
|
||||
+ ((EntityHuman) entityliving).causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
} else if (this == MobEffects.SATURATION && entityliving instanceof EntityHuman) {
|
||||
if (!entityliving.level.isClientSide) {
|
||||
if (!entityliving.level().isClientSide) {
|
||||
- ((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -236,6 +294,25 @@
|
||||
@@ -240,6 +298,25 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
|
@ -93,7 +93,7 @@
|
|||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -367,6 +444,12 @@
|
||||
@@ -373,6 +450,12 @@
|
||||
public void onClientRemoval() {}
|
||||
|
||||
public void setPose(EntityPose entitypose) {
|
||||
|
@ -106,7 +106,7 @@
|
|||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -391,6 +474,33 @@
|
||||
@@ -397,6 +480,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
|
@ -140,7 +140,7 @@
|
|||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -432,6 +542,15 @@
|
||||
@@ -438,6 +548,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
|
@ -154,9 +154,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
public void baseTick() {
|
||||
this.level.getProfiler().push("entityBaseTick");
|
||||
this.level().getProfiler().push("entityBaseTick");
|
||||
this.feetBlockState = null;
|
||||
@@ -446,7 +565,7 @@
|
||||
@@ -452,7 +571,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
|
@ -165,7 +165,7 @@
|
|||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -481,6 +600,10 @@
|
||||
@@ -487,6 +606,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
|
@ -175,8 +175,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
this.checkOutOfWorld();
|
||||
@@ -524,15 +647,48 @@
|
||||
this.checkBelowWorld();
|
||||
@@ -538,15 +661,48 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
|
@ -226,8 +226,8 @@
|
|||
int j = i * 20;
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -646,6 +802,28 @@
|
||||
block.updateEntityAfterFallOn(this.level, this);
|
||||
@@ -697,6 +853,28 @@
|
||||
block.updateEntityAfterFallOn(this.level(), this);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -252,10 +252,10 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.onGround) {
|
||||
block.stepOn(this.level, blockposition, iblockdata, this);
|
||||
if (this.onGround()) {
|
||||
block.stepOn(this.level(), blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -948,6 +1126,20 @@
|
||||
@@ -1024,6 +1202,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,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);
|
||||
@@ -1311,6 +1503,7 @@
|
||||
@@ -1430,6 +1622,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
|
@ -284,7 +284,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1505,6 +1698,12 @@
|
||||
@@ -1624,6 +1817,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@
|
|||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1538,7 +1737,7 @@
|
||||
@@ -1657,7 +1856,7 @@
|
||||
} else {
|
||||
String s = this.getEncodeId();
|
||||
|
||||
|
@ -306,7 +306,7 @@
|
|||
return false;
|
||||
} else {
|
||||
nbttagcompound.putString("id", s);
|
||||
@@ -1563,6 +1762,18 @@
|
||||
@@ -1682,6 +1881,18 @@
|
||||
Vec3D vec3d = this.getDeltaMovement();
|
||||
|
||||
nbttagcompound.put("Motion", this.newDoubleList(vec3d.x, vec3d.y, vec3d.z));
|
||||
|
@ -325,7 +325,7 @@
|
|||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1571,6 +1782,25 @@
|
||||
@@ -1690,6 +1901,25 @@
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
nbttagcompound.putUUID("UUID", this.getUUID());
|
||||
|
@ -351,7 +351,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1638,6 +1868,11 @@
|
||||
@@ -1757,6 +1987,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -363,7 +363,7 @@
|
|||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1721,6 +1956,45 @@
|
||||
@@ -1840,6 +2075,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
|
@ -409,8 +409,8 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1796,9 +2070,22 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
@@ -1915,9 +2189,22 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
+ // CraftBukkit start - Capture drops for death event
|
||||
|
@ -419,7 +419,7 @@
|
|||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY() + (double) f, this.getZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY() + (double) f, this.getZ(), itemstack);
|
||||
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
|
@ -429,10 +429,10 @@
|
|||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.addFreshEntity(entityitem);
|
||||
this.level().addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -1894,7 +2181,7 @@
|
||||
@@ -2013,7 +2300,7 @@
|
||||
|
||||
this.setPose(EntityPose.STANDING);
|
||||
this.vehicle = entity;
|
||||
|
@ -441,7 +441,7 @@
|
|||
entity.getIndirectPassengersStream().filter((entity2) -> {
|
||||
return entity2 instanceof EntityPlayer;
|
||||
}).forEach((entity2) -> {
|
||||
@@ -1925,7 +2212,7 @@
|
||||
@@ -2044,7 +2331,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
|
@ -450,7 +450,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1934,10 +2221,31 @@
|
||||
@@ -2053,10 +2340,31 @@
|
||||
this.removeVehicle();
|
||||
}
|
||||
|
||||
|
@ -483,7 +483,7 @@
|
|||
if (this.passengers.isEmpty()) {
|
||||
this.passengers = ImmutableList.of(entity);
|
||||
} else {
|
||||
@@ -1954,12 +2262,32 @@
|
||||
@@ -2073,12 +2381,32 @@
|
||||
|
||||
this.gameEvent(GameEvent.ENTITY_MOUNT, entity);
|
||||
}
|
||||
|
@ -517,7 +517,7 @@
|
|||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -1971,6 +2299,7 @@
|
||||
@@ -2090,6 +2418,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
|
@ -525,17 +525,17 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2037,14 +2366,20 @@
|
||||
@@ -2156,14 +2485,20 @@
|
||||
|
||||
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
|
||||
- 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.level().getProfiler().push("portal");
|
||||
this.portalTime = i;
|
||||
this.setPortalCooldown();
|
||||
- this.changeDimension(worldserver1);
|
||||
|
@ -546,10 +546,10 @@
|
|||
+ this.changeDimension(worldserver1);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.getProfiler().pop();
|
||||
this.level().getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2164,6 +2499,13 @@
|
||||
@@ -2283,6 +2618,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
|
@ -563,7 +563,7 @@
|
|||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2209,8 +2551,12 @@
|
||||
@@ -2332,8 +2674,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2229,7 +2575,7 @@
|
||||
@@ -2352,7 +2698,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -586,7 +586,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2237,7 +2583,18 @@
|
||||
@@ -2360,7 +2706,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
|
@ -606,7 +606,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2264,11 +2621,41 @@
|
||||
@@ -2387,11 +2744,41 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -650,7 +650,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2433,15 +2820,38 @@
|
||||
@@ -2556,15 +2943,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -661,16 +661,16 @@
|
|||
+ @Nullable
|
||||
+ public Entity teleportTo(WorldServer worldserver, Position location) {
|
||||
+ // CraftBukkit end
|
||||
if (this.level instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level.getProfiler().push("changeDimension");
|
||||
if (this.level() instanceof WorldServer && !this.isRemoved()) {
|
||||
this.level().getProfiler().push("changeDimension");
|
||||
- this.unRide();
|
||||
+ // CraftBukkit start
|
||||
+ // this.decouple();
|
||||
+ // this.unRide();
|
||||
+ if (worldserver == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.getProfiler().push("reposition");
|
||||
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
|
||||
|
||||
|
@ -688,10 +688,10 @@
|
|||
+ this.unRide();
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.level.getProfiler().popPush("reloading");
|
||||
this.level().getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2450,9 +2860,17 @@
|
||||
@@ -2573,9 +2983,17 @@
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
worldserver.addDuringTeleport(entity);
|
||||
|
@ -711,17 +711,17 @@
|
|||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2473,20 +2891,34 @@
|
||||
@@ -2596,20 +3014,34 @@
|
||||
|
||||
@Nullable
|
||||
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
|
||||
- boolean flag = this.level.dimension() == World.END && worldserver.dimension() == World.OVERWORLD;
|
||||
- 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 flag = this.level().getTypeKey() == WorldDimension.END && worldserver.getTypeKey() == WorldDimension.OVERWORLD; // fromEndToOverworld
|
||||
+ boolean flag1 = worldserver.getTypeKey() == WorldDimension.END; // targetIsEnd
|
||||
+ // CraftBukkit end
|
||||
|
||||
|
@ -729,12 +729,12 @@
|
|||
- 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
|
||||
- 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());
|
||||
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 Position(blockposition.getX(), blockposition.getY(), blockposition.getZ()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag2 ? 16 : 128, 16);
|
||||
|
@ -748,10 +748,10 @@
|
|||
- 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);
|
||||
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2503,8 +2935,8 @@
|
||||
@@ -2626,8 +3058,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
|
@ -762,7 +762,7 @@
|
|||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2514,8 +2946,14 @@
|
||||
@@ -2637,8 +3069,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
}
|
||||
|
@ -778,7 +778,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -2523,8 +2961,23 @@
|
||||
@@ -2646,8 +3084,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@
|
|||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2644,6 +3097,12 @@
|
||||
@@ -2767,6 +3220,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -817,7 +817,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);
|
||||
|
||||
@@ -2773,7 +3232,26 @@
|
||||
@@ -2901,7 +3360,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -845,7 +845,7 @@
|
|||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -3084,6 +3562,11 @@
|
||||
@@ -3212,6 +3690,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
@Override
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
- if (this.level.isClientSide) {
|
||||
+ if (this.level.isClientSide || ageLocked) { // CraftBukkit
|
||||
- if (this.level().isClientSide) {
|
||||
+ if (this.level().isClientSide || ageLocked) { // CraftBukkit
|
||||
if (this.forcedAgeTimer > 0) {
|
||||
if (this.forcedAgeTimer % 4 == 0) {
|
||||
this.level.addParticle(Particles.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
this.level().addParticle(Particles.HAPPY_VILLAGER, this.getRandomX(1.0D), this.getRandomY() + 0.5D, this.getRandomZ(1.0D), 0.0D, 0.0D, 0.0D);
|
||||
|
|
|
@ -15,7 +15,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.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
this.onLeashDistance(f);
|
||||
if (f > 10.0F) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
|
||||
+ 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) {
|
||||
|
|
|
@ -46,9 +46,9 @@
|
|||
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();
|
||||
|
||||
@@ -222,12 +245,12 @@
|
||||
@@ -227,12 +250,12 @@
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (entityhuman.takeXpDelay == 0) {
|
||||
- entityhuman.takeXpDelay = 2;
|
||||
+ entityhuman.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(entityhuman, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
|
||||
|
@ -61,7 +61,7 @@
|
|||
}
|
||||
|
||||
--this.count;
|
||||
@@ -245,9 +268,17 @@
|
||||
@@ -250,9 +273,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
|
||||
|
@ -79,7 +79,7 @@
|
|||
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -272,6 +303,24 @@
|
||||
@@ -277,6 +308,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -75,6 +75,19 @@
|
||||
@@ -74,6 +74,19 @@
|
||||
import net.minecraft.world.level.material.FluidType;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.storage.loot.LootTableInfo;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
|
@ -20,7 +20,7 @@
|
|||
public abstract class EntityInsentient extends EntityLiving implements Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -121,6 +134,8 @@
|
||||
@@ -120,6 +133,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
|||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -146,6 +161,12 @@
|
||||
@@ -145,6 +160,12 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
|||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -254,7 +275,38 @@
|
||||
@@ -257,7 +278,38 @@
|
||||
}
|
||||
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
|
@ -57,14 +57,14 @@
|
|||
+ reason = getTarget().isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
|
||||
+ }
|
||||
+ if (reason == EntityTargetEvent.TargetReason.UNKNOWN) {
|
||||
+ level.getCraftServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
|
||||
+ this.level().getCraftServer().getLogger().log(java.util.logging.Level.WARNING, "Unknown target reason, please report on the issue tracker", new Exception());
|
||||
+ }
|
||||
+ CraftLivingEntity ctarget = null;
|
||||
+ if (entityliving != null) {
|
||||
+ ctarget = (CraftLivingEntity) entityliving.getBukkitEntity();
|
||||
+ }
|
||||
+ EntityTargetLivingEntityEvent event = new EntityTargetLivingEntityEvent(this.getBukkitEntity(), ctarget, reason);
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -394,6 +446,12 @@
|
||||
@@ -397,6 +449,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@
|
|||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -483,16 +541,26 @@
|
||||
@@ -486,16 +544,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@
|
|||
NBTTagList nbttaglist;
|
||||
int i;
|
||||
|
||||
@@ -539,6 +607,11 @@
|
||||
@@ -542,6 +610,11 @@
|
||||
}
|
||||
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
|
@ -135,7 +135,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -606,7 +679,7 @@
|
||||
@@ -609,7 +682,7 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
@ -144,7 +144,7 @@
|
|||
|
||||
if (!itemstack1.isEmpty()) {
|
||||
this.onItemPickup(entityitem);
|
||||
@@ -620,6 +693,12 @@
|
||||
@@ -623,6 +696,12 @@
|
||||
}
|
||||
|
||||
public ItemStack equipItemIfPossible(ItemStack itemstack) {
|
||||
|
@ -157,8 +157,8 @@
|
|||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -630,11 +709,19 @@
|
||||
flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -633,11 +712,19 @@
|
||||
flag = itemstack1.isEmpty();
|
||||
}
|
||||
|
||||
- if (flag && this.canHoldItem(itemstack)) {
|
||||
|
@ -178,15 +178,15 @@
|
|||
}
|
||||
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -779,6 +866,7 @@
|
||||
@@ -782,6 +869,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
+ if (!this.aware) return; // CraftBukkit
|
||||
this.level.getProfiler().push("sensing");
|
||||
this.level().getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level.getProfiler().pop();
|
||||
@@ -1172,6 +1260,12 @@
|
||||
this.level().getProfiler().pop();
|
||||
@@ -1175,6 +1263,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
|
@ -198,8 +198,8 @@
|
|||
+ // CraftBukkit end
|
||||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1197,6 +1291,12 @@
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1200,6 +1294,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
|
@ -211,17 +211,17 @@
|
|||
+ // CraftBukkit end
|
||||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
@@ -1212,7 +1312,7 @@
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1215,7 +1315,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level instanceof WorldServer) {
|
||||
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<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);
|
||||
@@ -1262,12 +1362,19 @@
|
||||
@@ -1265,12 +1365,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
|
@ -237,52 +237,52 @@
|
|||
if (this.isRemoved()) {
|
||||
return null;
|
||||
} else {
|
||||
- T t0 = (EntityInsentient) entitytypes.create(this.level);
|
||||
+ T t0 = entitytypes.create(this.level); // CraftBukkit - decompile error
|
||||
- T t0 = (EntityInsentient) entitytypes.create(this.level());
|
||||
+ T t0 = entitytypes.create(this.level()); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1302,7 +1409,12 @@
|
||||
@@ -1304,7 +1411,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.level.addFreshEntity(t0);
|
||||
- this.level().addFreshEntity(t0);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, t0, transformReason).isCancelled()) {
|
||||
+ return null;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(t0, spawnReason);
|
||||
+ this.level().addFreshEntity(t0, spawnReason);
|
||||
+ // CraftBukkit end
|
||||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1323,6 +1435,7 @@
|
||||
@@ -1325,6 +1437,7 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), (!this.isAlive()) ? UnleashReason.PLAYER_UNLEASH : UnleashReason.HOLDER_GONE)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1334,7 +1447,9 @@
|
||||
@@ -1336,7 +1449,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
if (!this.level.isClientSide && flag1) {
|
||||
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) {
|
||||
@@ -1384,6 +1499,7 @@
|
||||
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
|
||||
@@ -1386,6 +1501,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1408,7 +1524,9 @@
|
||||
@@ -1410,7 +1526,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
|
@ -292,7 +292,7 @@
|
|||
this.leashInfoTag = null;
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1602,14 @@
|
||||
@@ -1486,7 +1604,14 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -308,15 +308,11 @@
|
|||
}
|
||||
|
||||
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
|
||||
@@ -1558,9 +1683,10 @@
|
||||
@@ -1560,6 +1685,7 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
|
||||
this.dropLeash(true, false);
|
||||
this.getAllSlots().forEach((itemstack) -> {
|
||||
- itemstack.setCount(0);
|
||||
+ if (!itemstack.isEmpty()) itemstack.setCount(0); // CraftBukkit
|
||||
});
|
||||
}
|
||||
|
||||
if (!itemstack.isEmpty()) {
|
||||
|
|
|
@ -17,18 +17,18 @@
|
|||
|
||||
- if (this.life >= 0) {
|
||||
+ if (this.life >= 0 && !this.visualOnly) { // CraftBukkit - add !this.visualOnly
|
||||
if (!(this.level instanceof WorldServer)) {
|
||||
this.level.setSkyFlashTime(2);
|
||||
if (!(this.level() instanceof WorldServer)) {
|
||||
this.level().setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -163,8 +167,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level, blockposition);
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level(), blockposition);
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!visualOnly"
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition, this).isCancelled()) {
|
||||
+ this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) {
|
||||
+ this.level().setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -37,13 +37,13 @@
|
|||
for (int j = 0; j < i; ++j) {
|
||||
@@ -172,8 +180,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.getState(this.level, blockposition1);
|
||||
if (this.level.getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level, blockposition1)) {
|
||||
- this.level.setBlockAndUpdate(blockposition1, iblockdata);
|
||||
iblockdata = BlockFireAbstract.getState(this.level(), blockposition1);
|
||||
if (this.level().getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level(), blockposition1)) {
|
||||
- this.level().setBlockAndUpdate(blockposition1, iblockdata);
|
||||
- ++this.blocksSetOnFire;
|
||||
+ // CraftBukkit start - add "!visualOnly"
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(level, blockposition1, this).isCancelled()) {
|
||||
+ this.level.setBlockAndUpdate(blockposition1, iblockdata);
|
||||
+ if (!visualOnly && !CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition1, this).isCancelled()) {
|
||||
+ this.level().setBlockAndUpdate(blockposition1, iblockdata);
|
||||
+ ++this.blocksSetOnFire;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -117,6 +117,30 @@
|
||||
@@ -119,6 +119,30 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
|||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -224,6 +248,20 @@
|
||||
@@ -227,6 +251,20 @@
|
||||
private float swimAmountO;
|
||||
protected BehaviorController<?> brain;
|
||||
private boolean skipDropExperience;
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -236,7 +274,9 @@
|
||||
@@ -239,7 +277,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
|
@ -63,22 +63,22 @@
|
|||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -303,7 +343,13 @@
|
||||
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d1);
|
||||
@@ -318,7 +358,13 @@
|
||||
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d7);
|
||||
|
||||
- ((WorldServer) this.level).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), 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), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, 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), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@@ -655,13 +701,19 @@
|
||||
super.checkFallDamage(d0, flag, iblockdata, blockposition);
|
||||
@@ -673,13 +719,19 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
|
@ -94,12 +94,12 @@
|
|||
Equipable equipable = Equipable.get(itemstack1);
|
||||
|
||||
if (equipable != null && !this.isSpectator() && equipable.getEquipmentSlot() == enumitemslot) {
|
||||
- if (!this.level.isClientSide() && !this.isSilent()) {
|
||||
+ if (!this.level.isClientSide() && !this.isSilent() && !silent) { // CraftBukkit
|
||||
this.level.playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
|
||||
- if (!this.level().isClientSide() && !this.isSilent()) {
|
||||
+ if (!this.level().isClientSide() && !this.isSilent() && !silent) { // CraftBukkit
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@@ -735,6 +787,17 @@
|
||||
@@ -753,6 +805,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
|||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -772,9 +835,32 @@
|
||||
@@ -790,9 +853,32 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -150,10 +150,10 @@
|
|||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -784,6 +870,12 @@
|
||||
@@ -802,6 +888,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ EntityPotionEffectEvent event = CraftEventFactory.callEntityPotionEffectChangeEvent(this, mobeffect, null, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.EXPIRATION);
|
||||
+ if (event.isCancelled()) {
|
||||
|
@ -163,7 +163,7 @@
|
|||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -794,6 +886,17 @@
|
||||
@@ -812,6 +904,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
|
@ -180,8 +180,8 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level.isClientSide) {
|
||||
@@ -920,7 +1023,13 @@
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -938,7 +1041,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
}
|
||||
|
||||
|
@ -192,10 +192,10 @@
|
|||
+
|
||||
+ public boolean removeAllEffects(EntityPotionEffectEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
if (this.level.isClientSide) {
|
||||
if (this.level().isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -929,7 +1038,14 @@
|
||||
@@ -947,7 +1056,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
|
@ -211,7 +211,7 @@
|
|||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -958,18 +1074,48 @@
|
||||
@@ -976,18 +1092,48 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@
|
|||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -1006,13 +1152,39 @@
|
||||
@@ -1024,13 +1170,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@
|
|||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1049,20 +1221,55 @@
|
||||
@@ -1098,20 +1270,55 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@
|
|||
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
|
||||
+ // Suppress during worldgen
|
||||
+ if (this.valid) {
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
|
@ -359,16 +359,16 @@
|
|||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1076,7 +1283,7 @@
|
||||
@@ -1125,7 +1332,7 @@
|
||||
return false;
|
||||
} else if (this.level.isClientSide) {
|
||||
} else if (this.level().isClientSide) {
|
||||
return false;
|
||||
- } else if (this.isDeadOrDying()) {
|
||||
+ } else if (this.isRemoved() || this.dead || this.getHealth() <= 0.0F) { // CraftBukkit - Don't allow entities that got set to dead/killed elsewhere to get damaged and die
|
||||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1087,10 +1294,11 @@
|
||||
@@ -1136,10 +1343,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
|
@ -382,7 +382,7 @@
|
|||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1114,27 +1322,46 @@
|
||||
@@ -1163,27 +1371,46 @@
|
||||
this.walkAnimation.setSpeed(1.5F);
|
||||
boolean flag1 = true;
|
||||
|
||||
|
@ -434,7 +434,7 @@
|
|||
Entity entity1 = damagesource.getEntity();
|
||||
|
||||
if (entity1 != null) {
|
||||
@@ -1248,19 +1475,32 @@
|
||||
@@ -1297,19 +1524,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
|
@ -460,7 +460,7 @@
|
|||
+ org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
|
||||
+ EntityResurrectEvent event = new EntityResurrectEvent((LivingEntity) this.getBukkitEntity(), handSlot);
|
||||
+ event.setCancelled(itemstack == null);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ if (!itemstack1.isEmpty()) {
|
||||
|
@ -471,7 +471,7 @@
|
|||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1268,14 +1508,16 @@
|
||||
@@ -1317,14 +1557,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
|
@ -485,7 +485,7 @@
|
|||
+ this.addEffect(new MobEffect(MobEffects.ABSORPTION, 100, 1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ this.addEffect(new MobEffect(MobEffects.FIRE_RESISTANCE, 800, 0), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.TOTEM);
|
||||
+ // CraftBukkit end
|
||||
this.level.broadcastEntityEvent(this, (byte) 35);
|
||||
this.level().broadcastEntityEvent(this, (byte) 35);
|
||||
}
|
||||
|
||||
- return itemstack != null;
|
||||
|
@ -493,20 +493,20 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1380,14 +1622,22 @@
|
||||
@@ -1433,14 +1675,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlock(blockposition, iblockdata, 3);
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
- this.level().setBlock(blockposition, iblockdata, 3);
|
||||
- flag = true;
|
||||
+ // CraftBukkit start - call EntityBlockFormEvent for Wither Rose
|
||||
+ flag = org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, 3, this);
|
||||
+ flag = org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, 3, this);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag) {
|
||||
EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(), this.getZ(), new ItemStack(Items.WITHER_ROSE));
|
||||
EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), new ItemStack(Items.WITHER_ROSE));
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
|
@ -515,15 +515,15 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.addFreshEntity(entityitem);
|
||||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1407,21 +1657,40 @@
|
||||
@@ -1460,21 +1710,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
+ this.dropEquipment(); // CraftBukkit - from below
|
||||
if (this.shouldDropLoot() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
if (this.shouldDropLoot() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
this.dropFromLootTable(damagesource, flag);
|
||||
this.dropCustomDeathLoot(damagesource, i, flag);
|
||||
}
|
||||
|
@ -542,27 +542,27 @@
|
|||
- 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());
|
||||
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;
|
||||
+ }
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ protected void dropExperience() {
|
||||
+ // 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
|
||||
+ EntityExperienceOrb.award((WorldServer) this.level, this.position(), this.expToDrop);
|
||||
+ EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.expToDrop);
|
||||
+ this.expToDrop = 0;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
}
|
||||
|
||||
@@ -1512,6 +1781,28 @@
|
||||
@@ -1565,6 +1834,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
|
@ -588,10 +588,10 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void setOnGround(boolean flag) {
|
||||
super.setOnGround(flag);
|
||||
@@ -1567,9 +1858,14 @@
|
||||
public Optional<BlockPosition> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1611,9 +1902,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -607,7 +607,7 @@
|
|||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1621,7 +1917,7 @@
|
||||
@@ -1665,7 +1961,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
|
@ -616,7 +616,7 @@
|
|||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1634,7 +1930,8 @@
|
||||
@@ -1678,7 +1974,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
|
@ -626,7 +626,7 @@
|
|||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1667,16 +1964,125 @@
|
||||
@@ -1711,16 +2008,125 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,10 @@
|
|||
+ }
|
||||
+
|
||||
+ f = (float) event.getFinalDamage();
|
||||
+
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionAmount(), 0.0F);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+ // Resistance
|
||||
+ if (event.getDamage(DamageModifier.RESISTANCE) < 0) {
|
||||
+ float f3 = (float) -event.getDamage(DamageModifier.RESISTANCE);
|
||||
|
@ -724,7 +727,7 @@
|
|||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
+ // Apply damage to helmet
|
||||
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.hurtHelmet(damagesource, f);
|
||||
|
@ -738,7 +741,7 @@
|
|||
+
|
||||
+ // Apply blocking code // PAIL: steal from above
|
||||
+ if (event.getDamage(DamageModifier.BLOCKING) < 0) {
|
||||
+ this.level.broadcastEntityEvent(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.level().broadcastEntityEvent(this, (byte) 29); // SPIGOT-4635 - shield damage sound
|
||||
+ this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING));
|
||||
+ Entity entity = damagesource.getDirectEntity();
|
||||
+
|
||||
|
@ -746,21 +749,18 @@
|
|||
+ this.blockUsingShield((EntityLiving) entity);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- f = Math.max(f - this.getAbsorptionAmount(), 0.0F);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - (f1 - f));
|
||||
- float f2 = f1 - f;
|
||||
+
|
||||
+ absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION);
|
||||
+ this.setAbsorptionAmount(Math.max(this.getAbsorptionAmount() - absorptionModifier, 0.0F));
|
||||
+ float f2 = absorptionModifier;
|
||||
|
||||
+
|
||||
+ if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) {
|
||||
+ ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F));
|
||||
+ }
|
||||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@@ -1687,15 +2093,49 @@
|
||||
@@ -1731,13 +2137,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -774,10 +774,8 @@
|
|||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
float f3 = this.getHealth();
|
||||
|
||||
this.getCombatTracker().recordDamage(damagesource, f3, f);
|
||||
this.setHealth(f3 - f);
|
||||
this.getCombatTracker().recordDamage(damagesource, f);
|
||||
this.setHealth(this.getHealth() - f);
|
||||
- this.setAbsorptionAmount(this.getAbsorptionAmount() - f);
|
||||
+ // CraftBukkit start
|
||||
+ if (!human) {
|
||||
|
@ -812,28 +810,27 @@
|
|||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1716,9 +2156,19 @@
|
||||
@@ -1758,8 +2198,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
- this.entityData.set(EntityLiving.DATA_ARROW_COUNT_ID, i);
|
||||
+ // CraftBukkit start
|
||||
+ setArrowCount(i, false);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ public final void setArrowCount(int i, boolean flag) {
|
||||
+ ArrowBodyCountChangeEvent event = CraftEventFactory.callArrowBodyCountChangeEvent(this, getArrowCount(), i, flag);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.entityData.set(EntityLiving.DATA_ARROW_COUNT_ID, event.getNewAmount());
|
||||
+ }
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
}
|
||||
@@ -1959,6 +2409,12 @@
|
||||
@@ -2001,6 +2451,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
|
@ -846,23 +843,23 @@
|
|||
@Override
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2198,6 +2654,7 @@
|
||||
@@ -2238,6 +2694,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround && !this.level.isClientSide) {
|
||||
if (this.onGround() && !this.level().isClientSide) {
|
||||
+ if (getSharedFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, false).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2757,6 +3214,7 @@
|
||||
@@ -2809,6 +3266,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
+ if (flag != this.getSharedFlag(7) && !CraftEventFactory.callToggleGlideEvent(this, flag).isCancelled()) // CraftBukkit
|
||||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -2916,14 +3374,21 @@
|
||||
@@ -2968,14 +3426,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
|
@ -886,18 +883,18 @@
|
|||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3118,7 +3583,26 @@
|
||||
@@ -3170,7 +3635,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
- ItemStack itemstack = this.useItem.finishUsingItem(this.level, this);
|
||||
- ItemStack itemstack = this.useItem.finishUsingItem(this.level(), this);
|
||||
+ // CraftBukkit start - fire PlayerItemConsumeEvent
|
||||
+ ItemStack itemstack;
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.useItem);
|
||||
+ org.bukkit.inventory.EquipmentSlot hand = org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(enumhand);
|
||||
+ PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem, hand);
|
||||
+ level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ // Update client
|
||||
|
@ -906,15 +903,15 @@
|
|||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level, this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(level, this);
|
||||
+ itemstack = (craftItem.equals(event.getItem())) ? this.useItem.finishUsingItem(this.level(), this) : CraftItemStack.asNMSCopy(event.getItem()).finishUsingItem(this.level(), this);
|
||||
+ } else {
|
||||
+ itemstack = this.useItem.finishUsingItem(this.level, this);
|
||||
+ itemstack = this.useItem.finishUsingItem(this.level(), this);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3196,6 +3680,12 @@
|
||||
@@ -3248,6 +3732,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
|
@ -927,7 +924,7 @@
|
|||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3220,16 +3710,41 @@
|
||||
@@ -3272,16 +3762,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
|
@ -945,8 +942,8 @@
|
|||
+
|
||||
+ if (flag1) {
|
||||
+ if (!(this instanceof EntityPlayer)) {
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level.getWorld(), d3, d4, d5), new Location(this.level.getWorld(), d0, d6, d2));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(teleport);
|
||||
+ EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.level().getWorld(), d3, d4, d5), new Location(this.level().getWorld(), d0, d6, d2));
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(teleport);
|
||||
+ if (!teleport.isCancelled()) {
|
||||
+ Location to = teleport.getTo();
|
||||
+ this.teleportTo(to.getX(), to.getY(), to.getZ());
|
||||
|
@ -972,7 +969,7 @@
|
|||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3239,7 +3754,7 @@
|
||||
@@ -3291,7 +3806,7 @@
|
||||
((EntityCreature) this).getNavigation().stop();
|
||||
}
|
||||
|
||||
|
@ -981,25 +978,25 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3322,7 +3837,7 @@
|
||||
@@ -3374,7 +3889,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
- Optional optional = this.getSleepingPos();
|
||||
+ Optional<BlockPosition> optional = this.getSleepingPos(); // CraftBukkit - decompile error
|
||||
World world = this.level;
|
||||
World world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(this.level);
|
||||
@@ -3356,7 +3871,7 @@
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3408,7 +3923,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
- BlockPosition blockposition = (BlockPosition) this.getSleepingPos().orElse((Object) null);
|
||||
+ BlockPosition blockposition = (BlockPosition) this.getSleepingPos().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level, blockposition) : null;
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3404,7 +3919,7 @@
|
||||
@@ -3456,7 +3971,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
|
|
|
@ -7,5 +7,5 @@
|
|||
- if (!entity1.isPushable()) {
|
||||
+ if (!entity1.canCollideWithBukkit(entity) || !entity.canCollideWithBukkit(entity1)) { // CraftBukkit - collidable API
|
||||
return false;
|
||||
} else if (entity.level.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).isLocalPlayer())) {
|
||||
} else if (entity.level().isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).isLocalPlayer())) {
|
||||
return false;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
Logger logger;
|
||||
|
||||
if (nbttagcompound.contains("attack")) {
|
||||
@@ -138,12 +144,19 @@
|
||||
@@ -143,12 +149,19 @@
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
|
@ -34,7 +34,7 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level.getGameTime());
|
||||
this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level().getGameTime());
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
private static final int TIMEOUT_TO_GET_WITHIN_ATTACK_RANGE = 200;
|
||||
@@ -41,6 +47,18 @@
|
||||
if (entityinsentient.canAttack(entityliving) && (!flag || !isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level == entityinsentient.level && !predicate.test(entityliving)) {
|
||||
if (entityinsentient.canAttack(entityliving) && (!flag || !isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !predicate.test(entityliving)) {
|
||||
return true;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -1,6 +1,17 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
@@ -80,8 +80,8 @@
|
||||
@@ -26,6 +26,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.world.level.block.Blocks;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class BehaviorFarm extends Behavior<EntityVillager> {
|
||||
|
||||
private static final int HARVEST_DURATION = 200;
|
||||
@@ -81,8 +85,8 @@
|
||||
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
|
||||
|
@ -11,7 +22,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -101,7 +101,11 @@
|
||||
@@ -102,7 +106,11 @@
|
||||
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
|
||||
|
@ -24,45 +35,24 @@
|
|||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
|
||||
@@ -114,27 +118,30 @@
|
||||
if (!itemstack.isEmpty()) {
|
||||
IBlockData iblockdata1;
|
||||
@@ -119,9 +127,13 @@
|
||||
ItemBlock itemblock = (ItemBlock) item;
|
||||
IBlockData iblockdata1 = itemblock.getBlock().defaultBlockState();
|
||||
|
||||
+ // CraftBukkit start
|
||||
if (itemstack.is(Items.WHEAT_SEEDS)) {
|
||||
iblockdata1 = Blocks.WHEAT.defaultBlockState();
|
||||
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
flag = true;
|
||||
} else if (itemstack.is(Items.POTATO)) {
|
||||
iblockdata1 = Blocks.POTATOES.defaultBlockState();
|
||||
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
flag = true;
|
||||
} else if (itemstack.is(Items.CARROT)) {
|
||||
iblockdata1 = Blocks.CARROTS.defaultBlockState();
|
||||
- worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
- worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
flag = true;
|
||||
} else if (itemstack.is(Items.BEETROOT_SEEDS)) {
|
||||
iblockdata1 = Blocks.BEETROOTS.defaultBlockState();
|
||||
+ flag = true;
|
||||
+ } else {
|
||||
+ iblockdata1 = null;
|
||||
+ }
|
||||
+
|
||||
+ if (iblockdata1 != null && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, iblockdata1).isCancelled()) {
|
||||
worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
- flag = true;
|
||||
+ } else {
|
||||
+ flag = false;
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, iblockdata1).isCancelled()) {
|
||||
+ worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
+ worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
+ flag = true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
@@ -153,8 +160,8 @@
|
||||
@@ -141,8 +153,8 @@
|
||||
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
|
||||
if (this.aboveFarmlandPos != null) {
|
||||
this.nextOkStartTime = i + 20L;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@@ -28,6 +28,20 @@
|
||||
EntityItem entityitem = (EntityItem) behaviorbuilder_b.get(memoryaccessor2);
|
||||
|
||||
if (behaviorbuilder_b.tryGet(memoryaccessor3).isEmpty() && predicate.test(entityliving) && entityitem.closerThan(entityliving, (double) i) && entityliving.level.getWorldBorder().isWithinBounds(entityitem.blockPosition())) {
|
||||
if (behaviorbuilder_b.tryGet(memoryaccessor3).isEmpty() && predicate.test(entityliving) && entityitem.closerThan(entityliving, (double) i) && entityliving.level().getWorldBorder().isWithinBounds(entityitem.blockPosition())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (entityliving instanceof net.minecraft.world.entity.animal.allay.Allay) {
|
||||
+ org.bukkit.event.entity.EntityTargetEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(entityliving, entityitem, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
if (!blockdoor.isOpen(iblockdata)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level(), blockposition));
|
||||
+ entityliving.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
@ -19,8 +19,8 @@
|
|||
|
||||
if (!blockdoor1.isOpen(iblockdata1)) {
|
||||
+ // CraftBukkit start - entities opening doors
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level, blockposition1));
|
||||
+ entityliving.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.level(), blockposition1));
|
||||
+ entityliving.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
|
||||
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-4940: no empty loot
|
||||
double d0 = entityliving.getEyeY() - (double) f;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level, entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
EntityItem entityitem = new EntityItem(entityliving.level(), entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
|
||||
@@ -101,12 +102,19 @@
|
||||
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
|
||||
|
@ -34,12 +34,12 @@
|
|||
entityitem.setDefaultPickUpDelay();
|
||||
+ // CraftBukkit start
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(entityliving.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ entityitem.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityliving.level.addFreshEntity(entityitem);
|
||||
entityliving.level().addFreshEntity(entityitem);
|
||||
}
|
||||
|
||||
public static SectionPosition findSectionClosestToVillage(WorldServer worldserver, SectionPosition sectionposition, int i) {
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
@@ -71,6 +71,12 @@
|
||||
}
|
||||
|
||||
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level.getDifficulty())) {
|
||||
if (this.breakTime == this.getDoorBreakTime() && this.isValidDifficulty(this.mob.level().getDifficulty())) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreakDoorEvent(this.mob, this.doorPos).isCancelled()) {
|
||||
+ this.start();
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.mob.level.removeBlock(this.doorPos, false);
|
||||
this.mob.level.levelEvent(1021, this.doorPos, 0);
|
||||
this.mob.level.levelEvent(2001, this.doorPos, Block.getId(this.mob.level.getBlockState(this.doorPos)));
|
||||
this.mob.level().removeBlock(this.doorPos, false);
|
||||
this.mob.level().levelEvent(1021, this.doorPos, 0);
|
||||
this.mob.level().levelEvent(2001, this.doorPos, Block.getId(this.mob.level().getBlockState(this.doorPos)));
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
+ CraftEntity entity = this.tamable.getBukkitEntity();
|
||||
+ Location to = new Location(entity.getWorld(), (double) i + 0.5D, (double) j, (double) k + 0.5D, this.tamable.getYRot(), this.tamable.getXRot());
|
||||
+ EntityTeleportEvent event = new EntityTeleportEvent(entity, entity.getLocation(), to);
|
||||
+ this.tamable.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.tamable.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return false;
|
||||
+ }
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
+ return this.mob.isOrderedToSit() && this.mob.getTarget() == null; // CraftBukkit - Allow sitting for wild animals
|
||||
} else if (this.mob.isInWaterOrBubble()) {
|
||||
return false;
|
||||
} else if (!this.mob.isOnGround()) {
|
||||
} else if (!this.mob.onGround()) {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
@@ -43,6 +50,15 @@
|
||||
return false;
|
||||
} else {
|
||||
this.player = this.mob.level.getNearestPlayer(this.targetingConditions, this.mob);
|
||||
this.player = this.mob.level().getNearestPlayer(this.targetingConditions, this.mob);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.player != null) {
|
||||
+ EntityTargetLivingEntityEvent event = CraftEventFactory.callEntityTargetLivingEvent(this.mob, this.player, EntityTargetEvent.TargetReason.TEMPT);
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
@@ -140,16 +142,24 @@
|
||||
}
|
||||
|
||||
if (this.level.getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
if (this.level().getNearestPlayer(EntityBat.BAT_RESTING_TARGETING, this) != null) {
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
+ this.setResting(false);
|
||||
+ if (!flag) {
|
||||
+ this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit End
|
||||
|
@ -27,22 +27,22 @@
|
|||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
this.setResting(false);
|
||||
if (!flag) {
|
||||
this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
}
|
||||
}
|
||||
- } else {
|
||||
- this.setResting(false);
|
||||
- if (!flag) {
|
||||
- this.level.levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
- this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
|
||||
- }
|
||||
+ // CraftBukkit End - Call BatToggleSleepEvent
|
||||
}
|
||||
} else {
|
||||
if (this.targetPosition != null && (!this.level.isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level.getMinBuildHeight())) {
|
||||
if (this.targetPosition != null && (!this.level().isEmptyBlock(this.targetPosition) || this.targetPosition.getY() <= this.level().getMinBuildHeight())) {
|
||||
@@ -173,7 +183,11 @@
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
if (this.random.nextInt(100) == 0 && this.level.getBlockState(blockposition1).isRedstoneConductor(this.level, blockposition1)) {
|
||||
if (this.random.nextInt(100) == 0 && this.level().getBlockState(blockposition1).isRedstoneConductor(this.level(), blockposition1)) {
|
||||
- this.setResting(true);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, false)) {
|
||||
|
@ -55,7 +55,7 @@
|
|||
@@ -198,7 +212,11 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide && this.isResting()) {
|
||||
if (!this.level().isClientSide && this.isResting()) {
|
||||
- this.setResting(false);
|
||||
+ // CraftBukkit Start - Call BatToggleSleepEvent
|
||||
+ if (CraftEventFactory.handleBatToggleSleepEvent(this, true)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
@@ -29,12 +29,19 @@
|
||||
@@ -30,12 +30,19 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
|
||||
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -71,6 +78,9 @@
|
||||
@@ -72,6 +79,9 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
@@ -80,6 +90,7 @@
|
||||
@@ -81,6 +91,7 @@
|
||||
return super.hurt(damagesource, f);
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@
|
|||
|
||||
@Override
|
||||
public float getWalkTargetValue(BlockPosition blockposition, IWorldReader iworldreader) {
|
||||
@@ -174,10 +185,17 @@
|
||||
@@ -175,10 +186,17 @@
|
||||
}
|
||||
|
||||
public void setInLove(@Nullable EntityHuman entityhuman) {
|
||||
|
@ -55,41 +55,45 @@
|
|||
}
|
||||
+ this.breedItem = entityhuman.getInventory().getSelected(); // CraftBukkit
|
||||
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
}
|
||||
@@ -222,6 +240,16 @@
|
||||
if (entityplayer == null && entityanimal.getLoveCause() != null) {
|
||||
entityplayer = entityanimal.getLoveCause();
|
||||
}
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ entityageable.setBaby(true);
|
||||
+ entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
+ int experience = this.getRandom().nextInt(7) + 1;
|
||||
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this, entityanimal, entityplayer, this.breedItem, experience);
|
||||
+ if (entityBreedEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ experience = entityBreedEvent.getExperience();
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (entityplayer != null) {
|
||||
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -232,12 +260,14 @@
|
||||
entityanimal.setAge(6000);
|
||||
this.resetLove();
|
||||
entityanimal.resetLove();
|
||||
- entityageable.setBaby(true);
|
||||
- entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
@@ -221,14 +239,23 @@
|
||||
entityageable.setBaby(true);
|
||||
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
this.finalizeSpawnChildFromBreeding(worldserver, entityanimal, entityageable);
|
||||
- worldserver.addFreshEntityWithPassengers(entityageable);
|
||||
+ worldserver.addFreshEntityWithPassengers(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
|
||||
worldserver.broadcastEntityEvent(this, (byte) 18);
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
+ worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void finalizeSpawnChildFromBreeding(WorldServer worldserver, EntityAnimal entityanimal, @Nullable EntityAgeable entityageable) {
|
||||
- Optional.ofNullable(this.getLoveCause()).or(() -> {
|
||||
+ // CraftBukkit start - call EntityBreedEvent
|
||||
+ Optional<EntityPlayer> cause = Optional.ofNullable(this.getLoveCause()).or(() -> {
|
||||
return Optional.ofNullable(entityanimal.getLoveCause());
|
||||
- }).ifPresent((entityplayer) -> {
|
||||
+ });
|
||||
+ int experience = this.getRandom().nextInt(7) + 1;
|
||||
+ org.bukkit.event.entity.EntityBreedEvent entityBreedEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityBreedEvent(entityageable, this, entityanimal, cause.orElse(null), this.breedItem, experience);
|
||||
+ if (entityBreedEvent.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ experience = entityBreedEvent.getExperience();
|
||||
+ cause.ifPresent((entityplayer) -> {
|
||||
+ // CraftBukkit end
|
||||
entityplayer.awardStat(StatisticList.ANIMALS_BRED);
|
||||
CriterionTriggers.BRED_ANIMALS.trigger(entityplayer, this, entityanimal, entityageable);
|
||||
});
|
||||
@@ -238,7 +265,11 @@
|
||||
entityanimal.resetLove();
|
||||
worldserver.broadcastEntityEvent(this, (byte) 18);
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
- worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), this.getRandom().nextInt(7) + 1));
|
||||
+ // CraftBukkit start - use event experience
|
||||
+ if (experience > 0) {
|
||||
+ worldserver.addFreshEntity(new EntityExperienceOrb(worldserver, this.getX(), this.getY(), this.getZ(), experience));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -243,7 +243,7 @@
|
||||
@@ -242,7 +242,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
|
@ -9,15 +9,15 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -641,11 +641,15 @@
|
||||
@@ -640,11 +640,15 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
- if (!this.level.isClientSide) {
|
||||
- if (!this.level().isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ boolean result = super.hurt(damagesource, f);
|
||||
+
|
||||
+ if (result && !this.level.isClientSide) {
|
||||
+ if (result && !this.level().isClientSide) {
|
||||
this.beePollinateGoal.stopPollinating();
|
||||
}
|
||||
|
||||
|
@ -27,16 +27,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1221,7 +1225,7 @@
|
||||
@@ -1216,7 +1220,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (flag) {
|
||||
+ if (flag && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1)).isCancelled()) { // Spigot
|
||||
EntityBee.this.level.levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.setValue(blockstateinteger, (Integer) iblockdata.getValue(blockstateinteger) + 1));
|
||||
- if (iblockdata1 != null) {
|
||||
+ if (iblockdata1 != null&& !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata1).isCancelled()) { // CraftBukkit
|
||||
EntityBee.this.level().levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1294,7 +1298,7 @@
|
||||
@@ -1289,7 +1293,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1303,7 +1307,7 @@
|
||||
@@ -1298,7 +1302,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -469,7 +469,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
|
@ -22,15 +22,15 @@
|
|||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
- this.cat.level.addFreshEntity(new EntityItem(this.cat.level, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack));
|
||||
- this.cat.level().addFreshEntity(new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.cat.level, (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
|
||||
+ EntityItem entityitem = new EntityItem(this.cat.level(), (double) blockposition_mutableblockposition.getX() - (double) MathHelper.sin(this.cat.yBodyRot * 0.017453292F), (double) blockposition_mutableblockposition.getY(), (double) blockposition_mutableblockposition.getZ() + (double) MathHelper.cos(this.cat.yBodyRot * 0.017453292F), itemstack);
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.cat.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ entityitem.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ entityitem.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.cat.level.addFreshEntity(entityitem);
|
||||
+ this.cat.level().addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
@@ -96,7 +96,9 @@
|
||||
this.flap += this.flapping * 2.0F;
|
||||
if (!this.level.isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
if (!this.level().isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.EGG);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
|
@ -29,4 +29,4 @@
|
|||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
@Override
|
||||
public boolean canUse() {
|
||||
- return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100;
|
||||
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level.getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
||||
+ return this.dolphin.gotFish() && this.dolphin.getAirSupply() >= 100 && this.dolphin.level().getWorld().canGenerateStructures(); // MC-151364, SPIGOT-5494: hangs if generate-structures=false
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@
|
|||
@@ -508,7 +520,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level.random.nextInt(6) == 0) {
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
- this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin);
|
||||
+ this.player.addEffect(new MobEffect(MobEffects.DOLPHINS_GRACE, 100), this.dolphin, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.DOLPHIN); // CraftBukkit
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
int j = 1 + EntityFox.this.level.random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
||||
|
||||
@@ -1441,7 +1459,7 @@
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -105,7 +105,7 @@
|
||||
@@ -102,7 +102,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
@@ -115,6 +122,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
} else if (itemstack.is(Items.SHEARS) && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
|
@ -25,11 +25,11 @@
|
|||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -165,7 +177,7 @@
|
||||
|
||||
if (entitycow != null) {
|
||||
((WorldServer) this.level).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
((WorldServer) this.level()).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
- this.discard();
|
||||
+ // this.discard(); // CraftBukkit - moved down
|
||||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
|
@ -39,26 +39,26 @@
|
|||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
- this.level.addFreshEntity(entitycow);
|
||||
- this.level().addFreshEntity(entitycow);
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callEntityTransformEvent(this, entitycow, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+ this.level().addFreshEntity(entitycow, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SHEARED);
|
||||
+
|
||||
+ this.discard(); // CraftBukkit - from above
|
||||
+ // CraftBukkit end
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
- this.level.addFreshEntity(new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
- this.level().addFreshEntity(new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock())));
|
||||
+ // CraftBukkit start
|
||||
+ EntityItem entityitem = new EntityItem(this.level, this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityItem entityitem = new EntityItem(this.level(), this.getX(), this.getY(1.0D), this.getZ(), new ItemStack(this.getVariant().blockState.getBlock()));
|
||||
+ EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ this.level.addFreshEntity(entityitem);
|
||||
+ this.level().addFreshEntity(entityitem);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
@@ -177,7 +177,8 @@
|
||||
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) {
|
||||
if (!this.level().isClientSide) {
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level.broadcastEntityEvent(this, (byte) 41);
|
||||
this.level().broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -308,10 +309,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
@@ -1105,7 +1107,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).isAggressive()) {
|
||||
if (entityinsentient instanceof EntityPanda && entityinsentient.isAggressive()) {
|
||||
- entityinsentient.setTarget(entityliving);
|
||||
+ entityinsentient.setTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
@@ -261,7 +261,7 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- if (this.random.nextInt(10) == 0) {
|
||||
+ if (this.random.nextInt(10) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.level.broadcastEntityEvent(this, (byte) 7);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
} else {
|
||||
@@ -275,7 +275,7 @@
|
||||
itemstack.shrink(1);
|
||||
|
@ -30,7 +30,7 @@
|
|||
@@ -398,7 +398,7 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
@Override
|
||||
public void registerGoals() {
|
||||
@@ -570,9 +576,23 @@
|
||||
@@ -576,9 +582,23 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
|
||||
|
||||
if (i == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntitySheep.java
|
||||
@@ -63,6 +63,14 @@
|
||||
@@ -64,6 +64,14 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.level.storage.loot.LootTables;
|
||||
|
||||
|
@ -15,10 +15,10 @@
|
|||
public class EntitySheep extends EntityAnimal implements IShearable {
|
||||
|
||||
private static final int EAT_ANIMATION_TICKS = 40;
|
||||
@@ -243,6 +251,11 @@
|
||||
@@ -244,6 +252,11 @@
|
||||
|
||||
if (itemstack.is(Items.SHEARS)) {
|
||||
if (!this.level.isClientSide && this.readyForShearing()) {
|
||||
if (!this.level().isClientSide && this.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.handlePlayerShearEntityEvent(entityhuman, this, itemstack, enumhand)) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
|
||||
@@ -264,7 +277,9 @@
|
||||
@@ -265,7 +278,9 @@
|
||||
int i = 1 + this.random.nextInt(3);
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
|
@ -37,29 +37,29 @@
|
|||
|
||||
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)));
|
||||
@@ -357,6 +372,12 @@
|
||||
@@ -358,6 +373,12 @@
|
||||
|
||||
@Override
|
||||
public void ate() {
|
||||
+ // CraftBukkit start
|
||||
+ SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) return;
|
||||
+ // CraftBukkit end
|
||||
super.ate();
|
||||
this.setSheared(false);
|
||||
if (this.isBaby()) {
|
||||
@@ -376,7 +397,7 @@
|
||||
@@ -377,7 +398,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((recipecrafting) -> {
|
||||
+ Optional<Item> optional = this.level.getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level).map((recipecrafting) -> { // CraftBukkit - decompile error
|
||||
return recipecrafting.assemble(inventorycrafting, this.level.registryAccess());
|
||||
- Optional optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> {
|
||||
+ Optional<Item> optional = this.level().getRecipeManager().getRecipeFor(Recipes.CRAFTING, inventorycrafting, this.level()).map((recipecrafting) -> { // CraftBukkit - decompile error
|
||||
return recipecrafting.assemble(inventorycrafting, this.level().registryAccess());
|
||||
}).map(ItemStack::getItem);
|
||||
|
||||
@@ -399,10 +420,18 @@
|
||||
@@ -400,10 +421,18 @@
|
||||
public boolean stillValid(EntityHuman entityhuman) {
|
||||
return false;
|
||||
}
|
||||
|
@ -72,9 +72,9 @@
|
|||
+ // CraftBukkit end
|
||||
}, 2, 1);
|
||||
|
||||
inventorycrafting.setItem(0, new ItemStack(ItemDye.byColor(enumcolor)));
|
||||
inventorycrafting.setItem(1, new ItemStack(ItemDye.byColor(enumcolor1)));
|
||||
+ inventorycrafting.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
|
||||
return inventorycrafting;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,24 +13,24 @@
|
|||
private static final DataWatcherObject<Byte> DATA_PUMPKIN_ID = DataWatcher.defineId(EntitySnowman.class, DataWatcherRegistry.BYTE);
|
||||
@@ -97,7 +101,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide) {
|
||||
if (this.level.getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (this.level().getBiome(this.blockPosition()).is(BiomeTags.SNOW_GOLEM_MELTS)) {
|
||||
- this.hurt(this.damageSources().onFire(), 1.0F);
|
||||
+ this.hurt(this.damageSources().melting, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
|
||||
}
|
||||
|
||||
if (!this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
if (!this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
||||
@@ -113,7 +117,11 @@
|
||||
BlockPosition blockposition = new BlockPosition(j, k, l);
|
||||
|
||||
if (this.level.getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level, blockposition)) {
|
||||
- this.level.setBlockAndUpdate(blockposition, iblockdata);
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
- this.level().setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level, blockposition, iblockdata, this)) {
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this.level(), blockposition, iblockdata, this)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
||||
this.level().gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.a.of(this, iblockdata));
|
||||
}
|
||||
}
|
||||
@@ -145,6 +153,11 @@
|
||||
|
@ -44,10 +44,10 @@
|
|||
+ // CraftBukkit end
|
||||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -164,7 +177,9 @@
|
||||
this.level.playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level.isClientSide()) {
|
||||
this.level().playSound((EntityHuman) null, (Entity) this, SoundEffects.SNOW_GOLEM_SHEAR, soundcategory, 1.0F, 1.0F);
|
||||
if (!this.level().isClientSide()) {
|
||||
this.setPumpkin(false);
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(new ItemStack(Items.CARVED_PUMPKIN), 1.7F);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
@@ -308,7 +308,9 @@
|
||||
protected void ageBoundaryReached() {
|
||||
super.ageBoundaryReached();
|
||||
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation(Items.SCUTE, 1);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
|
@ -22,7 +22,7 @@
|
|||
private static class e extends ControllerMove {
|
||||
@@ -487,12 +491,16 @@
|
||||
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
|
||||
World world = this.turtle.level;
|
||||
World world = this.turtle.level();
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
@@ -298,7 +321,7 @@
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
- this.setOrderedToSit(false);
|
||||
+ // this.setOrderedToSit(false); // CraftBukkit - moved into EntityLiving.damageEntity(DamageSource, float)
|
||||
}
|
||||
|
@ -55,31 +55,31 @@
|
|||
} else {
|
||||
this.getAttribute(GenericAttributes.MAX_HEALTH).setBaseValue(8.0D);
|
||||
}
|
||||
@@ -349,7 +372,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- this.heal((float) item.getFoodProperties().getNutrition());
|
||||
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -360,7 +383,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -382,7 +405,8 @@
|
||||
@@ -348,7 +371,7 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check.
|
||||
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.tame(entityhuman);
|
||||
- this.heal((float) item.getFoodProperties().getNutrition());
|
||||
+ this.heal((float) item.getFoodProperties().getNutrition(), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.EATING); // CraftBukkit
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
if (item instanceof ItemDye) {
|
||||
@@ -376,7 +399,7 @@
|
||||
this.setOrderedToSit(!this.isOrderedToSit());
|
||||
this.jumping = false;
|
||||
this.navigation.stop();
|
||||
this.setTarget((EntityLiving) null);
|
||||
- this.setTarget((EntityLiving) null);
|
||||
+ this.setTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else {
|
||||
return enuminteractionresult;
|
||||
@@ -387,7 +410,8 @@
|
||||
itemstack.shrink(1);
|
||||
}
|
||||
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ // CraftBukkit - added event call and isCancelled check.
|
||||
+ if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
|
||||
this.tame(entityhuman);
|
||||
this.navigation.stop();
|
||||
this.setTarget((EntityLiving) null);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
+++ b/net/minecraft/world/entity/animal/allay/Allay.java
|
||||
@@ -93,13 +93,14 @@
|
||||
private final DynamicGameEventListener<Allay.b> dynamicJukeboxListener;
|
||||
private final DynamicGameEventListener<Allay.a> dynamicJukeboxListener;
|
||||
private final InventorySubcontainer inventory = new InventorySubcontainer(1);
|
||||
@Nullable
|
||||
- private BlockPosition jukeboxPos;
|
||||
|
@ -17,8 +17,8 @@
|
|||
|
||||
public Allay(EntityTypes<? extends Allay> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -112,6 +113,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.b(entitypositionsource, GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
|
||||
@@ -111,6 +112,12 @@
|
||||
this.dynamicJukeboxListener = new DynamicGameEventListener<>(new Allay.a(this.vibrationUser.getPositionSource(), GameEvent.JUKEBOX_PLAY.getNotificationRadius()));
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -30,7 +30,7 @@
|
|||
@Override
|
||||
protected BehaviorController.b<Allay> brainProvider() {
|
||||
return BehaviorController.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES);
|
||||
@@ -124,7 +131,7 @@
|
||||
@@ -123,7 +130,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Allay> getBrain() {
|
||||
|
@ -39,16 +39,16 @@
|
|||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -231,7 +238,7 @@
|
||||
@@ -230,7 +237,7 @@
|
||||
public void aiStep() {
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
if (!this.level().isClientSide && this.isAlive() && this.tickCount % 10 == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit
|
||||
}
|
||||
|
||||
if (this.isDancing() && this.shouldStopDancing() && this.tickCount % 20 == 0) {
|
||||
@@ -301,7 +308,12 @@
|
||||
@@ -300,7 +307,12 @@
|
||||
ItemStack itemstack1 = this.getItemInHand(EnumHand.MAIN_HAND);
|
||||
|
||||
if (this.isDancing() && this.isDuplicationItem(itemstack) && this.canDuplicate()) {
|
||||
|
@ -59,59 +59,59 @@
|
|||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.level.broadcastEntityEvent(this, (byte) 18);
|
||||
this.level.playSound(entityhuman, (Entity) this, SoundEffects.AMETHYST_BLOCK_CHIME, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
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);
|
||||
@@ -313,7 +325,7 @@
|
||||
@@ -311,7 +323,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);
|
||||
this.level().playSound(entityhuman, (Entity) this, SoundEffects.ALLAY_ITEM_GIVEN, SoundCategory.NEUTRAL, 2.0F, 1.0F);
|
||||
- this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, (Object) entityhuman.getUUID());
|
||||
+ this.getBrain().setMemory(MemoryModuleType.LIKED_PLAYER, entityhuman.getUUID()); // CraftBukkit - decompile error
|
||||
return EnumInteractionResult.SUCCESS;
|
||||
} else if (!itemstack1.isEmpty() && enumhand == EnumHand.MAIN_HAND && itemstack.isEmpty()) {
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, ItemStack.EMPTY);
|
||||
@@ -434,6 +446,7 @@
|
||||
@@ -432,6 +444,7 @@
|
||||
}
|
||||
|
||||
private boolean shouldStopDancing() {
|
||||
+ if (this.forceDancing) {return false;} // CraftBukkit
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level.getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
return this.jukeboxPos == null || !this.jukeboxPos.closerToCenterThan(this.position(), (double) GameEvent.JUKEBOX_PLAY.getNotificationRadius()) || !this.level().getBlockState(this.jukeboxPos).is(Blocks.JUKEBOX);
|
||||
}
|
||||
|
||||
@@ -478,7 +491,7 @@
|
||||
@@ -476,7 +489,7 @@
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
this.writeInventoryToTag(nbttagcompound);
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener());
|
||||
+ DataResult<net.minecraft.nbt.NBTBase> dataresult = VibrationListener.codec(this.vibrationListenerConfig).encodeStart(DynamicOpsNBT.INSTANCE, (VibrationListener) this.dynamicVibrationListener.getListener()); // CraftBukkit - decompile error
|
||||
- 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);
|
||||
@@ -494,7 +507,7 @@
|
||||
@@ -492,7 +505,7 @@
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.readInventoryFromTag(nbttagcompound);
|
||||
if (nbttagcompound.contains("listener", 10)) {
|
||||
- DataResult dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
|
||||
+ DataResult<VibrationListener> dataresult = VibrationListener.codec(this.vibrationListenerConfig).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener"))); // CraftBukkit - decompile error
|
||||
- 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);
|
||||
@@ -527,7 +540,7 @@
|
||||
@@ -525,7 +538,7 @@
|
||||
return Allay.DUPLICATION_ITEM.test(itemstack);
|
||||
}
|
||||
|
||||
- private void duplicateAllay() {
|
||||
+ public Allay duplicateAllay() { // CraftBukkit - return allay and private -> public
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level);
|
||||
Allay allay = (Allay) EntityTypes.ALLAY.create(this.level());
|
||||
|
||||
if (allay != null) {
|
||||
@@ -535,17 +548,17 @@
|
||||
@@ -533,17 +546,17 @@
|
||||
allay.setPersistenceRequired();
|
||||
allay.resetDuplicationCooldown();
|
||||
this.resetDuplicationCooldown();
|
||||
- this.level.addFreshEntity(allay);
|
||||
+ this.level.addFreshEntity(allay, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DUPLICATION); // CraftBukkit - reason for duplicated allay
|
||||
- this.level().addFreshEntity(allay);
|
||||
+ this.level().addFreshEntity(allay, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DUPLICATION); // CraftBukkit - reason for duplicated allay
|
||||
}
|
||||
-
|
||||
+ return allay; // CraftBukkit
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
+ // CraftBukkit start - Got milk?
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level, entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.level(), entityhuman, this.blockPosition(), this.blockPosition(), null, itemstack, Items.MILK_BUCKET, enumhand);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return EnumInteractionResult.PASS;
|
||||
|
@ -37,4 +37,4 @@
|
|||
+ ItemStack itemstack1 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, CraftItemStack.asNMSCopy(event.getItemStack())); // CraftBukkit
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level.isClientSide);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
protected EntityHorseAbstract(EntityTypes<? extends EntityHorseAbstract> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -338,7 +341,7 @@
|
||||
@@ -334,7 +337,7 @@
|
||||
public void createInventory() {
|
||||
InventorySubcontainer inventorysubcontainer = this.inventory;
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
|||
|
||||
@@ -590,7 +593,7 @@
|
||||
super.aiStep();
|
||||
if (!this.level.isClientSide && this.isAlive()) {
|
||||
if (!this.level().isClientSide && this.isAlive()) {
|
||||
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
|
||||
- this.heal(1.0F);
|
||||
+ this.heal(1.0F, RegainReason.REGEN); // CraftBukkit
|
||||
|
|
|
@ -1,22 +1,24 @@
|
|||
--- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
+++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java
|
||||
@@ -75,12 +75,21 @@
|
||||
@@ -82,14 +82,23 @@
|
||||
|
||||
public Sniffer(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
- this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING);
|
||||
- this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
|
||||
- this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
|
||||
+ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING); // CraftBukkit - moved down to appropriate location
|
||||
+ // this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING); // CraftBukkit - moved down to appropriate location
|
||||
+ // this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0); // CraftBukkit - moved down to appropriate location
|
||||
this.getNavigation().setCanFloat(true);
|
||||
this.setPathfindingMalus(PathType.WATER, -2.0F);
|
||||
this.setPathfindingMalus(PathType.WATER, -1.0F);
|
||||
this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F);
|
||||
this.setPathfindingMalus(PathType.DAMAGE_CAUTIOUS, -1.0F);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-7295: moved from constructor to appropriate location
|
||||
+ @Override
|
||||
+ protected void defineSynchedData() {
|
||||
+ super.defineSynchedData();
|
||||
+ this.entityData.define(Sniffer.DATA_STATE, Sniffer.a.IDLING);
|
||||
+ this.entityData.define(Sniffer.DATA_STATE, Sniffer.State.IDLING);
|
||||
+ this.entityData.define(Sniffer.DATA_DROP_SEED_AT_TICK, 0);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -24,67 +26,30 @@
|
|||
@Override
|
||||
protected float getStandingEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
return this.getDimensions(entitypose).height * 0.6F;
|
||||
@@ -114,7 +123,7 @@
|
||||
return BlockPosition.containing(vec3d.x(), this.getY(), vec3d.z());
|
||||
}
|
||||
@@ -270,6 +279,13 @@
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
EntityItem entityitem = new EntityItem(worldserver, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
- private Sniffer.a getState() {
|
||||
+ public Sniffer.a getState() { // PAIL private -> public
|
||||
return (Sniffer.a) this.entityData.get(Sniffer.DATA_STATE);
|
||||
}
|
||||
+ // CraftBukkit start - handle EntityDropItemEvent
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
worldserver.addFreshEntity(entityitem);
|
||||
}
|
||||
@@ -309,7 +325,7 @@
|
||||
List<GlobalPos> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
|
||||
|
||||
@@ -207,7 +216,7 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
- Optional<BlockPosition> calculateDigPosition() {
|
||||
+ public Optional<BlockPosition> calculateDigPosition() { // PAIL public
|
||||
return IntStream.range(0, 5).mapToObj((i) -> {
|
||||
return LandRandomPos.getPos(this, 10 + 2 * i, 3);
|
||||
}).filter(Objects::nonNull).map(BlockPosition::containing).map(BlockPosition::below).filter(this::canDig).findFirst();
|
||||
@@ -218,7 +227,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
- boolean canDig() {
|
||||
+ public boolean canDig() { // PAIL public
|
||||
return !this.isPanicking() && !this.isBaby() && !this.isInWater() && this.canDig(this.getHeadPosition().below());
|
||||
}
|
||||
|
||||
@@ -245,6 +254,13 @@
|
||||
BlockPosition blockposition = this.getHeadPosition();
|
||||
EntityItem entityitem = new EntityItem(this.level, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), itemstack);
|
||||
|
||||
+ // CraftBukkit start - handle EntityDropItemEvent
|
||||
+ org.bukkit.event.entity.EntityDropItemEvent event = new org.bukkit.event.entity.EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) entityitem.getBukkitEntity());
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
this.level.addFreshEntity(entityitem);
|
||||
this.playSound(SoundEffects.SNIFFER_DROP_SEED, 1.0F, 1.0F);
|
||||
@@ -274,15 +290,15 @@
|
||||
return this;
|
||||
}
|
||||
|
||||
- private Sniffer storeExploredPosition(BlockPosition blockposition) {
|
||||
+ public Sniffer storeExploredPosition(BlockPosition blockposition) { // PAIL private -> public
|
||||
List<BlockPosition> list = (List) this.getExploredPositions().limit(20L).collect(Collectors.toList());
|
||||
|
||||
list.add(0, blockposition);
|
||||
list.add(0, GlobalPos.of(this.level().dimension(), blockposition));
|
||||
- this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, (Object) list);
|
||||
+ this.getBrain().setMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS, list); // CraftBukkit - decompile error
|
||||
return this;
|
||||
}
|
||||
|
||||
- private Stream<BlockPosition> getExploredPositions() {
|
||||
+ public Stream<BlockPosition> getExploredPositions() { // PAIL private -> public
|
||||
return this.getBrain().getMemory(MemoryModuleType.SNIFFER_EXPLORED_POSITIONS).stream().flatMap(Collection::stream);
|
||||
}
|
||||
|
||||
@@ -416,7 +432,7 @@
|
||||
@@ -461,7 +477,7 @@
|
||||
|
||||
@Override
|
||||
public BehaviorController<Sniffer> getBrain() {
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
@@ -55,7 +60,11 @@
|
||||
BlockPosition blockposition = this.blockPosition();
|
||||
|
||||
if (((WorldServer) this.level).dragonFight() != null && this.level.getBlockState(blockposition).isAir()) {
|
||||
- this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
|
||||
if (((WorldServer) this.level()).getDragonFight() != null && this.level().getBlockState(blockposition).isAir()) {
|
||||
- this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
||||
+ // CraftBukkit start
|
||||
+ if (!CraftEventFactory.callBlockIgniteEvent(this.level, blockposition, this).isCancelled()) {
|
||||
+ this.level.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level, blockposition));
|
||||
+ if (!CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) {
|
||||
+ this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -28,7 +28,7 @@
|
|||
@@ -95,11 +104,24 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level.isClientSide) {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
+ // CraftBukkit start - All non-living entities need this
|
||||
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false)) {
|
||||
+ return false;
|
||||
|
@ -38,15 +38,15 @@
|
|||
if (!damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
DamageSource damagesource1 = damagesource.getEntity() != null ? this.damageSources().explosion(this, damagesource.getEntity()) : null;
|
||||
|
||||
- this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
- this.level().explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), 6.0F, false, World.a.BLOCK);
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.unsetRemoved();
|
||||
+ return false;
|
||||
+ }
|
||||
+ this.level.explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ this.level().explode(this, damagesource1, (ExplosionDamageCalculator) null, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.BLOCK);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
+++ b/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java
|
||||
@@ -51,6 +51,18 @@
|
||||
@@ -51,6 +51,19 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
|||
+import net.minecraft.world.level.Explosion;
|
||||
+import net.minecraft.world.level.block.Block;
|
||||
+import net.minecraft.world.level.block.entity.TileEntity;
|
||||
+import net.minecraft.world.level.storage.loot.LootParams;
|
||||
+import net.minecraft.world.level.storage.loot.LootTableInfo;
|
||||
+import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
+import org.bukkit.craftbukkit.block.CraftBlock;
|
||||
|
@ -19,23 +20,23 @@
|
|||
public class EntityEnderDragon extends EntityInsentient implements IMonster {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -87,6 +99,7 @@
|
||||
private final PathPoint[] nodes = new PathPoint[24];
|
||||
private final int[] nodeAdjacency = new int[24];
|
||||
private final Path openSet = new Path();
|
||||
@@ -88,6 +101,7 @@
|
||||
private final PathPoint[] nodes;
|
||||
private final int[] nodeAdjacency;
|
||||
private final Path openSet;
|
||||
+ private final Explosion explosionSource; // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
|
||||
|
||||
public EntityEnderDragon(EntityTypes<? extends EntityEnderDragon> entitytypes, World world) {
|
||||
super(EntityTypes.ENDER_DRAGON, world);
|
||||
@@ -101,6 +114,7 @@
|
||||
}
|
||||
|
||||
@@ -109,6 +123,7 @@
|
||||
this.noPhysics = true;
|
||||
this.noCulling = true;
|
||||
this.phaseManager = new DragonControllerManager(this);
|
||||
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY); // CraftBukkit
|
||||
}
|
||||
|
||||
public static AttributeProvider.Builder createAttributes() {
|
||||
@@ -234,7 +248,7 @@
|
||||
public void setDragonFight(EnderDragonBattle enderdragonbattle) {
|
||||
@@ -267,7 +282,7 @@
|
||||
|
||||
Vec3D vec3d1 = idragoncontroller.getFlyTargetLocation();
|
||||
|
||||
|
@ -44,14 +45,14 @@
|
|||
d0 = vec3d1.x - this.getX();
|
||||
d1 = vec3d1.y - this.getY();
|
||||
d2 = vec3d1.z - this.getZ();
|
||||
@@ -375,7 +389,14 @@
|
||||
@@ -408,7 +423,14 @@
|
||||
if (this.nearestCrystal.isRemoved()) {
|
||||
this.nearestCrystal = null;
|
||||
} else if (this.tickCount % 10 == 0 && this.getHealth() < this.getMaxHealth()) {
|
||||
- this.setHealth(this.getHealth() + 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0F, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
|
||||
|
@ -60,7 +61,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -450,6 +471,9 @@
|
||||
@@ -483,6 +505,9 @@
|
||||
int j1 = MathHelper.floor(axisalignedbb.maxZ);
|
||||
boolean flag = false;
|
||||
boolean flag1 = false;
|
||||
|
@ -70,20 +71,20 @@
|
|||
|
||||
for (int k1 = i; k1 <= l; ++k1) {
|
||||
for (int l1 = j; l1 <= i1; ++l1) {
|
||||
@@ -459,7 +483,11 @@
|
||||
@@ -492,7 +517,11 @@
|
||||
|
||||
if (!iblockdata.isAir() && !iblockdata.is(TagsBlock.DRAGON_TRANSPARENT)) {
|
||||
if (this.level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
|
||||
- flag1 = this.level.removeBlock(blockposition, false) || flag1;
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && !iblockdata.is(TagsBlock.DRAGON_IMMUNE)) {
|
||||
- flag1 = this.level().removeBlock(blockposition, false) || flag1;
|
||||
+ // CraftBukkit start - Add blocks to list rather than destroying them
|
||||
+ // flag1 = this.level.removeBlock(blockposition, false) || flag1;
|
||||
+ // flag1 = this.level().removeBlock(blockposition, false) || flag1;
|
||||
+ flag1 = true;
|
||||
+ destroyedBlocks.add(CraftBlock.at(level, blockposition));
|
||||
+ destroyedBlocks.add(CraftBlock.at(this.level(), blockposition));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
flag = true;
|
||||
}
|
||||
@@ -468,6 +496,51 @@
|
||||
@@ -501,6 +530,51 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,7 +104,7 @@
|
|||
+ } else if (event.getYield() == 0F) {
|
||||
+ // Yield zero ==> no drops
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
+ this.level.removeBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
|
||||
+ this.level().removeBlock(new BlockPosition(block.getX(), block.getY(), block.getZ()), false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ for (org.bukkit.block.Block block : event.blockList()) {
|
||||
|
@ -117,17 +118,17 @@
|
|||
+
|
||||
+ Block nmsBlock = craftBlock.getNMS().getBlock();
|
||||
+ if (nmsBlock.dropFromExplosion(explosionSource)) {
|
||||
+ TileEntity tileentity = craftBlock.getNMS().hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
|
||||
+ LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.level)).withRandom(this.level.random).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity);
|
||||
+ TileEntity tileentity = craftBlock.getNMS().hasBlockEntity() ? this.level().getBlockEntity(blockposition) : null;
|
||||
+ LootParams.a loottableinfo_builder = (new LootParams.a((WorldServer) this.level())).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / event.getYield()).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity);
|
||||
+
|
||||
+ craftBlock.getNMS().getDrops(loottableinfo_builder).forEach((itemstack) -> {
|
||||
+ Block.popResource(level, blockposition, itemstack);
|
||||
+ Block.popResource(this.level(), blockposition, itemstack);
|
||||
+ });
|
||||
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) level, blockposition, ItemStack.EMPTY, false);
|
||||
+ craftBlock.getNMS().spawnAfterBreak((WorldServer) this.level(), blockposition, ItemStack.EMPTY, false);
|
||||
+ }
|
||||
+ nmsBlock.wasExploded(level, blockposition, explosionSource);
|
||||
+ nmsBlock.wasExploded(this.level(), blockposition, explosionSource);
|
||||
+
|
||||
+ this.level.removeBlock(blockposition, false);
|
||||
+ this.level().removeBlock(blockposition, false);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
@ -135,7 +136,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));
|
||||
|
||||
@@ -532,6 +605,21 @@
|
||||
@@ -565,6 +639,21 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -143,7 +144,7 @@
|
|||
+ @Override
|
||||
+ public int getExpReward() {
|
||||
+ // CraftBukkit - Moved from #tickDeath method
|
||||
+ boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
+ boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
+ short short0 = 500;
|
||||
+
|
||||
+ if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
||||
|
@ -157,13 +158,13 @@
|
|||
@Override
|
||||
protected void tickDeath() {
|
||||
if (this.dragonFight != null) {
|
||||
@@ -547,15 +635,20 @@
|
||||
this.level.addParticle(Particles.EXPLOSION_EMITTER, this.getX() + (double) f, this.getY() + 2.0D + (double) f1, this.getZ() + (double) f2, 0.0D, 0.0D, 0.0D);
|
||||
@@ -580,15 +669,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);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - SPIGOT-2420: Moved up to #getExpReward method
|
||||
+ /*
|
||||
boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT);
|
||||
short short0 = 500;
|
||||
|
||||
if (this.dragonFight != null && !this.dragonFight.hasPreviouslyKilledDragon()) {
|
||||
|
@ -173,22 +174,22 @@
|
|||
+ int short0 = expToDrop;
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (this.level instanceof WorldServer) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
- if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && flag) {
|
||||
+ if (this.dragonDeathTime > 150 && this.dragonDeathTime % 5 == 0 && true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
||||
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.08F));
|
||||
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.08F));
|
||||
}
|
||||
|
||||
@@ -566,7 +659,7 @@
|
||||
@@ -599,7 +693,7 @@
|
||||
|
||||
this.move(EnumMoveType.SELF, new Vec3D(0.0D, 0.10000000149011612D, 0.0D));
|
||||
if (this.dragonDeathTime == 200 && this.level instanceof WorldServer) {
|
||||
if (this.dragonDeathTime == 200 && this.level() instanceof WorldServer) {
|
||||
- if (flag) {
|
||||
+ if (true) { // CraftBukkit - SPIGOT-2420: Already checked for the game rule when calculating the xp
|
||||
EntityExperienceOrb.award((WorldServer) this.level, this.position(), MathHelper.floor((float) short0 * 0.2F));
|
||||
EntityExperienceOrb.award((WorldServer) this.level(), this.position(), MathHelper.floor((float) short0 * 0.2F));
|
||||
}
|
||||
|
||||
@@ -787,6 +880,7 @@
|
||||
@@ -820,6 +914,7 @@
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
nbttagcompound.putInt("DragonPhase", this.phaseManager.getCurrentPhase().getPhase().getId());
|
||||
nbttagcompound.putInt("DragonDeathTime", this.dragonDeathTime);
|
||||
|
@ -196,7 +197,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -800,6 +894,11 @@
|
||||
@@ -833,6 +928,11 @@
|
||||
this.dragonDeathTime = nbttagcompound.getInt("DragonDeathTime");
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
+ (this.currentPhase == null) ? null : CraftEnderDragon.getBukkitPhase(this.currentPhase.getPhase()),
|
||||
+ CraftEnderDragon.getBukkitPhase(dragoncontrollerphase)
|
||||
+ );
|
||||
+ this.dragon.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.dragon.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
|
@ -30,7 +30,7 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
this.currentPhase = this.getPhase(dragoncontrollerphase);
|
||||
if (!this.dragon.level.isClientSide) {
|
||||
if (!this.dragon.level().isClientSide) {
|
||||
this.dragon.getEntityData().set(EntityEnderDragon.DATA_PHASE, dragoncontrollerphase.getId());
|
||||
@@ -45,6 +63,6 @@
|
||||
this.phases[i] = dragoncontrollerphase.createInstance(this.dragon);
|
||||
|
|
|
@ -22,22 +22,22 @@
|
|||
i = this.getInvulnerableTicks() - 1;
|
||||
this.bossEvent.setProgress(1.0F - (float) i / 220.0F);
|
||||
if (i <= 0) {
|
||||
- this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
- this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // CraftBukkit start
|
||||
+ // this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ // this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), 7.0F, false, World.a.MOB);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.level().explode(this, this.getX(), this.getEyeY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (!this.isSilent()) {
|
||||
- this.level.globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
- this.level().globalLevelEvent(1023, this.blockPosition(), 0);
|
||||
+ // CraftBukkit start - Use relative location for far away sounds
|
||||
+ // this.world.globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.level).getCraftServer().getViewDistance() * 16;
|
||||
+ // this.level().globalLevelEvent(1023, new BlockPosition(this), 0);
|
||||
+ int viewDistance = ((WorldServer) this.level()).getCraftServer().getViewDistance() * 16;
|
||||
+ for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) {
|
||||
+ double deltaX = this.getX() - player.getX();
|
||||
+ double deltaZ = this.getZ() - player.getZ();
|
||||
|
@ -71,7 +71,7 @@
|
|||
}
|
||||
}
|
||||
@@ -331,6 +368,11 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
if (canDestroy(iblockdata)) {
|
||||
+ // CraftBukkit start
|
||||
|
@ -79,7 +79,7 @@
|
|||
+ continue;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
@@ -344,7 +386,7 @@
|
||||
|
|
|
@ -53,11 +53,13 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -403,6 +426,22 @@
|
||||
@@ -401,7 +424,25 @@
|
||||
return false;
|
||||
} else {
|
||||
ItemStack itemstack2;
|
||||
} else if (itemstack1.isEmpty() && (this.disabledSlots & 1 << enumitemslot.getFilterFlag() + 16) != 0) {
|
||||
return false;
|
||||
- } else if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ } else {
|
||||
+ org.bukkit.inventory.ItemStack armorStandItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+ org.bukkit.inventory.ItemStack playerHeldItem = CraftItemStack.asCraftMirror(itemstack);
|
||||
+
|
||||
|
@ -66,19 +68,28 @@
|
|||
+
|
||||
+ EquipmentSlot slot = CraftEquipmentSlot.getSlot(enumitemslot);
|
||||
+ EquipmentSlot hand = CraftEquipmentSlot.getHand(enumhand);
|
||||
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player,self,playerHeldItem,armorStandItem,slot,hand);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(armorStandManipulateEvent);
|
||||
+ PlayerArmorStandManipulateEvent armorStandManipulateEvent = new PlayerArmorStandManipulateEvent(player, self, playerHeldItem, armorStandItem, slot, hand);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(armorStandManipulateEvent);
|
||||
+
|
||||
+ if (armorStandManipulateEvent.isCancelled()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||
+ // CraftBukkit end
|
||||
this.setItemSlot(enumitemslot, itemstack.copyWithCount(1));
|
||||
return true;
|
||||
} else if (!itemstack.isEmpty() && itemstack.getCount() > 1) {
|
||||
@@ -416,15 +457,26 @@
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
return true;
|
||||
}
|
||||
+ } // CraftBukkit
|
||||
}
|
||||
|
||||
if (entityhuman.getAbilities().instabuild && itemstack1.isEmpty() && !itemstack.isEmpty()) {
|
||||
itemstack2 = itemstack.copy();
|
||||
@@ -431,9 +470,19 @@
|
||||
@Override
|
||||
public boolean hurt(DamageSource damagesource, float f) {
|
||||
if (!this.level.isClientSide && !this.isRemoved()) {
|
||||
if (!this.level().isClientSide && !this.isRemoved()) {
|
||||
if (damagesource.is(DamageTypeTags.BYPASSES_INVULNERABILITY)) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
|
||||
|
@ -97,7 +108,7 @@
|
|||
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
|
||||
this.brokenByAnything(damagesource);
|
||||
this.kill();
|
||||
@@ -482,7 +531,7 @@
|
||||
@@ -473,7 +525,7 @@
|
||||
} else {
|
||||
this.brokenByPlayer(damagesource);
|
||||
this.showBreakingParticles();
|
||||
|
@ -106,11 +117,11 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -550,13 +599,13 @@
|
||||
@@ -541,13 +593,13 @@
|
||||
itemstack.setHoverName(this.getCustomName());
|
||||
}
|
||||
|
||||
- Block.popResource(this.level, this.blockPosition(), itemstack);
|
||||
- Block.popResource(this.level(), this.blockPosition(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.brokenByAnything(damagesource);
|
||||
}
|
||||
|
@ -122,20 +133,20 @@
|
|||
|
||||
ItemStack itemstack;
|
||||
int i;
|
||||
@@ -564,7 +613,7 @@
|
||||
@@ -555,7 +607,7 @@
|
||||
for (i = 0; i < this.handItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.handItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- Block.popResource(this.level, this.blockPosition().above(), itemstack);
|
||||
- Block.popResource(this.level(), this.blockPosition().above(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.handItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
@@ -572,10 +621,11 @@
|
||||
@@ -563,10 +615,11 @@
|
||||
for (i = 0; i < this.armorItems.size(); ++i) {
|
||||
itemstack = (ItemStack) this.armorItems.get(i);
|
||||
if (!itemstack.isEmpty()) {
|
||||
- Block.popResource(this.level, this.blockPosition().above(), itemstack);
|
||||
- Block.popResource(this.level(), this.blockPosition().above(), itemstack);
|
||||
+ drops.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asBukkitCopy(itemstack)); // CraftBukkit - add to drops
|
||||
this.armorItems.set(i, ItemStack.EMPTY);
|
||||
}
|
||||
|
@ -144,7 +155,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -676,8 +726,16 @@
|
||||
@@ -667,8 +720,16 @@
|
||||
return this.isSmall();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
--- a/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
+++ b/net/minecraft/world/entity/decoration/EntityHanging.java
|
||||
@@ -26,6 +26,14 @@
|
||||
@@ -26,6 +26,13 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.tags.DamageTypeTags;
|
||||
+import net.minecraft.world.level.material.Material;
|
||||
+import org.bukkit.entity.Hanging;
|
||||
+import org.bukkit.event.hanging.HangingBreakByEntityEvent;
|
||||
+import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
|
@ -15,7 +14,7 @@
|
|||
public abstract class EntityHanging extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -60,26 +68,37 @@
|
||||
@@ -60,26 +67,37 @@
|
||||
|
||||
protected void recalculateBoundingBox() {
|
||||
if (this.direction != null) {
|
||||
|
@ -66,7 +65,7 @@
|
|||
d8 = 1.0D;
|
||||
} else {
|
||||
d6 = 1.0D;
|
||||
@@ -88,11 +107,12 @@
|
||||
@@ -88,11 +106,12 @@
|
||||
d6 /= 32.0D;
|
||||
d7 /= 32.0D;
|
||||
d8 /= 32.0D;
|
||||
|
@ -81,15 +80,15 @@
|
|||
return i % 32 == 0 ? 0.5D : 0.0D;
|
||||
}
|
||||
|
||||
@@ -103,6 +123,24 @@
|
||||
@@ -103,6 +122,24 @@
|
||||
if (this.checkInterval++ == 100) {
|
||||
this.checkInterval = 0;
|
||||
if (!this.isRemoved() && !this.survives()) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Material material = this.level.getBlockState(this.blockPosition()).getMaterial();
|
||||
+ IBlockData material = this.level().getBlockState(this.blockPosition());
|
||||
+ HangingBreakEvent.RemoveCause cause;
|
||||
+
|
||||
+ if (!material.equals(Material.AIR)) {
|
||||
+ if (!material.isAir()) {
|
||||
+ // TODO: This feels insufficient to catch 100% of suffocation cases
|
||||
+ cause = HangingBreakEvent.RemoveCause.OBSTRUCTION;
|
||||
+ } else {
|
||||
|
@ -97,7 +96,7 @@
|
|||
+ }
|
||||
+
|
||||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), cause);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (this.isRemoved() || event.isCancelled()) {
|
||||
+ return;
|
||||
|
@ -106,10 +105,10 @@
|
|||
this.discard();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -166,6 +204,22 @@
|
||||
@@ -166,6 +203,22 @@
|
||||
return false;
|
||||
} else {
|
||||
if (!this.isRemoved() && !this.level.isClientSide) {
|
||||
if (!this.isRemoved() && !this.level().isClientSide) {
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ Entity damager = (damagesource.isIndirect()) ? damagesource.getEntity() : damagesource.getDirectEntity();
|
||||
+ HangingBreakEvent event;
|
||||
|
@ -119,7 +118,7 @@
|
|||
+ event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), damagesource.is(DamageTypeTags.IS_EXPLOSION) ? HangingBreakEvent.RemoveCause.EXPLOSION : HangingBreakEvent.RemoveCause.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (this.isRemoved() || event.isCancelled()) {
|
||||
+ return true;
|
||||
|
@ -129,16 +128,16 @@
|
|||
this.kill();
|
||||
this.markHurt();
|
||||
this.dropItem(damagesource.getEntity());
|
||||
@@ -178,6 +232,18 @@
|
||||
@@ -178,6 +231,18 @@
|
||||
@Override
|
||||
public void move(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||
if (!this.level.isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
|
||||
if (!this.level().isClientSide && !this.isRemoved() && vec3d.lengthSqr() > 0.0D) {
|
||||
+ if (this.isRemoved()) return; // CraftBukkit
|
||||
+
|
||||
+ // CraftBukkit start - fire break events
|
||||
+ // TODO - Does this need its own cause? Seems to only be triggered by pistons
|
||||
+ HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.PHYSICS);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (this.isRemoved() || event.isCancelled()) {
|
||||
+ return;
|
||||
|
@ -148,12 +147,12 @@
|
|||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
@@ -186,7 +252,7 @@
|
||||
@@ -186,7 +251,7 @@
|
||||
|
||||
@Override
|
||||
public void push(double d0, double d1, double d2) {
|
||||
- if (!this.level.isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
+ if (false && !this.level.isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
|
||||
- if (!this.level().isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
+ if (false && !this.level().isClientSide && !this.isRemoved() && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
|
||||
this.kill();
|
||||
this.dropItem((Entity) null);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
@@ -173,6 +185,11 @@
|
||||
return false;
|
||||
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
+ // CraftBukkit start - fire EntityDamageEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.isRemoved()) {
|
||||
+ return true;
|
||||
|
@ -61,7 +61,7 @@
|
|||
this.dropItem(damagesource.getEntity(), false);
|
||||
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
|
||||
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
|
||||
@@ -302,6 +319,12 @@
|
||||
@@ -302,13 +319,19 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack, boolean flag) {
|
||||
|
@ -72,9 +72,8 @@
|
|||
+ public void setItem(ItemStack itemstack, boolean flag, boolean playSound) {
|
||||
+ // CraftBukkit end
|
||||
if (!itemstack.isEmpty()) {
|
||||
itemstack = itemstack.copy();
|
||||
itemstack.setCount(1);
|
||||
@@ -309,7 +332,7 @@
|
||||
itemstack = itemstack.copyWithCount(1);
|
||||
}
|
||||
|
||||
this.onItemChanged(itemstack);
|
||||
this.getEntityData().set(EntityItemFrame.DATA_ITEM, itemstack);
|
||||
|
|
|
@ -9,17 +9,6 @@
|
|||
public class EntityFallingBlock extends Entity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -57,8 +59,8 @@
|
||||
public boolean dropItem;
|
||||
private boolean cancelDrop;
|
||||
public boolean hurtEntities;
|
||||
- private int fallDamageMax;
|
||||
- private float fallDamagePerDistance;
|
||||
+ public int fallDamageMax;
|
||||
+ public float fallDamagePerDistance;
|
||||
@Nullable
|
||||
public NBTTagCompound blockData;
|
||||
protected static final DataWatcherObject<BlockPosition> DATA_START_POS = DataWatcher.defineId(EntityFallingBlock.class, DataWatcherRegistry.BLOCK_POS);
|
||||
@@ -83,10 +85,17 @@
|
||||
}
|
||||
|
||||
|
@ -49,24 +38,15 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (this.level.setBlock(blockposition, this.blockState, 3)) {
|
||||
((WorldServer) this.level).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level.getBlockState(blockposition)));
|
||||
if (this.level().setBlock(blockposition, this.blockState, 3)) {
|
||||
((WorldServer) this.level()).getChunkSource().chunkMap.broadcast(this, new PacketPlayOutBlockChange(blockposition, this.level().getBlockState(blockposition)));
|
||||
this.discard();
|
||||
@@ -239,7 +254,7 @@
|
||||
if (i < 0) {
|
||||
return false;
|
||||
} else {
|
||||
- Predicate predicate;
|
||||
+ Predicate<Entity> predicate; // CraftBukkit - decompile error
|
||||
DamageSource damagesource1;
|
||||
|
||||
if (this.blockState.getBlock() instanceof Fallable) {
|
||||
@@ -255,7 +270,9 @@
|
||||
float f2 = (float) Math.min(MathHelper.floor((float) i * this.fallDamagePerDistance), this.fallDamageMax);
|
||||
|
||||
this.level.getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
this.level().getEntities((Entity) this, this.getBoundingBox(), predicate).forEach((entity) -> {
|
||||
+ CraftEventFactory.entityDamage = this; // CraftBukkit
|
||||
entity.hurt(damagesource1, f2);
|
||||
entity.hurt(damagesource2, f2);
|
||||
+ CraftEventFactory.entityDamage = null; // CraftBukkit
|
||||
});
|
||||
boolean flag = this.blockState.is(TagsBlock.ANVIL);
|
||||
|
|
|
@ -48,11 +48,11 @@
|
|||
+ // CraftBukkit end */
|
||||
|
||||
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -176,6 +188,12 @@
|
||||
}
|
||||
|
||||
if (!this.level.isClientSide && this.age >= 6000) {
|
||||
if (!this.level().isClientSide && this.age >= 6000) {
|
||||
+ // CraftBukkit start - fire ItemDespawnEvent
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) {
|
||||
+ this.age = 0;
|
||||
|
@ -62,7 +62,7 @@
|
|||
this.discard();
|
||||
}
|
||||
|
||||
@@ -251,10 +269,11 @@
|
||||
@@ -255,10 +273,11 @@
|
||||
private static void merge(EntityItem entityitem, ItemStack itemstack, ItemStack itemstack1) {
|
||||
ItemStack itemstack2 = merge(itemstack, itemstack1, 64);
|
||||
|
||||
|
@ -75,8 +75,8 @@
|
|||
merge(entityitem, itemstack, itemstack1);
|
||||
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
|
||||
entityitem.age = Math.min(entityitem.age, entityitem1.age);
|
||||
@@ -280,6 +299,11 @@
|
||||
} else if (this.level.isClientSide) {
|
||||
@@ -284,6 +303,11 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return true;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
|
@ -87,7 +87,7 @@
|
|||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
|
||||
@@ -343,6 +367,46 @@
|
||||
@@ -347,6 +371,46 @@
|
||||
Item item = itemstack.getItem();
|
||||
int i = itemstack.getCount();
|
||||
|
||||
|
@ -100,7 +100,7 @@
|
|||
+ // Call legacy event
|
||||
+ PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||
+ playerEvent.setCancelled(!playerEvent.getPlayer().getCanPickupItems());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(playerEvent);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(playerEvent);
|
||||
+ if (playerEvent.isCancelled()) {
|
||||
+ itemstack.setCount(i); // SPIGOT-5294 - restore count
|
||||
+ return;
|
||||
|
@ -109,7 +109,7 @@
|
|||
+ // Call newer event afterwards
|
||||
+ EntityPickupItemEvent entityEvent = new EntityPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
|
||||
+ entityEvent.setCancelled(!entityEvent.getEntity().getCanPickupItems());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(entityEvent);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(entityEvent);
|
||||
+ if (entityEvent.isCancelled()) {
|
||||
+ itemstack.setCount(i); // SPIGOT-5294 - restore count
|
||||
+ return;
|
||||
|
@ -134,7 +134,7 @@
|
|||
if (this.pickupDelay == 0 && (this.target == null || this.target.equals(entityhuman.getUUID())) && entityhuman.getInventory().add(itemstack)) {
|
||||
entityhuman.take(this, i);
|
||||
if (itemstack.isEmpty()) {
|
||||
@@ -386,7 +450,9 @@
|
||||
@@ -390,7 +454,9 @@
|
||||
}
|
||||
|
||||
public void setItem(ItemStack itemstack) {
|
||||
|
|
|
@ -24,14 +24,14 @@
|
|||
- this.discard();
|
||||
+ // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
+ // this.discard();
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
this.explode();
|
||||
}
|
||||
+ this.discard();
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
this.updateInWaterStateAndDoFluidPushing();
|
||||
if (this.level.isClientSide) {
|
||||
if (this.level().isClientSide) {
|
||||
@@ -85,9 +92,16 @@
|
||||
}
|
||||
|
||||
|
@ -40,12 +40,12 @@
|
|||
+ // CraftBukkit start
|
||||
+ // float f = 4.0F;
|
||||
|
||||
- this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), 4.0F, World.a.TNT);
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) this.getBukkitEntity());
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.level.explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), World.a.TNT);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -35,19 +35,19 @@
|
|||
protected EnumInteractionResult mobInteract(EntityHuman entityhuman, EnumHand enumhand) {
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
@@ -250,10 +266,18 @@
|
||||
if (!this.level.isClientSide) {
|
||||
if (!this.level().isClientSide) {
|
||||
float f = this.isPowered() ? 2.0F : 1.0F;
|
||||
|
||||
- this.dead = true;
|
||||
- this.level.explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.level().explode(this, this.getX(), this.getY(), this.getZ(), (float) this.explosionRadius * f, World.a.MOB);
|
||||
- this.discard();
|
||||
- this.spawnLingeringCloud();
|
||||
+ // CraftBukkit start
|
||||
+ ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (!event.isCancelled()) {
|
||||
+ this.dead = true;
|
||||
+ this.level.explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.level().explode(this, this.getX(), this.getY(), this.getZ(), event.getRadius(), event.getFire(), World.a.MOB);
|
||||
+ this.discard();
|
||||
+ this.spawnLingeringCloud();
|
||||
+ } else {
|
||||
|
@ -59,7 +59,7 @@
|
|||
}
|
||||
@@ -264,6 +288,7 @@
|
||||
if (!collection.isEmpty()) {
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level, this.getX(), this.getY(), this.getZ());
|
||||
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.level(), this.getX(), this.getY(), this.getZ());
|
||||
|
||||
+ entityareaeffectcloud.setOwner(this); // CraftBukkit
|
||||
entityareaeffectcloud.setRadius(2.5F);
|
||||
|
@ -69,8 +69,8 @@
|
|||
entityareaeffectcloud.addEffect(new MobEffect(mobeffect));
|
||||
}
|
||||
|
||||
- this.level.addFreshEntity(entityareaeffectcloud);
|
||||
+ this.level.addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
- this.level().addFreshEntity(entityareaeffectcloud);
|
||||
+ this.level().addFreshEntity(entityareaeffectcloud, CreatureSpawnEvent.SpawnReason.EXPLOSION); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
@Override
|
||||
public void performRangedAttack(EntityLiving entityliving, float f) {
|
||||
- EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level, this, new ItemStack(Items.TRIDENT));
|
||||
+ EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level, this, this.getItemInHand(net.minecraft.world.entity.projectile.ProjectileHelper.getWeaponHoldingHand(this, Items.TRIDENT))); // CraftBukkit - Use Trident in hand like skeletons (SPIGOT-7025)
|
||||
- EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level(), this, new ItemStack(Items.TRIDENT));
|
||||
+ EntityThrownTrident entitythrowntrident = new EntityThrownTrident(this.level(), this, this.getItemInHand(net.minecraft.world.entity.projectile.ProjectileHelper.getWeaponHoldingHand(this, Items.TRIDENT))); // CraftBukkit - Use Trident in hand like skeletons (SPIGOT-7025)
|
||||
double d0 = entityliving.getX() - this.getX();
|
||||
double d1 = entityliving.getY(0.3333333333333333D) - entitythrowntrident.getY();
|
||||
double d2 = entityliving.getZ() - this.getZ();
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
@@ -487,9 +498,13 @@
|
||||
if (iblockdata2 != null) {
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level, blockposition);
|
||||
iblockdata2 = Block.updateFromNeighbourShapes(iblockdata2, this.enderman.level(), blockposition);
|
||||
if (this.canPlaceBlock(world, blockposition, iblockdata2, iblockdata, iblockdata1, blockposition1)) {
|
||||
+ // CraftBukkit start - Place event
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, blockposition, iblockdata2).isCancelled()) {
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
super.customServerAiStep();
|
||||
if ((this.tickCount + this.getId()) % 1200 == 0) {
|
||||
MobEffect mobeffect = new MobEffect(MobEffects.DIG_SLOWDOWN, 6000, 2);
|
||||
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200);
|
||||
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level, this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
- List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level(), this, this.position(), 50.0D, mobeffect, 1200);
|
||||
+ List<EntityPlayer> list = MobEffectUtil.addEffectToPlayersAround((WorldServer) this.level(), this, this.position(), 50.0D, mobeffect, 1200, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.ATTACK); // CraftBukkit
|
||||
|
||||
list.forEach((entityplayer) -> {
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.GUARDIAN_ELDER_EFFECT, this.isSilent() ? 0.0F : 1.0F));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityPhantom.java
|
||||
@@ -538,14 +538,14 @@
|
||||
List<EntityHuman> list = EntityPhantom.this.level.getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
List<EntityHuman> list = EntityPhantom.this.level().getNearbyPlayers(this.attackTargeting, EntityPhantom.this, EntityPhantom.this.getBoundingBox().inflate(16.0D, 64.0D, 16.0D));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
- list.sort(Comparator.comparing(Entity::getY).reversed());
|
||||
|
|
|
@ -30,9 +30,9 @@
|
|||
public void startPersistentAngerTimer() {
|
||||
- this.setRemainingPersistentAngerTime(EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ // CraftBukkit start
|
||||
+ Entity entity = ((WorldServer) this.level).getEntity(getPersistentAngerTarget());
|
||||
+ Entity entity = ((WorldServer) this.level()).getEntity(getPersistentAngerTarget());
|
||||
+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), EntityPigZombie.PERSISTENT_ANGER_TIME.sample(this.random));
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ this.setPersistentAngerTarget(null);
|
||||
+ return;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
+++ b/net/minecraft/world/entity/monster/EntityRavager.java
|
||||
@@ -170,7 +170,7 @@
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
IBlockData iblockdata = this.level().getBlockState(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
- if (block instanceof BlockLeaves) {
|
||||
+ if (block instanceof BlockLeaves && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, blockposition, net.minecraft.world.level.block.Blocks.AIR.defaultBlockState()).isCancelled()) { // CraftBukkit
|
||||
flag = this.level.destroyBlock(blockposition, true, this) || flag;
|
||||
flag = this.level().destroyBlock(blockposition, true, this) || flag;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue