mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-02 17:32:03 +01:00
Update to Minecraft 1.20.5
By: md_5 <git@md-5.net>
This commit is contained in:
parent
4deda9501f
commit
65bc2541a3
524 changed files with 7788 additions and 6181 deletions
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/advancements/AdvancementHolder.java
|
||||
+++ b/net/minecraft/advancements/AdvancementHolder.java
|
||||
@@ -3,6 +3,11 @@
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
@@ -6,6 +6,11 @@
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -11,8 +11,8 @@
|
|||
+
|
||||
public record AdvancementHolder(MinecraftKey id, Advancement value) {
|
||||
|
||||
public void write(PacketDataSerializer packetdataserializer) {
|
||||
@@ -41,4 +46,10 @@
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, AdvancementHolder> STREAM_CODEC = StreamCodec.composite(MinecraftKey.STREAM_CODEC, AdvancementHolder::id, Advancement.STREAM_CODEC, AdvancementHolder::value, AdvancementHolder::new);
|
||||
@@ -38,4 +43,10 @@
|
||||
public String toString() {
|
||||
return this.id.toString();
|
||||
}
|
||||
|
|
|
@ -1,14 +1,5 @@
|
|||
--- a/net/minecraft/advancements/AdvancementTree.java
|
||||
+++ b/net/minecraft/advancements/AdvancementTree.java
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
|
||||
public void addAll(Collection<AdvancementHolder> collection) {
|
||||
- ArrayList arraylist = new ArrayList(collection);
|
||||
+ ArrayList<AdvancementHolder> arraylist = new ArrayList(collection); // CraftBukkit - decompile error
|
||||
|
||||
while (!arraylist.isEmpty()) {
|
||||
if (!arraylist.removeIf(this::tryInsert)) {
|
||||
@@ -77,7 +77,7 @@
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/CommandDispatcher.java
|
||||
+++ b/net/minecraft/commands/CommandDispatcher.java
|
||||
@@ -134,6 +134,14 @@
|
||||
@@ -136,6 +136,14 @@
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class CommandDispatcher {
|
||||
|
||||
private static final ThreadLocal<ExecutionContext<CommandListenerWrapper>> CURRENT_EXECUTION_CONTEXT = new ThreadLocal();
|
||||
@@ -146,6 +154,7 @@
|
||||
@@ -148,6 +156,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);
|
||||
@@ -246,6 +255,11 @@
|
||||
@@ -249,6 +258,11 @@
|
||||
CommandPublish.register(this.dispatcher);
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
|||
this.dispatcher.setConsumer(ExecutionCommandSource.resultConsumer());
|
||||
}
|
||||
|
||||
@@ -256,18 +270,65 @@
|
||||
@@ -259,18 +273,65 @@
|
||||
return new ParseResults(commandcontextbuilder1, parseresults.getReader(), parseresults.getExceptions());
|
||||
}
|
||||
|
||||
|
@ -98,12 +98,12 @@
|
|||
commandlistenerwrapper.getServer().getProfiler().push(() -> {
|
||||
return "/" + s;
|
||||
});
|
||||
- ContextChain contextchain = finishParsing(parseresults, s, commandlistenerwrapper);
|
||||
+ ContextChain contextchain = finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
||||
- ContextChain<CommandListenerWrapper> contextchain = finishParsing(parseresults, s, commandlistenerwrapper);
|
||||
+ ContextChain<CommandListenerWrapper> contextchain = finishParsing(parseresults, s, commandlistenerwrapper, label); // CraftBukkit
|
||||
|
||||
try {
|
||||
if (contextchain != null) {
|
||||
@@ -301,7 +362,7 @@
|
||||
@@ -304,7 +365,7 @@
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -112,7 +112,7 @@
|
|||
try {
|
||||
validateParseResults(parseresults);
|
||||
return (ContextChain) ContextChain.tryFlatten(parseresults.getContext().build(s)).orElseThrow(() -> {
|
||||
@@ -312,7 +373,7 @@
|
||||
@@ -315,7 +376,7 @@
|
||||
if (commandsyntaxexception.getInput() != null && commandsyntaxexception.getCursor() >= 0) {
|
||||
int i = Math.min(commandsyntaxexception.getInput().length(), commandsyntaxexception.getCursor());
|
||||
IChatMutableComponent ichatmutablecomponent = IChatBaseComponent.empty().withStyle(EnumChatFormat.GRAY).withStyle((chatmodifier) -> {
|
||||
|
@ -121,7 +121,7 @@
|
|||
});
|
||||
|
||||
if (i > 10) {
|
||||
@@ -362,7 +423,7 @@
|
||||
@@ -365,7 +426,7 @@
|
||||
|
||||
executioncontext1.close();
|
||||
} finally {
|
||||
|
@ -130,7 +130,7 @@
|
|||
}
|
||||
} else {
|
||||
consumer.accept(executioncontext);
|
||||
@@ -371,11 +432,36 @@
|
||||
@@ -374,11 +435,36 @@
|
||||
}
|
||||
|
||||
public void sendCommands(EntityPlayer entityplayer) {
|
||||
|
@ -168,7 +168,7 @@
|
|||
entityplayer.connection.send(new PacketPlayOutCommands(rootcommandnode));
|
||||
}
|
||||
|
||||
@@ -386,7 +472,7 @@
|
||||
@@ -389,7 +475,7 @@
|
||||
CommandNode<CommandListenerWrapper> commandnode2 = (CommandNode) iterator.next();
|
||||
|
||||
if (commandnode2.canUse(commandlistenerwrapper)) {
|
||||
|
@ -177,7 +177,7 @@
|
|||
|
||||
argumentbuilder.requires((icompletionprovider) -> {
|
||||
return true;
|
||||
@@ -409,7 +495,7 @@
|
||||
@@ -412,7 +498,7 @@
|
||||
argumentbuilder.redirect((CommandNode) map.get(argumentbuilder.getRedirect()));
|
||||
}
|
||||
|
||||
|
@ -186,3 +186,12 @@
|
|||
|
||||
map.put(commandnode2, commandnode3);
|
||||
commandnode1.addChild(commandnode3);
|
||||
@@ -473,7 +559,7 @@
|
||||
}
|
||||
|
||||
private <T> HolderLookup.b.a<T> createLookup(final HolderLookup.b<T> holderlookup_b) {
|
||||
- return new HolderLookup.b.a<T>(this) {
|
||||
+ return new HolderLookup.b.a<T>() { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public HolderLookup.b<T> parent() {
|
||||
return holderlookup_b;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
public Vec3D getPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
@@ -304,7 +321,7 @@
|
||||
@@ -300,7 +317,7 @@
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
|||
entityplayer.sendSystemMessage(ichatmutablecomponent);
|
||||
}
|
||||
}
|
||||
@@ -397,4 +414,10 @@
|
||||
@@ -393,4 +410,10 @@
|
||||
public boolean isSilent() {
|
||||
return this.silent;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
+++ b/net/minecraft/commands/arguments/blocks/ArgumentBlock.java
|
||||
@@ -68,7 +68,7 @@
|
||||
@@ -67,7 +67,7 @@
|
||||
private final StringReader reader;
|
||||
private final boolean forTesting;
|
||||
private final boolean allowNbt;
|
||||
|
@ -9,16 +9,16 @@
|
|||
private final Map<String, String> vagueProperties = Maps.newHashMap();
|
||||
private MinecraftKey id = new MinecraftKey("");
|
||||
@Nullable
|
||||
@@ -276,7 +276,7 @@
|
||||
@@ -275,7 +275,7 @@
|
||||
Iterator iterator = iblockstate.getPossibleValues().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
- T t0 = (Comparable) iterator.next();
|
||||
+ T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 instanceof Integer) {
|
||||
Integer integer = (Integer) t0;
|
||||
@@ -548,7 +548,7 @@
|
||||
if (t0 instanceof Integer integer) {
|
||||
suggestionsbuilder.suggest(integer);
|
||||
@@ -545,7 +545,7 @@
|
||||
Optional<T> optional = iblockstate.getValue(s);
|
||||
|
||||
if (optional.isPresent()) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.properties.put(iblockstate, (Comparable) optional.get());
|
||||
} else {
|
||||
this.reader.setCursor(i);
|
||||
@@ -584,7 +584,7 @@
|
||||
@@ -581,7 +581,7 @@
|
||||
private static <T extends Comparable<T>> void appendProperty(StringBuilder stringbuilder, IBlockState<T> iblockstate, Comparable<?> comparable) {
|
||||
stringbuilder.append(iblockstate.getName());
|
||||
stringbuilder.append('=');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
+++ b/net/minecraft/core/cauldron/CauldronInteraction.java
|
||||
@@ -33,9 +33,15 @@
|
||||
@@ -34,9 +34,15 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
|||
Codec<CauldronInteraction.a> CODEC;
|
||||
CauldronInteraction.a EMPTY;
|
||||
CauldronInteraction.a WATER;
|
||||
@@ -47,6 +53,8 @@
|
||||
@@ -48,6 +54,8 @@
|
||||
CauldronInteraction SHULKER_BOX;
|
||||
CauldronInteraction BANNER;
|
||||
CauldronInteraction DYED_ITEM;
|
||||
|
@ -25,13 +25,13 @@
|
|||
|
||||
static CauldronInteraction.a newInteractionMap(String s) {
|
||||
Object2ObjectOpenHashMap<Item, CauldronInteraction> object2objectopenhashmap = new Object2ObjectOpenHashMap();
|
||||
@@ -71,12 +79,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
} else {
|
||||
@@ -72,12 +80,17 @@
|
||||
|
||||
if (potioncontents != null && potioncontents.is(Potions.WATER)) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.WATER_CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
@ -42,51 +42,51 @@
|
|||
- world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState());
|
||||
+ // world.setBlockAndUpdate(blockposition, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -94,12 +107,17 @@
|
||||
@@ -97,12 +110,17 @@
|
||||
});
|
||||
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)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER)));
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, PotionContents.createItemStack(Items.POTION, Potions.WATER)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(item));
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -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
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL));
|
||||
+ // world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -188,12 +211,17 @@
|
||||
return EnumInteractionResult.PASS;
|
||||
@@ -117,10 +135,15 @@
|
||||
|
||||
if (potioncontents != null && potioncontents.is(Potions.WATER)) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata.cycle(LayeredCauldronBlock.LEVEL), entityhuman, CauldronLevelChangeEvent.ChangeReason.BOTTLE_EMPTY)) {
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
entityhuman.setItemInHand(enumhand, ItemLiquidUtil.createFilledResult(itemstack, entityhuman, new ItemStack(Items.GLASS_BOTTLE)));
|
||||
entityhuman.awardStat(StatisticList.USE_CAULDRON);
|
||||
entityhuman.awardStat(StatisticList.ITEM_USED.get(itemstack.getItem()));
|
||||
- world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL));
|
||||
+ // world.setBlockAndUpdate(blockposition, (IBlockData) iblockdata.cycle(LayeredCauldronBlock.LEVEL)); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, SoundEffects.BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -198,12 +221,17 @@
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, Blocks.CAULDRON.defaultBlockState(), entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_FILL)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
@ -97,15 +97,15 @@
|
|||
- world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState());
|
||||
+ // world.setBlockAndUpdate(blockposition, Blocks.CAULDRON.defaultBlockState()); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition);
|
||||
}
|
||||
@@ -204,12 +232,17 @@
|
||||
@@ -214,12 +242,17 @@
|
||||
|
||||
static EnumInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
static ItemInteractionResult emptyBucket(World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, ItemStack itemstack, IBlockData iblockdata, SoundEffect soundeffect) {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.changeLevel(iblockdata, world, blockposition, iblockdata, entityhuman, CauldronLevelChangeEvent.ChangeReason.BUCKET_EMPTY)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Item item = itemstack.getItem();
|
||||
|
@ -116,10 +116,10 @@
|
|||
- world.setBlockAndUpdate(blockposition, iblockdata);
|
||||
+ // world.setBlockAndUpdate(blockposition, iblockdata); // CraftBukkit
|
||||
world.playSound((EntityHuman) null, blockposition, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
world.gameEvent((Entity) null, GameEvent.FLUID_PLACE, blockposition);
|
||||
world.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PLACE, blockposition);
|
||||
}
|
||||
@@ -217,32 +250,35 @@
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
@@ -227,47 +260,55 @@
|
||||
return ItemInteractionResult.sidedSuccess(world.isClientSide);
|
||||
}
|
||||
|
||||
- static {
|
||||
|
@ -127,7 +127,7 @@
|
|||
- Map map = CauldronInteraction.INTERACTIONS;
|
||||
-
|
||||
- Objects.requireNonNull(map);
|
||||
- CODEC = ExtraCodecs.stringResolverCodec(function, map::get);
|
||||
- CODEC = Codec.stringResolver(function, map::get);
|
||||
- EMPTY = newInteractionMap("empty");
|
||||
- WATER = newInteractionMap("water");
|
||||
- LAVA = newInteractionMap("lava");
|
||||
|
@ -135,7 +135,7 @@
|
|||
- 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);
|
||||
+ Codec<CauldronInteraction.a> CODEC = Codec.stringResolver(CauldronInteraction.a::name, CauldronInteraction.INTERACTIONS::get);
|
||||
+ CauldronInteraction.a EMPTY = newInteractionMap("empty");
|
||||
+ CauldronInteraction.a WATER = newInteractionMap("water");
|
||||
+ CauldronInteraction.a LAVA = newInteractionMap("lava");
|
||||
|
@ -157,43 +157,40 @@
|
|||
Block block = Block.byItem(itemstack.getItem());
|
||||
|
||||
if (!(block instanceof BlockShulkerBox)) {
|
||||
return EnumInteractionResult.PASS;
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.SHULKER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = new ItemStack(Blocks.SHULKER_BOX);
|
||||
|
||||
if (itemstack.hasTag()) {
|
||||
@@ -251,17 +287,22 @@
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack1);
|
||||
entityhuman.setItemInHand(enumhand, itemstack.transmuteCopy(Blocks.SHULKER_BOX, 1));
|
||||
entityhuman.awardStat(StatisticList.CLEAN_SHULKER_BOX);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
return ItemInteractionResult.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;
|
||||
BannerPatternLayers bannerpatternlayers = (BannerPatternLayers) itemstack.getOrDefault(DataComponents.BANNER_PATTERNS, BannerPatternLayers.EMPTY);
|
||||
|
||||
if (bannerpatternlayers.layers().isEmpty()) {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.BANNER_WASH)) {
|
||||
+ return EnumInteractionResult.SUCCESS;
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
ItemStack itemstack1 = itemstack.copyWithCount(1);
|
||||
|
||||
TileEntityBanner.removeLastPattern(itemstack1);
|
||||
@@ -278,13 +319,13 @@
|
||||
itemstack1.set(DataComponents.BANNER_PATTERNS, bannerpatternlayers.removeLast());
|
||||
@@ -281,28 +322,33 @@
|
||||
}
|
||||
|
||||
entityhuman.awardStat(StatisticList.CLEAN_BANNER);
|
||||
|
@ -201,31 +198,29 @@
|
|||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return EnumInteractionResult.sidedSuccess(world.isClientSide);
|
||||
return ItemInteractionResult.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);
|
||||
if (!itemstack.is(TagsItem.DYEABLE)) {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
} else if (!itemstack.has(DataComponents.DYED_COLOR)) {
|
||||
return ItemInteractionResult.PASS_TO_DEFAULT_BLOCK_INTERACTION;
|
||||
} else {
|
||||
if (!world.isClientSide) {
|
||||
+ // CraftBukkit start
|
||||
+ if (!LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition, entityhuman, CauldronLevelChangeEvent.ChangeReason.ARMOR_WASH)) {
|
||||
+ return ItemInteractionResult.SUCCESS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
itemstack.remove(DataComponents.DYED_COLOR);
|
||||
entityhuman.awardStat(StatisticList.CLEAN_ARMOR);
|
||||
- LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition);
|
||||
+ // LayeredCauldronBlock.lowerFillLevel(iblockdata, world, blockposition); // CraftBukkit
|
||||
}
|
||||
|
||||
return ItemInteractionResult.sidedSuccess(world.isClientSide);
|
||||
}
|
||||
};
|
||||
- }
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
--- a/net/minecraft/core/component/DataComponentPatch.java
|
||||
+++ b/net/minecraft/core/component/DataComponentPatch.java
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- return reference2objectmap;
|
||||
+ return (Reference2ObjectMap) reference2objectmap; // CraftBukkit - decompile error
|
||||
});
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch> STREAM_CODEC = new StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch>() {
|
||||
public DataComponentPatch decode(RegistryFriendlyByteBuf registryfriendlybytebuf) {
|
||||
@@ -143,7 +143,7 @@
|
||||
}
|
||||
|
||||
private static <T> void encodeComponent(RegistryFriendlyByteBuf registryfriendlybytebuf, DataComponentType<T> datacomponenttype, Object object) {
|
||||
- datacomponenttype.streamCodec().encode(registryfriendlybytebuf, object);
|
||||
+ datacomponenttype.streamCodec().encode(registryfriendlybytebuf, (T) object); // CraftBukkit - decompile error
|
||||
}
|
||||
};
|
||||
private static final String REMOVED_PREFIX = "!";
|
||||
@@ -270,6 +270,38 @@
|
||||
|
||||
a() {}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void copy(DataComponentPatch orig) {
|
||||
+ this.map.putAll(orig.map);
|
||||
+ }
|
||||
+
|
||||
+ public void clear(DataComponentType<?> type) {
|
||||
+ this.map.remove(type);
|
||||
+ }
|
||||
+
|
||||
+ public boolean isEmpty() {
|
||||
+ return this.map.isEmpty();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object object) {
|
||||
+ if (this == object) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ if (object instanceof DataComponentPatch.a patch) {
|
||||
+ return this.map.equals(patch.map);
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int hashCode() {
|
||||
+ return this.map.hashCode();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public <T> DataComponentPatch.a set(DataComponentType<T> datacomponenttype, T t0) {
|
||||
this.map.put(datacomponenttype, Optional.of(t0));
|
||||
return this;
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/core/dispenser/DispenseBehaviorProjectile.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorProjectile.java
|
||||
@@ -8,6 +8,13 @@
|
||||
import net.minecraft.world.level.World;
|
||||
@@ -9,6 +9,13 @@
|
||||
import net.minecraft.world.item.ProjectileItem;
|
||||
import net.minecraft.world.level.block.BlockDispenser;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -11,21 +11,21 @@
|
|||
+import org.bukkit.event.block.BlockDispenseEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
|
||||
public class DispenseBehaviorProjectile extends DispenseBehaviorItem {
|
||||
|
||||
public DispenseBehaviorProjectile() {}
|
||||
@@ -19,9 +26,38 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
IProjectile iprojectile = this.getProjectile(worldserver, iposition, itemstack);
|
||||
private final ProjectileItem projectileItem;
|
||||
@@ -32,9 +39,38 @@
|
||||
IPosition iposition = this.dispenseConfig.positionFunction().getDispensePosition(sourceblock, enumdirection);
|
||||
IProjectile iprojectile = this.projectileItem.asProjectile(worldserver, iposition, itemstack, enumdirection);
|
||||
|
||||
- iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty());
|
||||
- this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ // CraftBukkit start
|
||||
+ // iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty());
|
||||
+ // this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(worldserver, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ()));
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
|
@ -46,7 +46,7 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.getUncertainty());
|
||||
+ this.projectileItem.shoot(iprojectile, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty());
|
||||
+ ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(sourceblock.blockEntity());
|
||||
+ // CraftBukkit end
|
||||
worldserver.addFreshEntity(iprojectile);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
+++ b/net/minecraft/core/dispenser/DispenseBehaviorShears.java
|
||||
@@ -22,6 +22,13 @@
|
||||
@@ -23,6 +23,13 @@
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
public class DispenseBehaviorShears extends DispenseBehaviorMaybe {
|
||||
|
||||
public DispenseBehaviorShears() {}
|
||||
@@ -29,11 +36,34 @@
|
||||
@@ -30,11 +37,34 @@
|
||||
@Override
|
||||
protected ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
@ -47,10 +47,10 @@
|
|||
|
||||
- this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition));
|
||||
+ this.setSuccess(tryShearBeehive(worldserver, blockposition) || tryShearLivingEntity(worldserver, blockposition, bukkitBlock, craftItem)); // CraftBukkit
|
||||
if (this.isSuccess() && itemstack.hurt(1, worldserver.getRandom(), (EntityPlayer) null)) {
|
||||
itemstack.setCount(0);
|
||||
}
|
||||
@@ -62,7 +92,7 @@
|
||||
if (this.isSuccess()) {
|
||||
itemstack.hurtAndBreak(1, worldserver.getRandom(), (EntityPlayer) null, () -> {
|
||||
itemstack.setCount(0);
|
||||
@@ -65,7 +95,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -59,9 +59,9 @@
|
|||
List<EntityLiving> list = worldserver.getEntitiesOfClass(EntityLiving.class, new AxisAlignedBB(blockposition), IEntitySelector.NO_SPECTATORS);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
@@ -73,6 +103,11 @@
|
||||
IShearable ishearable = (IShearable) entityliving;
|
||||
@@ -74,6 +104,11 @@
|
||||
|
||||
if (entityliving instanceof IShearable ishearable) {
|
||||
if (ishearable.readyForShearing()) {
|
||||
+ // CraftBukkit start
|
||||
+ if (CraftEventFactory.callBlockShearEntityEvent(entityliving, bukkitBlock, craftItem).isCancelled()) {
|
||||
|
@ -69,5 +69,5 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
ishearable.shear(SoundCategory.BLOCKS);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.SHEAR, blockposition);
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.SHEAR, blockposition);
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
+++ b/net/minecraft/core/dispenser/IDispenseBehavior.java
|
||||
@@ -77,6 +77,22 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
@@ -66,6 +66,22 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -23,9 +23,9 @@
|
|||
public interface IDispenseBehavior {
|
||||
|
||||
Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -201,14 +217,42 @@
|
||||
@@ -93,14 +109,42 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack.getTag());
|
||||
EntityTypes<?> entitytypes = ((ItemMonsterEgg) itemstack.getItem()).getType(itemstack);
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = sourceblock.level();
|
||||
|
@ -65,10 +65,10 @@
|
|||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
sourceblock.level().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, sourceblock.pos());
|
||||
sourceblock.level().gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, sourceblock.pos());
|
||||
return itemstack;
|
||||
}
|
||||
@@ -227,13 +271,41 @@
|
||||
@@ -119,13 +163,41 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = sourceblock.pos().relative(enumdirection);
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
@ -103,7 +103,7 @@
|
|||
Consumer<EntityArmorStand> consumer = EntityTypes.appendDefaultStackConfig((entityarmorstand) -> {
|
||||
entityarmorstand.setYRot(enumdirection.toYRot());
|
||||
}, worldserver, itemstack, (EntityHuman) null);
|
||||
EntityArmorStand entityarmorstand = (EntityArmorStand) EntityTypes.ARMOR_STAND.spawn(worldserver, itemstack.getTag(), consumer, blockposition, EnumMobSpawn.DISPENSER, false, false);
|
||||
EntityArmorStand entityarmorstand = (EntityArmorStand) EntityTypes.ARMOR_STAND.spawn(worldserver, consumer, blockposition, EnumMobSpawn.DISPENSER, false, false);
|
||||
|
||||
if (entityarmorstand != null) {
|
||||
- itemstack.shrink(1);
|
||||
|
@ -111,13 +111,13 @@
|
|||
}
|
||||
|
||||
return itemstack;
|
||||
@@ -254,8 +326,35 @@
|
||||
@@ -144,8 +216,35 @@
|
||||
});
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ World world = sourceblock.level();
|
||||
+ WorldServer world = sourceblock.level();
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
|
@ -148,14 +148,14 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
} else {
|
||||
@@ -282,7 +381,35 @@
|
||||
@@ -172,7 +271,35 @@
|
||||
entityhorseabstract = (EntityHorseAbstract) iterator1.next();
|
||||
} while (!entityhorseabstract.isArmor(itemstack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed());
|
||||
} while (!entityhorseabstract.isBodyArmorItem(itemstack) || entityhorseabstract.isWearingBodyArmor() || !entityhorseabstract.isTamed());
|
||||
|
||||
- entityhorseabstract.getSlot(401).set(itemstack.split(1));
|
||||
- entityhorseabstract.setBodyArmorItem(itemstack.split(1));
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ World world = sourceblock.level();
|
||||
+ WorldServer world = sourceblock.level();
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
|
@ -180,12 +180,12 @@
|
|||
+ }
|
||||
+ }
|
||||
+
|
||||
+ entityhorseabstract.getSlot(401).set(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ entityhorseabstract.setBodyArmorItem(CraftItemStack.asNMSCopy(event.getItem()));
|
||||
+ // CraftBukkit end
|
||||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -325,9 +452,35 @@
|
||||
@@ -215,9 +342,35 @@
|
||||
}
|
||||
|
||||
entityhorsechestedabstract = (EntityHorseChestedAbstract) iterator1.next();
|
||||
|
@ -193,7 +193,7 @@
|
|||
+ // CraftBukkit start
|
||||
+ } while (!entityhorsechestedabstract.isTamed());
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ World world = sourceblock.level();
|
||||
+ WorldServer world = sourceblock.level();
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
|
||||
|
@ -223,96 +223,7 @@
|
|||
this.setSuccess(true);
|
||||
return itemstack;
|
||||
}
|
||||
@@ -336,12 +489,41 @@
|
||||
@Override
|
||||
public ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer worldserver = sourceblock.level();
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(worldserver, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(enumdirection.getStepX(), enumdirection.getStepY(), enumdirection.getStepZ()));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.grow(1);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.grow(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(sourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
|
||||
Vec3D vec3d = IDispenseBehavior.getEntityPokingOutOfBlockPos(sourceblock, EntityTypes.FIREWORK_ROCKET, enumdirection);
|
||||
EntityFireworks entityfireworks = new EntityFireworks(sourceblock.level(), itemstack, vec3d.x(), vec3d.y(), vec3d.z(), true);
|
||||
|
||||
entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F);
|
||||
sourceblock.level().addFreshEntity(entityfireworks);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -363,12 +545,40 @@
|
||||
double d3 = randomsource.triangle((double) enumdirection.getStepX(), 0.11485000000000001D);
|
||||
double d4 = randomsource.triangle((double) enumdirection.getStepY(), 0.11485000000000001D);
|
||||
double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D);
|
||||
- EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, d3, d4, d5);
|
||||
|
||||
- worldserver.addFreshEntity((Entity) SystemUtils.make(entitysmallfireball, (entitysmallfireball1) -> {
|
||||
- entitysmallfireball1.setItem(itemstack);
|
||||
- }));
|
||||
- itemstack.shrink(1);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack.split(1);
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(worldserver, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5));
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ worldserver.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ itemstack.grow(1);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ itemstack.grow(1);
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != this) {
|
||||
+ idispensebehavior.dispense(sourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(worldserver, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
|
||||
+ entitysmallfireball.setItem(itemstack1);
|
||||
+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(sourceblock.blockEntity());
|
||||
+
|
||||
+ worldserver.addFreshEntity(entitysmallfireball);
|
||||
+ // itemstack.shrink(1); // Handled during event processing
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@@ -404,9 +614,51 @@
|
||||
@@ -249,9 +402,51 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
||||
|
@ -365,17 +276,17 @@
|
|||
} else {
|
||||
return this.defaultDispenseItemBehavior.dispense(sourceblock, itemstack);
|
||||
}
|
||||
@@ -434,7 +686,7 @@
|
||||
@@ -278,7 +473,7 @@
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
if (block instanceof IFluidSource) {
|
||||
IFluidSource ifluidsource = (IFluidSource) block;
|
||||
if (block instanceof IFluidSource ifluidsource) {
|
||||
- ItemStack itemstack1 = ifluidsource.pickupBlock((EntityHuman) null, worldserver, blockposition, iblockdata);
|
||||
+ ItemStack itemstack1 = ifluidsource.pickupBlock((EntityHuman) null, DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); // CraftBukkit
|
||||
|
||||
if (itemstack1.isEmpty()) {
|
||||
return super.execute(sourceblock, itemstack);
|
||||
@@ -442,6 +694,32 @@
|
||||
worldserver.gameEvent((Entity) null, GameEvent.FLUID_PICKUP, blockposition);
|
||||
@@ -286,6 +481,32 @@
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.FLUID_PICKUP, blockposition);
|
||||
Item item = itemstack1.getItem();
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -407,7 +318,7 @@
|
|||
itemstack.shrink(1);
|
||||
if (itemstack.isEmpty()) {
|
||||
return new ItemStack(item);
|
||||
@@ -463,16 +741,44 @@
|
||||
@@ -307,16 +528,44 @@
|
||||
protected ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
|
||||
|
@ -442,11 +353,11 @@
|
|||
|
||||
if (BlockFireAbstract.canBePlacedAt(worldserver, blockposition, enumdirection)) {
|
||||
- worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
|
||||
- worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
- worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ // CraftBukkit start - Ignition by dispensing flint and steel
|
||||
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(worldserver, blockposition, sourceblock.pos()).isCancelled()) {
|
||||
+ worldserver.setBlockAndUpdate(blockposition, BlockFireAbstract.getState(worldserver, blockposition));
|
||||
+ worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
} else if (!BlockCampfire.canLight(iblockdata) && !CandleBlock.canLight(iblockdata) && !CandleCakeBlock.canLight(iblockdata)) {
|
||||
|
@ -455,7 +366,7 @@
|
|||
BlockTNT.explode(worldserver, blockposition);
|
||||
worldserver.removeBlock(blockposition, false);
|
||||
} else {
|
||||
@@ -496,12 +802,62 @@
|
||||
@@ -342,12 +591,62 @@
|
||||
this.setSuccess(true);
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
|
@ -488,7 +399,7 @@
|
|||
if (!ItemBoneMeal.growCrop(itemstack, worldserver, blockposition) && !ItemBoneMeal.growWaterPlant(itemstack, worldserver, blockposition, (EnumDirection) null)) {
|
||||
this.setSuccess(false);
|
||||
} else if (!worldserver.isClientSide) {
|
||||
worldserver.levelEvent(1505, blockposition, 0);
|
||||
worldserver.levelEvent(1505, blockposition, 15);
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ worldserver.captureTreeGeneration = false;
|
||||
|
@ -518,7 +429,7 @@
|
|||
|
||||
return itemstack;
|
||||
}
|
||||
@@ -511,12 +867,41 @@
|
||||
@@ -357,12 +656,41 @@
|
||||
protected ItemStack execute(SourceBlock sourceblock, ItemStack itemstack) {
|
||||
WorldServer worldserver = sourceblock.level();
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
|
@ -556,13 +467,13 @@
|
|||
|
||||
worldserver.addFreshEntity(entitytntprimed);
|
||||
worldserver.playSound((EntityHuman) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEffects.TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition);
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, blockposition);
|
||||
- itemstack.shrink(1);
|
||||
+ // itemstack.shrink(1); // CraftBukkit - handled above
|
||||
return itemstack;
|
||||
}
|
||||
});
|
||||
@@ -541,6 +926,30 @@
|
||||
@@ -387,6 +715,30 @@
|
||||
EnumDirection enumdirection = (EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING);
|
||||
BlockPosition blockposition = sourceblock.pos().relative(enumdirection);
|
||||
|
||||
|
@ -592,8 +503,8 @@
|
|||
+
|
||||
if (worldserver.isEmptyBlock(blockposition) && BlockWitherSkull.canSpawnMob(worldserver, blockposition, itemstack)) {
|
||||
worldserver.setBlock(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.defaultBlockState().setValue(BlockSkull.ROTATION, RotationSegment.convertToSegment(enumdirection)), 3);
|
||||
worldserver.gameEvent((Entity) null, GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -566,6 +975,30 @@
|
||||
worldserver.gameEvent((Entity) null, (Holder) GameEvent.BLOCK_PLACE, blockposition);
|
||||
@@ -412,6 +764,30 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN;
|
||||
|
||||
|
@ -624,7 +535,7 @@
|
|||
if (worldserver.isEmptyBlock(blockposition) && blockpumpkincarved.canSpawnGolem(worldserver, blockposition)) {
|
||||
if (!worldserver.isClientSide) {
|
||||
worldserver.setBlock(blockposition, blockpumpkincarved.defaultBlockState(), 3);
|
||||
@@ -615,6 +1048,30 @@
|
||||
@@ -461,6 +837,30 @@
|
||||
BlockPosition blockposition = sourceblock.pos().relative((EnumDirection) sourceblock.state().getValue(BlockDispenser.FACING));
|
||||
IBlockData iblockdata = worldserver.getBlockState(blockposition);
|
||||
|
||||
|
@ -655,3 +566,35 @@
|
|||
if (iblockdata.is(TagsBlock.BEEHIVES, (blockbase_blockdata) -> {
|
||||
return blockbase_blockdata.hasProperty(BlockBeehive.HONEY_LEVEL) && blockbase_blockdata.getBlock() instanceof BlockBeehive;
|
||||
}) && (Integer) iblockdata.getValue(BlockBeehive.HONEY_LEVEL) >= 5) {
|
||||
@@ -510,6 +910,31 @@
|
||||
this.setSuccess(false);
|
||||
return itemstack;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack itemstack1 = itemstack;
|
||||
+ WorldServer world = sourceblock.level();
|
||||
+ org.bukkit.block.Block block = CraftBlock.at(world, sourceblock.pos());
|
||||
+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
|
||||
+
|
||||
+ BlockDispenseEvent event = new BlockDispenseArmorEvent(block, craftItem.clone(), (org.bukkit.craftbukkit.entity.CraftLivingEntity) list.get(0).getBukkitEntity());
|
||||
+ if (!BlockDispenser.eventFired) {
|
||||
+ world.getCraftServer().getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+
|
||||
+ if (!event.getItem().equals(craftItem)) {
|
||||
+ // Chain to handler for new item
|
||||
+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem());
|
||||
+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.DISPENSER_REGISTRY.get(eventStack.getItem());
|
||||
+ if (idispensebehavior != IDispenseBehavior.NOOP && idispensebehavior != ItemArmor.DISPENSE_ITEM_BEHAVIOR) {
|
||||
+ idispensebehavior.dispense(sourceblock, eventStack);
|
||||
+ return itemstack;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
Iterator iterator1 = list.iterator();
|
||||
|
||||
Armadillo armadillo;
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
--- a/net/minecraft/nbt/NBTTagList.java
|
||||
+++ b/net/minecraft/nbt/NBTTagList.java
|
||||
@@ -145,7 +145,7 @@
|
||||
private final List<NBTBase> list;
|
||||
private byte type;
|
||||
|
||||
- NBTTagList(List<NBTBase> list, byte b0) {
|
||||
+ public NBTTagList(List<NBTBase> list, byte b0) { // PAIL: package-private -> public
|
||||
this.list = list;
|
||||
this.type = b0;
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/NetworkManager.java
|
||||
+++ b/net/minecraft/network/NetworkManager.java
|
||||
@@ -105,6 +105,7 @@
|
||||
@@ -114,6 +114,7 @@
|
||||
private volatile IChatBaseComponent delayedDisconnect;
|
||||
@Nullable
|
||||
BandwidthDebugMonitor bandwidthDebugMonitor;
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
public NetworkManager(EnumProtocolDirection enumprotocoldirection) {
|
||||
this.receiving = enumprotocoldirection;
|
||||
@@ -194,7 +195,7 @@
|
||||
@@ -197,7 +198,7 @@
|
||||
}
|
||||
|
||||
private static <T extends PacketListener> void genericsFtw(Packet<T> packet, PacketListener packetlistener) {
|
||||
|
@ -16,8 +16,8 @@
|
|||
+ packet.handle((T) packetlistener); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void suspendInboundAfterProtocolChange() {
|
||||
@@ -421,7 +422,7 @@
|
||||
private void validateListener(ProtocolInfo<?> protocolinfo, PacketListener packetlistener) {
|
||||
@@ -457,7 +458,7 @@
|
||||
}
|
||||
|
||||
if (this.isConnected()) {
|
||||
|
@ -26,3 +26,12 @@
|
|||
this.disconnectedReason = ichatbasecomponent;
|
||||
}
|
||||
|
||||
@@ -525,7 +526,7 @@
|
||||
}
|
||||
|
||||
public void configurePacketHandler(ChannelPipeline channelpipeline) {
|
||||
- channelpipeline.addLast("hackfix", new ChannelOutboundHandlerAdapter(this) {
|
||||
+ channelpipeline.addLast("hackfix", new ChannelOutboundHandlerAdapter() { // CraftBukkit - decompile error
|
||||
public void write(ChannelHandlerContext channelhandlercontext, Object object, ChannelPromise channelpromise) throws Exception {
|
||||
super.write(channelhandlercontext, object, channelpromise);
|
||||
}
|
||||
|
|
|
@ -1,33 +1,24 @@
|
|||
--- a/net/minecraft/network/PacketDataSerializer.java
|
||||
+++ b/net/minecraft/network/PacketDataSerializer.java
|
||||
@@ -81,6 +81,8 @@
|
||||
import org.joml.Quaternionf;
|
||||
import org.joml.Vector3f;
|
||||
@@ -139,7 +139,7 @@
|
||||
|
||||
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
|
||||
+
|
||||
public class PacketDataSerializer extends ByteBuf {
|
||||
|
||||
public static final int DEFAULT_NBT_QUOTA = 2097152;
|
||||
@@ -205,7 +207,7 @@
|
||||
|
||||
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, PacketDataSerializer.a<T> packetdataserializer_a) {
|
||||
public <T, C extends Collection<T>> C readCollection(IntFunction<C> intfunction, StreamDecoder<? super PacketDataSerializer, T> streamdecoder) {
|
||||
int i = this.readVarInt();
|
||||
- C c0 = (Collection) intfunction.apply(i);
|
||||
+ C c0 = intfunction.apply(i); // CraftBukkit - decompile error
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
c0.add(packetdataserializer_a.apply(this));
|
||||
@@ -216,7 +218,7 @@
|
||||
c0.add(streamdecoder.decode(this));
|
||||
@@ -150,7 +150,7 @@
|
||||
|
||||
public <T> void writeCollection(Collection<T> collection, PacketDataSerializer.b<T> packetdataserializer_b) {
|
||||
public <T> void writeCollection(Collection<T> collection, StreamEncoder<? super PacketDataSerializer, T> streamencoder) {
|
||||
this.writeVarInt(collection.size());
|
||||
- Iterator iterator = collection.iterator();
|
||||
+ Iterator<T> iterator = collection.iterator(); // CraftBukkit - decompile error
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -243,12 +245,12 @@
|
||||
@@ -177,12 +177,12 @@
|
||||
|
||||
public void writeIntIdList(IntList intlist) {
|
||||
this.writeVarInt(intlist.size());
|
||||
|
@ -35,14 +26,14 @@
|
|||
+ intlist.forEach((java.util.function.IntConsumer) this::writeVarInt); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> intfunction, PacketDataSerializer.a<K> packetdataserializer_a, PacketDataSerializer.a<V> packetdataserializer_a1) {
|
||||
public <K, V, M extends Map<K, V>> M readMap(IntFunction<M> intfunction, StreamDecoder<? super PacketDataSerializer, K> streamdecoder, StreamDecoder<? super PacketDataSerializer, V> streamdecoder1) {
|
||||
int i = this.readVarInt();
|
||||
- M m0 = (Map) intfunction.apply(i);
|
||||
+ M m0 = intfunction.apply(i); // CraftBukkit - decompile error
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
K k0 = packetdataserializer_a.apply(this);
|
||||
@@ -282,7 +284,7 @@
|
||||
K k0 = streamdecoder.decode(this);
|
||||
@@ -216,7 +216,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> void writeEnumSet(EnumSet<E> enumset, Class<E> oclass) {
|
||||
|
@ -51,7 +42,7 @@
|
|||
BitSet bitset = new BitSet(ae.length);
|
||||
|
||||
for (int i = 0; i < ae.length; ++i) {
|
||||
@@ -293,7 +295,7 @@
|
||||
@@ -227,7 +227,7 @@
|
||||
}
|
||||
|
||||
public <E extends Enum<E>> EnumSet<E> readEnumSet(Class<E> oclass) {
|
||||
|
@ -60,7 +51,7 @@
|
|||
BitSet bitset = this.readFixedBitSet(ae.length);
|
||||
EnumSet<E> enumset = EnumSet.noneOf(oclass);
|
||||
|
||||
@@ -529,7 +531,7 @@
|
||||
@@ -482,7 +482,7 @@
|
||||
}
|
||||
|
||||
public <T extends Enum<T>> T readEnum(Class<T> oclass) {
|
||||
|
@ -69,33 +60,12 @@
|
|||
}
|
||||
|
||||
public PacketDataSerializer writeEnum(Enum<?> oenum) {
|
||||
@@ -584,7 +586,7 @@
|
||||
@@ -549,7 +549,7 @@
|
||||
|
||||
try {
|
||||
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(this));
|
||||
return this;
|
||||
NBTCompressedStreamTools.writeAnyTag((NBTBase) nbtbase, new ByteBufOutputStream(bytebuf));
|
||||
- } catch (IOException ioexception) {
|
||||
+ } catch (Exception ioexception) { // CraftBukkit - IOException -> Exception
|
||||
throw new EncoderException(ioexception);
|
||||
}
|
||||
}
|
||||
@@ -612,7 +614,7 @@
|
||||
}
|
||||
|
||||
public PacketDataSerializer writeItem(ItemStack itemstack) {
|
||||
- if (itemstack.isEmpty()) {
|
||||
+ if (itemstack.isEmpty() || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
|
||||
this.writeBoolean(false);
|
||||
} else {
|
||||
this.writeBoolean(true);
|
||||
@@ -641,6 +643,11 @@
|
||||
ItemStack itemstack = new ItemStack(item, b0);
|
||||
|
||||
itemstack.setTag(this.readNbt());
|
||||
+ // CraftBukkit start
|
||||
+ if (itemstack.getTag() != null) {
|
||||
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
+++ b/net/minecraft/network/protocol/PlayerConnectionUtils.java
|
||||
@@ -9,6 +9,11 @@
|
||||
@@ -10,6 +10,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();
|
||||
@@ -22,6 +27,7 @@
|
||||
@@ -23,6 +28,7 @@
|
||||
public static <T extends PacketListener> void ensureRunningOnSameThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException {
|
||||
if (!iasynctaskhandler.isSameThread()) {
|
||||
iasynctaskhandler.executeIfPossible(() -> {
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
--- a/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java
|
||||
+++ b/net/minecraft/network/protocol/common/ServerboundCustomPayloadPacket.java
|
||||
@@ -12,7 +12,7 @@
|
||||
public record ServerboundCustomPayloadPacket(CustomPacketPayload payload) implements Packet<ServerCommonPacketListener> {
|
||||
|
||||
private static final int MAX_PAYLOAD_SIZE = 32767;
|
||||
- private static final Map<MinecraftKey, PacketDataSerializer.a<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.builder().put(BrandPayload.ID, BrandPayload::new).build();
|
||||
+ private static final Map<MinecraftKey, PacketDataSerializer.a<? extends CustomPacketPayload>> KNOWN_TYPES = ImmutableMap.<MinecraftKey, PacketDataSerializer.a<? extends CustomPacketPayload>>builder().build(); // CraftBukkit - no special handling
|
||||
|
||||
public ServerboundCustomPayloadPacket(PacketDataSerializer packetdataserializer) {
|
||||
this(readPayload(packetdataserializer.readResourceLocation(), packetdataserializer));
|
||||
@@ -24,12 +24,13 @@
|
||||
return (CustomPacketPayload) (packetdataserializer_a != null ? (CustomPacketPayload) packetdataserializer_a.apply(packetdataserializer) : readUnknownPayload(minecraftkey, packetdataserializer));
|
||||
}
|
||||
|
||||
- private static DiscardedPayload readUnknownPayload(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) {
|
||||
+ private static UnknownPayload readUnknownPayload(MinecraftKey minecraftkey, PacketDataSerializer packetdataserializer) { // CraftBukkit
|
||||
int i = packetdataserializer.readableBytes();
|
||||
|
||||
if (i >= 0 && i <= 32767) {
|
||||
- packetdataserializer.skipBytes(i);
|
||||
- return new DiscardedPayload(minecraftkey);
|
||||
+ // CraftBukkit start
|
||||
+ return new UnknownPayload(minecraftkey, packetdataserializer.readBytes(i));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
throw new IllegalArgumentException("Payload may not be larger than 32767 bytes");
|
||||
}
|
||||
@@ -44,4 +45,14 @@
|
||||
public void handle(ServerCommonPacketListener servercommonpacketlistener) {
|
||||
servercommonpacketlistener.handleCustomPayload(this);
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public record UnknownPayload(MinecraftKey id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload {
|
||||
+
|
||||
+ @Override
|
||||
+ public void write(PacketDataSerializer packetdataserializer) {
|
||||
+ packetdataserializer.writeBytes(data);
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
--- a/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
|
||||
+++ b/net/minecraft/network/protocol/common/custom/DiscardedPayload.java
|
||||
@@ -4,16 +4,18 @@
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.MinecraftKey;
|
||||
|
||||
-public record DiscardedPayload(MinecraftKey id) implements CustomPacketPayload {
|
||||
+public record DiscardedPayload(MinecraftKey id, io.netty.buffer.ByteBuf data) implements CustomPacketPayload { // CraftBukkit - store data
|
||||
|
||||
public static <T extends PacketDataSerializer> StreamCodec<T, DiscardedPayload> codec(MinecraftKey minecraftkey, int i) {
|
||||
return CustomPacketPayload.codec((discardedpayload, packetdataserializer) -> {
|
||||
+ packetdataserializer.writeBytes(discardedpayload.data); // CraftBukkit - serialize
|
||||
}, (packetdataserializer) -> {
|
||||
int j = packetdataserializer.readableBytes();
|
||||
|
||||
if (j >= 0 && j <= i) {
|
||||
- packetdataserializer.skipBytes(j);
|
||||
- return new DiscardedPayload(minecraftkey);
|
||||
+ // CraftBukkit start
|
||||
+ return new DiscardedPayload(minecraftkey, packetdataserializer.readBytes(j));
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
throw new IllegalArgumentException("Payload may not be larger than " + i + " bytes");
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundInitializeBorderPacket.java
|
||||
@@ -27,8 +27,10 @@
|
||||
@@ -30,8 +30,10 @@
|
||||
}
|
||||
|
||||
public ClientboundInitializeBorderPacket(WorldBorder worldborder) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
+++ b/net/minecraft/network/protocol/game/ClientboundSetBorderCenterPacket.java
|
||||
@@ -10,8 +10,10 @@
|
||||
@@ -13,8 +13,10 @@
|
||||
private final double newCenterZ;
|
||||
|
||||
public ClientboundSetBorderCenterPacket(WorldBorder worldborder) {
|
||||
|
@ -12,4 +12,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public ClientboundSetBorderCenterPacket(PacketDataSerializer packetdataserializer) {
|
||||
private ClientboundSetBorderCenterPacket(PacketDataSerializer packetdataserializer) {
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.game;
|
||||
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
+++ b/net/minecraft/network/protocol/game/PacketPlayOutMultiBlockChange.java
|
||||
@@ -30,11 +30,19 @@
|
||||
@@ -33,11 +33,19 @@
|
||||
short short0 = (Short) shortiterator.next();
|
||||
|
||||
this.positions[j] = short0;
|
||||
|
@ -18,6 +18,6 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public PacketPlayOutMultiBlockChange(PacketDataSerializer packetdataserializer) {
|
||||
private PacketPlayOutMultiBlockChange(PacketDataSerializer packetdataserializer) {
|
||||
this.sectionPos = SectionPosition.of(packetdataserializer.readLong());
|
||||
int i = packetdataserializer.readVarInt();
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
+// mc-dev import
|
||||
package net.minecraft.network.protocol.handshake;
|
||||
|
||||
import net.minecraft.network.EnumProtocol;
|
||||
import net.minecraft.network.PacketDataSerializer;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/network/syncher/DataWatcher.java
|
||||
+++ b/net/minecraft/network/syncher/DataWatcher.java
|
||||
@@ -24,6 +24,11 @@
|
||||
@@ -14,6 +14,11 @@
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -12,7 +12,16 @@
|
|||
public class DataWatcher {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -146,6 +151,13 @@
|
||||
@@ -51,7 +56,7 @@
|
||||
}
|
||||
|
||||
private <T> DataWatcher.Item<T> getItem(DataWatcherObject<T> datawatcherobject) {
|
||||
- return this.itemsById[datawatcherobject.id()];
|
||||
+ return (DataWatcher.Item<T>) this.itemsById[datawatcherobject.id()]; // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public <T> T get(DataWatcherObject<T> datawatcherobject) {
|
||||
@@ -74,6 +79,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -26,40 +35,12 @@
|
|||
public boolean isDirty() {
|
||||
return this.isDirty;
|
||||
}
|
||||
@@ -227,7 +239,7 @@
|
||||
if (!Objects.equals(datawatcher_b.serializer(), datawatcher_item.accessor.getSerializer())) {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.getId(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_b.value, datawatcher_b.value.getClass()));
|
||||
@@ -140,7 +152,7 @@
|
||||
if (!Objects.equals(datawatcher_c.serializer(), datawatcher_item.accessor.serializer())) {
|
||||
throw new IllegalStateException(String.format(Locale.ROOT, "Invalid entity data item type for field %d on entity %s: old=%s(%s), new=%s(%s)", datawatcher_item.accessor.id(), this.entity, datawatcher_item.value, datawatcher_item.value.getClass(), datawatcher_c.value, datawatcher_c.value.getClass()));
|
||||
} else {
|
||||
- datawatcher_item.setValue(datawatcher_b.value);
|
||||
+ datawatcher_item.setValue((T) datawatcher_b.value); // CraftBukkit - decompile error
|
||||
- datawatcher_item.setValue(datawatcher_c.value);
|
||||
+ datawatcher_item.setValue((T) datawatcher_c.value); // CraftBukkit - decompile error
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +247,18 @@
|
||||
return this.itemsById.isEmpty();
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void refresh(EntityPlayer to) {
|
||||
+ if (!this.isEmpty()) {
|
||||
+ List<DataWatcher.b<?>> list = this.getNonDefaultValues();
|
||||
+
|
||||
+ if (list != null) {
|
||||
+ to.connection.send(new PacketPlayOutEntityMetadata(this.entity.getId(), list));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public static class Item<T> {
|
||||
|
||||
final DataWatcherObject<T> accessor;
|
||||
@@ -277,7 +301,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- public static record b<T> (int id, DataWatcherSerializer<T> serializer, T value) {
|
||||
+ public static record b<T>(int id, DataWatcherSerializer<T> serializer, T value) { // CraftBukkit - decompile error
|
||||
|
||||
public static <T> DataWatcher.b<T> create(DataWatcherObject<T> datawatcherobject, T t0) {
|
||||
DataWatcherSerializer<T> datawatcherserializer = datawatcherobject.getSerializer();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/DispenserRegistry.java
|
||||
+++ b/net/minecraft/server/DispenserRegistry.java
|
||||
@@ -30,6 +30,12 @@
|
||||
@@ -29,6 +29,12 @@
|
||||
import net.minecraft.world.level.block.BlockFire;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class DispenserRegistry {
|
||||
|
||||
public static final PrintStream STDOUT = System.out;
|
||||
@@ -41,6 +47,23 @@
|
||||
@@ -40,6 +46,23 @@
|
||||
|
||||
public static void bootStrap() {
|
||||
if (!DispenserRegistry.isBootstrapped) {
|
||||
|
@ -37,7 +37,7 @@
|
|||
DispenserRegistry.isBootstrapped = true;
|
||||
Instant instant = Instant.now();
|
||||
|
||||
@@ -61,6 +84,69 @@
|
||||
@@ -59,6 +82,69 @@
|
||||
wrapStreams();
|
||||
DispenserRegistry.bootstrapDuration.set(Duration.between(instant, Instant.now()).toMillis());
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@
|
|||
OptionParser optionparser = new OptionParser();
|
||||
OptionSpec<Void> optionspec = optionparser.accepts("nogui");
|
||||
OptionSpec<Void> optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits");
|
||||
@@ -93,15 +105,18 @@
|
||||
@@ -94,15 +106,18 @@
|
||||
optionparser.printHelpOn(System.err);
|
||||
return;
|
||||
}
|
||||
+ */ // CraftBukkit end
|
||||
|
||||
- Path path = (Path) optionset.valueOf(optionspec13);
|
||||
- Path path = (Path) optionset.valueOf(optionspec14);
|
||||
+ try {
|
||||
+
|
||||
+ Path path = (Path) optionset.valueOf("pidFile"); // CraftBukkit
|
||||
|
@ -45,12 +45,12 @@
|
|||
}
|
||||
|
||||
CrashReport.preload();
|
||||
- if (optionset.has(optionspec12)) {
|
||||
- if (optionset.has(optionspec13)) {
|
||||
+ if (optionset.has("jfrProfile")) { // CraftBukkit
|
||||
JvmProfiler.INSTANCE.start(Environment.SERVER);
|
||||
}
|
||||
|
||||
@@ -109,13 +124,26 @@
|
||||
@@ -110,14 +125,27 @@
|
||||
DispenserRegistry.validate();
|
||||
SystemUtils.startTimerHackThread();
|
||||
Path path1 = Paths.get("server.properties");
|
||||
|
@ -58,6 +58,7 @@
|
|||
+ DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(optionset); // CraftBukkit - CLI argument support
|
||||
|
||||
dedicatedserversettings.forceSave();
|
||||
RegionFileCompression.configure(dedicatedserversettings.getProperties().regionFileComression);
|
||||
Path path2 = Paths.get("eula.txt");
|
||||
EULA eula = new EULA(path2);
|
||||
|
||||
|
@ -79,14 +80,14 @@
|
|||
Main.LOGGER.info("Initialized '{}' and '{}'", path1.toAbsolutePath(), path2.toAbsolutePath());
|
||||
return;
|
||||
}
|
||||
@@ -125,11 +153,13 @@
|
||||
@@ -127,11 +155,13 @@
|
||||
return;
|
||||
}
|
||||
|
||||
- File file = new File((String) optionset.valueOf(optionspec8));
|
||||
- File file = new File((String) optionset.valueOf(optionspec9));
|
||||
+ File file = (File) optionset.valueOf("universe"); // CraftBukkit
|
||||
Services services = Services.create(new YggdrasilAuthenticationService(Proxy.NO_PROXY), file);
|
||||
- String s = (String) Optional.ofNullable((String) optionset.valueOf(optionspec9)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
- String s = (String) Optional.ofNullable((String) optionset.valueOf(optionspec10)).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
+ // CraftBukkit start
|
||||
+ String s = (String) Optional.ofNullable((String) optionset.valueOf("world")).orElse(dedicatedserversettings.getProperties().levelName);
|
||||
Convertable convertable = Convertable.createDefault(file.toPath());
|
||||
|
@ -96,11 +97,11 @@
|
|||
Dynamic dynamic;
|
||||
|
||||
if (convertable_conversionsession.hasWorldData()) {
|
||||
@@ -170,13 +200,31 @@
|
||||
@@ -172,13 +202,31 @@
|
||||
}
|
||||
|
||||
Dynamic<?> dynamic1 = dynamic;
|
||||
- boolean flag = optionset.has(optionspec6);
|
||||
- boolean flag = optionset.has(optionspec7);
|
||||
+ boolean flag = optionset.has("safeMode"); // CraftBukkit
|
||||
|
||||
if (flag) {
|
||||
|
@ -129,7 +130,7 @@
|
|||
|
||||
WorldStem worldstem;
|
||||
|
||||
@@ -185,6 +233,7 @@
|
||||
@@ -187,6 +235,7 @@
|
||||
|
||||
worldstem = (WorldStem) SystemUtils.blockUntilDone((executor) -> {
|
||||
return WorldLoader.load(worldloader_c, (worldloader_a) -> {
|
||||
|
@ -137,7 +138,7 @@
|
|||
IRegistry<WorldDimension> iregistry = worldloader_a.datapackDimensions().registryOrThrow(Registries.LEVEL_STEM);
|
||||
|
||||
if (dynamic1 != null) {
|
||||
@@ -197,7 +246,7 @@
|
||||
@@ -199,7 +248,7 @@
|
||||
WorldOptions worldoptions;
|
||||
WorldDimensions worlddimensions;
|
||||
|
||||
|
@ -146,7 +147,7 @@
|
|||
worldsettings = MinecraftServer.DEMO_SETTINGS;
|
||||
worldoptions = WorldOptions.DEMO_OPTIONS;
|
||||
worlddimensions = WorldPresets.createNormalWorldDimensions(worldloader_a.datapackWorldgen());
|
||||
@@ -205,7 +254,7 @@
|
||||
@@ -207,7 +256,7 @@
|
||||
DedicatedServerProperties dedicatedserverproperties = dedicatedserversettings.getProperties();
|
||||
|
||||
worldsettings = new WorldSettings(dedicatedserverproperties.levelName, dedicatedserverproperties.gamemode, dedicatedserverproperties.hardcore, dedicatedserverproperties.difficulty, false, new GameRules(), worldloader_a.dataConfiguration());
|
||||
|
@ -155,32 +156,32 @@
|
|||
worlddimensions = dedicatedserverproperties.createDimensions(worldloader_a.datapackWorldgen());
|
||||
}
|
||||
|
||||
@@ -221,6 +270,7 @@
|
||||
@@ -223,6 +272,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
+ /*
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = worldstem.registries().compositeAccess();
|
||||
boolean flag1 = optionset.has(optionspec6);
|
||||
|
||||
if (optionset.has(optionspec4)) {
|
||||
@@ -232,20 +282,31 @@
|
||||
@@ -235,20 +285,31 @@
|
||||
SaveData savedata = worldstem.worldData();
|
||||
|
||||
convertable_conversionsession.saveDataTag(iregistrycustom_dimension, savedata);
|
||||
+ */
|
||||
final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.spin((thread) -> {
|
||||
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::new);
|
||||
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::new);
|
||||
- DedicatedServer dedicatedserver1 = new DedicatedServer(thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::createFromGameruleRadius);
|
||||
+ DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, worldLoader.get(), thread, convertable_conversionsession, resourcepackrepository, worldstem, dedicatedserversettings, DataConverterRegistry.getDataFixer(), services, WorldLoadListenerLogger::createFromGameruleRadius);
|
||||
|
||||
+ /*
|
||||
dedicatedserver1.setPort((Integer) optionset.valueOf(optionspec10));
|
||||
dedicatedserver1.setPort((Integer) optionset.valueOf(optionspec11));
|
||||
dedicatedserver1.setDemo(optionset.has(optionspec2));
|
||||
dedicatedserver1.setId((String) optionset.valueOf(optionspec11));
|
||||
- boolean flag1 = !optionset.has(optionspec) && !optionset.valuesOf(nonoptionargumentspec).contains("nogui");
|
||||
dedicatedserver1.setId((String) optionset.valueOf(optionspec12));
|
||||
- boolean flag2 = !optionset.has(optionspec) && !optionset.valuesOf(optionspec15).contains("nogui");
|
||||
+ */
|
||||
+ boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
|
||||
+ boolean flag2 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui");
|
||||
|
||||
if (flag1 && !GraphicsEnvironment.isHeadless()) {
|
||||
if (flag2 && !GraphicsEnvironment.isHeadless()) {
|
||||
dedicatedserver1.showGui();
|
||||
}
|
||||
|
||||
|
@ -197,7 +198,7 @@
|
|||
Thread thread = new Thread("Server Shutdown Thread") {
|
||||
public void run() {
|
||||
dedicatedserver.halt(true);
|
||||
@@ -254,6 +315,7 @@
|
||||
@@ -257,6 +318,7 @@
|
||||
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(Main.LOGGER));
|
||||
Runtime.getRuntime().addShutdownHook(thread);
|
||||
|
@ -205,12 +206,12 @@
|
|||
} catch (Exception exception1) {
|
||||
Main.LOGGER.error(LogUtils.FATAL_MARKER, "Failed to start the minecraft server", exception1);
|
||||
}
|
||||
@@ -290,7 +352,7 @@
|
||||
@@ -293,7 +355,7 @@
|
||||
}
|
||||
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistry<WorldDimension> iregistry) {
|
||||
public static void forceUpgrade(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, IRegistryCustom iregistrycustom, boolean flag1) {
|
||||
- Main.LOGGER.info("Forcing world upgrade!");
|
||||
+ Main.LOGGER.info("Forcing world upgrade! {}", convertable_conversionsession.getLevelId()); // CraftBukkit
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, iregistry, flag);
|
||||
WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, iregistrycustom, flag, flag1);
|
||||
IChatBaseComponent ichatbasecomponent = null;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/net/minecraft/server/MinecraftServer.java
|
||||
@@ -165,13 +165,36 @@
|
||||
@@ -168,13 +168,37 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
|||
+import net.minecraft.world.level.storage.WorldInfo;
|
||||
+import net.minecraft.world.level.validation.ContentValidationException;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.craftbukkit.CraftRegistry;
|
||||
+import org.bukkit.craftbukkit.CraftServer;
|
||||
+import org.bukkit.craftbukkit.Main;
|
||||
+import org.bukkit.event.server.ServerLoadEvent;
|
||||
|
@ -38,8 +39,8 @@
|
|||
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;
|
||||
@@ -260,6 +284,19 @@
|
||||
private final PotionBrewer potionBrewing;
|
||||
private volatile boolean isSaving;
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -58,7 +59,7 @@
|
|||
public static <S extends MinecraftServer> S spin(Function<Thread, S> function) {
|
||||
AtomicReference<S> atomicreference = new AtomicReference();
|
||||
Thread thread = new Thread(() -> {
|
||||
@@ -267,14 +303,14 @@
|
||||
@@ -273,14 +310,14 @@
|
||||
thread.setPriority(8);
|
||||
}
|
||||
|
||||
|
@ -75,7 +76,7 @@
|
|||
super("Server");
|
||||
this.metricsRecorder = InactiveMetricsRecorder.INSTANCE;
|
||||
this.profiler = this.metricsRecorder.getProfiler();
|
||||
@@ -295,7 +331,7 @@
|
||||
@@ -303,7 +340,7 @@
|
||||
this.customBossEvents = new BossBattleCustomData();
|
||||
this.registries = worldstem.registries();
|
||||
this.worldData = worldstem.worldData();
|
||||
|
@ -84,9 +85,9 @@
|
|||
throw new IllegalStateException("Missing Overworld dimension data");
|
||||
} else {
|
||||
this.proxy = proxy;
|
||||
@@ -319,6 +355,33 @@
|
||||
this.serverThread = thread;
|
||||
@@ -328,6 +365,33 @@
|
||||
this.executor = SystemUtils.backgroundExecutor();
|
||||
this.potionBrewing = PotionBrewer.bootstrap(this.worldData.enabledFeatures());
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ this.options = options;
|
||||
|
@ -118,7 +119,7 @@
|
|||
}
|
||||
|
||||
private void readScoreboard(WorldPersistentData worldpersistentdata) {
|
||||
@@ -327,7 +390,7 @@
|
||||
@@ -336,7 +400,7 @@
|
||||
|
||||
protected abstract boolean initServer() throws IOException;
|
||||
|
||||
|
@ -127,12 +128,12 @@
|
|||
if (!JvmProfiler.INSTANCE.isRunning()) {
|
||||
;
|
||||
}
|
||||
@@ -335,12 +398,8 @@
|
||||
@@ -344,12 +408,8 @@
|
||||
boolean flag = false;
|
||||
ProfiledDuration profiledduration = JvmProfiler.INSTANCE.onWorldLoadedStarted();
|
||||
|
||||
- this.worldData.setModdedInfo(this.getServerModName(), this.getModdedStatus().shouldReportAsModified());
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
- WorldLoadListener worldloadlistener = this.progressListenerFactory.create(this.worldData.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS));
|
||||
+ loadWorld0(s); // CraftBukkit
|
||||
|
||||
- this.createLevels(worldloadlistener);
|
||||
|
@ -141,7 +142,7 @@
|
|||
if (profiledduration != null) {
|
||||
profiledduration.finish();
|
||||
}
|
||||
@@ -357,23 +416,216 @@
|
||||
@@ -366,23 +426,217 @@
|
||||
|
||||
protected void forceDifficulty() {}
|
||||
|
||||
|
@ -161,7 +162,8 @@
|
|||
|
||||
- this.levels.put(World.OVERWORLD, worldserver);
|
||||
- WorldPersistentData worldpersistentdata = worldserver.getDataStorage();
|
||||
+ IRegistry<WorldDimension> dimensions = this.registries.compositeAccess().registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.compositeAccess();
|
||||
+ IRegistry<WorldDimension> dimensions = iregistrycustom_dimension.registryOrThrow(Registries.LEVEL_STEM);
|
||||
+ for (WorldDimension worldDimension : dimensions) {
|
||||
+ ResourceKey<WorldDimension> dimensionKey = dimensions.getResourceKey(worldDimension).get();
|
||||
|
||||
|
@ -304,7 +306,7 @@
|
|||
+ if (options.has("forceUpgrade")) {
|
||||
+ net.minecraft.server.Main.forceUpgrade(worldSession, DataConverterRegistry.getDataFixer(), options.has("eraseCache"), () -> {
|
||||
+ return true;
|
||||
+ }, dimensions);
|
||||
+ }, iregistrycustom_dimension, options.has("recreateRegionFiles"));
|
||||
+ }
|
||||
+
|
||||
+ WorldDataServer iworlddataserver = worlddata;
|
||||
|
@ -326,7 +328,7 @@
|
|||
+ this.worldData = worlddata;
|
||||
+ this.worldData.setGameType(((DedicatedServer) this).getProperties().gamemode); // From DedicatedServer.init
|
||||
+
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(this.worldData.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS));
|
||||
+
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, list, true, (RandomSequences) null, org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ WorldPersistentData worldpersistentdata = world.getDataStorage();
|
||||
|
@ -334,7 +336,7 @@
|
|||
+ this.server.scoreboardManager = new org.bukkit.craftbukkit.scoreboard.CraftScoreboardManager(this, world.getScoreboard());
|
||||
+ this.commandStorage = new PersistentCommandStorage(worldpersistentdata);
|
||||
+ } else {
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(11);
|
||||
+ WorldLoadListener worldloadlistener = this.progressListenerFactory.create(worldData.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS));
|
||||
+ world = new WorldServer(this, this.executor, worldSession, iworlddataserver, worldKey, worlddimension, worldloadlistener, flag, j, ImmutableList.of(), true, this.overworld().getRandomSequences(), org.bukkit.World.Environment.getEnvironment(dimension), gen, biomeProvider);
|
||||
+ }
|
||||
+
|
||||
|
@ -345,7 +347,7 @@
|
|||
+ this.getPlayerList().addWorldborderListener(world);
|
||||
+
|
||||
+ if (worlddata.getCustomBossEvents() != null) {
|
||||
+ this.getCustomBossEvents().load(worlddata.getCustomBossEvents());
|
||||
+ this.getCustomBossEvents().load(worlddata.getCustomBossEvents(), this.registryAccess());
|
||||
+ }
|
||||
+ }
|
||||
+ this.forceDifficulty();
|
||||
|
@ -372,13 +374,13 @@
|
|||
|
||||
if (!iworlddataserver.isInitialized()) {
|
||||
try {
|
||||
@@ -397,30 +649,8 @@
|
||||
@@ -406,30 +660,8 @@
|
||||
iworlddataserver.setInitialized(true);
|
||||
}
|
||||
|
||||
- this.getPlayerList().addWorldborderListener(worldserver);
|
||||
- if (this.worldData.getCustomBossEvents() != null) {
|
||||
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents());
|
||||
- this.getCustomBossEvents().load(this.worldData.getCustomBossEvents(), this.registryAccess());
|
||||
- }
|
||||
-
|
||||
- RandomSequences randomsequences = worldserver.getRandomSequences();
|
||||
|
@ -404,7 +406,7 @@
|
|||
|
||||
private static void setInitialSpawn(WorldServer worldserver, IWorldDataServer iworlddataserver, boolean flag, boolean flag1) {
|
||||
if (flag1) {
|
||||
@@ -428,6 +658,21 @@
|
||||
@@ -437,6 +669,21 @@
|
||||
} else {
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkproviderserver.randomState().sampler().findSpawnPosition());
|
||||
|
@ -426,7 +428,7 @@
|
|||
int i = chunkproviderserver.getGenerator().getSpawnHeight(worldserver);
|
||||
|
||||
if (i < worldserver.getMinBuildHeight()) {
|
||||
@@ -487,8 +732,11 @@
|
||||
@@ -495,8 +742,11 @@
|
||||
iworlddataserver.setGameType(EnumGamemode.SPECTATOR);
|
||||
}
|
||||
|
||||
|
@ -440,22 +442,20 @@
|
|||
|
||||
MinecraftServer.LOGGER.info("Preparing start region for dimension {}", worldserver.dimension().location());
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
@@ -497,19 +745,23 @@
|
||||
ChunkProviderServer chunkproviderserver = worldserver.getChunkSource();
|
||||
@@ -506,20 +756,22 @@
|
||||
|
||||
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);
|
||||
worldserver.setDefaultSpawnPos(blockposition, worldserver.getSharedSpawnAngle());
|
||||
- int i = this.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS);
|
||||
+ int i = worldserver.getGameRules().getInt(GameRules.RULE_SPAWN_CHUNK_RADIUS); // CraftBukkit - per-world
|
||||
int j = i > 0 ? MathHelper.square(WorldLoadListener.calculateDiameter(i)) : 0;
|
||||
|
||||
- while (chunkproviderserver.getTickingGenerated() != 441) {
|
||||
while (chunkproviderserver.getTickingGenerated() < j) {
|
||||
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
- this.waitUntilNextTick();
|
||||
+ while (chunkproviderserver.getTickingGenerated() != 441) {
|
||||
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
+ this.executeModerately();
|
||||
+ }
|
||||
+ // CraftBukkit start
|
||||
+ // this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
+ this.executeModerately();
|
||||
}
|
||||
|
||||
- this.nextTickTimeNanos = SystemUtils.getNanos() + MinecraftServer.PREPARE_LEVELS_DEFAULT_DELAY_NANOS;
|
||||
|
@ -473,7 +473,7 @@
|
|||
ForcedChunk forcedchunk = (ForcedChunk) worldserver1.getDataStorage().get(ForcedChunk.factory(), "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
@@ -524,10 +776,17 @@
|
||||
@@ -534,10 +786,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@
|
|||
}
|
||||
|
||||
public EnumGamemode getDefaultGameType() {
|
||||
@@ -557,12 +816,16 @@
|
||||
@@ -567,12 +826,16 @@
|
||||
worldserver.save((IProgressUpdate) null, flag1, worldserver.noSave && !flag2);
|
||||
}
|
||||
|
||||
|
@ -504,14 +504,14 @@
|
|||
IWorldDataServer iworlddataserver = this.worldData.overworldData();
|
||||
|
||||
iworlddataserver.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save());
|
||||
this.worldData.setCustomBossEvents(this.getCustomBossEvents().save(this.registryAccess()));
|
||||
this.storageSource.saveDataTag(this.registryAccess(), this.worldData, this.getPlayerList().getSingleplayerData());
|
||||
+ */
|
||||
+ // CraftBukkit end
|
||||
if (flag1) {
|
||||
Iterator iterator1 = this.getAllLevels().iterator();
|
||||
|
||||
@@ -597,18 +860,40 @@
|
||||
@@ -607,18 +870,40 @@
|
||||
this.stopServer();
|
||||
}
|
||||
|
||||
|
@ -552,7 +552,7 @@
|
|||
}
|
||||
|
||||
MinecraftServer.LOGGER.info("Saving worlds");
|
||||
@@ -696,7 +981,7 @@
|
||||
@@ -706,7 +991,7 @@
|
||||
}
|
||||
|
||||
this.nextTickTimeNanos = SystemUtils.getNanos();
|
||||
|
@ -561,7 +561,7 @@
|
|||
this.status = this.buildServerStatus();
|
||||
|
||||
while (this.running) {
|
||||
@@ -713,6 +998,7 @@
|
||||
@@ -723,6 +1008,7 @@
|
||||
if (j > MinecraftServer.OVERLOADED_THRESHOLD_NANOS + 20L * i && this.nextTickTimeNanos - this.lastOverloadWarningNanos >= MinecraftServer.OVERLOADED_WARNING_INTERVAL_NANOS + 100L * i) {
|
||||
long k = j / i;
|
||||
|
||||
|
@ -569,7 +569,7 @@
|
|||
MinecraftServer.LOGGER.warn("Can't keep up! Is the server overloaded? Running {}ms or {} ticks behind", j / TimeRange.NANOSECONDS_PER_MILLISECOND, k);
|
||||
this.nextTickTimeNanos += k * i;
|
||||
this.lastOverloadWarningNanos = this.nextTickTimeNanos;
|
||||
@@ -726,6 +1012,7 @@
|
||||
@@ -736,6 +1022,7 @@
|
||||
this.debugCommandProfiler = new MinecraftServer.TimeProfiler(SystemUtils.getNanos(), this.tickCount);
|
||||
}
|
||||
|
||||
|
@ -577,7 +577,7 @@
|
|||
this.nextTickTimeNanos += i;
|
||||
this.startMetricsRecordingTick();
|
||||
this.profiler.push("tick");
|
||||
@@ -770,6 +1057,12 @@
|
||||
@@ -783,6 +1070,12 @@
|
||||
this.services.profileCache().clearExecutor();
|
||||
}
|
||||
|
||||
|
@ -590,7 +590,7 @@
|
|||
this.onServerExit();
|
||||
}
|
||||
|
||||
@@ -803,7 +1096,14 @@
|
||||
@@ -842,7 +1135,14 @@
|
||||
}
|
||||
|
||||
private boolean haveTime() {
|
||||
|
@ -606,7 +606,7 @@
|
|||
}
|
||||
|
||||
protected void waitUntilNextTick() {
|
||||
@@ -850,7 +1150,7 @@
|
||||
@@ -901,7 +1201,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@
|
|||
this.getProfiler().incrementCounter("runTask");
|
||||
super.doRunTask(ticktask);
|
||||
}
|
||||
@@ -909,8 +1209,10 @@
|
||||
@@ -960,8 +1260,10 @@
|
||||
}
|
||||
|
||||
--this.ticksUntilAutosave;
|
||||
|
@ -628,7 +628,7 @@
|
|||
MinecraftServer.LOGGER.debug("Autosave started");
|
||||
this.profiler.push("save");
|
||||
this.saveEverything(true, false, false);
|
||||
@@ -991,22 +1293,39 @@
|
||||
@@ -1049,11 +1351,26 @@
|
||||
this.getPlayerList().getPlayers().forEach((entityplayer) -> {
|
||||
entityplayer.connection.suspendFlushing();
|
||||
});
|
||||
|
@ -655,8 +655,9 @@
|
|||
while (iterator.hasNext()) {
|
||||
WorldServer worldserver = (WorldServer) iterator.next();
|
||||
|
||||
this.profiler.push(() -> {
|
||||
return worldserver + " " + worldserver.dimension().location();
|
||||
@@ -1062,11 +1379,13 @@
|
||||
|
||||
return s + " " + String.valueOf(worldserver.dimension().location());
|
||||
});
|
||||
+ /* Drop global time updates
|
||||
if (this.tickCount % 20 == 0) {
|
||||
|
@ -668,7 +669,7 @@
|
|||
|
||||
this.profiler.push("tick");
|
||||
|
||||
@@ -1096,6 +1415,22 @@
|
||||
@@ -1156,6 +1475,22 @@
|
||||
return (WorldServer) this.levels.get(resourcekey);
|
||||
}
|
||||
|
||||
|
@ -691,7 +692,7 @@
|
|||
public Set<ResourceKey<World>> levelKeys() {
|
||||
return this.levels.keySet();
|
||||
}
|
||||
@@ -1125,7 +1460,7 @@
|
||||
@@ -1185,7 +1520,7 @@
|
||||
|
||||
@DontObfuscate
|
||||
public String getServerModName() {
|
||||
|
@ -700,9 +701,9 @@
|
|||
}
|
||||
|
||||
public SystemReport fillSystemReport(SystemReport systemreport) {
|
||||
@@ -1466,11 +1801,11 @@
|
||||
@@ -1527,11 +1862,11 @@
|
||||
|
||||
public CompletableFuture<Void> reloadResources(Collection<String> collection) {
|
||||
IRegistryCustom.Dimension iregistrycustom_dimension = this.registries.getAccessForLoading(RegistryLayer.RELOADABLE);
|
||||
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
|
||||
- Stream stream = collection.stream();
|
||||
+ Stream<String> stream = collection.stream(); // CraftBukkit - decompile error
|
||||
|
@ -714,15 +715,24 @@
|
|||
}, this).thenCompose((immutablelist) -> {
|
||||
ResourceManager resourcemanager = new ResourceManager(EnumResourcePackType.SERVER_DATA, immutablelist);
|
||||
|
||||
@@ -1485,6 +1820,7 @@
|
||||
@@ -1546,6 +1881,7 @@
|
||||
}).thenAcceptAsync((minecraftserver_reloadableresources) -> {
|
||||
this.resources.close();
|
||||
this.resources = minecraftserver_reloadableresources;
|
||||
+ this.server.syncCommands(); // SPIGOT-5884: Lost on reload
|
||||
this.packRepository.setSelected(collection);
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository), this.worldData.enabledFeatures());
|
||||
WorldDataConfiguration worlddataconfiguration = new WorldDataConfiguration(getSelectedPacks(this.packRepository, true), this.worldData.enabledFeatures());
|
||||
|
||||
@@ -1853,7 +2189,7 @@
|
||||
@@ -1846,7 +2182,7 @@
|
||||
final List<String> list = Lists.newArrayList();
|
||||
final GameRules gamerules = this.getGameRules();
|
||||
|
||||
- GameRules.visitGameRuleTypes(new GameRules.GameRuleVisitor(this) {
|
||||
+ GameRules.visitGameRuleTypes(new GameRules.GameRuleVisitor() { // CraftBukkit - decompile error
|
||||
@Override
|
||||
public <T extends GameRules.GameRuleValue<T>> void visit(GameRules.GameRuleKey<T> gamerules_gamerulekey, GameRules.GameRuleDefinition<T> gamerules_gameruledefinition) {
|
||||
list.add(String.format(Locale.ROOT, "%s=%s\n", gamerules_gamerulekey.getId(), gamerules.getRule(gamerules_gamerulekey)));
|
||||
@@ -1952,7 +2288,7 @@
|
||||
try {
|
||||
label51:
|
||||
{
|
||||
|
@ -731,7 +741,7 @@
|
|||
|
||||
try {
|
||||
arraylist = Lists.newArrayList(NativeModuleLister.listModules());
|
||||
@@ -1903,6 +2239,17 @@
|
||||
@@ -2002,6 +2338,22 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -744,12 +754,17 @@
|
|||
+ public static MinecraftServer getServer() {
|
||||
+ return (Bukkit.getServer() instanceof CraftServer) ? ((CraftServer) Bukkit.getServer()).getServer() : null;
|
||||
+ }
|
||||
+
|
||||
+ @Deprecated
|
||||
+ public static IRegistryCustom getDefaultRegistryAccess() {
|
||||
+ return CraftRegistry.getMinecraftRegistry();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
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) -> {
|
||||
@@ -2029,6 +2376,11 @@
|
||||
@@ -2132,6 +2484,11 @@
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
--- a/net/minecraft/server/ScoreboardServer.java
|
||||
+++ b/net/minecraft/server/ScoreboardServer.java
|
||||
@@ -40,7 +40,7 @@
|
||||
@@ -42,7 +42,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.server.getPlayerList().broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), Optional.ofNullable(scoreboardscore.display()), Optional.ofNullable(scoreboardscore.numberFormat())));
|
||||
+ this.broadcastAll(new PacketPlayOutScoreboardScore(scoreholder.getScoreboardName(), scoreboardobjective.getName(), scoreboardscore.value(), Optional.ofNullable(scoreboardscore.display()), Optional.ofNullable(scoreboardscore.numberFormat()))); // CraftBukkit
|
||||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -55,7 +55,7 @@
|
||||
@@ -57,7 +57,7 @@
|
||||
@Override
|
||||
public void onPlayerRemoved(ScoreHolder scoreholder) {
|
||||
super.onPlayerRemoved(scoreholder);
|
||||
|
@ -18,7 +18,7 @@
|
|||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
@@ -65,7 +65,7 @@
|
||||
public void onPlayerScoreRemoved(ScoreHolder scoreholder, ScoreboardObjective scoreboardobjective) {
|
||||
super.onPlayerScoreRemoved(scoreholder, scoreboardobjective);
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -76,7 +76,7 @@
|
||||
@@ -78,7 +78,7 @@
|
||||
super.setDisplayObjective(displayslot, scoreboardobjective);
|
||||
if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) {
|
||||
if (this.getObjectiveDisplaySlotCount(scoreboardobjective1) > 0) {
|
||||
|
@ -36,7 +36,7 @@
|
|||
} else {
|
||||
this.stopTrackingObjective(scoreboardobjective1);
|
||||
}
|
||||
@@ -84,7 +84,7 @@
|
||||
@@ -86,7 +86,7 @@
|
||||
|
||||
if (scoreboardobjective != null) {
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
|
@ -45,7 +45,7 @@
|
|||
} else {
|
||||
this.startTrackingObjective(scoreboardobjective);
|
||||
}
|
||||
@@ -96,7 +96,7 @@
|
||||
@@ -98,7 +98,7 @@
|
||||
@Override
|
||||
public boolean addPlayerToTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
if (super.addPlayerToTeam(s, scoreboardteam)) {
|
||||
|
@ -54,7 +54,7 @@
|
|||
this.setDirty();
|
||||
return true;
|
||||
} else {
|
||||
@@ -107,7 +107,7 @@
|
||||
@@ -109,7 +109,7 @@
|
||||
@Override
|
||||
public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) {
|
||||
super.removePlayerFromTeam(s, scoreboardteam);
|
||||
|
@ -63,7 +63,7 @@
|
|||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
@@ -123,7 +123,7 @@
|
||||
public void onObjectiveChanged(ScoreboardObjective scoreboardobjective) {
|
||||
super.onObjectiveChanged(scoreboardobjective);
|
||||
if (this.trackedObjectives.contains(scoreboardobjective)) {
|
||||
|
@ -72,7 +72,7 @@
|
|||
}
|
||||
|
||||
this.setDirty();
|
||||
@@ -140,21 +140,21 @@
|
||||
@@ -142,21 +142,21 @@
|
||||
@Override
|
||||
public void onTeamAdded(ScoreboardTeam scoreboardteam) {
|
||||
super.onTeamAdded(scoreboardteam);
|
||||
|
@ -97,7 +97,7 @@
|
|||
this.setDirty();
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
@@ -207,6 +207,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
@ -105,7 +105,7 @@
|
|||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -241,6 +242,7 @@
|
||||
@@ -243,6 +244,7 @@
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
@ -113,8 +113,8 @@
|
|||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -285,6 +287,16 @@
|
||||
return this.createData().load(nbttagcompound);
|
||||
@@ -287,6 +289,16 @@
|
||||
return this.createData().load(nbttagcompound, holderlookup_a);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - Send to players
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/bossevents/BossBattleCustom.java
|
||||
+++ b/net/minecraft/server/bossevents/BossBattleCustom.java
|
||||
@@ -18,12 +18,27 @@
|
||||
@@ -19,12 +19,27 @@
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.BossBattle;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
+++ b/net/minecraft/server/commands/CommandEffect.java
|
||||
@@ -84,7 +84,7 @@
|
||||
if (entity instanceof EntityLiving) {
|
||||
MobEffect mobeffect = new MobEffect(mobeffectlist, k, i, false, flag);
|
||||
MobEffect mobeffect = new MobEffect(holder, k, i, false, flag);
|
||||
|
||||
- if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity())) {
|
||||
+ if (((EntityLiving) entity).addEffect(mobeffect, commandlistenerwrapper.getEntity(), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
|
@ -22,8 +22,8 @@
|
|||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
- if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(mobeffectlist)) {
|
||||
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
- if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(holder)) {
|
||||
+ if (entity instanceof EntityLiving && ((EntityLiving) entity).removeEffect(holder, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.COMMAND)) { // CraftBukkit
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/server/commands/CommandGive.java
|
||||
+++ b/net/minecraft/server/commands/CommandGive.java
|
||||
@@ -61,7 +61,7 @@
|
||||
@@ -60,7 +60,7 @@
|
||||
EntityItem entityitem;
|
||||
|
||||
if (flag && itemstack1.isEmpty()) {
|
||||
itemstack1.setCount(1);
|
||||
- entityitem = entityplayer.drop(itemstack1, false);
|
||||
+ entityitem = entityplayer.drop(itemstack1, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
- entityitem = entityplayer.drop(itemstack, false);
|
||||
+ entityitem = entityplayer.drop(itemstack, false, false, false); // CraftBukkit - SPIGOT-2942: Add boolean to call event
|
||||
if (entityitem != null) {
|
||||
entityitem.makeFakeItem();
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/CommandLoot.java
|
||||
+++ b/net/minecraft/server/commands/CommandLoot.java
|
||||
@@ -90,7 +90,7 @@
|
||||
@@ -91,7 +91,7 @@
|
||||
}
|
||||
|
||||
private static <T extends ArgumentBuilder<CommandListenerWrapper, T>> T addTargets(T t0, CommandLoot.c commandloot_c) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), list.size(), list, commandloot_a);
|
||||
}).then(commandloot_c.construct(net.minecraft.commands.CommandDispatcher.argument("count", IntegerArgumentType.integer(0)), (commandcontext, list, commandloot_a) -> {
|
||||
return entityReplace(ArgumentEntity.getEntities(commandcontext, "entities"), ArgumentInventorySlot.getSlot(commandcontext, "slot"), IntegerArgumentType.getInteger(commandcontext, "count"), list, commandloot_a);
|
||||
@@ -247,6 +247,7 @@
|
||||
@@ -246,6 +246,7 @@
|
||||
private static int dropInWorld(CommandListenerWrapper commandlistenerwrapper, Vec3D vec3d, List<ItemStack> list, CommandLoot.a commandloot_a) throws CommandSyntaxException {
|
||||
WorldServer worldserver = commandlistenerwrapper.getLevel();
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/commands/CommandSummon.java
|
||||
+++ b/net/minecraft/server/commands/CommandSummon.java
|
||||
@@ -67,7 +67,7 @@
|
||||
((EntityInsentient) entity).finalizeSpawn(commandlistenerwrapper.getLevel(), commandlistenerwrapper.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EnumMobSpawn.COMMAND, (GroupDataEntity) null, (NBTTagCompound) null);
|
||||
((EntityInsentient) entity).finalizeSpawn(commandlistenerwrapper.getLevel(), commandlistenerwrapper.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EnumMobSpawn.COMMAND, (GroupDataEntity) null);
|
||||
}
|
||||
|
||||
- if (!worldserver.tryAddFreshEntityWithPassengers(entity)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/commands/PlaceCommand.java
|
||||
+++ b/net/minecraft/server/commands/PlaceCommand.java
|
||||
@@ -130,6 +130,7 @@
|
||||
@@ -132,6 +132,7 @@
|
||||
if (!structurestart.isValid()) {
|
||||
throw PlaceCommand.ERROR_STRUCTURE_FAILED.create();
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -53,6 +53,18 @@
|
||||
@@ -58,6 +58,18 @@
|
||||
import net.minecraft.world.level.storage.Convertable;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
|||
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -61,7 +73,7 @@
|
||||
@@ -66,7 +78,7 @@
|
||||
private final List<ServerCommand> consoleInput = Collections.synchronizedList(Lists.newArrayList());
|
||||
@Nullable
|
||||
private RemoteStatusListener queryThreadGs4;
|
||||
|
@ -28,9 +28,9 @@
|
|||
@Nullable
|
||||
private RemoteControlListener rconThread;
|
||||
public DedicatedServerSettings settings;
|
||||
@@ -70,10 +82,12 @@
|
||||
@@ -79,10 +91,12 @@
|
||||
@Nullable
|
||||
private final TextFilter textFilterClient;
|
||||
private DebugSampleSubscriptionTracker debugSampleSubscriptionTracker;
|
||||
|
||||
- public DedicatedServer(Thread thread, Convertable.ConversionSession convertable_conversionsession, ResourcePackRepository resourcepackrepository, WorldStem worldstem, DedicatedServerSettings dedicatedserversettings, DataFixer datafixer, Services services, WorldLoadListenerFactory worldloadlistenerfactory) {
|
||||
- super(thread, convertable_conversionsession, resourcepackrepository, worldstem, Proxy.NO_PROXY, datafixer, services, worldloadlistenerfactory);
|
||||
|
@ -44,7 +44,7 @@
|
|||
this.textFilterClient = TextFilter.createFromConfig(dedicatedserversettings.getProperties().textFilteringConfig);
|
||||
}
|
||||
|
||||
@@ -81,13 +95,44 @@
|
||||
@@ -90,13 +104,44 @@
|
||||
public boolean initServer() throws IOException {
|
||||
Thread thread = new Thread("Server console handler") {
|
||||
public void run() {
|
||||
|
@ -92,7 +92,7 @@
|
|||
}
|
||||
} catch (IOException ioexception) {
|
||||
DedicatedServer.LOGGER.error("Exception handling console input", ioexception);
|
||||
@@ -96,6 +141,29 @@
|
||||
@@ -105,6 +150,29 @@
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@
|
|||
thread.setDaemon(true);
|
||||
thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(DedicatedServer.LOGGER));
|
||||
thread.start();
|
||||
@@ -120,7 +188,7 @@
|
||||
@@ -129,7 +197,7 @@
|
||||
this.setMotd(dedicatedserverproperties.motd);
|
||||
super.setPlayerIdleTimeout((Integer) dedicatedserverproperties.playerIdleTimeout.get());
|
||||
this.setEnforceWhitelist(dedicatedserverproperties.enforceWhitelist);
|
||||
|
@ -131,7 +131,7 @@
|
|||
DedicatedServer.LOGGER.info("Default game type: {}", dedicatedserverproperties.gamemode);
|
||||
InetAddress inetaddress = null;
|
||||
|
||||
@@ -144,6 +212,12 @@
|
||||
@@ -153,6 +221,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -144,14 +144,16 @@
|
|||
if (!this.usesAuthentication()) {
|
||||
DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
|
||||
DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware.");
|
||||
@@ -158,19 +232,19 @@
|
||||
@@ -167,7 +241,7 @@
|
||||
if (!NameReferencingFileConverter.serverReadyAfterUserconversion(this)) {
|
||||
return false;
|
||||
} else {
|
||||
- this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage));
|
||||
+ // this.setPlayerList(new DedicatedPlayerList(this, this.registries(), this.playerDataStorage)); // CraftBukkit - moved up
|
||||
this.debugSampleSubscriptionTracker = new DebugSampleSubscriptionTracker(this.getPlayerList());
|
||||
this.tickTimeLogger = new RemoteSampleLogger(TpsDebugDimensions.values().length, this.debugSampleSubscriptionTracker, RemoteDebugSampleType.TICK_TIME);
|
||||
long i = SystemUtils.getNanos();
|
||||
|
||||
@@ -175,13 +249,13 @@
|
||||
TileEntitySkull.setup(this.services, this);
|
||||
UserCache.setUsesAuthentication(this.usesAuthentication());
|
||||
DedicatedServer.LOGGER.info("Preparing level \"{}\"", this.getLevelIdName());
|
||||
|
@ -167,7 +169,7 @@
|
|||
}
|
||||
|
||||
if (dedicatedserverproperties.enableQuery) {
|
||||
@@ -296,6 +370,7 @@
|
||||
@@ -307,6 +381,7 @@
|
||||
this.queryThreadGs4.stop();
|
||||
}
|
||||
|
||||
|
@ -175,7 +177,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -317,7 +392,15 @@
|
||||
@@ -328,7 +403,15 @@
|
||||
while (!this.consoleInput.isEmpty()) {
|
||||
ServerCommand servercommand = (ServerCommand) this.consoleInput.remove(0);
|
||||
|
||||
|
@ -192,7 +194,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -544,16 +627,52 @@
|
||||
@@ -555,16 +638,52 @@
|
||||
|
||||
@Override
|
||||
public String getPluginNames() {
|
||||
|
@ -249,9 +251,9 @@
|
|||
}
|
||||
|
||||
public void storeUsingWhiteList(boolean flag) {
|
||||
@@ -604,4 +723,15 @@
|
||||
public Optional<MinecraftServer.ServerResourcePackInfo> getServerResourcePack() {
|
||||
return this.settings.getProperties().serverResourcePackInfo;
|
||||
@@ -641,4 +760,15 @@
|
||||
public boolean acceptsTransfers() {
|
||||
return this.settings.getProperties().acceptsTransfers;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
+++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java
|
||||
@@ -44,11 +44,16 @@
|
||||
@@ -43,11 +43,16 @@
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -17,9 +17,9 @@
|
|||
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", "");
|
||||
@@ -103,8 +108,10 @@
|
||||
private final DedicatedServerProperties.WorldDimensionData worldDimensionData;
|
||||
@@ -104,8 +109,10 @@
|
||||
public final WorldOptions worldOptions;
|
||||
public boolean acceptsTransfers;
|
||||
|
||||
- public DedicatedServerProperties(Properties properties) {
|
||||
- super(properties);
|
||||
|
@ -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");
|
||||
@@ -161,13 +168,15 @@
|
||||
@@ -164,13 +171,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
|
||||
@@ -248,10 +257,10 @@
|
||||
@@ -251,10 +260,10 @@
|
||||
}).orElseThrow(() -> {
|
||||
return new IllegalStateException("Invalid datapack contents: can't find default preset");
|
||||
});
|
||||
|
@ -63,10 +63,10 @@
|
|||
});
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
@@ -263,7 +272,7 @@
|
||||
@@ -266,7 +275,7 @@
|
||||
|
||||
if (holder.is(WorldPresets.FLAT)) {
|
||||
RegistryOps<JsonElement> registryops = RegistryOps.create(JsonOps.INSTANCE, (HolderLookup.b) iregistrycustom);
|
||||
RegistryOps<JsonElement> registryops = iregistrycustom.createSerializationContext(JsonOps.INSTANCE);
|
||||
- DataResult dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings()));
|
||||
+ DataResult<GeneratorSettingsFlat> dataresult = GeneratorSettingsFlat.CODEC.parse(new Dynamic(registryops, this.generatorSettings())); // CraftBukkit - decompile error
|
||||
Logger logger = DedicatedServerProperties.LOGGER;
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
private final V value;
|
||||
private final Function<V, String> serializer;
|
||||
|
||||
- EditableProperty(String s, Object object, Function function) {
|
||||
+ EditableProperty(String s, V object, Function function) { // CraftBukkit - decompile error
|
||||
- EditableProperty(final String s, final Object object, final Function function) {
|
||||
+ EditableProperty(final String s, final V object, final Function function) { // CraftBukkit - decompile error
|
||||
this.key = s;
|
||||
this.value = object;
|
||||
this.serializer = function;
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
|
||||
Objects.requireNonNull(guistatscomponent);
|
||||
collection.add(guistatscomponent::close);
|
||||
@@ -132,7 +132,7 @@
|
||||
|
||||
jtextfield.setText("");
|
||||
});
|
||||
- jtextarea.addFocusListener(new FocusAdapter(this) {
|
||||
+ jtextarea.addFocusListener(new FocusAdapter() { // CraftBukkit - decompile error
|
||||
public void focusGained(FocusEvent focusevent) {}
|
||||
});
|
||||
jpanel.add(jscrollpane, "Center");
|
||||
@@ -166,6 +166,7 @@
|
||||
this.finalizers.forEach(Runnable::run);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkMapDistance.java
|
||||
+++ b/net/minecraft/server/level/ChunkMapDistance.java
|
||||
@@ -55,7 +55,7 @@
|
||||
final LongSet ticketsToRelease = new LongOpenHashSet();
|
||||
final Executor mainThreadExecutor;
|
||||
private long ticketTickCounter;
|
||||
- private int simulationDistance = 10;
|
||||
+ public int simulationDistance = 10;
|
||||
|
||||
protected ChunkMapDistance(Executor executor, Executor executor1) {
|
||||
Objects.requireNonNull(executor1);
|
||||
@@ -122,10 +122,25 @@
|
||||
@@ -121,10 +121,25 @@
|
||||
}
|
||||
|
||||
if (!this.chunksToUpdateFutures.isEmpty()) {
|
||||
|
@ -38,7 +29,7 @@
|
|||
return true;
|
||||
} else {
|
||||
if (!this.ticketsToRelease.isEmpty()) {
|
||||
@@ -161,7 +176,7 @@
|
||||
@@ -160,7 +175,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,7 +38,7 @@
|
|||
ArraySetSorted<Ticket<?>> arraysetsorted = this.getTickets(i);
|
||||
int j = getTicketLevelAt(arraysetsorted);
|
||||
Ticket<?> ticket1 = (Ticket) arraysetsorted.addOrGet(ticket);
|
||||
@@ -171,13 +186,15 @@
|
||||
@@ -170,13 +185,15 @@
|
||||
this.ticketTracker.update(i, ticket.getTicketLevel(), true);
|
||||
}
|
||||
|
||||
|
@ -65,7 +56,7 @@
|
|||
}
|
||||
|
||||
if (arraysetsorted.isEmpty()) {
|
||||
@@ -185,6 +202,7 @@
|
||||
@@ -184,6 +201,7 @@
|
||||
}
|
||||
|
||||
this.ticketTracker.update(i, getTicketLevelAt(arraysetsorted), false);
|
||||
|
@ -73,7 +64,7 @@
|
|||
}
|
||||
|
||||
public <T> void addTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
@@ -198,19 +216,33 @@
|
||||
@@ -197,19 +215,33 @@
|
||||
}
|
||||
|
||||
public <T> void addRegionTicket(TicketType<T> tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) {
|
||||
|
@ -109,7 +100,7 @@
|
|||
}
|
||||
|
||||
private ArraySetSorted<Ticket<?>> getTickets(long i) {
|
||||
@@ -249,6 +281,7 @@
|
||||
@@ -248,6 +280,7 @@
|
||||
ChunkCoordIntPair chunkcoordintpair = sectionposition.chunk();
|
||||
long i = chunkcoordintpair.toLong();
|
||||
ObjectSet<EntityPlayer> objectset = (ObjectSet) this.playersPerChunk.get(i);
|
||||
|
@ -117,7 +108,7 @@
|
|||
|
||||
objectset.remove(entityplayer);
|
||||
if (objectset.isEmpty()) {
|
||||
@@ -378,6 +411,26 @@
|
||||
@@ -377,6 +410,26 @@
|
||||
return !this.tickets.isEmpty();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/ChunkProviderServer.java
|
||||
+++ b/net/minecraft/server/level/ChunkProviderServer.java
|
||||
@@ -83,6 +83,16 @@
|
||||
@@ -81,6 +81,16 @@
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
|
@ -17,31 +17,40 @@
|
|||
@Override
|
||||
public LightEngineThreaded getLightEngine() {
|
||||
return this.lightEngine;
|
||||
@@ -127,7 +137,7 @@
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
@@ -124,7 +134,7 @@
|
||||
if (k == this.lastChunkPos[l] && chunkstatus == this.lastChunkStatus[l]) {
|
||||
ichunkaccess = this.lastChunk[l];
|
||||
IChunkAccess ichunkaccess = this.lastChunk[l];
|
||||
|
||||
- if (ichunkaccess != null || !flag) {
|
||||
+ if (ichunkaccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
|
||||
return ichunkaccess;
|
||||
}
|
||||
}
|
||||
@@ -175,12 +185,12 @@
|
||||
@@ -137,7 +147,7 @@
|
||||
Objects.requireNonNull(completablefuture);
|
||||
chunkproviderserver_b.managedBlock(completablefuture::isDone);
|
||||
ChunkResult<IChunkAccess> chunkresult = (ChunkResult) completablefuture.join();
|
||||
- IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess1 == null && flag) {
|
||||
throw (IllegalStateException) SystemUtils.pauseInIde(new IllegalStateException("Chunk not there when requested: " + chunkresult.getError()));
|
||||
@@ -170,12 +180,12 @@
|
||||
if (playerchunk == null) {
|
||||
return null;
|
||||
} else {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow(null); // CraftBukkit - decompile error
|
||||
- ChunkResult<IChunkAccess> chunkresult = (ChunkResult) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow((Object) null);
|
||||
+ ChunkResult<IChunkAccess> chunkresult = (ChunkResult) playerchunk.getFutureIfPresent(ChunkStatus.FULL).getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either == null) {
|
||||
if (chunkresult == null) {
|
||||
return null;
|
||||
} else {
|
||||
- IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse(null); // CraftBukkit - decompile error
|
||||
- IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess1 = (IChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess1 != null) {
|
||||
this.storeInCache(k, ichunkaccess1, ChunkStatus.FULL);
|
||||
@@ -228,7 +238,15 @@
|
||||
@@ -223,7 +233,15 @@
|
||||
int l = ChunkLevel.byStatus(chunkstatus);
|
||||
PlayerChunk playerchunk = this.getVisibleChunkIfPresent(k);
|
||||
|
||||
|
@ -58,7 +67,7 @@
|
|||
this.distanceManager.addTicket(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
if (this.chunkAbsent(playerchunk, l)) {
|
||||
GameProfilerFiller gameprofilerfiller = this.level.getProfiler();
|
||||
@@ -247,7 +265,7 @@
|
||||
@@ -242,7 +260,7 @@
|
||||
}
|
||||
|
||||
private boolean chunkAbsent(@Nullable PlayerChunk playerchunk, int i) {
|
||||
|
@ -67,16 +76,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -315,7 +333,7 @@
|
||||
} else if (!this.level.shouldTickBlocksAt(i)) {
|
||||
return false;
|
||||
} else {
|
||||
- Either<Chunk, PlayerChunk.Failure> either = (Either) playerchunk.getTickingChunkFuture().getNow((Object) null);
|
||||
+ Either<Chunk, PlayerChunk.Failure> either = (Either) playerchunk.getTickingChunkFuture().getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
return either != null && either.left().isPresent();
|
||||
}
|
||||
@@ -328,11 +346,31 @@
|
||||
@@ -315,11 +333,31 @@
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
@ -109,7 +109,7 @@
|
|||
@Override
|
||||
public void tick(BooleanSupplier booleansupplier, boolean flag) {
|
||||
this.level.getProfiler().push("purge");
|
||||
@@ -379,11 +417,11 @@
|
||||
@@ -369,11 +407,11 @@
|
||||
|
||||
this.lastSpawnState = spawnercreature_d;
|
||||
gameprofilerfiller.popPush("spawnAndTick");
|
||||
|
@ -123,7 +123,7 @@
|
|||
Iterator iterator1 = list.iterator();
|
||||
|
||||
while (iterator1.hasNext()) {
|
||||
@@ -586,13 +624,19 @@
|
||||
@@ -576,13 +614,19 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityPlayer.java
|
||||
+++ b/net/minecraft/server/level/EntityPlayer.java
|
||||
@@ -157,6 +157,38 @@
|
||||
@@ -165,6 +165,38 @@
|
||||
import net.minecraft.world.scores.criteria.IScoreboardCriteria;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
|||
public class EntityPlayer extends EntityHuman {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -192,7 +224,7 @@
|
||||
@@ -203,7 +235,7 @@
|
||||
private int levitationStartTime;
|
||||
private boolean disconnected;
|
||||
private int requestedViewDistance;
|
||||
|
@ -48,11 +48,12 @@
|
|||
@Nullable
|
||||
private Vec3D startingToFallPosition;
|
||||
@Nullable
|
||||
@@ -217,6 +249,20 @@
|
||||
@@ -233,6 +265,21 @@
|
||||
private int containerCounter;
|
||||
public boolean wonGame;
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
||||
+ public String displayName;
|
||||
+ public IChatBaseComponent listName;
|
||||
+ public org.bukkit.Location compassTarget;
|
||||
|
@ -69,17 +70,17 @@
|
|||
public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, ClientInformation clientinformation) {
|
||||
super(worldserver, worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle(), gameprofile);
|
||||
this.chatVisibility = EnumChatVisibility.FULL;
|
||||
@@ -283,12 +329,56 @@
|
||||
this.setMaxUpStep(1.0F);
|
||||
@@ -299,12 +346,56 @@
|
||||
this.fudgeSpawnLocation(worldserver);
|
||||
this.updateOptions(clientinformation);
|
||||
this.object = null;
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ 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) {
|
||||
|
@ -116,9 +117,9 @@
|
|||
+ }
|
||||
+
|
||||
+ return blockposition;
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
private void fudgeSpawnLocation(WorldServer worldserver) {
|
||||
BlockPosition blockposition = worldserver.getSharedSpawnPos();
|
||||
|
||||
|
@ -127,16 +128,16 @@
|
|||
int i = Math.max(0, this.server.getSpawnRadius(worldserver));
|
||||
int j = MathHelper.floor(worldserver.getWorldBorder().getDistanceToBorder((double) blockposition.getX(), (double) blockposition.getZ()));
|
||||
|
||||
@@ -337,7 +427,7 @@
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
if (nbttagcompound.contains("warden_spawn_tracker", 10)) {
|
||||
- DataResult dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
+ DataResult<WardenSpawnTracker> dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker"))); // CraftBukkit - decompile error
|
||||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
@@ -359,7 +450,7 @@
|
||||
dataresult = WardenSpawnTracker.CODEC.parse(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("warden_spawn_tracker")));
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -356,17 +446,26 @@
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((wardenspawntracker) -> {
|
||||
+ ((DataResult<WardenSpawnTracker>) dataresult).resultOrPartial(logger::error).ifPresent((wardenspawntracker) -> {
|
||||
this.wardenSpawnTracker = wardenspawntracker;
|
||||
});
|
||||
}
|
||||
@@ -374,17 +465,26 @@
|
||||
if (nbttagcompound.contains("recipeBook", 10)) {
|
||||
this.recipeBook.fromNbt(nbttagcompound.getCompound("recipeBook"), this.server.getRecipeManager());
|
||||
}
|
||||
|
@ -164,7 +165,16 @@
|
|||
Logger logger1 = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger1);
|
||||
@@ -379,7 +478,7 @@
|
||||
@@ -399,7 +499,7 @@
|
||||
dataresult = BlockPosition.CODEC.parse(DynamicOpsNBT.INSTANCE, nbtbase);
|
||||
logger = EntityPlayer.LOGGER;
|
||||
Objects.requireNonNull(logger);
|
||||
- dataresult.resultOrPartial(logger::error).ifPresent((blockposition) -> {
|
||||
+ ((DataResult<BlockPosition>) dataresult).resultOrPartial(logger::error).ifPresent((blockposition) -> { // CraftBukkit - decompile error
|
||||
this.raidOmenPosition = blockposition;
|
||||
});
|
||||
}
|
||||
@@ -409,7 +509,7 @@
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
|
@ -173,7 +183,7 @@
|
|||
Logger logger = EntityPlayer.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
@@ -400,7 +499,20 @@
|
||||
@@ -430,7 +530,20 @@
|
||||
Entity entity = this.getRootVehicle();
|
||||
Entity entity1 = this.getVehicle();
|
||||
|
||||
|
@ -195,13 +205,17 @@
|
|||
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
|
||||
NBTTagCompound nbttagcompound3 = new NBTTagCompound();
|
||||
|
||||
@@ -425,8 +537,32 @@
|
||||
@@ -455,6 +568,7 @@
|
||||
nbttagcompound.put("SpawnDimension", nbtbase);
|
||||
});
|
||||
}
|
||||
+ this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit
|
||||
+
|
||||
+ }
|
||||
|
||||
nbttagcompound.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
|
||||
if (this.raidOmenPosition != null) {
|
||||
@@ -468,6 +582,29 @@
|
||||
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - World fallback code, either respawn location or global spawn
|
||||
+ public void spawnIn(World world) {
|
||||
|
@ -223,12 +237,13 @@
|
|||
+ this.setPos(position);
|
||||
+ }
|
||||
+ this.gameMode.setLevel((WorldServer) world);
|
||||
}
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public void setExperiencePoints(int i) {
|
||||
float f = (float) this.getXpNeededForNextLevel();
|
||||
@@ -486,6 +622,11 @@
|
||||
float f1 = (f - 1.0F) / f;
|
||||
@@ -526,6 +663,11 @@
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
|
@ -240,7 +255,7 @@
|
|||
this.gameMode.tick();
|
||||
this.wardenSpawnTracker.tick();
|
||||
--this.spawnInvulnerableTime;
|
||||
@@ -542,7 +683,7 @@
|
||||
@@ -606,7 +748,7 @@
|
||||
}
|
||||
|
||||
if (this.getHealth() != this.lastSentHealth || this.lastSentFood != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.lastFoodSaturationZero) {
|
||||
|
@ -249,7 +264,7 @@
|
|||
this.lastSentHealth = this.getHealth();
|
||||
this.lastSentFood = this.foodData.getFoodLevel();
|
||||
this.lastFoodSaturationZero = this.foodData.getSaturationLevel() == 0.0F;
|
||||
@@ -573,6 +714,12 @@
|
||||
@@ -637,6 +779,12 @@
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.EXPERIENCE, MathHelper.ceil((float) this.lastRecordedExperience));
|
||||
}
|
||||
|
||||
|
@ -262,7 +277,7 @@
|
|||
if (this.experienceLevel != this.lastRecordedLevel) {
|
||||
this.lastRecordedLevel = this.experienceLevel;
|
||||
this.updateScoreForCriteria(IScoreboardCriteria.LEVEL, MathHelper.ceil((float) this.lastRecordedLevel));
|
||||
@@ -587,6 +734,20 @@
|
||||
@@ -651,6 +799,20 @@
|
||||
CriterionTriggers.LOCATION.trigger(this);
|
||||
}
|
||||
|
||||
|
@ -283,7 +298,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking player");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Player being ticked");
|
||||
@@ -629,7 +790,8 @@
|
||||
@@ -696,7 +858,8 @@
|
||||
}
|
||||
|
||||
private void updateScoreForCriteria(IScoreboardCriteria iscoreboardcriteria, int i) {
|
||||
|
@ -293,7 +308,7 @@
|
|||
scoreaccess.set(i);
|
||||
});
|
||||
}
|
||||
@@ -638,9 +800,47 @@
|
||||
@@ -705,9 +868,47 @@
|
||||
public void die(DamageSource damagesource) {
|
||||
this.gameEvent(GameEvent.ENTITY_DIE);
|
||||
boolean flag = this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES);
|
||||
|
@ -343,7 +358,7 @@
|
|||
|
||||
this.connection.send(new ClientboundPlayerCombatKillPacket(this.getId(), ichatbasecomponent), PacketSendListener.exceptionallySend(() -> {
|
||||
boolean flag1 = true;
|
||||
@@ -671,12 +871,18 @@
|
||||
@@ -738,12 +939,18 @@
|
||||
if (this.level().getGameRules().getBoolean(GameRules.RULE_FORGIVE_DEAD_PLAYERS)) {
|
||||
this.tellNeutralMobsThatIDied();
|
||||
}
|
||||
|
@ -366,7 +381,7 @@
|
|||
EntityLiving entityliving = this.getKillCredit();
|
||||
|
||||
if (entityliving != null) {
|
||||
@@ -711,10 +917,12 @@
|
||||
@@ -778,10 +985,12 @@
|
||||
if (entity != this) {
|
||||
super.awardKillScore(entity, i, damagesource);
|
||||
this.increaseScore(i);
|
||||
|
@ -381,7 +396,7 @@
|
|||
} else {
|
||||
this.awardStat(StatisticList.MOB_KILLS);
|
||||
}
|
||||
@@ -732,7 +940,8 @@
|
||||
@@ -799,7 +1008,8 @@
|
||||
int i = scoreboardteam.getColor().getId();
|
||||
|
||||
if (i >= 0 && i < aiscoreboardcriteria.length) {
|
||||
|
@ -391,7 +406,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -782,18 +991,20 @@
|
||||
@@ -849,18 +1059,20 @@
|
||||
}
|
||||
|
||||
private boolean isPvpAllowed() {
|
||||
|
@ -415,7 +430,7 @@
|
|||
} else {
|
||||
return shapedetectorshape;
|
||||
}
|
||||
@@ -802,11 +1013,20 @@
|
||||
@@ -869,11 +1081,20 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -439,7 +454,7 @@
|
|||
this.unRide();
|
||||
this.serverLevel().removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
if (!this.wonGame) {
|
||||
@@ -817,6 +1037,8 @@
|
||||
@@ -884,6 +1105,8 @@
|
||||
|
||||
return this;
|
||||
} else {
|
||||
|
@ -448,7 +463,7 @@
|
|||
WorldData worlddata = worldserver.getLevelData();
|
||||
|
||||
this.connection.send(new PacketPlayOutRespawn(this.createCommonSpawnInfo(worldserver), (byte) 3));
|
||||
@@ -826,20 +1048,50 @@
|
||||
@@ -893,20 +1116,50 @@
|
||||
playerlist.sendPlayerPermissionLevel(this);
|
||||
worldserver1.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION);
|
||||
this.unsetRemoved();
|
||||
|
@ -504,7 +519,7 @@
|
|||
this.connection.resetPosition();
|
||||
worldserver.addDuringPortalTeleport(this);
|
||||
worldserver1.getProfiler().pop();
|
||||
@@ -859,39 +1111,66 @@
|
||||
@@ -926,39 +1179,66 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -577,7 +592,7 @@
|
|||
}
|
||||
|
||||
return optional1;
|
||||
@@ -901,13 +1180,21 @@
|
||||
@@ -968,13 +1248,21 @@
|
||||
public void triggerDimensionChangeTriggers(WorldServer worldserver) {
|
||||
ResourceKey<World> resourcekey = worldserver.dimension();
|
||||
ResourceKey<World> resourcekey1 = this.level().dimension();
|
||||
|
@ -602,7 +617,7 @@
|
|||
this.enteredNetherPosition = null;
|
||||
}
|
||||
|
||||
@@ -924,19 +1211,17 @@
|
||||
@@ -991,19 +1279,17 @@
|
||||
this.containerMenu.broadcastChanges();
|
||||
}
|
||||
|
||||
|
@ -626,7 +641,7 @@
|
|||
if (this.level().isDay()) {
|
||||
return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_NOW);
|
||||
} else {
|
||||
@@ -953,7 +1238,36 @@
|
||||
@@ -1020,7 +1306,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,7 +679,7 @@
|
|||
this.awardStat(StatisticList.SLEEP_IN_BED);
|
||||
CriterionTriggers.SLEPT_IN_BED.trigger(this);
|
||||
});
|
||||
@@ -966,9 +1280,8 @@
|
||||
@@ -1033,9 +1348,8 @@
|
||||
return either;
|
||||
}
|
||||
}
|
||||
|
@ -675,7 +690,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -995,13 +1308,31 @@
|
||||
@@ -1062,13 +1376,31 @@
|
||||
|
||||
@Override
|
||||
public void stopSleepInBed(boolean flag, boolean flag1) {
|
||||
|
@ -708,7 +723,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1051,8 +1382,9 @@
|
||||
@@ -1135,8 +1467,9 @@
|
||||
this.connection.send(new PacketPlayOutOpenSignEditor(tileentitysign.getBlockPos(), flag));
|
||||
}
|
||||
|
||||
|
@ -719,7 +734,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1060,13 +1392,35 @@
|
||||
@@ -1144,13 +1477,35 @@
|
||||
if (itileinventory == null) {
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -755,7 +770,7 @@
|
|||
if (container == null) {
|
||||
if (this.isSpectator()) {
|
||||
this.displayClientMessage(IChatBaseComponent.translatable("container.spectatorCantOpen").withStyle(EnumChatFormat.RED), true);
|
||||
@@ -1074,9 +1428,11 @@
|
||||
@@ -1158,9 +1513,11 @@
|
||||
|
||||
return OptionalInt.empty();
|
||||
} else {
|
||||
|
@ -769,7 +784,7 @@
|
|||
return OptionalInt.of(this.containerCounter);
|
||||
}
|
||||
}
|
||||
@@ -1089,13 +1445,24 @@
|
||||
@@ -1173,13 +1530,24 @@
|
||||
|
||||
@Override
|
||||
public void openHorseInventory(EntityHorseAbstract entityhorseabstract, IInventory iinventory) {
|
||||
|
@ -796,7 +811,7 @@
|
|||
this.initMenu(this.containerMenu);
|
||||
}
|
||||
|
||||
@@ -1118,6 +1485,7 @@
|
||||
@@ -1202,6 +1570,7 @@
|
||||
|
||||
@Override
|
||||
public void closeContainer() {
|
||||
|
@ -804,7 +819,7 @@
|
|||
this.connection.send(new PacketPlayOutCloseWindow(this.containerMenu.containerId));
|
||||
this.doCloseContainer();
|
||||
}
|
||||
@@ -1140,6 +1508,16 @@
|
||||
@@ -1224,6 +1593,16 @@
|
||||
}
|
||||
|
||||
this.jumping = flag;
|
||||
|
@ -821,7 +836,7 @@
|
|||
this.setShiftKeyDown(flag1);
|
||||
}
|
||||
|
||||
@@ -1173,19 +1551,19 @@
|
||||
@@ -1257,19 +1636,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);
|
||||
|
@ -844,7 +859,7 @@
|
|||
}
|
||||
} else if (this.onClimbable()) {
|
||||
if (d1 > 0.0D) {
|
||||
@@ -1196,13 +1574,13 @@
|
||||
@@ -1280,13 +1659,13 @@
|
||||
if (i > 0) {
|
||||
if (this.isSprinting()) {
|
||||
this.awardStat(StatisticList.SPRINT_ONE_CM, i);
|
||||
|
@ -861,7 +876,7 @@
|
|||
}
|
||||
}
|
||||
} else if (this.isFallFlying()) {
|
||||
@@ -1245,7 +1623,7 @@
|
||||
@@ -1329,7 +1708,7 @@
|
||||
@Override
|
||||
public void awardStat(Statistic<?> statistic, int i) {
|
||||
this.stats.increment(this, statistic, i);
|
||||
|
@ -870,7 +885,7 @@
|
|||
scoreaccess.add(i);
|
||||
});
|
||||
}
|
||||
@@ -1253,7 +1631,7 @@
|
||||
@@ -1337,7 +1716,7 @@
|
||||
@Override
|
||||
public void resetStat(Statistic<?> statistic) {
|
||||
this.stats.setValue(this, statistic, 0);
|
||||
|
@ -879,7 +894,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1301,6 +1679,7 @@
|
||||
@@ -1385,6 +1764,7 @@
|
||||
|
||||
public void resetSentInfo() {
|
||||
this.lastSentHealth = -1.0E8F;
|
||||
|
@ -887,7 +902,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1358,7 +1737,7 @@
|
||||
@@ -1442,7 +1822,7 @@
|
||||
this.lastSentExp = -1;
|
||||
this.lastSentHealth = -1.0F;
|
||||
this.lastSentFood = -1;
|
||||
|
@ -896,7 +911,7 @@
|
|||
this.seenCredits = entityplayer.seenCredits;
|
||||
this.enteredNetherPosition = entityplayer.enteredNetherPosition;
|
||||
this.chunkTrackingView = entityplayer.chunkTrackingView;
|
||||
@@ -1409,6 +1788,12 @@
|
||||
@@ -1493,6 +1873,12 @@
|
||||
|
||||
@Override
|
||||
public boolean teleportTo(WorldServer worldserver, double d0, double d1, double d2, Set<RelativeMovement> set, float f, float f1) {
|
||||
|
@ -909,7 +924,7 @@
|
|||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(BlockPosition.containing(d0, d1, d2));
|
||||
|
||||
worldserver.getChunkSource().addRegionTicket(TicketType.POST_TELEPORT, chunkcoordintpair, 1, this.getId());
|
||||
@@ -1418,9 +1803,9 @@
|
||||
@@ -1502,9 +1888,9 @@
|
||||
}
|
||||
|
||||
if (worldserver == this.level()) {
|
||||
|
@ -921,7 +936,7 @@
|
|||
}
|
||||
|
||||
this.setYHeadRot(f);
|
||||
@@ -1524,6 +1909,16 @@
|
||||
@@ -1606,6 +1992,16 @@
|
||||
}
|
||||
|
||||
public void updateOptions(ClientInformation clientinformation) {
|
||||
|
@ -938,7 +953,7 @@
|
|||
this.language = clientinformation.language();
|
||||
this.requestedViewDistance = clientinformation.viewDistance();
|
||||
this.chatVisibility = clientinformation.chatVisibility();
|
||||
@@ -1607,7 +2002,7 @@
|
||||
@@ -1689,7 +2085,7 @@
|
||||
if (world instanceof WorldServer) {
|
||||
WorldServer worldserver = (WorldServer) world;
|
||||
|
||||
|
@ -947,7 +962,7 @@
|
|||
}
|
||||
|
||||
if (entity != null) {
|
||||
@@ -1644,7 +2039,7 @@
|
||||
@@ -1726,7 +2122,7 @@
|
||||
|
||||
@Nullable
|
||||
public IChatBaseComponent getTabListDisplayName() {
|
||||
|
@ -956,7 +971,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1665,9 +2060,16 @@
|
||||
@@ -1747,9 +2143,16 @@
|
||||
return this.advancements;
|
||||
}
|
||||
|
||||
|
@ -973,7 +988,7 @@
|
|||
if (worldserver == this.level()) {
|
||||
this.connection.teleport(d0, d1, d2, f, f1);
|
||||
} else {
|
||||
@@ -1687,6 +2089,9 @@
|
||||
@@ -1769,6 +2172,9 @@
|
||||
this.server.getPlayerList().sendLevelInfo(this, worldserver);
|
||||
this.server.getPlayerList().sendAllPlayerInfo(this);
|
||||
}
|
||||
|
@ -983,7 +998,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1708,6 +2113,32 @@
|
||||
@@ -1790,6 +2196,32 @@
|
||||
}
|
||||
|
||||
public void setRespawnPosition(ResourceKey<World> resourcekey, @Nullable BlockPosition blockposition, float f, boolean flag, boolean flag1) {
|
||||
|
@ -1016,9 +1031,9 @@
|
|||
if (blockposition != null) {
|
||||
boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension);
|
||||
|
||||
@@ -1913,4 +2344,147 @@
|
||||
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());
|
||||
@@ -2011,4 +2443,147 @@
|
||||
public BlockPosition getRaidOmenPosition() {
|
||||
return this.raidOmenPosition;
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start - Add per-player time and weather.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
+++ b/net/minecraft/server/level/EntityTrackerEntry.java
|
||||
@@ -42,6 +42,12 @@
|
||||
@@ -46,6 +46,12 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
|||
public class EntityTrackerEntry {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -66,8 +72,12 @@
|
||||
@@ -70,8 +76,12 @@
|
||||
private boolean wasOnGround;
|
||||
@Nullable
|
||||
private List<DataWatcher.b<?>> trackedDataValues;
|
||||
private List<DataWatcher.c<?>> trackedDataValues;
|
||||
+ // CraftBukkit start
|
||||
+ private final Set<ServerPlayerConnection> trackedPlayers;
|
||||
|
||||
|
@ -27,27 +27,27 @@
|
|||
this.ap = Vec3D.ZERO;
|
||||
this.lastPassengers = Collections.emptyList();
|
||||
this.level = worldserver;
|
||||
@@ -87,7 +97,7 @@
|
||||
@@ -91,7 +101,7 @@
|
||||
List<Entity> list = this.entity.getPassengers();
|
||||
|
||||
if (!list.equals(this.lastPassengers)) {
|
||||
- this.broadcast.accept(new PacketPlayOutMount(this.entity));
|
||||
+ this.broadcastAndSend(new PacketPlayOutMount(this.entity)); // CraftBukkit
|
||||
removedPassengers(list, this.lastPassengers).forEach((entity) -> {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entity;
|
||||
if (entity instanceof EntityPlayer entityplayer) {
|
||||
entityplayer.connection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
@@ -104,18 +114,18 @@
|
||||
if (entity instanceof EntityItemFrame) {
|
||||
EntityItemFrame entityitemframe = (EntityItemFrame) entity;
|
||||
Entity entity = this.entity;
|
||||
|
||||
if (entity instanceof EntityItemFrame entityitemframe) {
|
||||
- if (this.tickCount % 10 == 0) {
|
||||
+ if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block
|
||||
ItemStack itemstack = entityitemframe.getItem();
|
||||
|
||||
- if (itemstack.getItem() instanceof ItemWorldMap) {
|
||||
+ if (this.tickCount % 10 == 0 && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks
|
||||
Integer integer = ItemWorldMap.getMapId(itemstack);
|
||||
WorldMap worldmap = ItemWorldMap.getSavedData(integer, this.level);
|
||||
MapId mapid = (MapId) itemstack.get(DataComponents.MAP_ID);
|
||||
WorldMap worldmap = ItemWorldMap.getSavedData(mapid, this.level);
|
||||
|
||||
if (worldmap != null) {
|
||||
- Iterator iterator = this.level.players().iterator();
|
||||
|
@ -58,7 +58,7 @@
|
|||
+ EntityPlayer entityplayer = iterator.next().getPlayer(); // CraftBukkit
|
||||
|
||||
worldmap.tickCarriedBy(entityplayer, itemstack);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(integer, entityplayer);
|
||||
Packet<?> packet = worldmap.getUpdatePacket(mapid, entityplayer);
|
||||
@@ -228,7 +238,27 @@
|
||||
|
||||
++this.tickCount;
|
||||
|
@ -85,10 +85,10 @@
|
|||
+ this.broadcastAndSend(new PacketPlayOutEntityVelocity(this.entity));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.entity.hurtMarked = false;
|
||||
}
|
||||
|
||||
@@ -256,7 +286,10 @@
|
||||
entity = this.entity;
|
||||
if (entity instanceof EntityFireball) {
|
||||
EntityFireball entityfireball = (EntityFireball) entity;
|
||||
@@ -263,7 +293,10 @@
|
||||
|
||||
public void sendPairingData(EntityPlayer entityplayer, Consumer<Packet<PacketListenerPlayOut>> consumer) {
|
||||
if (this.entity.isRemoved()) {
|
||||
|
@ -100,7 +100,7 @@
|
|||
}
|
||||
|
||||
Packet<PacketListenerPlayOut> packet = this.entity.getAddEntityPacket();
|
||||
@@ -272,6 +305,12 @@
|
||||
@@ -279,6 +312,12 @@
|
||||
if (this.entity instanceof EntityLiving) {
|
||||
Collection<AttributeModifiable> collection = ((EntityLiving) this.entity).getAttributes().getSyncableAttributes();
|
||||
|
||||
|
@ -113,7 +113,7 @@
|
|||
if (!collection.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutUpdateAttributes(this.entity.getId(), collection));
|
||||
}
|
||||
@@ -303,6 +342,7 @@
|
||||
@@ -310,6 +349,7 @@
|
||||
if (!list.isEmpty()) {
|
||||
consumer.accept(new PacketPlayOutEntityEquipment(this.entity.getId(), list));
|
||||
}
|
||||
|
@ -121,7 +121,7 @@
|
|||
}
|
||||
|
||||
if (!this.entity.getPassengers().isEmpty()) {
|
||||
@@ -338,6 +378,11 @@
|
||||
@@ -343,6 +383,11 @@
|
||||
Set<AttributeModifiable> set = ((EntityLiving) this.entity).getAttributes().getDirtyAttributes();
|
||||
|
||||
if (!set.isEmpty()) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunk.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunk.java
|
||||
@@ -36,6 +36,10 @@
|
||||
import net.minecraft.world.level.chunk.ProtoChunkExtension;
|
||||
@@ -34,6 +34,10 @@
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.level.lighting.LevelLightEngine;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -10,8 +10,8 @@
|
|||
+
|
||||
public class PlayerChunk {
|
||||
|
||||
public static final Either<IChunkAccess, PlayerChunk.Failure> UNLOADED_CHUNK = Either.right(PlayerChunk.Failure.UNLOADED);
|
||||
@@ -72,12 +76,12 @@
|
||||
public static final ChunkResult<IChunkAccess> UNLOADED_CHUNK = ChunkResult.error("Unloaded chunk");
|
||||
@@ -70,12 +74,12 @@
|
||||
this.fullChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.tickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
this.entityTickingChunkFuture = PlayerChunk.UNLOADED_LEVEL_CHUNK_FUTURE;
|
||||
|
@ -27,7 +27,7 @@
|
|||
this.pos = chunkcoordintpair;
|
||||
this.levelHeightAccessor = levelheightaccessor;
|
||||
this.lightEngine = levellightengine;
|
||||
@@ -90,6 +94,20 @@
|
||||
@@ -88,6 +92,20 @@
|
||||
this.changedBlocksPerSection = new ShortSet[levelheightaccessor.getSectionsCount()];
|
||||
}
|
||||
|
||||
|
@ -39,40 +39,25 @@
|
|||
+ }
|
||||
+
|
||||
+ public Chunk getFullChunkNowUnchecked() {
|
||||
+ CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either<IChunkAccess, PlayerChunk.Failure>) statusFuture.getNow(null);
|
||||
+ return (either == null) ? null : (Chunk) either.left().orElse(null);
|
||||
+ CompletableFuture<ChunkResult<IChunkAccess>> statusFuture = this.getFutureIfPresentUnchecked(ChunkStatus.FULL);
|
||||
+ ChunkResult<IChunkAccess> either = statusFuture.getNow(null);
|
||||
+ return (either == null) ? null : (Chunk) either.orElse(null);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
|
||||
public CompletableFuture<ChunkResult<IChunkAccess>> getFutureIfPresentUnchecked(ChunkStatus chunkstatus) {
|
||||
CompletableFuture<ChunkResult<IChunkAccess>> completablefuture = (CompletableFuture) this.futures.get(chunkstatus.getIndex());
|
||||
|
||||
@@ -112,7 +130,7 @@
|
||||
|
||||
@@ -115,9 +133,9 @@
|
||||
@Nullable
|
||||
public Chunk getTickingChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getTickingChunkFuture();
|
||||
- Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
|
||||
+ Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
- return either == null ? null : (Chunk) either.left().orElse((Object) null);
|
||||
+ return either == null ? null : (Chunk) either.left().orElse(null); // CraftBukkit - decompile error
|
||||
- return (Chunk) ((ChunkResult) this.getTickingChunkFuture().getNow(PlayerChunk.UNLOADED_LEVEL_CHUNK)).orElse((Object) null);
|
||||
+ return (Chunk) ((ChunkResult) this.getTickingChunkFuture().getNow(PlayerChunk.UNLOADED_LEVEL_CHUNK)).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public CompletableFuture<?> getChunkSendSyncFuture() {
|
||||
@@ -132,9 +150,9 @@
|
||||
@Nullable
|
||||
public Chunk getFullChunk() {
|
||||
CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture = this.getFullChunkFuture();
|
||||
- Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
|
||||
+ Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
- return either == null ? null : (Chunk) either.left().orElse((Object) null);
|
||||
+ return either == null ? null : (Chunk) either.left().orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -179,6 +197,7 @@
|
||||
@@ -166,6 +184,7 @@
|
||||
if (chunk != null) {
|
||||
int i = this.levelHeightAccessor.getSectionIndex(blockposition.getY());
|
||||
|
||||
|
@ -80,20 +65,16 @@
|
|||
if (this.changedBlocksPerSection[i] == null) {
|
||||
this.hasChangedSections = true;
|
||||
this.changedBlocksPerSection[i] = new ShortOpenHashSet();
|
||||
@@ -189,10 +208,10 @@
|
||||
@@ -176,7 +195,7 @@
|
||||
}
|
||||
|
||||
public void sectionLightChanged(EnumSkyBlock enumskyblock, int i) {
|
||||
- Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow((Object) null);
|
||||
+ Either<IChunkAccess, PlayerChunk.Failure> either = (Either) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(null); // CraftBukkit - decompile error
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) ((ChunkResult) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(PlayerChunk.UNLOADED_CHUNK)).orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) ((ChunkResult) this.getFutureIfPresent(ChunkStatus.INITIALIZE_LIGHT).getNow(PlayerChunk.UNLOADED_CHUNK)).orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (either != null) {
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) either.left().orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) either.left().orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess != null) {
|
||||
ichunkaccess.setUnsaved(true);
|
||||
@@ -257,8 +276,11 @@
|
||||
if (ichunkaccess != null) {
|
||||
ichunkaccess.setUnsaved(true);
|
||||
@@ -240,8 +259,11 @@
|
||||
PacketPlayOutMultiBlockChange packetplayoutmultiblockchange = new PacketPlayOutMultiBlockChange(sectionposition, shortset, chunksection);
|
||||
|
||||
this.broadcast(list, packetplayoutmultiblockchange);
|
||||
|
@ -106,16 +87,16 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
@@ -394,7 +416,7 @@
|
||||
@@ -374,7 +396,7 @@
|
||||
this.pendingFullStateConfirmation = completablefuture1;
|
||||
completablefuture.thenAccept((either) -> {
|
||||
either.ifLeft((chunk) -> {
|
||||
completablefuture.thenAccept((chunkresult) -> {
|
||||
chunkresult.ifSuccess((chunk) -> {
|
||||
- completablefuture1.complete((Object) null);
|
||||
+ completablefuture1.complete(null); // CraftBukkit - decompile error
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -411,6 +433,30 @@
|
||||
@@ -391,6 +413,30 @@
|
||||
boolean flag1 = ChunkLevel.isLoaded(this.ticketLevel);
|
||||
FullChunkStatus fullchunkstatus = ChunkLevel.fullStatus(this.oldTicketLevel);
|
||||
FullChunkStatus fullchunkstatus1 = ChunkLevel.fullStatus(this.ticketLevel);
|
||||
|
@ -123,7 +104,7 @@
|
|||
+ // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins.
|
||||
+ if (fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && !fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ Chunk chunk = (Chunk) either.orElse(null);
|
||||
+ if (chunk != null) {
|
||||
+ playerchunkmap.callbackExecutor.execute(() -> {
|
||||
+ // Minecraft will apply the chunks tick lists to the world once the chunk got loaded, and then store the tick
|
||||
|
@ -145,8 +126,8 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
if (flag) {
|
||||
Either<IChunkAccess, PlayerChunk.Failure> either = Either.right(new PlayerChunk.Failure() {
|
||||
@@ -481,6 +527,26 @@
|
||||
ChunkResult<IChunkAccess> chunkresult = ChunkResult.error(() -> {
|
||||
@@ -459,6 +505,26 @@
|
||||
|
||||
this.onLevelChange.onLevelChange(this.pos, this::getQueueLevel, this.ticketLevel, this::setQueueLevel);
|
||||
this.oldTicketLevel = this.ticketLevel;
|
||||
|
@ -154,7 +135,7 @@
|
|||
+ // ChunkLoadEvent: Called after the chunk is loaded: isChunkLoaded returns true and chunk is ready to be modified by plugins.
|
||||
+ if (!fullchunkstatus.isOrAfter(FullChunkStatus.FULL) && fullchunkstatus1.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ this.getFutureIfPresentUnchecked(ChunkStatus.FULL).thenAccept((either) -> {
|
||||
+ Chunk chunk = (Chunk)either.left().orElse(null);
|
||||
+ Chunk chunk = (Chunk) either.orElse(null);
|
||||
+ if (chunk != null) {
|
||||
+ playerchunkmap.callbackExecutor.execute(() -> {
|
||||
+ chunk.loadCallback();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/PlayerChunkMap.java
|
||||
+++ b/net/minecraft/server/level/PlayerChunkMap.java
|
||||
@@ -101,6 +101,10 @@
|
||||
@@ -104,6 +104,10 @@
|
||||
import org.apache.commons.lang3.mutable.MutableBoolean;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -8,16 +8,13 @@
|
|||
+import org.bukkit.craftbukkit.generator.CustomChunkGenerator;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.c {
|
||||
|
||||
private static final byte CHUNK_TYPE_REPLACEABLE = -1;
|
||||
@@ -141,7 +145,28 @@
|
||||
private final Long2ByteMap chunkTypeCache;
|
||||
private final Long2LongMap chunkSaveCooldowns;
|
||||
private final Queue<Runnable> unloadQueue;
|
||||
- private int serverViewDistance;
|
||||
+ public int serverViewDistance;
|
||||
+
|
||||
@@ -146,6 +150,27 @@
|
||||
public int serverViewDistance;
|
||||
private WorldGenContext worldGenContext;
|
||||
|
||||
+ // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback()
|
||||
+ public final CallbackExecutor callbackExecutor = new CallbackExecutor();
|
||||
+ public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable {
|
||||
|
@ -38,10 +35,11 @@
|
|||
+ }
|
||||
+ };
|
||||
+ // CraftBukkit end
|
||||
|
||||
+
|
||||
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, StructureTemplateManager structuretemplatemanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, ChunkStatusUpdateListener chunkstatusupdatelistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
|
||||
super(convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
@@ -161,6 +186,11 @@
|
||||
super(new RegionStorageInfo(convertable_conversionsession.getLevelId(), worldserver.dimension(), "chunk"), convertable_conversionsession.getDimensionPath(worldserver.dimension()).resolve("region"), datafixer, flag);
|
||||
this.visibleChunkMap = this.updatingChunkMap.clone();
|
||||
@@ -163,6 +188,11 @@
|
||||
this.storageName = path.getFileName().toString();
|
||||
this.level = worldserver;
|
||||
this.generator = chunkgenerator;
|
||||
|
@ -53,11 +51,11 @@
|
|||
IRegistryCustom iregistrycustom = worldserver.registryAccess();
|
||||
long j = worldserver.getSeed();
|
||||
|
||||
@@ -332,9 +362,12 @@
|
||||
CompletableFuture<List<Either<IChunkAccess, PlayerChunk.Failure>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
@@ -332,16 +362,19 @@
|
||||
CompletableFuture<List<ChunkResult<IChunkAccess>>> completablefuture1 = SystemUtils.sequence(list);
|
||||
CompletableFuture<ChunkResult<List<IChunkAccess>>> completablefuture2 = completablefuture1.thenApply((list2) -> {
|
||||
List<IChunkAccess> list3 = Lists.newArrayList();
|
||||
- final int l1 = 0;
|
||||
- int l1 = 0;
|
||||
+ // CraftBukkit start - decompile error
|
||||
+ int cnt = 0;
|
||||
|
||||
|
@ -65,10 +63,18 @@
|
|||
+ for (Iterator iterator = list2.iterator(); iterator.hasNext(); ++cnt) {
|
||||
+ final int l1 = cnt;
|
||||
+ // CraftBukkit end
|
||||
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
||||
ChunkResult<IChunkAccess> chunkresult = (ChunkResult) iterator.next();
|
||||
|
||||
if (either == null) {
|
||||
@@ -540,7 +573,7 @@
|
||||
if (chunkresult == null) {
|
||||
throw this.debugFuturesAndCreateReportedException(new IllegalStateException("At least one of the chunk futures were null"), "n/a");
|
||||
}
|
||||
|
||||
- IChunkAccess ichunkaccess = (IChunkAccess) chunkresult.orElse((Object) null);
|
||||
+ IChunkAccess ichunkaccess = (IChunkAccess) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (ichunkaccess == null) {
|
||||
return ChunkResult.error(() -> {
|
||||
@@ -538,7 +571,7 @@
|
||||
|
||||
private void scheduleUnload(long i, PlayerChunk playerchunk) {
|
||||
CompletableFuture<IChunkAccess> completablefuture = playerchunk.getChunkToSave();
|
||||
|
@ -77,19 +83,16 @@
|
|||
CompletableFuture<IChunkAccess> completablefuture1 = playerchunk.getChunkToSave();
|
||||
|
||||
if (completablefuture1 != completablefuture) {
|
||||
@@ -631,9 +664,9 @@
|
||||
ProtoChunk protochunk = ChunkRegionLoader.read(this.level, this.poiManager, chunkcoordintpair, (NBTTagCompound) optional.get());
|
||||
@@ -708,7 +741,7 @@
|
||||
};
|
||||
|
||||
this.markPosition(chunkcoordintpair, protochunk.getStatus().getChunkType());
|
||||
- return Either.left(protochunk);
|
||||
+ return Either.<IChunkAccess, PlayerChunk.Failure>left(protochunk); // CraftBukkit - decompile error
|
||||
} else {
|
||||
- return Either.left(this.createEmptyChunk(chunkcoordintpair));
|
||||
+ return Either.<IChunkAccess, PlayerChunk.Failure>left(this.createEmptyChunk(chunkcoordintpair)); // CraftBukkit - decompile error
|
||||
}
|
||||
}, this.mainThreadExecutor).exceptionallyAsync((throwable) -> {
|
||||
return this.handleChunkLoadFailure(throwable, chunkcoordintpair);
|
||||
@@ -748,7 +781,21 @@
|
||||
return completablefuture.thenComposeAsync((chunkresult) -> {
|
||||
- List<IChunkAccess> list = (List) chunkresult.orElse((Object) null);
|
||||
+ List<IChunkAccess> list = (List) chunkresult.orElse(null); // CraftBukkit - decompile error
|
||||
|
||||
if (list == null) {
|
||||
this.releaseLightTicket(chunkcoordintpair);
|
||||
@@ -773,7 +806,21 @@
|
||||
|
||||
private static void postLoadProtoChunk(WorldServer worldserver, List<NBTTagCompound> list) {
|
||||
if (!list.isEmpty()) {
|
||||
|
@ -112,7 +115,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -860,7 +907,7 @@
|
||||
@@ -879,7 +926,7 @@
|
||||
if (!playerchunk.wasAccessibleSinceLastSave()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -121,7 +124,7 @@
|
|||
|
||||
if (!(ichunkaccess instanceof ProtoChunkExtension) && !(ichunkaccess instanceof Chunk)) {
|
||||
return false;
|
||||
@@ -1017,7 +1064,8 @@
|
||||
@@ -1040,7 +1087,8 @@
|
||||
return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty();
|
||||
});
|
||||
|
||||
|
@ -131,16 +134,16 @@
|
|||
return chunk.getBlockEntities().size();
|
||||
}).orElse(0), tickingtracker.getTicketDebugString(i), tickingtracker.getLevel(i), optional1.map((chunk) -> {
|
||||
return chunk.getBlockTicks().count();
|
||||
@@ -1030,7 +1078,7 @@
|
||||
@@ -1053,7 +1101,7 @@
|
||||
|
||||
private static String printFuture(CompletableFuture<Either<Chunk, PlayerChunk.Failure>> completablefuture) {
|
||||
private static String printFuture(CompletableFuture<ChunkResult<Chunk>> completablefuture) {
|
||||
try {
|
||||
- Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow((Object) null);
|
||||
+ Either<Chunk, PlayerChunk.Failure> either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
- ChunkResult<Chunk> chunkresult = (ChunkResult) completablefuture.getNow((Object) null);
|
||||
+ ChunkResult<Chunk> chunkresult = (ChunkResult) completablefuture.getNow(null); // CraftBukkit - decompile error
|
||||
|
||||
return either != null ? (String) either.map((chunk) -> {
|
||||
return "done";
|
||||
@@ -1046,12 +1094,14 @@
|
||||
return chunkresult != null ? (chunkresult.isSuccess() ? "done" : "unloaded") : "not completed";
|
||||
} catch (CompletionException completionexception) {
|
||||
@@ -1065,12 +1113,14 @@
|
||||
|
||||
private CompletableFuture<Optional<NBTTagCompound>> readChunk(ChunkCoordIntPair chunkcoordintpair) {
|
||||
return this.read(chunkcoordintpair).thenApplyAsync((optional) -> {
|
||||
|
@ -158,16 +161,16 @@
|
|||
}
|
||||
|
||||
boolean anyPlayerCloseEnoughForSpawning(ChunkCoordIntPair chunkcoordintpair) {
|
||||
@@ -1460,7 +1510,7 @@
|
||||
@@ -1473,7 +1523,7 @@
|
||||
public final Set<ServerPlayerConnection> seenBy = Sets.newIdentityHashSet();
|
||||
|
||||
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
||||
public EntityTracker(final Entity entity, final int i, final int j, final boolean flag) {
|
||||
- this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast);
|
||||
+ this.serverEntity = new EntityTrackerEntry(PlayerChunkMap.this.level, entity, j, flag, this::broadcast, seenBy); // CraftBukkit
|
||||
this.entity = entity;
|
||||
this.range = i;
|
||||
this.lastSectionPos = SectionPosition.of((EntityAccess) entity);
|
||||
@@ -1520,6 +1570,11 @@
|
||||
@@ -1533,6 +1583,11 @@
|
||||
double d2 = d0 * d0;
|
||||
boolean flag = d1 <= d2 && this.entity.broadcastToPlayer(entityplayer) && PlayerChunkMap.this.isChunkTracked(entityplayer, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/level/PlayerInteractManager.java
|
||||
+++ b/net/minecraft/server/level/PlayerInteractManager.java
|
||||
@@ -26,6 +26,27 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
@@ -25,6 +25,27 @@
|
||||
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -28,7 +28,7 @@
|
|||
public class PlayerInteractManager {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -56,9 +77,16 @@
|
||||
@@ -55,9 +76,16 @@
|
||||
if (enumgamemode == this.gameModeForPlayer) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -44,9 +44,9 @@
|
|||
- this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player));
|
||||
+ this.player.server.getPlayerList().broadcastAll(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.a.UPDATE_GAME_MODE, this.player), this.player); // CraftBukkit
|
||||
this.level.updateSleepingPlayerList();
|
||||
return true;
|
||||
}
|
||||
@@ -88,7 +116,7 @@
|
||||
if (enumgamemode == EnumGamemode.CREATIVE) {
|
||||
this.player.resetCurrentImpulseContext();
|
||||
@@ -91,7 +119,7 @@
|
||||
}
|
||||
|
||||
public void tick() {
|
||||
|
@ -55,7 +55,7 @@
|
|||
IBlockData iblockdata;
|
||||
|
||||
if (this.hasDelayedDestroy) {
|
||||
@@ -142,11 +170,33 @@
|
||||
@@ -145,11 +173,33 @@
|
||||
|
||||
if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) {
|
||||
if (!this.level.mayInteract(this.player, blockposition)) {
|
||||
|
@ -89,7 +89,7 @@
|
|||
if (this.isCreative()) {
|
||||
this.destroyAndAck(blockposition, j, "creative destroy");
|
||||
return;
|
||||
@@ -162,11 +212,43 @@
|
||||
@@ -165,11 +215,43 @@
|
||||
float f = 1.0F;
|
||||
|
||||
iblockdata = this.level.getBlockState(blockposition);
|
||||
|
@ -134,7 +134,7 @@
|
|||
if (!iblockdata.isAir() && f >= 1.0F) {
|
||||
this.destroyAndAck(blockposition, j, "insta mine");
|
||||
} else {
|
||||
@@ -211,13 +293,15 @@
|
||||
@@ -214,13 +296,15 @@
|
||||
} else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) {
|
||||
this.isDestroyingBlock = false;
|
||||
if (!Objects.equals(this.destroyPos, blockposition)) {
|
||||
|
@ -151,7 +151,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -235,10 +319,65 @@
|
||||
@@ -238,10 +322,65 @@
|
||||
|
||||
public boolean destroyBlock(BlockPosition blockposition) {
|
||||
IBlockData iblockdata = this.level.getBlockState(blockposition);
|
||||
|
@ -218,7 +218,7 @@
|
|||
TileEntity tileentity = this.level.getBlockEntity(blockposition);
|
||||
Block block = iblockdata.getBlock();
|
||||
|
||||
@@ -248,6 +387,10 @@
|
||||
@@ -251,6 +390,10 @@
|
||||
} else if (this.player.blockActionRestricted(this.level, blockposition, this.gameModeForPlayer)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -229,7 +229,7 @@
|
|||
IBlockData iblockdata1 = block.playerWillDestroy(this.level, blockposition, iblockdata, this.player);
|
||||
boolean flag = this.level.removeBlock(blockposition, false);
|
||||
|
||||
@@ -256,19 +399,32 @@
|
||||
@@ -259,19 +402,32 @@
|
||||
}
|
||||
|
||||
if (this.isCreative()) {
|
||||
|
@ -265,7 +265,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -313,14 +469,54 @@
|
||||
@@ -309,14 +465,53 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,6 @@
|
|||
public EnumInteractionResult useItemOn(EntityPlayer entityplayer, World world, ItemStack itemstack, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) {
|
||||
BlockPosition blockposition = movingobjectpositionblock.getBlockPos();
|
||||
IBlockData iblockdata = world.getBlockState(blockposition);
|
||||
+ EnumInteractionResult enuminteractionresult = EnumInteractionResult.PASS;
|
||||
+ boolean cancelledBlock = false;
|
||||
|
||||
if (!iblockdata.getBlock().isEnabled(world.enabledFeatures())) {
|
||||
|
@ -314,40 +313,18 @@
|
|||
+ entityplayer.connection.send(new PacketPlayOutBlockChange(world, blockposition.above()));
|
||||
+ }
|
||||
+ entityplayer.getBukkitEntity().updateInventory(); // SPIGOT-2867
|
||||
+ enuminteractionresult = (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
|
||||
+ return (event.useItemInHand() != Event.Result.ALLOW) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.PASS;
|
||||
+ } else if (this.gameModeForPlayer == EnumGamemode.SPECTATOR) {
|
||||
+ ITileInventory itileinventory = iblockdata.getMenuProvider(world, blockposition);
|
||||
|
||||
if (itileinventory != null) {
|
||||
entityplayer.openMenu(itileinventory);
|
||||
@@ -334,7 +530,7 @@
|
||||
ItemStack itemstack1 = itemstack.copy();
|
||||
|
||||
if (!flag1) {
|
||||
- EnumInteractionResult enuminteractionresult = iblockdata.use(world, entityplayer, enumhand, movingobjectpositionblock);
|
||||
+ enuminteractionresult = iblockdata.use(world, entityplayer, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.ITEM_USED_ON_BLOCK.trigger(entityplayer, blockposition, itemstack1);
|
||||
@@ -342,7 +538,7 @@
|
||||
@@ -347,7 +542,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!itemstack.isEmpty() && !entityplayer.getCooldowns().isOnCooldown(itemstack.getItem())) {
|
||||
+ if (!itemstack.isEmpty() && enuminteractionresult != EnumInteractionResult.SUCCESS && !interactResult) { // add !interactResult SPIGOT-764
|
||||
+ if (!itemstack.isEmpty() && !interactResult) { // add !interactResult SPIGOT-764
|
||||
ItemActionContext itemactioncontext = new ItemActionContext(entityplayer, enumhand, movingobjectpositionblock);
|
||||
EnumInteractionResult enuminteractionresult1;
|
||||
|
||||
@@ -360,10 +556,10 @@
|
||||
}
|
||||
|
||||
return enuminteractionresult1;
|
||||
- } else {
|
||||
- return EnumInteractionResult.PASS;
|
||||
}
|
||||
}
|
||||
+ return enuminteractionresult;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
public void setLevel(WorldServer worldserver) {
|
||||
if (this.isCreative()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
+++ b/net/minecraft/server/level/RegionLimitedWorldAccess.java
|
||||
@@ -208,7 +208,7 @@
|
||||
@@ -216,7 +216,7 @@
|
||||
if (iblockdata.isAir()) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -9,7 +9,7 @@
|
|||
TileEntity tileentity = iblockdata.hasBlockEntity() ? this.getBlockEntity(blockposition) : null;
|
||||
|
||||
Block.dropResources(iblockdata, this.level, blockposition, tileentity, entity, ItemStack.EMPTY);
|
||||
@@ -327,6 +327,13 @@
|
||||
@@ -335,6 +335,13 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/level/WorldServer.java
|
||||
+++ b/net/minecraft/server/level/WorldServer.java
|
||||
@@ -164,6 +164,26 @@
|
||||
@@ -170,6 +170,23 @@
|
||||
import net.minecraft.world.ticks.TickListServer;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -11,32 +11,29 @@
|
|||
+import net.minecraft.world.level.levelgen.ChunkProviderFlat;
|
||||
+import net.minecraft.world.level.storage.WorldDataServer;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.WeatherType;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
+import org.bukkit.craftbukkit.generator.CustomWorldChunkManager;
|
||||
+import org.bukkit.craftbukkit.util.CraftNamespacedKey;
|
||||
+import org.bukkit.craftbukkit.util.WorldUUID;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+import org.bukkit.event.server.MapInitializeEvent;
|
||||
+import org.bukkit.event.weather.LightningStrikeEvent;
|
||||
+import org.bukkit.event.world.GenericGameEvent;
|
||||
+import org.bukkit.event.world.TimeSkipEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class WorldServer extends World implements GeneratorAccessSeed {
|
||||
|
||||
public static final BlockPosition END_SPAWN_POINT = new BlockPosition(100, 50, 0);
|
||||
@@ -177,7 +197,7 @@
|
||||
@@ -183,7 +200,7 @@
|
||||
final List<EntityPlayer> players;
|
||||
private final ChunkProviderServer chunkSource;
|
||||
private final MinecraftServer server;
|
||||
- public final IWorldDataServer serverLevelData;
|
||||
+ public final WorldDataServer serverLevelData; // CraftBukkit - type
|
||||
private int lastSpawnChunkRadius;
|
||||
final EntityTickList entityTickList;
|
||||
public final PersistentEntitySectionManager<Entity> entityManager;
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
@@ -202,12 +222,30 @@
|
||||
@@ -210,12 +227,30 @@
|
||||
private final boolean tickTime;
|
||||
private final RandomSequences randomSequences;
|
||||
|
||||
|
@ -72,7 +69,7 @@
|
|||
this.players = Lists.newArrayList();
|
||||
this.entityTickList = new EntityTickList();
|
||||
this.blockTicks = new TickListServer<>(this::isPositionTickingWithEntitiesLoaded, this.getProfilerSupplier());
|
||||
@@ -221,6 +259,22 @@
|
||||
@@ -230,6 +265,22 @@
|
||||
this.customSpawners = list;
|
||||
this.serverLevelData = iworlddataserver;
|
||||
ChunkGenerator chunkgenerator = worlddimension.generator();
|
||||
|
@ -94,8 +91,8 @@
|
|||
+ // CraftBukkit end
|
||||
boolean flag2 = minecraftserver.forceSynchronousWrites();
|
||||
DataFixer datafixer = minecraftserver.getFixerUpper();
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(this, convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, minecraftserver);
|
||||
@@ -248,9 +302,9 @@
|
||||
EntityPersistentStorage<Entity> entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver);
|
||||
@@ -257,9 +308,9 @@
|
||||
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 +105,7 @@
|
|||
} else {
|
||||
this.dragonFight = null;
|
||||
}
|
||||
@@ -260,6 +314,7 @@
|
||||
@@ -269,6 +320,7 @@
|
||||
this.randomSequences = (RandomSequences) Objects.requireNonNullElseGet(randomsequences, () -> {
|
||||
return (RandomSequences) this.getDataStorage().computeIfAbsent(RandomSequences.factory(l), "random_sequences");
|
||||
});
|
||||
|
@ -116,7 +113,7 @@
|
|||
}
|
||||
|
||||
/** @deprecated */
|
||||
@@ -304,12 +359,20 @@
|
||||
@@ -313,12 +365,20 @@
|
||||
long j;
|
||||
|
||||
if (this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) {
|
||||
|
@ -140,7 +137,7 @@
|
|||
if (this.getGameRules().getBoolean(GameRules.RULE_WEATHER_CYCLE) && this.isRaining()) {
|
||||
this.resetWeatherCycle();
|
||||
}
|
||||
@@ -344,7 +407,7 @@
|
||||
@@ -353,7 +413,7 @@
|
||||
|
||||
this.handlingTick = false;
|
||||
gameprofilerfiller.pop();
|
||||
|
@ -149,7 +146,7 @@
|
|||
|
||||
if (flag1) {
|
||||
this.resetEmptyTime();
|
||||
@@ -360,7 +423,7 @@
|
||||
@@ -369,7 +429,7 @@
|
||||
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
|
@ -158,7 +155,7 @@
|
|||
entity.discard();
|
||||
} else if (!tickratemanager.isEntityFrozen(entity)) {
|
||||
gameprofilerfiller.push("checkDespawn");
|
||||
@@ -432,7 +495,7 @@
|
||||
@@ -441,7 +501,7 @@
|
||||
|
||||
private void wakeUpAllPlayers() {
|
||||
this.sleepStatus.removeAllSleepers();
|
||||
|
@ -167,7 +164,7 @@
|
|||
entityplayer.stopSleepInBed(false, false);
|
||||
});
|
||||
}
|
||||
@@ -459,7 +522,7 @@
|
||||
@@ -468,7 +528,7 @@
|
||||
entityhorseskeleton.setTrap(true);
|
||||
entityhorseskeleton.setAge(0);
|
||||
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
|
||||
|
@ -176,7 +173,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -468,7 +531,7 @@
|
||||
@@ -477,7 +537,7 @@
|
||||
if (entitylightning != null) {
|
||||
entitylightning.moveTo(Vec3D.atBottomCenterOf(blockposition));
|
||||
entitylightning.setVisualOnly(flag1);
|
||||
|
@ -185,7 +182,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -524,7 +587,7 @@
|
||||
@@ -533,7 +593,7 @@
|
||||
BiomeBase biomebase = (BiomeBase) this.getBiome(blockposition1).value();
|
||||
|
||||
if (biomebase.shouldFreeze(this, blockposition2)) {
|
||||
|
@ -194,7 +191,7 @@
|
|||
}
|
||||
|
||||
if (this.isRaining()) {
|
||||
@@ -540,10 +603,10 @@
|
||||
@@ -549,10 +609,10 @@
|
||||
IBlockData iblockdata1 = (IBlockData) iblockdata.setValue(BlockSnow.LAYERS, j + 1);
|
||||
|
||||
Block.pushEntitiesUp(iblockdata, iblockdata1, this, blockposition1);
|
||||
|
@ -207,7 +204,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -704,6 +767,7 @@
|
||||
@@ -713,6 +773,7 @@
|
||||
this.rainLevel = MathHelper.clamp(this.rainLevel, 0.0F, 1.0F);
|
||||
}
|
||||
|
||||
|
@ -215,7 +212,7 @@
|
|||
if (this.oRainLevel != this.rainLevel) {
|
||||
this.server.getPlayerList().broadcastAll(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.RAIN_LEVEL_CHANGE, this.rainLevel), this.dimension());
|
||||
}
|
||||
@@ -722,15 +786,48 @@
|
||||
@@ -731,15 +792,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));
|
||||
}
|
||||
|
@ -266,7 +263,7 @@
|
|||
}
|
||||
|
||||
public void resetEmptyTime() {
|
||||
@@ -765,6 +862,7 @@
|
||||
@@ -774,6 +868,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickNonPassenger");
|
||||
entity.tick();
|
||||
|
@ -274,7 +271,7 @@
|
|||
this.getProfiler().pop();
|
||||
Iterator iterator = entity.getPassengers().iterator();
|
||||
|
||||
@@ -788,6 +886,7 @@
|
||||
@@ -797,6 +892,7 @@
|
||||
});
|
||||
gameprofilerfiller.incrementCounter("tickPassenger");
|
||||
entity1.rideTick();
|
||||
|
@ -282,7 +279,7 @@
|
|||
gameprofilerfiller.pop();
|
||||
Iterator iterator = entity1.getPassengers().iterator();
|
||||
|
||||
@@ -812,6 +911,7 @@
|
||||
@@ -821,6 +917,7 @@
|
||||
ChunkProviderServer chunkproviderserver = this.getChunkSource();
|
||||
|
||||
if (!flag1) {
|
||||
|
@ -290,7 +287,7 @@
|
|||
if (iprogressupdate != null) {
|
||||
iprogressupdate.progressStartNoAbort(IChatBaseComponent.translatable("menu.savingLevel"));
|
||||
}
|
||||
@@ -829,11 +929,19 @@
|
||||
@@ -838,11 +935,19 @@
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -299,7 +296,7 @@
|
|||
+ WorldServer worldserver1 = this;
|
||||
+
|
||||
+ serverLevelData.setWorldBorder(worldserver1.getWorldBorder().createSettings());
|
||||
+ serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save());
|
||||
+ serverLevelData.setCustomBossEvents(this.server.getCustomBossEvents().save(this.registryAccess()));
|
||||
+ convertable.saveDataTag(this.server.registryAccess(), this.serverLevelData, this.server.getPlayerList().getSingleplayerData());
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -311,7 +308,7 @@
|
|||
}
|
||||
|
||||
this.getChunkSource().getDataStorage().save();
|
||||
@@ -898,15 +1006,37 @@
|
||||
@@ -907,15 +1012,37 @@
|
||||
|
||||
@Override
|
||||
public boolean addFreshEntity(Entity entity) {
|
||||
|
@ -352,7 +349,7 @@
|
|||
}
|
||||
|
||||
public void addDuringCommandTeleport(EntityPlayer entityplayer) {
|
||||
@@ -937,24 +1067,37 @@
|
||||
@@ -946,24 +1073,37 @@
|
||||
this.entityManager.addNewEntity(entityplayer);
|
||||
}
|
||||
|
||||
|
@ -394,7 +391,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -965,13 +1108,35 @@
|
||||
@@ -974,13 +1114,35 @@
|
||||
}
|
||||
|
||||
public void removePlayerImmediately(EntityPlayer entityplayer, Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -431,7 +428,7 @@
|
|||
while (iterator.hasNext()) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
|
||||
|
||||
@@ -980,6 +1145,12 @@
|
||||
@@ -989,6 +1151,12 @@
|
||||
double d1 = (double) blockposition.getY() - entityplayer.getY();
|
||||
double d2 = (double) blockposition.getZ() - entityplayer.getZ();
|
||||
|
||||
|
@ -444,7 +441,7 @@
|
|||
if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) {
|
||||
entityplayer.connection.send(new PacketPlayOutBlockBreakAnimation(i, blockposition, j));
|
||||
}
|
||||
@@ -1039,7 +1210,18 @@
|
||||
@@ -1049,7 +1217,18 @@
|
||||
Iterator iterator = this.navigatingMobs.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
|
@ -464,10 +461,10 @@
|
|||
NavigationAbstract navigationabstract = entityinsentient.getNavigation();
|
||||
|
||||
if (navigationabstract.shouldRecomputePath(blockposition)) {
|
||||
@@ -1101,6 +1283,11 @@
|
||||
@@ -1111,6 +1290,11 @@
|
||||
@Override
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, SoundEffect soundeffect) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, soundeffect);
|
||||
public Explosion explode(@Nullable Entity entity, @Nullable DamageSource damagesource, @Nullable ExplosionDamageCalculator explosiondamagecalculator, double d0, double d1, double d2, float f, boolean flag, World.a world_a, ParticleParam particleparam, ParticleParam particleparam1, Holder<SoundEffect> holder) {
|
||||
Explosion explosion = this.explode(entity, damagesource, explosiondamagecalculator, d0, d1, d2, f, flag, world_a, false, particleparam, particleparam1, holder);
|
||||
+ // CraftBukkit start
|
||||
+ if (explosion.wasCanceled) {
|
||||
+ return explosion;
|
||||
|
@ -476,7 +473,7 @@
|
|||
|
||||
if (!explosion.interactsWithBlocks()) {
|
||||
explosion.clearToBlow();
|
||||
@@ -1173,13 +1360,20 @@
|
||||
@@ -1183,13 +1367,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) {
|
||||
|
@ -499,7 +496,7 @@
|
|||
++j;
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1424,7 @@
|
||||
@@ -1240,7 +1431,7 @@
|
||||
|
||||
@Nullable
|
||||
public BlockPosition findNearestMapStructure(TagKey<Structure> tagkey, BlockPosition blockposition, int i, boolean flag) {
|
||||
|
@ -508,31 +505,31 @@
|
|||
return null;
|
||||
} else {
|
||||
Optional<HolderSet.Named<Structure>> optional = this.registryAccess().registryOrThrow(Registries.STRUCTURE).getTag(tagkey);
|
||||
@@ -1272,11 +1466,22 @@
|
||||
@@ -1282,11 +1473,22 @@
|
||||
@Nullable
|
||||
@Override
|
||||
public WorldMap getMapData(String s) {
|
||||
- return (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), s);
|
||||
public WorldMap getMapData(MapId mapid) {
|
||||
- return (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), mapid.key());
|
||||
+ // CraftBukkit start
|
||||
+ WorldMap worldmap = (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), s);
|
||||
+ WorldMap worldmap = (WorldMap) this.getServer().overworld().getDataStorage().get(WorldMap.factory(), mapid.key());
|
||||
+ if (worldmap != null) {
|
||||
+ worldmap.id = s;
|
||||
+ worldmap.id = mapid;
|
||||
+ }
|
||||
+ return worldmap;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMapData(String s, WorldMap worldmap) {
|
||||
public void setMapData(MapId mapid, WorldMap worldmap) {
|
||||
+ // CraftBukkit start
|
||||
+ worldmap.id = s;
|
||||
+ worldmap.id = mapid;
|
||||
+ MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView);
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ // CraftBukkit end
|
||||
this.getServer().overworld().getDataStorage().set(s, worldmap);
|
||||
this.getServer().overworld().getDataStorage().set(mapid.key(), worldmap);
|
||||
}
|
||||
|
||||
@@ -1574,6 +1779,11 @@
|
||||
@@ -1597,6 +1799,11 @@
|
||||
@Override
|
||||
public void blockUpdated(BlockPosition blockposition, Block block) {
|
||||
if (!this.isDebug()) {
|
||||
|
@ -544,7 +541,7 @@
|
|||
this.updateNeighborsAt(blockposition, block);
|
||||
}
|
||||
|
||||
@@ -1593,12 +1803,12 @@
|
||||
@@ -1616,12 +1823,12 @@
|
||||
}
|
||||
|
||||
public boolean isFlat() {
|
||||
|
@ -559,7 +556,7 @@
|
|||
}
|
||||
|
||||
@Nullable
|
||||
@@ -1621,7 +1831,7 @@
|
||||
@@ -1644,7 +1851,7 @@
|
||||
private static <T> String getTypeCount(Iterable<T> iterable, Function<T, String> function) {
|
||||
try {
|
||||
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
|
||||
|
@ -568,7 +565,7 @@
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = iterator.next();
|
||||
@@ -1630,7 +1840,7 @@
|
||||
@@ -1653,7 +1860,7 @@
|
||||
object2intopenhashmap.addTo(s, 1);
|
||||
}
|
||||
|
||||
|
@ -577,7 +574,7 @@
|
|||
String s1 = (String) entry.getKey();
|
||||
|
||||
return s1 + ":" + entry.getIntValue();
|
||||
@@ -1641,17 +1851,33 @@
|
||||
@@ -1664,17 +1871,33 @@
|
||||
}
|
||||
|
||||
public static void makeObsidianPlatform(WorldServer worldserver) {
|
||||
|
@ -613,7 +610,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1785,6 +2011,8 @@
|
||||
@@ -1812,6 +2035,8 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
|
||||
|
@ -622,7 +619,7 @@
|
|||
}
|
||||
|
||||
public void onTrackingEnd(Entity entity) {
|
||||
@@ -1821,6 +2049,14 @@
|
||||
@@ -1843,6 +2068,14 @@
|
||||
}
|
||||
|
||||
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/server/network/HandshakeListener.java
|
||||
+++ b/net/minecraft/server/network/HandshakeListener.java
|
||||
@@ -11,8 +11,17 @@
|
||||
import net.minecraft.network.protocol.status.ServerPing;
|
||||
@@ -12,8 +12,17 @@
|
||||
import net.minecraft.network.protocol.status.StatusProtocols;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -18,48 +18,52 @@
|
|||
private static final IChatBaseComponent IGNORE_STATUS_REASON = IChatBaseComponent.translatable("disconnect.ignoring_status_request");
|
||||
private final MinecraftServer server;
|
||||
private final NetworkManager connection;
|
||||
@@ -24,9 +33,44 @@
|
||||
@@ -25,6 +34,7 @@
|
||||
|
||||
@Override
|
||||
public void handleIntention(PacketHandshakingInSetProtocol packethandshakinginsetprotocol) {
|
||||
+ this.connection.hostname = packethandshakinginsetprotocol.hostName() + ":" + packethandshakinginsetprotocol.port(); // CraftBukkit - set hostname
|
||||
switch (packethandshakinginsetprotocol.intention()) {
|
||||
case LOGIN:
|
||||
this.connection.setClientboundProtocolAfterHandshake(ClientIntent.LOGIN);
|
||||
+ // CraftBukkit start - Connection throttle
|
||||
+ try {
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ long connectionThrottle = this.server.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
|
||||
this.beginLogin(packethandshakinginsetprotocol, false);
|
||||
@@ -58,6 +68,40 @@
|
||||
|
||||
private void beginLogin(PacketHandshakingInSetProtocol packethandshakinginsetprotocol, boolean flag) {
|
||||
this.connection.setupOutboundProtocol(LoginProtocols.CLIENTBOUND);
|
||||
+ // CraftBukkit start - Connection throttle
|
||||
+ try {
|
||||
+ long currentTime = System.currentTimeMillis();
|
||||
+ long connectionThrottle = this.server.server.getConnectionThrottle();
|
||||
+ InetAddress address = ((java.net.InetSocketAddress) this.connection.getRemoteAddress()).getAddress();
|
||||
+
|
||||
+ synchronized (throttleTracker) {
|
||||
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ IChatMutableComponent chatmessage = IChatBaseComponent.literal("Connection throttled! Please wait before reconnecting.");
|
||||
+ this.connection.send(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.connection.disconnect(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+ synchronized (throttleTracker) {
|
||||
+ if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) {
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ IChatMutableComponent chatmessage = IChatBaseComponent.literal("Connection throttled! Please wait before reconnecting.");
|
||||
+ this.connection.send(new PacketLoginOutDisconnect(chatmessage));
|
||||
+ this.connection.disconnect(chatmessage);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ throttleCounter++;
|
||||
+ if (throttleCounter > 200) {
|
||||
+ throttleCounter = 0;
|
||||
+ throttleTracker.put(address, currentTime);
|
||||
+ throttleCounter++;
|
||||
+ if (throttleCounter > 200) {
|
||||
+ throttleCounter = 0;
|
||||
+
|
||||
+ // Cleanup stale entries
|
||||
+ java.util.Iterator iter = throttleTracker.entrySet().iterator();
|
||||
+ while (iter.hasNext()) {
|
||||
+ java.util.Map.Entry<InetAddress, Long> entry = (java.util.Map.Entry) iter.next();
|
||||
+ if (entry.getValue() > connectionThrottle) {
|
||||
+ iter.remove();
|
||||
+ }
|
||||
+ }
|
||||
+ // Cleanup stale entries
|
||||
+ java.util.Iterator iter = throttleTracker.entrySet().iterator();
|
||||
+ while (iter.hasNext()) {
|
||||
+ java.util.Map.Entry<InetAddress, Long> entry = (java.util.Map.Entry) iter.next();
|
||||
+ if (entry.getValue() > connectionThrottle) {
|
||||
+ iter.remove();
|
||||
+ }
|
||||
+ }
|
||||
+ } catch (Throwable t) {
|
||||
+ org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (packethandshakinginsetprotocol.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
||||
IChatMutableComponent ichatmutablecomponent;
|
||||
+ }
|
||||
+ } catch (Throwable t) {
|
||||
+ org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (packethandshakinginsetprotocol.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
|
||||
IChatMutableComponent ichatmutablecomponent;
|
||||
|
||||
|
|
|
@ -1,28 +1,62 @@
|
|||
--- a/net/minecraft/server/network/LoginListener.java
|
||||
+++ b/net/minecraft/server/network/LoginListener.java
|
||||
@@ -40,6 +40,13 @@
|
||||
@@ -42,8 +42,33 @@
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
-public class LoginListener implements PacketLoginInListener, TickablePacketListener {
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.EnumProtocol;
|
||||
+import net.minecraft.network.protocol.Packet;
|
||||
+import net.minecraft.network.protocol.PlayerConnectionUtils;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
+import org.bukkit.craftbukkit.entity.CraftPlayer;
|
||||
+import org.bukkit.craftbukkit.util.Waitable;
|
||||
+import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
|
||||
+import org.bukkit.event.player.PlayerPreLoginEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class LoginListener implements PacketLoginInListener, TickablePacketListener {
|
||||
+public class LoginListener implements PacketLoginInListener, TickablePacketListener, CraftPlayer.TransferCookieConnection {
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTransferred() {
|
||||
+ return this.transferred;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumProtocol protocol() {
|
||||
+ return EnumProtocol.LOGIN;
|
||||
+ }
|
||||
|
||||
+ @Override
|
||||
+ public void send(Packet<?> packet) {
|
||||
+ this.connection.send(packet);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
private static final AtomicInteger UNIQUE_THREAD_ID = new AtomicInteger(0);
|
||||
@@ -56,6 +63,7 @@
|
||||
@Nullable
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
private static final int MAX_TICKS_BEFORE_LOGIN = 600;
|
||||
@@ -58,6 +83,7 @@
|
||||
private GameProfile authenticatedProfile;
|
||||
private final String serverId;
|
||||
private final boolean transferred;
|
||||
+ private EntityPlayer player; // CraftBukkit
|
||||
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) {
|
||||
public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager, boolean flag) {
|
||||
this.state = LoginListener.EnumProtocolState.HELLO;
|
||||
@@ -81,6 +89,13 @@
|
||||
@@ -74,6 +100,12 @@
|
||||
this.verifyLoginAndFinishConnectionSetup((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ if (this.state == LoginListener.EnumProtocolState.WAITING_FOR_COOKIES && !this.player.getBukkitEntity().isAwaitingCookies()) {
|
||||
+ this.postCookies(this.authenticatedProfile);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.state == LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT && !this.isPlayerAlreadyInWorld((GameProfile) Objects.requireNonNull(this.authenticatedProfile))) {
|
||||
this.finishLoginAndWaitForClient(this.authenticatedProfile);
|
||||
}
|
||||
@@ -84,6 +116,13 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -36,9 +70,9 @@
|
|||
@Override
|
||||
public boolean isAcceptingMessages() {
|
||||
return this.connection.isConnected();
|
||||
@@ -126,7 +141,27 @@
|
||||
@@ -129,7 +168,27 @@
|
||||
this.state = LoginListener.EnumProtocolState.KEY;
|
||||
this.connection.send(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge));
|
||||
this.connection.send(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.challenge, true));
|
||||
} else {
|
||||
- this.startClientVerification(UUIDUtil.createOfflineProfile(this.requestedUsername));
|
||||
+ // CraftBukkit start
|
||||
|
@ -65,7 +99,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -139,10 +174,12 @@
|
||||
@@ -142,10 +201,24 @@
|
||||
|
||||
private void verifyLoginAndFinishConnectionSetup(GameProfile gameprofile) {
|
||||
PlayerList playerlist = this.server.getPlayerList();
|
||||
|
@ -75,13 +109,25 @@
|
|||
|
||||
- if (ichatbasecomponent != null) {
|
||||
- this.disconnect(ichatbasecomponent);
|
||||
+ if (this.player != null) {
|
||||
+ if (this.player.getBukkitEntity().isAwaitingCookies()) {
|
||||
+ this.state = LoginListener.EnumProtocolState.WAITING_FOR_COOKIES;
|
||||
+ } else {
|
||||
+ this.postCookies(gameprofile);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void postCookies(GameProfile gameprofile) {
|
||||
+ PlayerList playerlist = this.server.getPlayerList();
|
||||
+
|
||||
+ if (this.player == null) {
|
||||
+ // this.disconnect(ichatbasecomponent);
|
||||
+ // CraftBukkit end
|
||||
} else {
|
||||
if (this.server.getCompressionThreshold() >= 0 && !this.connection.isMemoryConnection()) {
|
||||
this.connection.send(new PacketLoginOutSetCompression(this.server.getCompressionThreshold()), PacketSendListener.thenRun(() -> {
|
||||
@@ -150,7 +187,7 @@
|
||||
@@ -153,7 +226,7 @@
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -90,7 +136,7 @@
|
|||
|
||||
if (flag) {
|
||||
this.state = LoginListener.EnumProtocolState.WAITING_FOR_DUPE_DISCONNECT;
|
||||
@@ -200,6 +237,12 @@
|
||||
@@ -203,6 +276,12 @@
|
||||
if (profileresult != null) {
|
||||
GameProfile gameprofile = profileresult.profile();
|
||||
|
||||
|
@ -103,7 +149,7 @@
|
|||
LoginListener.LOGGER.info("UUID of player {} is {}", gameprofile.getName(), gameprofile.getId());
|
||||
LoginListener.this.startClientVerification(gameprofile);
|
||||
} else if (LoginListener.this.server.isSingleplayer()) {
|
||||
@@ -217,6 +260,11 @@
|
||||
@@ -220,6 +299,11 @@
|
||||
LoginListener.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.authservers_down"));
|
||||
LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable");
|
||||
}
|
||||
|
@ -115,7 +161,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -233,6 +281,43 @@
|
||||
@@ -236,6 +320,43 @@
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -126,7 +172,7 @@
|
|||
+ java.util.UUID uniqueId = gameprofile.getId();
|
||||
+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server;
|
||||
+
|
||||
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId);
|
||||
+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId, this.transferred);
|
||||
+ server.getPluginManager().callEvent(asyncEvent);
|
||||
+
|
||||
+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) {
|
||||
|
@ -158,13 +204,33 @@
|
|||
+
|
||||
@Override
|
||||
public void handleCustomQueryPacket(ServerboundCustomQueryAnswerPacket serverboundcustomqueryanswerpacket) {
|
||||
this.disconnect(LoginListener.DISCONNECT_UNEXPECTED_QUERY);
|
||||
@@ -242,7 +327,7 @@
|
||||
public void handleLoginAcknowledgement(ServerboundLoginAcknowledgedPacket serverboundloginacknowledgedpacket) {
|
||||
this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
@@ -246,7 +367,7 @@
|
||||
Validate.validState(this.state == LoginListener.EnumProtocolState.PROTOCOL_SWITCHING, "Unexpected login acknowledgement packet", new Object[0]);
|
||||
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile));
|
||||
this.connection.setupOutboundProtocol(ConfigurationProtocols.CLIENTBOUND);
|
||||
CommonListenerCookie commonlistenercookie = CommonListenerCookie.createInitial((GameProfile) Objects.requireNonNull(this.authenticatedProfile), this.transferred);
|
||||
- ServerConfigurationPacketListenerImpl serverconfigurationpacketlistenerimpl = new ServerConfigurationPacketListenerImpl(this.server, this.connection, commonlistenercookie);
|
||||
+ ServerConfigurationPacketListenerImpl serverconfigurationpacketlistenerimpl = new ServerConfigurationPacketListenerImpl(this.server, this.connection, commonlistenercookie, this.player); // CraftBukkit
|
||||
|
||||
this.connection.setListener(serverconfigurationpacketlistenerimpl);
|
||||
this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, serverconfigurationpacketlistenerimpl);
|
||||
serverconfigurationpacketlistenerimpl.startConfiguration();
|
||||
@@ -262,12 +383,18 @@
|
||||
|
||||
@Override
|
||||
public void handleCookieResponse(ServerboundCookieResponsePacket serverboundcookieresponsepacket) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(serverboundcookieresponsepacket, this, this.server);
|
||||
+ if (this.player != null && this.player.getBukkitEntity().handleCookieResponse(serverboundcookieresponsepacket)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
}
|
||||
|
||||
private static enum EnumProtocolState {
|
||||
|
||||
- HELLO, KEY, AUTHENTICATING, NEGOTIATING, VERIFYING, WAITING_FOR_DUPE_DISCONNECT, PROTOCOL_SWITCHING, ACCEPTED;
|
||||
+ HELLO, KEY, AUTHENTICATING, NEGOTIATING, VERIFYING, WAITING_FOR_COOKIES, WAITING_FOR_DUPE_DISCONNECT, PROTOCOL_SWITCHING, ACCEPTED; // CraftBukkit
|
||||
|
||||
private EnumProtocolState() {}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/network/PlayerConnection.java
|
||||
+++ b/net/minecraft/server/network/PlayerConnection.java
|
||||
@@ -183,6 +183,67 @@
|
||||
@@ -190,6 +190,68 @@
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
|||
+import java.util.concurrent.ExecutionException;
|
||||
+import java.util.concurrent.atomic.AtomicInteger;
|
||||
+import java.util.function.Function;
|
||||
+import net.minecraft.network.EnumProtocol;
|
||||
+import net.minecraft.network.chat.OutgoingChatMessage;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityEquipment;
|
||||
|
@ -68,7 +69,7 @@
|
|||
public class PlayerConnection extends ServerCommonPacketListenerImpl implements PacketListenerPlayIn, ServerPlayerConnection, TickablePacketListener {
|
||||
|
||||
static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -194,7 +255,9 @@
|
||||
@@ -203,7 +265,9 @@
|
||||
public final PlayerChunkSender chunkSender;
|
||||
private int tickCount;
|
||||
private int ackBlockChangesUpTo = -1;
|
||||
|
@ -79,16 +80,16 @@
|
|||
private int dropSpamTickCount;
|
||||
private double firstGoodX;
|
||||
private double firstGoodY;
|
||||
@@ -229,7 +292,7 @@
|
||||
@@ -238,7 +302,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.chunkSender = new PlayerChunkSender(networkmanager.isMemoryConnection());
|
||||
networkmanager.setListener(this);
|
||||
this.player = entityplayer;
|
||||
@@ -239,9 +302,25 @@
|
||||
entityplayer.connection = this;
|
||||
@@ -247,9 +311,30 @@
|
||||
|
||||
Objects.requireNonNull(minecraftserver);
|
||||
this.signedMessageDecoder = SignedMessageChain.b.unsigned(uuid, minecraftserver::enforceSecureProfile);
|
||||
|
@ -96,7 +97,7 @@
|
|||
+ this.chatMessageChain = new FutureChain(minecraftserver.chatExecutor); // CraftBukkit - async chat
|
||||
}
|
||||
|
||||
+ // CraftBukkit start - add fields
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ private int lastTick = MinecraftServer.currentTick;
|
||||
+ private int allowedPlayerTicks = 1;
|
||||
+ private int lastDropTick = MinecraftServer.currentTick;
|
||||
|
@ -110,12 +111,17 @@
|
|||
+ private float lastPitch = Float.MAX_VALUE;
|
||||
+ private float lastYaw = Float.MAX_VALUE;
|
||||
+ private boolean justTeleported = false;
|
||||
+
|
||||
+ @Override
|
||||
+ public EnumProtocol protocol() {
|
||||
+ return PacketListenerPlayIn.super.protocol();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public void tick() {
|
||||
if (this.ackBlockChangesUpTo > -1) {
|
||||
@@ -293,15 +372,21 @@
|
||||
@@ -301,15 +386,21 @@
|
||||
}
|
||||
|
||||
this.keepConnectionAlive();
|
||||
|
@ -137,7 +143,7 @@
|
|||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.idling"));
|
||||
}
|
||||
|
||||
@@ -378,6 +463,13 @@
|
||||
@@ -398,6 +489,13 @@
|
||||
|
||||
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lastVehicle) {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
@ -151,7 +157,7 @@
|
|||
double d0 = entity.getX();
|
||||
double d1 = entity.getY();
|
||||
double d2 = entity.getZ();
|
||||
@@ -392,7 +484,33 @@
|
||||
@@ -412,7 +510,33 @@
|
||||
double d9 = entity.getDeltaMovement().lengthSqr();
|
||||
double d10 = d6 * d6 + d7 * d7 + d8 * d8;
|
||||
|
||||
|
@ -186,7 +192,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;
|
||||
@@ -432,14 +550,76 @@
|
||||
@@ -452,14 +576,76 @@
|
||||
}
|
||||
|
||||
entity.absMoveTo(d3, d4, d5, f, f1);
|
||||
|
@ -263,7 +269,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);
|
||||
@@ -473,6 +653,7 @@
|
||||
@@ -493,6 +679,7 @@
|
||||
}
|
||||
|
||||
this.awaitingPositionFromClient = null;
|
||||
|
@ -271,7 +277,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -480,7 +661,7 @@
|
||||
@@ -500,7 +687,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookSeenRecipePacket(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipedisplayed, this, this.player.serverLevel());
|
||||
|
@ -280,7 +286,7 @@
|
|||
RecipeBookServer recipebookserver = this.player.getRecipeBook();
|
||||
|
||||
Objects.requireNonNull(recipebookserver);
|
||||
@@ -490,6 +671,7 @@
|
||||
@@ -510,6 +697,7 @@
|
||||
@Override
|
||||
public void handleRecipeBookChangeSettingsPacket(PacketPlayInRecipeSettings packetplayinrecipesettings) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinrecipesettings, this, this.player.serverLevel());
|
||||
|
@ -288,7 +294,7 @@
|
|||
this.player.getRecipeBook().setBookSetting(packetplayinrecipesettings.getBookType(), packetplayinrecipesettings.isOpen(), packetplayinrecipesettings.isFiltering());
|
||||
}
|
||||
|
||||
@@ -510,6 +692,12 @@
|
||||
@@ -530,6 +718,12 @@
|
||||
@Override
|
||||
public void handleCustomCommandSuggestions(PacketPlayInTabComplete packetplayintabcomplete) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayintabcomplete, this, this.player.serverLevel());
|
||||
|
@ -301,18 +307,18 @@
|
|||
StringReader stringreader = new StringReader(packetplayintabcomplete.getCommand());
|
||||
|
||||
if (stringreader.canRead() && stringreader.peek() == '/') {
|
||||
@@ -519,6 +707,7 @@
|
||||
@@ -539,6 +733,7 @@
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack());
|
||||
|
||||
this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> {
|
||||
+ if (suggestions.isEmpty()) return; // CraftBukkit - don't send through empty suggestions - prevents [<args>] from showing for plugins with nothing more to offer
|
||||
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions));
|
||||
});
|
||||
}
|
||||
@@ -766,6 +955,13 @@
|
||||
Suggestions suggestions1 = suggestions.getList().size() <= 1000 ? suggestions : new Suggestions(suggestions.getRange(), suggestions.getList().subList(0, 1000));
|
||||
|
||||
if (container instanceof ContainerMerchant) {
|
||||
ContainerMerchant containermerchant = (ContainerMerchant) container;
|
||||
this.send(new PacketPlayOutTabComplete(packetplayintabcomplete.getId(), suggestions1));
|
||||
@@ -783,6 +978,13 @@
|
||||
Container container = this.player.containerMenu;
|
||||
|
||||
if (container instanceof ContainerMerchant containermerchant) {
|
||||
+ // CraftBukkit start
|
||||
+ final org.bukkit.event.inventory.TradeSelectEvent tradeSelectEvent = CraftEventFactory.callTradeSelectEvent(this.player, i, containermerchant);
|
||||
+ if (tradeSelectEvent.isCancelled()) {
|
||||
|
@ -320,10 +326,10 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (!containermerchant.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, containermerchant);
|
||||
@@ -780,6 +976,13 @@
|
||||
return;
|
||||
@@ -796,6 +998,13 @@
|
||||
|
||||
@Override
|
||||
public void handleEditBook(PacketPlayInBEdit packetplayinbedit) {
|
||||
|
@ -334,57 +340,53 @@
|
|||
+ }
|
||||
+ this.lastBookTick = MinecraftServer.currentTick;
|
||||
+ // CraftBukkit end
|
||||
int i = packetplayinbedit.getSlot();
|
||||
int i = packetplayinbedit.slot();
|
||||
|
||||
if (PlayerInventory.isHotbarSlot(i) || i == 40) {
|
||||
@@ -788,7 +991,7 @@
|
||||
@@ -804,7 +1013,7 @@
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
- Stream stream = packetplayinbedit.getPages().stream().limit(100L);
|
||||
+ Stream<String> stream = packetplayinbedit.getPages().stream().limit(100L); // CraftBukkit - decompile error
|
||||
- Stream stream = packetplayinbedit.pages().stream().limit(100L);
|
||||
+ Stream<String> stream = packetplayinbedit.pages().stream().limit(100L); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
stream.forEach(list::add);
|
||||
@@ -806,7 +1009,7 @@
|
||||
ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
@@ -819,12 +1028,16 @@
|
||||
}
|
||||
|
||||
private void updateBookContents(List<FilteredText> list, int i) {
|
||||
- ItemStack itemstack = this.player.getInventory().getItem(i);
|
||||
+ // CraftBukkit start
|
||||
+ ItemStack handItem = this.player.getInventory().getItem(i);
|
||||
+ ItemStack itemstack = handItem.copy();
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (itemstack.is(Items.WRITABLE_BOOK)) {
|
||||
- this.updateBookPages(list, UnaryOperator.identity(), itemstack);
|
||||
+ this.updateBookPages(list, UnaryOperator.identity(), itemstack.copy(), i, itemstack); // CraftBukkit
|
||||
List<Filterable<String>> list1 = list.stream().map(this::filterableFromOutgoing).toList();
|
||||
|
||||
itemstack.set(DataComponents.WRITABLE_BOOK_CONTENT, new WritableBookContent(list1));
|
||||
+ CraftEventFactory.handleEditBookEvent(player, i, handItem, itemstack); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,16 +1034,16 @@
|
||||
@@ -835,12 +1048,13 @@
|
||||
ItemStack itemstack1 = itemstack.transmuteCopy(Items.WRITTEN_BOOK, 1);
|
||||
|
||||
this.updateBookPages(list, (s) -> {
|
||||
return IChatBaseComponent.ChatSerializer.toJson(IChatBaseComponent.literal(s));
|
||||
- }, itemstack1);
|
||||
itemstack1.remove(DataComponents.WRITABLE_BOOK_CONTENT);
|
||||
- List<Filterable<IChatBaseComponent>> list1 = list.stream().map((filteredtext1) -> {
|
||||
+ List<Filterable<IChatBaseComponent>> list1 = (List<Filterable<IChatBaseComponent>>) (List) list.stream().map((filteredtext1) -> { // CraftBukkit - decompile error
|
||||
return this.filterableFromOutgoing(filteredtext1).map(IChatBaseComponent::literal);
|
||||
}).toList();
|
||||
|
||||
itemstack1.set(DataComponents.WRITTEN_BOOK_CONTENT, new WrittenBookContent(this.filterableFromOutgoing(filteredtext), this.player.getName().getString(), 0, list1, true));
|
||||
- this.player.getInventory().setItem(i, itemstack1);
|
||||
+ }, itemstack1, i, itemstack); // CraftBukkit
|
||||
+ CraftEventFactory.handleEditBookEvent(player, i, itemstack, itemstack1); // CraftBukkit
|
||||
+ this.player.getInventory().setItem(i, itemstack); // CraftBukkit - event factory updates the hand book
|
||||
}
|
||||
}
|
||||
|
||||
- private void updateBookPages(List<FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack) {
|
||||
+ private void updateBookPages(List<FilteredText> list, UnaryOperator<String> unaryoperator, ItemStack itemstack, int slot, ItemStack handItem) { // CraftBukkit
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
if (this.player.isTextFilteringEnabled()) {
|
||||
- Stream stream = list.stream().map((filteredtext) -> {
|
||||
+ Stream<NBTTagString> stream = list.stream().map((filteredtext) -> { // CraftBukkit - decompile error
|
||||
return NBTTagString.valueOf((String) unaryoperator.apply(filteredtext.filteredOrEmpty()));
|
||||
});
|
||||
|
||||
@@ -866,6 +1069,7 @@
|
||||
}
|
||||
|
||||
itemstack.addTagElement("pages", nbttaglist);
|
||||
+ CraftEventFactory.handleEditBookEvent(player, slot, handItem, itemstack); // CraftBukkit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -922,7 +1126,7 @@
|
||||
@@ -902,7 +1116,7 @@
|
||||
} else {
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
|
||||
|
@ -393,7 +395,7 @@
|
|||
if (this.tickCount == 0) {
|
||||
this.resetPosition();
|
||||
}
|
||||
@@ -932,6 +1136,7 @@
|
||||
@@ -912,6 +1126,7 @@
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot());
|
||||
}
|
||||
|
@ -401,7 +403,7 @@
|
|||
|
||||
} else {
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
@@ -944,7 +1149,15 @@
|
||||
@@ -924,7 +1139,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);
|
||||
|
@ -417,7 +419,7 @@
|
|||
double d3 = this.player.getX();
|
||||
double d4 = this.player.getY();
|
||||
double d5 = this.player.getZ();
|
||||
@@ -964,15 +1177,33 @@
|
||||
@@ -946,15 +1169,33 @@
|
||||
++this.receivedMovePacketCount;
|
||||
int i = this.receivedMovePacketCount - this.knownMovePacketCount;
|
||||
|
||||
|
@ -444,8 +446,8 @@
|
|||
+ 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) || !flag)) {
|
||||
float f2 = flag ? 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()) {
|
||||
|
@ -453,18 +455,18 @@
|
|||
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 +1225,7 @@
|
||||
boolean flag1 = this.player.verticalCollisionBelow;
|
||||
@@ -976,6 +1217,7 @@
|
||||
boolean flag2 = this.player.verticalCollisionBelow;
|
||||
|
||||
this.player.move(EnumMoveType.PLAYER, new Vec3D(d6, d7, d8));
|
||||
+ this.player.onGround = packetplayinflying.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move
|
||||
double d11 = d7;
|
||||
|
||||
d6 = d0 - this.player.getX();
|
||||
@@ -1012,9 +1244,75 @@
|
||||
@@ -994,9 +1236,75 @@
|
||||
}
|
||||
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
if (!this.player.noPhysics && !this.player.isSleeping() && (flag3 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) {
|
||||
- this.teleport(d3, d4, d5, f, f1);
|
||||
+ this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet.
|
||||
this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packetplayinflying.isOnGround());
|
||||
|
@ -536,9 +538,9 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
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);
|
||||
@@ -1055,11 +1353,68 @@
|
||||
boolean flag4 = this.player.isAutoSpinAttack();
|
||||
|
||||
@@ -1043,11 +1351,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -608,7 +610,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;
|
||||
@@ -1071,6 +1426,14 @@
|
||||
@@ -1059,6 +1424,14 @@
|
||||
this.awaitingTeleport = 0;
|
||||
}
|
||||
|
||||
|
@ -621,9 +623,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
this.awaitingTeleportTime = this.tickCount;
|
||||
this.player.resetCurrentImpulseContext();
|
||||
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));
|
||||
@@ -1079,6 +1442,7 @@
|
||||
@@ -1068,6 +1441,7 @@
|
||||
@Override
|
||||
public void handlePlayerAction(PacketPlayInBlockDig packetplayinblockdig) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockdig, this, this.player.serverLevel());
|
||||
|
@ -631,7 +633,7 @@
|
|||
BlockPosition blockposition = packetplayinblockdig.getPos();
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
@@ -1089,14 +1453,46 @@
|
||||
@@ -1078,14 +1452,46 @@
|
||||
if (!this.player.isSpectator()) {
|
||||
ItemStack itemstack = this.player.getItemInHand(EnumHand.OFF_HAND);
|
||||
|
||||
|
@ -680,7 +682,7 @@
|
|||
this.player.drop(false);
|
||||
}
|
||||
|
||||
@@ -1134,6 +1530,7 @@
|
||||
@@ -1123,6 +1529,7 @@
|
||||
@Override
|
||||
public void handleUseItemOn(PacketPlayInUseItem packetplayinuseitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseitem, this, this.player.serverLevel());
|
||||
|
@ -688,15 +690,15 @@
|
|||
this.player.connection.ackBlockChangesUpTo(packetplayinuseitem.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinuseitem.getHand();
|
||||
@@ -1157,6 +1554,7 @@
|
||||
@@ -1145,6 +1552,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)) {
|
||||
if (this.awaitingPositionFromClient == null && worldserver.mayInteract(this.player, blockposition)) {
|
||||
+ this.player.stopUsingItem(); // CraftBukkit - SPIGOT-4706
|
||||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItemOn(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock);
|
||||
|
||||
if (enumdirection == EnumDirection.UP && !enuminteractionresult.consumesAction() && blockposition.getY() >= i - 1 && wasBlockPlacementAttempt(this.player, itemstack)) {
|
||||
@@ -1185,6 +1583,7 @@
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
@@ -1177,6 +1585,7 @@
|
||||
@Override
|
||||
public void handleUseItem(PacketPlayInBlockPlace packetplayinblockplace) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinblockplace, this, this.player.serverLevel());
|
||||
|
@ -704,7 +706,7 @@
|
|||
this.ackBlockChangesUpTo(packetplayinblockplace.getSequence());
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
EnumHand enumhand = packetplayinblockplace.getHand();
|
||||
@@ -1192,6 +1591,49 @@
|
||||
@@ -1184,6 +1593,49 @@
|
||||
|
||||
this.player.resetLastActionTime();
|
||||
if (!itemstack.isEmpty() && itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
|
@ -733,7 +735,7 @@
|
|||
+ cancelled = event.useItemInHand() == Event.Result.DENY;
|
||||
+ } else {
|
||||
+ MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameTags(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ if (player.gameMode.firedInteract && player.gameMode.interactPosition.equals(movingobjectpositionblock.getBlockPos()) && player.gameMode.interactHand == enumhand && ItemStack.isSameItemSameComponents(player.gameMode.interactItemStack, itemstack)) {
|
||||
+ cancelled = player.gameMode.interactResult;
|
||||
+ } else {
|
||||
+ org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation());
|
||||
|
@ -754,7 +756,7 @@
|
|||
EnumInteractionResult enuminteractionresult = this.player.gameMode.useItem(this.player, worldserver, itemstack, enumhand);
|
||||
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1212,7 +1654,7 @@
|
||||
@@ -1204,7 +1656,7 @@
|
||||
Entity entity = packetplayinspectate.getEntity(worldserver);
|
||||
|
||||
if (entity != null) {
|
||||
|
@ -763,7 +765,7 @@
|
|||
return;
|
||||
}
|
||||
}
|
||||
@@ -1235,6 +1677,13 @@
|
||||
@@ -1225,6 +1677,13 @@
|
||||
|
||||
@Override
|
||||
public void onDisconnect(IChatBaseComponent ichatbasecomponent) {
|
||||
|
@ -777,7 +779,7 @@
|
|||
PlayerConnection.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), ichatbasecomponent.getString());
|
||||
this.removePlayerFromWorld();
|
||||
super.onDisconnect(ichatbasecomponent);
|
||||
@@ -1242,10 +1691,18 @@
|
||||
@@ -1232,10 +1691,18 @@
|
||||
|
||||
private void removePlayerFromWorld() {
|
||||
this.chatMessageChain.close();
|
||||
|
@ -797,7 +799,7 @@
|
|||
this.player.getTextFilter().leave();
|
||||
}
|
||||
|
||||
@@ -1260,7 +1717,16 @@
|
||||
@@ -1250,7 +1717,16 @@
|
||||
@Override
|
||||
public void handleSetCarriedItem(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinhelditemslot, this, this.player.serverLevel());
|
||||
|
@ -814,7 +816,7 @@
|
|||
if (this.player.getInventory().selected != packetplayinhelditemslot.getSlot() && this.player.getUsedItemHand() == EnumHand.MAIN_HAND) {
|
||||
this.player.stopUsingItem();
|
||||
}
|
||||
@@ -1269,18 +1735,25 @@
|
||||
@@ -1259,11 +1735,18 @@
|
||||
this.player.resetLastActionTime();
|
||||
} else {
|
||||
PlayerConnection.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString());
|
||||
|
@ -830,55 +832,77 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
if (isChatMessageIllegal(packetplayinchat.message())) {
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
} else {
|
||||
Optional<LastSeenMessages> optional = this.tryHandleChat(packetplayinchat.lastSeenMessages());
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(packetplayinchat.lastSeenMessages());
|
||||
|
||||
if (optional.isPresent()) {
|
||||
- this.server.submit(() -> {
|
||||
+ // this.server.submit(() -> { // CraftBukkit - async chat
|
||||
PlayerChatMessage playerchatmessage;
|
||||
if (!optional.isEmpty()) {
|
||||
@@ -1277,7 +1760,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -1290,7 +1763,7 @@
|
||||
return;
|
||||
}
|
||||
- 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());
|
||||
|
||||
- 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) -> {
|
||||
@@ -1285,19 +1768,36 @@
|
||||
|
||||
this.chatMessageChain.append(completablefuture, (filteredtext) -> {
|
||||
@@ -1298,7 +1771,7 @@
|
||||
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
- });
|
||||
+ // }); // CraftBukkit - async chat
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1313,6 +1786,12 @@
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.server.submit(() -> {
|
||||
+ // CraftBukkit start - SPIGOT-7346: Prevent disconnected players from executing commands
|
||||
+ if (player.hasDisconnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
this.performChatCommand(serverboundchatcommandpacket, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam();
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
@@ -1322,12 +1801,25 @@
|
||||
- });
|
||||
+ }, false); // CraftBukkit - async chat
|
||||
}
|
||||
}
|
||||
|
||||
private void performChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket, LastSeenMessages lastseenmessages) {
|
||||
- ParseResults parseresults = this.parseCommand(serverboundchatcommandpacket.command());
|
||||
@Override
|
||||
public void handleChatCommand(ServerboundChatCommandPacket serverboundchatcommandpacket) {
|
||||
this.tryHandleChat(serverboundchatcommandpacket.command(), () -> {
|
||||
+ // CraftBukkit start - SPIGOT-7346: Prevent disconnected players from executing commands
|
||||
+ if (player.hasDisconnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.performUnsignedChatCommand(serverboundchatcommandpacket.command());
|
||||
this.detectRateSpam();
|
||||
- });
|
||||
+ }, true); // CraftBukkit - sync commands
|
||||
}
|
||||
|
||||
private void performUnsignedChatCommand(String s) {
|
||||
+ // CraftBukkit start
|
||||
+ String command = "/" + serverboundchatcommandpacket.command();
|
||||
+ String command = "/" + s;
|
||||
+ PlayerConnection.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
||||
+
|
||||
+ PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(getCraftPlayer(), command, new LazyPlayerSet(server));
|
||||
+ this.cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ if (event.isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ s = event.getMessage().substring(1);
|
||||
+ // CraftBukkit end
|
||||
ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(s);
|
||||
|
||||
if (this.server.enforceSecureProfile() && SignableCommand.hasSignableArguments(parseresults)) {
|
||||
@@ -1314,19 +1814,37 @@
|
||||
|
||||
if (!optional.isEmpty()) {
|
||||
this.tryHandleChat(serverboundchatcommandsignedpacket.command(), () -> {
|
||||
+ // CraftBukkit start - SPIGOT-7346: Prevent disconnected players from executing commands
|
||||
+ if (player.hasDisconnected()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.performSignedChatCommand(serverboundchatcommandsignedpacket, (LastSeenMessages) optional.get());
|
||||
this.detectRateSpam();
|
||||
- });
|
||||
+ }, true); // CraftBukkit - sync commands
|
||||
}
|
||||
}
|
||||
|
||||
private void performSignedChatCommand(ServerboundChatCommandSignedPacket serverboundchatcommandsignedpacket, LastSeenMessages lastseenmessages) {
|
||||
- ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(serverboundchatcommandsignedpacket.command());
|
||||
+ // CraftBukkit start
|
||||
+ String command = "/" + serverboundchatcommandsignedpacket.command();
|
||||
+ PlayerConnection.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command);
|
||||
+
|
||||
+ PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(getCraftPlayer(), command, new LazyPlayerSet(server));
|
||||
|
@ -889,18 +913,18 @@
|
|||
+ }
|
||||
+ command = event.getMessage().substring(1);
|
||||
+
|
||||
+ ParseResults parseresults = this.parseCommand(command);
|
||||
+ ParseResults<CommandListenerWrapper> parseresults = this.parseCommand(command);
|
||||
+ // CraftBukkit end
|
||||
|
||||
Map map;
|
||||
|
||||
try {
|
||||
- map = this.collectSignedArguments(serverboundchatcommandpacket, SignableCommand.of(parseresults), lastseenmessages);
|
||||
+ map = (serverboundchatcommandpacket.command().equals(command)) ? this.collectSignedArguments(serverboundchatcommandpacket, SignableCommand.of(parseresults), lastseenmessages) : Collections.emptyMap(); // CraftBukkit
|
||||
- map = this.collectSignedArguments(serverboundchatcommandsignedpacket, SignableCommand.of(parseresults), lastseenmessages);
|
||||
+ map = (serverboundchatcommandsignedpacket.command().equals(command)) ? this.collectSignedArguments(serverboundchatcommandsignedpacket, SignableCommand.of(parseresults), lastseenmessages) : Collections.emptyMap(); // CraftBukkit
|
||||
} catch (SignedMessageChain.a signedmessagechain_a) {
|
||||
this.handleMessageDecodeFailure(signedmessagechain_a);
|
||||
return;
|
||||
@@ -1335,10 +1827,10 @@
|
||||
@@ -1334,10 +1852,10 @@
|
||||
|
||||
CommandSigningContext.a commandsigningcontext_a = new CommandSigningContext.a(map);
|
||||
|
||||
|
@ -908,21 +932,36 @@
|
|||
+ parseresults = CommandDispatcher.<CommandListenerWrapper>mapSource(parseresults, (commandlistenerwrapper) -> { // CraftBukkit - decompile error
|
||||
return commandlistenerwrapper.withSigningContext(commandsigningcontext_a, this.chatMessageChain);
|
||||
});
|
||||
- this.server.getCommands().performCommand(parseresults, serverboundchatcommandpacket.command());
|
||||
- this.server.getCommands().performCommand(parseresults, serverboundchatcommandsignedpacket.command());
|
||||
+ this.server.getCommands().performCommand(parseresults, command); // CraftBukkit
|
||||
}
|
||||
|
||||
private void handleMessageDecodeFailure(SignedMessageChain.a signedmessagechain_a) {
|
||||
@@ -1375,7 +1867,7 @@
|
||||
private Optional<LastSeenMessages> tryHandleChat(LastSeenMessages.b lastseenmessages_b) {
|
||||
Optional<LastSeenMessages> optional = this.unpackAndApplyLastSeen(lastseenmessages_b);
|
||||
@@ -1413,14 +1931,20 @@
|
||||
return com_mojang_brigadier_commanddispatcher.parse(s, this.player.createCommandSourceStack());
|
||||
}
|
||||
|
||||
- if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
- private void tryHandleChat(String s, Runnable runnable) {
|
||||
+ private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit
|
||||
if (isChatMessageIllegal(s)) {
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.illegal_characters"));
|
||||
- } else if (this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) {
|
||||
+ } else if (this.player.isRemoved() || this.player.getChatVisibility() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales
|
||||
this.send(new ClientboundSystemChatPacket(IChatBaseComponent.translatable("chat.disabled.options").withStyle(EnumChatFormat.RED), false));
|
||||
return Optional.empty();
|
||||
} else {
|
||||
@@ -1409,6 +1901,116 @@
|
||||
this.player.resetLastActionTime();
|
||||
- this.server.execute(runnable);
|
||||
+ // CraftBukkit start
|
||||
+ if (sync) {
|
||||
+ this.server.execute(runnable);
|
||||
+ } else {
|
||||
+ runnable.run();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1449,6 +1973,116 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1039,7 +1078,7 @@
|
|||
private PlayerChatMessage getSignedMessage(PacketPlayInChat packetplayinchat, LastSeenMessages lastseenmessages) throws SignedMessageChain.a {
|
||||
SignedMessageBody signedmessagebody = new SignedMessageBody(packetplayinchat.message(), packetplayinchat.timeStamp(), packetplayinchat.salt(), lastseenmessages);
|
||||
|
||||
@@ -1416,13 +2018,33 @@
|
||||
@@ -1456,13 +2090,33 @@
|
||||
}
|
||||
|
||||
private void broadcastChatMessage(PlayerChatMessage playerchatmessage) {
|
||||
|
@ -1076,7 +1115,7 @@
|
|||
this.disconnect(IChatBaseComponent.translatable("disconnect.spam"));
|
||||
}
|
||||
|
||||
@@ -1444,13 +2066,62 @@
|
||||
@@ -1484,13 +2138,62 @@
|
||||
@Override
|
||||
public void handleAnimate(PacketPlayInArmAnimation packetplayinarmanimation) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinarmanimation, this, this.player.serverLevel());
|
||||
|
@ -1138,8 +1177,8 @@
|
|||
+ // CraftBukkit end
|
||||
this.player.resetLastActionTime();
|
||||
Entity entity;
|
||||
IJumpable ijumpable;
|
||||
@@ -1532,6 +2203,12 @@
|
||||
|
||||
@@ -1567,6 +2270,12 @@
|
||||
}
|
||||
|
||||
public void sendPlayerChatMessage(PlayerChatMessage playerchatmessage, ChatMessageType.a chatmessagetype_a) {
|
||||
|
@ -1149,10 +1188,10 @@
|
|||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a.toNetwork(this.player.level().registryAccess())));
|
||||
this.send(new ClientboundPlayerChatPacket(playerchatmessage.link().sender(), playerchatmessage.link().index(), playerchatmessage.signature(), playerchatmessage.signedBody().pack(this.messageSignatureCache), playerchatmessage.unsignedContent(), playerchatmessage.filterMask(), chatmessagetype_a));
|
||||
this.addPendingMessage(playerchatmessage);
|
||||
}
|
||||
@@ -1558,6 +2235,7 @@
|
||||
@@ -1594,6 +2303,7 @@
|
||||
@Override
|
||||
public void handleInteract(PacketPlayInUseEntity packetplayinuseentity) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinuseentity, this, this.player.serverLevel());
|
||||
|
@ -1160,9 +1199,9 @@
|
|||
final WorldServer worldserver = this.player.serverLevel();
|
||||
final Entity entity = packetplayinuseentity.getTarget(worldserver);
|
||||
|
||||
@@ -1572,13 +2250,51 @@
|
||||
@@ -1608,13 +2318,51 @@
|
||||
|
||||
if (axisalignedbb.distanceToSqr(this.player.getEyePosition()) < PlayerConnection.MAX_INTERACTION_DISTANCE) {
|
||||
if (this.player.canInteractWithEntity(axisalignedbb, 1.0D)) {
|
||||
packetplayinuseentity.dispatch(new PacketPlayInUseEntity.c() {
|
||||
- private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a) {
|
||||
+ private void performInteraction(EnumHand enumhand, PlayerConnection.a playerconnection_a, PlayerInteractEntityEvent event) { // CraftBukkit
|
||||
|
@ -1190,7 +1229,7 @@
|
|||
+
|
||||
+ if (event.isCancelled() || player.getInventory().getSelected() == null || player.getInventory().getSelected().getItem() != origItem) {
|
||||
+ // Refresh the current entity metadata
|
||||
+ entity.getEntityData().refresh(player);
|
||||
+ entity.refreshEntityData(player);
|
||||
+ // SPIGOT-7136 - Allays
|
||||
+ if (entity instanceof Allay) {
|
||||
+ send(new PacketPlayOutEntityEquipment(entity.getId(), Arrays.stream(EnumItemSlot.values()).map((slot) -> Pair.of(slot, ((EntityLiving) entity).getItemBySlot(slot).copy())).collect(Collectors.toList())));
|
||||
|
@ -1211,9 +1250,9 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
if (enuminteractionresult.consumesAction()) {
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, itemstack1, entity);
|
||||
CriterionTriggers.PLAYER_INTERACTED_WITH_ENTITY.trigger(PlayerConnection.this.player, enuminteractionresult.indicateItemUse() ? itemstack1 : ItemStack.EMPTY, entity);
|
||||
if (enuminteractionresult.shouldSwing()) {
|
||||
@@ -1591,23 +2307,29 @@
|
||||
@@ -1627,19 +2375,20 @@
|
||||
|
||||
@Override
|
||||
public void onInteraction(EnumHand enumhand) {
|
||||
|
@ -1231,22 +1270,25 @@
|
|||
|
||||
@Override
|
||||
public void onAttack() {
|
||||
- if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && !(entity instanceof EntityArrow) && entity != PlayerConnection.this.player) {
|
||||
- if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && entity != PlayerConnection.this.player) {
|
||||
+ // CraftBukkit
|
||||
+ if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && !(entity instanceof EntityArrow) && (entity != PlayerConnection.this.player || player.isSpectator())) {
|
||||
ItemStack itemstack = PlayerConnection.this.player.getItemInHand(EnumHand.MAIN_HAND);
|
||||
+ if (!(entity instanceof EntityItem) && !(entity instanceof EntityExperienceOrb) && (entity != PlayerConnection.this.player || player.isSpectator())) {
|
||||
label23:
|
||||
{
|
||||
if (entity instanceof EntityArrow) {
|
||||
@@ -1657,6 +2406,11 @@
|
||||
}
|
||||
|
||||
if (itemstack.isItemEnabled(worldserver.enabledFeatures())) {
|
||||
PlayerConnection.this.player.attack(entity);
|
||||
+ // CraftBukkit start
|
||||
+ if (!itemstack.isEmpty() && itemstack.getCount() <= -1) {
|
||||
+ player.containerMenu.sendAllDataToRemote();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
PlayerConnection.this.disconnect(IChatBaseComponent.translatable("multiplayer.disconnect.invalid_entity_attacked"));
|
||||
@@ -1630,17 +2352,17 @@
|
||||
}
|
||||
@@ -1680,17 +2434,17 @@
|
||||
case PERFORM_RESPAWN:
|
||||
if (this.player.wonGame) {
|
||||
this.player.wonGame = false;
|
||||
|
@ -1267,7 +1309,7 @@
|
|||
}
|
||||
}
|
||||
break;
|
||||
@@ -1653,15 +2375,21 @@
|
||||
@@ -1703,15 +2457,21 @@
|
||||
@Override
|
||||
public void handleContainerClose(PacketPlayInCloseWindow packetplayinclosewindow) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinclosewindow, this, this.player.serverLevel());
|
||||
|
@ -1291,7 +1333,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);
|
||||
@@ -1674,7 +2402,284 @@
|
||||
@@ -1724,7 +2484,284 @@
|
||||
boolean flag = packetplayinwindowclick.getStateId() != this.player.containerMenu.getStateId();
|
||||
|
||||
this.player.containerMenu.suppressRemoteUpdates();
|
||||
|
@ -1338,7 +1380,7 @@
|
|||
+ if (cursor.isEmpty()) {
|
||||
+ action = packetplayinwindowclick.getButtonNum() == 0 ? InventoryAction.PICKUP_ALL : InventoryAction.PICKUP_HALF;
|
||||
+ } else if (slot.mayPlace(cursor)) {
|
||||
+ if (ItemStack.isSameItemSameTags(clickedItem, cursor)) {
|
||||
+ if (ItemStack.isSameItemSameComponents(clickedItem, cursor)) {
|
||||
+ int toPlace = packetplayinwindowclick.getButtonNum() == 0 ? cursor.getCount() : 1;
|
||||
+ toPlace = Math.min(toPlace, clickedItem.getMaxStackSize() - clickedItem.getCount());
|
||||
+ toPlace = Math.min(toPlace, slot.container.getMaxStackSize() - clickedItem.getCount());
|
||||
|
@ -1354,7 +1396,7 @@
|
|||
+ } else if (cursor.getCount() <= slot.getMaxStackSize()) {
|
||||
+ action = InventoryAction.SWAP_WITH_CURSOR;
|
||||
+ }
|
||||
+ } else if (ItemStack.isSameItemSameTags(cursor, clickedItem)) {
|
||||
+ } else if (ItemStack.isSameItemSameComponents(cursor, clickedItem)) {
|
||||
+ if (clickedItem.getCount() >= 0) {
|
||||
+ if (clickedItem.getCount() + cursor.getCount() <= cursor.getMaxStackSize()) {
|
||||
+ // As of 1.5, this is result slots only
|
||||
|
@ -1577,7 +1619,7 @@
|
|||
ObjectIterator objectiterator = Int2ObjectMaps.fastIterable(packetplayinwindowclick.getChangedSlots()).iterator();
|
||||
|
||||
while (objectiterator.hasNext()) {
|
||||
@@ -1704,9 +2709,18 @@
|
||||
@@ -1754,9 +2791,18 @@
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
PlayerConnection.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu);
|
||||
} else {
|
||||
|
@ -1598,34 +1640,34 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -1714,6 +2728,7 @@
|
||||
@@ -1764,6 +2810,7 @@
|
||||
@Override
|
||||
public void handleContainerButtonClick(PacketPlayInEnchantItem packetplayinenchantitem) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinenchantitem, this, this.player.serverLevel());
|
||||
+ if (this.player.isImmobile()) return; // CraftBukkit
|
||||
this.player.resetLastActionTime();
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.getContainerId() && !this.player.isSpectator()) {
|
||||
if (this.player.containerMenu.containerId == packetplayinenchantitem.containerId() && !this.player.isSpectator()) {
|
||||
if (!this.player.containerMenu.stillValid(this.player)) {
|
||||
@@ -1756,6 +2771,43 @@
|
||||
@@ -1806,6 +2853,43 @@
|
||||
|
||||
boolean flag1 = packetplayinsetcreativeslot.getSlotNum() >= 1 && packetplayinsetcreativeslot.getSlotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getDamageValue() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty();
|
||||
+ if (flag || (flag1 && !ItemStack.matches(this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).getItem(), packetplayinsetcreativeslot.getItem()))) { // Insist on valid slot
|
||||
boolean flag1 = packetplayinsetcreativeslot.slotNum() >= 1 && packetplayinsetcreativeslot.slotNum() <= 45;
|
||||
boolean flag2 = itemstack.isEmpty() || itemstack.getCount() <= itemstack.getMaxStackSize();
|
||||
+ if (flag || (flag1 && !ItemStack.matches(this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).getItem(), packetplayinsetcreativeslot.itemStack()))) { // Insist on valid slot
|
||||
+ // CraftBukkit start - Call click event
|
||||
+ InventoryView inventory = this.player.inventoryMenu.getBukkitView();
|
||||
+ org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packetplayinsetcreativeslot.getItem());
|
||||
+ org.bukkit.inventory.ItemStack item = CraftItemStack.asBukkitCopy(packetplayinsetcreativeslot.itemStack());
|
||||
+
|
||||
+ SlotType type = SlotType.QUICKBAR;
|
||||
+ if (flag) {
|
||||
+ type = SlotType.OUTSIDE;
|
||||
+ } else if (packetplayinsetcreativeslot.getSlotNum() < 36) {
|
||||
+ if (packetplayinsetcreativeslot.getSlotNum() >= 5 && packetplayinsetcreativeslot.getSlotNum() < 9) {
|
||||
+ } else if (packetplayinsetcreativeslot.slotNum() < 36) {
|
||||
+ if (packetplayinsetcreativeslot.slotNum() >= 5 && packetplayinsetcreativeslot.slotNum() < 9) {
|
||||
+ type = SlotType.ARMOR;
|
||||
+ } else {
|
||||
+ type = SlotType.CONTAINER;
|
||||
+ }
|
||||
+ }
|
||||
+ InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packetplayinsetcreativeslot.getSlotNum(), item);
|
||||
+ InventoryCreativeEvent event = new InventoryCreativeEvent(inventory, type, flag ? -999 : packetplayinsetcreativeslot.slotNum(), item);
|
||||
+ cserver.getPluginManager().callEvent(event);
|
||||
+
|
||||
+ itemstack = CraftItemStack.asNMSCopy(event.getCursor());
|
||||
|
@ -1639,8 +1681,8 @@
|
|||
+ break;
|
||||
+ case DENY:
|
||||
+ // Reset the slot
|
||||
+ if (packetplayinsetcreativeslot.getSlotNum() >= 0) {
|
||||
+ this.player.connection.send(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinsetcreativeslot.getSlotNum(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).getItem()));
|
||||
+ if (packetplayinsetcreativeslot.slotNum() >= 0) {
|
||||
+ this.player.connection.send(new PacketPlayOutSetSlot(this.player.inventoryMenu.containerId, this.player.inventoryMenu.incrementStateId(), packetplayinsetcreativeslot.slotNum(), this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).getItem()));
|
||||
+ this.player.connection.send(new PacketPlayOutSetSlot(-1, this.player.inventoryMenu.incrementStateId(), -1, ItemStack.EMPTY));
|
||||
+ }
|
||||
+ return;
|
||||
|
@ -1649,8 +1691,8 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
if (flag1 && flag2) {
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.getSlotNum()).setByPlayer(itemstack);
|
||||
@@ -1778,6 +2830,7 @@
|
||||
this.player.inventoryMenu.getSlot(packetplayinsetcreativeslot.slotNum()).setByPlayer(itemstack);
|
||||
@@ -1828,6 +2912,7 @@
|
||||
}
|
||||
|
||||
private void updateSignText(PacketPlayInUpdateSign packetplayinupdatesign, List<FilteredText> list) {
|
||||
|
@ -1658,7 +1700,7 @@
|
|||
this.player.resetLastActionTime();
|
||||
WorldServer worldserver = this.player.serverLevel();
|
||||
BlockPosition blockposition = packetplayinupdatesign.getPos();
|
||||
@@ -1799,7 +2852,17 @@
|
||||
@@ -1849,7 +2934,17 @@
|
||||
@Override
|
||||
public void handlePlayerAbilities(PacketPlayInAbilities packetplayinabilities) {
|
||||
PlayerConnectionUtils.ensureRunningOnSameThread(packetplayinabilities, this, this.player.serverLevel());
|
||||
|
@ -1677,12 +1719,12 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -1858,7 +2921,7 @@
|
||||
@@ -1908,7 +3003,7 @@
|
||||
if (!this.waitingForSwitchToConfig) {
|
||||
throw new IllegalStateException("Client acknowledged config, but none was requested");
|
||||
} else {
|
||||
- this.connection.setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())));
|
||||
+ this.connection.setListener(new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation()), this.player)); // CraftBukkit
|
||||
- this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation())));
|
||||
+ this.connection.setupInboundProtocol(ConfigurationProtocols.SERVERBOUND, new ServerConfigurationPacketListenerImpl(this.server, this.connection, this.createCookie(this.player.clientInformation()), this.player)); // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -26,6 +26,21 @@
|
||||
@@ -27,8 +27,28 @@
|
||||
import net.minecraft.util.thread.IAsyncTaskHandler;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
-public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
|
||||
+// CraftBukkit start
|
||||
+import io.netty.buffer.ByteBuf;
|
||||
+import java.util.concurrent.ExecutionException;
|
||||
+import net.minecraft.EnumChatFormat;
|
||||
+import net.minecraft.network.protocol.common.custom.DiscardedPayload;
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutSpawnPosition;
|
||||
+import net.minecraft.resources.MinecraftKey;
|
||||
+import net.minecraft.server.level.EntityPlayer;
|
||||
|
@ -17,12 +19,18 @@
|
|||
+import org.bukkit.craftbukkit.util.Waitable;
|
||||
+import org.bukkit.event.player.PlayerKickEvent;
|
||||
+import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener {
|
||||
|
||||
+public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, CraftPlayer.TransferCookieConnection {
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isTransferred() {
|
||||
+ return this.transferred;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -39,11 +54,22 @@
|
||||
public static final int LATENCY_CHECK_INTERVAL = 15000;
|
||||
private static final int CLOSED_LISTENER_TIMEOUT = 15000;
|
||||
@@ -45,12 +65,24 @@
|
||||
private int latency;
|
||||
private volatile boolean suspendFlushingOnServerThread = false;
|
||||
|
||||
|
@ -32,8 +40,10 @@
|
|||
this.connection = networkmanager;
|
||||
this.keepAliveTime = SystemUtils.getMillis();
|
||||
this.latency = commonlistenercookie.latency();
|
||||
this.transferred = commonlistenercookie.transferred();
|
||||
+ // CraftBukkit start - add fields and methods
|
||||
+ this.player = player;
|
||||
+ this.player.transferCookieConnection = this;
|
||||
+ this.cserver = minecraftserver.server;
|
||||
+ }
|
||||
+ protected final EntityPlayer player;
|
||||
|
@ -45,8 +55,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,6 +83,7 @@
|
||||
private void close() {
|
||||
@@ -72,6 +104,7 @@
|
||||
|
||||
@Override
|
||||
public void handleKeepAlive(ServerboundKeepAlivePacket serverboundkeepalivepacket) {
|
||||
|
@ -54,7 +64,7 @@
|
|||
if (this.keepAlivePending && serverboundkeepalivepacket.getId() == this.keepAliveChallenge) {
|
||||
int i = (int) (SystemUtils.getMillis() - this.keepAliveTime);
|
||||
|
||||
@@ -71,8 +98,56 @@
|
||||
@@ -86,8 +119,56 @@
|
||||
@Override
|
||||
public void handlePong(ServerboundPongPacket serverboundpongpacket) {}
|
||||
|
||||
|
@ -65,12 +75,12 @@
|
|||
@Override
|
||||
- public void handleCustomPayload(ServerboundCustomPayloadPacket serverboundcustompayloadpacket) {}
|
||||
+ public void handleCustomPayload(ServerboundCustomPayloadPacket serverboundcustompayloadpacket) {
|
||||
+ if (!(serverboundcustompayloadpacket.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
|
||||
+ if (!(serverboundcustompayloadpacket.payload() instanceof DiscardedPayload)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(serverboundcustompayloadpacket, this, this.player.serverLevel());
|
||||
+ MinecraftKey identifier = serverboundcustompayloadpacket.payload().id();
|
||||
+ ByteBuf payload = ((ServerboundCustomPayloadPacket.UnknownPayload)serverboundcustompayloadpacket.payload()).data();
|
||||
+ MinecraftKey identifier = serverboundcustompayloadpacket.payload().type().id();
|
||||
+ ByteBuf payload = ((DiscardedPayload)serverboundcustompayloadpacket.payload()).data();
|
||||
+
|
||||
+ if (identifier.equals(CUSTOM_REGISTER)) {
|
||||
+ try {
|
||||
|
@ -112,7 +122,7 @@
|
|||
|
||||
@Override
|
||||
public void handleResourcePackResponse(ServerboundResourcePackPacket serverboundresourcepackpacket) {
|
||||
@@ -81,6 +156,7 @@
|
||||
@@ -96,11 +177,18 @@
|
||||
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), serverboundresourcepackpacket.id());
|
||||
this.disconnect(IChatBaseComponent.translatable("multiplayer.requiredTexturePrompt.disconnect"));
|
||||
}
|
||||
|
@ -120,16 +130,27 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -88,7 +164,7 @@
|
||||
@Override
|
||||
public void handleCookieResponse(ServerboundCookieResponsePacket serverboundcookieresponsepacket) {
|
||||
+ // CraftBukkit start
|
||||
+ PlayerConnectionUtils.ensureRunningOnSameThread(serverboundcookieresponsepacket, this, (IAsyncTaskHandler) this.server);
|
||||
+ if (this.player.getBukkitEntity().handleCookieResponse(serverboundcookieresponsepacket)) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.disconnect(ServerCommonPacketListenerImpl.DISCONNECT_UNEXPECTED_QUERY);
|
||||
}
|
||||
|
||||
@@ -108,7 +196,7 @@
|
||||
this.server.getProfiler().push("keepAlive");
|
||||
long i = SystemUtils.getMillis();
|
||||
|
||||
- if (i - this.keepAliveTime >= 15000L) {
|
||||
+ if (i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
||||
- if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 15000L) {
|
||||
+ if (!this.isSingleplayerOwner() && i - this.keepAliveTime >= 25000L) { // CraftBukkit
|
||||
if (this.keepAlivePending) {
|
||||
this.disconnect(ServerCommonPacketListenerImpl.TIMEOUT_DISCONNECTION_MESSAGE);
|
||||
} else {
|
||||
@@ -116,6 +192,14 @@
|
||||
} else if (this.checkIfClosed(i)) {
|
||||
@@ -148,6 +236,14 @@
|
||||
}
|
||||
|
||||
public void send(Packet<?> packet, @Nullable PacketSendListener packetsendlistener) {
|
||||
|
@ -141,10 +162,10 @@
|
|||
+ this.player.compassTarget = CraftLocation.toBukkit(packet6.pos, this.getCraftPlayer().getWorld());
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
boolean flag = !this.suspendFlushingOnServerThread || !this.server.isSameThread();
|
||||
|
||||
try {
|
||||
@@ -131,16 +215,67 @@
|
||||
if (packet.isTerminal()) {
|
||||
this.close();
|
||||
}
|
||||
@@ -167,16 +263,67 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,35 @@
|
|||
--- a/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
+++ b/net/minecraft/server/network/ServerConfigurationPacketListenerImpl.java
|
||||
@@ -44,8 +44,8 @@
|
||||
private ConfigurationTask currentTask;
|
||||
private ClientInformation clientInformation;
|
||||
@@ -35,6 +35,10 @@
|
||||
import net.minecraft.world.flag.FeatureFlags;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.EnumProtocol;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public class ServerConfigurationPacketListenerImpl extends ServerCommonPacketListenerImpl implements ServerConfigurationPacketListener, TickablePacketListener {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -47,8 +51,15 @@
|
||||
@Nullable
|
||||
private SynchronizeRegistriesTask synchronizeRegistriesTask;
|
||||
|
||||
- public ServerConfigurationPacketListenerImpl(MinecraftServer minecraftserver, NetworkManager networkmanager, CommonListenerCookie commonlistenercookie) {
|
||||
- super(minecraftserver, networkmanager, commonlistenercookie);
|
||||
+ public ServerConfigurationPacketListenerImpl(MinecraftServer minecraftserver, NetworkManager networkmanager, CommonListenerCookie commonlistenercookie, EntityPlayer player) { // CraftBukkit
|
||||
+ super(minecraftserver, networkmanager, commonlistenercookie, player); // CraftBukkit
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public EnumProtocol protocol() {
|
||||
+ return ServerConfigurationPacketListener.super.protocol();
|
||||
+ }
|
||||
+
|
||||
+ public ServerConfigurationPacketListenerImpl(MinecraftServer minecraftserver, NetworkManager networkmanager, CommonListenerCookie commonlistenercookie, EntityPlayer player) {
|
||||
+ super(minecraftserver, networkmanager, commonlistenercookie, player);
|
||||
+ // CraftBukkit end
|
||||
this.gameProfile = commonlistenercookie.gameProfile();
|
||||
this.clientInformation = commonlistenercookie.clientInformation();
|
||||
}
|
||||
@@ -117,14 +117,14 @@
|
||||
@@ -134,14 +145,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -27,4 +45,4 @@
|
|||
+ EntityPlayer entityplayer = playerlist.getPlayerForLogin(this.gameProfile, this.clientInformation, this.player); // CraftBukkit
|
||||
|
||||
playerlist.placeNewPlayer(this.connection, entityplayer, this.createCookie(this.clientInformation));
|
||||
this.connection.resumeInboundAfterProtocolChange();
|
||||
} catch (Exception exception) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/server/network/ServerConnection.java
|
||||
+++ b/net/minecraft/server/network/ServerConnection.java
|
||||
@@ -98,15 +98,25 @@
|
||||
@@ -100,15 +100,25 @@
|
||||
|
||||
NetworkManager.configureSerialization(channelpipeline, EnumProtocolDirection.SERVERBOUND, (BandwidthDebugMonitor) null);
|
||||
NetworkManager.configureSerialization(channelpipeline, EnumProtocolDirection.SERVERBOUND, false, (BandwidthDebugMonitor) null);
|
||||
int j = ServerConnection.this.server.getRateLimitPacketsPerSecond();
|
||||
- Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND);
|
||||
+ NetworkManager object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND); // CraftBukkit - decompile error
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/server/players/PlayerList.java
|
||||
+++ b/net/minecraft/server/players/PlayerList.java
|
||||
@@ -101,6 +101,27 @@
|
||||
@@ -103,6 +103,27 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
|||
public abstract class PlayerList {
|
||||
|
||||
public static final File USERBANLIST_FILE = new File("banned-players.json");
|
||||
@@ -113,14 +134,16 @@
|
||||
@@ -115,14 +136,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;
|
||||
|
@ -48,7 +48,7 @@
|
|||
public final WorldNBTStorage playerIo;
|
||||
private boolean doWhiteList;
|
||||
private final LayeredRegistryAccess<RegistryLayer> registries;
|
||||
@@ -131,13 +154,23 @@
|
||||
@@ -133,13 +156,23 @@
|
||||
private static final boolean ALLOW_LOGOUTIVATOR = false;
|
||||
private int sendAllPlayerInfoIn;
|
||||
|
||||
|
@ -74,32 +74,47 @@
|
|||
this.server = minecraftserver;
|
||||
this.registries = layeredregistryaccess;
|
||||
this.maxPlayers = i;
|
||||
@@ -160,15 +193,21 @@
|
||||
@@ -149,25 +182,34 @@
|
||||
public void placeNewPlayer(NetworkManager networkmanager, EntityPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
|
||||
GameProfile gameprofile = entityplayer.getGameProfile();
|
||||
UserCache usercache = this.server.getProfileCache();
|
||||
- Optional optional;
|
||||
+ // Optional optional; // CraftBukkit - decompile error
|
||||
String s;
|
||||
|
||||
NBTTagCompound nbttagcompound = this.load(entityplayer);
|
||||
ResourceKey resourcekey;
|
||||
if (usercache != null) {
|
||||
- optional = usercache.get(gameprofile.getId());
|
||||
+ Optional<GameProfile> optional = usercache.get(gameprofile.getId()); // CraftBukkit - decompile error
|
||||
s = (String) optional.map(GameProfile::getName).orElse(gameprofile.getName());
|
||||
usercache.add(gameprofile);
|
||||
} else {
|
||||
s = gameprofile.getName();
|
||||
}
|
||||
|
||||
- optional = this.load(entityplayer);
|
||||
+ Optional<NBTTagCompound> optional = this.load(entityplayer); // CraftBukkit - decompile error
|
||||
+ // CraftBukkit start - Better rename detection
|
||||
+ if (nbttagcompound != null && nbttagcompound.contains("bukkit")) {
|
||||
+ NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit");
|
||||
+ s = bukkit.contains("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
|
||||
+ if (optional.isPresent()) {
|
||||
+ NBTTagCompound nbttagcompound = optional.get();
|
||||
+ if (nbttagcompound.contains("bukkit")) {
|
||||
+ NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit");
|
||||
+ s = bukkit.contains("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s;
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (nbttagcompound != null) {
|
||||
ResourceKey<World> resourcekey = (ResourceKey) optional.flatMap((nbttagcompound) -> {
|
||||
- DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension")));
|
||||
+ DataResult<ResourceKey<World>> dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("Dimension"))); // CraftBukkit - decompile error
|
||||
Logger logger = PlayerList.LOGGER;
|
||||
|
||||
Objects.requireNonNull(logger);
|
||||
- resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(World.OVERWORLD);
|
||||
+ resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElse(entityplayer.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||
} else {
|
||||
- resourcekey = World.OVERWORLD;
|
||||
+ resourcekey = entityplayer.serverLevel().dimension(); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||
}
|
||||
return dataresult.resultOrPartial(logger::error);
|
||||
- }).orElse(World.OVERWORLD);
|
||||
+ }).orElse(entityplayer.serverLevel().dimension()); // CraftBukkit - SPIGOT-7507: If no dimension, fall back to existing dimension loaded from "WorldUUID", which in turn defaults to World.OVERWORLD
|
||||
WorldServer worldserver = this.server.getLevel(resourcekey);
|
||||
WorldServer worldserver1;
|
||||
|
||||
ResourceKey<World> resourcekey1 = resourcekey;
|
||||
@@ -185,7 +224,8 @@
|
||||
@@ -181,10 +223,11 @@
|
||||
entityplayer.setServerLevel(worldserver1);
|
||||
String s1 = networkmanager.getLoggableAddress(this.server.logIPs());
|
||||
|
||||
|
@ -108,16 +123,20 @@
|
|||
+ // PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ({}, {}, {})", new Object[]{entityplayer.getName().getString(), s1, entityplayer.getId(), entityplayer.getX(), entityplayer.getY(), entityplayer.getZ()});
|
||||
WorldData worlddata = worldserver1.getLevelData();
|
||||
|
||||
entityplayer.loadGameTypes(nbttagcompound);
|
||||
@@ -196,6 +236,7 @@
|
||||
- entityplayer.loadGameTypes((NBTTagCompound) optional.orElse((Object) null));
|
||||
+ entityplayer.loadGameTypes((NBTTagCompound) optional.orElse(null)); // CraftBukkit - decompile error
|
||||
PlayerConnection playerconnection = new PlayerConnection(this.server, networkmanager, entityplayer, commonlistenercookie);
|
||||
|
||||
networkmanager.setupInboundProtocol(GameProtocols.SERVERBOUND.bind(RegistryFriendlyByteBuf.decorator(this.server.registryAccess())), playerconnection);
|
||||
@@ -194,6 +237,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)));
|
||||
playerconnection.send(new PacketPlayOutLogin(entityplayer.getId(), worlddata.isHardcore(), this.server.levelKeys(), this.getMaxPlayers(), this.viewDistance, this.simulationDistance, flag1, !flag, flag2, entityplayer.createCommonSpawnInfo(worldserver1), this.server.enforceSecureProfile()));
|
||||
+ entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit
|
||||
playerconnection.send(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked()));
|
||||
playerconnection.send(new PacketPlayOutAbilities(entityplayer.getAbilities()));
|
||||
playerconnection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
@@ -212,8 +253,10 @@
|
||||
@@ -210,8 +254,10 @@
|
||||
} else {
|
||||
ichatmutablecomponent = IChatBaseComponent.translatable("multiplayer.player.joined.renamed", entityplayer.getDisplayName(), s);
|
||||
}
|
||||
|
@ -129,7 +148,7 @@
|
|||
playerconnection.teleport(entityplayer.getX(), entityplayer.getY(), entityplayer.getZ(), entityplayer.getYRot(), entityplayer.getXRot());
|
||||
ServerPing serverping = this.server.getStatus();
|
||||
|
||||
@@ -221,13 +264,64 @@
|
||||
@@ -219,13 +265,64 @@
|
||||
entityplayer.sendServerStatus(serverping);
|
||||
}
|
||||
|
||||
|
@ -181,7 +200,7 @@
|
|||
+ entityplayer.sentListPacket = true;
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ entityplayer.getEntityData().refresh(entityplayer); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+ entityplayer.refreshEntityData(entityplayer); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn
|
||||
+
|
||||
this.sendLevelInfo(entityplayer, worldserver1);
|
||||
- worldserver1.addNewPlayer(entityplayer);
|
||||
|
@ -198,21 +217,18 @@
|
|||
Iterator iterator = entityplayer.getActiveEffects().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -238,8 +332,11 @@
|
||||
@@ -236,8 +333,9 @@
|
||||
|
||||
if (nbttagcompound != null && nbttagcompound.contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle");
|
||||
- Entity entity = EntityTypes.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), worldserver1, (entity1) -> {
|
||||
if (optional.isPresent() && ((NBTTagCompound) optional.get()).contains("RootVehicle", 10)) {
|
||||
NBTTagCompound nbttagcompound = ((NBTTagCompound) optional.get()).getCompound("RootVehicle");
|
||||
+ WorldServer finalWorldServer = worldserver1; // CraftBukkit - decompile error
|
||||
Entity entity = EntityTypes.loadEntityRecursive(nbttagcompound.getCompound("Entity"), worldserver1, (entity1) -> {
|
||||
- return !worldserver1.addWithUUID(entity1) ? null : entity1;
|
||||
+ // CraftBukkit start
|
||||
+ WorldServer finalWorldServer = worldserver1;
|
||||
+ Entity entity = EntityTypes.loadEntityRecursive(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> {
|
||||
+ return !finalWorldServer.addWithUUID(entity1) ? null : entity1;
|
||||
+ // CraftBukkit end
|
||||
+ return !finalWorldServer.addWithUUID(entity1) ? null : entity1; // CraftBukkit - decompile error
|
||||
});
|
||||
|
||||
if (entity != null) {
|
||||
@@ -270,18 +367,20 @@
|
||||
@@ -268,18 +366,20 @@
|
||||
|
||||
if (!entityplayer.isPassenger()) {
|
||||
PlayerList.LOGGER.warn("Couldn't reattach entity to player");
|
||||
|
@ -235,7 +251,7 @@
|
|||
}
|
||||
|
||||
public void updateEntireScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
|
||||
@@ -318,30 +417,31 @@
|
||||
@@ -316,30 +416,31 @@
|
||||
}
|
||||
|
||||
public void addWorldborderListener(WorldServer worldserver) {
|
||||
|
@ -272,7 +288,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -369,14 +469,15 @@
|
||||
@@ -366,14 +467,15 @@
|
||||
}
|
||||
|
||||
protected void save(EntityPlayer entityplayer) {
|
||||
|
@ -290,7 +306,7 @@
|
|||
|
||||
if (advancementdataplayer != null) {
|
||||
advancementdataplayer.save();
|
||||
@@ -384,10 +485,24 @@
|
||||
@@ -381,10 +483,24 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -316,7 +332,7 @@
|
|||
this.save(entityplayer);
|
||||
if (entityplayer.isPassenger()) {
|
||||
Entity entity = entityplayer.getRootVehicle();
|
||||
@@ -396,7 +511,7 @@
|
||||
@@ -393,7 +509,7 @@
|
||||
PlayerList.LOGGER.debug("Removing player mount");
|
||||
entityplayer.stopRiding();
|
||||
entity.getPassengersAndSelf().forEach((entity1) -> {
|
||||
|
@ -325,7 +341,7 @@
|
|||
});
|
||||
}
|
||||
}
|
||||
@@ -411,17 +526,65 @@
|
||||
@@ -408,17 +524,66 @@
|
||||
|
||||
if (entityplayer1 == entityplayer) {
|
||||
this.playersByUUID.remove(uuid);
|
||||
|
@ -390,13 +406,14 @@
|
|||
+ SocketAddress socketaddress = loginlistener.connection.getRemoteAddress();
|
||||
+
|
||||
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getLevel(World.OVERWORLD), gameprofile, ClientInformation.createDefault());
|
||||
+ entity.transferCookieConnection = loginlistener;
|
||||
+ Player player = entity.getBukkitEntity();
|
||||
+ PlayerLoginEvent event = new PlayerLoginEvent(player, loginlistener.connection.hostname, ((java.net.InetSocketAddress) socketaddress).getAddress());
|
||||
+
|
||||
if (this.bans.isBanned(gameprofile)) {
|
||||
GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.bans.get(gameprofile);
|
||||
|
||||
@@ -430,9 +593,11 @@
|
||||
@@ -427,9 +592,11 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned.expiration", PlayerList.BAN_DATE_FORMAT.format(gameprofilebanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -410,7 +427,7 @@
|
|||
} else if (this.ipBans.isBanned(socketaddress)) {
|
||||
IpBanEntry ipbanentry = this.ipBans.get(socketaddress);
|
||||
|
||||
@@ -441,17 +606,32 @@
|
||||
@@ -438,17 +605,32 @@
|
||||
ichatmutablecomponent.append((IChatBaseComponent) IChatBaseComponent.translatable("multiplayer.disconnect.banned_ip.expiration", PlayerList.BAN_DATE_FORMAT.format(ipbanentry.getExpires())));
|
||||
}
|
||||
|
||||
|
@ -448,7 +465,7 @@
|
|||
UUID uuid = gameprofile.getId();
|
||||
Set<EntityPlayer> set = Sets.newIdentityHashSet();
|
||||
Iterator iterator = this.players.iterator();
|
||||
@@ -479,14 +659,24 @@
|
||||
@@ -476,14 +658,24 @@
|
||||
}
|
||||
|
||||
return !set.isEmpty();
|
||||
|
@ -474,7 +491,7 @@
|
|||
WorldServer worldserver = this.server.getLevel(entityplayer.getRespawnDimension());
|
||||
Optional optional;
|
||||
|
||||
@@ -498,6 +688,11 @@
|
||||
@@ -495,6 +687,11 @@
|
||||
|
||||
WorldServer worldserver1 = worldserver != null && optional.isPresent() ? worldserver : this.server.overworld();
|
||||
EntityPlayer entityplayer1 = new EntityPlayer(this.server, worldserver1, entityplayer.getGameProfile(), entityplayer.clientInformation());
|
||||
|
@ -486,7 +503,7 @@
|
|||
|
||||
entityplayer1.connection = entityplayer.connection;
|
||||
entityplayer1.restoreFrom(entityplayer, flag);
|
||||
@@ -513,28 +708,66 @@
|
||||
@@ -510,28 +707,66 @@
|
||||
|
||||
boolean flag2 = false;
|
||||
|
||||
|
@ -569,7 +586,7 @@
|
|||
entityplayer1.setPos(entityplayer1.getX(), entityplayer1.getY() + 1.0D, entityplayer1.getZ());
|
||||
}
|
||||
|
||||
@@ -543,21 +776,43 @@
|
||||
@@ -540,21 +775,43 @@
|
||||
WorldData worlddata = worldserver2.getLevelData();
|
||||
|
||||
entityplayer1.connection.send(new PacketPlayOutRespawn(entityplayer1.createCommonSpawnInfo(worldserver2), (byte) i));
|
||||
|
@ -598,9 +615,9 @@
|
|||
+ sendAllPlayerInfo(entityplayer); // Update health, etc...
|
||||
+ entityplayer.onUpdateAbilities();
|
||||
+ for (MobEffect mobEffect : entityplayer.getActiveEffects()) {
|
||||
+ entityplayer.connection.send(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect));
|
||||
+ entityplayer.connection.send(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect, false)); // blend = false
|
||||
+ }
|
||||
|
||||
+
|
||||
+ // Fire advancement trigger
|
||||
+ entityplayer.triggerDimensionChangeTriggers(((CraftWorld) fromWorld).getHandle());
|
||||
+
|
||||
|
@ -609,7 +626,7 @@
|
|||
+ PlayerChangedWorldEvent event = new PlayerChangedWorldEvent(entityplayer.getBukkitEntity(), fromWorld);
|
||||
+ server.server.getPluginManager().callEvent(event);
|
||||
+ }
|
||||
+
|
||||
|
||||
+ // Save player file again if they were disconnected
|
||||
+ if (entityplayer.connection.isDisconnected()) {
|
||||
+ this.save(entityplayer);
|
||||
|
@ -618,7 +635,7 @@
|
|||
return entityplayer1;
|
||||
}
|
||||
|
||||
@@ -570,7 +825,18 @@
|
||||
@@ -567,7 +824,18 @@
|
||||
|
||||
public void tick() {
|
||||
if (++this.sendAllPlayerInfoIn > 600) {
|
||||
|
@ -638,7 +655,7 @@
|
|||
this.sendAllPlayerInfoIn = 0;
|
||||
}
|
||||
|
||||
@@ -587,6 +853,25 @@
|
||||
@@ -584,6 +852,25 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -664,7 +681,7 @@
|
|||
public void broadcastAll(Packet<?> packet, ResourceKey<World> resourcekey) {
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
@@ -665,7 +950,7 @@
|
||||
@@ -662,7 +949,7 @@
|
||||
}
|
||||
|
||||
public void deop(GameProfile gameprofile) {
|
||||
|
@ -673,7 +690,7 @@
|
|||
EntityPlayer entityplayer = this.getPlayer(gameprofile.getId());
|
||||
|
||||
if (entityplayer != null) {
|
||||
@@ -689,6 +974,7 @@
|
||||
@@ -686,6 +973,7 @@
|
||||
entityplayer.connection.send(new PacketPlayOutEntityStatus(entityplayer, b0));
|
||||
}
|
||||
|
||||
|
@ -681,7 +698,7 @@
|
|||
this.server.getCommands().sendCommands(entityplayer);
|
||||
}
|
||||
|
||||
@@ -719,6 +1005,12 @@
|
||||
@@ -716,6 +1004,12 @@
|
||||
for (int i = 0; i < this.players.size(); ++i) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i);
|
||||
|
||||
|
@ -694,7 +711,7 @@
|
|||
if (entityplayer != entityhuman && entityplayer.level().dimension() == resourcekey) {
|
||||
double d4 = d0 - entityplayer.getX();
|
||||
double d5 = d1 - entityplayer.getY();
|
||||
@@ -758,15 +1050,19 @@
|
||||
@@ -755,15 +1049,19 @@
|
||||
public void reloadWhiteList() {}
|
||||
|
||||
public void sendLevelInfo(EntityPlayer entityplayer, WorldServer worldserver) {
|
||||
|
@ -718,14 +735,14 @@
|
|||
}
|
||||
|
||||
entityplayer.connection.send(new PacketPlayOutGameStateChange(PacketPlayOutGameStateChange.LEVEL_CHUNKS_LOAD_START, 0.0F));
|
||||
@@ -775,8 +1071,16 @@
|
||||
@@ -772,8 +1070,16 @@
|
||||
|
||||
public void sendAllPlayerInfo(EntityPlayer entityplayer) {
|
||||
entityplayer.inventoryMenu.sendAllDataToRemote();
|
||||
- entityplayer.resetSentInfo();
|
||||
+ // entityplayer.resetSentInfo();
|
||||
+ entityplayer.getBukkitEntity().updateScaledHealth(); // CraftBukkit - Update scaled health on respawn and worldchange
|
||||
+ entityplayer.getEntityData().refresh(entityplayer); // CraftBukkkit - SPIGOT-7218: sync metadata
|
||||
+ entityplayer.refreshEntityData(entityplayer); // CraftBukkkit - SPIGOT-7218: sync metadata
|
||||
entityplayer.connection.send(new PacketPlayOutHeldItemSlot(entityplayer.getInventory().selected));
|
||||
+ // CraftBukkit start - from GameRules
|
||||
+ int i = entityplayer.level().getGameRules().getBoolean(GameRules.RULE_REDUCEDDEBUGINFO) ? 22 : 23;
|
||||
|
@ -736,7 +753,7 @@
|
|||
}
|
||||
|
||||
public int getPlayerCount() {
|
||||
@@ -832,12 +1136,22 @@
|
||||
@@ -829,12 +1135,22 @@
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
|
@ -761,7 +778,7 @@
|
|||
public void broadcastSystemMessage(IChatBaseComponent ichatbasecomponent, boolean flag) {
|
||||
this.broadcastSystemMessage(ichatbasecomponent, (entityplayer) -> {
|
||||
return ichatbasecomponent;
|
||||
@@ -895,16 +1209,23 @@
|
||||
@@ -892,16 +1208,23 @@
|
||||
return playerchatmessage.hasSignature() && !playerchatmessage.hasExpiredServer(Instant.now());
|
||||
}
|
||||
|
||||
|
@ -781,7 +798,7 @@
|
|||
|
||||
if (serverstatisticmanager == null) {
|
||||
File file = this.server.getWorldPath(SavedFile.PLAYER_STATS_DIR).toFile();
|
||||
File file1 = new File(file, uuid + ".json");
|
||||
File file1 = new File(file, String.valueOf(uuid) + ".json");
|
||||
|
||||
if (!file1.exists()) {
|
||||
- File file2 = new File(file, entityhuman.getName().getString() + ".json");
|
||||
|
@ -789,7 +806,7 @@
|
|||
Path path = file2.toPath();
|
||||
|
||||
if (FileUtils.isPathNormalized(path) && FileUtils.isPathPortable(path) && path.startsWith(file.getPath()) && file2.isFile()) {
|
||||
@@ -913,7 +1234,7 @@
|
||||
@@ -910,7 +1233,7 @@
|
||||
}
|
||||
|
||||
serverstatisticmanager = new ServerStatisticManager(this.server, file1);
|
||||
|
@ -798,7 +815,7 @@
|
|||
}
|
||||
|
||||
return serverstatisticmanager;
|
||||
@@ -921,13 +1242,13 @@
|
||||
@@ -918,13 +1241,13 @@
|
||||
|
||||
public AdvancementDataPlayer getPlayerAdvancements(EntityPlayer entityplayer) {
|
||||
UUID uuid = entityplayer.getUUID();
|
||||
|
@ -806,7 +823,7 @@
|
|||
+ AdvancementDataPlayer advancementdataplayer = (AdvancementDataPlayer) entityplayer.getAdvancements(); // CraftBukkit
|
||||
|
||||
if (advancementdataplayer == null) {
|
||||
Path path = this.server.getWorldPath(SavedFile.PLAYER_ADVANCEMENTS_DIR).resolve(uuid + ".json");
|
||||
Path path = this.server.getWorldPath(SavedFile.PLAYER_ADVANCEMENTS_DIR).resolve(String.valueOf(uuid) + ".json");
|
||||
|
||||
advancementdataplayer = new AdvancementDataPlayer(this.server.getFixerUpper(), this, this.server.getAdvancements(), path, entityplayer);
|
||||
- this.advancements.put(uuid, advancementdataplayer);
|
||||
|
@ -814,7 +831,7 @@
|
|||
}
|
||||
|
||||
advancementdataplayer.setPlayer(entityplayer);
|
||||
@@ -978,13 +1299,20 @@
|
||||
@@ -975,13 +1298,20 @@
|
||||
}
|
||||
|
||||
public void reloadResources() {
|
||||
|
@ -835,4 +852,4 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
this.broadcastAll(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(this.registries)));
|
||||
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getRecipeManager().getRecipes());
|
||||
PacketPlayOutRecipeUpdate packetplayoutrecipeupdate = new PacketPlayOutRecipeUpdate(this.server.getRecipeManager().getOrderedRecipes());
|
||||
|
|
|
@ -18,3 +18,21 @@
|
|||
if (optional.isPresent()) {
|
||||
this.add((GameProfile) optional.get());
|
||||
flag = false;
|
||||
@@ -208,7 +208,7 @@
|
||||
|
||||
label54:
|
||||
{
|
||||
- ArrayList arraylist;
|
||||
+ List<UserCache.UserCacheEntry> arraylist; // CraftBukkit - decompile error
|
||||
|
||||
try {
|
||||
JsonArray jsonarray = (JsonArray) this.gson.fromJson(bufferedreader, JsonArray.class);
|
||||
@@ -217,7 +217,7 @@
|
||||
DateFormat dateformat = createDateFormat();
|
||||
|
||||
jsonarray.forEach((jsonelement) -> {
|
||||
- Optional optional = readGameProfile(jsonelement, dateformat);
|
||||
+ Optional<UserCache.UserCacheEntry> optional = readGameProfile(jsonelement, dateformat); // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(list);
|
||||
optional.ifPresent(list::add);
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
+ // CraftBukkit end
|
||||
|
||||
RemoteControlSession(IMinecraftServer iminecraftserver, String s, Socket socket) {
|
||||
super("RCON Client " + socket.getInetAddress());
|
||||
super("RCON Client " + String.valueOf(socket.getInetAddress()));
|
||||
- this.serverInterface = iminecraftserver;
|
||||
+ this.serverInterface = (DedicatedServer) iminecraftserver; // CraftBukkit
|
||||
this.client = socket;
|
||||
|
@ -46,7 +46,7 @@
|
|||
return;
|
||||
}
|
||||
@@ -71,7 +81,7 @@
|
||||
String s = StatusChallengeUtils.stringFromByteArray(this.buf, k, i);
|
||||
String s = StatusChallengeUtils.stringFromByteArray(this.buf, j, i);
|
||||
|
||||
try {
|
||||
- this.sendCmdResponse(l, this.serverInterface.runCommand(s));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/SpawnUtil.java
|
||||
+++ b/net/minecraft/util/SpawnUtil.java
|
||||
@@ -21,6 +21,12 @@
|
||||
@@ -20,6 +20,12 @@
|
||||
public SpawnUtil() {}
|
||||
|
||||
public static <T extends EntityInsentient> Optional<T> trySpawnMob(EntityTypes<T> entitytypes, EnumMobSpawn enummobspawn, WorldServer worldserver, BlockPosition blockposition, int i, int j, int k, SpawnUtil.a spawnutil_a) {
|
||||
|
@ -13,12 +13,12 @@
|
|||
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = blockposition.mutable();
|
||||
|
||||
for (int l = 0; l < i; ++l) {
|
||||
@@ -29,15 +35,15 @@
|
||||
@@ -28,15 +34,15 @@
|
||||
|
||||
blockposition_mutableblockposition.setWithOffset(blockposition, i1, k, j1);
|
||||
if (worldserver.getWorldBorder().isWithinBounds((BlockPosition) blockposition_mutableblockposition) && moveToPossibleSpawnPosition(worldserver, k, blockposition_mutableblockposition, spawnutil_a)) {
|
||||
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition_mutableblockposition, enummobspawn, false, false);
|
||||
+ T t0 = entitytypes.create(worldserver, (NBTTagCompound) null, null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
|
||||
- T t0 = (EntityInsentient) entitytypes.create(worldserver, (Consumer) null, blockposition_mutableblockposition, enummobspawn, false, false);
|
||||
+ T t0 = entitytypes.create(worldserver, (Consumer<T>) null, blockposition_mutableblockposition, enummobspawn, false, false); // CraftBukkit - decompile error
|
||||
|
||||
if (t0 != null) {
|
||||
if (t0.checkSpawnRules(worldserver, enummobspawn) && t0.checkSpawnObstruction(worldserver)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
+++ b/net/minecraft/util/datafix/DataConverterRegistry.java
|
||||
@@ -455,6 +455,18 @@
|
||||
@@ -483,6 +483,18 @@
|
||||
datafixerbuilder.addFixer(new DataConverterItemFrame(schema44, false));
|
||||
Schema schema45 = datafixerbuilder.addSchema(1458, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -19,7 +19,17 @@
|
|||
datafixerbuilder.addFixer(new DataConverterCustomNameEntity(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameItem(schema45, false));
|
||||
datafixerbuilder.addFixer(new DataConverterCustomNameTile(schema45, false));
|
||||
@@ -776,12 +788,14 @@
|
||||
@@ -741,7 +753,8 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema110, "Added Zoglin", DataConverterTypes.ENTITY));
|
||||
Schema schema111 = datafixerbuilder.addSchema(2523, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
- datafixerbuilder.addFixer(new DataConverterAttributes(schema111, "Attribute renames", createRenamerNoNamespace(ImmutableMap.builder().put("generic.maxHealth", "minecraft:generic.max_health").put("Max Health", "minecraft:generic.max_health").put("zombie.spawnReinforcements", "minecraft:zombie.spawn_reinforcements").put("Spawn Reinforcements Chance", "minecraft:zombie.spawn_reinforcements").put("horse.jumpStrength", "minecraft:horse.jump_strength").put("Jump Strength", "minecraft:horse.jump_strength").put("generic.followRange", "minecraft:generic.follow_range").put("Follow Range", "minecraft:generic.follow_range").put("generic.knockbackResistance", "minecraft:generic.knockback_resistance").put("Knockback Resistance", "minecraft:generic.knockback_resistance").put("generic.movementSpeed", "minecraft:generic.movement_speed").put("Movement Speed", "minecraft:generic.movement_speed").put("generic.flyingSpeed", "minecraft:generic.flying_speed").put("Flying Speed", "minecraft:generic.flying_speed").put("generic.attackDamage", "minecraft:generic.attack_damage").put("generic.attackKnockback", "minecraft:generic.attack_knockback").put("generic.attackSpeed", "minecraft:generic.attack_speed").put("generic.armorToughness", "minecraft:generic.armor_toughness").build())));
|
||||
+ // CraftBukkit - decompile error
|
||||
+ datafixerbuilder.addFixer(new DataConverterAttributes(schema111, "Attribute renames", createRenamerNoNamespace(ImmutableMap.<String, String>builder().put("generic.maxHealth", "minecraft:generic.max_health").put("Max Health", "minecraft:generic.max_health").put("zombie.spawnReinforcements", "minecraft:zombie.spawn_reinforcements").put("Spawn Reinforcements Chance", "minecraft:zombie.spawn_reinforcements").put("horse.jumpStrength", "minecraft:horse.jump_strength").put("Jump Strength", "minecraft:horse.jump_strength").put("generic.followRange", "minecraft:generic.follow_range").put("Follow Range", "minecraft:generic.follow_range").put("generic.knockbackResistance", "minecraft:generic.knockback_resistance").put("Knockback Resistance", "minecraft:generic.knockback_resistance").put("generic.movementSpeed", "minecraft:generic.movement_speed").put("Movement Speed", "minecraft:generic.movement_speed").put("generic.flyingSpeed", "minecraft:generic.flying_speed").put("Flying Speed", "minecraft:generic.flying_speed").put("generic.attackDamage", "minecraft:generic.attack_damage").put("generic.attackKnockback", "minecraft:generic.attack_knockback").put("generic.attackSpeed", "minecraft:generic.attack_speed").put("generic.armorToughness", "minecraft:generic.armor_toughness").build())));
|
||||
Schema schema112 = datafixerbuilder.addSchema(2527, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
datafixerbuilder.addFixer(new DataConverterBitStorageAlign(schema112));
|
||||
@@ -804,12 +817,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);
|
||||
|
@ -28,15 +38,15 @@
|
|||
+ 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(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)));
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.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(schema132, "Rename copper item suffixes", createRenamer(immutablemap1)));
|
||||
datafixerbuilder.addFixer(BlockRenameFixWithJigsaw.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -789,7 +803,8 @@
|
||||
datafixerbuilder.addFixer(DataConverterBlockRename.create(schema132, "Rename copper blocks suffixes", createRenamer(immutablemap1)));
|
||||
@@ -817,7 +832,8 @@
|
||||
|
||||
datafixerbuilder.addFixer(new AddFlagIfNotPresentFix(schema133, DataConverterTypes.WORLD_GEN_SETTINGS, "has_increased_height_already", false));
|
||||
Schema schema134 = datafixerbuilder.addSchema(2696, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
@ -45,8 +55,8 @@
|
|||
+ 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(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(DataConverterBlockRename.create(schema134, "Renamed grimstone blocks to deepslate", createRenamer(immutablemap2)));
|
||||
@@ -904,10 +920,11 @@
|
||||
datafixerbuilder.addFixer(new DataConverterAddChoices(schema159, "Added Allay", DataConverterTypes.ENTITY));
|
||||
Schema schema160 = datafixerbuilder.addSchema(3084, DataConverterRegistry.SAME_NAMESPACED);
|
||||
|
||||
|
@ -60,7 +70,7 @@
|
|||
int2objectopenhashmap1.defaultReturnValue("minecraft:tabby");
|
||||
int2objectopenhashmap1.put(0, "minecraft:tabby");
|
||||
int2objectopenhashmap1.put(1, "minecraft:black");
|
||||
@@ -896,7 +912,8 @@
|
||||
@@ -924,7 +941,8 @@
|
||||
|
||||
Objects.requireNonNull(int2objectopenhashmap);
|
||||
datafixerbuilder.addFixer(new EntityVariantFix(schema161, "Change cat variant type", typereference, "minecraft:cat", "CatType", int2objectopenhashmap::get));
|
||||
|
|
|
@ -1,23 +1,32 @@
|
|||
--- a/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
+++ b/net/minecraft/util/worldupdate/WorldUpgrader.java
|
||||
@@ -66,7 +66,7 @@
|
||||
@@ -81,7 +81,7 @@
|
||||
|
||||
public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, IRegistry<WorldDimension> iregistry, boolean flag) {
|
||||
this.dimensions = iregistry;
|
||||
- this.levels = (Set) iregistry.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet());
|
||||
public WorldUpgrader(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, IRegistryCustom iregistrycustom, boolean flag, boolean flag1) {
|
||||
this.dimensions = iregistrycustom.registryOrThrow(Registries.LEVEL_STEM);
|
||||
- this.levels = (Set) this.dimensions.registryKeySet().stream().map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet());
|
||||
+ this.levels = (Set) java.util.stream.Stream.of(convertable_conversionsession.dimensionType).map(Registries::levelStemToLevel).collect(Collectors.toUnmodifiableSet()); // CraftBukkit
|
||||
this.eraseCache = flag;
|
||||
this.dataFixer = datafixer;
|
||||
this.levelStorage = convertable_conversionsession;
|
||||
@@ -145,9 +145,9 @@
|
||||
if (nbttagcompound != null) {
|
||||
int j = IChunkLoader.getVersion(nbttagcompound);
|
||||
ChunkGenerator chunkgenerator = ((WorldDimension) this.dimensions.getOrThrow(Registries.levelToLevelStem(resourcekey2))).generator();
|
||||
- NBTTagCompound nbttagcompound1 = ichunkloader.upgradeChunkTag(resourcekey2, () -> {
|
||||
+ NBTTagCompound nbttagcompound1 = ichunkloader.upgradeChunkTag(Registries.levelToLevelStem(resourcekey2), () -> { // CraftBukkit
|
||||
return this.overworldDataStorage;
|
||||
- }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer());
|
||||
+ }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer(), chunkcoordintpair, null); // CraftBukkit
|
||||
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos"));
|
||||
@@ -194,9 +194,9 @@
|
||||
if (nbttagcompound != null) {
|
||||
int i = IChunkLoader.getVersion(nbttagcompound);
|
||||
ChunkGenerator chunkgenerator = ((WorldDimension) WorldUpgrader.this.dimensions.getOrThrow(Registries.levelToLevelStem(resourcekey))).generator();
|
||||
- NBTTagCompound nbttagcompound1 = ichunkloader.upgradeChunkTag(resourcekey, () -> {
|
||||
+ NBTTagCompound nbttagcompound1 = ichunkloader.upgradeChunkTag(Registries.levelToLevelStem(resourcekey), () -> { // CraftBukkit
|
||||
return WorldUpgrader.this.overworldDataStorage;
|
||||
- }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer());
|
||||
+ }, nbttagcompound, chunkgenerator.getTypeNameForDataFixer(), chunkcoordintpair, null); // CraftBukkit
|
||||
ChunkCoordIntPair chunkcoordintpair1 = new ChunkCoordIntPair(nbttagcompound1.getInt("xPos"), nbttagcompound1.getInt("zPos"));
|
||||
|
||||
if (!chunkcoordintpair1.equals(chunkcoordintpair)) {
|
||||
if (!chunkcoordintpair1.equals(chunkcoordintpair)) {
|
||||
@@ -316,7 +316,7 @@
|
||||
WorldUpgrader.c<T> worldupgrader_c = (WorldUpgrader.c) iterator.next();
|
||||
ResourceKey<World> resourcekey = worldupgrader_c.dimensionKey;
|
||||
ListIterator<WorldUpgrader.e> listiterator = worldupgrader_c.files;
|
||||
- T t0 = (AutoCloseable) worldupgrader_c.storage;
|
||||
+ T t0 = (T) worldupgrader_c.storage; // CraftBukkit - decompile error
|
||||
|
||||
if (listiterator.hasNext()) {
|
||||
WorldUpgrader.e worldupgrader_e = (WorldUpgrader.e) listiterator.next();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/ChestLock.java
|
||||
+++ b/net/minecraft/world/ChestLock.java
|
||||
@@ -4,6 +4,11 @@
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -6,6 +6,11 @@
|
||||
import net.minecraft.network.chat.IChatBaseComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -9,27 +9,27 @@
|
|||
+import org.bukkit.craftbukkit.util.CraftChatMessage;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
@Immutable
|
||||
public class ChestLock {
|
||||
public record ChestLock(String key) {
|
||||
|
||||
@@ -16,7 +21,19 @@
|
||||
}
|
||||
public static final ChestLock NO_LOCK = new ChestLock("");
|
||||
@@ -18,7 +23,19 @@
|
||||
} else {
|
||||
IChatBaseComponent ichatbasecomponent = (IChatBaseComponent) itemstack.get(DataComponents.CUSTOM_NAME);
|
||||
|
||||
public boolean unlocksWith(ItemStack itemstack) {
|
||||
- return this.key.isEmpty() || !itemstack.isEmpty() && itemstack.hasCustomHoverName() && this.key.equals(itemstack.getHoverName().getString());
|
||||
+ // CraftBukkit start - SPIGOT-6307: Check for color codes if the lock contains color codes
|
||||
+ if (this.key.isEmpty()) return true;
|
||||
+ if (!itemstack.isEmpty() && itemstack.hasCustomHoverName()) {
|
||||
+ if (this.key.indexOf(ChatColor.COLOR_CHAR) == -1) {
|
||||
+ // The lock key contains no color codes, so let's ignore colors in the item display name (vanilla Minecraft behavior):
|
||||
+ return this.key.equals(itemstack.getHoverName().getString());
|
||||
+ } else {
|
||||
+ // The lock key contains color codes, so let's take them into account:
|
||||
+ return this.key.equals(CraftChatMessage.fromComponent(itemstack.getHoverName()));
|
||||
- return ichatbasecomponent != null && this.key.equals(ichatbasecomponent.getString());
|
||||
+ // CraftBukkit start - SPIGOT-6307: Check for color codes if the lock contains color codes
|
||||
+ if (this.key.isEmpty()) return true;
|
||||
+ if (ichatbasecomponent != null) {
|
||||
+ if (this.key.indexOf(ChatColor.COLOR_CHAR) == -1) {
|
||||
+ // The lock key contains no color codes, so let's ignore colors in the item display name (vanilla Minecraft behavior):
|
||||
+ return this.key.equals(ichatbasecomponent.getString());
|
||||
+ } else {
|
||||
+ // The lock key contains color codes, so let's take them into account:
|
||||
+ return this.key.equals(CraftChatMessage.fromComponent(ichatbasecomponent));
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ return false;
|
||||
+ // CraftBukkit end
|
||||
+ return false;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
public void addToTag(NBTTagCompound nbttagcompound) {
|
||||
|
|
|
@ -11,21 +11,21 @@
|
|||
+
|
||||
public interface IInventory extends Clearable {
|
||||
|
||||
int LARGE_MAX_STACK_SIZE = 64;
|
||||
@@ -26,9 +31,7 @@
|
||||
float DEFAULT_DISTANCE_BUFFER = 4.0F;
|
||||
@@ -25,9 +30,7 @@
|
||||
|
||||
void setItem(int i, ItemStack itemstack);
|
||||
|
||||
- default int getMaxStackSize() {
|
||||
- return 64;
|
||||
- return 99;
|
||||
- }
|
||||
+ int getMaxStackSize(); // CraftBukkit
|
||||
|
||||
void setChanged();
|
||||
default int getMaxStackSize(ItemStack itemstack) {
|
||||
return Math.min(this.getMaxStackSize(), itemstack.getMaxStackSize());
|
||||
@@ -91,4 +94,29 @@
|
||||
|
||||
@@ -88,4 +91,29 @@
|
||||
|
||||
return world == null ? false : (world.getBlockEntity(blockposition) != tileentity ? false : entityhuman.distanceToSqr((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) <= (double) (i * i));
|
||||
return world == null ? false : (world.getBlockEntity(blockposition) != tileentity ? false : entityhuman.canInteractWithBlock(blockposition, (double) f));
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
|
@ -50,6 +50,6 @@
|
|||
+ default void setCurrentRecipe(RecipeHolder<?> recipe) {
|
||||
+ }
|
||||
+
|
||||
+ int MAX_STACK = 64;
|
||||
+ int MAX_STACK = 99;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/damagesource/DamageSource.java
|
||||
+++ b/net/minecraft/world/damagesource/DamageSource.java
|
||||
@@ -20,6 +20,86 @@
|
||||
@@ -21,6 +21,86 @@
|
||||
private final Entity directEntity;
|
||||
@Nullable
|
||||
private final Vec3D damageSourcePosition;
|
||||
|
@ -87,12 +87,3 @@
|
|||
|
||||
public String toString() {
|
||||
return "DamageSource (" + this.type().msgId() + ")";
|
||||
@@ -33,7 +113,7 @@
|
||||
return this.causingEntity != this.directEntity;
|
||||
}
|
||||
|
||||
- private DamageSource(Holder<DamageType> holder, @Nullable Entity entity, @Nullable Entity entity1, @Nullable Vec3D vec3d) {
|
||||
+ public DamageSource(Holder<DamageType> holder, @Nullable Entity entity, @Nullable Entity entity1, @Nullable Vec3D vec3d) {
|
||||
this.type = holder;
|
||||
this.causingEntity = entity1;
|
||||
this.directEntity = entity;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/HealOrHarmMobEffect.java
|
||||
@@ -17,7 +17,7 @@
|
||||
public void applyEffectTick(EntityLiving entityliving, int i) {
|
||||
super.applyEffectTick(entityliving, i);
|
||||
@@ -16,7 +16,7 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (this.isHarm == entityliving.isInvertedHealAndHarm()) {
|
||||
- entityliving.heal((float) Math.max(4 << i, 0));
|
||||
+ entityliving.heal((float) Math.max(4 << i, 0), org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC); // CraftBukkit
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/effect/HungerMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/HungerMobEffect.java
|
||||
@@ -15,7 +15,7 @@
|
||||
if (entityliving instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (entityliving instanceof EntityHuman entityhuman) {
|
||||
- entityhuman.causeFoodExhaustion(0.005F * (float) (i + 1));
|
||||
+ entityhuman.causeFoodExhaustion(0.005F * (float) (i + 1), org.bukkit.event.entity.EntityExhaustionEvent.ExhaustionReason.HUNGER_EFFECT); // CraftBukkit - EntityExhaustionEvent
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/effect/MobEffectUtil.java
|
||||
+++ b/net/minecraft/world/effect/MobEffectUtil.java
|
||||
@@ -49,13 +49,19 @@
|
||||
@@ -50,13 +50,19 @@
|
||||
}
|
||||
|
||||
public static List<EntityPlayer> addEffectToPlayersAround(WorldServer worldserver, @Nullable Entity entity, Vec3D vec3d, double d0, MobEffect mobeffect, int i) {
|
||||
|
@ -10,9 +10,9 @@
|
|||
+
|
||||
+ public static List<EntityPlayer> addEffectToPlayersAround(WorldServer worldserver, @Nullable Entity entity, Vec3D vec3d, double d0, MobEffect mobeffect, int i, org.bukkit.event.entity.EntityPotionEffectEvent.Cause cause) {
|
||||
+ // CraftBukkit end
|
||||
MobEffectList mobeffectlist = mobeffect.getEffect();
|
||||
Holder<MobEffectList> holder = mobeffect.getEffect();
|
||||
List<EntityPlayer> list = worldserver.getPlayers((entityplayer) -> {
|
||||
return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(mobeffectlist) || entityplayer.getEffect(mobeffectlist).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(mobeffectlist).endsWithin(i - 1));
|
||||
return entityplayer.gameMode.isSurvival() && (entity == null || !entity.isAlliedTo((Entity) entityplayer)) && vec3d.closerThan(entityplayer.position(), d0) && (!entityplayer.hasEffect(holder) || entityplayer.getEffect(holder).getAmplifier() < mobeffect.getAmplifier() || entityplayer.getEffect(holder).endsWithin(i - 1));
|
||||
});
|
||||
|
||||
list.forEach((entityplayer) -> {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/PoisonMobEffect.java
|
||||
@@ -12,7 +12,7 @@
|
||||
public void applyEffectTick(EntityLiving entityliving, int i) {
|
||||
super.applyEffectTick(entityliving, i);
|
||||
@@ -11,7 +11,7 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (entityliving.getHealth() > 1.0F) {
|
||||
- entityliving.hurt(entityliving.damageSources().magic(), 1.0F);
|
||||
+ entityliving.hurt(entityliving.damageSources().poison(), 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
--- a/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
+++ b/net/minecraft/world/effect/RegenerationMobEffect.java
|
||||
@@ -12,7 +12,7 @@
|
||||
public void applyEffectTick(EntityLiving entityliving, int i) {
|
||||
super.applyEffectTick(entityliving, i);
|
||||
@@ -11,7 +11,7 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (entityliving.getHealth() < entityliving.getMaxHealth()) {
|
||||
- entityliving.heal(1.0F);
|
||||
+ entityliving.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.MAGIC_REGEN); // CraftBukkit
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -12,10 +12,10 @@
|
|||
class SaturationMobEffect extends InstantMobEffect {
|
||||
|
||||
protected SaturationMobEffect(MobEffectInfo mobeffectinfo, int i) {
|
||||
@@ -15,7 +20,15 @@
|
||||
if (!entityliving.level().isClientSide && entityliving instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entityliving;
|
||||
|
||||
@@ -12,7 +17,15 @@
|
||||
@Override
|
||||
public boolean applyEffectTick(EntityLiving entityliving, int i) {
|
||||
if (!entityliving.level().isClientSide && entityliving instanceof EntityHuman entityhuman) {
|
||||
- entityhuman.getFoodData().eat(i + 1, 1.0F);
|
||||
+ // CraftBukkit start
|
||||
+ int oldFoodLevel = entityhuman.getFoodData().foodLevel;
|
||||
|
@ -28,4 +28,4 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
--- a/net/minecraft/world/entity/Entity.java
|
||||
+++ b/net/minecraft/world/entity/Entity.java
|
||||
@@ -126,8 +126,68 @@
|
||||
import org.joml.Vector3f;
|
||||
@@ -128,8 +128,69 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeamBase;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.network.protocol.game.PacketPlayOutEntityMetadata;
|
||||
+import net.minecraft.world.level.dimension.WorldDimension;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.bukkit.Location;
|
||||
|
@ -38,7 +39,7 @@
|
|||
+import org.bukkit.plugin.PluginManager;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class Entity implements INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
|
||||
public abstract class Entity implements SyncedDataHolder, INamableTileEntity, EntityAccess, ICommandListener, ScoreHolder {
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ private static final int CURRENT_LEVEL = 2;
|
||||
|
@ -69,10 +70,10 @@
|
|||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
public static final String ID_TAG = "id";
|
||||
public static final String PASSENGERS_TAG = "Passengers";
|
||||
@@ -242,6 +302,29 @@
|
||||
@@ -243,6 +304,29 @@
|
||||
public boolean hasVisualFire;
|
||||
@Nullable
|
||||
private IBlockData feetBlockState;
|
||||
private IBlockData inBlockState;
|
||||
+ // CraftBukkit start
|
||||
+ public boolean persist = true;
|
||||
+ public boolean visibleByDefault = true;
|
||||
|
@ -99,7 +100,7 @@
|
|||
|
||||
public Entity(EntityTypes<?> entitytypes, World world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -346,12 +429,18 @@
|
||||
@@ -349,12 +433,18 @@
|
||||
}
|
||||
|
||||
public void kill() {
|
||||
|
@ -119,8 +120,25 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected abstract void defineSynchedData();
|
||||
@@ -369,12 +458,24 @@
|
||||
protected abstract void defineSynchedData(DataWatcher.a datawatcher_a);
|
||||
@@ -363,6 +453,16 @@
|
||||
return this.entityData;
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ public void refreshEntityData(EntityPlayer to) {
|
||||
+ List<DataWatcher.c<?>> list = this.getEntityData().getNonDefaultValues();
|
||||
+
|
||||
+ if (list != null) {
|
||||
+ to.connection.send(new PacketPlayOutEntityMetadata(this.getId(), list));
|
||||
+ }
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Entity ? ((Entity) object).id == this.id : false;
|
||||
}
|
||||
@@ -372,12 +472,24 @@
|
||||
}
|
||||
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
|
@ -146,7 +164,7 @@
|
|||
this.entityData.set(Entity.DATA_POSE, entitypose);
|
||||
}
|
||||
|
||||
@@ -399,6 +500,33 @@
|
||||
@@ -402,6 +514,33 @@
|
||||
}
|
||||
|
||||
protected void setRot(float f, float f1) {
|
||||
|
@ -180,7 +198,7 @@
|
|||
this.setYRot(f % 360.0F);
|
||||
this.setXRot(f1 % 360.0F);
|
||||
}
|
||||
@@ -440,6 +568,15 @@
|
||||
@@ -443,6 +582,15 @@
|
||||
this.baseTick();
|
||||
}
|
||||
|
||||
|
@ -195,8 +213,8 @@
|
|||
+
|
||||
public void baseTick() {
|
||||
this.level().getProfiler().push("entityBaseTick");
|
||||
this.feetBlockState = null;
|
||||
@@ -454,7 +591,7 @@
|
||||
this.inBlockState = null;
|
||||
@@ -457,7 +605,7 @@
|
||||
this.walkDistO = this.walkDist;
|
||||
this.xRotO = this.getXRot();
|
||||
this.yRotO = this.getYRot();
|
||||
|
@ -205,7 +223,7 @@
|
|||
if (this.canSpawnSprintParticle()) {
|
||||
this.spawnSprintParticle();
|
||||
}
|
||||
@@ -489,6 +626,10 @@
|
||||
@@ -492,6 +640,10 @@
|
||||
if (this.isInLava()) {
|
||||
this.lavaHurt();
|
||||
this.fallDistance *= 0.5F;
|
||||
|
@ -216,11 +234,11 @@
|
|||
}
|
||||
|
||||
this.checkBelowWorld();
|
||||
@@ -540,15 +681,47 @@
|
||||
@@ -543,15 +695,47 @@
|
||||
|
||||
public void lavaHurt() {
|
||||
if (!this.fireImmune()) {
|
||||
- this.setSecondsOnFire(15);
|
||||
- this.igniteForSeconds(15);
|
||||
- if (this.hurt(this.damageSources().lava(), 4.0F)) {
|
||||
+ // CraftBukkit start - Fallen in lava TODO: this event spams!
|
||||
+ if (this instanceof EntityLiving && remainingFireTicks <= 0) {
|
||||
|
@ -231,11 +249,11 @@
|
|||
+ this.level.getCraftServer().getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ this.setSecondsOnFire(combustEvent.getDuration(), false);
|
||||
+ this.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ } else {
|
||||
+ // This will be called every single tick the entity is in lava, so don't throw an event
|
||||
+ this.setSecondsOnFire(15, false);
|
||||
+ this.igniteForSeconds(15, false);
|
||||
+ }
|
||||
+
|
||||
+ if (this.hurt(this.damageSources().lava().directBlock(level, lastLavaContact), 4.0F)) {
|
||||
|
@ -246,12 +264,12 @@
|
|||
}
|
||||
}
|
||||
|
||||
public void setSecondsOnFire(int i) {
|
||||
public final void igniteForSeconds(int i) {
|
||||
+ // CraftBukkit start
|
||||
+ this.setSecondsOnFire(i, true);
|
||||
+ this.igniteForSeconds(i, true);
|
||||
+ }
|
||||
+
|
||||
+ public void setSecondsOnFire(int i, boolean callEvent) {
|
||||
+ public final void igniteForSeconds(int i, boolean callEvent) {
|
||||
+ if (callEvent) {
|
||||
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), i);
|
||||
+ this.level.getCraftServer().getPluginManager().callEvent(event);
|
||||
|
@ -263,10 +281,10 @@
|
|||
+ i = event.getDuration();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
int j = i * 20;
|
||||
this.igniteForTicks(i * 20);
|
||||
}
|
||||
|
||||
if (this instanceof EntityLiving) {
|
||||
@@ -574,7 +747,7 @@
|
||||
@@ -575,7 +759,7 @@
|
||||
}
|
||||
|
||||
protected void onBelowWorld() {
|
||||
|
@ -275,7 +293,7 @@
|
|||
}
|
||||
|
||||
public boolean isFree(double d0, double d1, double d2) {
|
||||
@@ -699,6 +872,28 @@
|
||||
@@ -700,6 +884,28 @@
|
||||
block.updateEntityAfterFallOn(this.level(), this);
|
||||
}
|
||||
|
||||
|
@ -304,7 +322,7 @@
|
|||
if (this.onGround()) {
|
||||
block.stepOn(this.level(), blockposition, iblockdata, this);
|
||||
}
|
||||
@@ -1026,6 +1221,20 @@
|
||||
@@ -1027,6 +1233,20 @@
|
||||
return SoundEffects.GENERIC_SPLASH;
|
||||
}
|
||||
|
||||
|
@ -325,7 +343,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);
|
||||
@@ -1440,6 +1649,7 @@
|
||||
@@ -1454,6 +1674,7 @@
|
||||
this.yo = d1;
|
||||
this.zo = d4;
|
||||
this.setPos(d3, d1, d4);
|
||||
|
@ -333,7 +351,7 @@
|
|||
}
|
||||
|
||||
public void moveTo(Vec3D vec3d) {
|
||||
@@ -1634,6 +1844,12 @@
|
||||
@@ -1652,6 +1873,12 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -346,7 +364,7 @@
|
|||
public void awardKillScore(Entity entity, int i, DamageSource damagesource) {
|
||||
if (entity instanceof EntityPlayer) {
|
||||
CriterionTriggers.ENTITY_KILLED_PLAYER.trigger((EntityPlayer) entity, this, damagesource);
|
||||
@@ -1662,16 +1878,22 @@
|
||||
@@ -1680,16 +1907,22 @@
|
||||
}
|
||||
|
||||
public boolean saveAsPassenger(NBTTagCompound nbttagcompound) {
|
||||
|
@ -371,7 +389,7 @@
|
|||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1682,16 +1904,38 @@
|
||||
@@ -1700,16 +1933,38 @@
|
||||
}
|
||||
|
||||
public NBTTagCompound saveWithoutId(NBTTagCompound nbttagcompound) {
|
||||
|
@ -414,7 +432,7 @@
|
|||
nbttagcompound.put("Rotation", this.newFloatList(this.getYRot(), this.getXRot()));
|
||||
nbttagcompound.putFloat("FallDistance", this.fallDistance);
|
||||
nbttagcompound.putShort("Fire", (short) this.remainingFireTicks);
|
||||
@@ -1699,7 +1943,28 @@
|
||||
@@ -1717,7 +1972,28 @@
|
||||
nbttagcompound.putBoolean("OnGround", this.onGround());
|
||||
nbttagcompound.putBoolean("Invulnerable", this.invulnerable);
|
||||
nbttagcompound.putInt("PortalCooldown", this.portalCooldown);
|
||||
|
@ -444,7 +462,7 @@
|
|||
IChatBaseComponent ichatbasecomponent = this.getCustomName();
|
||||
|
||||
if (ichatbasecomponent != null) {
|
||||
@@ -1748,7 +2013,7 @@
|
||||
@@ -1766,7 +2042,7 @@
|
||||
nbttagcompound.put("Tags", nbttaglist);
|
||||
}
|
||||
|
||||
|
@ -453,7 +471,7 @@
|
|||
if (this.isVehicle()) {
|
||||
nbttaglist = new NBTTagList();
|
||||
iterator = this.getPassengers().iterator();
|
||||
@@ -1757,7 +2022,7 @@
|
||||
@@ -1775,7 +2051,7 @@
|
||||
Entity entity = (Entity) iterator.next();
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
|
@ -462,7 +480,7 @@
|
|||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@@ -1767,6 +2032,11 @@
|
||||
@@ -1785,6 +2061,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +492,7 @@
|
|||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -1850,6 +2120,45 @@
|
||||
@@ -1868,6 +2149,45 @@
|
||||
} else {
|
||||
throw new IllegalStateException("Entity has invalid position");
|
||||
}
|
||||
|
@ -520,7 +538,7 @@
|
|||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.addCategory("Entity being loaded");
|
||||
@@ -1871,6 +2180,12 @@
|
||||
@@ -1889,6 +2209,12 @@
|
||||
return entitytypes.canSerialize() && minecraftkey != null ? minecraftkey.toString() : null;
|
||||
}
|
||||
|
||||
|
@ -533,7 +551,7 @@
|
|||
protected abstract void readAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
|
||||
protected abstract void addAdditionalSaveData(NBTTagCompound nbttagcompound);
|
||||
@@ -1925,9 +2240,22 @@
|
||||
@@ -1943,9 +2269,22 @@
|
||||
} else if (this.level().isClientSide) {
|
||||
return null;
|
||||
} else {
|
||||
|
@ -556,7 +574,7 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
return entityitem;
|
||||
}
|
||||
@@ -2025,6 +2353,27 @@
|
||||
@@ -2046,6 +2385,27 @@
|
||||
if (!flag && (!this.canRide(entity) || !entity.canAddPassenger(this))) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -584,7 +602,7 @@
|
|||
if (this.isPassenger()) {
|
||||
this.stopRiding();
|
||||
}
|
||||
@@ -2058,7 +2407,7 @@
|
||||
@@ -2079,7 +2439,7 @@
|
||||
Entity entity = this.vehicle;
|
||||
|
||||
this.vehicle = null;
|
||||
|
@ -593,7 +611,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -2089,10 +2438,38 @@
|
||||
@@ -2110,10 +2470,38 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +651,7 @@
|
|||
if (this.passengers.size() == 1 && this.passengers.get(0) == entity) {
|
||||
this.passengers = ImmutableList.of();
|
||||
} else {
|
||||
@@ -2104,6 +2481,7 @@
|
||||
@@ -2125,6 +2513,7 @@
|
||||
entity.boardingCooldown = 60;
|
||||
this.gameEvent(GameEvent.ENTITY_DISMOUNT, entity);
|
||||
}
|
||||
|
@ -641,7 +659,7 @@
|
|||
}
|
||||
|
||||
protected boolean canAddPassenger(Entity entity) {
|
||||
@@ -2190,14 +2568,20 @@
|
||||
@@ -2210,14 +2599,20 @@
|
||||
|
||||
if (this.isInsidePortal) {
|
||||
MinecraftServer minecraftserver = worldserver.getServer();
|
||||
|
@ -665,7 +683,7 @@
|
|||
this.level().getProfiler().pop();
|
||||
}
|
||||
|
||||
@@ -2321,6 +2705,13 @@
|
||||
@@ -2327,6 +2722,13 @@
|
||||
}
|
||||
|
||||
public void setSwimming(boolean flag) {
|
||||
|
@ -679,7 +697,7 @@
|
|||
this.setSharedFlag(4, flag);
|
||||
}
|
||||
|
||||
@@ -2370,8 +2761,12 @@
|
||||
@@ -2376,8 +2778,12 @@
|
||||
return this.getTeam() != null ? this.getTeam().isAlliedTo(scoreboardteambase) : false;
|
||||
}
|
||||
|
||||
|
@ -693,7 +711,7 @@
|
|||
}
|
||||
|
||||
public boolean getSharedFlag(int i) {
|
||||
@@ -2390,7 +2785,7 @@
|
||||
@@ -2396,7 +2802,7 @@
|
||||
}
|
||||
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -702,7 +720,7 @@
|
|||
}
|
||||
|
||||
public int getAirSupply() {
|
||||
@@ -2398,7 +2793,18 @@
|
||||
@@ -2404,7 +2810,18 @@
|
||||
}
|
||||
|
||||
public void setAirSupply(int i) {
|
||||
|
@ -722,7 +740,7 @@
|
|||
}
|
||||
|
||||
public int getTicksFrozen() {
|
||||
@@ -2425,11 +2831,40 @@
|
||||
@@ -2431,11 +2848,40 @@
|
||||
|
||||
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
|
||||
this.setRemainingFireTicks(this.remainingFireTicks + 1);
|
||||
|
@ -733,12 +751,12 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
if (this.remainingFireTicks == 0) {
|
||||
- this.setSecondsOnFire(8);
|
||||
- this.igniteForSeconds(8);
|
||||
+ // CraftBukkit start - Call a combust event when lightning strikes
|
||||
+ EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
|
||||
+ pluginManager.callEvent(entityCombustEvent);
|
||||
+ if (!entityCombustEvent.isCancelled()) {
|
||||
+ this.setSecondsOnFire(entityCombustEvent.getDuration(), false);
|
||||
+ this.igniteForSeconds(entityCombustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -765,7 +783,7 @@
|
|||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean flag) {
|
||||
@@ -2594,15 +3029,38 @@
|
||||
@@ -2600,15 +3046,38 @@
|
||||
|
||||
@Nullable
|
||||
public Entity changeDimension(WorldServer worldserver) {
|
||||
|
@ -806,7 +824,7 @@
|
|||
this.level().getProfiler().popPush("reloading");
|
||||
Entity entity = this.getType().create(worldserver);
|
||||
|
||||
@@ -2610,10 +3068,22 @@
|
||||
@@ -2616,10 +3085,22 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(shapedetectorshape.pos.x, shapedetectorshape.pos.y, shapedetectorshape.pos.z, shapedetectorshape.yRot, entity.getXRot());
|
||||
entity.setDeltaMovement(shapedetectorshape.speed);
|
||||
|
@ -832,7 +850,7 @@
|
|||
}
|
||||
|
||||
this.removeAfterChangingDimensions();
|
||||
@@ -2629,25 +3099,39 @@
|
||||
@@ -2635,25 +3116,39 @@
|
||||
}
|
||||
|
||||
protected void removeAfterChangingDimensions() {
|
||||
|
@ -878,7 +896,7 @@
|
|||
IBlockData iblockdata = this.level().getBlockState(this.portalEntrancePos);
|
||||
EnumDirection.EnumAxis enumdirection_enumaxis;
|
||||
Vec3D vec3d;
|
||||
@@ -2664,8 +3148,8 @@
|
||||
@@ -2670,8 +3165,8 @@
|
||||
vec3d = new Vec3D(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
|
@ -888,24 +906,24 @@
|
|||
+ }).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
} else {
|
||||
BlockPosition blockposition1;
|
||||
@@ -2675,8 +3159,14 @@
|
||||
BlockPosition blockposition1 = flag1 ? WorldServer.END_SPAWN_POINT : worldserver.getSharedSpawnPos();
|
||||
@@ -2684,8 +3179,14 @@
|
||||
} else {
|
||||
blockposition1 = worldserver.getHeightmapPos(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver.getSharedSpawnPos());
|
||||
i = worldserver.getChunkAt(blockposition1).getHeight(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, blockposition1.getX(), blockposition1.getZ()) + 1;
|
||||
}
|
||||
+ // CraftBukkit start
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, blockposition1.getY(), blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
+ CraftPortalEvent event = callPortalEvent(this, worldserver, new Vec3D(blockposition1.getX() + 0.5D, i, blockposition1.getZ() + 0.5D), PlayerTeleportEvent.TeleportCause.END_PORTAL, 0, 0);
|
||||
+ if (event == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY(), (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
- return new ShapeDetectorShape(new Vec3D((double) blockposition1.getX() + 0.5D, (double) i, (double) blockposition1.getZ() + 0.5D), this.getDeltaMovement(), this.getYRot(), this.getXRot());
|
||||
+ return new ShapeDetectorShape(new Vec3D(event.getTo().getX(), event.getTo().getY(), event.getTo().getZ()), this.getDeltaMovement(), this.getYRot(), this.getXRot(), ((CraftWorld) event.getTo().getWorld()).getHandle(), event);
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2684,8 +3174,23 @@
|
||||
@@ -2693,8 +3194,23 @@
|
||||
return BlockPortalShape.getRelativePosition(blockutil_rectangle, enumdirection_enumaxis, this.position(), this.getDimensions(this.getPose()));
|
||||
}
|
||||
|
||||
|
@ -931,7 +949,7 @@
|
|||
}
|
||||
|
||||
public boolean canChangeDimensions() {
|
||||
@@ -2806,6 +3311,12 @@
|
||||
@@ -2815,6 +3331,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -944,7 +962,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);
|
||||
|
||||
@@ -2824,8 +3335,12 @@
|
||||
@@ -2833,8 +3355,12 @@
|
||||
entity.restoreFrom(this);
|
||||
entity.moveTo(d0, d1, d2, f, f2);
|
||||
entity.setYHeadRot(f);
|
||||
|
@ -959,7 +977,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -2931,7 +3446,26 @@
|
||||
@@ -2942,7 +3468,26 @@
|
||||
}
|
||||
|
||||
public final void setBoundingBox(AxisAlignedBB axisalignedbb) {
|
||||
|
@ -986,8 +1004,8 @@
|
|||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
protected float getEyeHeight(EntityPose entitypose, EntitySize entitysize) {
|
||||
@@ -3246,6 +3780,11 @@
|
||||
public final float getEyeHeight(EntityPose entitypose) {
|
||||
@@ -3263,6 +3808,11 @@
|
||||
vec3d = vec3d.add(vec3d1);
|
||||
++k1;
|
||||
}
|
||||
|
@ -999,7 +1017,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -3517,6 +4056,14 @@
|
||||
@@ -3532,6 +4082,14 @@
|
||||
|
||||
@Override
|
||||
public final void setRemoved(Entity.RemovalReason entity_removalreason) {
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
||||
@@ -31,6 +31,13 @@
|
||||
@@ -30,6 +30,12 @@
|
||||
import net.minecraft.world.level.material.EnumPistonReaction;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import net.minecraft.resources.MinecraftKey;
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
|
@ -14,7 +13,7 @@
|
|||
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -216,7 +223,7 @@
|
||||
@@ -186,7 +192,7 @@
|
||||
}
|
||||
} else {
|
||||
if (this.tickCount >= this.waitTime + this.duration) {
|
||||
|
@ -23,7 +22,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -233,7 +240,7 @@
|
||||
@@ -203,7 +209,7 @@
|
||||
if (this.radiusPerTick != 0.0F) {
|
||||
f += this.radiusPerTick;
|
||||
if (f < 0.5F) {
|
||||
|
@ -32,7 +31,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -264,6 +271,7 @@
|
||||
@@ -237,6 +243,7 @@
|
||||
if (!list1.isEmpty()) {
|
||||
Iterator iterator1 = list1.iterator();
|
||||
|
||||
|
@ -40,10 +39,10 @@
|
|||
while (iterator1.hasNext()) {
|
||||
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
||||
|
||||
@@ -273,6 +281,17 @@
|
||||
double d8 = d6 * d6 + d7 * d7;
|
||||
@@ -246,6 +253,17 @@
|
||||
double d5 = d3 * d3 + d4 * d4;
|
||||
|
||||
if (d8 <= (double) (f * f)) {
|
||||
if (d5 <= (double) (f * f)) {
|
||||
+ // CraftBukkit start
|
||||
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
||||
+ }
|
||||
|
@ -58,9 +57,9 @@
|
|||
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
||||
Iterator iterator2 = list.iterator();
|
||||
|
||||
@@ -282,14 +301,14 @@
|
||||
if (mobeffect1.getEffect().isInstantenous()) {
|
||||
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
@@ -255,14 +273,14 @@
|
||||
if (((MobEffectList) mobeffect1.getEffect().value()).isInstantenous()) {
|
||||
((MobEffectList) mobeffect1.getEffect().value()).applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
||||
} else {
|
||||
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
||||
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
||||
|
@ -75,7 +74,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@@ -299,7 +318,7 @@
|
||||
@@ -272,7 +290,7 @@
|
||||
if (this.durationOnUse != 0) {
|
||||
this.duration += this.durationOnUse;
|
||||
if (this.duration <= 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityCreature.java
|
||||
+++ b/net/minecraft/world/entity/EntityCreature.java
|
||||
@@ -9,6 +9,10 @@
|
||||
@@ -11,6 +11,10 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public abstract class EntityCreature extends EntityInsentient {
|
||||
|
||||
protected static final float DEFAULT_WALK_TARGET_VALUE = 0.0F;
|
||||
@@ -51,6 +55,7 @@
|
||||
@@ -67,6 +71,7 @@
|
||||
|
||||
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isInSittingPose()) {
|
||||
if (f > 10.0F) {
|
||||
|
@ -19,7 +19,7 @@
|
|||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -59,6 +64,7 @@
|
||||
@@ -75,6 +80,7 @@
|
||||
|
||||
this.onLeashDistance(f);
|
||||
if (f > 10.0F) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
+++ b/net/minecraft/world/entity/EntityExperienceOrb.java
|
||||
@@ -21,6 +21,14 @@
|
||||
@@ -22,6 +22,14 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
|||
public class EntityExperienceOrb extends Entity {
|
||||
|
||||
private static final int LIFETIME = 6000;
|
||||
@@ -59,6 +67,7 @@
|
||||
@@ -65,6 +73,7 @@
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
@ -23,7 +23,7 @@
|
|||
this.xo = this.getX();
|
||||
this.yo = this.getY();
|
||||
this.zo = this.getZ();
|
||||
@@ -84,7 +93,22 @@
|
||||
@@ -90,7 +99,22 @@
|
||||
this.followingPlayer = null;
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
|||
Vec3D vec3d = new Vec3D(this.followingPlayer.getX() - this.getX(), this.followingPlayer.getY() + (double) this.followingPlayer.getEyeHeight() / 2.0D - this.getY(), this.followingPlayer.getZ() - this.getZ());
|
||||
double d0 = vec3d.lengthSqr();
|
||||
|
||||
@@ -109,7 +133,7 @@
|
||||
@@ -115,7 +139,7 @@
|
||||
|
||||
++this.age;
|
||||
if (this.age >= 6000) {
|
||||
|
@ -56,7 +56,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -178,7 +202,7 @@
|
||||
@@ -184,7 +208,7 @@
|
||||
private void merge(EntityExperienceOrb entityexperienceorb) {
|
||||
this.count += entityexperienceorb.count;
|
||||
this.age = Math.min(this.age, entityexperienceorb.age);
|
||||
|
@ -65,7 +65,7 @@
|
|||
}
|
||||
|
||||
private void setUnderwaterMovement() {
|
||||
@@ -200,7 +224,7 @@
|
||||
@@ -206,7 +230,7 @@
|
||||
this.markHurt();
|
||||
this.health = (int) ((float) this.health - f);
|
||||
if (this.health <= 0) {
|
||||
|
@ -74,7 +74,7 @@
|
|||
}
|
||||
|
||||
return true;
|
||||
@@ -227,17 +251,17 @@
|
||||
@@ -233,17 +257,17 @@
|
||||
public void playerTouch(EntityHuman entityhuman) {
|
||||
if (!this.level().isClientSide) {
|
||||
if (entityhuman.takeXpDelay == 0) {
|
||||
|
@ -95,7 +95,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -250,9 +274,17 @@
|
||||
@@ -256,9 +280,17 @@
|
||||
if (entry != null) {
|
||||
ItemStack itemstack = (ItemStack) entry.getValue();
|
||||
int j = Math.min(this.xpToDurability(i), itemstack.getDamageValue());
|
||||
|
@ -113,7 +113,7 @@
|
|||
|
||||
return k > 0 ? this.repairPlayerItems(entityhuman, k) : 0;
|
||||
} else {
|
||||
@@ -277,6 +309,24 @@
|
||||
@@ -283,6 +315,24 @@
|
||||
}
|
||||
|
||||
public static int getExperienceValue(int i) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/EntityInsentient.java
|
||||
+++ b/net/minecraft/world/entity/EntityInsentient.java
|
||||
@@ -76,6 +76,20 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
@@ -89,6 +89,20 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -18,10 +18,10 @@
|
|||
+import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason;
|
||||
+// CraftBukkit end
|
||||
+
|
||||
public abstract class EntityInsentient extends EntityLiving implements Targeting {
|
||||
public abstract class EntityInsentient extends EntityLiving implements EquipmentUser, Targeting {
|
||||
|
||||
private static final DataWatcherObject<Byte> DATA_MOB_FLAGS_ID = DataWatcher.defineId(EntityInsentient.class, DataWatcherRegistry.BYTE);
|
||||
@@ -123,6 +137,8 @@
|
||||
@@ -138,6 +152,8 @@
|
||||
private BlockPosition restrictCenter;
|
||||
private float restrictRadius;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
protected EntityInsentient(EntityTypes<? extends EntityInsentient> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
this.handItems = NonNullList.withSize(2, ItemStack.EMPTY);
|
||||
@@ -148,6 +164,12 @@
|
||||
@@ -165,6 +181,12 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,12 @@
|
|||
protected void registerGoals() {}
|
||||
|
||||
public static AttributeProvider.Builder createMobAttributes() {
|
||||
@@ -259,7 +281,38 @@
|
||||
@@ -269,11 +291,42 @@
|
||||
|
||||
@Nullable
|
||||
protected final EntityLiving getTargetFromBrain() {
|
||||
- return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse((Object) null);
|
||||
+ return (EntityLiving) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
public void setTarget(@Nullable EntityLiving entityliving) {
|
||||
|
@ -82,7 +87,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -399,6 +452,12 @@
|
||||
@@ -412,6 +465,12 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -95,16 +100,16 @@
|
|||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.addAdditionalSaveData(nbttagcompound);
|
||||
@@ -457,7 +516,7 @@
|
||||
@@ -486,7 +545,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
nbttagcompound.put("HandDropChances", nbttaglist3);
|
||||
- if (this.leashHolder != null) {
|
||||
+ if (this.leashHolder != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
nbttagcompound2 = new NBTTagCompound();
|
||||
if (this.leashHolder instanceof EntityLiving) {
|
||||
UUID uuid = this.leashHolder.getUUID();
|
||||
@@ -488,16 +547,26 @@
|
||||
- if (either != null) {
|
||||
+ if (either != null && !this.leashHolder.pluginRemoved) { // CraftBukkit - SPIGOT-7487: Don't save (and possible drop) leash, when the holder was removed by a plugin
|
||||
nbttagcompound.put("leash", (NBTBase) either.map((uuid) -> {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
@@ -507,16 +566,26 @@
|
||||
nbttagcompound.putBoolean("NoAI", this.isNoAi());
|
||||
}
|
||||
|
||||
|
@ -131,9 +136,18 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
NBTTagList nbttaglist;
|
||||
NBTTagCompound nbttagcompound1;
|
||||
int i;
|
||||
|
||||
@@ -544,6 +613,11 @@
|
||||
@@ -565,7 +634,7 @@
|
||||
if (nbttagcompound.contains("leash", 10)) {
|
||||
this.delayedLeashInfo = Either.left(nbttagcompound.getCompound("leash").getUUID("UUID"));
|
||||
} else if (nbttagcompound.contains("leash", 11)) {
|
||||
- this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse((Object) null);
|
||||
+ this.delayedLeashInfo = (Either) GameProfileSerializer.readBlockPos(nbttagcompound, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error
|
||||
} else {
|
||||
this.delayedLeashInfo = null;
|
||||
}
|
||||
@@ -577,6 +646,11 @@
|
||||
}
|
||||
|
||||
this.setNoAi(nbttagcompound.getBoolean("NoAI"));
|
||||
|
@ -145,7 +159,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -611,20 +685,26 @@
|
||||
@@ -651,20 +725,26 @@
|
||||
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
@ -174,7 +188,7 @@
|
|||
EnumItemSlot enumitemslot = getEquipmentSlotForItem(itemstack);
|
||||
ItemStack itemstack1 = this.getItemBySlot(enumitemslot);
|
||||
boolean flag = this.canReplaceCurrentItem(itemstack, itemstack1);
|
||||
@@ -635,11 +715,19 @@
|
||||
@@ -675,11 +755,19 @@
|
||||
flag = itemstack1.isEmpty();
|
||||
}
|
||||
|
||||
|
@ -195,7 +209,7 @@
|
|||
}
|
||||
|
||||
if (enumitemslot.isArmor() && itemstack.getCount() > 1) {
|
||||
@@ -760,7 +848,7 @@
|
||||
@@ -813,7 +901,7 @@
|
||||
@Override
|
||||
public void checkDespawn() {
|
||||
if (this.level().getDifficulty() == EnumDifficulty.PEACEFUL && this.shouldDespawnInPeaceful()) {
|
||||
|
@ -204,7 +218,7 @@
|
|||
} else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) {
|
||||
EntityHuman entityhuman = this.level().getNearestPlayer(this, -1.0D);
|
||||
|
||||
@@ -770,14 +858,14 @@
|
||||
@@ -823,14 +911,14 @@
|
||||
int j = i * i;
|
||||
|
||||
if (d0 > (double) j && this.removeWhenFarAway(d0)) {
|
||||
|
@ -221,15 +235,15 @@
|
|||
} else if (d0 < (double) l) {
|
||||
this.noActionTime = 0;
|
||||
}
|
||||
@@ -791,6 +879,7 @@
|
||||
@@ -844,6 +932,7 @@
|
||||
@Override
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
+ if (!this.aware) return; // CraftBukkit
|
||||
this.level().getProfiler().push("sensing");
|
||||
this.sensing.tick();
|
||||
this.level().getProfiler().pop();
|
||||
@@ -1184,6 +1273,12 @@
|
||||
GameProfilerFiller gameprofilerfiller = this.level().getProfiler();
|
||||
|
||||
gameprofilerfiller.push("sensing");
|
||||
@@ -1311,6 +1400,12 @@
|
||||
if (!this.isAlive()) {
|
||||
return EnumInteractionResult.PASS;
|
||||
} else if (this.getLeashHolder() == entityhuman) {
|
||||
|
@ -239,10 +253,10 @@
|
|||
+ return EnumInteractionResult.PASS;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.dropLeash(true, !entityhuman.getAbilities().instabuild);
|
||||
this.dropLeash(true, !entityhuman.hasInfiniteMaterials());
|
||||
this.gameEvent(GameEvent.ENTITY_INTERACT, entityhuman);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1209,6 +1304,12 @@
|
||||
@@ -1336,6 +1431,12 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.LEAD) && this.canBeLeashed(entityhuman)) {
|
||||
|
@ -255,7 +269,7 @@
|
|||
this.setLeashedTo(entityhuman, true);
|
||||
itemstack.shrink(1);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
@@ -1224,7 +1325,7 @@
|
||||
@@ -1351,7 +1452,7 @@
|
||||
if (itemstack.getItem() instanceof ItemMonsterEgg) {
|
||||
if (this.level() instanceof WorldServer) {
|
||||
ItemMonsterEgg itemmonsteregg = (ItemMonsterEgg) itemstack.getItem();
|
||||
|
@ -264,7 +278,7 @@
|
|||
|
||||
optional.ifPresent((entityinsentient) -> {
|
||||
this.onOffspringSpawnedFromEgg(entityhuman, entityinsentient);
|
||||
@@ -1274,12 +1375,19 @@
|
||||
@@ -1401,12 +1502,19 @@
|
||||
return this.restrictRadius != -1.0F;
|
||||
}
|
||||
|
||||
|
@ -285,7 +299,7 @@
|
|||
|
||||
if (t0 == null) {
|
||||
return null;
|
||||
@@ -1313,7 +1421,12 @@
|
||||
@@ -1440,7 +1548,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -299,7 +313,7 @@
|
|||
if (this.isPassenger()) {
|
||||
Entity entity = this.getVehicle();
|
||||
|
||||
@@ -1321,7 +1434,7 @@
|
||||
@@ -1448,7 +1561,7 @@
|
||||
t0.startRiding(entity, true);
|
||||
}
|
||||
|
||||
|
@ -308,7 +322,7 @@
|
|||
return t0;
|
||||
}
|
||||
}
|
||||
@@ -1334,7 +1447,8 @@
|
||||
@@ -1461,7 +1574,8 @@
|
||||
|
||||
if (this.leashHolder != null) {
|
||||
if (!this.isAlive() || !this.leashHolder.isAlive()) {
|
||||
|
@ -318,9 +332,9 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1345,7 +1459,9 @@
|
||||
this.leashHolder = null;
|
||||
this.leashInfoTag = null;
|
||||
@@ -1473,7 +1587,9 @@
|
||||
this.delayedLeashInfo = null;
|
||||
this.clearRestriction();
|
||||
if (!this.level().isClientSide && flag1) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
|
@ -328,7 +342,7 @@
|
|||
}
|
||||
|
||||
if (!this.level().isClientSide && flag && this.level() instanceof WorldServer) {
|
||||
@@ -1395,6 +1511,7 @@
|
||||
@@ -1527,6 +1643,7 @@
|
||||
boolean flag1 = super.startRiding(entity, flag);
|
||||
|
||||
if (flag1 && this.isLeashed()) {
|
||||
|
@ -336,27 +350,27 @@
|
|||
this.dropLeash(true, true);
|
||||
}
|
||||
|
||||
@@ -1419,7 +1536,9 @@
|
||||
}
|
||||
@@ -1555,7 +1672,9 @@
|
||||
}
|
||||
|
||||
if (this.tickCount > 100) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.leashInfoTag = null;
|
||||
if (this.tickCount > 100) {
|
||||
+ this.forceDrops = true; // CraftBukkit
|
||||
this.spawnAtLocation((IMaterial) Items.LEAD);
|
||||
+ this.forceDrops = false; // CraftBukkit
|
||||
this.delayedLeashInfo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1501,14 +1620,21 @@
|
||||
@@ -1638,14 +1757,21 @@
|
||||
int i = EnchantmentManager.getFireAspect(this);
|
||||
|
||||
if (i > 0) {
|
||||
- entity.setSecondsOnFire(i * 4);
|
||||
- entity.igniteForSeconds(i * 4);
|
||||
+ // CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
|
||||
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), i * 4);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
||||
+
|
||||
+ if (!combustEvent.isCancelled()) {
|
||||
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
|
||||
+ entity.igniteForSeconds(combustEvent.getDuration(), false);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -370,7 +384,7 @@
|
|||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
}
|
||||
|
||||
@@ -1576,6 +1702,7 @@
|
||||
@@ -1695,6 +1821,7 @@
|
||||
@Override
|
||||
protected void removeAfterChangingDimensions() {
|
||||
super.removeAfterChangingDimensions();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLightning.java
|
||||
+++ b/net/minecraft/world/entity/EntityLightning.java
|
||||
@@ -29,6 +29,11 @@
|
||||
@@ -30,6 +30,11 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class EntityLightning extends Entity {
|
||||
|
||||
private static final int START_LIFE = 2;
|
||||
@@ -120,7 +125,7 @@
|
||||
@@ -121,7 +126,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
} else if (this.life < -this.random.nextInt(10)) {
|
||||
--this.flashes;
|
||||
this.life = 1;
|
||||
@@ -129,7 +134,7 @@
|
||||
@@ -130,7 +135,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
|||
if (!(this.level() instanceof WorldServer)) {
|
||||
this.level().setSkyFlashTime(2);
|
||||
} else if (!this.visualOnly) {
|
||||
@@ -163,8 +168,12 @@
|
||||
@@ -164,8 +169,12 @@
|
||||
IBlockData iblockdata = BlockFireAbstract.getState(this.level(), blockposition);
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
|
@ -45,7 +45,7 @@
|
|||
}
|
||||
|
||||
for (int j = 0; j < i; ++j) {
|
||||
@@ -172,8 +181,12 @@
|
||||
@@ -173,8 +182,12 @@
|
||||
|
||||
iblockdata = BlockFireAbstract.getState(this.level(), blockposition1);
|
||||
if (this.level().getBlockState(blockposition1).isAir() && iblockdata.canSurvive(this.level(), blockposition1)) {
|
||||
|
@ -60,7 +60,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -237,8 +250,9 @@
|
||||
@@ -238,8 +251,9 @@
|
||||
iblockdata = world.getBlockState(blockposition1);
|
||||
} while (!(iblockdata.getBlock() instanceof WeatheringCopper));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/EntityLiving.java
|
||||
+++ b/net/minecraft/world/entity/EntityLiving.java
|
||||
@@ -119,6 +119,32 @@
|
||||
@@ -126,6 +126,32 @@
|
||||
import net.minecraft.world.scores.ScoreboardTeam;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
|
@ -33,21 +33,10 @@
|
|||
public abstract class EntityLiving extends Entity implements Attackable {
|
||||
|
||||
private static final Logger LOGGER = LogUtils.getLogger();
|
||||
@@ -214,7 +240,7 @@
|
||||
private int noJumpDelay;
|
||||
private float absorptionAmount;
|
||||
protected ItemStack useItem;
|
||||
- protected int useItemRemaining;
|
||||
+ public int useItemRemaining;
|
||||
protected int fallFlyTicks;
|
||||
private BlockPosition lastPos;
|
||||
private Optional<BlockPosition> lastClimbablePos;
|
||||
@@ -225,7 +251,21 @@
|
||||
private float swimAmount;
|
||||
private float swimAmountO;
|
||||
@@ -237,6 +263,20 @@
|
||||
protected BehaviorController<?> brain;
|
||||
- private boolean skipDropExperience;
|
||||
+ protected boolean skipDropExperience;
|
||||
protected boolean skipDropExperience;
|
||||
protected float appliedScale;
|
||||
+ // CraftBukkit start
|
||||
+ public int expToDrop;
|
||||
+ public boolean forceDrops;
|
||||
|
@ -65,9 +54,9 @@
|
|||
|
||||
protected EntityLiving(EntityTypes<? extends EntityLiving> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -238,7 +278,9 @@
|
||||
this.useItem = ItemStack.EMPTY;
|
||||
@@ -251,7 +291,9 @@
|
||||
this.lastClimbablePos = Optional.empty();
|
||||
this.appliedScale = 1.0F;
|
||||
this.attributes = new AttributeMapBase(AttributeDefaults.getSupplier(entitytypes));
|
||||
- this.setHealth(this.getMaxHealth());
|
||||
+ this.craftAttributes = new CraftAttributeMap(attributes); // CraftBukkit
|
||||
|
@ -76,22 +65,22 @@
|
|||
this.blocksBuilding = true;
|
||||
this.rotA = (float) ((Math.random() + 1.0D) * 0.009999999776482582D);
|
||||
this.reapplyPosition();
|
||||
@@ -317,7 +359,13 @@
|
||||
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d7);
|
||||
@@ -329,7 +371,13 @@
|
||||
double d8 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
|
||||
int i = (int) (150.0D * d8);
|
||||
|
||||
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.level()).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), this.getX(), this.getY(), this.getZ(), i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d1, d2, d3, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
- ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ // CraftBukkit start - visiblity api
|
||||
+ if (this instanceof EntityPlayer) {
|
||||
+ ((WorldServer) this.level()).sendParticles((EntityPlayer) this, new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, false);
|
||||
+ } else {
|
||||
+ ((WorldServer) this.level()).sendParticles(new ParticleParamBlock(Particles.BLOCK, iblockdata), d2, d3, d4, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
}
|
||||
|
||||
super.checkFallDamage(d0, flag, iblockdata, blockposition);
|
||||
@@ -573,7 +621,7 @@
|
||||
@@ -594,7 +642,7 @@
|
||||
++this.deathTime;
|
||||
if (this.deathTime >= 20 && !this.level().isClientSide() && !this.isRemoved()) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 60);
|
||||
|
@ -100,7 +89,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -672,13 +720,19 @@
|
||||
@@ -693,13 +741,19 @@
|
||||
}
|
||||
|
||||
public void onEquipItem(EnumItemSlot enumitemslot, ItemStack itemstack, ItemStack itemstack1) {
|
||||
|
@ -112,32 +101,39 @@
|
|||
+ // CraftBukkit end
|
||||
boolean flag = itemstack1.isEmpty() && itemstack.isEmpty();
|
||||
|
||||
if (!flag && !ItemStack.isSameItemSameTags(itemstack, itemstack1) && !this.firstTick) {
|
||||
if (!flag && !ItemStack.isSameItemSameComponents(itemstack, itemstack1) && !this.firstTick) {
|
||||
Equipable equipable = Equipable.get(itemstack1);
|
||||
|
||||
if (!this.level().isClientSide() && !this.isSpectator()) {
|
||||
- if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot) {
|
||||
+ if (!this.isSilent() && equipable != null && equipable.getEquipmentSlot() == enumitemslot && !silent) { // CraftBukkit
|
||||
this.level().playSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F);
|
||||
this.level().playSeededSound((EntityHuman) null, this.getX(), this.getY(), this.getZ(), equipable.getEquipSound(), this.getSoundSource(), 1.0F, 1.0F, this.random.nextLong());
|
||||
}
|
||||
|
||||
@@ -692,7 +746,14 @@
|
||||
@@ -713,6 +767,13 @@
|
||||
|
||||
@Override
|
||||
public void remove(Entity.RemovalReason entity_removalreason) {
|
||||
- super.remove(entity_removalreason);
|
||||
+ // CraftBukkit start - add Bukkit remove cause
|
||||
+ this.remove(entity_removalreason, null);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void remove(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) {
|
||||
+ super.remove(entity_removalreason, cause);
|
||||
+ // CraftBukkit end
|
||||
if (entity_removalreason == Entity.RemovalReason.KILLED || entity_removalreason == Entity.RemovalReason.DISCARDED) {
|
||||
Iterator iterator = this.getActiveEffects().iterator();
|
||||
|
||||
@@ -723,7 +784,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- super.remove(entity_removalreason);
|
||||
+ super.remove(entity_removalreason, cause); // CraftBukkit
|
||||
this.brain.clearMemories();
|
||||
}
|
||||
|
||||
@@ -752,6 +813,17 @@
|
||||
@@ -783,6 +844,17 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -155,7 +151,7 @@
|
|||
if (nbttagcompound.contains("Health", 99)) {
|
||||
this.setHealth(nbttagcompound.getFloat("Health"));
|
||||
}
|
||||
@@ -789,9 +861,32 @@
|
||||
@@ -821,9 +893,32 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -165,7 +161,7 @@
|
|||
+
|
||||
+ private static class ProcessableEffect {
|
||||
+
|
||||
+ private MobEffectList type;
|
||||
+ private Holder<MobEffectList> type;
|
||||
+ private MobEffect effect;
|
||||
+ private final EntityPotionEffectEvent.Cause cause;
|
||||
+
|
||||
|
@ -174,7 +170,7 @@
|
|||
+ this.cause = cause;
|
||||
+ }
|
||||
+
|
||||
+ private ProcessableEffect(MobEffectList type, EntityPotionEffectEvent.Cause cause) {
|
||||
+ private ProcessableEffect(Holder<MobEffectList> type, EntityPotionEffectEvent.Cause cause) {
|
||||
+ this.type = type;
|
||||
+ this.cause = cause;
|
||||
+ }
|
||||
|
@ -182,13 +178,13 @@
|
|||
+ // CraftBukkit end
|
||||
+
|
||||
protected void tickEffects() {
|
||||
Iterator iterator = this.activeEffects.keySet().iterator();
|
||||
Iterator<Holder<MobEffectList>> iterator = this.activeEffects.keySet().iterator();
|
||||
|
||||
+ isTickingEffects = true; // CraftBukkit
|
||||
try {
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectList mobeffectlist = (MobEffectList) iterator.next();
|
||||
@@ -801,6 +896,12 @@
|
||||
Holder<MobEffectList> holder = (Holder) iterator.next();
|
||||
@@ -833,6 +928,12 @@
|
||||
this.onEffectUpdated(mobeffect, true, (Entity) null);
|
||||
})) {
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -201,7 +197,7 @@
|
|||
iterator.remove();
|
||||
this.onEffectRemoved(mobeffect);
|
||||
}
|
||||
@@ -811,6 +912,17 @@
|
||||
@@ -843,6 +944,17 @@
|
||||
} catch (ConcurrentModificationException concurrentmodificationexception) {
|
||||
;
|
||||
}
|
||||
|
@ -219,8 +215,8 @@
|
|||
|
||||
if (this.effectsDirty) {
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -937,7 +1049,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_COLOR_ID, 0);
|
||||
@@ -958,7 +1070,13 @@
|
||||
this.entityData.set(EntityLiving.DATA_EFFECT_PARTICLES, List.of());
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
|
@ -233,7 +229,7 @@
|
|||
if (this.level().isClientSide) {
|
||||
return false;
|
||||
} else {
|
||||
@@ -946,7 +1064,14 @@
|
||||
@@ -967,7 +1085,14 @@
|
||||
boolean flag;
|
||||
|
||||
for (flag = false; iterator.hasNext(); flag = true) {
|
||||
|
@ -249,7 +245,7 @@
|
|||
iterator.remove();
|
||||
}
|
||||
|
||||
@@ -975,19 +1100,49 @@
|
||||
@@ -996,20 +1121,50 @@
|
||||
return this.addEffect(mobeffect, (Entity) null);
|
||||
}
|
||||
|
||||
|
@ -291,6 +287,7 @@
|
|||
this.activeEffects.put(mobeffect.getEffect(), mobeffect);
|
||||
this.onEffectAdded(mobeffect, entity);
|
||||
flag = true;
|
||||
mobeffect.onEffectAdded(this);
|
||||
- } else if (mobeffect1.update(mobeffect)) {
|
||||
+ // CraftBukkit start
|
||||
+ } else if (event.isOverride()) {
|
||||
|
@ -300,24 +297,24 @@
|
|||
flag = true;
|
||||
}
|
||||
|
||||
@@ -1025,13 +1180,39 @@
|
||||
return this.getMobType() == EnumMonsterType.UNDEAD;
|
||||
@@ -1040,13 +1195,39 @@
|
||||
return this.getType().is(TagsEntity.INVERTED_HEALING_AND_HARM);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
@Nullable
|
||||
public MobEffect removeEffectNoUpdate(@Nullable MobEffectList mobeffectlist) {
|
||||
+ return c(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
public MobEffect removeEffectNoUpdate(Holder<MobEffectList> holder) {
|
||||
+ return removeEffectNoUpdate(holder, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public MobEffect c(@Nullable MobEffectList mobeffectlist, EntityPotionEffectEvent.Cause cause) {
|
||||
+ public MobEffect removeEffectNoUpdate(Holder<MobEffectList> holder, EntityPotionEffectEvent.Cause cause) {
|
||||
+ if (isTickingEffects) {
|
||||
+ effectsToProcess.add(new ProcessableEffect(mobeffectlist, cause));
|
||||
+ effectsToProcess.add(new ProcessableEffect(holder, cause));
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ MobEffect effect = this.activeEffects.get(mobeffectlist);
|
||||
+ MobEffect effect = this.activeEffects.get(holder);
|
||||
+ if (effect == null) {
|
||||
+ return null;
|
||||
+ }
|
||||
|
@ -327,21 +324,21 @@
|
|||
+ return null;
|
||||
+ }
|
||||
+
|
||||
return (MobEffect) this.activeEffects.remove(mobeffectlist);
|
||||
return (MobEffect) this.activeEffects.remove(holder);
|
||||
}
|
||||
|
||||
public boolean removeEffect(MobEffectList mobeffectlist) {
|
||||
- MobEffect mobeffect = this.removeEffectNoUpdate(mobeffectlist);
|
||||
+ return removeEffect(mobeffectlist, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
public boolean removeEffect(Holder<MobEffectList> holder) {
|
||||
- MobEffect mobeffect = this.removeEffectNoUpdate(holder);
|
||||
+ return removeEffect(holder, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.UNKNOWN);
|
||||
+ }
|
||||
+
|
||||
+ public boolean removeEffect(MobEffectList mobeffectlist, EntityPotionEffectEvent.Cause cause) {
|
||||
+ MobEffect mobeffect = this.c(mobeffectlist, cause);
|
||||
+ public boolean removeEffect(Holder<MobEffectList> holder, EntityPotionEffectEvent.Cause cause) {
|
||||
+ MobEffect mobeffect = this.removeEffectNoUpdate(holder, cause);
|
||||
+ // CraftBukkit end
|
||||
|
||||
if (mobeffect != null) {
|
||||
this.onEffectRemoved(mobeffect);
|
||||
@@ -1129,20 +1310,55 @@
|
||||
@@ -1142,20 +1323,55 @@
|
||||
|
||||
}
|
||||
|
||||
|
@ -398,7 +395,7 @@
|
|||
this.entityData.set(EntityLiving.DATA_HEALTH_ID, MathHelper.clamp(f, 0.0F, this.getMaxHealth()));
|
||||
}
|
||||
|
||||
@@ -1156,7 +1372,7 @@
|
||||
@@ -1169,7 +1385,7 @@
|
||||
return false;
|
||||
} else if (this.level().isClientSide) {
|
||||
return false;
|
||||
|
@ -407,7 +404,7 @@
|
|||
return false;
|
||||
} else if (damagesource.is(DamageTypeTags.IS_FIRE) && this.hasEffect(MobEffects.FIRE_RESISTANCE)) {
|
||||
return false;
|
||||
@@ -1167,10 +1383,11 @@
|
||||
@@ -1180,10 +1396,11 @@
|
||||
|
||||
this.noActionTime = 0;
|
||||
float f1 = f;
|
||||
|
@ -421,7 +418,17 @@
|
|||
this.hurtCurrentlyUsedShield(f);
|
||||
f2 = f;
|
||||
f = 0.0F;
|
||||
@@ -1194,23 +1411,33 @@
|
||||
@@ -1204,7 +1421,8 @@
|
||||
f *= 5.0F;
|
||||
}
|
||||
|
||||
- if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
+ if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.hurtHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
@@ -1212,18 +1430,27 @@
|
||||
this.walkAnimation.setSpeed(1.5F);
|
||||
boolean flag1 = true;
|
||||
|
||||
|
@ -453,14 +460,7 @@
|
|||
this.hurtDuration = 10;
|
||||
this.hurtTime = this.hurtDuration;
|
||||
}
|
||||
|
||||
- if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
+ if (false && damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
this.hurtHelmet(damagesource, f);
|
||||
f *= 0.75F;
|
||||
}
|
||||
@@ -1269,7 +1496,7 @@
|
||||
@@ -1282,7 +1509,7 @@
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
|
@ -469,7 +469,7 @@
|
|||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1317,7 +1544,7 @@
|
||||
@@ -1335,7 +1562,7 @@
|
||||
}
|
||||
|
||||
protected void blockedByShield(EntityLiving entityliving) {
|
||||
|
@ -478,7 +478,7 @@
|
|||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource damagesource) {
|
||||
@@ -1328,19 +1555,32 @@
|
||||
@@ -1346,19 +1573,32 @@
|
||||
EnumHand[] aenumhand = EnumHand.values();
|
||||
int i = aenumhand.length;
|
||||
|
||||
|
@ -515,7 +515,7 @@
|
|||
EntityPlayer entityplayer = (EntityPlayer) this;
|
||||
|
||||
entityplayer.awardStat(StatisticList.ITEM_USED.get(Items.TOTEM_OF_UNDYING));
|
||||
@@ -1349,14 +1589,16 @@
|
||||
@@ -1367,14 +1607,16 @@
|
||||
}
|
||||
|
||||
this.setHealth(1.0F);
|
||||
|
@ -537,7 +537,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1463,14 +1705,22 @@
|
||||
@@ -1481,14 +1723,22 @@
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.defaultBlockState();
|
||||
|
||||
if (this.level().getBlockState(blockposition).isAir() && iblockdata.canSurvive(this.level(), blockposition)) {
|
||||
|
@ -562,7 +562,7 @@
|
|||
this.level().addFreshEntity(entityitem);
|
||||
}
|
||||
}
|
||||
@@ -1490,21 +1740,40 @@
|
||||
@@ -1508,21 +1758,40 @@
|
||||
|
||||
boolean flag = this.lastHurtByPlayerTime > 0;
|
||||
|
||||
|
@ -606,7 +606,7 @@
|
|||
|
||||
}
|
||||
|
||||
@@ -1533,13 +1802,25 @@
|
||||
@@ -1551,13 +1820,25 @@
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2) {
|
||||
|
@ -635,7 +635,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -1596,6 +1877,28 @@
|
||||
@@ -1614,6 +1895,28 @@
|
||||
return itemstack.getEatingSound();
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@
|
|||
public Optional<BlockPosition> getLastClimbablePos() {
|
||||
return this.lastClimbablePos;
|
||||
}
|
||||
@@ -1642,9 +1945,14 @@
|
||||
@@ -1669,9 +1972,14 @@
|
||||
int i = this.calculateFallDamage(f, f1);
|
||||
|
||||
if (i > 0) {
|
||||
|
@ -680,16 +680,16 @@
|
|||
return true;
|
||||
} else {
|
||||
return flag;
|
||||
@@ -1696,7 +2004,7 @@
|
||||
@@ -1741,7 +2049,7 @@
|
||||
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource damagesource, float f) {
|
||||
if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
- this.hurtArmor(damagesource, f);
|
||||
+ // this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
f = CombatMath.getDamageAfterAbsorb(f, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
f = CombatMath.getDamageAfterAbsorb(f, damagesource, (float) this.getArmorValue(), (float) this.getAttributeValue(GenericAttributes.ARMOR_TOUGHNESS));
|
||||
}
|
||||
|
||||
@@ -1709,7 +2017,8 @@
|
||||
@@ -1754,7 +2062,8 @@
|
||||
} else {
|
||||
int i;
|
||||
|
||||
|
@ -699,7 +699,7 @@
|
|||
i = (this.getEffect(MobEffects.DAMAGE_RESISTANCE).getAmplifier() + 1) * 5;
|
||||
int j = 25 - i;
|
||||
float f1 = f * (float) j;
|
||||
@@ -1742,16 +2051,125 @@
|
||||
@@ -1787,16 +2096,125 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -746,7 +746,7 @@
|
|||
+ };
|
||||
+ float armorModifier = armor.apply((double) f).floatValue();
|
||||
+ f += armorModifier;
|
||||
+
|
||||
|
||||
+ Function<Double, Double> resistance = new Function<Double, Double>() {
|
||||
+ @Override
|
||||
+ public Double apply(Double f) {
|
||||
|
@ -805,7 +805,7 @@
|
|||
+ if (damagesource.is(DamageTypeTags.DAMAGES_HELMET) && !this.getItemBySlot(EnumItemSlot.HEAD).isEmpty()) {
|
||||
+ this.hurtHelmet(damagesource, f);
|
||||
+ }
|
||||
|
||||
+
|
||||
+ // Apply damage to armor
|
||||
+ if (!damagesource.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
+ float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT));
|
||||
|
@ -833,7 +833,7 @@
|
|||
if (f2 > 0.0F && f2 < 3.4028235E37F) {
|
||||
Entity entity = damagesource.getEntity();
|
||||
|
||||
@@ -1762,13 +2180,47 @@
|
||||
@@ -1807,13 +2225,47 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -883,7 +883,7 @@
|
|||
}
|
||||
|
||||
public CombatTracker getCombatTracker() {
|
||||
@@ -1793,8 +2245,18 @@
|
||||
@@ -1838,8 +2290,18 @@
|
||||
}
|
||||
|
||||
public final void setArrowCount(int i) {
|
||||
|
@ -903,7 +903,7 @@
|
|||
|
||||
public final int getStingerCount() {
|
||||
return (Integer) this.entityData.get(EntityLiving.DATA_STINGER_COUNT_ID);
|
||||
@@ -2036,6 +2498,12 @@
|
||||
@@ -2075,6 +2537,12 @@
|
||||
|
||||
public abstract ItemStack getItemBySlot(EnumItemSlot enumitemslot);
|
||||
|
||||
|
@ -913,10 +913,10 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
@Override
|
||||
public abstract void setItemSlot(EnumItemSlot enumitemslot, ItemStack itemstack);
|
||||
|
||||
@@ -2270,6 +2738,7 @@
|
||||
public Iterable<ItemStack> getHandSlots() {
|
||||
@@ -2328,6 +2796,7 @@
|
||||
}
|
||||
|
||||
if (this.onGround() && !this.level().isClientSide) {
|
||||
|
@ -924,7 +924,7 @@
|
|||
this.setSharedFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@@ -2440,7 +2909,7 @@
|
||||
@@ -2498,7 +2967,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -933,8 +933,8 @@
|
|||
if (this.tickCount % 20 == 0) {
|
||||
this.getCombatTracker().recheckStatus();
|
||||
}
|
||||
@@ -2537,7 +3006,7 @@
|
||||
this.refreshDirtyAttributes();
|
||||
@@ -2602,7 +3071,7 @@
|
||||
|
||||
}
|
||||
|
||||
- public void detectEquipmentUpdates() {
|
||||
|
@ -942,7 +942,7 @@
|
|||
Map<EnumItemSlot, ItemStack> map = this.collectEquipmentChanges();
|
||||
|
||||
if (map != null) {
|
||||
@@ -2839,6 +3308,7 @@
|
||||
@@ -2924,6 +3393,7 @@
|
||||
}
|
||||
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -950,7 +950,7 @@
|
|||
this.setSharedFlag(7, flag);
|
||||
}
|
||||
|
||||
@@ -3029,14 +3499,21 @@
|
||||
@@ -3114,14 +3584,21 @@
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
|
@ -974,7 +974,7 @@
|
|||
@Override
|
||||
public float getYHeadRot() {
|
||||
return this.yHeadRot;
|
||||
@@ -3231,7 +3708,26 @@
|
||||
@@ -3314,7 +3791,26 @@
|
||||
} else {
|
||||
if (!this.useItem.isEmpty() && this.isUsingItem()) {
|
||||
this.triggerItemUseEffects(this.useItem, 16);
|
||||
|
@ -1002,7 +1002,7 @@
|
|||
|
||||
if (itemstack != this.useItem) {
|
||||
this.setItemInHand(enumhand, itemstack);
|
||||
@@ -3309,6 +3805,12 @@
|
||||
@@ -3392,6 +3888,12 @@
|
||||
}
|
||||
|
||||
public boolean randomTeleport(double d0, double d1, double d2, boolean flag) {
|
||||
|
@ -1015,7 +1015,7 @@
|
|||
double d3 = this.getX();
|
||||
double d4 = this.getY();
|
||||
double d5 = this.getZ();
|
||||
@@ -3333,16 +3835,41 @@
|
||||
@@ -3416,16 +3918,41 @@
|
||||
}
|
||||
|
||||
if (flag2) {
|
||||
|
@ -1060,7 +1060,7 @@
|
|||
} else {
|
||||
if (flag) {
|
||||
world.broadcastEntityEvent(this, (byte) 46);
|
||||
@@ -3354,7 +3881,7 @@
|
||||
@@ -3437,7 +3964,7 @@
|
||||
entitycreature.getNavigation().stop();
|
||||
}
|
||||
|
||||
|
@ -1069,7 +1069,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -3443,7 +3970,7 @@
|
||||
@@ -3530,7 +4057,7 @@
|
||||
}
|
||||
|
||||
public void stopSleeping() {
|
||||
|
@ -1078,7 +1078,7 @@
|
|||
World world = this.level();
|
||||
|
||||
java.util.Objects.requireNonNull(world);
|
||||
@@ -3477,7 +4004,7 @@
|
||||
@@ -3564,7 +4091,7 @@
|
||||
|
||||
@Nullable
|
||||
public EnumDirection getBedOrientation() {
|
||||
|
@ -1087,12 +1087,12 @@
|
|||
|
||||
return blockposition != null ? BlockBed.getBedOrientation(this.level(), blockposition) : null;
|
||||
}
|
||||
@@ -3525,7 +4052,7 @@
|
||||
Pair<MobEffect, Float> pair = (Pair) iterator.next();
|
||||
@@ -3600,7 +4127,7 @@
|
||||
FoodInfo.b foodinfo_b = (FoodInfo.b) iterator.next();
|
||||
|
||||
if (!world.isClientSide && pair.getFirst() != null && world.random.nextFloat() < (Float) pair.getSecond()) {
|
||||
- entityliving.addEffect(new MobEffect((MobEffect) pair.getFirst()));
|
||||
+ entityliving.addEffect(new MobEffect((MobEffect) pair.getFirst()), EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
|
||||
if (this.random.nextFloat() < foodinfo_b.probability()) {
|
||||
- this.addEffect(foodinfo_b.effect());
|
||||
+ this.addEffect(foodinfo_b.effect(), EntityPotionEffectEvent.Cause.FOOD); // CraftBukkit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
--- a/net/minecraft/world/entity/EntityTypes.java
|
||||
+++ b/net/minecraft/world/entity/EntityTypes.java
|
||||
@@ -160,6 +160,7 @@
|
||||
import net.minecraft.world.phys.AxisAlignedBB;
|
||||
@@ -168,6 +168,7 @@
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||
import net.minecraft.world.phys.shapes.VoxelShapes;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
public class EntityTypes<T extends Entity> implements FeatureElement, EntityTypeTest<Entity, T> {
|
||||
@@ -170,7 +171,7 @@
|
||||
private static final float MAGIC_HORSE_WIDTH = 1.3964844F;
|
||||
@@ -178,7 +179,7 @@
|
||||
private static final int DISPLAY_TRACKING_RANGE = 10;
|
||||
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).clientTrackingRange(8).updateInterval(2));
|
||||
- public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
|
||||
+ public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
||||
public static final EntityTypes<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));
|
||||
@@ -313,8 +314,8 @@
|
||||
private final EntitySize dimensions;
|
||||
public static final EntityTypes<Allay> ALLAY = register("allay", EntityTypes.Builder.of(Allay::new, EnumCreatureType.CREATURE).sized(0.35F, 0.6F).eyeHeight(0.36F).ridingOffset(0.04F).clientTrackingRange(8).updateInterval(2));
|
||||
public static final EntityTypes<EntityAreaEffectCloud> AREA_EFFECT_CLOUD = register("area_effect_cloud", EntityTypes.Builder.of(EntityAreaEffectCloud::new, EnumCreatureType.MISC).fireImmune().sized(6.0F, 0.5F).clientTrackingRange(10).updateInterval(Integer.MAX_VALUE));
|
||||
- public static final EntityTypes<Armadillo> ARMADILLO = register("armadillo", EntityTypes.Builder.of(Armadillo::new, EnumCreatureType.CREATURE).sized(0.7F, 0.65F).eyeHeight(0.26F).clientTrackingRange(10));
|
||||
+ public static final EntityTypes<Armadillo> ARMADILLO = register("armadillo", EntityTypes.Builder.of(Armadillo::new, EnumCreatureType.CREATURE).sized(0.7F, 0.65F).eyeHeight(0.26F).clientTrackingRange(10).updateInterval(10)); // CraftBukkit - SPIGOT-3729: track area effect clouds
|
||||
public static final EntityTypes<EntityArmorStand> ARMOR_STAND = register("armor_stand", EntityTypes.Builder.of(EntityArmorStand::new, EnumCreatureType.MISC).sized(0.5F, 1.975F).eyeHeight(1.7775F).clientTrackingRange(10));
|
||||
public static final EntityTypes<EntityTippedArrow> ARROW = register("arrow", EntityTypes.Builder.of(EntityTippedArrow::new, EnumCreatureType.MISC).sized(0.5F, 0.5F).eyeHeight(0.13F).clientTrackingRange(4).updateInterval(20));
|
||||
public static final EntityTypes<Axolotl> AXOLOTL = register("axolotl", EntityTypes.Builder.of(Axolotl::new, EnumCreatureType.AXOLOTLS).sized(0.75F, 0.42F).eyeHeight(0.2751F).clientTrackingRange(10));
|
||||
@@ -325,8 +326,8 @@
|
||||
private final float spawnDimensionsScale;
|
||||
private final FeatureFlagSet requiredFeatures;
|
||||
|
||||
- private static <T extends Entity> EntityTypes<T> register(String s, EntityTypes.Builder<T> entitytypes_builder) {
|
||||
|
@ -28,10 +28,11 @@
|
|||
}
|
||||
|
||||
public static MinecraftKey getKey(EntityTypes<?> entitytypes) {
|
||||
@@ -342,8 +343,15 @@
|
||||
@@ -355,7 +356,14 @@
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
- Consumer consumer;
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, itemstack, entityhuman, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ }
|
||||
|
@ -39,53 +40,51 @@
|
|||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable ItemStack itemstack, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
NBTTagCompound nbttagcompound;
|
||||
- Consumer consumer;
|
||||
+ Consumer<T> consumer; // CraftBukkit - decompile error
|
||||
|
||||
if (itemstack != null) {
|
||||
nbttagcompound = itemstack.getTag();
|
||||
@@ -354,7 +362,7 @@
|
||||
nbttagcompound = null;
|
||||
consumer = createDefaultStackConfig(worldserver, itemstack, entityhuman);
|
||||
@@ -364,7 +372,7 @@
|
||||
};
|
||||
}
|
||||
|
||||
- return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, spawnReason); // CraftBukkit
|
||||
- return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
+ return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1, spawnReason); // CraftBukkit
|
||||
}
|
||||
|
||||
public static <T extends Entity> Consumer<T> createDefaultStackConfig(WorldServer worldserver, ItemStack itemstack, @Nullable EntityHuman entityhuman) {
|
||||
@@ -376,21 +384,37 @@
|
||||
NBTTagCompound nbttagcompound = itemstack.getTag();
|
||||
@@ -388,21 +396,37 @@
|
||||
CustomData customdata = (CustomData) itemstack.getOrDefault(DataComponents.ENTITY_DATA, CustomData.EMPTY);
|
||||
|
||||
return nbttagcompound != null ? consumer.andThen((entity) -> {
|
||||
- updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, nbttagcompound); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
return !customdata.isEmpty() ? consumer.andThen((entity) -> {
|
||||
- updateCustomEntityTag(worldserver, entityhuman, entity, customdata);
|
||||
+ try { updateCustomEntityTag(worldserver, entityhuman, entity, customdata); } catch (Throwable t) { LOGGER.warn("Error loading spawn egg NBT", t); } // CraftBukkit - SPIGOT-5665
|
||||
}) : consumer;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn) {
|
||||
- return this.spawn(worldserver, (NBTTagCompound) null, (Consumer) null, blockposition, enummobspawn, false, false);
|
||||
- return this.spawn(worldserver, (Consumer) null, blockposition, enummobspawn, false, false);
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, blockposition, enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, BlockPosition blockposition, EnumMobSpawn enummobspawn, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ return this.spawn(worldserver, (NBTTagCompound) null, null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
|
||||
+ return this.spawn(worldserver, (Consumer<T>) null, blockposition, enummobspawn, false, false, spawnReason); // CraftBukkit - decompile error
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
public T spawn(WorldServer worldserver, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) {
|
||||
+ // CraftBukkit start
|
||||
+ return this.spawn(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ return this.spawn(worldserver, consumer, blockposition, enummobspawn, flag, flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DEFAULT);
|
||||
+ }
|
||||
+
|
||||
+ @Nullable
|
||||
+ public T spawn(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ public T spawn(WorldServer worldserver, @Nullable Consumer<T> consumer, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
+ // CraftBukkit end
|
||||
T t0 = this.create(worldserver, nbttagcompound, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
T t0 = this.create(worldserver, consumer, blockposition, enummobspawn, flag, flag1);
|
||||
|
||||
if (t0 != null) {
|
||||
- worldserver.addFreshEntityWithPassengers(t0);
|
||||
|
@ -95,7 +94,7 @@
|
|||
}
|
||||
|
||||
return t0;
|
||||
@@ -577,7 +601,7 @@
|
||||
@@ -583,7 +607,7 @@
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
@ -104,7 +103,7 @@
|
|||
}
|
||||
|
||||
public static Stream<Entity> loadEntitiesRecursive(final List<? extends NBTBase> list, final World world) {
|
||||
@@ -638,7 +662,7 @@
|
||||
@@ -644,7 +668,7 @@
|
||||
|
||||
@Nullable
|
||||
public T tryCast(Entity entity) {
|
||||
|
@ -113,7 +112,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -673,7 +697,7 @@
|
||||
@@ -681,7 +705,7 @@
|
||||
this.canSpawnFarFromPlayer = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/IEntityAngerable.java
|
||||
+++ b/net/minecraft/world/entity/IEntityAngerable.java
|
||||
@@ -108,7 +108,7 @@
|
||||
@@ -114,7 +114,7 @@
|
||||
default void stopBeingAngry() {
|
||||
this.setLastHurtByMob((EntityLiving) null);
|
||||
this.setPersistentAngerTarget((UUID) null);
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.setRemainingPersistentAngerTime(0);
|
||||
}
|
||||
|
||||
@@ -121,6 +121,8 @@
|
||||
@@ -127,6 +127,8 @@
|
||||
|
||||
void setTarget(@Nullable EntityLiving entityliving);
|
||||
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
Logger logger;
|
||||
|
||||
if (nbttagcompound.contains("attack")) {
|
||||
@@ -143,12 +149,19 @@
|
||||
@@ -142,9 +148,16 @@
|
||||
@Override
|
||||
public boolean skipAttackInteraction(Entity entity) {
|
||||
if (entity instanceof EntityHuman) {
|
||||
EntityHuman entityhuman = (EntityHuman) entity;
|
||||
if (entity instanceof EntityHuman entityhuman) {
|
||||
+ // CraftBukkit start
|
||||
+ DamageSource source = entityhuman.damageSources().playerAttack(entityhuman);
|
||||
+ EntityDamageEvent event = CraftEventFactory.callNonLivingEntityDamageEvent(this, source, 1.0F, false);
|
||||
|
@ -33,11 +33,8 @@
|
|||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level().getGameTime());
|
||||
if (entityhuman instanceof EntityPlayer) {
|
||||
EntityPlayer entityplayer = (EntityPlayer) entityhuman;
|
||||
|
||||
if (entityhuman instanceof EntityPlayer entityplayer) {
|
||||
- CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, entityhuman.damageSources().generic(), 1.0F, 1.0F, false);
|
||||
+ CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@
|
|||
+// mc-dev import
|
||||
package net.minecraft.world.entity.ai.attributes;
|
||||
|
||||
import net.minecraft.core.IRegistry;
|
||||
import net.minecraft.core.Holder;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/BehaviorFarm.java
|
||||
@@ -26,6 +26,11 @@
|
||||
@@ -27,6 +27,11 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
|||
public class BehaviorFarm extends Behavior<EntityVillager> {
|
||||
|
||||
private static final int HARVEST_DURATION = 200;
|
||||
@@ -81,8 +86,8 @@
|
||||
@@ -82,8 +87,8 @@
|
||||
|
||||
protected void start(WorldServer worldserver, EntityVillager entityvillager, long i) {
|
||||
if (i > this.nextOkStartTime && this.aboveFarmlandPos != null) {
|
||||
|
@ -23,7 +23,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -102,7 +107,9 @@
|
||||
@@ -103,7 +108,9 @@
|
||||
Block block1 = worldserver.getBlockState(this.aboveFarmlandPos.below()).getBlock();
|
||||
|
||||
if (block instanceof BlockCrops && ((BlockCrops) block).isMaxAge(iblockdata)) {
|
||||
|
@ -33,19 +33,19 @@
|
|||
}
|
||||
|
||||
if (iblockdata.isAir() && block1 instanceof BlockSoil && entityvillager.hasFarmSeeds()) {
|
||||
@@ -119,9 +126,11 @@
|
||||
@@ -120,9 +127,11 @@
|
||||
ItemBlock itemblock = (ItemBlock) item;
|
||||
IBlockData iblockdata1 = itemblock.getBlock().defaultBlockState();
|
||||
|
||||
+ if (CraftEventFactory.callEntityChangeBlockEvent(entityvillager, this.aboveFarmlandPos, iblockdata1)) { // CraftBukkit
|
||||
worldserver.setBlockAndUpdate(this.aboveFarmlandPos, iblockdata1);
|
||||
worldserver.gameEvent(GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
worldserver.gameEvent((Holder) GameEvent.BLOCK_PLACE, this.aboveFarmlandPos, GameEvent.a.of(entityvillager, iblockdata1));
|
||||
flag = true;
|
||||
+ } // CraftBukkit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,8 +150,8 @@
|
||||
@@ -142,8 +151,8 @@
|
||||
this.aboveFarmlandPos = this.getValidFarmland(worldserver);
|
||||
if (this.aboveFarmlandPos != null) {
|
||||
this.nextOkStartTime = i + 20L;
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
+
|
||||
public class BehaviorMakeLove extends Behavior<EntityVillager> {
|
||||
|
||||
private static final int INTERACT_DIST_SQR = 5;
|
||||
@@ -116,11 +121,17 @@
|
||||
private long birthTimestamp;
|
||||
@@ -114,11 +119,17 @@
|
||||
if (entityvillager2 == null) {
|
||||
return Optional.empty();
|
||||
} else {
|
||||
|
@ -33,7 +33,7 @@
|
|||
worldserver.broadcastEntityEvent(entityvillager2, (byte) 12);
|
||||
return Optional.of(entityvillager2);
|
||||
}
|
||||
@@ -129,6 +140,6 @@
|
||||
@@ -127,6 +138,6 @@
|
||||
private void giveBedToChild(WorldServer worldserver, EntityVillager entityvillager, BlockPosition blockposition) {
|
||||
GlobalPos globalpos = GlobalPos.of(worldserver.dimension(), blockposition);
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
+ entityliving.getBrain().setMemory(MemoryModuleType.LOOK_TARGET, (new BehaviorPositionEntity(entityliving1, true))); // CraftBukkit - decompile error
|
||||
}
|
||||
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f) {
|
||||
@@ -81,8 +81,8 @@
|
||||
private static void setWalkAndLookTargetMemoriesToEachOther(EntityLiving entityliving, EntityLiving entityliving1, float f, int i) {
|
||||
@@ -79,8 +79,8 @@
|
||||
public static void setWalkAndLookTargetMemories(EntityLiving entityliving, BehaviorPosition behaviorposition, float f, int i) {
|
||||
MemoryTarget memorytarget = new MemoryTarget(behaviorposition, f, i);
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
|||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d) {
|
||||
@@ -92,6 +92,7 @@
|
||||
@@ -90,6 +90,7 @@
|
||||
}
|
||||
|
||||
public static void throwItem(EntityLiving entityliving, ItemStack itemstack, Vec3D vec3d, Vec3D vec3d1, float f) {
|
||||
|
@ -28,7 +28,7 @@
|
|||
double d0 = entityliving.getEyeY() - (double) f;
|
||||
EntityItem entityitem = new EntityItem(entityliving.level(), entityliving.getX(), d0, entityliving.getZ(), itemstack);
|
||||
|
||||
@@ -101,12 +102,19 @@
|
||||
@@ -99,12 +100,19 @@
|
||||
vec3d2 = vec3d2.normalize().multiply(vec3d1.x, vec3d1.y, vec3d1.z);
|
||||
entityitem.setDeltaMovement(vec3d2);
|
||||
entityitem.setDefaultPickUpDelay();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/PrepareRamNearestTarget.java
|
||||
@@ -30,6 +30,13 @@
|
||||
@@ -31,6 +31,13 @@
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
|||
public class PrepareRamNearestTarget<E extends EntityCreature> extends Behavior<E> {
|
||||
|
||||
public static final int TIME_OUT_DURATION = 160;
|
||||
@@ -62,6 +69,13 @@
|
||||
@@ -63,6 +70,13 @@
|
||||
return this.ramTargeting.test(entitycreature, entityliving);
|
||||
});
|
||||
}).ifPresent((entityliving) -> {
|
||||
|
@ -28,7 +28,7 @@
|
|||
this.chooseRamPosition(entitycreature, entityliving);
|
||||
});
|
||||
}
|
||||
@@ -71,7 +85,7 @@
|
||||
@@ -72,7 +86,7 @@
|
||||
|
||||
if (!behaviorcontroller.hasMemoryValue(MemoryModuleType.RAM_TARGET)) {
|
||||
worldserver.broadcastEntityEvent(e0, (byte) 59);
|
||||
|
@ -37,7 +37,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -82,8 +96,8 @@
|
||||
@@ -83,8 +97,8 @@
|
||||
|
||||
protected void tick(WorldServer worldserver, E e0, long i) {
|
||||
if (!this.ramCandidate.isEmpty()) {
|
||||
|
@ -48,7 +48,7 @@
|
|||
boolean flag = !((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTarget().blockPosition().equals(((PrepareRamNearestTarget.a) this.ramCandidate.get()).getTargetPosition());
|
||||
|
||||
if (flag) {
|
||||
@@ -100,7 +114,7 @@
|
||||
@@ -101,7 +115,7 @@
|
||||
}
|
||||
|
||||
if (i - (Long) this.reachedRamPositionTimestamp.get() >= (long) this.ramPrepareTime) {
|
||||
|
@ -57,7 +57,7 @@
|
|||
worldserver.playSound((EntityHuman) null, (Entity) e0, (SoundEffect) this.getPrepareRamSound.apply(e0), SoundCategory.NEUTRAL, 1.0F, e0.getVoicePitch());
|
||||
this.ramCandidate = Optional.empty();
|
||||
}
|
||||
@@ -152,7 +166,7 @@
|
||||
@@ -153,7 +167,7 @@
|
||||
}
|
||||
|
||||
NavigationAbstract navigationabstract = entitycreature.getNavigation();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
|
||||
+++ b/net/minecraft/world/entity/ai/behavior/TryLaySpawnOnWaterNearLand.java
|
||||
@@ -38,6 +38,12 @@
|
||||
@@ -39,6 +39,12 @@
|
||||
if (worldserver.getBlockState(blockposition2).isAir()) {
|
||||
IBlockData iblockdata = block.defaultBlockState();
|
||||
|
||||
|
@ -11,5 +11,5 @@
|
|||
+ }
|
||||
+ // CraftBukkit end
|
||||
worldserver.setBlock(blockposition2, iblockdata, 3);
|
||||
worldserver.gameEvent(GameEvent.BLOCK_PLACE, blockposition2, GameEvent.a.of(entityliving, iblockdata));
|
||||
worldserver.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition2, GameEvent.a.of(entityliving, iblockdata));
|
||||
worldserver.playSound((EntityHuman) null, (Entity) entityliving, SoundEffects.FROG_LAY_SPAWN, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalFollowOwner.java
|
||||
@@ -14,6 +14,12 @@
|
||||
@@ -15,6 +15,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.pathfinder.PathfinderNormal;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class PathfinderGoalFollowOwner extends PathfinderGoal {
|
||||
|
||||
public static final int TELEPORT_WHEN_DISTANCE_IS = 12;
|
||||
@@ -122,7 +128,14 @@
|
||||
@@ -123,7 +129,14 @@
|
||||
} else if (!this.canTeleportTo(new BlockPosition(i, j, k))) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java
|
||||
@@ -21,6 +21,11 @@
|
||||
import net.minecraft.world.level.chunk.IChunkAccess;
|
||||
import net.minecraft.world.level.chunk.status.ChunkStatus;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
+++ b/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java
|
||||
@@ -9,6 +9,13 @@
|
||||
@@ -10,6 +10,13 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
||||
|
@ -14,7 +14,7 @@
|
|||
public class PathfinderGoalTempt extends PathfinderGoal {
|
||||
|
||||
private static final PathfinderTargetCondition TEMP_TARGETING = PathfinderTargetCondition.forNonCombat().range(10.0D).ignoreLineOfSight();
|
||||
@@ -21,7 +28,7 @@
|
||||
@@ -22,7 +29,7 @@
|
||||
private double pRotX;
|
||||
private double pRotY;
|
||||
@Nullable
|
||||
|
@ -22,8 +22,8 @@
|
|||
+ protected EntityLiving player; // CraftBukkit
|
||||
private int calmDown;
|
||||
private boolean isRunning;
|
||||
private final RecipeItemStack items;
|
||||
@@ -43,6 +50,15 @@
|
||||
private final Predicate<ItemStack> items;
|
||||
@@ -44,6 +51,15 @@
|
||||
return false;
|
||||
} else {
|
||||
this.player = this.mob.level().getNearestPlayer(this.targetingConditions, this.mob);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
+++ b/net/minecraft/world/entity/ai/sensing/TemptingSensor.java
|
||||
@@ -18,6 +18,14 @@
|
||||
import net.minecraft.world.entity.player.EntityHuman;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.RecipeItemStack;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
+++ b/net/minecraft/world/entity/ai/village/VillageSiege.java
|
||||
@@ -122,7 +122,7 @@
|
||||
@@ -121,7 +121,7 @@
|
||||
}
|
||||
|
||||
entityzombie.moveTo(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
+++ b/net/minecraft/world/entity/ambient/EntityBat.java
|
||||
@@ -29,6 +29,10 @@
|
||||
@@ -27,6 +27,10 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityBat extends EntityAmbient {
|
||||
|
||||
public static final float FLAP_LENGTH_SECONDS = 0.5F;
|
||||
@@ -143,13 +147,13 @@
|
||||
@@ -141,13 +145,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);
|
||||
@@ -176,7 +180,7 @@
|
||||
@@ -174,7 +178,7 @@
|
||||
|
||||
this.zza = 0.5F;
|
||||
this.setYRot(this.getYRot() + f1);
|
||||
|
@ -36,7 +36,7 @@
|
|||
this.setResting(true);
|
||||
}
|
||||
}
|
||||
@@ -201,7 +205,7 @@
|
||||
@@ -199,7 +203,7 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
--- a/net/minecraft/world/entity/animal/Bucketable.java
|
||||
+++ b/net/minecraft/world/entity/animal/Bucketable.java
|
||||
@@ -15,6 +15,15 @@
|
||||
import net.minecraft.world.item.Items;
|
||||
@@ -17,6 +17,15 @@
|
||||
import net.minecraft.world.item.component.CustomData;
|
||||
import net.minecraft.world.level.World;
|
||||
|
||||
+// CraftBukkit start
|
||||
|
@ -16,7 +16,7 @@
|
|||
public interface Bucketable {
|
||||
|
||||
boolean fromBucket();
|
||||
@@ -94,10 +103,22 @@
|
||||
@@ -93,10 +102,22 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.getItem() == Items.WATER_BUCKET && t0.isAlive()) {
|
||||
|
@ -32,7 +32,7 @@
|
|||
+ if (playerBucketFishEvent.isCancelled()) {
|
||||
+ ((EntityPlayer) entityhuman).containerMenu.sendAllDataToRemote(); // We need to update inventory to resync client's bucket
|
||||
+ ((EntityPlayer) entityhuman).connection.send(new PacketPlayOutSpawnEntity(t0)); // We need to play out these packets as the client assumes the fish is gone
|
||||
+ t0.getEntityData().refresh((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ t0.refreshEntityData((EntityPlayer) entityhuman); // Need to send data such as the display name to client
|
||||
+ return Optional.of(EnumInteractionResult.FAIL);
|
||||
+ }
|
||||
+ t0.playSound(((Bucketable) t0).getPickupSound(), 1.0F, 1.0F);
|
||||
|
@ -40,7 +40,7 @@
|
|||
ItemStack itemstack2 = ItemLiquidUtil.createFilledResult(itemstack, entityhuman, itemstack1, false);
|
||||
|
||||
entityhuman.setItemInHand(enumhand, itemstack2);
|
||||
@@ -107,7 +128,7 @@
|
||||
@@ -106,7 +127,7 @@
|
||||
CriterionTriggers.FILLED_BUCKET.trigger((EntityPlayer) entityhuman, itemstack1);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityAnimal.java
|
||||
@@ -30,12 +30,19 @@
|
||||
@@ -29,12 +29,19 @@
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
|
||||
|
@ -20,22 +20,25 @@
|
|||
|
||||
protected EntityAnimal(EntityTypes<? extends EntityAnimal> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -77,8 +84,13 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ boolean result = super.hurt(damagesource, f);
|
||||
+ if (result) {
|
||||
this.inLove = 0;
|
||||
- return super.hurt(damagesource, f);
|
||||
+ }
|
||||
+ return result;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
@@ -72,9 +79,15 @@
|
||||
}
|
||||
|
||||
@@ -172,10 +184,17 @@
|
||||
@Override
|
||||
- protected void actuallyHurt(DamageSource damagesource, float f) {
|
||||
+ // CraftBukkit start - void -> boolean
|
||||
+ public boolean actuallyHurt(DamageSource damagesource, float f) {
|
||||
+ boolean result = super.actuallyHurt(damagesource, f);
|
||||
+ if (!result) {
|
||||
+ return result;
|
||||
+ }
|
||||
this.resetLove();
|
||||
- super.actuallyHurt(damagesource, f);
|
||||
+ return result;
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,10 +175,17 @@
|
||||
}
|
||||
|
||||
public void setInLove(@Nullable EntityHuman entityhuman) {
|
||||
|
@ -54,7 +57,7 @@
|
|||
|
||||
this.level().broadcastEntityEvent(this, (byte) 18);
|
||||
}
|
||||
@@ -217,12 +236,29 @@
|
||||
@@ -207,12 +227,29 @@
|
||||
if (entityageable != null) {
|
||||
entityageable.setBaby(true);
|
||||
entityageable.moveTo(this.getX(), this.getY(), this.getZ(), 0.0F, 0.0F);
|
||||
|
@ -86,7 +89,7 @@
|
|||
Optional.ofNullable(this.getLoveCause()).or(() -> {
|
||||
return Optional.ofNullable(entityanimal.getLoveCause());
|
||||
}).ifPresent((entityplayer) -> {
|
||||
@@ -235,7 +271,11 @@
|
||||
@@ -225,7 +262,11 @@
|
||||
entityanimal.resetLove();
|
||||
worldserver.broadcastEntityEvent(this, (byte) 18);
|
||||
if (worldserver.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityBee.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityBee.java
|
||||
@@ -90,6 +90,12 @@
|
||||
@@ -86,6 +86,12 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityBird {
|
||||
|
||||
public static final float FLAP_DEGREES_PER_TICK = 120.32113F;
|
||||
@@ -187,12 +193,19 @@
|
||||
@@ -185,12 +191,19 @@
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
|
@ -27,15 +27,26 @@
|
|||
super.addAdditionalSaveData(nbttagcompound);
|
||||
- if (this.hasHive()) {
|
||||
+ if (includeAll && this.hasHive()) { // CraftBukkit - selectively save hive
|
||||
nbttagcompound.put("HivePos", GameProfileSerializer.writeBlockPos(this.getHivePos()));
|
||||
nbttagcompound.put("hive_pos", GameProfileSerializer.writeBlockPos(this.getHivePos()));
|
||||
}
|
||||
|
||||
- if (this.hasSavedFlowerPos()) {
|
||||
+ if (includeAll && this.hasSavedFlowerPos()) { // CraftBukkit - selectively save flower
|
||||
nbttagcompound.put("FlowerPos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
|
||||
nbttagcompound.put("flower_pos", GameProfileSerializer.writeBlockPos(this.getSavedFlowerPos()));
|
||||
}
|
||||
|
||||
@@ -242,7 +255,7 @@
|
||||
@@ -204,8 +217,8 @@
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
- this.hivePos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "hive_pos").orElse((Object) null);
|
||||
- this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse((Object) null);
|
||||
+ this.hivePos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "hive_pos").orElse(null); // CraftBukkit - decompile error
|
||||
+ this.savedFlowerPos = (BlockPosition) GameProfileSerializer.readBlockPos(nbttagcompound, "flower_pos").orElse(null); // CraftBukkit - decompile error
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
this.setHasNectar(nbttagcompound.getBoolean("HasNectar"));
|
||||
this.setHasStung(nbttagcompound.getBoolean("HasStung"));
|
||||
@@ -232,7 +245,7 @@
|
||||
}
|
||||
|
||||
if (b0 > 0) {
|
||||
|
@ -44,7 +55,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -640,11 +653,14 @@
|
||||
@@ -625,11 +638,14 @@
|
||||
if (this.isInvulnerableTo(damagesource)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -61,7 +72,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -999,7 +1015,7 @@
|
||||
@@ -981,7 +997,7 @@
|
||||
|
||||
e() {
|
||||
super();
|
||||
|
@ -70,7 +81,7 @@
|
|||
this.blacklistedTargets = Lists.newArrayList();
|
||||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
@@ -1116,7 +1132,7 @@
|
||||
@@ -1098,7 +1114,7 @@
|
||||
|
||||
f() {
|
||||
super();
|
||||
|
@ -79,16 +90,16 @@
|
|||
this.setFlags(EnumSet.of(PathfinderGoal.Type.MOVE));
|
||||
}
|
||||
|
||||
@@ -1216,7 +1232,7 @@
|
||||
@@ -1198,7 +1214,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (iblockdata1 != null) {
|
||||
+ if (iblockdata1 != null && CraftEventFactory.callEntityChangeBlockEvent(EntityBee.this, blockposition, iblockdata1)) { // CraftBukkit
|
||||
EntityBee.this.level().levelEvent(2005, blockposition, 0);
|
||||
EntityBee.this.level().levelEvent(2011, blockposition, 15);
|
||||
EntityBee.this.level().setBlockAndUpdate(blockposition, iblockdata1);
|
||||
EntityBee.this.incrementNumCropsGrownSincePollination();
|
||||
@@ -1289,7 +1305,7 @@
|
||||
@@ -1271,7 +1287,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityBee && this.mob.hasLineOfSight(entityliving)) {
|
||||
|
@ -97,7 +108,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1298,7 +1314,7 @@
|
||||
@@ -1280,7 +1296,7 @@
|
||||
private static class c extends PathfinderGoalNearestAttackableTarget<EntityHuman> {
|
||||
|
||||
c(EntityBee entitybee) {
|
||||
|
|
|
@ -1,15 +1,28 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityCat.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCat.java
|
||||
@@ -413,7 +413,7 @@
|
||||
}
|
||||
} else if (this.isFood(itemstack)) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -475,7 +475,7 @@
|
||||
@@ -182,10 +182,10 @@
|
||||
@Override
|
||||
public void readAdditionalSaveData(NBTTagCompound nbttagcompound) {
|
||||
super.readAdditionalSaveData(nbttagcompound);
|
||||
- Optional optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> {
|
||||
+ Optional<ResourceKey<CatVariant>> optional = Optional.ofNullable(MinecraftKey.tryParse(nbttagcompound.getString("variant"))).map((minecraftkey) -> { // CraftBukkit - decompile error
|
||||
return ResourceKey.create(Registries.CAT_VARIANT, minecraftkey);
|
||||
});
|
||||
- IRegistry iregistry = BuiltInRegistries.CAT_VARIANT;
|
||||
+ IRegistry<CatVariant> iregistry = BuiltInRegistries.CAT_VARIANT; // CraftBukkit - decompile error
|
||||
|
||||
Objects.requireNonNull(iregistry);
|
||||
optional.flatMap(iregistry::getHolder).ifPresent(this::setVariant);
|
||||
@@ -462,7 +462,7 @@
|
||||
}
|
||||
|
||||
private void tryToTame(EntityHuman entityhuman) {
|
||||
- if (this.random.nextInt(3) == 0) {
|
||||
+ if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { // CraftBukkit
|
||||
this.tame(entityhuman);
|
||||
this.setOrderedToSit(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 7);
|
||||
@@ -480,7 +480,7 @@
|
||||
private static class PathfinderGoalTemptChance extends PathfinderGoalTempt {
|
||||
|
||||
@Nullable
|
||||
|
@ -17,8 +30,8 @@
|
|||
+ private EntityLiving selectedPlayer; // CraftBukkit
|
||||
private final EntityCat cat;
|
||||
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, RecipeItemStack recipeitemstack, boolean flag) {
|
||||
@@ -616,7 +616,15 @@
|
||||
public PathfinderGoalTemptChance(EntityCat entitycat, double d0, Predicate<ItemStack> predicate, boolean flag) {
|
||||
@@ -621,7 +621,15 @@
|
||||
while (iterator.hasNext()) {
|
||||
ItemStack itemstack = (ItemStack) iterator.next();
|
||||
|
||||
|
@ -35,7 +48,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -648,10 +656,10 @@
|
||||
@@ -653,10 +661,10 @@
|
||||
private final EntityCat cat;
|
||||
|
||||
public a(EntityCat entitycat, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityChicken.java
|
||||
@@ -97,7 +97,9 @@
|
||||
@@ -98,7 +98,9 @@
|
||||
this.flap += this.flapping * 2.0F;
|
||||
if (!this.level().isClientSide && this.isAlive() && !this.isBaby() && !this.isChickenJockey() && --this.eggTime <= 0) {
|
||||
this.playSound(SoundEffects.CHICKEN_EGG, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityCow.java
|
||||
@@ -33,6 +33,12 @@
|
||||
@@ -31,6 +31,12 @@
|
||||
import net.minecraft.world.level.World;
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -12,8 +12,8 @@
|
|||
+
|
||||
public class EntityCow extends EntityAnimal {
|
||||
|
||||
public EntityCow(EntityTypes<? extends EntityCow> entitytypes, World world) {
|
||||
@@ -85,8 +91,16 @@
|
||||
private static final EntitySize BABY_DIMENSIONS = EntityTypes.COW.getDimensions().scale(0.5F).withEyeHeight(0.665F);
|
||||
@@ -92,8 +98,16 @@
|
||||
ItemStack itemstack = entityhuman.getItemInHand(enumhand);
|
||||
|
||||
if (itemstack.is(Items.BUCKET) && !this.isBaby()) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityDolphin.java
|
||||
@@ -61,8 +61,20 @@
|
||||
@@ -59,8 +59,20 @@
|
||||
import net.minecraft.world.level.pathfinder.PathMode;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
private static final DataWatcherObject<BlockPosition> TREASURE_POS = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BLOCK_POS);
|
||||
private static final DataWatcherObject<Boolean> GOT_FISH = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.BOOLEAN);
|
||||
private static final DataWatcherObject<Integer> MOISTNESS_LEVEL = DataWatcher.defineId(EntityDolphin.class, DataWatcherRegistry.INT);
|
||||
@@ -185,7 +197,7 @@
|
||||
@@ -183,7 +195,7 @@
|
||||
|
||||
@Override
|
||||
public int getMaxAirSupply() {
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -226,11 +238,17 @@
|
||||
@@ -219,11 +231,17 @@
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
if (this.canHoldItem(itemstack)) {
|
||||
|
@ -49,7 +49,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
@@ -484,7 +502,7 @@
|
||||
@@ -474,7 +492,7 @@
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
|
@ -58,7 +58,7 @@
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -503,7 +521,7 @@
|
||||
@@ -493,7 +511,7 @@
|
||||
}
|
||||
|
||||
if (this.player.isSwimming() && this.player.level().random.nextInt(6) == 0) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityFox.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityFox.java
|
||||
@@ -94,6 +94,10 @@
|
||||
@@ -93,6 +93,10 @@
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start
|
||||
+import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
|
@ -11,7 +11,7 @@
|
|||
public class EntityFox extends EntityAnimal implements VariantHolder<EntityFox.Type> {
|
||||
|
||||
private static final DataWatcherObject<Integer> DATA_TYPE_ID = DataWatcher.defineId(EntityFox.class, DataWatcherRegistry.INT);
|
||||
@@ -523,7 +527,8 @@
|
||||
@@ -518,7 +522,8 @@
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
ItemStack itemstack = entityitem.getItem();
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
|||
int i = itemstack.getCount();
|
||||
|
||||
if (i > 1) {
|
||||
@@ -535,7 +540,7 @@
|
||||
@@ -530,7 +535,7 @@
|
||||
this.setItemSlot(EnumItemSlot.MAINHAND, itemstack.split(1));
|
||||
this.setGuaranteedDrop(EnumItemSlot.MAINHAND);
|
||||
this.take(entityitem, itemstack.getCount());
|
||||
|
@ -30,7 +30,7 @@
|
|||
this.ticksSinceEaten = 0;
|
||||
}
|
||||
|
||||
@@ -883,6 +888,16 @@
|
||||
@@ -868,6 +873,16 @@
|
||||
if (entityplayer1 != null && entityplayer != entityplayer1) {
|
||||
entityfox.addTrustedUUID(entityplayer1.getUUID());
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
|||
|
||||
if (entityplayer2 != null) {
|
||||
entityplayer2.awardStat(StatisticList.ANIMALS_BRED);
|
||||
@@ -893,12 +908,14 @@
|
||||
@@ -878,12 +893,14 @@
|
||||
this.partner.setAge(6000);
|
||||
this.animal.resetLove();
|
||||
this.partner.resetLove();
|
||||
|
@ -66,7 +66,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -1294,6 +1311,11 @@
|
||||
@@ -1279,6 +1296,11 @@
|
||||
int i = (Integer) iblockdata.getValue(BlockSweetBerryBush.AGE);
|
||||
|
||||
iblockdata.setValue(BlockSweetBerryBush.AGE, 1);
|
||||
|
@ -78,12 +78,12 @@
|
|||
int j = 1 + EntityFox.this.level().random.nextInt(2) + (i == 3 ? 1 : 0);
|
||||
ItemStack itemstack = EntityFox.this.getItemBySlot(EnumItemSlot.MAINHAND);
|
||||
|
||||
@@ -1451,7 +1473,7 @@
|
||||
@@ -1436,7 +1458,7 @@
|
||||
private EntityLiving trustedLastHurt;
|
||||
private int timestamp;
|
||||
|
||||
- public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate predicate) {
|
||||
+ public a(Class oclass, boolean flag, boolean flag1, @Nullable Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
|
||||
- public a(final Class oclass, final boolean flag, final boolean flag1, @Nullable final Predicate predicate) {
|
||||
+ public a(final Class oclass, final boolean flag, final boolean flag1, @Nullable final Predicate<EntityLiving> predicate) { // CraftBukkit - decompile error
|
||||
super(EntityFox.this, oclass, 10, flag, flag1, predicate);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityIronGolem.java
|
||||
@@ -102,7 +102,7 @@
|
||||
@@ -97,7 +97,7 @@
|
||||
@Override
|
||||
protected void doPush(Entity entity) {
|
||||
if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.getRandom().nextInt(20) == 0) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityMushroomCow.java
|
||||
@@ -42,13 +42,21 @@
|
||||
@@ -42,6 +42,14 @@
|
||||
import net.minecraft.world.level.block.state.IBlockData;
|
||||
import net.minecraft.world.level.gameevent.GameEvent;
|
||||
|
||||
|
@ -15,14 +15,6 @@
|
|||
public class EntityMushroomCow extends EntityCow implements IShearable, VariantHolder<EntityMushroomCow.Type> {
|
||||
|
||||
private static final DataWatcherObject<String> DATA_TYPE = DataWatcher.defineId(EntityMushroomCow.class, DataWatcherRegistry.STRING);
|
||||
private static final int MUTATE_CHANCE = 1024;
|
||||
private static final String TAG_STEW_EFFECTS = "stew_effects";
|
||||
@Nullable
|
||||
- private List<SuspiciousEffectHolder.a> stewEffects;
|
||||
+ public List<SuspiciousEffectHolder.a> stewEffects;
|
||||
@Nullable
|
||||
private UUID lastLightningBoltUUID;
|
||||
|
||||
@@ -114,6 +122,11 @@
|
||||
this.playSound(soundeffect, 1.0F, 1.0F);
|
||||
return EnumInteractionResult.sidedSuccess(this.level().isClientSide);
|
||||
|
@ -35,7 +27,7 @@
|
|||
this.shear(SoundCategory.PLAYERS);
|
||||
this.gameEvent(GameEvent.SHEAR, entityhuman);
|
||||
if (!this.level().isClientSide) {
|
||||
@@ -161,7 +174,7 @@
|
||||
@@ -157,7 +170,7 @@
|
||||
|
||||
if (entitycow != null) {
|
||||
((WorldServer) this.level()).sendParticles(Particles.EXPLOSION, this.getX(), this.getY(0.5D), this.getZ(), 1, 0.0D, 0.0D, 0.0D, 0.0D);
|
||||
|
@ -44,7 +36,7 @@
|
|||
entitycow.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot());
|
||||
entitycow.setHealth(this.getHealth());
|
||||
entitycow.yBodyRot = this.yBodyRot;
|
||||
@@ -175,10 +188,25 @@
|
||||
@@ -171,10 +184,25 @@
|
||||
}
|
||||
|
||||
entitycow.setInvulnerable(this.isInvulnerable());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityOcelot.java
|
||||
@@ -179,7 +179,7 @@
|
||||
@@ -177,7 +177,7 @@
|
||||
if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && entityhuman.distanceToSqr((Entity) this) < 9.0D) {
|
||||
this.usePlayerItem(entityhuman, enumhand, itemstack);
|
||||
if (!this.level().isClientSide) {
|
||||
|
@ -9,7 +9,7 @@
|
|||
this.setTrusting(true);
|
||||
this.spawnTrustingParticles(true);
|
||||
this.level().broadcastEntityEvent(this, (byte) 41);
|
||||
@@ -315,10 +315,10 @@
|
||||
@@ -308,10 +308,10 @@
|
||||
private final EntityOcelot ocelot;
|
||||
|
||||
public a(EntityOcelot entityocelot, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
--- a/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
+++ b/net/minecraft/world/entity/animal/EntityPanda.java
|
||||
@@ -67,6 +67,12 @@
|
||||
@@ -72,6 +72,12 @@
|
||||
import net.minecraft.world.level.storage.loot.parameters.LootContextParameters;
|
||||
import net.minecraft.world.phys.Vec3D;
|
||||
import org.joml.Vector3f;
|
||||
|
||||
+// CraftBukkit start;
|
||||
+import org.bukkit.craftbukkit.event.CraftEventFactory;
|
||||
|
@ -13,7 +13,7 @@
|
|||
public class EntityPanda extends EntityAnimal {
|
||||
|
||||
private static final DataWatcherObject<Integer> UNHAPPY_COUNTER = DataWatcher.defineId(EntityPanda.class, DataWatcherRegistry.INT);
|
||||
@@ -534,14 +540,14 @@
|
||||
@@ -553,14 +559,14 @@
|
||||
|
||||
@Override
|
||||
protected void pickUpItem(EntityItem entityitem) {
|
||||
|
@ -30,7 +30,7 @@
|
|||
}
|
||||
|
||||
}
|
||||
@@ -870,10 +876,10 @@
|
||||
@@ -889,10 +895,10 @@
|
||||
private final EntityPanda panda;
|
||||
|
||||
public c(EntityPanda entitypanda, Class<T> oclass, float f, double d0, double d1) {
|
||||
|
@ -44,7 +44,7 @@
|
|||
this.panda = entitypanda;
|
||||
}
|
||||
|
||||
@@ -1112,7 +1118,7 @@
|
||||
@@ -1131,7 +1137,7 @@
|
||||
@Override
|
||||
protected void alertOther(EntityInsentient entityinsentient, EntityLiving entityliving) {
|
||||
if (entityinsentient instanceof EntityPanda && entityinsentient.isAggressive()) {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue