From db4d8a4729f686c17a837df5803e5e36fe1d0613 Mon Sep 17 00:00:00 2001 From: LexManos Date: Thu, 8 Aug 2024 13:40:50 -0700 Subject: [PATCH] 1.21.1 --- gradle.properties | 8 +++---- .../arguments/EntityArgument.java.patch | 4 ++-- .../arguments/MessageArgument.java.patch | 4 ++-- .../selector/EntitySelectorParser.java.patch | 4 ++-- .../level/block/SculkSensorBlock.java.patch | 2 +- .../level/block/entity/BlockEntity.java.patch | 11 +++++----- .../world/level/chunk/LevelChunk.java.patch | 22 +++++++++---------- .../net/minecraftforge/common/ForgeHooks.java | 3 ++- 8 files changed, 30 insertions(+), 28 deletions(-) diff --git a/gradle.properties b/gradle.properties index 66ade9902f..1b54f1f1b3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,13 +5,13 @@ org.gradle.daemon=false org.gradle.parallel=true JAVA_VERSION=21 -MC_VERSION=1.21 +MC_VERSION=1.21.1 MC_NEXT_VERSION=1.22 -MCP_VERSION=20240613.102039 +MCP_VERSION=20240808.132146 MAPPING_CHANNEL=official -MAPPING_VERSION=1.21 +MAPPING_VERSION=1.21.1 // Set to true before the first build of a new MC version, so we don't do compatibility checks CHECK_COMPATIBILITY=false // Set to true to allow for fuzzy patching. Useful during updateing -UPDATING=false \ No newline at end of file +UPDATING=true \ No newline at end of file diff --git a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch index 97e2034756..96a42d5415 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/EntityArgument.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -115,7 +_,7 @@ +@@ -123,7 +_,7 @@ if (p_91482_.getSource() instanceof SharedSuggestionProvider sharedsuggestionprovider) { StringReader stringreader = new StringReader(p_91483_.getInput()); stringreader.setCursor(p_91483_.getStart()); -- EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, sharedsuggestionprovider.hasPermission(2)); +- EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, EntitySelectorParser.allowSelectors(sharedsuggestionprovider)); + EntitySelectorParser entityselectorparser = new EntitySelectorParser(stringreader, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(sharedsuggestionprovider)); try { diff --git a/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch b/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch index 67a8fddd25..5c1a098f55 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/MessageArgument.java.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/commands/arguments/MessageArgument.java +++ b/net/minecraft/commands/arguments/MessageArgument.java -@@ -84,7 +_,7 @@ +@@ -89,7 +_,7 @@ public static record Message(String text, MessageArgument.Part[] parts) { Component resolveComponent(CommandSourceStack p_232197_) throws CommandSyntaxException { -- return this.toComponent(p_232197_, p_232197_.hasPermission(2)); +- return this.toComponent(p_232197_, EntitySelectorParser.allowSelectors(p_232197_)); + return this.toComponent(p_232197_, net.minecraftforge.common.ForgeHooks.canUseEntitySelectors(p_232197_)); } diff --git a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch index 4f8a9102eb..ceae1b6b8f 100644 --- a/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch +++ b/patches/minecraft/net/minecraft/commands/arguments/selector/EntitySelectorParser.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/net/minecraft/commands/arguments/selector/EntitySelectorParser.java -@@ -472,6 +_,11 @@ +@@ -477,6 +_,11 @@ } this.reader.skip(); @@ -12,7 +12,7 @@ this.parseSelector(); } else { this.parseNameOrUUID(); -@@ -488,6 +_,7 @@ +@@ -493,6 +_,7 @@ p_121248_.suggest("@s", Component.translatable("argument.entity.selector.self")); p_121248_.suggest("@e", Component.translatable("argument.entity.selector.allEntities")); p_121248_.suggest("@n", Component.translatable("argument.entity.selector.nearestEntity")); diff --git a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch index a512a7769c..07d2f088ec 100644 --- a/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/SculkSensorBlock.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/world/level/block/SculkSensorBlock.java +++ b/net/minecraft/world/level/block/SculkSensorBlock.java -@@ -294,8 +_,13 @@ +@@ -293,8 +_,13 @@ @Override protected void spawnAfterBreak(BlockState p_222142_, ServerLevel p_222143_, BlockPos p_222144_, ItemStack p_222145_, boolean p_222146_) { super.spawnAfterBreak(p_222142_, p_222143_, p_222144_, p_222145_, p_222146_); diff --git a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch index 6786705cda..c224e4399d 100644 --- a/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch +++ b/patches/minecraft/net/minecraft/world/level/block/entity/BlockEntity.java.patch @@ -9,19 +9,20 @@ private static final Logger LOGGER = LogUtils.getLogger(); private final BlockEntityType type; @Nullable -@@ -38,9 +_,11 @@ +@@ -38,10 +_,12 @@ private DataComponentMap components = DataComponentMap.EMPTY; public BlockEntity(BlockEntityType p_155228_, BlockPos p_155229_, BlockState p_155230_) { + super(BlockEntity.class); this.type = p_155228_; this.worldPosition = p_155229_.immutable(); + this.validateBlockState(p_155230_); this.blockState = p_155230_; + this.gatherCapabilities(); } - public static BlockPos getPosFromTag(CompoundTag p_187473_) { -@@ -61,6 +_,7 @@ + private void validateBlockState(BlockState p_345558_) { +@@ -72,6 +_,7 @@ } protected void loadAdditional(CompoundTag p_331149_, HolderLookup.Provider p_333170_) { @@ -29,7 +30,7 @@ } public final void loadWithComponents(CompoundTag p_331756_, HolderLookup.Provider p_335164_) { -@@ -76,6 +_,7 @@ +@@ -87,6 +_,7 @@ } protected void saveAdditional(CompoundTag p_187471_, HolderLookup.Provider p_327783_) { @@ -37,7 +38,7 @@ } public final CompoundTag saveWithFullMetadata(HolderLookup.Provider p_331193_) { -@@ -205,6 +_,13 @@ +@@ -216,6 +_,13 @@ public void setRemoved() { this.remove = true; diff --git a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch index 9b5d64a16d..48e6045e83 100644 --- a/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch +++ b/patches/minecraft/net/minecraft/world/level/chunk/LevelChunk.java.patch @@ -34,7 +34,7 @@ p_62866_.onPlace(this.level, p_62865_, blockstate, p_62867_); } -@@ -321,6 +_,12 @@ +@@ -326,6 +_,12 @@ @Nullable public BlockEntity getBlockEntity(BlockPos p_62868_, LevelChunk.EntityCreationType p_62869_) { BlockEntity blockentity = this.blockEntities.get(p_62868_); @@ -47,7 +47,7 @@ if (blockentity == null) { CompoundTag compoundtag = this.pendingBlockEntities.remove(p_62868_); if (compoundtag != null) { -@@ -338,9 +_,6 @@ +@@ -343,9 +_,6 @@ this.addAndRegisterBlockEntity(blockentity); } } @@ -57,7 +57,7 @@ } return blockentity; -@@ -354,6 +_,7 @@ +@@ -359,6 +_,7 @@ } this.updateBlockEntityTicker(p_156391_); @@ -65,7 +65,7 @@ } } -@@ -406,9 +_,14 @@ +@@ -411,9 +_,14 @@ public CompoundTag getBlockEntityNbtForSaving(BlockPos p_62932_, HolderLookup.Provider p_329605_) { BlockEntity blockentity = this.getBlockEntity(p_62932_); if (blockentity != null && !blockentity.isRemoved()) { @@ -80,7 +80,7 @@ } else { CompoundTag compoundtag = this.pendingBlockEntities.get(p_62932_); if (compoundtag != null) { -@@ -488,7 +_,7 @@ +@@ -493,7 +_,7 @@ p_187974_.accept((p_327409_, p_327410_, p_327411_) -> { BlockEntity blockentity = this.getBlockEntity(p_327409_, LevelChunk.EntityCreationType.IMMEDIATE); if (blockentity != null && p_327411_ != null && blockentity.getType() == p_327410_) { @@ -89,7 +89,7 @@ } }); } -@@ -596,6 +_,7 @@ +@@ -601,6 +_,7 @@ } public void clearAllBlockEntities() { @@ -97,7 +97,7 @@ this.blockEntities.values().forEach(BlockEntity::setRemoved); this.blockEntities.clear(); this.tickersInLevel.values().forEach(p_187966_ -> p_187966_.rebind(NULL_TICKER)); -@@ -603,6 +_,7 @@ +@@ -608,6 +_,7 @@ } public void registerAllBlockEntitiesAfterLevelLoad() { @@ -105,7 +105,7 @@ this.blockEntities.values().forEach(p_187988_ -> { if (this.level instanceof ServerLevel serverlevel) { this.addGameEventListener(p_187988_, serverlevel); -@@ -654,6 +_,24 @@ +@@ -659,6 +_,24 @@ return new LevelChunk.BoundTickingBlockEntity<>(p_156376_, p_156377_); } @@ -130,7 +130,7 @@ class BoundTickingBlockEntity implements TickingBlockEntity { private final T blockEntity; private final BlockEntityTicker ticker; -@@ -671,6 +_,7 @@ +@@ -676,6 +_,7 @@ if (LevelChunk.this.isTicking(blockpos)) { try { ProfilerFiller profilerfiller = LevelChunk.this.level.getProfiler(); @@ -138,7 +138,7 @@ profilerfiller.push(this::getType); BlockState blockstate = LevelChunk.this.getBlockState(blockpos); if (this.blockEntity.getType().isValid(blockstate)) { -@@ -692,6 +_,11 @@ +@@ -697,6 +_,11 @@ CrashReport crashreport = CrashReport.forThrowable(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory = crashreport.addCategory("Block entity being ticked"); this.blockEntity.fillCrashReportCategory(crashreportcategory); @@ -150,7 +150,7 @@ throw new ReportedException(crashreport); } } -@@ -765,5 +_,32 @@ +@@ -770,5 +_,32 @@ public String toString() { return this.ticker + " "; } diff --git a/src/main/java/net/minecraftforge/common/ForgeHooks.java b/src/main/java/net/minecraftforge/common/ForgeHooks.java index eb6bf0a378..388acd9b26 100644 --- a/src/main/java/net/minecraftforge/common/ForgeHooks.java +++ b/src/main/java/net/minecraftforge/common/ForgeHooks.java @@ -42,6 +42,7 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.Commands; import net.minecraft.commands.SharedSuggestionProvider; +import net.minecraft.commands.arguments.selector.EntitySelectorParser; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Holder; @@ -1003,7 +1004,7 @@ public final class ForgeHooks { } public static boolean canUseEntitySelectors(SharedSuggestionProvider provider) { - if (provider.hasPermission(Commands.LEVEL_GAMEMASTERS)) + if (EntitySelectorParser.allowSelectors(provider)) return true; else if (provider instanceof CommandSourceStack source && source.source instanceof ServerPlayer player) return PermissionAPI.getPermission(player, ForgeMod.USE_SELECTORS_PERMISSION);