diff --git a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch index 950e15f1b1..6696a374a3 100644 --- a/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch +++ b/patches/minecraft/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch @@ -1,5 +1,13 @@ --- a/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +++ b/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java +@@ -46,6 +_,7 @@ + import net.minecraft.world.item.TooltipFlag; + import net.minecraftforge.api.distmarker.Dist; + import net.minecraftforge.api.distmarker.OnlyIn; ++import org.bukkit.inventory.InventoryView; + + @OnlyIn(Dist.CLIENT) + public class CreativeModeInventoryScreen extends EffectRenderingInventoryScreen { @@ -79,6 +_,8 @@ private boolean hasClickedOutside; private final Set> visibleTags = new HashSet<>(); @@ -263,6 +271,20 @@ @OnlyIn(Dist.CLIENT) static class CustomCreativeSlot extends Slot { public CustomCreativeSlot(Container p_98633_, int p_98634_, int p_98635_, int p_98636_) { +@@ -838,6 +_,13 @@ + return this.items.size() > 45; + } + ++ //Ketting start - Bogus client implementation, because it will never get called anyways ++ @Override ++ public InventoryView getBukkitView() { ++ return null; ++ } ++ //Ketting end ++ + public ItemStack quickMoveStack(Player p_98650_, int p_98651_) { + if (p_98651_ >= this.slots.size() - 9 && p_98651_ < this.slots.size()) { + Slot slot = this.slots.get(p_98651_); @@ -926,6 +_,22 @@ public boolean mayPickup(Player p_98665_) { diff --git a/patches/minecraft/net/minecraft/client/server/IntegratedPlayerList.java.patch b/patches/minecraft/net/minecraft/client/server/IntegratedPlayerList.java.patch new file mode 100644 index 0000000000..0d2d10ae53 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/server/IntegratedPlayerList.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/client/server/IntegratedPlayerList.java ++++ b/net/minecraft/client/server/IntegratedPlayerList.java +@@ -30,7 +_,7 @@ + } + + public Component canPlayerLogin(SocketAddress p_120007_, GameProfile p_120008_) { +- return (Component)(this.getServer().isSingleplayerOwner(p_120008_) && this.getPlayerByName(p_120008_.getName()) != null ? Component.translatable("multiplayer.disconnect.name_taken") : super.canPlayerLogin(p_120007_, p_120008_)); ++ return (Component)(this.getServer().isSingleplayerOwner(p_120008_) && this.getPlayerByName(p_120008_.getName()) != null ? Component.translatable("multiplayer.disconnect.name_taken") : super.canPlayerLogin(null, p_120008_)); //Ketting - bogus fix, because client stuff will never get called anyways + } + + public IntegratedServer getServer() { diff --git a/patches/minecraft/net/minecraft/server/commands/DebugCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/DebugCommand.java.patch new file mode 100644 index 0000000000..e1077cb754 --- /dev/null +++ b/patches/minecraft/net/minecraft/server/commands/DebugCommand.java.patch @@ -0,0 +1,22 @@ +--- a/net/minecraft/server/commands/DebugCommand.java ++++ b/net/minecraft/server/commands/DebugCommand.java +@@ -118,11 +_,18 @@ + return i; + } + +- static class Tracer implements ServerFunctionManager.TraceCallbacks, CommandSource { ++ public static class Tracer implements ServerFunctionManager.TraceCallbacks, CommandSource { + public static final int INDENT_OFFSET = 1; + private final PrintWriter output; + private int lastIndent; + private boolean waitingForResult; ++ ++ //Ketting start ++ @Override ++ public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) { ++ return new org.bukkit.craftbukkit.v1_20_R2.command.DebugCommandCommandSender(wrapper, Tracer.this); ++ } ++ //Ketting end + + Tracer(PrintWriter p_180079_) { + this.output = p_180079_; diff --git a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch index 8024facc45..511bebb079 100644 --- a/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch +++ b/patches/minecraft/net/minecraft/server/commands/TeleportCommand.java.patch @@ -32,9 +32,9 @@ + result = player.teleportTo(p_139017_, p_139018_, p_139019_, p_139020_, p_139021_, f, f1, PlayerTeleportEvent.TeleportCause.COMMAND); + } else { + Location to = new Location(p_139017_.getWorld(), p_139018_, p_139019_, p_139020_, f, f1); -+ EntityTeleportEvent event = new EntityTeleportEvent(p_139016_.getBukkitEntity(), p_139016_.getBukkitEntity().getLocation(), to); -+ p_139017_.getCraftServer().getPluginManager().callEvent(event); -+ if (event.isCancelled()) { ++ EntityTeleportEvent bevent = new EntityTeleportEvent(p_139016_.getBukkitEntity(), p_139016_.getBukkitEntity().getLocation(), to); ++ p_139017_.getCraftServer().getPluginManager().callEvent(bevent); ++ if (bevent.isCancelled()) { + return; + } + diff --git a/patches/minecraft/net/minecraft/util/worldupdate/WorldUpgrader.java.patch b/patches/minecraft/net/minecraft/util/worldupdate/WorldUpgrader.java.patch index f74ade84e7..9aee7e2144 100644 --- a/patches/minecraft/net/minecraft/util/worldupdate/WorldUpgrader.java.patch +++ b/patches/minecraft/net/minecraft/util/worldupdate/WorldUpgrader.java.patch @@ -14,7 +14,7 @@ int k = ChunkStorage.getVersion(compoundtag); ChunkGenerator chunkgenerator = this.dimensions.getOrThrow(Registries.levelToLevelStem(resourcekey2)).generator(); - CompoundTag compoundtag1 = chunkstorage.upgradeChunkTag(resourcekey2, () -> { -+ CompoundTag compoundtag1 = chunkstorage.upgradeChunkTag(Registries.levelStemToLevel(resourcekey2), () -> { // CraftBukkit ++ CompoundTag compoundtag1 = chunkstorage.upgradeChunkTag(Registries.levelToLevelStem(resourcekey2), () -> { // CraftBukkit return this.overworldDataStorage; - }, compoundtag, chunkgenerator.getTypeNameForDataFixer()); + }, compoundtag, chunkgenerator.getTypeNameForDataFixer(), chunkpos, null); // CraftBukkit diff --git a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch index 7c0eb6d424..d76e0ade6c 100644 --- a/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/RedStoneOreBlock.java.patch @@ -1,11 +1,13 @@ --- a/net/minecraft/world/level/block/RedStoneOreBlock.java +++ b/net/minecraft/world/level/block/RedStoneOreBlock.java -@@ -20,6 +_,8 @@ +@@ -20,6 +_,10 @@ import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; +import org.bukkit.craftbukkit.v1_20_R2.event.CraftEventFactory; +import org.bukkit.event.entity.EntityInteractEvent; ++ ++import javax.annotation.Nullable; public class RedStoneOreBlock extends Block { public static final BooleanProperty LIT = RedstoneTorchBlock.LIT; @@ -20,7 +22,8 @@ public void stepOn(Level p_154299_, BlockPos p_154300_, BlockState p_154301_, Entity p_154302_) { if (!p_154302_.isSteppingCarefully()) { - interact(p_154301_, p_154299_, p_154300_); +- interact(p_154301_, p_154299_, p_154300_); ++ interact(p_154301_, p_154299_, p_154300_, p_154302_); + // CraftBukkit start + if (p_154302_ instanceof Player) { + org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.v1_20_R2.event.CraftEventFactory.callPlayerInteractEvent((Player) p_154302_, org.bukkit.event.block.Action.PHYSICAL, p_154300_, null, null, null); @@ -38,7 +41,7 @@ } super.stepOn(p_154299_, p_154300_, p_154301_, p_154302_); -@@ -46,16 +_,21 @@ +@@ -46,16 +_,26 @@ if (p_55473_.isClientSide) { spawnParticles(p_55473_, p_55474_); } else { @@ -51,11 +54,16 @@ } - private static void interact(BlockState p_55493_, Level p_55494_, BlockPos p_55495_) { -+ private static void interact(BlockState p_55493_, Level p_55494_, BlockPos p_55495_, Entity entity) { // CraftBukkit - add Entity ++ //Ketting start - keep original method head ++ private static void interact(BlockState p_55493_, Level p_55494_, BlockPos p_55495_){ ++ interact(p_55493_,p_55494_,p_55495_, null); ++ } ++ //Ketting end ++ private static void interact(BlockState p_55493_, Level p_55494_, BlockPos p_55495_, @Nullable Entity entity) { // CraftBukkit - add Entity spawnParticles(p_55494_, p_55495_); if (!p_55493_.getValue(LIT)) { + // CraftBukkit start -+ if (!CraftEventFactory.callEntityChangeBlockEvent(entity, p_55495_, p_55493_.setValue(RedStoneOreBlock.LIT, true))) { ++ if (entity != null && !CraftEventFactory.callEntityChangeBlockEvent(entity, p_55495_, p_55493_.setValue(RedStoneOreBlock.LIT, true))) { + return; + } + // CraftBukkit end diff --git a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch index 331001065b..d095168f8c 100644 --- a/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch +++ b/patches/minecraft/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplateManager.java.patch @@ -27,3 +27,12 @@ if (!Files.isDirectory(this.generatedDir)) { return Optional.empty(); } else { +@@ -227,7 +_,7 @@ + } + } + +- private StructureTemplate readStructure(InputStream p_230378_) throws IOException { ++ public StructureTemplate readStructure(InputStream p_230378_) throws IOException { + CompoundTag compoundtag = NbtIo.readCompressed(p_230378_); + return this.readStructure(compoundtag); + } diff --git a/src/main/java/org/bukkit/craftbukkit/v1_20_R2/command/DebugCommandCommandSender.java b/src/main/java/org/bukkit/craftbukkit/v1_20_R2/command/DebugCommandCommandSender.java new file mode 100644 index 0000000000..3218fef209 --- /dev/null +++ b/src/main/java/org/bukkit/craftbukkit/v1_20_R2/command/DebugCommandCommandSender.java @@ -0,0 +1,43 @@ +package org.bukkit.craftbukkit.v1_20_R2.command; + +import net.minecraft.commands.CommandSourceStack; +import net.minecraft.network.chat.Component; +import org.bukkit.craftbukkit.v1_20_R2.util.CraftChatMessage; +import org.jetbrains.annotations.NotNull; + +public class DebugCommandCommandSender extends ServerCommandSender { + private CommandSourceStack stack; + private net.minecraft.server.commands.DebugCommand.Tracer tracer; + public DebugCommandCommandSender(CommandSourceStack stack, net.minecraft.server.commands.DebugCommand.Tracer tracer){ + this.stack = stack; + this.tracer = tracer; + } + @Override + public void sendMessage(@NotNull String message) { + for (Component component : CraftChatMessage.fromString(message)) { + tracer.sendSystemMessage(component); + } + } + + @Override + public void sendMessage(String... messages) { + for (String message : messages) { + sendMessage(message); + } + } + + @Override + public @NotNull String getName() { + return "DebugCommandCommandSender"; + } + + @Override + public boolean isOp() { + return true; + } + + @Override + public void setOp(boolean value) { + throw new UnsupportedOperationException("Cannot change operator status of a DebugCommand CommandSender"); + } +}