Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot 2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/CrashReport.java
+++ b/net/minecraft/CrashReport.java
@@ -34,6 +34,7 @@
@@ -36,6 +36,7 @@
public CrashReport(String s, Throwable throwable) {
this.title = s;
this.exception = throwable;

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/commands/CommandDispatcher.java
+++ b/net/minecraft/commands/CommandDispatcher.java
@@ -122,6 +122,14 @@
import net.minecraft.util.profiling.jfr.JvmProfiler;
@@ -134,6 +134,14 @@
import net.minecraft.world.level.GameRules;
import org.slf4j.Logger;
+// CraftBukkit start
@ -14,8 +14,8 @@
+
public class CommandDispatcher {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -133,6 +141,7 @@
private static final ThreadLocal<ExecutionContext<CommandListenerWrapper>> CURRENT_EXECUTION_CONTEXT = new ThreadLocal();
@@ -146,6 +154,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);
@@ -226,6 +235,11 @@
@@ -246,6 +255,11 @@
CommandPublish.register(this.dispatcher);
}
@ -32,15 +32,15 @@
+
+ public CommandDispatcher() {
+ // CraftBukkkit end
this.dispatcher.setConsumer((commandcontext, flag, i) -> {
((CommandListenerWrapper) commandcontext.getSource()).onCommandComplete(commandcontext, flag, i);
});
@@ -238,12 +252,59 @@
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
}
@@ -256,18 +270,65 @@
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
}
+ // CraftBukkit start
+ public int dispatchServerCommand(CommandListenerWrapper sender, String command) {
+ public void dispatchServerCommand(CommandListenerWrapper sender, String command) {
+ Joiner joiner = Joiner.on(" ");
+ if (command.startsWith("/")) {
+ command = command.substring(1);
@ -49,7 +49,7 @@
+ ServerCommandEvent event = new ServerCommandEvent(sender.getBukkitSender(), command);
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ return 0;
+ return;
+ }
+ command = event.getCommand();
+
@ -63,7 +63,7 @@
+ if (cmd.equalsIgnoreCase("stop") || cmd.equalsIgnoreCase("kick") || cmd.equalsIgnoreCase("op")
+ || cmd.equalsIgnoreCase("deop") || cmd.equalsIgnoreCase("ban") || cmd.equalsIgnoreCase("ban-ip")
+ || cmd.equalsIgnoreCase("pardon") || cmd.equalsIgnoreCase("pardon-ip") || cmd.equalsIgnoreCase("reload")) {
+ return 0;
+ return;
+ }
+
+ // Handle vanilla commands;
@ -72,40 +72,65 @@
+ }
+
+ String newCommand = joiner.join(args);
+ return this.performPrefixedCommand(sender, newCommand, newCommand);
+ this.performPrefixedCommand(sender, newCommand, newCommand);
+ }
+ // CraftBukkit end
+
public int performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s) {
public void performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s) {
+ // CraftBukkit start
+ return this.performPrefixedCommand(commandlistenerwrapper, s, s);
+ this.performPrefixedCommand(commandlistenerwrapper, s, s);
+ }
+
+ public int performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
+ public void performPrefixedCommand(CommandListenerWrapper commandlistenerwrapper, String s, String label) {
s = s.startsWith("/") ? s.substring(1) : s;
- return this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s);
+ return this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s, label);
- this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s);
+ this.performCommand(this.dispatcher.parse(s, commandlistenerwrapper), s, label);
+ // CraftBukkit end
}
public int performCommand(ParseResults<CommandListenerWrapper> parseresults, String s) {
+ return this.performCommand(parseresults, s, s);
public void performCommand(ParseResults<CommandListenerWrapper> parseresults, String s) {
+ this.performCommand(parseresults, s, s);
+ }
+
+ public int performCommand(ParseResults<CommandListenerWrapper> parseresults, String s, String label) { // CraftBukkit
+ public void performCommand(ParseResults<CommandListenerWrapper> parseresults, String s, String label) { // CraftBukkit
CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) parseresults.getContext().getSource();
commandlistenerwrapper.getServer().getProfiler().push(() -> {
@@ -268,7 +329,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) -> {
- return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, "/" + s));
+ return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
});
return "/" + s;
});
- ContextChain contextchain = finishParsing(parseresults, s, commandlistenerwrapper);
+ ContextChain contextchain = finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
if (j > 10) {
@@ -318,11 +379,36 @@
try {
if (contextchain != null) {
@@ -301,7 +362,7 @@
}
@Nullable
- private static ContextChain<CommandListenerWrapper> finishParsing(ParseResults<CommandListenerWrapper> parseresults, String s, CommandListenerWrapper commandlistenerwrapper) {
+ private static ContextChain<CommandListenerWrapper> finishParsing(ParseResults<CommandListenerWrapper> parseresults, String s, CommandListenerWrapper commandlistenerwrapper, String label) { // CraftBukkit
try {
validateParseResults(parseresults);
return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> {
@@ -312,7 +373,7 @@
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
- return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, "/" + s));
+ return chatmodifier.withClickEvent(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, label)); // CraftBukkit
});
if (i > 10) {
@@ -362,7 +423,7 @@
executioncontext1.close();
} finally {
- CommandDispatcher.CURRENT_EXECUTION_CONTEXT.set((Object) null);
+ CommandDispatcher.CURRENT_EXECUTION_CONTEXT.set(null); // CraftBukkit - decompile error
}
} else {
consumer.accept(executioncontext);
@@ -371,11 +432,36 @@
}
public void sendCommands(EntityPlayer entityplayer) {
@ -143,7 +168,7 @@
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
}
@@ -333,7 +419,7 @@
@@ -386,7 +472,7 @@
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
if (commandnode2.canUse(commandlistenerwrapper)) {
@ -152,7 +177,7 @@
argumentbuilder.requires((icompletionprovider) -> {
return true;
@@ -356,7 +442,7 @@
@@ -409,7 +495,7 @@
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
}

View file

@ -1,23 +1,23 @@
--- a/net/minecraft/commands/CommandListenerWrapper.java
+++ b/net/minecraft/commands/CommandListenerWrapper.java
@@ -42,6 +42,8 @@
@@ -44,6 +44,8 @@
import net.minecraft.world.phys.Vec2F;
import net.minecraft.world.phys.Vec3D;
+import com.mojang.brigadier.tree.CommandNode; // CraftBukkit
+
public class CommandListenerWrapper implements ICompletionProvider {
public class CommandListenerWrapper implements ExecutionCommandSource<CommandListenerWrapper>, ICompletionProvider {
public static final SimpleCommandExceptionType ERROR_NOT_PLAYER = new SimpleCommandExceptionType(IChatBaseComponent.translatable("permissions.requires.player"));
@@ -63,6 +65,7 @@
private final Vec2F rotation;
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) -> {
@@ -175,9 +178,23 @@
this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, CommandResultCallback.EMPTY, ArgumentAnchor.Anchor.FEET, CommandSigningContext.ANONYMOUS, TaskChainer.immediate(minecraftserver));
@@ -169,9 +172,23 @@
@Override
public boolean hasPermission(int i) {
@ -41,7 +41,7 @@
public Vec3D getPosition() {
return this.worldPosition;
}
@@ -314,7 +331,7 @@
@@ -304,7 +321,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -50,9 +50,9 @@
entityplayer.sendSystemMessage(ichatmutablecomponent);
}
}
@@ -387,4 +404,10 @@
public FeatureFlagSet enabledFeatures() {
return this.level.enabledFeatures();
@@ -397,4 +414,10 @@
public boolean isSilent() {
return this.silent;
}
+
+ // CraftBukkit start

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
@@ -29,6 +29,10 @@
@@ -33,9 +33,15 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.level.gameevent.GameEvent;
@ -10,75 +10,22 @@
+
public interface CauldronInteraction {
Map<Item, CauldronInteraction> EMPTY = newInteractionMap();
@@ -51,6 +55,11 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
Map<String, CauldronInteraction.a> INTERACTIONS = new Object2ObjectArrayMap();
+ // CraftBukkit start - decompile error
+ /*
Codec<CauldronInteraction.a> CODEC;
CauldronInteraction.a EMPTY;
CauldronInteraction.a WATER;
@@ -47,6 +53,8 @@
CauldronInteraction SHULKER_BOX;
CauldronInteraction BANNER;
CauldronInteraction DYED_ITEM;
+ */
+ // CraftBukkit end
if (itemstack.hasTag()) {
@@ -59,7 +68,7 @@
entityhuman.setItemInHand(enumhand, itemstack1);
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
@@ -70,6 +79,11 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
ItemStack itemstack1 = itemstack.copyWithCount(1);
TileEntityBanner.removeLastPattern(itemstack1);
@@ -86,7 +100,7 @@
}
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
@@ -104,9 +118,14 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
idyeable.clearColor(itemstack);
entityhuman.awardStat(StatisticList.CLEAN_ARMOR);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
@@ -115,7 +134,7 @@
};
static Object2ObjectOpenHashMap<Item, CauldronInteraction> newInteractionMap() {
- return (Object2ObjectOpenHashMap) SystemUtils.make(new Object2ObjectOpenHashMap(), (object2objectopenhashmap) -> {
+ return SystemUtils.make(new Object2ObjectOpenHashMap<>(), (object2objectopenhashmap) -> { // CraftBukkit - decompile error
object2objectopenhashmap.defaultReturnValue((iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
return EnumInteractionResult.PASS;
});
@@ -131,12 +150,17 @@
static CauldronInteraction.a newInteractionMap(String s) {
Object2ObjectOpenHashMap<Item, CauldronInteraction> object2objectopenhashmap = new Object2ObjectOpenHashMap();
@@ -71,12 +79,17 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
@ -97,9 +44,9 @@
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
}
@@ -152,12 +176,17 @@
@@ -94,12 +107,17 @@
});
CauldronInteraction.WATER.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
map1.put(Items.GLASS_BOTTLE, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_FILL)) {
@ -116,8 +63,8 @@
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
}
@@ -167,10 +196,15 @@
CauldronInteraction.WATER.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
@@ -109,10 +127,15 @@
map1.put(Items.POTION, (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
if ((Integer) iblockdata.getValue(LayeredCauldronBlock.LEVEL) != 3 && PotionUtil.getPotion(itemstack) == Potions.WATER) {
if (!world.isClientSide) {
+ // CraftBukkit start
@ -133,7 +80,7 @@
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
}
@@ -242,12 +276,17 @@
@@ -188,12 +211,17 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
@ -152,7 +99,7 @@
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
}
@@ -258,12 +297,17 @@
@@ -204,12 +232,17 @@
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
if (!world.isClientSide) {
@ -171,3 +118,118 @@
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
}
@@ -217,32 +250,35 @@
return EnumInteractionResult.sidedSuccess(world.isClientSide);
}
- static {
- Function function = CauldronInteraction.a::name;
- Map map = CauldronInteraction.INTERACTIONS;
-
- Objects.requireNonNull(map);
- CODEC = ExtraCodecs.stringResolverCodec(function, map::get);
- EMPTY = newInteractionMap("empty");
- WATER = newInteractionMap("water");
- LAVA = newInteractionMap("lava");
- POWDER_SNOW = newInteractionMap("powder_snow");
- FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ // CraftBukkit start - decompile errors
+ // static {
+ Codec<CauldronInteraction.a> CODEC = ExtraCodecs.stringResolverCodec(CauldronInteraction.a::name, CauldronInteraction.INTERACTIONS::get);
+ CauldronInteraction.a EMPTY = newInteractionMap("empty");
+ CauldronInteraction.a WATER = newInteractionMap("water");
+ CauldronInteraction.a LAVA = newInteractionMap("lava");
+ CauldronInteraction.a POWDER_SNOW = newInteractionMap("powder_snow");
+ CauldronInteraction FILL_WATER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
return emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (IBlockData) Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEffects.BUCKET_EMPTY);
};
- FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction FILL_LAVA = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
return emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, Blocks.LAVA_CAULDRON.defaultBlockState(), SoundEffects.BUCKET_EMPTY_LAVA);
};
- FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction FILL_POWDER_SNOW = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
return emptyBucket(world, blockposition, entityhuman, enumhand, itemstack, (IBlockData) Blocks.POWDER_SNOW_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL, 3), SoundEffects.BUCKET_EMPTY_POWDER_SNOW);
};
- SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction SHULKER_BOX = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ // CraftBukkit end
Block block = Block.byItem(itemstack.getItem());
if (!(block instanceof BlockShulkerBox)) {
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
if (itemstack.hasTag()) {
@@ -251,17 +287,22 @@
entityhuman.setItemInHand(enumhand, itemstack1);
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
}
};
- BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction BANNER = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error
if (TileEntityBanner.getPatternCount(itemstack) <= 0) {
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
ItemStack itemstack1 = itemstack.copyWithCount(1);
TileEntityBanner.removeLastPattern(itemstack1);
@@ -278,13 +319,13 @@
}
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
}
};
- DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> {
+ CauldronInteraction DYED_ITEM = (iblockdata, world, blockposition, entityhuman, enumhand, itemstack) -> { // CraftBukkit - decompile error
Item item = itemstack.getItem();
if (!(item instanceof IDyeable)) {
@@ -296,16 +337,21 @@
return EnumInteractionResult.PASS;
} else {
if (!world.isClientSide) {
+ // CraftBukkit start
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
+ return EnumInteractionResult.SUCCESS;
+ }
+ // CraftBukkit end
idyeable.clearColor(itemstack);
entityhuman.awardStat(StatisticList.CLEAN_ARMOR);
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
}
return EnumInteractionResult.sidedSuccess(world.isClientSide);
}
}
};
- }
+ // } // CraftBukkit - decompile error
public static record a(String name, Map<Item, CauldronInteraction> map) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
+++ b/net/minecraft/core/dispenser/DispenseBehaviorBoat.java
@@ -12,6 +12,12 @@
@@ -13,6 +13,12 @@
import net.minecraft.world.level.block.BlockDispenser;
import net.minecraft.world.phys.Vec3D;
@ -13,7 +13,7 @@
public class DispenseBehaviorBoat extends DispenseBehaviorItem {
private final DispenseBehaviorItem defaultDispenseItemBehavior;
@@ -50,12 +56,40 @@
@@ -51,13 +57,41 @@
d4 = 0.0D;
}
@ -45,9 +45,10 @@
+ }
+ }
+
+ Object object = this.isChestBoat ? new ChestBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()) : new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ EntityBoat object = this.isChestBoat ? new ChestBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()) : new EntityBoat(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+ // CraftBukkit end
EntityTypes.createDefaultStackConfig(worldserver, itemstack, (EntityHuman) null).accept(object);
((EntityBoat) object).setVariant(this.type);
((EntityBoat) object).setYRot(enumdirection.toYRot());
- worldserver.addFreshEntity((Entity) object);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/network/PacketDataSerializer.java
+++ b/net/minecraft/network/PacketDataSerializer.java
@@ -80,6 +80,8 @@
@@ -81,6 +81,8 @@
import org.joml.Quaternionf;
import org.joml.Vector3f;
@ -9,7 +9,7 @@
public class PacketDataSerializer extends ByteBuf {
public static final int DEFAULT_NBT_QUOTA = 2097152;
@@ -204,7 +206,7 @@
@@ -205,7 +207,7 @@
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) {
int i = this.readVarInt();
@ -18,7 +18,7 @@
for (int j = 0; j < i; ++j) {
c0.add(packetdataserializer_a.apply(this));
@@ -215,7 +217,7 @@
@@ -216,7 +218,7 @@
public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) {
this.writeVarInt(collection.size());
@ -27,7 +27,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -242,12 +244,12 @@
@@ -243,12 +245,12 @@
public void writeIntIdList(IntList intlist) {
this.writeVarInt(intlist.size());
@ -42,7 +42,7 @@
for (int j = 0; j < i; ++j) {
K k0 = packetdataserializer_a.apply(this);
@@ -281,7 +283,7 @@
@@ -282,7 +284,7 @@
}
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
@ -51,7 +51,7 @@
BitSet bitset = new BitSet(ae.length);
for (int i = 0; i < ae.length; ++i) {
@@ -292,7 +294,7 @@
@@ -293,7 +295,7 @@
}
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
@ -60,7 +60,7 @@
BitSet bitset = this.readFixedBitSet(ae.length);
EnumSet<E> enumset = EnumSet.noneOf(oclass);
@@ -530,7 +532,7 @@
@@ -529,7 +531,7 @@
}
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
@ -69,7 +69,7 @@
}
public PacketDataSerializer writeEnum(Enum<?> oenum) {
@@ -585,7 +587,7 @@
@@ -584,7 +586,7 @@
try {
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(this));
return this;
@ -78,7 +78,7 @@
throw new EncoderException(ioexception);
}
}
@@ -613,7 +615,7 @@
@@ -612,7 +614,7 @@
}
public PacketDataSerializer writeItem(ItemStack itemstack) {
@ -87,7 +87,7 @@
this.writeBoolean(false);
} else {
this.writeBoolean(true);
@@ -642,6 +644,11 @@
@@ -641,6 +643,11 @@
ItemStack itemstack = new ItemStack(item, b0);
itemstack.setTag(this.readNbt());

View file

@ -1,15 +1,15 @@
--- a/net/minecraft/network/chat/ChatHexColor.java
+++ b/net/minecraft/network/chat/ChatHexColor.java
@@ -22,7 +22,7 @@
});
}, ChatHexColor::serialize);
@@ -17,7 +17,7 @@
private static final String CUSTOM_COLOR_PREFIX = "#";
public static final Codec<ChatHexColor> CODEC = Codec.STRING.comapFlatMap(ChatHexColor::parseColor, ChatHexColor::serialize);
private static final Map<EnumChatFormat, ChatHexColor> LEGACY_FORMAT_TO_COLOR = (Map) Stream.of(EnumChatFormat.values()).filter(EnumChatFormat::isColor).collect(ImmutableMap.toImmutableMap(Function.identity(), (enumchatformat) -> {
- return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName());
+ return new ChatHexColor(enumchatformat.getColor(), enumchatformat.getName(), enumchatformat); // CraftBukkit
}));
private static final Map<String, ChatHexColor> NAMED_COLORS = (Map) ChatHexColor.LEGACY_FORMAT_TO_COLOR.values().stream().collect(ImmutableMap.toImmutableMap((chathexcolor) -> {
return chathexcolor.name;
@@ -30,16 +30,22 @@
@@ -25,16 +25,22 @@
private final int value;
@Nullable
public final String name;
@ -19,13 +19,13 @@
- private ChatHexColor(int i, String s) {
+ private ChatHexColor(int i, String s, EnumChatFormat format) {
this.value = i;
this.value = i & 16777215;
this.name = s;
+ this.format = format;
}
private ChatHexColor(int i) {
this.value = i;
this.value = i & 16777215;
this.name = null;
+ this.format = null;
}

View file

@ -1,12 +1,11 @@
--- a/net/minecraft/network/chat/IChatBaseComponent.java
+++ b/net/minecraft/network/chat/IChatBaseComponent.java
@@ -41,7 +41,23 @@
import net.minecraft.util.ChatTypeAdapterFactory;
@@ -35,7 +35,22 @@
import net.minecraft.util.FormattedString;
import net.minecraft.world.level.ChunkCoordIntPair;
-public interface IChatBaseComponent extends Message, IChatFormatted {
+// CraftBukkit start
+import com.google.common.collect.Streams;
+import java.util.stream.Stream;
+// CraftBukkit end
+
@ -14,7 +13,7 @@
+
+ // CraftBukkit start
+ default Stream<IChatBaseComponent> stream() {
+ return Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
+ return com.google.common.collect.Streams.concat(new Stream[]{Stream.of(this), this.getSiblings().stream().flatMap(IChatBaseComponent::stream)});
+ }
+
+ @Override

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
@@ -8,6 +8,11 @@
@@ -9,6 +9,11 @@
import net.minecraft.util.thread.IAsyncTaskHandler;
import org.slf4j.Logger;
@ -12,7 +12,7 @@
public class PlayerConnectionUtils {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -21,6 +26,7 @@
@@ -22,6 +27,7 @@
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
if (!iasynctaskhandler.isSameThread()) {
iasynctaskhandler.executeIfPossible(() -> {
@ -20,7 +20,7 @@
if (t0.shouldHandleMessage(packet)) {
try {
packet.handle(t0);
@@ -46,6 +52,10 @@
@@ -60,6 +66,10 @@
});
throw CancelledPacketHandleException.RUNNING_ON_DIFFERENT_THREAD;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/AdvancementDataPlayer.java
+++ b/net/minecraft/server/AdvancementDataPlayer.java
@@ -197,6 +197,7 @@
@@ -196,6 +196,7 @@
AdvancementHolder advancementholder = advancementdataworld.get(minecraftkey);
if (advancementholder == null) {
@ -8,7 +8,7 @@
AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", minecraftkey, this.playerSavePath);
} else {
this.startProgress(advancementholder, advancementprogress);
@@ -228,6 +229,7 @@
@@ -227,6 +228,7 @@
this.progressChanged.add(advancementholder);
flag = true;
if (!flag1 && advancementprogress.isDone()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/CustomFunctionData.java
+++ b/net/minecraft/server/CustomFunctionData.java
@@ -45,7 +45,7 @@
@@ -36,7 +36,7 @@
}
public CommandDispatcher<CommandListenerWrapper> getDispatcher() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/Main.java
+++ b/net/minecraft/server/Main.java
@@ -61,6 +61,17 @@
@@ -60,6 +60,17 @@
import net.minecraft.world.level.storage.WorldInfo;
import org.slf4j.Logger;
@ -18,7 +18,7 @@
public class Main {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -68,8 +79,9 @@
@@ -67,8 +78,9 @@
public Main() {}
@DontObfuscate
@ -29,7 +29,7 @@
OptionParser optionparser = new OptionParser();
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
@@ -94,15 +106,18 @@
@@ -93,15 +105,18 @@
optionparser.printHelpOn(System.err);
return;
}
@ -50,7 +50,7 @@
JvmProfiler.INSTANCE.start(Environment.SERVER);
}
@@ -110,13 +125,26 @@
@@ -109,13 +124,26 @@
DispenserRegistry.validate();
SystemUtils.startTimerHackThread();
Path path1 = Paths.get("server.properties");
@ -79,7 +79,7 @@
Main.LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
return;
}
@@ -126,11 +154,12 @@
@@ -125,11 +153,13 @@
return;
}
@ -92,15 +92,16 @@
Convertable convertable = Convertable.createDefault(file.toPath());
- Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s);
+ Convertable.ConversionSession convertable_conversionsession = convertable.validateAndCreateAccess(s, WorldDimension.OVERWORLD);
WorldInfo worldinfo = convertable_conversionsession.getSummary();
+ // CraftBukkit end
Dynamic dynamic;
if (worldinfo != null) {
@@ -145,13 +174,31 @@
}
if (convertable_conversionsession.hasWorldData()) {
@@ -170,13 +200,31 @@
}
Dynamic<?> dynamic1 = dynamic;
- boolean flag = optionset.has(optionspec6);
+ boolean flag = optionset.has("safeMode");
+ boolean flag = optionset.has("safeMode"); // CraftBukkit
if (flag) {
Main.LOGGER.warn("Safe mode active, only vanilla datapack will be loaded");
@ -128,15 +129,15 @@
WorldStem worldstem;
@@ -160,6 +207,7 @@
@@ -185,6 +233,7 @@
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
+ worldLoader.set(worldloader_a); // CraftBukkit
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
Pair<SaveData, WorldDimensions.b> pair = convertable_conversionsession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
@@ -171,7 +219,7 @@
if (dynamic1 != null) {
@@ -197,7 +246,7 @@
WorldOptions worldoptions;
WorldDimensions worlddimensions;
@ -145,7 +146,7 @@
worldsettings = MinecraftServer.DEMO_SETTINGS;
worldoptions = WorldOptions.DEMO_OPTIONS;
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
@@ -179,7 +227,7 @@
@@ -205,7 +254,7 @@
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
@ -154,7 +155,7 @@
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
}
@@ -195,6 +243,7 @@
@@ -221,6 +270,7 @@
return;
}
@ -162,7 +163,7 @@
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
if (optionset.has(optionspec4)) {
@@ -206,20 +255,31 @@
@@ -232,20 +282,31 @@
SaveData savedata = worldstem.worldData();
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
@ -196,7 +197,7 @@
Thread thread = new Thread("Server Shutdown Thread") {
public void run() {
dedicatedserver.halt(true);
@@ -228,6 +288,7 @@
@@ -254,6 +315,7 @@
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
Runtime.getRuntime().addShutdownHook(thread);
@ -204,7 +205,7 @@
} catch (Exception exception1) {
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
}
@@ -263,7 +324,7 @@
@@ -290,7 +352,7 @@
}
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) {

View file

@ -1,26 +1,25 @@
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -163,6 +163,30 @@
@@ -165,13 +165,36 @@
import net.minecraft.world.phys.Vec3D;
import org.slf4j.Logger;
+// CraftBukkit start
+import com.mojang.datafixers.util.Pair;
+import com.mojang.serialization.DynamicOps;
+import com.mojang.serialization.Dynamic;
+import com.mojang.serialization.Lifecycle;
+import java.util.Random;
+import jline.console.ConsoleReader;
+import joptsimple.OptionSet;
+import net.minecraft.core.HolderLookup;
+import net.minecraft.nbt.DynamicOpsNBT;
+import net.minecraft.nbt.NBTBase;
+import net.minecraft.resources.RegistryOps;
+import net.minecraft.nbt.NbtException;
+import net.minecraft.nbt.ReportedNbtException;
+import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.server.dedicated.DedicatedServerProperties;
+import net.minecraft.util.datafix.DataConverterRegistry;
+import net.minecraft.world.level.levelgen.WorldDimensions;
+import net.minecraft.world.level.levelgen.presets.WorldPresets;
+import net.minecraft.world.level.storage.LevelDataAndDimensions;
+import net.minecraft.world.level.storage.WorldDataServer;
+import net.minecraft.world.level.storage.WorldInfo;
+import net.minecraft.world.level.validation.ContentValidationException;
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer;
@ -31,7 +30,15 @@
public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTask> implements ServerInfo, ICommandListener, AutoCloseable {
public static final Logger LOGGER = LogUtils.getLogger();
@@ -247,6 +271,19 @@
public static final String VANILLA_BRAND = "vanilla";
private static final float AVERAGE_TICK_TIME_SMOOTHING = 0.8F;
private static final int TICK_STATS_SPAN = 100;
- private static final long OVERLOADED_THRESHOLD_NANOS = 20L * TimeRange.NANOSECONDS_PER_SECOND / 20L;
+ private static final long OVERLOADED_THRESHOLD_NANOS = 30L * TimeRange.NANOSECONDS_PER_SECOND / 20L; // CraftBukkit
private static final int OVERLOADED_TICKS_THRESHOLD = 20;
private static final long OVERLOADED_WARNING_INTERVAL_NANOS = 10L * TimeRange.NANOSECONDS_PER_SECOND;
private static final int OVERLOADED_TICKS_WARNING_INTERVAL = 100;
@@ -254,6 +277,19 @@
protected SaveData worldData;
private volatile boolean isSaving;
@ -51,7 +58,7 @@
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
AtomicReference<S> atomicreference = new AtomicReference();
Thread thread = new Thread(() -> {
@@ -260,14 +297,14 @@
@@ -267,14 +303,14 @@
thread.setPriority(8);
}
@ -68,7 +75,7 @@
super("Server");
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
this.profiler = this.metricsRecorder.getProfiler();
@@ -286,7 +323,7 @@
@@ -295,7 +331,7 @@
this.customBossEvents = new BossBattleCustomData();
this.registries = worldstem.registries();
this.worldData = worldstem.worldData();
@ -77,7 +84,7 @@
throw new IllegalStateException("Missing Overworld dimension data");
} else {
this.proxy = proxy;
@@ -309,6 +346,33 @@
@@ -319,6 +355,33 @@
this.serverThread = thread;
this.executor = SystemUtils.backgroundExecutor();
}
@ -111,7 +118,7 @@
}
private void readScoreboard(WorldPersistentData worldpersistentdata) {
@@ -317,7 +381,7 @@
@@ -327,7 +390,7 @@
protected abstract boolean initServer() throws IOException;
@ -120,7 +127,7 @@
if (!JvmProfiler.INSTANCE.isRunning()) {
;
}
@@ -325,12 +389,8 @@
@@ -335,12 +398,8 @@
boolean flag = false;
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
@ -134,7 +141,7 @@
if (profiledduration != null) {
profiledduration.finish();
}
@@ -347,23 +407,179 @@
@@ -357,23 +416,216 @@
protected void forceDifficulty() {}
@ -223,17 +230,54 @@
+ }
+ }
+
+ Dynamic<?> dynamic;
+ if (worldSession.hasWorldData()) {
+ WorldInfo worldinfo;
+
+ try {
+ dynamic = worldSession.getDataTag();
+ worldinfo = worldSession.getSummary(dynamic);
+ } catch (NbtException | ReportedNbtException | IOException ioexception) {
+ Convertable.b convertable_b = worldSession.getLevelDirectory();
+
+ MinecraftServer.LOGGER.warn("Failed to load world data from {}", convertable_b.dataFile(), ioexception);
+ MinecraftServer.LOGGER.info("Attempting to use fallback");
+
+ try {
+ dynamic = worldSession.getDataTagFallback();
+ worldinfo = worldSession.getSummary(dynamic);
+ } catch (NbtException | ReportedNbtException | IOException ioexception1) {
+ MinecraftServer.LOGGER.error("Failed to load world data from {}", convertable_b.oldDataFile(), ioexception1);
+ MinecraftServer.LOGGER.error("Failed to load world data from {} and {}. World files may be corrupted. Shutting down.", convertable_b.dataFile(), convertable_b.oldDataFile());
+ return;
+ }
+
+ worldSession.restoreLevelDataFromOld();
+ }
+
+ if (worldinfo.requiresManualConversion()) {
+ MinecraftServer.LOGGER.info("This world must be opened in an older version (like 1.6.4) to be safely converted");
+ return;
+ }
+
+ if (!worldinfo.isCompatible()) {
+ MinecraftServer.LOGGER.info("This world was created by an incompatible version.");
+ return;
+ }
+ } else {
+ dynamic = null;
+ }
+
+ org.bukkit.generator.ChunkGenerator gen = this.server.getGenerator(name);
+ org.bukkit.generator.BiomeProvider biomeProvider = this.server.getBiomeProvider(name);
+
+ WorldDataServer worlddata;
+ WorldLoader.a worldloader_a = this.worldLoader;
+ IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
+ DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) worldloader_a.datapackWorldgen());
+ Pair<SaveData, WorldDimensions.b> pair = worldSession.getDataTag(dynamicops, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen().allRegistriesLifecycle());
+ if (dynamic != null) {
+ LevelDataAndDimensions leveldataanddimensions = Convertable.getLevelDataAndDimensions(dynamic, worldloader_a.dataConfiguration(), iregistry, worldloader_a.datapackWorldgen());
+
+ if (pair != null) {
+ worlddata = (WorldDataServer) pair.getFirst();
+ worlddata = (WorldDataServer) leveldataanddimensions.worldData();
+ } else {
+ WorldSettings worldsettings;
+ WorldOptions worldoptions;
@ -328,7 +372,7 @@
if (!iworlddataserver.isInitialized()) {
try {
@@ -387,30 +603,8 @@
@@ -397,30 +649,8 @@
iworlddataserver.setInitialized(true);
}
@ -360,7 +404,7 @@
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
if (flag1) {
@@ -418,6 +612,21 @@
@@ -428,6 +658,21 @@
} else {
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
@ -382,7 +426,7 @@
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
if (i < worldserver.getMinBuildHeight()) {
@@ -477,8 +686,11 @@
@@ -487,8 +732,11 @@
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
}
@ -396,28 +440,28 @@
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
BlockPosition blockposition = worldserver.getSharedSpawnPos();
@@ -487,19 +699,23 @@
@@ -497,19 +745,23 @@
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
this.nextTickTime = SystemUtils.getMillis();
this.nextTickTimeNanos = SystemUtils.getNanos();
- chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
+ // CraftBukkit start
+ if (worldserver.getWorld().getKeepSpawnInMemory()) {
+ chunkproviderserver.addRegionTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE);
- while (chunkproviderserver.getTickingGenerated() != 441) {
- this.nextTickTime = SystemUtils.getMillis() + 10L;
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.waitUntilNextTick();
+ while (chunkproviderserver.getTickingGenerated() != 441) {
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
+ this.executeModerately();
+ }
}
- this.nextTickTime = SystemUtils.getMillis() + 10L;
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.waitUntilNextTick();
- Iterator iterator = this.levels.values().iterator();
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
+ this.executeModerately();
+ // Iterator iterator = this.levels.values().iterator();
@ -429,14 +473,14 @@
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk.factory(), "chunks");
if (forcedchunk != null) {
@@ -514,10 +730,17 @@
@@ -524,10 +776,17 @@
}
}
- this.nextTickTime = SystemUtils.getMillis() + 10L;
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
- this.waitUntilNextTick();
+ // CraftBukkit start
+ // this.nextTickTime = SystemUtils.getMillis() + 10L;
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
+ this.executeModerately();
+ // CraftBukkit end
worldloadlistener.stop();
@ -450,7 +494,7 @@
}
public EnumGamemode getDefaultGameType() {
@@ -547,12 +770,16 @@
@@ -557,12 +816,16 @@
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
}
@ -467,7 +511,7 @@
if (flag1) {
Iterator iterator1 = this.getAllLevels().iterator();
@@ -587,18 +814,40 @@
@@ -597,18 +860,40 @@
this.stopServer();
}
@ -508,34 +552,32 @@
}
MinecraftServer.LOGGER.info("Saving worlds");
@@ -686,15 +935,16 @@
@@ -696,7 +981,7 @@
}
this.nextTickTime = SystemUtils.getMillis();
this.nextTickTimeNanos = SystemUtils.getNanos();
- this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse((Object) null);
+ this.statusIcon = (ServerPing.a) this.loadStatusIcon().orElse(null); // CraftBukkit - decompile error
this.status = this.buildServerStatus();
while (this.running) {
long i = SystemUtils.getMillis() - this.nextTickTime;
@@ -713,6 +998,7 @@
if (j > MinecraftServer.OVERLOADED_THRESHOLD_NANOS + 20L * i && this.nextTickTimeNanos - this.lastOverloadWarningNanos >= MinecraftServer.OVERLOADED_WARNING_INTERVAL_NANOS + 100L * i) {
long k = j / i;
- if (i > 2000L && this.nextTickTime - this.lastOverloadWarning >= 15000L) {
+ if (i > 5000L && this.nextTickTime - this.lastOverloadWarning >= 30000L) { // CraftBukkit
long j = i / 50L;
+ if (server.getWarnOnOverload()) // CraftBukkit
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;
@@ -705,6 +955,7 @@
+ if (server.getWarnOnOverload()) // CraftBukkit
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", j / TimeRange.NANOSECONDS_PER_MILLISECOND, k);
this.nextTickTimeNanos += k * i;
this.lastOverloadWarningNanos = this.nextTickTimeNanos;
@@ -726,6 +1012,7 @@
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
}
+ MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
this.nextTickTime += 50L;
this.nextTickTimeNanos += i;
this.startMetricsRecordingTick();
this.profiler.push("tick");
@@ -743,6 +994,12 @@
@@ -770,6 +1057,12 @@
this.services.profileCache().clearExecutor();
}
@ -548,13 +590,13 @@
this.onServerExit();
}
@@ -776,7 +1033,14 @@
@@ -803,7 +1096,14 @@
}
private boolean haveTime() {
- return this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
- return this.runningTask() || SystemUtils.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
+ // CraftBukkit start
+ return this.forceTicks || this.runningTask() || SystemUtils.getMillis() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTime : this.nextTickTime);
+ return this.forceTicks || this.runningTask() || SystemUtils.getNanos() < (this.mayHaveDelayedTasks ? this.delayedTasksMaxNextTickTimeNanos : this.nextTickTimeNanos);
+ }
+
+ private void executeModerately() {
@ -564,7 +606,7 @@
}
protected void waitUntilNextTick() {
@@ -823,7 +1087,7 @@
@@ -850,7 +1150,7 @@
}
}
@ -573,16 +615,20 @@
this.getProfiler().incrementCounter("runTask");
super.doRunTask(ticktask);
}
@@ -876,7 +1140,7 @@
this.status = this.buildServerStatus();
@@ -909,8 +1209,10 @@
}
- if (this.tickCount % 6000 == 0) {
+ if (autosavePeriod > 0 && this.tickCount % autosavePeriod == 0) { // CraftBukkit
--this.ticksUntilAutosave;
- if (this.ticksUntilAutosave <= 0) {
- this.ticksUntilAutosave = this.computeNextAutosaveInterval();
+ // CraftBukkit start
+ if (this.autosavePeriod > 0 && this.ticksUntilAutosave <= 0) {
+ this.ticksUntilAutosave = this.autosavePeriod;
+ // CraftBukkit end
MinecraftServer.LOGGER.debug("Autosave started");
this.profiler.push("save");
this.saveEverything(true, false, false);
@@ -928,22 +1192,39 @@
@@ -991,22 +1293,39 @@
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
entityplayer.connection.suspendFlushing();
});
@ -622,7 +668,7 @@
this.profiler.push("tick");
@@ -1033,6 +1314,22 @@
@@ -1096,6 +1415,22 @@
return (WorldServer) this.levels.get(resourcekey);
}
@ -645,7 +691,7 @@
public Set<ResourceKey<World>> levelKeys() {
return this.levels.keySet();
}
@@ -1062,7 +1359,7 @@
@@ -1125,7 +1460,7 @@
@DontObfuscate
public String getServerModName() {
@ -654,7 +700,7 @@
}
public SystemReport fillSystemReport(SystemReport systemreport) {
@@ -1403,11 +1700,11 @@
@@ -1466,11 +1801,11 @@
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
@ -668,7 +714,7 @@
}, this).thenCompose((immutablelist) -> {
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
@@ -1422,6 +1719,7 @@
@@ -1485,6 +1820,7 @@
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
this.resources.close();
this.resources = minecraftserver_reloadableresources;
@ -676,7 +722,7 @@
this.packRepository.setSelected(collection);
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
@@ -1778,7 +2076,7 @@
@@ -1853,7 +2189,7 @@
try {
label51:
{
@ -685,7 +731,7 @@
try {
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
@@ -1828,6 +2126,22 @@
@@ -1903,6 +2239,22 @@
}
@ -708,7 +754,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) -> {
@@ -1954,6 +2268,11 @@
@@ -2029,6 +2381,11 @@
}

View file

@ -1,83 +1,83 @@
--- a/net/minecraft/server/ScoreboardServer.java
+++ b/net/minecraft/server/ScoreboardServer.java
@@ -37,7 +37,7 @@
public void onScoreChanged(ScoreboardScore scoreboardscore) {
super.onScoreChanged(scoreboardscore);
if (this.trackedObjectives.contains(scoreboardscore.getObjective())) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.CHANGE, scoreboardscore.getObjective().getName(), scoreboardscore.getOwner(), scoreboardscore.getScore()));
@@ -40,7 +40,7 @@
protected void onScoreChanged(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective, ScoreboardScore scoreboardscore) {
super.onScoreChanged(scoreholder, scoreboardobjective, scoreboardscore);
if (this.trackedObjectives.contains(scoreboardobjective)) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), scoreboardscore.display(), scoreboardscore.numberFormat()));
+ this.broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), scoreboardscore.display(), scoreboardscore.numberFormat())); // CraftBukkit
}
this.setDirty();
@@ -46,7 +46,7 @@
@@ -55,7 +55,7 @@
@Override
public void onPlayerRemoved(String s) {
super.onPlayerRemoved(s);
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, (String) null, s, 0));
public void onPlayerRemoved(ScoreHolder scoreholder) {
super.onPlayerRemoved(scoreholder);
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null));
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), (String) null)); // CraftBukkit
this.setDirty();
}
@@ -54,7 +54,7 @@
public void onPlayerScoreRemoved(String s, ScoreboardObjective scoreboardobjective) {
super.onPlayerScoreRemoved(s, scoreboardobjective);
@@ -63,7 +63,7 @@
public void onPlayerScoreRemoved(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective) {
super.onPlayerScoreRemoved(scoreholder, scoreboardobjective);
if (this.trackedObjectives.contains(scoreboardobjective)) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
+ this.broadcastAll(new PacketPlayOutScoreboardScore(ScoreboardServer.Action.REMOVE, scoreboardobjective.getName(), s, 0));
- this.server.getPlayerList().broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName()));
+ this.broadcastAll(new ClientboundResetScorePacket(scoreholder.getScoreboardName(), scoreboardobjective.getName())); // CraftBukkit
}
this.setDirty();
@@ -67,7 +67,7 @@
@@ -76,7 +76,7 @@
super.setDisplayObjective(displayslot, scoreboardobjective);
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
} else {
this.stopTrackingObjective(scoreboardobjective1);
}
@@ -75,7 +75,7 @@
@@ -84,7 +84,7 @@
if (scoreboardobjective != null) {
if (this.trackedObjectives.contains(scoreboardobjective)) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective));
+ this.broadcastAll(new PacketPlayOutScoreboardDisplayObjective(displayslot, scoreboardobjective)); // CraftBukkit
} else {
this.startTrackingObjective(scoreboardobjective);
}
@@ -87,7 +87,7 @@
@@ -96,7 +96,7 @@
@Override
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
if (super.addPlayerToTeam(s, scoreboardteam)) {
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.ADD)); // CraftBukkit
this.setDirty();
return true;
} else {
@@ -98,7 +98,7 @@
@@ -107,7 +107,7 @@
@Override
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
super.removePlayerFromTeam(s, scoreboardteam);
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createPlayerPacket(scoreboardteam, s, PacketPlayOutScoreboardTeam.a.REMOVE)); // CraftBukkit
this.setDirty();
}
@@ -112,7 +112,7 @@
@@ -121,7 +121,7 @@
public void onObjectiveChanged(ScoreboardObjective scoreboardobjective) {
super.onObjectiveChanged(scoreboardobjective);
if (this.trackedObjectives.contains(scoreboardobjective)) {
- this.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
+ this.broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2));
+ this.broadcastAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit
}
this.setDirty();
@@ -131,21 +131,21 @@
@@ -140,21 +140,21 @@
@Override
public void onTeamAdded(ScoreboardTeam scoreboardteam) {
super.onTeamAdded(scoreboardteam);
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, true)); // CraftBukkit
this.setDirty();
}
@ -85,7 +85,7 @@
public void onTeamChanged(ScoreboardTeam scoreboardteam) {
super.onTeamChanged(scoreboardteam);
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createAddOrModifyPacket(scoreboardteam, false)); // CraftBukkit
this.setDirty();
}
@ -93,11 +93,11 @@
public void onTeamRemoved(ScoreboardTeam scoreboardteam) {
super.onTeamRemoved(scoreboardteam);
- this.server.getPlayerList().broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam));
+ this.broadcastAll(PacketPlayOutScoreboardTeam.createRemovePacket(scoreboardteam)); // CraftBukkit
this.setDirty();
}
@@ -196,6 +196,7 @@
@@ -205,6 +205,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -105,7 +105,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -232,6 +233,7 @@
@@ -241,6 +242,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@ -113,7 +113,7 @@
Iterator iterator1 = list.iterator();
while (iterator1.hasNext()) {
@@ -276,6 +278,16 @@
@@ -285,6 +287,16 @@
return this.createData().load(nbttagcompound);
}

View file

@ -1,11 +1,11 @@
--- a/net/minecraft/server/commands/CommandSchedule.java
+++ b/net/minecraft/server/commands/CommandSchedule.java
@@ -56,7 +56,7 @@
@@ -55,7 +55,7 @@
} else {
long j = commandlistenerwrapper.getLevel().getGameTime() + (long) i;
MinecraftKey minecraftkey = (MinecraftKey) pair.getFirst();
- CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = commandlistenerwrapper.getServer().getWorldData().overworldData().getScheduledEvents();
+ CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue = commandlistenerwrapper.getLevel().serverLevelData.overworldData().getScheduledEvents(); // CraftBukkit - SPIGOT-6667: Use world specific function timer
((Either) pair.getSecond()).ifLeft((customfunction) -> {
((Either) pair.getSecond()).ifLeft((net_minecraft_commands_functions_commandfunction) -> {
String s = minecraftkey.toString();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/commands/CommandSpreadPlayers.java
+++ b/net/minecraft/server/commands/CommandSpreadPlayers.java
@@ -92,7 +92,7 @@
@@ -93,7 +93,7 @@
if (entity instanceof EntityHuman) {
set.add(entity.getTeam());
} else {
@ -9,7 +9,7 @@
}
}
@@ -202,7 +202,7 @@
@@ -203,7 +203,7 @@
commandspreadplayers_a = acommandspreadplayers_a[j++];
}

View file

@ -1,11 +0,0 @@
--- a/net/minecraft/server/commands/CommandTrigger.java
+++ b/net/minecraft/server/commands/CommandTrigger.java
@@ -96,7 +96,7 @@
if (scoreboardobjective.getCriteria() != IScoreboardCriteria.TRIGGER) {
throw CommandTrigger.ERROR_INVALID_OBJECTIVE.create();
} else {
- Scoreboard scoreboard = entityplayer.getScoreboard();
+ Scoreboard scoreboard = entityplayer.getServer().getScoreboard(); // CraftBukkit - SPIGOT-6917: use main scoreboard
String s = entityplayer.getScoreboardName();
if (!scoreboard.hasPlayerScore(s, scoreboardobjective)) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
@@ -45,11 +45,16 @@
@@ -44,11 +44,16 @@
import net.minecraft.world.level.levelgen.presets.WorldPresets;
import org.slf4j.Logger;
@ -17,7 +17,7 @@
public final boolean onlineMode = this.get("online-mode", true);
public final boolean preventProxyConnections = this.get("prevent-proxy-connections", false);
public final String serverIp = this.get("server-ip", "");
@@ -104,8 +109,10 @@
@@ -103,8 +108,10 @@
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
public final WorldOptions worldOptions;
@ -30,7 +30,7 @@
this.difficulty = (EnumDifficulty) this.get("difficulty", dispatchNumberOrString(EnumDifficulty::byId, EnumDifficulty::byName), EnumDifficulty::getKey, EnumDifficulty.EASY);
this.gamemode = (EnumGamemode) this.get("gamemode", dispatchNumberOrString(EnumGamemode::byId, EnumGamemode::byName), EnumGamemode::getName, EnumGamemode.SURVIVAL);
this.levelName = this.get("level-name", "world");
@@ -162,13 +169,15 @@
@@ -161,13 +168,15 @@
this.initialDataPackConfiguration = getDatapackConfig(this.get("initial-enabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getEnabled())), this.get("initial-disabled-packs", String.join(",", WorldDataConfiguration.DEFAULT.dataPacks().getDisabled())));
}
@ -50,7 +50,7 @@
}
@Nullable
@@ -249,10 +258,10 @@
@@ -248,10 +257,10 @@
}).orElseThrow(() -> {
return new IllegalStateException("Invalid datapack contents: can't find default preset");
});
@ -63,7 +63,7 @@
});
Objects.requireNonNull(iregistry);
@@ -264,7 +273,7 @@
@@ -263,7 +272,7 @@
if (holder.is(WorldPresets.FLAT)) {
RegistryOps<JsonElement> registryops = RegistryOps.create(JsonOps.INSTANCE, (HolderLookup.b) iregistrycustom);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ChunkProviderServer.java
+++ b/net/minecraft/server/level/ChunkProviderServer.java
@@ -85,6 +85,16 @@
@@ -83,6 +83,16 @@
this.clearCache();
}
@ -17,7 +17,7 @@
@Override
public LightEngineThreaded getLightEngine() {
return this.lightEngine;
@@ -129,7 +139,7 @@
@@ -127,7 +137,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
ichunkaccess = this.lastChunk[l];
@ -26,7 +26,7 @@
return ichunkaccess;
}
}
@@ -177,12 +187,12 @@
@@ -175,12 +185,12 @@
if (playerchunk == null) {
return null;
} else {
@ -41,7 +41,7 @@
if (ichunkaccess1 != null) {
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
@@ -230,7 +240,15 @@
@@ -228,7 +238,15 @@
int l = ChunkLevel.byStatus(chunkstatus);
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
@ -58,7 +58,7 @@
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.chunkAbsent(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
@@ -249,7 +267,7 @@
@@ -247,7 +265,7 @@
}
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
@ -67,7 +67,7 @@
}
@Override
@@ -317,7 +335,7 @@
@@ -315,7 +333,7 @@
} else if (!this.level.shouldTickBlocksAt(i)) {
return false;
} else {
@ -76,7 +76,7 @@
return either != null && either.left().isPresent();
}
@@ -330,11 +348,31 @@
@@ -328,11 +346,31 @@
@Override
public void close() throws IOException {
@ -109,25 +109,21 @@
@Override
public void tick(BooleanSupplier booleansupplier, boolean flag) {
this.level.getProfiler().push("purge");
@@ -366,7 +404,7 @@
@@ -379,11 +417,11 @@
gameprofilerfiller.push("pollingChunks");
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
- boolean flag1 = worlddata.getGameTime() % 400L == 0L;
+ boolean flag1 = level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && worlddata.getGameTime() % level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
this.lastSpawnState = spawnercreature_d;
gameprofilerfiller.popPush("spawnAndTick");
- boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
+ boolean flag = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit
gameprofilerfiller.push("naturalSpawnCount");
int l = this.distanceManager.getNaturalSpawnChunkCount();
@@ -387,7 +425,7 @@
}
SystemUtils.shuffle(list, this.level.random);
int l = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
- boolean flag1 = this.level.getLevelData().getGameTime() % 400L == 0L;
+ boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit
Iterator iterator1 = list.iterator();
gameprofilerfiller.popPush("spawnAndTick");
- boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING);
+ boolean flag2 = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !level.players().isEmpty(); // CraftBukkit
Collections.shuffle(list);
Iterator iterator1 = list.iterator();
@@ -592,13 +630,19 @@
while (iterator1.hasNext()) {
@@ -586,13 +624,19 @@
}
@Override

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/EntityPlayer.java
+++ b/net/minecraft/server/level/EntityPlayer.java
@@ -151,6 +151,37 @@
@@ -157,6 +157,38 @@
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
import org.slf4j.Logger;
@ -23,6 +23,7 @@
+import org.bukkit.craftbukkit.inventory.CraftItemStack;
+import org.bukkit.craftbukkit.util.CraftDimensionUtil;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.event.entity.EntityExhaustionEvent;
+import org.bukkit.event.player.PlayerBedLeaveEvent;
+import org.bukkit.event.player.PlayerChangedMainHandEvent;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
@ -38,7 +39,7 @@
public class EntityPlayer extends EntityHuman {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -185,7 +216,7 @@
@@ -192,7 +224,7 @@
private int levitationStartTime;
private boolean disconnected;
private int requestedViewDistance;
@ -47,7 +48,7 @@
@Nullable
private Vec3D startingToFallPosition;
@Nullable
@@ -210,6 +241,20 @@
@@ -217,6 +249,20 @@
private int containerCounter;
public boolean wonGame;
@ -68,7 +69,7 @@
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
this.chatVisibility = EnumChatVisibility.FULL;
@@ -276,12 +321,56 @@
@@ -283,12 +329,56 @@
this.setMaxUpStep(1.0F);
this.fudgeSpawnLocation(worldserver);
this.updateOptions(clientinformation);
@ -77,8 +78,8 @@
+ this.displayName = this.getScoreboardName();
+ this.bukkitPickUpLoot = true;
+ this.maxHealthCache = this.getMaxHealth();
}
+ }
+
+ // Yes, this doesn't match Vanilla, but it's the best we can do for now.
+ // If this is an issue, PRs are welcome
+ public final BlockPosition getSpawnPoint(WorldServer worldserver) {
@ -115,9 +116,9 @@
+ }
+
+ return blockposition;
+ }
}
+ // CraftBukkit end
+
private void fudgeSpawnLocation(WorldServer worldserver) {
BlockPosition blockposition = worldserver.getSharedSpawnPos();
@ -126,7 +127,7 @@
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
@@ -330,7 +419,7 @@
@@ -337,7 +427,7 @@
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.readAdditionalSaveData(nbttagcompound);
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
@ -135,7 +136,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -349,17 +438,26 @@
@@ -356,17 +446,26 @@
if (nbttagcompound.contains("recipeBook", 10)) {
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
}
@ -163,7 +164,7 @@
Logger logger1 = EntityPlayer.LOGGER;
Objects.requireNonNull(logger1);
@@ -372,7 +470,7 @@
@@ -379,7 +478,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@ -172,7 +173,7 @@
Logger logger = EntityPlayer.LOGGER;
Objects.requireNonNull(logger);
@@ -393,7 +491,20 @@
@@ -400,7 +499,20 @@
Entity entity = this.getRootVehicle();
Entity entity1 = this.getVehicle();
@ -194,7 +195,7 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
@@ -418,8 +529,32 @@
@@ -425,8 +537,32 @@
nbttagcompound.put("SpawnDimension", nbtbase);
});
}
@ -227,7 +228,7 @@
public void setExperiencePoints(int i) {
float f = (float) this.getXpNeededForNextLevel();
@@ -479,6 +614,11 @@
@@ -486,6 +622,11 @@
@Override
public void tick() {
@ -239,7 +240,7 @@
this.gameMode.tick();
this.wardenSpawnTracker.tick();
--this.spawnInvulnerableTime;
@@ -535,7 +675,7 @@
@@ -542,7 +683,7 @@
}
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
@ -248,7 +249,7 @@
this.lastSentHealth = this.getHealth();
this.lastSentFood = this.foodData.getFoodLevel();
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
@@ -566,6 +706,12 @@
@@ -573,6 +714,12 @@
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
}
@ -261,7 +262,7 @@
if (this.experienceLevel != this.lastRecordedLevel) {
this.lastRecordedLevel = this.experienceLevel;
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
@@ -580,6 +726,20 @@
@@ -587,6 +734,20 @@
CriterionTriggers.LOCATION.trigger(this);
}
@ -282,17 +283,17 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
@@ -622,7 +782,8 @@
@@ -629,7 +790,8 @@
}
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
- this.getScoreboard().forAllObjectives(iscoreboardcriteria, this, (scoreaccess) -> {
+ // CraftBukkit - Use our scores instead
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(iscoreboardcriteria, this.getScoreboardName(), (scoreboardscore) -> {
scoreboardscore.setScore(i);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(iscoreboardcriteria, this, (scoreaccess) -> {
scoreaccess.set(i);
});
}
@@ -631,9 +792,47 @@
@@ -638,9 +800,47 @@
public void die(DamageSource damagesource) {
this.gameEvent(GameEvent.ENTITY_DIE);
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
@ -342,7 +343,7 @@
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
boolean flag1 = true;
@@ -664,12 +863,18 @@
@@ -671,12 +871,18 @@
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
this.tellNeutralMobsThatIDied();
}
@ -356,41 +357,41 @@
+ this.getInventory().clearContent();
}
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this, ScoreAccess::increment);
+ this.setCamera(this); // Remove spectated target
+ // CraftBukkit end
+
+ // CraftBukkit - Get our scores instead
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.DEATH_COUNT, this.getScoreboardName(), ScoreboardScore::increment);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.DEATH_COUNT, this, ScoreAccess::increment);
EntityLiving entityliving = this.getKillCredit();
if (entityliving != null) {
@@ -707,10 +912,12 @@
String s = this.getScoreboardName();
String s1 = entity.getScoreboardName();
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
@@ -711,10 +917,12 @@
if (entity != this) {
super.awardKillScore(entity, i, damagesource);
this.increaseScore(i);
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
+ // CraftBukkit - Get our scores instead
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_ALL, s, ScoreboardScore::increment);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_ALL, this, ScoreAccess::increment);
if (entity instanceof EntityHuman) {
this.awardStat(StatisticList.PLAYER_KILLS);
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
- this.getScoreboard().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, this, ScoreAccess::increment);
+ // CraftBukkit - Get our scores instead
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.KILL_COUNT_PLAYERS, s, ScoreboardScore::increment);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(IScoreboardCriteria.KILL_COUNT_PLAYERS, this, ScoreAccess::increment);
} else {
this.awardStat(StatisticList.MOB_KILLS);
}
@@ -728,7 +935,8 @@
@@ -732,7 +940,8 @@
int i = scoreboardteam.getColor().getId();
if (i >= 0 && i < aiscoreboardcriteria.length) {
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
- this.getScoreboard().forAllObjectives(aiscoreboardcriteria[i], scoreholder, ScoreAccess::increment);
+ // CraftBukkit - Get our scores instead
+ this.level().getCraftServer().getScoreboardManager().getScoreboardScores(aiscoreboardcriteria[i], s, ScoreboardScore::increment);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(aiscoreboardcriteria[i], scoreholder, ScoreAccess::increment);
}
}
@@ -778,18 +986,20 @@
@@ -782,18 +991,20 @@
}
private boolean isPvpAllowed() {
@ -414,7 +415,7 @@
} else {
return shapedetectorshape;
}
@@ -798,11 +1008,20 @@
@@ -802,11 +1013,20 @@
@Nullable
@Override
public Entity changeDimension(WorldServer worldserver) {
@ -438,7 +439,7 @@
this.unRide();
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
if (!this.wonGame) {
@@ -813,6 +1032,8 @@
@@ -817,6 +1037,8 @@
return this;
} else {
@ -447,7 +448,7 @@
WorldData worlddata = worldserver.getLevelData();
this.connection.send(new PacketPlayOutRespawn(this.createCommonSpawnInfo(worldserver), (byte) 3));
@@ -822,20 +1043,50 @@
@@ -826,20 +1048,50 @@
playerlist.sendPlayerPermissionLevel(this);
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
this.unsetRemoved();
@ -503,7 +504,7 @@
this.connection.resetPosition();
worldserver.addDuringPortalTeleport(this);
worldserver1.getProfiler().pop();
@@ -855,39 +1106,66 @@
@@ -859,39 +1111,66 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@ -576,7 +577,7 @@
}
return optional1;
@@ -897,13 +1175,21 @@
@@ -901,13 +1180,21 @@
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
ResourceKey<World> resourcekey = worldserver.dimension();
ResourceKey<World> resourcekey1 = this.level().dimension();
@ -601,7 +602,7 @@
this.enteredNetherPosition = null;
}
@@ -920,19 +1206,17 @@
@@ -924,19 +1211,17 @@
this.containerMenu.broadcastChanges();
}
@ -625,7 +626,7 @@
if (this.level().isDay()) {
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
} else {
@@ -949,7 +1233,36 @@
@@ -953,7 +1238,36 @@
}
}
@ -663,7 +664,7 @@
this.awardStat(StatisticList.SLEEP_IN_BED);
CriterionTriggers.SLEPT_IN_BED.trigger(this);
});
@@ -962,9 +1275,8 @@
@@ -966,9 +1280,8 @@
return either;
}
}
@ -674,7 +675,7 @@
}
@Override
@@ -991,13 +1303,31 @@
@@ -995,13 +1308,31 @@
@Override
public void stopSleepInBed(boolean flag, boolean flag1) {
@ -707,7 +708,7 @@
}
}
@@ -1039,8 +1369,9 @@
@@ -1051,8 +1382,9 @@
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
}
@ -718,7 +719,7 @@
}
@Override
@@ -1048,13 +1379,35 @@
@@ -1060,13 +1392,35 @@
if (itileinventory == null) {
return OptionalInt.empty();
} else {
@ -754,7 +755,7 @@
if (container == null) {
if (this.isSpectator()) {
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
@@ -1062,9 +1415,11 @@
@@ -1074,9 +1428,11 @@
return OptionalInt.empty();
} else {
@ -768,7 +769,7 @@
return OptionalInt.of(this.containerCounter);
}
}
@@ -1077,13 +1432,24 @@
@@ -1089,13 +1445,24 @@
@Override
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
@ -795,7 +796,7 @@
this.initMenu(this.containerMenu);
}
@@ -1106,6 +1472,7 @@
@@ -1118,6 +1485,7 @@
@Override
public void closeContainer() {
@ -803,7 +804,7 @@
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
this.doCloseContainer();
}
@@ -1128,6 +1495,16 @@
@@ -1140,6 +1508,16 @@
}
this.jumping = flag;
@ -820,34 +821,65 @@
this.setShiftKeyDown(flag1);
}
@@ -1136,7 +1513,7 @@
@@ -1173,19 +1551,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isEyeInFluid(TagsFluid.WATER)) {
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_UNDER_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isInWater()) {
i = Math.round((float) Math.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_ON_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1196,13 +1574,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
- this.causeFoodExhaustion(0.1F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.1F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent
} else if (this.isCrouching()) {
this.awardStat(StatisticList.CROUCH_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent
} else {
this.awardStat(StatisticList.WALK_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent
}
}
} else if (this.isFallFlying()) {
@@ -1245,7 +1623,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
scoreboardscore.add(i);
- this.getScoreboard().forAllObjectives(statistic, this, (scoreaccess) -> {
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(statistic, this, (scoreaccess) -> {
scoreaccess.add(i);
});
}
@@ -1144,7 +1521,7 @@
@@ -1253,7 +1631,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.getScoreboard().forAllObjectives(statistic, this, ScoreAccess::reset);
+ this.level().getCraftServer().getScoreboardManager().forAllObjectives(statistic, this, ScoreAccess::reset); // CraftBukkit - Get our scores instead
}
@Override
@@ -1165,7 +1542,7 @@
for (int j = 0; j < i; ++j) {
MinecraftKey minecraftkey = aminecraftkey1[j];
- Optional optional = this.server.getRecipeManager().byKey(minecraftkey);
+ Optional<? extends RecipeHolder<?>> optional = this.server.getRecipeManager().byKey(minecraftkey); // CraftBukkit - decompile error
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@@ -1200,6 +1577,7 @@
@@ -1301,6 +1679,7 @@
public void resetSentInfo() {
this.lastSentHealth = -1.0E8F;
@ -855,7 +887,7 @@
}
@Override
@@ -1257,7 +1635,7 @@
@@ -1358,7 +1737,7 @@
this.lastSentExp = -1;
this.lastSentHealth = -1.0F;
this.lastSentFood = -1;
@ -864,7 +896,7 @@
this.seenCredits = entityplayer.seenCredits;
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
this.chunkTrackingView = entityplayer.chunkTrackingView;
@@ -1308,6 +1686,12 @@
@@ -1409,6 +1788,12 @@
@Override
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
@ -877,7 +909,7 @@
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
@@ -1317,9 +1701,9 @@
@@ -1418,9 +1803,9 @@
}
if (worldserver == this.level()) {
@ -889,7 +921,7 @@
}
this.setYHeadRot(f);
@@ -1423,6 +1807,16 @@
@@ -1524,6 +1909,16 @@
}
public void updateOptions(ClientInformation clientinformation) {
@ -906,7 +938,7 @@
this.language = clientinformation.language();
this.requestedViewDistance = clientinformation.viewDistance();
this.chatVisibility = clientinformation.chatVisibility();
@@ -1506,7 +1900,7 @@
@@ -1607,7 +2002,7 @@
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;
@ -915,7 +947,7 @@
}
if (entity != null) {
@@ -1543,7 +1937,7 @@
@@ -1644,7 +2039,7 @@
@Nullable
public IChatBaseComponent getTabListDisplayName() {
@ -924,7 +956,7 @@
}
@Override
@@ -1564,9 +1958,16 @@
@@ -1665,9 +2060,16 @@
return this.advancements;
}
@ -941,7 +973,7 @@
if (worldserver == this.level()) {
this.connection.teleport(d0, d1, d2, f, f1);
} else {
@@ -1586,6 +1987,9 @@
@@ -1687,6 +2089,9 @@
this.server.getPlayerList().sendLevelInfo(this, worldserver);
this.server.getPlayerList().sendAllPlayerInfo(this);
}
@ -951,7 +983,7 @@
}
@@ -1607,6 +2011,32 @@
@@ -1708,6 +2113,32 @@
}
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
@ -984,7 +1016,7 @@
if (blockposition != null) {
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
@@ -1812,4 +2242,146 @@
@@ -1913,4 +2344,146 @@
public CommonPlayerSpawnInfo createCommonSpawnInfo(WorldServer worldserver) {
return new CommonPlayerSpawnInfo(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), this.getLastDeathLocation(), this.getPortalCooldown());
}

View file

@ -226,7 +226,7 @@
+ org.bukkit.block.BlockState state = bblock.getState();
+ level.captureDrops = new ArrayList<>();
+ // CraftBukkit end
block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
boolean flag = this.level.removeBlock(blockposition, false);
@@ -256,19 +399,32 @@
@ -238,12 +238,12 @@
} else {
ItemStack itemstack = this.player.getMainHandItem();
ItemStack itemstack1 = itemstack.copy();
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata);
boolean flag1 = this.player.hasCorrectToolForDrops(iblockdata1);
itemstack.mineBlock(this.level, iblockdata, blockposition, this.player);
itemstack.mineBlock(this.level, iblockdata1, blockposition, this.player);
- if (flag && flag1) {
+ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items
block.playerDestroy(this.level, this.player, blockposition, iblockdata, tileentity, itemstack1);
block.playerDestroy(this.level, this.player, blockposition, iblockdata1, tileentity, itemstack1);
}
- return true;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/WorldServer.java
+++ b/net/minecraft/server/level/WorldServer.java
@@ -162,6 +162,26 @@
@@ -164,6 +164,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);
@@ -175,7 +195,7 @@
@@ -177,7 +197,7 @@
final List<EntityPlayer> players;
private final ChunkProviderServer chunkSource;
private final MinecraftServer server;
@ -36,7 +36,7 @@
final EntityTickList entityTickList;
public final PersistentEntitySectionManager<Entity> entityManager;
private final GameEventDispatcher gameEventDispatcher;
@@ -200,12 +220,30 @@
@@ -202,12 +222,30 @@
private final boolean tickTime;
private final RandomSequences randomSequences;
@ -72,7 +72,7 @@
this.players = Lists.newArrayList();
this.entityTickList = new EntityTickList();
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
@@ -219,6 +257,22 @@
@@ -221,6 +259,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,9 +300,9 @@
@@ -248,9 +302,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,7 +108,7 @@
} else {
this.dragonFight = null;
}
@@ -258,6 +312,7 @@
@@ -260,6 +314,7 @@
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
});
@ -116,7 +116,7 @@
}
/** @deprecated */
@@ -296,12 +351,20 @@
@@ -304,12 +359,20 @@
long j;
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
@ -140,25 +140,25 @@
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
this.resetWeatherCycle();
}
@@ -327,7 +390,7 @@
this.runBlockEvents();
@@ -344,7 +407,7 @@
this.handlingTick = false;
gameprofilerfiller.pop();
- boolean flag = !this.players.isEmpty() || !this.getForcedChunks().isEmpty();
+ boolean flag = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
- boolean flag1 = !this.players.isEmpty() || !this.getForcedChunks().isEmpty();
+ boolean flag1 = true || !this.players.isEmpty() || !this.getForcedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players
if (flag) {
if (flag1) {
this.resetEmptyTime();
@@ -343,7 +406,7 @@
@@ -360,7 +423,7 @@
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
- if (this.shouldDiscardEntity(entity)) {
+ if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
entity.discard();
} else {
} else if (!tickratemanager.isEntityFrozen(entity)) {
gameprofilerfiller.push("checkDespawn");
@@ -415,7 +478,7 @@
@@ -432,7 +495,7 @@
private void wakeUpAllPlayers() {
this.sleepStatus.removeAllSleepers();
@ -167,7 +167,7 @@
entityplayer.stopSleepInBed(false, false);
});
}
@@ -442,7 +505,7 @@
@@ -459,7 +522,7 @@
entityhorseskeleton.setTrap(true);
entityhorseskeleton.setAge(0);
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
@ -176,7 +176,7 @@
}
}
@@ -451,7 +514,7 @@
@@ -468,7 +531,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setVisualOnly(flag1);
@ -185,7 +185,7 @@
}
}
}
@@ -506,7 +569,7 @@
@@ -524,7 +587,7 @@
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
if (biomebase.shouldFreeze(this, blockposition2)) {
@ -193,8 +193,8 @@
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(this, blockposition2, Blocks.ICE.defaultBlockState(), null); // CraftBukkit
}
if (flag) {
@@ -522,10 +585,10 @@
if (this.isRaining()) {
@@ -540,10 +603,10 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
@ -207,7 +207,7 @@
}
}
@@ -686,6 +749,7 @@
@@ -704,6 +767,7 @@
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
}
@ -215,7 +215,7 @@
if (this.oRainLevel != this.rainLevel) {
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
}
@@ -704,14 +768,47 @@
@@ -722,15 +786,48 @@
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel));
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.THUNDER_LEVEL_CHANGE, this.thunderLevel));
}
@ -243,7 +243,8 @@
}
private void resetWeatherCycle() {
@VisibleForTesting
public void resetWeatherCycle() {
- this.serverLevelData.setRainTime(0);
+ // CraftBukkit start
this.serverLevelData.setRaining(false);
@ -265,7 +266,7 @@
}
public void resetEmptyTime() {
@@ -746,6 +843,7 @@
@@ -765,6 +862,7 @@
});
gameprofilerfiller.incrementCounter("tickNonPassenger");
entity.tick();
@ -273,7 +274,7 @@
this.getProfiler().pop();
Iterator iterator = entity.getPassengers().iterator();
@@ -769,6 +867,7 @@
@@ -788,6 +886,7 @@
});
gameprofilerfiller.incrementCounter("tickPassenger");
entity1.rideTick();
@ -281,7 +282,7 @@
gameprofilerfiller.pop();
Iterator iterator = entity1.getPassengers().iterator();
@@ -793,6 +892,7 @@
@@ -812,6 +911,7 @@
ChunkProviderServer chunkproviderserver = this.getChunkSource();
if (!flag1) {
@ -289,7 +290,7 @@
if (iprogressupdate != null) {
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
}
@@ -810,11 +910,19 @@
@@ -829,11 +929,19 @@
}
}
@ -310,7 +311,7 @@
}
this.getChunkSource().getDataStorage().save();
@@ -879,15 +987,37 @@
@@ -898,15 +1006,37 @@
@Override
public boolean addFreshEntity(Entity entity) {
@ -351,7 +352,7 @@
}
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
@@ -918,24 +1048,37 @@
@@ -937,24 +1067,37 @@
this.entityManager.addNewEntity(entityplayer);
}
@ -393,7 +394,7 @@
return true;
}
}
@@ -949,10 +1092,32 @@
@@ -968,10 +1111,32 @@
entityplayer.remove(entity_removalreason);
}
@ -426,7 +427,7 @@
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
@@ -961,6 +1126,12 @@
@@ -980,6 +1145,12 @@
double d1 = (double) blockposition.getY() - entityplayer.getY();
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
@ -439,7 +440,7 @@
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
}
@@ -1020,7 +1191,18 @@
@@ -1039,7 +1210,18 @@
Iterator iterator = this.navigatingMobs.iterator();
while (iterator.hasNext()) {
@ -459,10 +460,10 @@
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
if (navigationabstract.shouldRecomputePath(blockposition)) {
@@ -1082,6 +1264,11 @@
@@ -1101,6 +1283,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);
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, SoundEffect soundeffect) {
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, soundeffect);
+ // CraftBukkit start
+ if (explosion.wasCanceled) {
+ return explosion;
@ -471,7 +472,7 @@
if (!explosion.interactsWithBlocks()) {
explosion.clearToBlow();
@@ -1154,13 +1341,20 @@
@@ -1173,13 +1360,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) {
@ -494,7 +495,7 @@
++j;
}
}
@@ -1211,7 +1405,7 @@
@@ -1230,7 +1424,7 @@
@Nullable
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
@ -503,7 +504,7 @@
return null;
} else {
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
@@ -1253,6 +1447,7 @@
@@ -1277,6 +1471,7 @@
@Override
public void setMapData(String s, WorldMap worldmap) {
@ -511,7 +512,7 @@
this.getServer().overworld().getDataStorage().set(s, worldmap);
}
@@ -1550,6 +1745,11 @@
@@ -1574,6 +1769,11 @@
@Override
public void blockUpdated(BlockPosition blockposition, Block block) {
if (!this.isDebug()) {
@ -523,7 +524,7 @@
this.updateNeighborsAt(blockposition, block);
}
@@ -1569,12 +1769,12 @@
@@ -1593,12 +1793,12 @@
}
public boolean isFlat() {
@ -538,7 +539,7 @@
}
@Nullable
@@ -1597,7 +1797,7 @@
@@ -1621,7 +1821,7 @@
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -547,7 +548,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1606,7 +1806,7 @@
@@ -1630,7 +1830,7 @@
object2intopenhashmap.addTo(s, 1);
}
@ -556,7 +557,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1617,17 +1817,33 @@
@@ -1641,17 +1841,33 @@
}
public static void makeObsidianPlatform(WorldServer worldserver) {
@ -592,7 +593,7 @@
}
@Override
@@ -1703,7 +1919,9 @@
@@ -1737,7 +1953,9 @@
a() {}
@ -603,7 +604,7 @@
public void onDestroyed(Entity entity) {
WorldServer.this.getScoreboard().entityRemoved(entity);
@@ -1751,6 +1969,7 @@
@@ -1785,6 +2003,7 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@ -611,7 +612,7 @@
}
public void onTrackingEnd(Entity entity) {
@@ -1787,6 +2006,14 @@
@@ -1821,6 +2040,14 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/LoginListener.java
+++ b/net/minecraft/server/network/LoginListener.java
@@ -39,6 +39,13 @@
@@ -40,6 +40,13 @@
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
@ -14,7 +14,7 @@
public class LoginListener implements PacketLoginInListener, TickablePacketListener {
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
@@ -55,6 +62,7 @@
@@ -56,6 +63,7 @@
@Nullable
private GameProfile authenticatedProfile;
private final String serverId;
@ -22,7 +22,7 @@
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
this.state = LoginListener.EnumProtocolState.HELLO;
@@ -80,6 +88,13 @@
@@ -81,6 +89,13 @@
}
@ -36,7 +36,7 @@
@Override
public boolean isAcceptingMessages() {
return this.connection.isConnected();
@@ -138,10 +153,12 @@
@@ -139,10 +154,12 @@
private void verifyLoginAndFinishConnectionSetup(GameProfile gameprofile) {
PlayerList playerlist = this.server.getPlayerList();
@ -52,7 +52,7 @@
} else {
if (this.server.getCompressionThreshold() >= 0 && !this.connection.isMemoryConnection()) {
this.connection.send(new PacketLoginOutSetCompression(this.server.getCompressionThreshold()), PacketSendListener.thenRun(() -> {
@@ -149,7 +166,7 @@
@@ -150,7 +167,7 @@
}));
}
@ -61,7 +61,7 @@
if (flag) {
this.state = LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT;
@@ -205,6 +222,43 @@
@@ -200,6 +217,43 @@
if (profileresult != null) {
GameProfile gameprofile = profileresult.profile();
@ -105,7 +105,7 @@
LoginListener.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
LoginListener.this.startClientVerification(gameprofile);
} else if (LoginListener.this.server.isSingleplayer()) {
@@ -222,6 +276,11 @@
@@ -217,6 +271,11 @@
LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down"));
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
}
@ -117,7 +117,7 @@
}
}
@@ -247,7 +306,7 @@
@@ -242,7 +301,7 @@
public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket serverboundloginacknowledgedpacket) {
Validate.validState(this.state == LoginListener.EnumProtocolState.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet", new Object[0]);
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile));

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/server/network/PlayerConnection.java
+++ b/net/minecraft/server/network/PlayerConnection.java
@@ -180,6 +180,66 @@
@@ -183,6 +183,67 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.slf4j.Logger;
@ -9,6 +9,7 @@
+import java.util.Arrays;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.function.Function;
+import net.minecraft.network.chat.OutgoingChatMessage;
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
+import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment;
@ -67,7 +68,7 @@
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
static final Logger LOGGER = LogUtils.getLogger();
@@ -191,7 +251,9 @@
@@ -194,7 +255,9 @@
public final PlayerChunkSender chunkSender;
private int tickCount;
private int ackBlockChangesUpTo = -1;
@ -78,19 +79,19 @@
private int dropSpamTickCount;
private double firstGoodX;
private double firstGoodY;
@@ -227,7 +289,7 @@
@@ -229,7 +292,7 @@
private boolean waitingForSwitchToConfig;
public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
- super(minecraftserver, networkmanager, commonlistenercookie);
+ super(minecraftserver, networkmanager, commonlistenercookie, entityplayer); // CraftBukkit
this.lastChatTimeStamp = new AtomicReference(Instant.EPOCH);
this.lastSeenMessages = new LastSeenMessagesValidator(20);
this.messageSignatureCache = MessageSignatureCache.createDefault();
@@ -237,9 +299,25 @@
entityplayer.connection = this;
entityplayer.getTextFilter().join();
this.signedMessageDecoder = minecraftserver.enforceSecureProfile() ? SignedMessageChain.b.REJECT_ALL : SignedMessageChain.b.unsigned(entityplayer.getUUID());
this.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
networkmanager.setListener(this);
this.player = entityplayer;
@@ -239,9 +302,25 @@
Objects.requireNonNull(minecraftserver);
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
- this.chatMessageChain = new FutureChain(minecraftserver);
+ this.chatMessageChain = new FutureChain(minecraftserver.chatExecutor); // CraftBukkit - async chat
}
@ -114,7 +115,7 @@
@Override
public void tick() {
if (this.ackBlockChangesUpTo > -1) {
@@ -291,15 +369,21 @@
@@ -293,15 +372,21 @@
}
this.keepConnectionAlive();
@ -136,7 +137,7 @@
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
}
@@ -390,7 +474,34 @@
@@ -392,7 +477,34 @@
double d9 = entity.getDeltaMovement().lengthSqr();
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
@ -172,7 +173,7 @@
PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8});
this.send(new PacketPlayOutVehicleMove(entity));
return;
@@ -430,14 +541,72 @@
@@ -432,14 +544,72 @@
}
entity.absMoveTo(d3, d4, d5, f, f1);
@ -245,7 +246,7 @@
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);
@@ -471,6 +640,7 @@
@@ -473,6 +643,7 @@
}
this.awaitingPositionFromClient = null;
@ -253,7 +254,7 @@
}
}
@@ -478,7 +648,7 @@
@@ -480,7 +651,7 @@
@Override
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
@ -262,7 +263,7 @@
RecipeBookServer recipebookserver = this.player.getRecipeBook();
Objects.requireNonNull(recipebookserver);
@@ -488,6 +658,7 @@
@@ -490,6 +661,7 @@
@Override
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
@ -270,7 +271,7 @@
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
}
@@ -508,6 +679,12 @@
@@ -510,6 +682,12 @@
@Override
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
@ -283,7 +284,7 @@
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
if (stringreader.canRead() && stringreader.peek() == '/') {
@@ -517,6 +694,7 @@
@@ -519,6 +697,7 @@
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
@ -291,7 +292,7 @@
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
});
}
@@ -762,6 +940,13 @@
@@ -766,6 +945,13 @@
if (container instanceof ContainerMerchant) {
ContainerMerchant containermerchant = (ContainerMerchant) container;
@ -305,7 +306,7 @@
if (!containermerchant.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
@@ -776,6 +961,13 @@
@@ -780,6 +966,13 @@
@Override
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
@ -319,7 +320,7 @@
int i = packetplayinbedit.getSlot();
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
@@ -784,7 +976,7 @@
@@ -788,7 +981,7 @@
Objects.requireNonNull(list);
optional.ifPresent(list::add);
@ -328,7 +329,7 @@
Objects.requireNonNull(list);
stream.forEach(list::add);
@@ -802,7 +994,7 @@
@@ -806,7 +999,7 @@
ItemStack itemstack = this.player.getInventory().getItem(i);
if (itemstack.is(Items.WRITABLE_BOOK)) {
@ -337,7 +338,7 @@
}
}
@@ -827,16 +1019,16 @@
@@ -831,16 +1024,16 @@
this.updateBookPages(list, (s) -> {
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
@ -358,7 +359,7 @@
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
});
@@ -862,6 +1054,7 @@
@@ -866,6 +1059,7 @@
}
itemstack.addTagElement("pages", nbttaglist);
@ -366,7 +367,7 @@
}
@Override
@@ -898,7 +1091,7 @@
@@ -922,7 +1116,7 @@
} else {
WorldServer worldserver = this.player.serverLevel();
@ -375,7 +376,7 @@
if (this.tickCount == 0) {
this.resetPosition();
}
@@ -908,7 +1101,7 @@
@@ -932,7 +1126,7 @@
this.awaitingTeleportTime = this.tickCount;
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
}
@ -384,7 +385,7 @@
} else {
this.awaitingTeleportTime = this.tickCount;
double d0 = clampHorizontal(packetplayinflying.getX(this.player.getX()));
@@ -920,7 +1113,15 @@
@@ -944,7 +1138,15 @@
if (this.player.isPassenger()) {
this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1);
this.player.serverLevel().getChunkSource().move(this.player);
@ -400,43 +401,43 @@
double d3 = this.player.getX();
double d4 = this.player.getY();
double d5 = this.player.getZ();
@@ -939,15 +1140,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
@@ -964,15 +1166,33 @@
++this.receivedMovePacketCount;
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
- if (i > 5) {
+ // CraftBukkit start - handle custom speeds and skipped ticks
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
- if (i > 5) {
+ // CraftBukkit start - handle custom speeds and skipped ticks
+ this.allowedPlayerTicks += (System.currentTimeMillis() / 50) - this.lastTick;
+ this.allowedPlayerTicks = Math.max(this.allowedPlayerTicks, 1);
+ this.lastTick = (int) (System.currentTimeMillis() / 50);
+
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
i = 1;
}
+ if (i > Math.max(this.allowedPlayerTicks, 5)) {
PlayerConnection.LOGGER.debug("{} is sending move packets too frequently ({} packets since last tick)", this.player.getName().getString(), i);
i = 1;
}
+ if (packetplayinflying.hasRot || d10 > 0) {
+ allowedPlayerTicks -= 1;
+ } else {
+ allowedPlayerTicks = 20;
+ }
+ double speed;
+ if (player.getAbilities().flying) {
+ speed = player.getAbilities().flyingSpeed * 20f;
+ } else {
+ speed = player.getAbilities().walkingSpeed * 10f;
+ }
+ if (packetplayinflying.hasRot || d10 > 0) {
+ allowedPlayerTicks -= 1;
+ } else {
+ allowedPlayerTicks = 20;
+ }
+ double speed;
+ if (player.getAbilities().flying) {
+ speed = player.getAbilities().flyingSpeed * 20f;
+ } else {
+ speed = player.getAbilities().walkingSpeed * 10f;
+ }
+
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 (!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 (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(), d6, d7, d8});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -968,6 +1187,7 @@
- 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(), d6, d7, d8});
this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot());
return;
@@ -994,6 +1214,7 @@
boolean flag1 = this.player.verticalCollisionBelow;
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
@ -444,7 +445,7 @@
double d11 = d7;
d6 = d0 - this.player.getX();
@@ -986,9 +1206,70 @@
@@ -1012,9 +1233,70 @@
}
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
@ -516,7 +517,7 @@
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);
@@ -1029,11 +1310,68 @@
@@ -1055,11 +1337,68 @@
return true;
}
@ -586,7 +587,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;
@@ -1045,6 +1383,14 @@
@@ -1071,6 +1410,14 @@
this.awaitingTeleport = 0;
}
@ -601,7 +602,7 @@
this.awaitingTeleportTime = this.tickCount;
this.player.absMoveTo(d0, d1, d2, f, f1);
this.player.connection.send(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
@@ -1053,6 +1399,7 @@
@@ -1079,6 +1426,7 @@
@Override
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
@ -609,7 +610,7 @@
BlockPosition blockposition = packetplayinblockdig.getPos();
this.player.resetLastActionTime();
@@ -1063,14 +1410,46 @@
@@ -1089,14 +1437,46 @@
if (!this.player.isSpectator()) {
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
@ -658,7 +659,7 @@
this.player.drop(false);
}
@@ -1108,6 +1487,7 @@
@@ -1134,6 +1514,7 @@
@Override
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
@ -666,7 +667,7 @@
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
WorldServer worldserver = this.player.serverLevel();
EnumHand enumhand = packetplayinuseitem.getHand();
@@ -1131,6 +1511,7 @@
@@ -1157,6 +1538,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)) {
@ -674,7 +675,7 @@
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)) {
@@ -1159,6 +1540,7 @@
@@ -1185,6 +1567,7 @@
@Override
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
@ -682,7 +683,7 @@
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
WorldServer worldserver = this.player.serverLevel();
EnumHand enumhand = packetplayinblockplace.getHand();
@@ -1166,6 +1548,49 @@
@@ -1192,6 +1575,49 @@
this.player.resetLastActionTime();
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
@ -732,7 +733,7 @@
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
if (enuminteractionresult.shouldSwing()) {
@@ -1186,7 +1611,7 @@
@@ -1212,7 +1638,7 @@
Entity entity = packetplayinspectate.getEntity(worldserver);
if (entity != null) {
@ -741,7 +742,7 @@
return;
}
}
@@ -1209,6 +1634,13 @@
@@ -1235,6 +1661,13 @@
@Override
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
@ -755,7 +756,7 @@
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
this.removePlayerFromWorld();
super.onDisconnect(ichatbasecomponent);
@@ -1216,10 +1648,18 @@
@@ -1242,10 +1675,18 @@
private void removePlayerFromWorld() {
this.chatMessageChain.close();
@ -775,7 +776,7 @@
this.player.getTextFilter().leave();
}
@@ -1234,7 +1674,16 @@
@@ -1260,7 +1701,16 @@
@Override
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
@ -792,7 +793,7 @@
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
this.player.stopUsingItem();
}
@@ -1243,18 +1692,25 @@
@@ -1269,18 +1719,25 @@
this.player.resetLastActionTime();
} else {
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
@ -811,7 +812,7 @@
if (isChatMessageIllegal(packetplayinchat.message())) {
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
} else {
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.lastSeenMessages());
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.lastSeenMessages());
if (optional.isPresent()) {
- this.server.submit(() -> {
@ -819,19 +820,25 @@
PlayerChatMessage playerchatmessage;
try {
@@ -1272,9 +1728,9 @@
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(ichatbasecomponent).filter(filteredtext.mask());
@@ -1290,7 +1747,7 @@
return;
}
this.broadcastChatMessage(playerchatmessage1);
- }, executor);
+ }, this.server.chatExecutor); // CraftBukkit - async chat
- CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent());
+ CompletableFuture<FilteredText> completablefuture = this.filterTextPacket(playerchatmessage.signedContent()).thenApplyAsync(Function.identity(), this.server.chatExecutor); // CraftBukkit - async chat
IChatBaseComponent ichatbasecomponent = this.server.getChatDecorator().decorate(this.player, playerchatmessage.decoratedContent());
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
@@ -1298,7 +1755,7 @@
this.broadcastChatMessage(playerchatmessage1);
});
- });
+ // }); // CraftBukkit - async chat
}
}
@@ -1289,6 +1745,12 @@
@@ -1313,6 +1770,12 @@
if (optional.isPresent()) {
this.server.submit(() -> {
@ -844,7 +851,7 @@
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
this.detectRateSpam();
});
@@ -1298,12 +1760,25 @@
@@ -1322,12 +1785,25 @@
}
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
@ -872,7 +879,7 @@
} catch (SignedMessageChain.a signedmessagechain_a) {
this.handleMessageDecodeFailure(signedmessagechain_a);
return;
@@ -1311,10 +1786,10 @@
@@ -1335,10 +1811,10 @@
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
@ -885,16 +892,16 @@
}
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
@@ -1355,7 +1830,7 @@
} else {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
@@ -1375,7 +1851,7 @@
private Optional<LastSeenMessages> tryHandleChat(LastSeenMessages.b lastseenmessages_b) {
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
} else {
@@ -1403,6 +1878,116 @@
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
return Optional.empty();
} else {
@@ -1409,6 +1885,116 @@
return false;
}
@ -1011,7 +1018,7 @@
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
@@ -1410,13 +1995,33 @@
@@ -1416,13 +2002,33 @@
}
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
@ -1048,7 +1055,7 @@
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
}
@@ -1438,13 +2043,62 @@
@@ -1444,13 +2050,62 @@
@Override
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
@ -1111,7 +1118,7 @@
this.player.resetLastActionTime();
Entity entity;
IJumpable ijumpable;
@@ -1526,6 +2180,12 @@
@@ -1532,6 +2187,12 @@
}
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
@ -1124,7 +1131,7 @@
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
this.addPendingMessage(playerchatmessage);
}
@@ -1552,6 +2212,7 @@
@@ -1558,6 +2219,7 @@
@Override
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
@ -1132,7 +1139,7 @@
final WorldServer worldserver = this.player.serverLevel();
final Entity entity = packetplayinuseentity.getTarget(worldserver);
@@ -1566,13 +2227,51 @@
@@ -1572,13 +2234,51 @@
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
@ -1185,7 +1192,7 @@
if (enuminteractionresult.consumesAction()) {
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
if (enuminteractionresult.shouldSwing()) {
@@ -1585,23 +2284,29 @@
@@ -1591,23 +2291,29 @@
@Override
public void onInteraction(EnumHand enumhand) {
@ -1218,7 +1225,7 @@
}
} else {
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
@@ -1624,14 +2329,14 @@
@@ -1630,14 +2336,14 @@
case PERFORM_RESPAWN:
if (this.player.wonGame) {
this.player.wonGame = false;
@ -1235,7 +1242,7 @@
if (this.server.isHardcore()) {
this.player.setGameMode(EnumGamemode.SPECTATOR);
((GameRules.GameRuleBoolean) this.player.level().getGameRules().getRule(GameRules.RULE_SPECTATORSGENERATECHUNKS)).set(false, this.server);
@@ -1647,15 +2352,21 @@
@@ -1653,15 +2359,21 @@
@Override
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
@ -1259,7 +1266,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);
@@ -1668,7 +2379,284 @@
@@ -1674,7 +2386,284 @@
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
this.player.containerMenu.suppressRemoteUpdates();
@ -1545,7 +1552,7 @@
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
while (objectiterator.hasNext()) {
@@ -1698,9 +2686,18 @@
@@ -1704,9 +2693,18 @@
if (!this.player.containerMenu.stillValid(this.player)) {
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
} else {
@ -1566,7 +1573,7 @@
}
}
}
@@ -1708,6 +2705,7 @@
@@ -1714,6 +2712,7 @@
@Override
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
@ -1574,7 +1581,7 @@
this.player.resetLastActionTime();
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
if (!this.player.containerMenu.stillValid(this.player)) {
@@ -1750,6 +2748,43 @@
@@ -1756,6 +2755,43 @@
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
@ -1618,7 +1625,7 @@
if (flag1 && flag2) {
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
@@ -1772,6 +2807,7 @@
@@ -1778,6 +2814,7 @@
}
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
@ -1626,7 +1633,7 @@
this.player.resetLastActionTime();
WorldServer worldserver = this.player.serverLevel();
BlockPosition blockposition = packetplayinupdatesign.getPos();
@@ -1793,7 +2829,17 @@
@@ -1799,7 +2836,17 @@
@Override
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
@ -1645,7 +1652,7 @@
}
@Override
@@ -1852,7 +2898,7 @@
@@ -1858,7 +2905,7 @@
if (!this.waitingForSwitchToConfig) {
throw new IllegalStateException("Client acknowledged config, but none was requested");
} else {

View file

@ -113,10 +113,10 @@
@Override
public void handleResourcePackResponse(ServerboundResourcePackPacket serverboundresourcepackpacket) {
@@ -81,6 +156,7 @@
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack rejection", this.playerProfile().getName());
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), serverboundresourcepackpacket.id());
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
}
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[serverboundresourcepackpacket.getAction().ordinal()])); // CraftBukkit
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(getCraftPlayer(), PlayerResourcePackStatusEvent.Status.values()[serverboundresourcepackpacket.action().ordinal()])); // CraftBukkit
}

View file

@ -1,18 +1,19 @@
--- a/net/minecraft/server/players/NameReferencingFileConverter.java
+++ b/net/minecraft/server/players/NameReferencingFileConverter.java
@@ -27,6 +27,11 @@
@@ -27,6 +27,12 @@
import net.minecraft.world.level.storage.SavedFile;
import org.slf4j.Logger;
+// CraftBukkit start
+import net.minecraft.nbt.NBTCompressedStreamTools;
+import net.minecraft.nbt.NBTReadLimiter;
+import net.minecraft.nbt.NBTTagCompound;
+// CraftBukkit end
+
public class NameReferencingFileConverter {
static final Logger LOGGER = LogUtils.getLogger();
@@ -87,7 +92,7 @@
@@ -85,7 +91,7 @@
try {
gameprofilebanlist.load();
} catch (IOException ioexception) {
@ -21,7 +22,7 @@
}
}
@@ -145,7 +150,7 @@
@@ -143,7 +149,7 @@
try {
ipbanlist.load();
} catch (IOException ioexception) {
@ -30,7 +31,7 @@
}
}
@@ -186,7 +191,7 @@
@@ -184,7 +190,7 @@
try {
oplist.load();
} catch (IOException ioexception) {
@ -39,7 +40,7 @@
}
}
@@ -230,7 +235,7 @@
@@ -228,7 +234,7 @@
try {
whitelist.load();
} catch (IOException ioexception) {
@ -48,7 +49,7 @@
}
}
@@ -349,6 +354,30 @@
@@ -347,6 +353,30 @@
File file5 = new File(file, s2 + ".dat");
File file6 = new File(file4, s3 + ".dat");
@ -56,7 +57,7 @@
+ NBTTagCompound root = null;
+
+ try {
+ root = NBTCompressedStreamTools.readCompressed(new java.io.FileInputStream(file5));
+ root = NBTCompressedStreamTools.readCompressed(new java.io.FileInputStream(file5), NBTReadLimiter.unlimitedHeap());
+ } catch (Exception exception) {
+ exception.printStackTrace();
+ }

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -102,6 +102,26 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -101,6 +101,26 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
+// CraftBukkit start
@ -27,7 +27,7 @@
public abstract class PlayerList {
public static final File USERBANLIST_FILE = new File("banned-players.json");
@@ -114,14 +134,16 @@
@@ -113,14 +133,16 @@
private static final int SEND_PLAYER_INFO_INTERVAL = 600;
private static final SimpleDateFormat BAN_DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z");
private final MinecraftServer server;
@ -47,7 +47,7 @@
public final WorldNBTStorage playerIo;
private boolean doWhiteList;
private final LayeredRegistryAccess<RegistryLayer> registries;
@@ -132,13 +154,23 @@
@@ -131,13 +153,23 @@
private static final boolean ALLOW_LOGOUTIVATOR = false;
private int sendAllPlayerInfoIn;
@ -73,7 +73,7 @@
this.server = minecraftserver;
this.registries = layeredregistryaccess;
this.maxPlayers = i;
@@ -161,15 +193,21 @@
@@ -160,15 +192,21 @@
NBTTagCompound nbttagcompound = this.load(entityplayer);
ResourceKey resourcekey;
@ -98,7 +98,7 @@
}
ResourceKey<World> resourcekey1 = resourcekey;
@@ -186,7 +224,8 @@
@@ -185,7 +223,8 @@
entityplayer.setServerLevel(worldserver1);
String s1 = networkmanager.getLoggableAddress(this.server.logIPs());
@ -108,7 +108,7 @@
WorldData worlddata = worldserver1.getLevelData();
entityplayer.loadGameTypes(nbttagcompound);
@@ -197,6 +236,7 @@
@@ -196,6 +235,7 @@
boolean flag2 = gamerules.getBoolean(GameRules.RULE_LIMITED_CRAFTING);
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), this.server.levelKeys(), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, flag2, entityplayer.createCommonSpawnInfo(worldserver1)));
@ -116,7 +116,7 @@
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
playerconnection.send(new PacketPlayOutAbilities(entityplayer.getAbilities()));
playerconnection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
@@ -213,8 +253,10 @@
@@ -212,8 +252,10 @@
} else {
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
}
@ -128,7 +128,7 @@
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
ServerPing serverping = this.server.getStatus();
@@ -222,13 +264,64 @@
@@ -221,13 +263,64 @@
entityplayer.sendServerStatus(serverping);
}
@ -197,7 +197,7 @@
Iterator iterator = entityplayer.getActiveEffects().iterator();
while (iterator.hasNext()) {
@@ -239,8 +332,11 @@
@@ -238,8 +331,11 @@
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
@ -211,7 +211,7 @@
});
if (entity != null) {
@@ -283,6 +379,8 @@
@@ -282,6 +378,8 @@
}
entityplayer.initInventoryMenu();
@ -220,7 +220,7 @@
}
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
@@ -319,30 +417,31 @@
@@ -318,30 +416,31 @@
}
public void addWorldborderListener(WorldServer worldserver) {
@ -257,7 +257,7 @@
}
@Override
@@ -370,14 +469,15 @@
@@ -369,14 +468,15 @@
}
protected void save(EntityPlayer entityplayer) {
@ -275,7 +275,7 @@
if (advancementdataplayer != null) {
advancementdataplayer.save();
@@ -385,10 +485,24 @@
@@ -384,10 +484,24 @@
}
@ -301,7 +301,7 @@
this.save(entityplayer);
if (entityplayer.isPassenger()) {
Entity entity = entityplayer.getRootVehicle();
@@ -412,18 +526,66 @@
@@ -411,18 +525,66 @@
if (entityplayer1 == entityplayer) {
this.playersByUUID.remove(uuid);
@ -374,7 +374,7 @@
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned.reason", gameprofilebanentry.getReason());
@@ -431,10 +593,12 @@
@@ -430,10 +592,12 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
}
@ -390,7 +390,7 @@
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.reason", ipbanentry.getReason());
@@ -442,17 +606,32 @@
@@ -441,17 +605,32 @@
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
}
@ -428,7 +428,7 @@
UUID uuid = gameprofile.getId();
Set<EntityPlayer> set = Sets.newIdentityHashSet();
Iterator iterator = this.players.iterator();
@@ -480,14 +659,24 @@
@@ -479,14 +658,24 @@
}
return !set.isEmpty();
@ -454,7 +454,7 @@
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
Optional optional;
@@ -499,6 +688,11 @@
@@ -498,6 +687,11 @@
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile(), entityplayer.clientInformation());
@ -466,7 +466,7 @@
entityplayer1.connection = entityplayer.connection;
entityplayer1.restoreFrom(entityplayer, flag);
@@ -514,28 +708,66 @@
@@ -513,28 +707,66 @@
boolean flag2 = false;
@ -549,7 +549,7 @@
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
}
@@ -544,21 +776,43 @@
@@ -543,21 +775,43 @@
WorldData worlddata = worldserver2.getLevelData();
entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
@ -598,7 +598,7 @@
return entityplayer1;
}
@@ -571,7 +825,18 @@
@@ -570,7 +824,18 @@
public void tick() {
if (++this.sendAllPlayerInfoIn > 600) {
@ -618,7 +618,7 @@
this.sendAllPlayerInfoIn = 0;
}
@@ -588,6 +853,25 @@
@@ -587,6 +852,25 @@
}
@ -644,7 +644,7 @@
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
Iterator iterator = this.players.iterator();
@@ -666,7 +950,7 @@
@@ -665,7 +949,7 @@
}
public void deop(GameProfile gameprofile) {
@ -653,7 +653,7 @@
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
if (entityplayer != null) {
@@ -690,6 +974,7 @@
@@ -689,6 +973,7 @@
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
}
@ -661,7 +661,7 @@
this.server.getCommands().sendCommands(entityplayer);
}
@@ -722,6 +1007,12 @@
@@ -719,6 +1004,12 @@
for (int i = 0; i < this.players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
@ -674,7 +674,7 @@
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
double d4 = d0 - entityplayer.getX();
double d5 = d1 - entityplayer.getY();
@@ -761,23 +1052,35 @@
@@ -758,15 +1049,19 @@
public void reloadWhiteList() {}
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
@ -697,7 +697,8 @@
+ // CraftBukkit end
}
}
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.LEVEL_CHUNKS_LOAD_START, 0.0F));
@@ -775,8 +1070,16 @@
public void sendAllPlayerInfo(EntityPlayer entityplayer) {
entityplayer.inventoryMenu.sendAllDataToRemote();
@ -715,7 +716,7 @@
}
public int getPlayerCount() {
@@ -833,12 +1136,22 @@
@@ -832,12 +1135,22 @@
}
public void removeAll() {
@ -740,7 +741,7 @@
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
return ichatbasecomponent;
@@ -896,16 +1209,23 @@
@@ -895,16 +1208,23 @@
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
}
@ -768,7 +769,7 @@
Path path = file2.toPath();
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
@@ -914,7 +1234,7 @@
@@ -913,7 +1233,7 @@
}
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
@ -777,7 +778,7 @@
}
return serverstatisticmanager;
@@ -922,13 +1242,13 @@
@@ -921,13 +1241,13 @@
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
UUID uuid = entityplayer.getUUID();
@ -793,7 +794,7 @@
}
advancementdataplayer.setPlayer(entityplayer);
@@ -979,13 +1299,20 @@
@@ -978,13 +1298,20 @@
}
public void reloadResources() {

View file

@ -5,12 +5,12 @@
package net.minecraft.server.players;
import com.google.common.collect.ImmutableList;
@@ -81,7 +82,7 @@
}
@@ -85,7 +86,7 @@
}
public void onProfileLookupFailed(String s1, Exception exception) {
- atomicreference.set((Object) null);
+ atomicreference.set(null); // CraftBukkit - decompile error
}
};
public void onProfileLookupFailed(String s1, Exception exception) {
- atomicreference.set((Object) null);
+ atomicreference.set(null); // CraftBukkit - decompile error
}
};

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
@@ -448,6 +448,18 @@
@@ -455,6 +455,18 @@
datafixerbuilder.addFixer(new DataConverterItemFrame(schema44, false));
Schema schema45 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
@ -19,54 +19,54 @@
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema45, false));
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema45, false));
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema45, false));
@@ -766,12 +778,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);
@@ -776,12 +788,14 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Squid", DataConverterTypes.ENTITY));
datafixerbuilder.addFixer(new DataConverterAddChoices(schema130, "Added Glow Item Frame", DataConverterTypes.ENTITY));
Schema schema131 = datafixerbuilder.addSchema(2690, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap = ImmutableMap.builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap = ImmutableMap.<String, String>builder().put("minecraft:weathered_copper_block", "minecraft:oxidized_copper_block").put("minecraft:semi_weathered_copper_block", "minecraft:weathered_copper_block").put("minecraft:lightly_weathered_copper_block", "minecraft:exposed_copper_block").put("minecraft:weathered_cut_copper", "minecraft:oxidized_cut_copper").put("minecraft:semi_weathered_cut_copper", "minecraft:weathered_cut_copper").put("minecraft:lightly_weathered_cut_copper", "minecraft:exposed_cut_copper").put("minecraft:weathered_cut_copper_stairs", "minecraft:oxidized_cut_copper_stairs").put("minecraft:semi_weathered_cut_copper_stairs", "minecraft:weathered_cut_copper_stairs").put("minecraft:lightly_weathered_cut_copper_stairs", "minecraft:exposed_cut_copper_stairs").put("minecraft:weathered_cut_copper_slab", "minecraft:oxidized_cut_copper_slab").put("minecraft:semi_weathered_cut_copper_slab", "minecraft:weathered_cut_copper_slab").put("minecraft:lightly_weathered_cut_copper_slab", "minecraft:exposed_cut_copper_slab").put("minecraft:waxed_semi_weathered_copper", "minecraft:waxed_weathered_copper").put("minecraft:waxed_lightly_weathered_copper", "minecraft:waxed_exposed_copper").put("minecraft:waxed_semi_weathered_cut_copper", "minecraft:waxed_weathered_cut_copper").put("minecraft:waxed_lightly_weathered_cut_copper", "minecraft:waxed_exposed_cut_copper").put("minecraft:waxed_semi_weathered_cut_copper_stairs", "minecraft:waxed_weathered_cut_copper_stairs").put("minecraft:waxed_lightly_weathered_cut_copper_stairs", "minecraft:waxed_exposed_cut_copper_stairs").put("minecraft:waxed_semi_weathered_cut_copper_slab", "minecraft:waxed_weathered_cut_copper_slab").put("minecraft:waxed_lightly_weathered_cut_copper_slab", "minecraft:waxed_exposed_cut_copper_slab").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema130, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema130, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap)));
Schema schema131 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
datafixerbuilder.addFixer(DataConverterItemName.create(schema131, "Renamed copper block items to new oxidized terms", createRenamer(immutablemap)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema131, "Renamed copper blocks to new oxidized terms", createRenamer(immutablemap)));
Schema schema132 = datafixerbuilder.addSchema(2691, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap1 = ImmutableMap.builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap1 = ImmutableMap.<String, String>builder().put("minecraft:waxed_copper", "minecraft:waxed_copper_block").put("minecraft:oxidized_copper_block", "minecraft:oxidized_copper").put("minecraft:weathered_copper_block", "minecraft:weathered_copper").put("minecraft:exposed_copper_block", "minecraft:exposed_copper").build();
datafixerbuilder.addFixer(DataConverterItemName.create(schema131, "Rename copper item suffixes", createRenamer(immutablemap1)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema131, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
@@ -779,7 +793,8 @@
datafixerbuilder.addFixer(DataConverterItemName.create(schema132, "Rename copper item suffixes", createRenamer(immutablemap1)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
@@ -789,7 +803,8 @@
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema132, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
Schema schema133 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema133, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
Schema schema134 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
- ImmutableMap<String, String> immutablemap2 = ImmutableMap.builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap2 = ImmutableMap.<String, String>builder().put("minecraft:grimstone", "minecraft:deepslate").put("minecraft:grimstone_slab", "minecraft:cobbled_deepslate_slab").put("minecraft:grimstone_stairs", "minecraft:cobbled_deepslate_stairs").put("minecraft:grimstone_wall", "minecraft:cobbled_deepslate_wall").put("minecraft:polished_grimstone", "minecraft:polished_deepslate").put("minecraft:polished_grimstone_slab", "minecraft:polished_deepslate_slab").put("minecraft:polished_grimstone_stairs", "minecraft:polished_deepslate_stairs").put("minecraft:polished_grimstone_wall", "minecraft:polished_deepslate_wall").put("minecraft:grimstone_tiles", "minecraft:deepslate_tiles").put("minecraft:grimstone_tile_slab", "minecraft:deepslate_tile_slab").put("minecraft:grimstone_tile_stairs", "minecraft:deepslate_tile_stairs").put("minecraft:grimstone_tile_wall", "minecraft:deepslate_tile_wall").put("minecraft:grimstone_bricks", "minecraft:deepslate_bricks").put("minecraft:grimstone_brick_slab", "minecraft:deepslate_brick_slab").put("minecraft:grimstone_brick_stairs", "minecraft:deepslate_brick_stairs").put("minecraft:grimstone_brick_wall", "minecraft:deepslate_brick_wall").put("minecraft:chiseled_grimstone", "minecraft:chiseled_deepslate").build();
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)));
@@ -866,10 +881,11 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema158, "Added Allay", DataConverterTypes.ENTITY));
Schema schema159 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
datafixerbuilder.addFixer(DataConverterItemName.create(schema134, "Renamed grimstone block items to deepslate", createRenamer(immutablemap2)));
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema134, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
@@ -876,10 +891,11 @@
datafixerbuilder.addFixer(new DataConverterAddChoices(schema159, "Added Allay", DataConverterTypes.ENTITY));
Schema schema160 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
- 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())));
- datafixerbuilder.addFixer(new NamespacedTypeRenameFix(schema160, "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 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);
+ datafixerbuilder.addFixer(new NamespacedTypeRenameFix(schema160, "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 schema161 = datafixerbuilder.addSchema(3086, DataConverterRegistry.SAME_NAMESPACED);
TypeReference typereference = DataConverterTypes.ENTITY;
- Int2ObjectOpenHashMap int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> {
+ Int2ObjectOpenHashMap<String> int2objectopenhashmap = (Int2ObjectOpenHashMap) SystemUtils.make(new Int2ObjectOpenHashMap(), (int2objectopenhashmap1) -> { // CraftBukkit - decompile error
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
int2objectopenhashmap1.put(0, "minecraft:tabby");
int2objectopenhashmap1.put(1, "minecraft:black");
@@ -886,7 +902,8 @@
@@ -896,7 +912,8 @@
Objects.requireNonNull(int2objectopenhashmap);
datafixerbuilder.addFixer(new EntityVariantFix(schema160, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
datafixerbuilder.addFixer(new EntityVariantFix(schema161, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
- ImmutableMap<String, String> immutablemap3 = ImmutableMap.builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build();
+ // CraftBukkit - decompile error
+ ImmutableMap<String, String> immutablemap3 = ImmutableMap.<String, String>builder().put("textures/entity/cat/tabby.png", "minecraft:tabby").put("textures/entity/cat/black.png", "minecraft:black").put("textures/entity/cat/red.png", "minecraft:red").put("textures/entity/cat/siamese.png", "minecraft:siamese").put("textures/entity/cat/british_shorthair.png", "minecraft:british").put("textures/entity/cat/calico.png", "minecraft:calico").put("textures/entity/cat/persian.png", "minecraft:persian").put("textures/entity/cat/ragdoll.png", "minecraft:ragdoll").put("textures/entity/cat/white.png", "minecraft:white").put("textures/entity/cat/jellie.png", "minecraft:jellie").put("textures/entity/cat/all_black.png", "minecraft:all_black").build();
datafixerbuilder.addFixer(new CriteriaRenameFix(schema160, "Migrate cat variant advancement", "minecraft:husbandry/complete_catalogue", (s) -> {
datafixerbuilder.addFixer(new CriteriaRenameFix(schema161, "Migrate cat variant advancement", "minecraft:husbandry/complete_catalogue", (s) -> {
return (String) immutablemap3.getOrDefault(s, s);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -125,8 +125,65 @@
@@ -126,8 +126,65 @@
import org.joml.Vector3f;
import org.slf4j.Logger;
@ -35,7 +35,7 @@
+import org.bukkit.plugin.PluginManager;
+// CraftBukkit end
+
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener {
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
+ // CraftBukkit start
+ private static final int CURRENT_LEVEL = 2;
@ -66,16 +66,7 @@
private static final Logger LOGGER = LogUtils.getLogger();
public static final String ID_TAG = "id";
public static final String PASSENGERS_TAG = "Passengers";
@@ -189,7 +246,7 @@
public double zOld;
private float maxUpStep;
public boolean noPhysics;
- protected final RandomSource random;
+ public final RandomSource random;
public int tickCount;
private int remainingFireTicks;
public boolean wasTouchingWater;
@@ -241,6 +298,29 @@
@@ -242,6 +299,29 @@
public boolean hasVisualFire;
@Nullable
private IBlockData feetBlockState;
@ -105,7 +96,7 @@
public Entity(EntityTypes<?> entitytypes, World world) {
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
@@ -374,6 +454,12 @@
@@ -375,6 +455,12 @@
public void onClientRemoval() {}
public void setPose(EntityPose entitypose) {
@ -118,7 +109,7 @@
this.entityData.set(Entity.DATA_POSE, entitypose);
}
@@ -398,6 +484,33 @@
@@ -399,6 +485,33 @@
}
protected void setRot(float f, float f1) {
@ -152,7 +143,7 @@
this.setYRot(f % 360.0F);
this.setXRot(f1 % 360.0F);
}
@@ -439,6 +552,15 @@
@@ -440,6 +553,15 @@
this.baseTick();
}
@ -168,7 +159,7 @@
public void baseTick() {
this.level().getProfiler().push("entityBaseTick");
this.feetBlockState = null;
@@ -453,7 +575,7 @@
@@ -454,7 +576,7 @@
this.walkDistO = this.walkDist;
this.xRotO = this.getXRot();
this.yRotO = this.getYRot();
@ -177,7 +168,7 @@
if (this.canSpawnSprintParticle()) {
this.spawnSprintParticle();
}
@@ -488,6 +610,10 @@
@@ -489,6 +611,10 @@
if (this.isInLava()) {
this.lavaHurt();
this.fallDistance *= 0.5F;
@ -188,7 +179,7 @@
}
this.checkBelowWorld();
@@ -539,15 +665,48 @@
@@ -540,15 +666,48 @@
public void lavaHurt() {
if (!this.fireImmune()) {
@ -238,7 +229,7 @@
int j = i * 20;
if (this instanceof EntityLiving) {
@@ -698,6 +857,28 @@
@@ -699,6 +858,28 @@
block.updateEntityAfterFallOn(this.level(), this);
}
@ -267,7 +258,7 @@
if (this.onGround()) {
block.stepOn(this.level(), blockposition, iblockdata, this);
}
@@ -1025,6 +1206,20 @@
@@ -1026,6 +1207,20 @@
return SoundEffects.GENERIC_SPLASH;
}
@ -288,7 +279,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);
@@ -1439,6 +1634,7 @@
@@ -1440,6 +1635,7 @@
this.yo = d1;
this.zo = d4;
this.setPos(d3, d1, d4);
@ -296,7 +287,7 @@
}
public void moveTo(Vec3D vec3d) {
@@ -1633,6 +1829,12 @@
@@ -1634,6 +1830,12 @@
return false;
}
@ -309,7 +300,7 @@
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
if (entity instanceof EntityPlayer) {
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
@@ -1661,16 +1863,22 @@
@@ -1662,16 +1864,22 @@
}
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
@ -334,7 +325,7 @@
return true;
}
}
@@ -1681,16 +1889,38 @@
@@ -1682,16 +1890,38 @@
}
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
@ -377,7 +368,7 @@
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
nbttagcompound.putFloat("FallDistance", this.fallDistance);
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
@@ -1698,7 +1928,28 @@
@@ -1699,7 +1929,28 @@
nbttagcompound.putBoolean("OnGround", this.onGround());
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
@ -407,7 +398,7 @@
IChatBaseComponent ichatbasecomponent = this.getCustomName();
if (ichatbasecomponent != null) {
@@ -1747,7 +1998,7 @@
@@ -1748,7 +1999,7 @@
nbttagcompound.put("Tags", nbttaglist);
}
@ -416,7 +407,7 @@
if (this.isVehicle()) {
nbttaglist = new NBTTagList();
iterator = this.getPassengers().iterator();
@@ -1756,7 +2007,7 @@
@@ -1757,7 +2008,7 @@
Entity entity = (Entity) iterator.next();
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@ -425,7 +416,7 @@
nbttaglist.add(nbttagcompound1);
}
}
@@ -1766,6 +2017,11 @@
@@ -1767,6 +2018,11 @@
}
}
@ -437,7 +428,7 @@
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -1849,6 +2105,45 @@
@@ -1850,6 +2106,45 @@
} else {
throw new IllegalStateException("Entity has invalid position");
}
@ -483,7 +474,7 @@
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
@@ -1870,6 +2165,12 @@
@@ -1871,6 +2166,12 @@
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
}
@ -496,7 +487,7 @@
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
@@ -1924,9 +2225,22 @@
@@ -1925,9 +2226,22 @@
} else if (this.level().isClientSide) {
return null;
} else {
@ -519,7 +510,7 @@
this.level().addFreshEntity(entityitem);
return entityitem;
}
@@ -2024,6 +2338,18 @@
@@ -2025,6 +2339,18 @@
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
return false;
} else {
@ -538,7 +529,7 @@
if (this.isPassenger()) {
this.stopRiding();
}
@@ -2057,7 +2383,7 @@
@@ -2058,7 +2384,7 @@
Entity entity = this.vehicle;
this.vehicle = null;
@ -547,7 +538,7 @@
}
}
@@ -2088,10 +2414,29 @@
@@ -2089,10 +2415,29 @@
}
}
@ -578,7 +569,7 @@
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
this.passengers = ImmutableList.of();
} else {
@@ -2103,6 +2448,7 @@
@@ -2104,6 +2449,7 @@
entity.boardingCooldown = 60;
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
}
@ -586,7 +577,7 @@
}
protected boolean canAddPassenger(Entity entity) {
@@ -2189,14 +2535,20 @@
@@ -2190,14 +2536,20 @@
if (this.isInsidePortal) {
MinecraftServer minecraftserver = worldserver.getServer();
@ -610,7 +601,7 @@
this.level().getProfiler().pop();
}
@@ -2320,6 +2672,13 @@
@@ -2321,6 +2673,13 @@
}
public void setSwimming(boolean flag) {
@ -624,7 +615,7 @@
this.setSharedFlag(4, flag);
}
@@ -2369,8 +2728,12 @@
@@ -2370,8 +2729,12 @@
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
}
@ -638,7 +629,7 @@
}
public boolean getSharedFlag(int i) {
@@ -2389,7 +2752,7 @@
@@ -2390,7 +2753,7 @@
}
public int getMaxAirSupply() {
@ -647,7 +638,7 @@
}
public int getAirSupply() {
@@ -2397,7 +2760,18 @@
@@ -2398,7 +2761,18 @@
}
public void setAirSupply(int i) {
@ -667,7 +658,7 @@
}
public int getTicksFrozen() {
@@ -2424,11 +2798,41 @@
@@ -2425,11 +2799,41 @@
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
this.setRemainingFireTicks(this.remainingFireTicks + 1);
@ -711,7 +702,7 @@
}
public void onAboveBubbleCol(boolean flag) {
@@ -2593,15 +2997,38 @@
@@ -2594,15 +2998,38 @@
@Nullable
public Entity changeDimension(WorldServer worldserver) {
@ -752,7 +743,7 @@
this.level().getProfiler().popPush("reloading");
Entity entity = this.getType().create(worldserver);
@@ -2609,10 +3036,22 @@
@@ -2610,10 +3037,22 @@
entity.restoreFrom(this);
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
entity.setDeltaMovement(shapedetectorshape.speed);
@ -778,7 +769,7 @@
}
this.removeAfterChangingDimensions();
@@ -2633,20 +3072,34 @@
@@ -2634,20 +3073,34 @@
@Nullable
protected ShapeDetectorShape findDimensionEntryPoint(WorldServer worldserver) {
@ -818,7 +809,7 @@
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
EnumDirection.EnumAxis enumdirection_enumaxis;
Vec3D vec3d;
@@ -2663,8 +3116,8 @@
@@ -2664,8 +3117,8 @@
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
}
@ -829,7 +820,7 @@
}
} else {
BlockPosition blockposition1;
@@ -2674,8 +3127,14 @@
@@ -2675,8 +3128,14 @@
} else {
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
}
@ -845,7 +836,7 @@
}
}
@@ -2683,8 +3142,23 @@
@@ -2684,8 +3143,23 @@
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
}
@ -871,7 +862,7 @@
}
public boolean canChangeDimensions() {
@@ -2804,6 +3278,12 @@
@@ -2806,6 +3280,12 @@
}
}
@ -884,7 +875,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);
@@ -2823,7 +3303,11 @@
@@ -2825,7 +3305,11 @@
entity.moveTo(d0, d1, d2, f, f2);
entity.setYHeadRot(f);
this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION);
@ -897,7 +888,7 @@
}
return true;
@@ -2929,7 +3413,26 @@
@@ -2931,7 +3415,26 @@
}
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
@ -925,7 +916,7 @@
}
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
@@ -3240,6 +3743,11 @@
@@ -3246,6 +3749,11 @@
vec3d = vec3d.add(vec3d1);
++k1;
}

View file

@ -64,7 +64,7 @@
@@ -250,9 +273,17 @@
if (entry != null) {
ItemStack itemstack = (ItemStack) entry.getValue();
int j = Math.min(this.xpToDurability(this.value), itemstack.getDamageValue());
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
+ // CraftBukkit start
+ org.bukkit.event.player.PlayerItemMendEvent event = CraftEventFactory.callPlayerItemMendEvent(entityhuman, this, itemstack, entry.getKey(), j);
+ j = event.getRepairAmount();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityInsentient.java
+++ b/net/minecraft/world/entity/EntityInsentient.java
@@ -75,6 +75,19 @@
@@ -76,6 +76,19 @@
import net.minecraft.world.level.pathfinder.PathType;
import net.minecraft.world.phys.AxisAlignedBB;
@ -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);
@@ -122,6 +135,8 @@
@@ -123,6 +136,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);
@@ -147,6 +162,12 @@
@@ -148,6 +163,12 @@
}
@ -42,7 +42,7 @@
protected void registerGoals() {}
public static AttributeProvider.Builder createMobAttributes() {
@@ -258,7 +279,38 @@
@@ -259,7 +280,38 @@
}
public void setTarget(@Nullable EntityLiving entityliving) {
@ -81,7 +81,7 @@
}
@Override
@@ -398,6 +450,12 @@
@@ -399,6 +451,12 @@
return null;
}
@ -94,7 +94,7 @@
@Override
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
super.addAdditionalSaveData(nbttagcompound);
@@ -456,7 +514,7 @@
@@ -457,7 +515,7 @@
}
nbttagcompound.put("HandDropChances", nbttaglist3);
@ -103,7 +103,7 @@
nbttagcompound2 = new NBTTagCompound();
if (this.leashHolder instanceof EntityLiving) {
UUID uuid = this.leashHolder.getUUID();
@@ -487,16 +545,26 @@
@@ -488,16 +546,26 @@
nbttagcompound.putBoolean("NoAI", this.isNoAi());
}
@ -132,7 +132,7 @@
NBTTagList nbttaglist;
int i;
@@ -543,6 +611,11 @@
@@ -544,6 +612,11 @@
}
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
@ -144,7 +144,7 @@
}
@Override
@@ -610,7 +683,7 @@
@@ -611,7 +684,7 @@
protected void pickUpItem(EntityItem entityitem) {
ItemStack itemstack = entityitem.getItem();
@ -153,7 +153,7 @@
if (!itemstack1.isEmpty()) {
this.onItemPickup(entityitem);
@@ -624,6 +697,12 @@
@@ -625,6 +698,12 @@
}
public ItemStack equipItemIfPossible(ItemStack itemstack) {
@ -166,7 +166,7 @@
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
@@ -634,11 +713,19 @@
@@ -635,11 +714,19 @@
flag = itemstack1.isEmpty();
}
@ -187,7 +187,7 @@
}
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
@@ -790,6 +877,7 @@
@@ -791,6 +878,7 @@
@Override
protected final void serverAiStep() {
++this.noActionTime;
@ -195,7 +195,7 @@
this.level().getProfiler().push("sensing");
this.sensing.tick();
this.level().getProfiler().pop();
@@ -1183,6 +1271,12 @@
@@ -1184,6 +1272,12 @@
if (!this.isAlive()) {
return EnumInteractionResult.PASS;
} else if (this.getLeashHolder() == entityhuman) {
@ -208,7 +208,7 @@
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1208,6 +1302,12 @@
@@ -1209,6 +1303,12 @@
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
@ -221,7 +221,7 @@
this.setLeashedTo(entityhuman, true);
itemstack.shrink(1);
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
@@ -1223,7 +1323,7 @@
@@ -1224,7 +1324,7 @@
if (itemstack.getItem() instanceof ItemMonsterEgg) {
if (this.level() instanceof WorldServer) {
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
@ -230,7 +230,7 @@
optional.ifPresent((entityinsentient) -> {
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
@@ -1273,12 +1373,19 @@
@@ -1274,12 +1374,19 @@
return this.restrictRadius != -1.0F;
}
@ -251,7 +251,7 @@
if (t0 == null) {
return null;
@@ -1312,7 +1419,12 @@
@@ -1313,7 +1420,12 @@
}
}
@ -265,7 +265,7 @@
if (this.isPassenger()) {
Entity entity = this.getVehicle();
@@ -1333,7 +1445,8 @@
@@ -1334,7 +1446,8 @@
if (this.leashHolder != null) {
if (!this.isAlive() || !this.leashHolder.isAlive()) {
@ -275,7 +275,7 @@
}
}
@@ -1344,7 +1457,9 @@
@@ -1345,7 +1458,9 @@
this.leashHolder = null;
this.leashInfoTag = null;
if (!this.level().isClientSide && flag1) {
@ -285,7 +285,7 @@
}
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
@@ -1394,6 +1509,7 @@
@@ -1395,6 +1510,7 @@
boolean flag1 = super.startRiding(entity, flag);
if (flag1 && this.isLeashed()) {
@ -293,7 +293,7 @@
this.dropLeash(true, true);
}
@@ -1418,7 +1534,9 @@
@@ -1419,7 +1535,9 @@
}
if (this.tickCount > 100) {
@ -303,7 +303,7 @@
this.leashInfoTag = null;
}
}
@@ -1500,7 +1618,14 @@
@@ -1501,7 +1619,14 @@
int i = EnchantmentManager.getFireAspect(this);
if (i > 0) {
@ -319,7 +319,7 @@
}
boolean flag = entity.hurt(this.damageSources().mobAttack(this), f);
@@ -1574,6 +1699,7 @@
@@ -1576,6 +1701,7 @@
@Override
protected void removeAfterChangingDimensions() {
super.removeAfterChangingDimensions();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityLightning.java
+++ b/net/minecraft/world/entity/EntityLightning.java
@@ -29,14 +29,18 @@
@@ -29,6 +29,10 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.Vec3D;
@ -11,16 +11,6 @@
public class EntityLightning extends Entity {
private static final int START_LIFE = 2;
private static final double DAMAGE_RADIUS = 3.0D;
private static final double DETECTION_RADIUS = 15.0D;
- private int life;
+ public int life; // PAIL private -> public
public long seed;
- private int flashes;
+ public int flashes; // PAIL private -> public
public boolean visualOnly;
@Nullable
private EntityPlayer cause;
@@ -129,7 +133,7 @@
}
}

View file

@ -31,7 +31,7 @@
public abstract class EntityLiving extends Entity implements Attackable {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -227,6 +251,20 @@
@@ -226,6 +250,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);
@@ -239,7 +277,9 @@
@@ -238,7 +276,9 @@
this.useItem = ItemStack.EMPTY;
this.lastClimbablePos = Optional.empty();
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
@ -63,7 +63,7 @@
this.blocksBuilding = true;
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
this.reapplyPosition();
@@ -318,7 +358,13 @@
@@ -317,7 +357,13 @@
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d7);
@ -78,7 +78,7 @@
}
super.checkFallDamage(d0, flag, iblockdata, blockposition);
@@ -673,13 +719,19 @@
@@ -672,13 +718,19 @@
}
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
@ -99,7 +99,7 @@
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
}
@@ -753,6 +805,17 @@
@@ -752,6 +804,17 @@
}
}
@ -117,7 +117,7 @@
if (nbttagcompound.contains("Health", 99)) {
this.setHealth(nbttagcompound.getFloat("Health"));
}
@@ -790,9 +853,32 @@
@@ -789,9 +852,32 @@
}
@ -150,7 +150,7 @@
try {
while (iterator.hasNext()) {
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
@@ -802,6 +888,12 @@
@@ -801,6 +887,12 @@
this.onEffectUpdated(mobeffect, true, (Entity) null);
})) {
if (!this.level().isClientSide) {
@ -163,7 +163,7 @@
iterator.remove();
this.onEffectRemoved(mobeffect);
}
@@ -812,6 +904,17 @@
@@ -811,6 +903,17 @@
} catch (ConcurrentModificationException concurrentmodificationexception) {
;
}
@ -181,7 +181,7 @@
if (this.effectsDirty) {
if (!this.level().isClientSide) {
@@ -938,7 +1041,13 @@
@@ -937,7 +1040,13 @@
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
}
@ -195,7 +195,7 @@
if (this.level().isClientSide) {
return false;
} else {
@@ -947,7 +1056,14 @@
@@ -946,7 +1055,14 @@
boolean flag;
for (flag = false; iterator.hasNext(); flag = true) {
@ -211,7 +211,7 @@
iterator.remove();
}
@@ -976,19 +1092,49 @@
@@ -975,19 +1091,49 @@
return this.addEffect(mobeffect, (Entity) null);
}
@ -262,7 +262,7 @@
flag = true;
}
@@ -1026,13 +1172,39 @@
@@ -1025,13 +1171,39 @@
return this.getMobType() == EnumMonsterType.UNDEAD;
}
@ -303,7 +303,7 @@
if (mobeffect != null) {
this.onEffectRemoved(mobeffect);
@@ -1130,20 +1302,55 @@
@@ -1129,20 +1301,55 @@
}
@ -360,7 +360,7 @@
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
}
@@ -1157,7 +1364,7 @@
@@ -1156,7 +1363,7 @@
return false;
} else if (this.level().isClientSide) {
return false;
@ -369,7 +369,7 @@
return false;
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
return false;
@@ -1168,10 +1375,11 @@
@@ -1167,10 +1374,11 @@
this.noActionTime = 0;
float f1 = f;
@ -383,7 +383,7 @@
this.hurtCurrentlyUsedShield(f);
f2 = f;
f = 0.0F;
@@ -1195,23 +1403,33 @@
@@ -1194,23 +1402,33 @@
this.walkAnimation.setSpeed(1.5F);
boolean flag1 = true;
@ -422,7 +422,7 @@
this.hurtHelmet(damagesource, f);
f *= 0.75F;
}
@@ -1329,19 +1547,32 @@
@@ -1328,19 +1546,32 @@
EnumHand[] aenumhand = EnumHand.values();
int i = aenumhand.length;
@ -459,7 +459,7 @@
EntityPlayer entityplayer = (EntityPlayer) this;
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
@@ -1350,14 +1581,16 @@
@@ -1349,14 +1580,16 @@
}
this.setHealth(1.0F);
@ -481,7 +481,7 @@
}
}
@@ -1466,14 +1699,22 @@
@@ -1463,14 +1696,22 @@
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
@ -506,7 +506,7 @@
this.level().addFreshEntity(entityitem);
}
}
@@ -1493,21 +1734,40 @@
@@ -1490,21 +1731,40 @@
boolean flag = this.lastHurtByPlayerTime > 0;
@ -550,7 +550,7 @@
}
@@ -1599,6 +1859,28 @@
@@ -1596,6 +1856,28 @@
return itemstack.getEatingSound();
}
@ -579,7 +579,7 @@
public Optional<BlockPosition> getLastClimbablePos() {
return this.lastClimbablePos;
}
@@ -1645,9 +1927,14 @@
@@ -1642,9 +1924,14 @@
int i = this.calculateFallDamage(f, f1);
if (i > 0) {
@ -595,7 +595,7 @@
return true;
} else {
return flag;
@@ -1699,7 +1986,7 @@
@@ -1696,7 +1983,7 @@
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
@ -604,7 +604,7 @@
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
}
@@ -1712,7 +1999,8 @@
@@ -1709,7 +1996,8 @@
} else {
int i;
@ -614,7 +614,7 @@
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
int j = 25 - i;
float f1 = f * (float) j;
@@ -1745,16 +2033,125 @@
@@ -1742,16 +2030,125 @@
}
}
@ -748,7 +748,7 @@
if (f2 > 0.0F && f2 < 3.4028235E37F) {
Entity entity = damagesource.getEntity();
@@ -1765,13 +2162,47 @@
@@ -1762,13 +2159,47 @@
}
}
@ -798,7 +798,7 @@
}
public CombatTracker getCombatTracker() {
@@ -1796,8 +2227,18 @@
@@ -1793,8 +2224,18 @@
}
public final void setArrowCount(int i) {
@ -818,7 +818,7 @@
public final int getStingerCount() {
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
@@ -2039,6 +2480,12 @@
@@ -2036,6 +2477,12 @@
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
@ -831,7 +831,7 @@
@Override
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
@@ -2273,6 +2720,7 @@
@@ -2270,6 +2717,7 @@
}
if (this.onGround() && !this.level().isClientSide) {
@ -839,7 +839,7 @@
this.setSharedFlag(7, false);
}
} else {
@@ -2443,7 +2891,7 @@
@@ -2440,7 +2888,7 @@
}
}
@ -848,7 +848,7 @@
if (this.tickCount % 20 == 0) {
this.getCombatTracker().recheckStatus();
}
@@ -2540,7 +2988,7 @@
@@ -2537,7 +2985,7 @@
this.refreshDirtyAttributes();
}
@ -857,7 +857,7 @@
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
if (map != null) {
@@ -2837,6 +3285,7 @@
@@ -2839,6 +3287,7 @@
}
if (!this.level().isClientSide) {
@ -865,7 +865,7 @@
this.setSharedFlag(7, flag);
}
@@ -3027,13 +3476,20 @@
@@ -3029,13 +3478,20 @@
@Override
public boolean isPickable() {
@ -888,7 +888,7 @@
@Override
public float getYHeadRot() {
@@ -3229,7 +3685,26 @@
@@ -3231,7 +3687,26 @@
} else {
if (!this.useItem.isEmpty() && this.isUsingItem()) {
this.triggerItemUseEffects(this.useItem, 16);
@ -916,7 +916,7 @@
if (itemstack != this.useItem) {
this.setItemInHand(enumhand, itemstack);
@@ -3307,6 +3782,12 @@
@@ -3309,6 +3784,12 @@
}
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
@ -929,7 +929,7 @@
double d3 = this.getX();
double d4 = this.getY();
double d5 = this.getZ();
@@ -3331,16 +3812,41 @@
@@ -3333,16 +3814,41 @@
}
if (flag2) {
@ -974,8 +974,8 @@
} else {
if (flag) {
world.broadcastEntityEvent(this, (byte) 46);
@@ -3350,7 +3856,7 @@
((EntityCreature) this).getNavigation().stop();
@@ -3354,7 +3860,7 @@
entitycreature.getNavigation().stop();
}
- return true;
@ -983,7 +983,7 @@
}
}
@@ -3439,7 +3945,7 @@
@@ -3443,7 +3949,7 @@
}
public void stopSleeping() {
@ -992,7 +992,7 @@
World world = this.level();
java.util.Objects.requireNonNull(world);
@@ -3473,7 +3979,7 @@
@@ -3477,7 +3983,7 @@
@Nullable
public EnumDirection getBedOrientation() {
@ -1001,7 +1001,7 @@
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
}
@@ -3521,7 +4027,7 @@
@@ -3525,7 +4031,7 @@
Pair<MobEffect, Float> pair = (Pair) iterator.next();
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/EntityTypes.java
+++ b/net/minecraft/world/entity/EntityTypes.java
@@ -158,6 +158,7 @@
@@ -160,6 +160,7 @@
import net.minecraft.world.phys.AxisAlignedBB;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapes;
@ -8,7 +8,7 @@
import org.slf4j.Logger;
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
@@ -168,7 +169,7 @@
@@ -170,7 +171,7 @@
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
private static final int DISPLAY_TRACKING_RANGE = 10;
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
@ -17,7 +17,7 @@
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).clientTrackingRange(10));
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).clientTrackingRange(4).updateInterval(20));
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).clientTrackingRange(10));
@@ -309,8 +310,8 @@
@@ -313,8 +314,8 @@
private final EntitySize dimensions;
private final FeatureFlagSet requiredFeatures;
@ -28,7 +28,7 @@
}
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
@@ -338,8 +339,15 @@
@@ -342,8 +343,15 @@
@Nullable
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
@ -45,7 +45,7 @@
if (itemstack != null) {
nbttagcompound = itemstack.getTag();
@@ -350,7 +358,7 @@
@@ -354,7 +362,7 @@
nbttagcompound = null;
}
@ -54,7 +54,7 @@
}
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
@@ -372,21 +380,37 @@
@@ -376,21 +384,37 @@
NBTTagCompound nbttagcompound = itemstack.getTag();
return nbttagcompound != null ? consumer.andThen((entity) -> {
@ -95,7 +95,7 @@
}
return t0;
@@ -573,7 +597,7 @@
@@ -577,7 +601,7 @@
}
return entity;
@ -104,7 +104,7 @@
}
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
@@ -634,7 +658,7 @@
@@ -638,7 +662,7 @@
@Nullable
public T tryCast(Entity entity) {
@ -113,7 +113,7 @@
}
@Override
@@ -669,7 +693,7 @@
@@ -673,7 +697,7 @@
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
}

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/IEntitySelector.java
+++ b/net/minecraft/world/entity/IEntitySelector.java
@@ -43,7 +43,7 @@
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteambase == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteambase.getCollisionRule();
@@ -44,7 +44,7 @@
ScoreboardTeamBase.EnumTeamPush scoreboardteambase_enumteampush = scoreboardteam == null ? ScoreboardTeamBase.EnumTeamPush.ALWAYS : scoreboardteam.getCollisionRule();
return (Predicate) (scoreboardteambase_enumteampush == ScoreboardTeamBase.EnumTeamPush.NEVER ? Predicates.alwaysFalse() : IEntitySelector.NO_SPECTATORS.and((entity1) -> {
- if (!entity1.isPushable()) {

View file

@ -2,7 +2,7 @@
+++ b/net/minecraft/world/entity/ai/goal/target/PathfinderGoalTarget.java
@@ -11,6 +11,10 @@
import net.minecraft.world.level.pathfinder.PathPoint;
import net.minecraft.world.scores.ScoreboardTeamBase;
import net.minecraft.world.scores.ScoreboardTeam;
+// CraftBukkit start
+import org.bukkit.event.entity.EntityTargetEvent;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/ambient/EntityBat.java
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
@@ -28,6 +28,10 @@
@@ -29,6 +29,10 @@
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.Vec3D;
@ -10,8 +10,8 @@
+
public class EntityBat extends EntityAmbient {
public static final float FLAP_DEGREES_PER_TICK = 74.48451F;
@@ -139,13 +143,13 @@
public static final float FLAP_LENGTH_SECONDS = 0.5F;
@@ -143,13 +147,13 @@
this.yHeadRot = (float) this.random.nextInt(360);
}
@ -27,7 +27,7 @@
this.setResting(false);
if (!flag) {
this.level().levelEvent((EntityHuman) null, 1025, blockposition, 0);
@@ -172,7 +176,7 @@
@@ -176,7 +180,7 @@
this.zza = 0.5F;
this.setYRot(this.getYRot() + f1);
@ -36,7 +36,7 @@
this.setResting(true);
}
}
@@ -197,7 +201,7 @@
@@ -201,7 +205,7 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {

View file

@ -35,7 +35,7 @@
}
}
@@ -170,10 +182,17 @@
@@ -172,10 +184,17 @@
}
public void setInLove(@Nullable EntityHuman entityhuman) {
@ -54,7 +54,7 @@
this.level().broadcastEntityEvent(this, (byte) 18);
}
@@ -215,12 +234,29 @@
@@ -217,12 +236,29 @@
if (entityageable != null) {
entityageable.setBaby(true);
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
@ -86,7 +86,7 @@
Optional.ofNullable(this.getLoveCause()).or(() -> {
return Optional.ofNullable(entityanimal.getLoveCause());
}).ifPresent((entityplayer) -> {
@@ -233,7 +269,11 @@
@@ -235,7 +271,11 @@
entityanimal.resetLove();
worldserver.broadcastEntityEvent(this, (byte) 18);
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {

View file

@ -20,7 +20,7 @@
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
@@ -190,7 +201,7 @@
@@ -185,7 +196,7 @@
@Override
public int getMaxAirSupply() {
@ -29,7 +29,7 @@
}
@Override
@@ -231,6 +242,12 @@
@@ -226,6 +237,12 @@
ItemStack itemstack = entityitem.getItem();
if (this.canHoldItem(itemstack)) {
@ -42,7 +42,7 @@
this.onItemPickup(entityitem);
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack);
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
@@ -489,7 +506,7 @@
@@ -484,7 +501,7 @@
@Override
public void start() {
@ -51,7 +51,7 @@
}
@Override
@@ -508,7 +525,7 @@
@@ -503,7 +520,7 @@
}
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityParrot.java
+++ b/net/minecraft/world/entity/animal/EntityParrot.java
@@ -262,7 +262,7 @@
@@ -263,7 +263,7 @@
}
if (!this.level().isClientSide) {
@ -9,7 +9,7 @@
this.tame(entityhuman);
this.level().broadcastEntityEvent(this, (byte) 7);
} else {
@@ -276,7 +276,7 @@
@@ -277,7 +277,7 @@
itemstack.shrink(1);
}
@ -18,7 +18,7 @@
if (entityhuman.isCreative() || !this.isInvulnerable()) {
this.hurt(this.damageSources().playerAttack(entityhuman), Float.MAX_VALUE);
}
@@ -383,7 +383,7 @@
@@ -384,7 +384,7 @@
@Override
public boolean isPushable() {
@ -27,7 +27,7 @@
}
@Override
@@ -398,11 +398,14 @@
@@ -399,11 +399,14 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
@@ -312,7 +312,9 @@
@@ -307,7 +307,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
if (!this.isBaby() && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
@ -10,7 +10,7 @@
}
}
@@ -339,7 +341,9 @@
@@ -334,7 +336,9 @@
@Override
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
@ -20,7 +20,7 @@
}
@Override
@@ -496,12 +500,14 @@
@@ -491,12 +495,14 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
World world = this.turtle.level();

View file

@ -27,7 +27,7 @@
}
@Override
@@ -414,7 +421,7 @@
@@ -409,7 +416,7 @@
int i = mobeffect != null ? mobeffect.getDuration() : 0;
int j = Math.min(2400, 100 + i);
@ -36,7 +36,7 @@
}
entityhuman.removeEffect(MobEffects.DIG_SLOWDOWN);
@@ -464,7 +471,7 @@
@@ -459,7 +466,7 @@
@Override
public BehaviorController<Axolotl> getBrain() {

View file

@ -48,7 +48,7 @@
flag = true;
}
@@ -591,7 +598,7 @@
@@ -588,7 +595,7 @@
super.aiStep();
if (!this.level().isClientSide && this.isAlive()) {
if (this.random.nextInt(900) == 0 && this.deathTime == 0) {
@ -57,7 +57,7 @@
}
if (this.canEatGrass()) {
@@ -858,6 +865,7 @@
@@ -855,6 +862,7 @@
if (this.getOwnerUUID() != null) {
nbttagcompound.putUUID("Owner", this.getOwnerUUID());
}
@ -65,7 +65,7 @@
if (!this.inventory.getItem(0).isEmpty()) {
nbttagcompound.put("SaddleItem", this.inventory.getItem(0).save(new NBTTagCompound()));
@@ -885,6 +893,11 @@
@@ -882,6 +890,11 @@
if (uuid != null) {
this.setOwnerUUID(uuid);
}
@ -77,7 +77,7 @@
if (nbttagcompound.contains("SaddleItem", 10)) {
ItemStack itemstack = ItemStack.of(nbttagcompound.getCompound("SaddleItem"));
@@ -987,6 +1000,17 @@
@@ -984,6 +997,17 @@
@Override
public void handleStartJump(int i) {

View file

@ -32,7 +32,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
+ this.explosionSource = new Explosion(world, this, null, null, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, Explosion.Effect.DESTROY, Particles.EXPLOSION, Particles.EXPLOSION_EMITTER, SoundEffects.GENERIC_EXPLODE); // CraftBukkit
}
public void setDragonFight(EnderDragonBattle enderdragonbattle) {

View file

@ -108,7 +108,7 @@
if (damagesource.is(DamageTypeTags.IS_EXPLOSION)) {
this.brokenByAnything(damagesource);
this.kill();
@@ -486,7 +538,7 @@
@@ -473,7 +525,7 @@
} else {
this.brokenByPlayer(damagesource);
this.showBreakingParticles();
@ -117,7 +117,7 @@
}
return true;
@@ -554,13 +606,13 @@
@@ -541,13 +593,13 @@
itemstack.setHoverName(this.getCustomName());
}
@ -133,7 +133,7 @@
ItemStack itemstack;
int i;
@@ -568,7 +620,7 @@
@@ -555,7 +607,7 @@
for (i = 0; i < this.handItems.size(); ++i) {
itemstack = (ItemStack) this.handItems.get(i);
if (!itemstack.isEmpty()) {
@ -142,7 +142,7 @@
this.handItems.set(i, ItemStack.EMPTY);
}
}
@@ -576,10 +628,11 @@
@@ -563,10 +615,11 @@
for (i = 0; i < this.armorItems.size(); ++i) {
itemstack = (ItemStack) this.armorItems.get(i);
if (!itemstack.isEmpty()) {
@ -155,7 +155,7 @@
}
@@ -675,8 +728,16 @@
@@ -662,8 +715,16 @@
return this.isSmall();
}

View file

@ -48,7 +48,7 @@
@Override
public boolean survives() {
@@ -173,6 +185,11 @@
@@ -168,6 +180,11 @@
return false;
} else if (!damagesource.is(DamageTypeTags.IS_EXPLOSION) && !this.getItem().isEmpty()) {
if (!this.level().isClientSide) {
@ -60,7 +60,7 @@
this.dropItem(damagesource.getEntity(), false);
this.gameEvent(GameEvent.BLOCK_CHANGE, damagesource.getEntity());
this.playSound(this.getRemoveItemSound(), 1.0F, 1.0F);
@@ -302,13 +319,19 @@
@@ -297,13 +314,19 @@
}
public void setItem(ItemStack itemstack, boolean flag) {

View file

@ -15,7 +15,7 @@
public class EntityItem extends Entity implements TraceableEntity {
private static final DataWatcherObject<ItemStack> DATA_ITEM = DataWatcher.defineId(EntityItem.class, DataWatcherRegistry.ITEM_STACK);
@@ -45,6 +53,7 @@
@@ -47,6 +55,7 @@
@Nullable
public UUID target;
public final float bobOffs;
@ -23,7 +23,7 @@
public EntityItem(EntityTypes<? extends EntityItem> entitytypes, World world) {
super(entitytypes, world);
@@ -110,9 +119,12 @@
@@ -128,9 +137,12 @@
this.discard();
} else {
super.tick();
@ -39,7 +39,7 @@
this.xo = this.getX();
this.yo = this.getY();
@@ -162,9 +174,11 @@
@@ -180,9 +192,11 @@
this.mergeWithNeighbours();
}
@ -51,7 +51,7 @@
this.hasImpulse |= this.updateInWaterStateAndDoFluidPushing();
if (!this.level().isClientSide) {
@@ -176,6 +190,12 @@
@@ -194,6 +208,12 @@
}
if (!this.level().isClientSide && this.age >= 6000) {
@ -64,7 +64,7 @@
this.discard();
}
@@ -259,6 +279,11 @@
@@ -277,6 +297,11 @@
}
private static void merge(EntityItem entityitem, ItemStack itemstack, EntityItem entityitem1, ItemStack itemstack1) {
@ -76,7 +76,7 @@
merge(entityitem, itemstack, itemstack1);
entityitem.pickupDelay = Math.max(entityitem.pickupDelay, entityitem1.pickupDelay);
entityitem.age = Math.min(entityitem.age, entityitem1.age);
@@ -284,6 +309,11 @@
@@ -302,6 +327,11 @@
} else if (this.level().isClientSide) {
return true;
} else {
@ -88,7 +88,7 @@
this.markHurt();
this.health = (int) ((float) this.health - f);
this.gameEvent(GameEvent.ENTITY_DAMAGE, damagesource.getEntity());
@@ -347,6 +377,46 @@
@@ -366,6 +396,46 @@
Item item = itemstack.getItem();
int i = itemstack.getCount();

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/world/entity/item/EntityTNTPrimed.java
+++ b/net/minecraft/world/entity/item/EntityTNTPrimed.java
@@ -15,12 +15,19 @@
import net.minecraft.world.entity.TraceableEntity;
import net.minecraft.world.level.World;
@@ -19,6 +19,11 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
+// CraftBukkit start;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
@ -12,7 +12,8 @@
public class EntityTNTPrimed extends Entity implements TraceableEntity {
private static final DataWatcherObject<Integer> DATA_FUSE_ID = DataWatcher.defineId(EntityTNTPrimed.class, DataWatcherRegistry.INT);
private static final int DEFAULT_FUSE_TIME = 80;
@@ -28,6 +33,8 @@
public static final String TAG_FUSE = "fuse";
@Nullable
public EntityLiving owner;
+ public float yield = 4; // CraftBukkit - add field
@ -20,7 +21,7 @@
public EntityTNTPrimed(EntityTypes<? extends EntityTNTPrimed> entitytypes, World world) {
super(entitytypes, world);
@@ -71,10 +78,13 @@
@@ -79,10 +86,13 @@
this.setFuse(i);
if (i <= 0) {
@ -35,7 +36,7 @@
} else {
this.updateInWaterStateAndDoFluidPushing();
if (this.level().isClientSide) {
@@ -85,9 +95,14 @@
@@ -93,9 +103,14 @@
}
private void explode() {

View file

@ -1,9 +1,9 @@
--- a/net/minecraft/world/entity/monster/EntityEvoker.java
+++ b/net/minecraft/world/entity/monster/EntityEvoker.java
@@ -194,7 +194,7 @@
entityvex.setOwner(EntityEvoker.this);
entityvex.setBoundOrigin(blockposition);
entityvex.setLimitedLife(20 * (30 + EntityEvoker.this.random.nextInt(90)));
@@ -200,7 +200,7 @@
worldserver.getScoreboard().addPlayerToTeam(entityvex.getScoreboardName(), scoreboardteam);
}
- worldserver.addFreshEntityWithPassengers(entityvex);
+ worldserver.addFreshEntityWithPassengers(entityvex, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPELL); // CraftBukkit - Add SpawnReason
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of((Entity) EntityEvoker.this));

View file

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

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/warden/Warden.java
+++ b/net/minecraft/world/entity/monster/warden/Warden.java
@@ -372,7 +372,7 @@
@@ -373,7 +373,7 @@
@Override
public BehaviorController<Warden> getBrain() {
@ -9,7 +9,7 @@
}
@Override
@@ -413,13 +413,13 @@
@@ -414,13 +414,13 @@
public static void applyDarknessAround(WorldServer worldserver, Vec3D vec3d, @Nullable Entity entity, int i) {
MobEffect mobeffect = new MobEffect(MobEffects.DARKNESS, 260, 0, false, false);
@ -25,7 +25,7 @@
Logger logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@@ -444,7 +444,7 @@
@@ -445,7 +445,7 @@
dataresult = AngerManagement.codec(this::canTargetEntity).parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("anger")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@ -34,7 +34,7 @@
this.angerManagement = angermanagement;
});
this.syncClientAngerLevel();
@@ -454,7 +454,7 @@
@@ -455,7 +455,7 @@
dataresult = VibrationSystem.a.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.getCompound("listener")));
logger = Warden.LOGGER;
Objects.requireNonNull(logger);
@ -43,7 +43,7 @@
this.vibrationData = vibrationsystem_a;
});
}
@@ -488,7 +488,7 @@
@@ -489,7 +489,7 @@
public void increaseAngerAt(@Nullable Entity entity, int i, boolean flag) {
if (!this.isNoAi() && this.canTargetEntity(entity)) {
WardenAi.setDigCooldown(this);
@ -52,7 +52,7 @@
int j = this.angerManagement.increaseAnger(entity, i);
if (entity instanceof EntityHuman && flag1 && AngerLevel.byAnger(j).isAngry()) {
@@ -509,7 +509,7 @@
@@ -510,7 +510,7 @@
@Nullable
@Override
public EntityLiving getTarget() {
@ -61,7 +61,7 @@
}
@Override
@@ -552,7 +552,7 @@
@@ -553,7 +553,7 @@
public void setAttackTarget(EntityLiving entityliving) {
this.getBrain().eraseMemory(MemoryModuleType.ROAR_TARGET);

View file

@ -1,7 +1,7 @@
--- a/net/minecraft/world/entity/player/EntityHuman.java
+++ b/net/minecraft/world/entity/player/EntityHuman.java
@@ -117,6 +117,20 @@
import net.minecraft.world.scores.ScoreboardTeamBase;
@@ -112,6 +112,20 @@
import net.minecraft.world.scores.ScoreboardTeam;
import org.slf4j.Logger;
+// CraftBukkit start
@ -21,17 +21,17 @@
public abstract class EntityHuman extends EntityLiving {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -132,7 +146,8 @@
@@ -127,7 +141,8 @@
public static final float SWIMMING_BB_HEIGHT = 0.6F;
public static final float DEFAULT_EYE_HEIGHT = 1.62F;
public static final EntitySize STANDING_DIMENSIONS = EntitySize.scalable(0.6F, 1.8F);
- private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
+ // CraftBukkit - decompile error
+ private static final Map<EntityPose, EntitySize> POSES = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.STANDING_DIMENSIONS).put(EntityPose.SLEEPING, EntityHuman.SLEEPING_DIMENSIONS).put(EntityPose.FALL_FLYING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.scalable(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.scalable(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.fixed(0.2F, 0.2F)).build();
private static final int FLY_ACHIEVEMENT_SPEED = 25;
private static final DataWatcherObject<Float> DATA_PLAYER_ABSORPTION_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.FLOAT);
private static final DataWatcherObject<Integer> DATA_SCORE_ID = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.INT);
@@ -142,10 +157,10 @@
protected static final DataWatcherObject<Byte> DATA_PLAYER_MODE_CUSTOMISATION = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.BYTE);
@@ -136,10 +151,10 @@
protected static final DataWatcherObject<NBTTagCompound> DATA_SHOULDER_RIGHT = DataWatcher.defineId(EntityHuman.class, DataWatcherRegistry.COMPOUND_TAG);
private long timeEntitySatOnShoulder;
private final PlayerInventory inventory = new PlayerInventory(this);
@ -44,7 +44,7 @@
protected int jumpTriggerTime;
public float oBob;
public float bob;
@@ -174,6 +189,16 @@
@@ -168,6 +183,16 @@
public EntityFishingHook fishing;
protected float hurtDir;
@ -61,7 +61,7 @@
public EntityHuman(World world, BlockPosition blockposition, float f, GameProfile gameprofile) {
super(EntityTypes.PLAYER, world);
this.lastItemInMainHand = ItemStack.EMPTY;
@@ -313,7 +338,7 @@
@@ -312,7 +337,7 @@
ItemStack itemstack = this.getItemBySlot(EnumItemSlot.HEAD);
if (itemstack.is(Items.TURTLE_HELMET) && !this.isEyeInFluid(TagsFluid.WATER)) {
@ -70,7 +70,7 @@
}
}
@@ -483,8 +508,14 @@
@@ -482,8 +507,14 @@
public void rideTick() {
if (!this.level().isClientSide && this.wantsToStopRiding() && this.isPassenger()) {
this.stopRiding();
@ -84,10 +84,10 @@
+ }
+ {
+ // CraftBukkit end
double d0 = this.getX();
double d1 = this.getY();
double d2 = this.getZ();
@@ -511,7 +542,8 @@
super.rideTick();
this.oBob = this.bob;
this.bob = 0.0F;
@@ -505,7 +536,8 @@
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION)) {
if (this.getHealth() < this.getMaxHealth() && this.tickCount % 20 == 0) {
@ -97,7 +97,7 @@
}
if (this.foodData.needsFood() && this.tickCount % 10 == 0) {
@@ -671,6 +703,13 @@
@@ -665,6 +697,13 @@
@Nullable
public EntityItem drop(ItemStack itemstack, boolean flag, boolean flag1) {
@ -111,7 +111,7 @@
if (itemstack.isEmpty()) {
return null;
} else {
@@ -705,6 +744,33 @@
@@ -699,6 +738,33 @@
entityitem.setDeltaMovement((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6);
}
@ -145,7 +145,7 @@
return entityitem;
}
}
@@ -795,7 +861,7 @@
@@ -789,7 +855,7 @@
}
if (nbttagcompound.contains("LastDeathLocation", 10)) {
@ -154,7 +154,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -828,7 +894,7 @@
@@ -822,7 +888,7 @@
}
this.getLastDeathLocation().flatMap((globalpos) -> {
@ -163,7 +163,7 @@
Logger logger = EntityHuman.LOGGER;
Objects.requireNonNull(logger);
@@ -855,12 +921,12 @@
@@ -849,12 +915,12 @@
return false;
} else {
if (!this.level().isClientSide) {
@ -178,7 +178,7 @@
}
if (this.level().getDifficulty() == EnumDifficulty.EASY) {
@@ -872,7 +938,13 @@
@@ -866,7 +932,13 @@
}
}
@ -193,12 +193,12 @@
}
}
}
@@ -892,10 +964,29 @@
@@ -886,10 +958,29 @@
}
public boolean canHarmPlayer(EntityHuman entityhuman) {
- ScoreboardTeamBase scoreboardteambase = this.getTeam();
- ScoreboardTeamBase scoreboardteambase1 = entityhuman.getTeam();
- ScoreboardTeam scoreboardteam = this.getTeam();
- ScoreboardTeam scoreboardteam1 = entityhuman.getTeam();
+ // CraftBukkit start - Change to check OTHER player's scoreboard team according to API
+ // To summarize this method's logic, it's "Can parameter hurt this"
+ org.bukkit.scoreboard.Team team;
@ -217,7 +217,7 @@
+ }
+ }
- return scoreboardteambase == null ? true : (!scoreboardteambase.isAlliedTo(scoreboardteambase1) ? true : scoreboardteambase.isAllowFriendlyFire());
- return scoreboardteam == null ? true : (!scoreboardteam.isAlliedTo(scoreboardteam1) ? true : scoreboardteam.isAllowFriendlyFire());
+ if (this instanceof EntityPlayer) {
+ return !team.hasPlayer(((EntityPlayer) this).getBukkitEntity());
+ }
@ -226,7 +226,7 @@
}
@Override
@@ -937,8 +1028,13 @@
@@ -931,8 +1022,13 @@
}
}
@ -241,7 +241,7 @@
if (!this.isInvulnerableTo(damagesource)) {
f = this.getDamageAfterArmorAbsorb(damagesource, f);
f = this.getDamageAfterMagicAbsorb(damagesource, f);
@@ -953,7 +1049,7 @@
@@ -947,7 +1043,7 @@
}
if (f != 0.0F) {
@ -250,7 +250,7 @@
this.getCombatTracker().recordDamage(damagesource, f);
this.setHealth(this.getHealth() - f);
if (f < 3.4028235E37F) {
@@ -963,6 +1059,7 @@
@@ -957,6 +1053,7 @@
this.gameEvent(GameEvent.ENTITY_DAMAGE);
}
}
@ -258,7 +258,7 @@
}
@Override
@@ -1127,7 +1224,7 @@
@@ -1121,7 +1218,7 @@
f *= 0.2F + f2 * f2 * 0.8F;
f1 *= f2;
@ -267,7 +267,7 @@
if (f > 0.0F || f1 > 0.0F) {
boolean flag = f2 > 0.9F;
boolean flag1 = false;
@@ -1166,8 +1263,15 @@
@@ -1160,8 +1257,15 @@
if (entity instanceof EntityLiving) {
f3 = ((EntityLiving) entity).getHealth();
if (j > 0 && !entity.isOnFire()) {
@ -285,7 +285,7 @@
}
}
@@ -1195,8 +1299,11 @@
@@ -1189,8 +1293,11 @@
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving != this && entityliving != entity && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
@ -298,7 +298,7 @@
}
}
@@ -1205,9 +1312,26 @@
@@ -1199,9 +1306,26 @@
}
if (entity instanceof EntityPlayer && entity.hurtMarked) {
@ -325,7 +325,7 @@
}
if (flag2) {
@@ -1252,7 +1376,14 @@
@@ -1246,7 +1370,14 @@
this.awardStat(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F));
if (j > 0) {
@ -341,7 +341,7 @@
}
if (this.level() instanceof WorldServer && f5 > 2.0F) {
@@ -1262,12 +1393,17 @@
@@ -1256,12 +1387,17 @@
}
}
@ -360,7 +360,7 @@
}
}
@@ -1344,6 +1480,12 @@
@@ -1338,6 +1474,12 @@
}
public Either<EntityHuman.EnumBedResult, Unit> startSleepInBed(BlockPosition blockposition) {
@ -373,7 +373,7 @@
this.startSleeping(blockposition);
this.sleepCounter = 0;
return Either.right(Unit.INSTANCE);
@@ -1431,9 +1573,9 @@
@@ -1425,9 +1567,9 @@
super.jumpFromGround();
this.awardStat(StatisticList.JUMP);
if (this.isSprinting()) {
@ -385,9 +385,9 @@
}
}
@@ -1463,7 +1605,11 @@
@@ -1454,7 +1596,11 @@
this.setDeltaMovement(vec3d2.x, d3 * 0.6D, vec3d2.z);
this.setDeltaMovement(vec3d2.x, d0 * 0.6D, vec3d2.z);
this.resetFallDistance();
- this.setSharedFlag(7, false);
+ // CraftBukkit start
@ -398,47 +398,7 @@
} else {
super.travel(vec3d);
}
@@ -1498,19 +1644,19 @@
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.SWIM_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SWIM); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isEyeInFluid(TagsFluid.WATER)) {
i = Math.round((float) Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_UNDER_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_UNDERWATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.isInWater()) {
i = Math.round((float) Math.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.awardStat(StatisticList.WALK_ON_WATER_ONE_CM, i);
- this.causeFoodExhaustion(0.01F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.01F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK_ON_WATER); // CraftBukkit - EntityExhaustionEvent
}
} else if (this.onClimbable()) {
if (d1 > 0.0D) {
@@ -1521,13 +1667,13 @@
if (i > 0) {
if (this.isSprinting()) {
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
- this.causeFoodExhaustion(0.1F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.1F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.SPRINT); // CraftBukkit - EntityExhaustionEvent
} else if (this.isCrouching()) {
this.awardStat(StatisticList.CROUCH_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.CROUCH); // CraftBukkit - EntityExhaustionEvent
} else {
this.awardStat(StatisticList.WALK_ONE_CM, i);
- this.causeFoodExhaustion(0.0F * (float) i * 0.01F);
+ this.causeFoodExhaustion(0.0F * (float) i * 0.01F, EntityExhaustionEvent.ExhaustionReason.WALK); // CraftBukkit - EntityExhaustionEvent
}
}
} else if (this.isFallFlying()) {
@@ -1593,12 +1739,24 @@
@@ -1507,12 +1653,24 @@
}
public void startFallFlying() {
@ -464,7 +424,7 @@
}
@Override
@@ -1712,10 +1870,21 @@
@@ -1626,10 +1784,21 @@
return this.experienceLevel >= 30 ? 112 + (this.experienceLevel - 30) * 9 : (this.experienceLevel >= 15 ? 37 + (this.experienceLevel - 15) * 5 : 7 + this.experienceLevel * 2);
}
@ -487,7 +447,7 @@
}
}
@@ -1801,13 +1970,20 @@
@@ -1715,13 +1884,20 @@
@Override
public void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack) {
@ -511,7 +471,7 @@
}
}
@@ -1846,26 +2022,31 @@
@@ -1760,26 +1936,31 @@
protected void removeEntitiesOnShoulder() {
if (this.timeEntitySatOnShoulder + 20L < this.level().getGameTime()) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
@@ -46,6 +46,12 @@
@@ -47,6 +47,12 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -13,7 +13,7 @@
public abstract class EntityArrow extends IProjectile {
private static final double ARROW_BASE_DAMAGE = 2.0D;
@@ -212,7 +218,7 @@
@@ -219,7 +225,7 @@
}
if (object != null && !flag) {
@ -22,10 +22,10 @@
this.hasImpulse = true;
}
@@ -359,7 +365,13 @@
int k = entity.getRemainingFireTicks();
@@ -367,7 +373,13 @@
boolean flag1 = entity.getType().is(TagsEntity.DEFLECTS_ARROWS);
if (this.isOnFire() && !flag) {
if (this.isOnFire() && !flag && !flag1) {
- entity.setSecondsOnFire(5);
+ // CraftBukkit start
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
@ -37,7 +37,7 @@
}
if (entity.hurt(damagesource, (float) i)) {
@@ -522,7 +534,22 @@
@@ -545,7 +557,22 @@
@Override
public void playerTouch(EntityHuman entityhuman) {
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityEnderPearl.java
+++ b/net/minecraft/world/entity/projectile/EntityEnderPearl.java
@@ -15,6 +15,13 @@
@@ -18,6 +18,13 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -14,7 +14,7 @@
public class EntityEnderPearl extends EntityProjectileThrowable {
public EntityEnderPearl(EntityTypes<? extends EntityEnderPearl> entitytypes, World world) {
@@ -51,23 +58,36 @@
@@ -54,23 +61,36 @@
EntityPlayer entityplayer = (EntityPlayer) entity;
if (entityplayer.connection.isAcceptingMessages() && entityplayer.level() == this.level() && !entityplayer.isSleeping()) {
@ -61,10 +61,10 @@
+ CraftEventFactory.entityDamage = null;
+ }
+ // CraftBukkit end
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), SoundEffects.PLAYER_TELEPORT, SoundCategory.PLAYERS);
}
} else if (entity != null) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
@@ -96,7 +116,7 @@
@@ -100,7 +120,7 @@
public Entity changeDimension(WorldServer worldserver) {
Entity entity = this.getOwner();

View file

@ -1,14 +1,5 @@
--- a/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
+++ b/net/minecraft/world/entity/projectile/EntityEvokerFangs.java
@@ -19,7 +19,7 @@
public static final int ATTACK_DURATION = 20;
public static final int LIFE_OFFSET = 2;
public static final int ATTACK_TRIGGER_TICKS = 14;
- private int warmupDelayTicks;
+ public int warmupDelayTicks;
private boolean sentSpikeEvent;
private int lifeTicks;
private boolean clientSideAttackStarted;
@@ -129,7 +129,9 @@
if (entityliving.isAlive() && !entityliving.isInvulnerable() && entityliving != entityliving1) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityFireball.java
+++ b/net/minecraft/world/entity/projectile/EntityFireball.java
@@ -15,11 +15,15 @@
@@ -17,11 +17,15 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
@ -16,7 +16,7 @@
protected EntityFireball(EntityTypes<? extends EntityFireball> entitytypes, World world) {
super(entitytypes, world);
@@ -29,6 +33,12 @@
@@ -36,6 +40,12 @@
this(entitytypes, world);
this.moveTo(d0, d1, d2, this.getYRot(), this.getXRot());
this.reapplyPosition();
@ -29,8 +29,8 @@
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
if (d6 != 0.0D) {
@@ -75,7 +85,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity);
@@ -86,7 +96,13 @@
MovingObjectPosition movingobjectposition = ProjectileHelper.getHitResultOnMoveVector(this, this::canHitEntity, this.getClipType());
if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS) {
- this.onHit(movingobjectposition);
@ -44,7 +44,7 @@
}
this.checkInsideBlocks();
@@ -161,6 +177,11 @@
@@ -184,6 +200,11 @@
if (entity != null) {
if (!this.level().isClientSide) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
+++ b/net/minecraft/world/entity/projectile/EntitySpectralArrow.java
@@ -45,7 +45,7 @@
@@ -41,7 +41,7 @@
super.doPostHurtEffects(entityliving);
MobEffect mobeffect = new MobEffect(MobEffects.GLOWING, this.duration, 0);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityThrownTrident.java
+++ b/net/minecraft/world/entity/projectile/EntityThrownTrident.java
@@ -157,7 +157,7 @@
@@ -153,7 +153,7 @@
if (entitylightning != null) {
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
entitylightning.setCause(entity1 instanceof EntityPlayer ? (EntityPlayer) entity1 : null);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityTippedArrow.java
+++ b/net/minecraft/world/entity/projectile/EntityTippedArrow.java
@@ -212,7 +212,7 @@
@@ -213,7 +213,7 @@
mobeffect = (MobEffect) iterator.next();
entityliving.addEffect(new MobEffect(mobeffect.getEffect(), Math.max(mobeffect.mapDuration((i) -> {
return i / 8;
@ -9,7 +9,7 @@
}
if (!this.effects.isEmpty()) {
@@ -220,7 +220,7 @@
@@ -221,7 +221,7 @@
while (iterator.hasNext()) {
mobeffect = (MobEffect) iterator.next();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/EntityWitherSkull.java
+++ b/net/minecraft/world/entity/projectile/EntityWitherSkull.java
@@ -20,6 +20,10 @@
@@ -21,6 +21,10 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.MovingObjectPositionEntity;
@ -11,7 +11,7 @@
public class EntityWitherSkull extends EntityFireball {
private static final DataWatcherObject<Boolean> DATA_DANGEROUS = DataWatcher.defineId(EntityWitherSkull.class, DataWatcherRegistry.BOOLEAN);
@@ -63,7 +67,7 @@
@@ -64,7 +68,7 @@
if (entity.isAlive()) {
this.doEnchantDamageEffects(entityliving, entity);
} else {
@ -20,7 +20,7 @@
}
}
} else {
@@ -81,7 +85,7 @@
@@ -82,7 +86,7 @@
}
if (b0 > 0) {
@ -29,7 +29,7 @@
}
}
@@ -92,7 +96,15 @@
@@ -93,7 +97,15 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
super.onHit(movingobjectposition);
if (!this.level().isClientSide) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/IProjectile.java
+++ b/net/minecraft/world/entity/projectile/IProjectile.java
@@ -24,6 +24,10 @@
@@ -25,6 +25,10 @@
import net.minecraft.world.phys.MovingObjectPositionEntity;
import net.minecraft.world.phys.Vec3D;
@ -11,7 +11,7 @@
public abstract class IProjectile extends Entity implements TraceableEntity {
@Nullable
@@ -33,6 +37,10 @@
@@ -34,6 +38,10 @@
private boolean leftOwner;
private boolean hasBeenShot;
@ -22,7 +22,7 @@
IProjectile(EntityTypes<? extends IProjectile> entitytypes, World world) {
super(entitytypes, world);
}
@@ -42,6 +50,7 @@
@@ -43,6 +51,7 @@
this.ownerUUID = entity.getUUID();
this.cachedOwner = entity;
}
@ -30,7 +30,7 @@
}
@@ -147,6 +156,16 @@
@@ -167,6 +176,16 @@
this.setDeltaMovement(this.getDeltaMovement().add(vec3d.x, entity.onGround() ? 0.0D : vec3d.y, vec3d.z));
}
@ -47,7 +47,7 @@
protected void onHit(MovingObjectPosition movingobjectposition) {
MovingObjectPosition.EnumMovingObjectType movingobjectposition_enummovingobjecttype = movingobjectposition.getType();
@@ -167,6 +186,11 @@
@@ -187,6 +206,11 @@
protected void onHitEntity(MovingObjectPositionEntity movingobjectpositionentity) {}
protected void onHitBlock(MovingObjectPositionBlock movingobjectpositionblock) {

View file

@ -14,7 +14,7 @@
public class ChestBoat extends EntityBoat implements HasCustomInventoryScreen, ContainerEntity {
@@ -237,4 +244,51 @@
@@ -238,4 +245,51 @@
public void stopOpen(EntityHuman entityhuman) {
this.level().gameEvent(GameEvent.CONTAINER_CLOSE, this.position(), GameEvent.a.of((Entity) entityhuman));
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityBoat.java
+++ b/net/minecraft/world/entity/vehicle/EntityBoat.java
@@ -55,6 +55,16 @@
@@ -55,6 +55,15 @@
import net.minecraft.world.phys.shapes.VoxelShapes;
import org.joml.Vector3f;
@ -8,16 +8,15 @@
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
+import org.bukkit.event.vehicle.VehicleMoveEvent;
+// CraftBukkit end
+
public class EntityBoat extends Entity implements VariantHolder<EntityBoat.EnumBoatType> {
public class EntityBoat extends VehicleEntity implements VariantHolder<EntityBoat.EnumBoatType> {
private static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -95,6 +105,14 @@
private static final DataWatcherObject<Integer> DATA_ID_TYPE = DataWatcher.defineId(EntityBoat.class, DataWatcherRegistry.INT);
@@ -92,6 +101,14 @@
private float bubbleAngle;
private float bubbleAngleO;
@ -32,43 +31,7 @@
public EntityBoat(EntityTypes<? extends EntityBoat> entitytypes, World world) {
super(entitytypes, world);
this.paddlePositions = new float[2];
@@ -180,6 +198,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else if (!this.level().isClientSide && !this.isRemoved()) {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ // f = event.getDamage(); // TODO Why don't we do this?
+ // CraftBukkit end
+
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.setDamage(this.getDamage() + f * 10.0F);
@@ -188,6 +219,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
if (!flag && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.destroy(damagesource);
}
@@ -227,9 +267,29 @@
@@ -192,9 +209,29 @@
public void push(Entity entity) {
if (entity instanceof EntityBoat) {
if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) {
@ -98,7 +61,7 @@
super.push(entity);
}
@@ -322,6 +382,7 @@
@@ -288,6 +325,7 @@
return this.getDirection().getClockWise();
}
@ -106,7 +69,7 @@
@Override
public void tick() {
this.oldStatus = this.status;
@@ -362,6 +423,22 @@
@@ -328,6 +366,22 @@
this.setDeltaMovement(Vec3D.ZERO);
}
@ -129,7 +92,7 @@
this.tickBubbleColumn();
for (int i = 0; i <= 1; ++i) {
@@ -845,6 +922,11 @@
@@ -813,6 +867,11 @@
this.causeFallDamage(this.fallDistance, 1.0F, this.damageSources().fall());
if (!this.level().isClientSide && !this.isRemoved()) {
@ -141,7 +104,7 @@
this.kill();
if (this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
int i;
@@ -858,6 +940,7 @@
@@ -826,6 +885,7 @@
}
}
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
+++ b/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java
@@ -50,6 +50,16 @@
@@ -48,6 +48,14 @@
import net.minecraft.world.phys.Vec3D;
import org.joml.Vector3f;
@ -8,16 +8,14 @@
+import org.bukkit.Location;
+import org.bukkit.craftbukkit.util.CraftLocation;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
+import org.bukkit.util.Vector;
+// CraftBukkit end
+
public abstract class EntityMinecartAbstract extends Entity {
public abstract class EntityMinecartAbstract extends VehicleEntity {
private static final float LOWERED_PASSENGER_ATTACHMENT_Y = 0.0F;
@@ -93,6 +103,17 @@
@@ -88,6 +96,17 @@
enummap.put(BlockPropertyTrackPosition.NORTH_EAST, Pair.of(baseblockposition2, baseblockposition1));
});
@ -35,43 +33,16 @@
protected EntityMinecartAbstract(EntityTypes<?> entitytypes, World world) {
super(entitytypes, world);
this.targetDeltaMovement = Vec3D.ZERO;
@@ -222,6 +243,19 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
+ // CraftBukkit start - fire VehicleDamageEvent
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+
+ f = (float) event.getDamage();
+ // CraftBukkit end
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -230,6 +264,15 @@
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).getAbilities().instabuild;
@@ -128,7 +147,7 @@
object = new EntityMinecartRideable(worldserver, d0, d1, d2);
}
if (flag || this.getDamage() > 40.0F) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.ejectPassengers();
if (flag && !this.hasCustomName()) {
this.discard();
@@ -291,6 +334,14 @@
- Object object1 = object;
+ EntityMinecartAbstract object1 = (EntityMinecartAbstract) object; // CraftBukkit- decompile error
EntityTypes.createDefaultStackConfig(worldserver, itemstack, entityhuman).accept(object1);
return (EntityMinecartAbstract) object1;
@@ -267,6 +286,14 @@
@Override
public void tick() {
@ -86,7 +57,7 @@
if (this.getHurtTime() > 0) {
this.setHurtTime(this.getHurtTime() - 1);
}
@@ -300,7 +351,7 @@
@@ -276,7 +303,7 @@
}
this.checkBelowWorld();
@ -95,7 +66,7 @@
if (this.level().isClientSide) {
if (this.lerpSteps > 0) {
this.lerpPositionAndRotationStep(this.lerpSteps, this.lerpX, this.lerpY, this.lerpZ, this.lerpYRot, this.lerpXRot);
@@ -358,6 +409,18 @@
@@ -334,6 +361,18 @@
}
this.setRot(this.getYRot(), this.getXRot());
@ -114,7 +85,7 @@
if (this.getMinecartType() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.getDeltaMovement().horizontalDistanceSqr() > 0.01D) {
List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox().inflate(0.20000000298023224D, 0.0D, 0.20000000298023224D), IEntitySelector.pushableBy(this));
@@ -368,8 +431,26 @@
@@ -344,8 +383,26 @@
Entity entity = (Entity) iterator.next();
if (!(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && !(entity instanceof EntityMinecartAbstract) && !this.isVehicle() && !entity.isPassenger()) {
@ -141,7 +112,7 @@
entity.push(this);
}
}
@@ -381,6 +462,14 @@
@@ -357,6 +414,14 @@
Entity entity1 = (Entity) iterator1.next();
if (!this.hasPassenger(entity1) && entity1.isPushable() && entity1 instanceof EntityMinecartAbstract) {
@ -156,7 +127,7 @@
entity1.push(this);
}
}
@@ -397,7 +486,7 @@
@@ -373,7 +438,7 @@
}
protected double getMaxSpeed() {
@ -165,7 +136,7 @@
}
public void activateMinecart(int i, int j, int k, boolean flag) {}
@@ -408,12 +497,16 @@
@@ -384,12 +449,16 @@
this.setDeltaMovement(MathHelper.clamp(vec3d.x, -d0, d0), vec3d.y, MathHelper.clamp(vec3d.z, -d0, d0));
if (this.onGround()) {
@ -184,7 +155,7 @@
}
}
@@ -609,7 +702,7 @@
@@ -585,7 +654,7 @@
}
protected void applyNaturalSlowdown() {
@ -193,7 +164,7 @@
Vec3D vec3d = this.getDeltaMovement();
vec3d = vec3d.multiply(d0, 0.0D, d0);
@@ -748,6 +841,14 @@
@@ -724,6 +793,14 @@
if (!this.level().isClientSide) {
if (!entity.noPhysics && !this.noPhysics) {
if (!this.hasPassenger(entity)) {
@ -208,7 +179,7 @@
double d0 = entity.getX() - this.getX();
double d1 = entity.getZ() - this.getZ();
double d2 = d0 * d0 + d1 * d1;
@@ -945,4 +1046,26 @@
@@ -898,4 +975,26 @@
private EnumMinecartType() {}
}

View file

@ -0,0 +1,62 @@
--- a/net/minecraft/world/entity/vehicle/VehicleEntity.java
+++ b/net/minecraft/world/entity/vehicle/VehicleEntity.java
@@ -13,6 +13,12 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.gameevent.GameEvent;
+// CraftBukkit start
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+// CraftBukkit end
+
public abstract class VehicleEntity extends Entity {
protected static final DataWatcherObject<Integer> DATA_ID_HURT = DataWatcher.defineId(VehicleEntity.class, DataWatcherRegistry.INT);
@@ -29,6 +35,18 @@
if (this.isInvulnerableTo(damagesource)) {
return false;
} else {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return false;
+ }
+ f = (float) event.getDamage();
+ // CraftBukkit end
this.setHurtDir(-this.getHurtDir());
this.setHurtTime(10);
this.markHurt();
@@ -38,9 +56,27 @@
if ((flag || this.getDamage() <= 40.0F) && !this.shouldSourceDestroy(damagesource)) {
if (flag) {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.discard();
}
} else {
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
+ this.level().getCraftServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40.0F); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
this.destroy(damagesource);
}

View file

@ -162,8 +162,8 @@
+ // CraftBukkit end
}
} else {
Slot slot2;
@@ -605,13 +698,14 @@
int j2;
@@ -609,13 +702,14 @@
ItemStack itemstack = this.getCarried();
if (!itemstack.isEmpty()) {
@ -179,7 +179,7 @@
}
}
@@ -828,6 +922,11 @@
@@ -832,6 +926,11 @@
}
public ItemStack getCarried() {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerBrewingStand.java
+++ b/net/minecraft/world/inventory/ContainerBrewingStand.java
@@ -12,6 +12,11 @@
@@ -13,6 +13,11 @@
import net.minecraft.world.item.alchemy.PotionRegistry;
import net.minecraft.world.item.alchemy.PotionUtil;
@ -12,7 +12,7 @@
public class ContainerBrewingStand extends Container {
private static final int BOTTLE_SLOT_START = 0;
@@ -28,12 +33,18 @@
@@ -29,12 +34,18 @@
private final IContainerProperties brewingStandData;
private final Slot ingredientSlot;
@ -31,7 +31,7 @@
checkContainerSize(iinventory, 5);
checkContainerDataCount(icontainerproperties, 2);
this.brewingStand = iinventory;
@@ -61,6 +72,7 @@
@@ -62,6 +73,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
@ -39,7 +39,7 @@
return this.brewingStand.stillValid(entityhuman);
}
@@ -198,4 +210,17 @@
@@ -199,4 +211,17 @@
return 64;
}
}

View file

@ -11,7 +11,7 @@
public class Containers<T extends Container> implements FeatureElement {
public static final Containers<ContainerChest> GENERIC_9x1 = register("generic_9x1", ContainerChest::oneRow);
@@ -27,7 +31,7 @@
@@ -28,7 +32,7 @@
public static final Containers<ContainerGrindstone> GRINDSTONE = register("grindstone", ContainerGrindstone::new);
public static final Containers<ContainerHopper> HOPPER = register("hopper", ContainerHopper::new);
public static final Containers<ContainerLectern> LECTERN = register("lectern", (i, playerinventory) -> {

View file

@ -0,0 +1,38 @@
--- a/net/minecraft/world/inventory/CrafterMenu.java
+++ b/net/minecraft/world/inventory/CrafterMenu.java
@@ -8,8 +8,27 @@
import net.minecraft.world.level.World;
import net.minecraft.world.level.block.CrafterBlock;
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventoryCrafter;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
public class CrafterMenu extends Container implements ICrafting {
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+
+ @Override
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventoryCrafter inventory = new CraftInventoryCrafter(this.container, this.resultContainer);
+ bukkitEntity = new CraftInventoryView(this.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
protected static final int SLOT_COUNT = 9;
private static final int INV_SLOT_START = 9;
private static final int INV_SLOT_END = 36;
@@ -116,6 +135,7 @@
@Override
public boolean stillValid(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
return this.container.stillValid(entityhuman);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemBoat.java
+++ b/net/minecraft/world/item/ItemBoat.java
@@ -58,6 +58,13 @@
@@ -60,6 +60,13 @@
}
if (movingobjectpositionblock.getType() == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
@ -11,10 +11,10 @@
+ return InteractionResultWrapper.pass(itemstack);
+ }
+ // CraftBukkit end
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock);
EntityBoat entityboat = this.getBoat(world, movingobjectpositionblock, itemstack, entityhuman);
entityboat.setVariant(this.type);
@@ -66,7 +73,15 @@
@@ -68,7 +75,15 @@
return InteractionResultWrapper.fail(itemstack);
} else {
if (!world.isClientSide) {
@ -31,3 +31,12 @@
world.gameEvent((Entity) entityhuman, GameEvent.ENTITY_PLACE, movingobjectpositionblock.getLocation());
if (!entityhuman.getAbilities().instabuild) {
itemstack.shrink(1);
@@ -86,7 +101,7 @@
private EntityBoat getBoat(World world, MovingObjectPosition movingobjectposition, ItemStack itemstack, EntityHuman entityhuman) {
Vec3D vec3d = movingobjectposition.getLocation();
- Object object = this.hasChest ? new ChestBoat(world, vec3d.x, vec3d.y, vec3d.z) : new EntityBoat(world, vec3d.x, vec3d.y, vec3d.z);
+ EntityBoat object = this.hasChest ? new ChestBoat(world, vec3d.x, vec3d.y, vec3d.z) : new EntityBoat(world, vec3d.x, vec3d.y, vec3d.z); // CraftBukkit - decompile error
if (world instanceof WorldServer) {
WorldServer worldserver = (WorldServer) world;

View file

@ -1,12 +1,12 @@
--- a/net/minecraft/world/item/ItemChorusFruit.java
+++ b/net/minecraft/world/item/ItemChorusFruit.java
@@ -39,7 +39,16 @@
@@ -35,7 +35,16 @@
Vec3D vec3d = entityliving.position();
- if (entityliving.randomTeleport(d3, d4, d5, true)) {
- if (entityliving.randomTeleport(d0, d1, d2, true)) {
+ // CraftBukkit start - handle canceled status of teleport event
+ java.util.Optional<Boolean> status = entityliving.randomTeleport(d3, d4, d5, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
+ java.util.Optional<Boolean> status = entityliving.randomTeleport(d0, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
+
+ if (!status.isPresent()) {
+ // teleport event was canceled, no more tries
@ -16,5 +16,5 @@
+ if (status.get()) {
+ // CraftBukkit end
world.gameEvent(GameEvent.TELEPORT, vec3d, GameEvent.a.of((Entity) entityliving));
SoundEffect soundeffect = entityliving instanceof EntityFox ? SoundEffects.FOX_TELEPORT : SoundEffects.CHORUS_FRUIT_TELEPORT;
SoundEffect soundeffect;
SoundCategory soundcategory;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemMinecart.java
+++ b/net/minecraft/world/item/ItemMinecart.java
@@ -18,6 +18,12 @@
@@ -19,6 +19,12 @@
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.phys.Vec3D;
@ -13,17 +13,19 @@
public class ItemMinecart extends Item {
private static final IDispenseBehavior DISPENSE_ITEM_BEHAVIOR = new DispenseBehaviorItem() {
@@ -57,14 +63,43 @@
@@ -58,10 +64,39 @@
}
}
- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type, itemstack, (EntityHuman) null);
+ // CraftBukkit start
+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).type);
+ ItemStack itemstack1 = itemstack.split(1);
+ org.bukkit.block.Block block2 = CraftBlock.at(worldserver, sourceblock.pos());
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
+
- worldserver.addFreshEntity(entityminecartabstract);
- itemstack.shrink(1);
+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2));
+ if (!BlockDispenser.eventFired) {
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
@ -46,31 +48,25 @@
+ }
+
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).type);
if (itemstack.hasCustomHoverName()) {
entityminecartabstract.setCustomName(itemstack.getHoverName());
}
- worldserver.addFreshEntity(entityminecartabstract);
- itemstack.shrink(1);
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).type, itemstack1, (EntityHuman) null);
+
+ if (!worldserver.addFreshEntity(entityminecartabstract)) itemstack.grow(1);
+ // itemstack.shrink(1); // CraftBukkit - handled during event processing
+ // CraftBukkit end
return itemstack;
}
@@ -106,7 +141,12 @@
entityminecartabstract.setCustomName(itemstack.getHoverName());
}
@@ -100,7 +135,12 @@
- world.addFreshEntity(entityminecartabstract);
EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.createMinecart(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.0625D + d0, (double) blockposition.getZ() + 0.5D, this.type, itemstack, itemactioncontext.getPlayer());
- worldserver.addFreshEntity(entityminecartabstract);
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPlaceEvent(itemactioncontext, entityminecartabstract).isCancelled()) {
+ return EnumInteractionResult.FAIL;
+ }
+ // CraftBukkit end
+ if (!world.addFreshEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
world.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of(itemactioncontext.getPlayer(), world.getBlockState(blockposition.below())));
+ if (!worldserver.addFreshEntity(entityminecartabstract)) return EnumInteractionResult.PASS; // CraftBukkit
worldserver.gameEvent(GameEvent.ENTITY_PLACE, blockposition, GameEvent.a.of(itemactioncontext.getPlayer(), worldserver.getBlockState(blockposition.below())));
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemMonsterEgg.java
+++ b/net/minecraft/world/item/ItemMonsterEgg.java
@@ -185,7 +185,7 @@
@@ -180,7 +180,7 @@
return Optional.empty();
} else {
((EntityInsentient) object).moveTo(vec3d.x(), vec3d.y(), vec3d.z(), 0.0F, 0.0F);
@ -9,7 +9,7 @@
if (itemstack.hasCustomHoverName()) {
((EntityInsentient) object).setCustomName(itemstack.getHoverName());
}
@@ -194,7 +194,7 @@
@@ -189,7 +189,7 @@
itemstack.shrink(1);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java
@@ -77,6 +77,43 @@
@@ -81,6 +81,43 @@
import net.minecraft.world.level.block.state.pattern.ShapeDetectorBlock;
import org.slf4j.Logger;
@ -44,7 +44,7 @@
public final class ItemStack {
public static final Codec<ItemStack> CODEC = RecordCodecBuilder.create((instance) -> {
@@ -152,11 +189,24 @@
@@ -175,7 +212,18 @@
this.item = null;
}
@ -64,14 +64,7 @@
this.item = (Item) BuiltInRegistries.ITEM.get(new MinecraftKey(nbttagcompound.getString("id")));
this.count = nbttagcompound.getByte("Count");
if (nbttagcompound.contains("tag", 10)) {
- this.tag = nbttagcompound.getCompound("tag");
+ // CraftBukkit start - make defensive copy as this data may be coming from the save thread
+ this.tag = nbttagcompound.getCompound("tag").copy();
+ // CraftBukkit end
this.getItem().verifyTagAfterLoad(this.tag);
}
@@ -166,6 +216,11 @@
@@ -189,6 +237,11 @@
}
@ -83,7 +76,7 @@
public static ItemStack of(NBTTagCompound nbttagcompound) {
try {
return new ItemStack(nbttagcompound);
@@ -243,11 +298,190 @@
@@ -266,11 +319,190 @@
return EnumInteractionResult.PASS;
} else {
Item item = this.getItem();
@ -212,7 +205,7 @@
+ record.setCount(1);
+ }
+
+ tileentityjukebox.setFirstItem(record);
+ tileentityjukebox.setTheItem(record);
+ world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.a.of(entityhuman, world.getBlockState(blockposition)));
+ }
+
@ -276,7 +269,7 @@
return enuminteractionresult;
}
@@ -328,6 +562,21 @@
@@ -351,6 +583,21 @@
}
i -= k;
@ -298,7 +291,7 @@
if (i <= 0) {
return false;
}
@@ -349,6 +598,11 @@
@@ -372,6 +619,11 @@
if (this.hurt(i, t0.getRandom(), t0 instanceof EntityPlayer ? (EntityPlayer) t0 : null)) {
consumer.accept(t0);
Item item = this.getItem();
@ -310,7 +303,7 @@
this.shrink(1);
if (t0 instanceof EntityHuman) {
@@ -497,6 +751,17 @@
@@ -524,6 +776,17 @@
return this.tag;
}
@ -328,7 +321,7 @@
public NBTTagCompound getOrCreateTag() {
if (this.tag == null) {
this.setTag(new NBTTagCompound());
@@ -921,6 +1186,13 @@
@@ -948,6 +1211,13 @@
nbttaglist.add(nbttagcompound);
}

View file

@ -29,7 +29,7 @@
+ itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
+ entityhuman1.broadcastBreakEvent(entityliving.getUsedItemHand());
+ });
+ entitythrowntrident.tridentItem = itemstack.copy(); // SPIGOT-4511 update since damage call moved
+ entitythrowntrident.pickupItemStack = itemstack.copy(); // SPIGOT-4511 update since damage call moved
+ // CraftBukkit end
+
world.playSound((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F);

View file

@ -1,10 +1,13 @@
--- a/net/minecraft/world/item/crafting/CraftingManager.java
+++ b/net/minecraft/world/item/crafting/CraftingManager.java
@@ -37,11 +37,13 @@
@@ -34,11 +34,16 @@
import net.minecraft.world.level.World;
import org.slf4j.Logger;
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; // CraftBukkit
+// CraftBukkit start
+import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap;
+import net.minecraft.core.registries.BuiltInRegistries;
+// CraftBukkit end
+
public class CraftingManager extends ResourceDataJson {
@ -15,7 +18,7 @@
private Map<MinecraftKey, RecipeHolder<?>> byName = ImmutableMap.of();
private boolean hasErrors;
@@ -51,7 +53,12 @@
@@ -48,7 +53,12 @@
protected void apply(Map<MinecraftKey, JsonElement> map, IResourceManager iresourcemanager, GameProfilerFiller gameprofilerfiller) {
this.hasErrors = false;
@ -29,7 +32,7 @@
Builder<MinecraftKey, RecipeHolder<?>> builder = ImmutableMap.builder();
Iterator iterator = map.entrySet().iterator();
@@ -62,8 +69,10 @@
@@ -59,8 +69,10 @@
try {
RecipeHolder<?> recipeholder = fromJson(minecraftkey, ChatDeserializer.convertToJsonObject((JsonElement) entry.getValue(), "top element"));
@ -42,7 +45,7 @@
})).put(minecraftkey, recipeholder);
builder.put(minecraftkey, recipeholder);
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
@@ -72,20 +81,37 @@
@@ -69,20 +81,37 @@
}
this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> {
@ -83,7 +86,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> Optional<Pair<MinecraftKey, RecipeHolder<T>>> getRecipeFor(Recipes<T> recipes, C c0, World world, @Nullable MinecraftKey minecraftkey) {
@@ -119,7 +145,7 @@
@@ -116,7 +145,7 @@
}
private <C extends IInventory, T extends IRecipe<C>> Map<MinecraftKey, RecipeHolder<T>> byType(Recipes<T> recipes) {
@ -92,7 +95,7 @@
}
public <C extends IInventory, T extends IRecipe<C>> NonNullList<ItemStack> getRemainingItemsFor(Recipes<T> recipes, C c0, World world) {
@@ -166,12 +192,12 @@
@@ -159,12 +188,12 @@
public void replaceRecipes(Iterable<RecipeHolder<?>> iterable) {
this.hasErrors = false;
@ -107,14 +110,14 @@
});
MinecraftKey minecraftkey = recipeholder.id();
RecipeHolder<?> recipeholder1 = (RecipeHolder) map1.put(minecraftkey, recipeholder);
@@ -182,9 +208,29 @@
@@ -175,9 +204,29 @@
}
});
this.recipes = ImmutableMap.copyOf(map);
- this.byName = builder.build();
+ this.byName = Maps.newHashMap(builder.build()); // CraftBukkit
+ }
+
}
+ // CraftBukkit start
+ public boolean removeRecipe(MinecraftKey mcKey) {
+ for (Object2ObjectLinkedOpenHashMap<MinecraftKey, RecipeHolder<?>> recipes : recipes.values()) {
@ -122,8 +125,8 @@
+ }
+
+ return byName.remove(mcKey) != null;
}
+ }
+
+ public void clearRecipes() {
+ this.recipes = Maps.newHashMap();
+

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/IRecipe.java
+++ b/net/minecraft/world/item/crafting/IRecipe.java
@@ -63,4 +63,6 @@
@@ -67,4 +67,6 @@
return recipeitemstack.getItems().length == 0;
});
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/crafting/RecipeItemStack.java
+++ b/net/minecraft/world/item/crafting/RecipeItemStack.java
@@ -38,6 +38,7 @@
@@ -35,6 +35,7 @@
public ItemStack[] itemStacks;
@Nullable
private IntList stackingIds;
@ -8,7 +8,7 @@
public static final Codec<RecipeItemStack> CODEC = codec(true);
public static final Codec<RecipeItemStack> CODEC_NONEMPTY = codec(false);
@@ -75,6 +76,15 @@
@@ -72,6 +73,15 @@
for (int j = 0; j < i; ++j) {
ItemStack itemstack1 = aitemstack[j];

View file

@ -1,8 +1,8 @@
--- a/net/minecraft/world/item/crafting/ShapedRecipes.java
+++ b/net/minecraft/world/item/crafting/ShapedRecipes.java
@@ -18,6 +18,14 @@
@@ -10,6 +10,14 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.World;
import org.apache.commons.lang3.NotImplementedException;
+// CraftBukkit start
+import org.bukkit.NamespacedKey;
@ -14,9 +14,9 @@
+
public class ShapedRecipes implements RecipeCrafting {
final int width;
@@ -42,6 +50,68 @@
this(s, craftingbookcategory, i, j, nonnulllist, itemstack, true);
final ShapedRecipePattern pattern;
@@ -30,6 +38,68 @@
this(s, craftingbookcategory, shapedrecipepattern, itemstack, true);
}
+ // CraftBukkit start
@ -27,9 +27,9 @@
+ recipe.setGroup(this.group);
+ recipe.setCategory(CraftRecipe.getCategory(this.category()));
+
+ switch (this.height) {
+ switch (this.pattern.height()) {
+ case 1:
+ switch (this.width) {
+ switch (this.pattern.width()) {
+ case 1:
+ recipe.shape("a");
+ break;
@ -42,7 +42,7 @@
+ }
+ break;
+ case 2:
+ switch (this.width) {
+ switch (this.pattern.width()) {
+ case 1:
+ recipe.shape("a","b");
+ break;
@ -55,7 +55,7 @@
+ }
+ break;
+ case 3:
+ switch (this.width) {
+ switch (this.pattern.width()) {
+ case 1:
+ recipe.shape("a","b","c");
+ break;
@ -69,7 +69,7 @@
+ break;
+ }
+ char c = 'a';
+ for (RecipeItemStack list : this.recipeItems) {
+ for (RecipeItemStack list : this.pattern.ingredients()) {
+ RecipeChoice choice = CraftRecipe.toBukkit(list);
+ if (choice != null) {
+ recipe.setIngredient(c, choice);

View file

@ -1,12 +1,13 @@
--- a/net/minecraft/world/level/Explosion.java
+++ b/net/minecraft/world/level/Explosion.java
@@ -41,6 +41,15 @@
@@ -39,6 +39,16 @@
import net.minecraft.world.phys.MovingObjectPosition;
import net.minecraft.world.phys.Vec3D;
+// CraftBukkit start
+import net.minecraft.world.entity.boss.EntityComplexPart;
+import net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon;
+import net.minecraft.world.level.block.Blocks;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.Location;
@ -16,15 +17,18 @@
public class Explosion {
private static final ExplosionDamageCalculator EXPLOSION_DAMAGE_CALCULATOR = new ExplosionDamageCalculator();
@@ -59,6 +68,7 @@
private final ExplosionDamageCalculator damageCalculator;
@@ -60,6 +70,10 @@
private final SoundEffect explosionSound;
private final ObjectArrayList<BlockPosition> toBlow;
private final Map<EntityHuman, Vec3D> hitPlayers;
+ public boolean wasCanceled = false; // CraftBukkit - add field
+ // CraftBukkit - add field
+ public boolean wasCanceled = false;
+ public float yield;
+ // CraftBukkit end
public Explosion(World world, @Nullable Entity entity, double d0, double d1, double d2, float f, List<BlockPosition> list) {
this(world, entity, d0, d1, d2, f, false, Explosion.Effect.DESTROY_WITH_DECAY, list);
@@ -79,7 +89,7 @@
public static DamageSource getDefaultDamageSource(World world, @Nullable Entity entity) {
return world.damageSources().explosion(entity, getIndirectSourceEntityInternal(entity));
@@ -85,7 +99,7 @@
this.hitPlayers = Maps.newHashMap();
this.level = world;
this.source = entity;
@ -33,7 +37,15 @@
this.x = d0;
this.y = d1;
this.z = d2;
@@ -129,6 +139,11 @@
@@ -96,6 +110,7 @@
this.smallExplosionParticles = particleparam;
this.largeExplosionParticles = particleparam1;
this.explosionSound = soundeffect;
+ this.yield = this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
}
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -146,6 +161,11 @@
}
public void explode() {
@ -45,48 +57,46 @@
this.level.gameEvent(this.source, GameEvent.EXPLODE, new Vec3D(this.x, this.y, this.z));
Set<BlockPosition> set = Sets.newHashSet();
boolean flag = true;
@@ -213,7 +228,39 @@
double d12 = (double) getSeenPercent(vec3d, entity);
double d13 = (1.0D - d7) * d12;
- entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
+ // CraftBukkit start
@@ -228,7 +248,37 @@
d9 /= d11;
d10 /= d11;
if (this.damageCalculator.shouldDamageEntity(this, entity)) {
- entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ // CraftBukkit start
+
+ // Special case ender dragon only give knockback if no damage is cancelled
+ // Thinks to note:
+ // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
+ // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
+ // - Damaging EntityEnderDragon does nothing
+ // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
+ if (entity instanceof EntityComplexPart) {
+ continue;
+ }
+
+ CraftEventFactory.entityDamage = source;
+ entity.lastDamageCancelled = false;
+
+ if (entity instanceof EntityEnderDragon) {
+ for (EntityComplexPart entityComplexPart : ((EntityEnderDragon) entity).subEntities) {
+ // Calculate damage separately for each EntityComplexPart
+ double d7part;
+ if (list.contains(entityComplexPart) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) {
+ double d13part = (1.0D - d7part) * getSeenPercent(vec3d, entityComplexPart);
+ entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) f2 + 1.0D)));
+ }
+ // Special case ender dragon only give knockback if no damage is cancelled
+ // Thinks to note:
+ // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
+ // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
+ // - Damaging EntityEnderDragon does nothing
+ // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
+ if (entity instanceof EntityComplexPart) {
+ continue;
+ }
+ } else {
+ entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * (double) f2 + 1.0D)));
+ }
+
+ CraftEventFactory.entityDamage = null;
+ if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
+ continue;
+ }
+ // CraftBukkit end
double d14;
+ CraftEventFactory.entityDamage = source;
+ entity.lastDamageCancelled = false;
+
+ if (entity instanceof EntityEnderDragon) {
+ for (EntityComplexPart entityComplexPart : ((EntityEnderDragon) entity).subEntities) {
+ // Calculate damage separately for each EntityComplexPart
+ if (list.contains(entityComplexPart)) {
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ }
+ }
+ } else {
+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ }
+
+ CraftEventFactory.entityDamage = null;
+ if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
+ continue;
+ }
+ // CraftBukkit end
}
if (entity instanceof EntityLiving) {
@@ -265,11 +312,66 @@
double d12 = (1.0D - d7) * (double) getSeenPercent(vec3d, entity);
@@ -287,9 +337,63 @@
SystemUtils.shuffle(this.toBlow, this.level.random);
ObjectListIterator objectlistiterator = this.toBlow.iterator();
@ -104,22 +114,20 @@
+ }
+ }
+
+ boolean cancelled;
+ List<org.bukkit.block.Block> bukkitBlocks;
+ float yield;
+
+ if (explode != null) {
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
+ EntityExplodeEvent event = new EntityExplodeEvent(explode, location, blockList, this.yield);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled();
+ this.wasCanceled = event.isCancelled();
+ bukkitBlocks = event.blockList();
+ yield = event.getYield();
+ this.yield = event.getYield();
+ } else {
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F);
+ BlockExplodeEvent event = new BlockExplodeEvent(location.getBlock(), blockList, this.yield);
+ this.level.getCraftServer().getPluginManager().callEvent(event);
+ cancelled = event.isCancelled();
+ this.wasCanceled = event.isCancelled();
+ bukkitBlocks = event.blockList();
+ yield = event.getYield();
+ this.yield = event.getYield();
+ }
+
+ this.toBlow.clear();
@ -129,8 +137,7 @@
+ toBlow.add(coords);
+ }
+
+ if (cancelled) {
+ this.wasCanceled = true;
+ if (this.wasCanceled) {
+ return;
+ }
+ // CraftBukkit end
@ -138,9 +145,9 @@
while (objectlistiterator.hasNext()) {
BlockPosition blockposition = (BlockPosition) objectlistiterator.next();
IBlockData iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();
+ // CraftBukkit start - TNTPrimeEvent
+ IBlockData iblockdata = this.level.getBlockState(blockposition);
+ Block block = iblockdata.getBlock();
+ if (block instanceof net.minecraft.world.level.block.BlockTNT) {
+ Entity sourceEntity = source == null ? null : source;
+ BlockPosition sourceBlock = sourceEntity == null ? BlockPosition.containing(this.x, this.y, this.z) : null;
@ -151,37 +158,26 @@
+ }
+ // CraftBukkit end
if (!iblockdata.isAir()) {
BlockPosition blockposition1 = blockposition.immutable();
@@ -283,8 +385,8 @@
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.level.getBlockEntity(blockposition) : null;
LootParams.a lootparams_a = (new LootParams.a(worldserver)).withParameter(LootContextParameters.ORIGIN, Vec3D.atCenterOf(blockposition)).withParameter(LootContextParameters.TOOL, ItemStack.EMPTY).withOptionalParameter(LootContextParameters.BLOCK_ENTITY, tileentity).withOptionalParameter(LootContextParameters.THIS_ENTITY, this.source);
this.level.getBlockState(blockposition).onExplosionHit(this.level, blockposition, this, (itemstack, blockposition1) -> {
addOrAppendStack(list, itemstack, blockposition1);
@@ -314,7 +418,11 @@
BlockPosition blockposition1 = (BlockPosition) objectlistiterator1.next();
- if (this.blockInteraction == Explosion.Effect.DESTROY_WITH_DECAY) {
- lootparams_a.withParameter(LootContextParameters.EXPLOSION_RADIUS, this.radius);
+ if (yield < 1.0F) { // CraftBukkit - add yield
+ lootparams_a.withParameter(LootContextParameters.EXPLOSION_RADIUS, 1.0F / yield); // CraftBukkit - add yield
}
iblockdata.spawnAfterBreak(worldserver, blockposition, ItemStack.EMPTY, flag2);
@@ -316,7 +418,11 @@
BlockPosition blockposition2 = (BlockPosition) objectlistiterator1.next();
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition2).isAir() && this.level.getBlockState(blockposition2.below()).isSolidRender(this.level, blockposition2.below())) {
- this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
if (this.random.nextInt(3) == 0 && this.level.getBlockState(blockposition1).isAir() && this.level.getBlockState(blockposition1.below()).isSolidRender(this.level, blockposition1.below())) {
- this.level.setBlockAndUpdate(blockposition1, BlockFireAbstract.getState(this.level, blockposition1));
+ // CraftBukkit start - Ignition by explosion
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), this).isCancelled()) {
+ this.level.setBlockAndUpdate(blockposition2, BlockFireAbstract.getState(this.level, blockposition2));
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level, blockposition1, this).isCancelled()) {
+ this.level.setBlockAndUpdate(blockposition1, BlockFireAbstract.getState(this.level, blockposition1));
+ }
+ // CraftBukkit end
}
}
}
@@ -328,6 +434,7 @@
@@ -322,6 +430,7 @@
}
private static void addBlockDrops(ObjectArrayList<Pair<ItemStack, BlockPosition>> objectarraylist, ItemStack itemstack, BlockPosition blockposition) {
private static void addOrAppendStack(List<Pair<ItemStack, BlockPosition>> list, ItemStack itemstack, BlockPosition blockposition) {
+ if (itemstack.isEmpty()) return; // CraftBukkit - SPIGOT-5425
int i = objectarraylist.size();
for (int j = 0; j < i; ++j) {
for (int i = 0; i < list.size(); ++i) {
Pair<ItemStack, BlockPosition> pair = (Pair) list.get(i);
ItemStack itemstack1 = (ItemStack) pair.getFirst();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/GameRules.java
+++ b/net/minecraft/world/level/GameRules.java
@@ -138,7 +138,7 @@
@@ -142,7 +142,7 @@
}
public <T extends GameRules.GameRuleValue<T>> T getRule(GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@ -9,7 +9,7 @@
}
public NBTTagCompound createTag() {
@@ -152,7 +152,7 @@
@@ -156,7 +156,7 @@
private void loadFromTag(DynamicLike<?> dynamiclike) {
this.rules.forEach((gamerules_gamerulekey, gamerules_gamerulevalue) -> {
@ -18,7 +18,7 @@
Objects.requireNonNull(gamerules_gamerulevalue);
optional.ifPresent(gamerules_gamerulevalue::deserialize);
@@ -172,8 +172,8 @@
@@ -176,8 +176,8 @@
}
private static <T extends GameRules.GameRuleValue<T>> void callVisitorCap(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<?> gamerules_gamerulekey, GameRules.GameRuleDefinition<?> gamerules_gameruledefinition) {
@ -29,7 +29,7 @@
}
public void assignFrom(GameRules gamerules, @Nullable MinecraftServer minecraftserver) {
@@ -265,7 +265,7 @@
@@ -269,7 +269,7 @@
}
public T createRule() {
@ -38,7 +38,7 @@
}
public void callVisitor(GameRules.GameRuleVisitor gamerules_gamerulevisitor, GameRules.GameRuleKey<T> gamerules_gamerulekey) {
@@ -295,7 +295,7 @@
@@ -299,7 +299,7 @@
}
@ -47,7 +47,7 @@
public abstract String serialize();
@@ -361,7 +361,7 @@
@@ -365,7 +365,7 @@
}
@Override
@ -56,7 +56,7 @@
this.value = Boolean.parseBoolean(s);
}
@@ -426,7 +426,7 @@
@@ -430,7 +430,7 @@
}
@Override

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/MobSpawnerAbstract.java
+++ b/net/minecraft/world/level/MobSpawnerAbstract.java
@@ -50,6 +50,7 @@
@@ -52,6 +52,7 @@
public void setEntityId(EntityTypes<?> entitytypes, @Nullable World world, RandomSource randomsource, BlockPosition blockposition) {
this.getOrCreateNextSpawnData(world, randomsource, blockposition).getEntityToSpawn().putString("id", BuiltInRegistries.ENTITY_TYPE.getKey(entitytypes).toString());
@ -8,7 +8,7 @@
}
private boolean isNearPlayer(World world, BlockPosition blockposition) {
@@ -152,7 +153,12 @@
@@ -154,7 +155,12 @@
}
}

View file

@ -1,15 +1,15 @@
--- a/net/minecraft/world/level/RayTrace.java
+++ b/net/minecraft/world/level/RayTrace.java
@@ -26,7 +26,7 @@
this.to = vec3d1;
this.block = raytrace_blockcollisionoption;
this.fluid = raytrace_fluidcollisionoption;
- this.collisionContext = VoxelShapeCollision.of(entity);
+ this.collisionContext = (entity == null) ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entity); // CraftBukkit
@@ -22,7 +22,7 @@
private final VoxelShapeCollision collisionContext;
public RayTrace(Vec3D vec3d, Vec3D vec3d1, RayTrace.BlockCollisionOption raytrace_blockcollisionoption, RayTrace.FluidCollisionOption raytrace_fluidcollisionoption, Entity entity) {
- this(vec3d, vec3d1, raytrace_blockcollisionoption, raytrace_fluidcollisionoption, VoxelShapeCollision.of(entity));
+ this(vec3d, vec3d1, raytrace_blockcollisionoption, raytrace_fluidcollisionoption, (entity == null) ? VoxelShapeCollision.empty() : VoxelShapeCollision.of(entity)); // CraftBukkit
}
public Vec3D getTo() {
@@ -75,7 +75,7 @@
public RayTrace(Vec3D vec3d, Vec3D vec3d1, RayTrace.BlockCollisionOption raytrace_blockcollisionoption, RayTrace.FluidCollisionOption raytrace_fluidcollisionoption, VoxelShapeCollision voxelshapecollision) {
@@ -79,7 +79,7 @@
private final Predicate<Fluid> canPick;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/World.java
+++ b/net/minecraft/world/level/World.java
@@ -72,6 +72,31 @@
@@ -75,6 +75,31 @@
import net.minecraft.world.phys.Vec3D;
import net.minecraft.world.scores.Scoreboard;
@ -32,7 +32,7 @@
public abstract class World implements GeneratorAccess, AutoCloseable {
public static final Codec<ResourceKey<World>> RESOURCE_KEY_CODEC = ResourceKey.codec(Registries.DIMENSION);
@@ -114,7 +139,43 @@
@@ -117,7 +142,43 @@
private final DamageSources damageSources;
private long subTickCount;
@ -77,7 +77,7 @@
this.profiler = supplier;
this.levelData = worlddatamutable;
this.dimensionTypeRegistration = holder;
@@ -129,12 +190,12 @@
@@ -132,12 +193,12 @@
this.worldBorder = new WorldBorder() {
@Override
public double getCenterX() {
@ -92,7 +92,7 @@
}
};
} else {
@@ -147,6 +208,42 @@
@@ -150,6 +211,42 @@
this.neighborUpdater = new CollectingNeighborUpdater(this, j);
this.registryAccess = iregistrycustom;
this.damageSources = new DamageSources(iregistrycustom);
@ -135,7 +135,7 @@
}
@Override
@@ -204,6 +301,17 @@
@@ -207,6 +304,17 @@
@Override
public boolean setBlock(BlockPosition blockposition, IBlockData iblockdata, int i, int j) {
@ -153,7 +153,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return false;
} else if (!this.isClientSide && this.isDebug()) {
@@ -211,13 +319,29 @@
@@ -214,13 +322,29 @@
} else {
Chunk chunk = this.getChunkAt(blockposition);
Block block = iblockdata.getBlock();
@ -184,7 +184,7 @@
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
this.setBlocksDirty(blockposition, iblockdata1, iblockdata2);
@@ -244,12 +368,69 @@
@@ -247,12 +371,69 @@
this.onBlockStateChange(blockposition, iblockdata1, iblockdata2);
}
@ -254,7 +254,7 @@
public void onBlockStateChange(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
@Override
@@ -335,6 +516,14 @@
@@ -338,6 +519,14 @@
@Override
public IBlockData getBlockState(BlockPosition blockposition) {
@ -269,7 +269,7 @@
if (this.isOutsideBuildHeight(blockposition)) {
return Blocks.VOID_AIR.defaultBlockState();
} else {
@@ -526,6 +715,16 @@
@@ -543,6 +732,16 @@
@Nullable
@Override
public TileEntity getBlockEntity(BlockPosition blockposition) {
@ -286,7 +286,7 @@
return this.isOutsideBuildHeight(blockposition) ? null : (!this.isClientSide && Thread.currentThread() != this.thread ? null : this.getChunkAt(blockposition).getBlockEntity(blockposition, Chunk.EnumTileEntityState.IMMEDIATE));
}
@@ -533,6 +732,12 @@
@@ -550,6 +749,12 @@
BlockPosition blockposition = tileentity.getBlockPos();
if (!this.isOutsideBuildHeight(blockposition)) {
@ -299,7 +299,7 @@
this.getChunkAt(blockposition).addAndRegisterBlockEntity(tileentity);
}
}
@@ -663,7 +868,7 @@
@@ -680,7 +885,7 @@
for (int k = 0; k < j; ++k) {
EntityComplexPart entitycomplexpart = aentitycomplexpart[k];

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/AbstractCandleBlock.java
+++ b/net/minecraft/world/level/block/AbstractCandleBlock.java
@@ -38,6 +38,11 @@
@@ -45,6 +45,11 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
if (!world.isClientSide && iprojectile.isOnFire() && this.canBeLit(iblockdata)) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BigDripleafBlock.java
+++ b/net/minecraft/world/level/block/BigDripleafBlock.java
@@ -41,6 +41,11 @@
@@ -42,6 +42,11 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@ -11,8 +11,8 @@
+
public class BigDripleafBlock extends BlockFacingHorizontal implements IBlockFragilePlantElement, IBlockWaterlogged {
private static final BlockStateBoolean WATERLOGGED = BlockProperties.WATERLOGGED;
@@ -109,7 +114,7 @@
public static final MapCodec<BigDripleafBlock> CODEC = simpleCodec(BigDripleafBlock::new);
@@ -116,7 +121,7 @@
@Override
public void onProjectileHit(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) {
@ -21,7 +21,7 @@
}
@Override
@@ -168,7 +173,20 @@
@@ -175,7 +180,20 @@
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if (!world.isClientSide) {
if (iblockdata.getValue(BigDripleafBlock.TILT) == Tilt.NONE && canEntityTilt(blockposition, entity) && !world.hasNeighborSignal(blockposition)) {
@ -43,7 +43,7 @@
}
}
@@ -182,9 +200,9 @@
@@ -189,9 +207,9 @@
Tilt tilt = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
if (tilt == Tilt.UNSTABLE) {
@ -55,7 +55,7 @@
} else if (tilt == Tilt.FULL) {
resetTilt(iblockdata, worldserver, blockposition);
}
@@ -210,8 +228,10 @@
@@ -217,8 +235,10 @@
return entity.onGround() && entity.position().y > (double) ((float) blockposition.getY() + 0.6875F);
}
@ -68,7 +68,7 @@
if (soundeffect != null) {
playTiltSound(world, blockposition, soundeffect);
}
@@ -225,14 +245,21 @@
@@ -232,14 +252,21 @@
}
private static void resetTilt(IBlockData iblockdata, World world, BlockPosition blockposition) {
@ -92,7 +92,7 @@
Tilt tilt1 = (Tilt) iblockdata.getValue(BigDripleafBlock.TILT);
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BigDripleafBlock.TILT, tilt), 2);
@@ -240,6 +267,7 @@
@@ -247,6 +274,7 @@
world.gameEvent((Entity) null, GameEvent.BLOCK_CHANGE, blockposition);
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/Block.java
+++ b/net/minecraft/world/level/block/Block.java
@@ -342,7 +342,13 @@
@@ -349,7 +349,13 @@
EntityItem entityitem = (EntityItem) supplier.get();
entityitem.setDefaultPickUpDelay();
@ -15,7 +15,7 @@
}
}
@@ -368,7 +374,7 @@
@@ -375,7 +381,7 @@
public void playerDestroy(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, @Nullable TileEntity tileentity, ItemStack itemstack) {
entityhuman.awardStat(StatisticList.BLOCK_MINED.get(this));
@ -24,7 +24,7 @@
dropResources(iblockdata, world, blockposition, tileentity, entityhuman, itemstack);
}
@@ -504,17 +510,25 @@
@@ -512,17 +518,25 @@
return this.builtInRegistryHolder;
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBamboo.java
+++ b/net/minecraft/world/level/block/BlockBamboo.java
@@ -180,7 +180,7 @@
@@ -187,7 +187,7 @@
BlockPosition blockposition1 = blockposition.above(i);
IBlockData iblockdata1 = worldserver.getBlockState(blockposition1);
@ -9,7 +9,7 @@
return;
}
@@ -201,14 +201,18 @@
@@ -208,14 +208,18 @@
BlockPosition blockposition1 = blockposition.below(2);
IBlockData iblockdata2 = world.getBlockState(blockposition1);
BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE;
@ -30,7 +30,7 @@
}
}
} else {
@@ -219,7 +223,14 @@
@@ -226,7 +230,14 @@
int j = (Integer) iblockdata.getValue(BlockBamboo.AGE) != 1 && !iblockdata2.is(Blocks.BAMBOO) ? 0 : 1;
int k = (i < 11 || randomsource.nextFloat() >= 0.25F) && i != 15 ? 0 : 1;

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBambooSapling.java
+++ b/net/minecraft/world/level/block/BlockBambooSapling.java
@@ -88,6 +88,6 @@
@@ -95,6 +95,6 @@
}
protected void growBamboo(World world, BlockPosition blockposition) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBed.java
+++ b/net/minecraft/world/level/block/BlockBed.java
@@ -84,7 +84,8 @@
@@ -94,7 +94,8 @@
}
}
@ -10,7 +10,7 @@
world.removeBlock(blockposition, false);
BlockPosition blockposition1 = blockposition.relative(((EnumDirection) iblockdata.getValue(BlockBed.FACING)).getOpposite());
@@ -103,7 +104,16 @@
@@ -113,7 +114,16 @@
return EnumInteractionResult.SUCCESS;
} else {
@ -27,7 +27,7 @@
if (entityhuman_enumbedresult.getMessage() != null) {
entityhuman.displayClientMessage(entityhuman_enumbedresult.getMessage(), true);
}
@@ -114,8 +124,29 @@
@@ -124,8 +134,29 @@
}
}
@ -58,7 +58,7 @@
}
private boolean kickVillagerOutOfBed(World world, BlockPosition blockposition) {
@@ -314,6 +345,11 @@
@@ -324,6 +355,11 @@
BlockPosition blockposition1 = blockposition.relative((EnumDirection) iblockdata.getValue(BlockBed.FACING));
world.setBlock(blockposition1, (IBlockData) iblockdata.setValue(BlockBed.PART, BlockPropertyBedPart.HEAD), 3);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBeehive.java
+++ b/net/minecraft/world/level/block/BlockBeehive.java
@@ -112,7 +112,7 @@
@@ -119,7 +119,7 @@
if (entitybee.getTarget() == null) {
EntityHuman entityhuman = (EntityHuman) SystemUtils.getRandom(list1, world.random);
@ -9,20 +9,3 @@
}
}
}
@@ -338,4 +338,16 @@
return super.updateShape(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1);
}
+
+ // CraftBukkit start - fix MC-227255
+ @Override
+ public IBlockData rotate(IBlockData iblockdata, EnumBlockRotation enumblockrotation) {
+ return iblockdata.setValue(BlockBeehive.FACING, enumblockrotation.rotate(iblockdata.getValue(BlockBeehive.FACING)));
+ }
+
+ @Override
+ public IBlockData mirror(IBlockData iblockdata, EnumBlockMirror enumblockmirror) {
+ return iblockdata.rotate(enumblockmirror.getRotation(iblockdata.getValue(BlockBeehive.FACING)));
+ }
+ // CraftBukkit end
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockBell.java
+++ b/net/minecraft/world/level/block/BlockBell.java
@@ -136,6 +136,11 @@
@@ -146,6 +146,11 @@
if (enumdirection == null) {
enumdirection = (EnumDirection) world.getBlockState(blockposition).getValue(BlockBell.FACING);
}
@ -12,20 +12,3 @@
((TileEntityBell) tileentity).onHit(enumdirection);
world.playSound((EntityHuman) null, blockposition, SoundEffects.BELL_BLOCK, SoundCategory.BLOCKS, 2.0F, 1.0F);
@@ -262,4 +267,16 @@
public boolean isPathfindable(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) {
return false;
}
+
+ // CraftBukkit start - fix MC-253819
+ @Override
+ public IBlockData rotate(IBlockData iblockdata, EnumBlockRotation enumblockrotation) {
+ return iblockdata.setValue(BlockBell.FACING, enumblockrotation.rotate(iblockdata.getValue(BlockBell.FACING)));
+ }
+
+ @Override
+ public IBlockData mirror(IBlockData iblockdata, EnumBlockMirror enumblockmirror) {
+ return iblockdata.rotate(enumblockmirror.getRotation(iblockdata.getValue(BlockBell.FACING)));
+ }
+ // CraftBukkit end
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockButtonAbstract.java
+++ b/net/minecraft/world/level/block/BlockButtonAbstract.java
@@ -27,6 +27,11 @@
@@ -33,6 +33,11 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@ -11,8 +11,8 @@
+
public class BlockButtonAbstract extends BlockAttachable {
public static final BlockStateBoolean POWERED = BlockProperties.POWERED;
@@ -108,6 +113,19 @@
public static final MapCodec<BlockButtonAbstract> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -124,6 +129,19 @@
if ((Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED)) {
return EnumInteractionResult.CONSUME;
} else {
@ -32,12 +32,12 @@
this.press(iblockdata, world, blockposition);
this.playSound(entityhuman, world, blockposition, true);
world.gameEvent((Entity) entityhuman, GameEvent.BLOCK_ACTIVATE, blockposition);
@@ -170,11 +188,36 @@
@@ -195,11 +213,36 @@
}
protected void checkPressed(IBlockData iblockdata, World world, BlockPosition blockposition) {
- EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse((Object) null) : null;
+ EntityArrow entityarrow = this.arrowsCanPress ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse(null) : null; // CraftBukkit - decompile error
- EntityArrow entityarrow = this.type.canButtonBeActivatedByArrows() ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse((Object) null) : null;
+ EntityArrow entityarrow = this.type.canButtonBeActivatedByArrows() ? (EntityArrow) world.getEntitiesOfClass(EntityArrow.class, iblockdata.getShape(world, blockposition).bounds().move(blockposition)).stream().findFirst().orElse(null) : null; // CraftBukkit - decompile error
boolean flag = entityarrow != null;
boolean flag1 = (Boolean) iblockdata.getValue(BlockButtonAbstract.POWERED);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCactus.java
+++ b/net/minecraft/world/level/block/BlockCactus.java
@@ -21,6 +21,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
@ -8,8 +8,8 @@
+
public class BlockCactus extends Block {
public static final BlockStateInteger AGE = BlockProperties.AGE_15;
@@ -57,7 +59,7 @@
public static final MapCodec<BlockCactus> CODEC = simpleCodec(BlockCactus::new);
@@ -64,7 +66,7 @@
int j = (Integer) iblockdata.getValue(BlockCactus.AGE);
if (j == 15) {
@ -18,7 +18,7 @@
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockCactus.AGE, 0);
worldserver.setBlock(blockposition, iblockdata1, 4);
@@ -112,7 +114,9 @@
@@ -119,7 +121,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCake.java
+++ b/net/minecraft/world/level/block/BlockCake.java
@@ -85,7 +85,18 @@
@@ -92,7 +92,18 @@
return EnumInteractionResult.PASS;
} else {
entityhuman.awardStat(StatisticList.EAT_CAKE_SLICE);

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCampfire.java
+++ b/net/minecraft/world/level/block/BlockCampfire.java
@@ -47,6 +47,10 @@
@@ -50,6 +50,10 @@
import net.minecraft.world.phys.shapes.VoxelShapeCollision;
import net.minecraft.world.phys.shapes.VoxelShapes;
@ -10,8 +10,8 @@
+
public class BlockCampfire extends BlockTileEntity implements IBlockWaterlogged {
protected static final VoxelShape SHAPE = Block.box(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D);
@@ -91,7 +95,9 @@
public static final MapCodec<BlockCampfire> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -106,7 +110,9 @@
@Override
public void entityInside(IBlockData iblockdata, World world, BlockPosition blockposition, Entity entity) {
if ((Boolean) iblockdata.getValue(BlockCampfire.LIT) && entity instanceof EntityLiving && !EnchantmentManager.hasFrostWalker((EntityLiving) entity)) {
@ -21,7 +21,7 @@
}
super.entityInside(iblockdata, world, blockposition, entity);
@@ -201,6 +207,11 @@
@@ -216,6 +222,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.isOnFire() && iprojectile.mayInteract(world, blockposition) && !(Boolean) iblockdata.getValue(BlockCampfire.LIT) && !(Boolean) iblockdata.getValue(BlockCampfire.WATERLOGGED)) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockCauldron.java
+++ b/net/minecraft/world/level/block/BlockCauldron.java
@@ -11,6 +11,10 @@
@@ -12,6 +12,10 @@
import net.minecraft.world.level.material.FluidType;
import net.minecraft.world.level.material.FluidTypes;
@ -10,8 +10,8 @@
+
public class BlockCauldron extends AbstractCauldronBlock {
private static final float RAIN_FILL_CHANCE = 0.05F;
@@ -54,13 +58,11 @@
public static final MapCodec<BlockCauldron> CODEC = simpleCodec(BlockCauldron::new);
@@ -61,13 +65,11 @@
if (fluidtype == FluidTypes.WATER) {
iblockdata1 = Blocks.WATER_CAULDRON.defaultBlockState();

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChest.java
+++ b/net/minecraft/world/level/block/BlockChest.java
@@ -87,24 +87,7 @@
@@ -93,24 +93,7 @@
public Optional<ITileInventory> acceptDouble(final TileEntityChest tileentitychest, final TileEntityChest tileentitychest1) {
final InventoryLargeChest inventorylargechest = new InventoryLargeChest(tileentitychest, tileentitychest1);
@ -26,7 +26,7 @@
}
public Optional<ITileInventory> acceptSingle(TileEntityChest tileentitychest) {
@@ -117,6 +100,38 @@
@@ -123,6 +106,38 @@
}
};
@ -62,10 +62,10 @@
+ };
+ // CraftBukkit end
+
protected BlockChest(BlockBase.Info blockbase_info, Supplier<TileEntityTypes<? extends TileEntityChest>> supplier) {
super(blockbase_info, supplier);
this.registerDefaultState((IBlockData) ((IBlockData) ((IBlockData) ((IBlockData) this.stateDefinition.any()).setValue(BlockChest.FACING, EnumDirection.NORTH)).setValue(BlockChest.TYPE, BlockPropertyChestType.SINGLE)).setValue(BlockChest.WATERLOGGED, false));
@@ -275,7 +290,7 @@
@Override
public MapCodec<? extends BlockChest> codec() {
return BlockChest.CODEC;
@@ -278,7 +293,7 @@
@Override
public DoubleBlockFinder.Result<? extends TileEntityChest> combine(IBlockData iblockdata, World world, BlockPosition blockposition, boolean flag) {
@ -74,7 +74,7 @@
if (flag) {
bipredicate = (generatoraccess, blockposition1) -> {
@@ -291,7 +306,14 @@
@@ -294,7 +309,14 @@
@Nullable
@Override
public ITileInventory getMenuProvider(IBlockData iblockdata, World world, BlockPosition blockposition) {

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/BlockChorusFlower.java
+++ b/net/minecraft/world/level/block/BlockChorusFlower.java
@@ -20,6 +20,8 @@
@@ -22,6 +22,8 @@
import net.minecraft.world.phys.MovingObjectPositionBlock;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -8,23 +8,23 @@
+
public class BlockChorusFlower extends Block {
public static final int DEAD_AGE = 5;
@@ -90,8 +92,12 @@
public static final MapCodec<BlockChorusFlower> CODEC = RecordCodecBuilder.mapCodec((instance) -> {
@@ -102,8 +104,12 @@
}
if (flag && allNeighborsEmpty(worldserver, blockposition1, (EnumDirection) null) && worldserver.isEmptyBlock(blockposition.above(2))) {
- worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
- worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
- this.placeGrownFlower(worldserver, blockposition1, i);
+ // CraftBukkit start - add event
+ if (CraftEventFactory.handleBlockSpreadEvent(worldserver, blockposition, blockposition1, this.defaultBlockState().setValue(BlockChorusFlower.AGE, Integer.valueOf(i)), 2)) {
+ worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
+ worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
+ this.placeGrownFlower(worldserver, blockposition1, i);
+ }
+ // CraftBukkit end
} else if (i < 4) {
j = randomsource.nextInt(4);
if (flag1) {
@@ -105,18 +111,30 @@
@@ -117,18 +123,30 @@
BlockPosition blockposition2 = blockposition.relative(enumdirection);
if (worldserver.isEmptyBlock(blockposition2) && worldserver.isEmptyBlock(blockposition2.below()) && allNeighborsEmpty(worldserver, blockposition2, enumdirection.getOpposite())) {
@ -40,7 +40,7 @@
}
if (flag2) {
worldserver.setBlock(blockposition, this.plant.getStateForPlacement(worldserver, blockposition), 2);
worldserver.setBlock(blockposition, BlockChorusFruit.getStateWithConnections(worldserver, blockposition, this.plant.defaultBlockState()), 2);
} else {
- this.placeDeadFlower(worldserver, blockposition);
+ // CraftBukkit start - add event
@ -59,10 +59,10 @@
}
}
@@ -253,6 +271,11 @@
@@ -265,6 +283,11 @@
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.getType().is(TagsEntity.IMPACT_PROJECTILES)) {
if (!world.isClientSide && iprojectile.mayInteract(world, blockposition) && iprojectile.mayBreak(world)) {
+ // CraftBukkit
+ if (!CraftEventFactory.callEntityChangeBlockEvent(iprojectile, blockposition, Blocks.AIR.defaultBlockState())) {
+ return;

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