diff --git a/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch index 1b8251784..3775a99a5 100644 --- a/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/AbstractBlock.java.patch @@ -65,10 +65,14 @@ } return this.field_220085_g; -@@ -346,6 +349,10 @@ +@@ -346,6 +349,14 @@ return this.field_235684_aB_.field_235800_b_.apply(this.func_230328_p_().func_176223_P()); } ++ protected boolean isAir(BlockState state) { ++ return ((AbstractBlockState)state).field_235702_f_; ++ } ++ + /* ======================================== FORGE START ===================================== */ + private final java.util.function.Supplier lootTableSupplier; + /* ========================================= FORGE END ====================================== */ @@ -76,16 +80,18 @@ public abstract static class AbstractBlockState extends StateHolder { private final int field_215708_d; private final boolean field_215709_e; -@@ -428,6 +435,8 @@ +@@ -428,14 +439,18 @@ return this.field_215708_d; } + /** @deprecated use {@link BlockState#isAir(IBlockReader, BlockPos) */ + @Deprecated public boolean func_196958_f() { - return this.field_235702_f_; +- return this.field_235702_f_; ++ return this.func_177230_c().isAir((BlockState)this); } -@@ -436,6 +445,8 @@ + + public MaterialColor func_185909_g(IBlockReader p_185909_1_, BlockPos p_185909_2_) { return this.field_235704_h_; } @@ -94,7 +100,7 @@ public BlockState func_185907_a(Rotation p_185907_1_) { return this.func_177230_c().func_185499_a(this.func_230340_p_(), p_185907_1_); } -@@ -802,6 +813,9 @@ +@@ -802,6 +817,9 @@ private ResourceLocation field_222381_j; private boolean field_226895_m_ = true; private boolean field_235813_o_; @@ -104,7 +110,7 @@ private AbstractBlock.IExtendedPositionPredicate> field_235814_p_ = (p_235832_0_, p_235832_1_, p_235832_2_, p_235832_3_) -> { return p_235832_0_.func_224755_d(p_235832_1_, p_235832_2_, Direction.UP) && p_235832_0_.func_185906_d() < 14; }; -@@ -863,6 +877,8 @@ +@@ -863,6 +881,8 @@ abstractblock$properties.field_226895_m_ = p_200950_0_.field_235684_aB_.field_226895_m_; abstractblock$properties.field_235813_o_ = p_200950_0_.field_235684_aB_.field_235813_o_; abstractblock$properties.field_235806_h_ = p_200950_0_.field_235684_aB_.field_235806_h_; @@ -113,7 +119,7 @@ return abstractblock$properties; } -@@ -877,6 +893,24 @@ +@@ -877,6 +897,24 @@ return this; } @@ -138,7 +144,7 @@ public AbstractBlock.Properties func_200941_a(float p_200941_1_) { this.field_200961_i = p_200941_1_; return this; -@@ -933,7 +967,7 @@ +@@ -933,7 +971,7 @@ } public AbstractBlock.Properties func_222379_b(Block p_222379_1_) { diff --git a/patches/minecraft/net/minecraft/block/VineBlock.java.patch b/patches/minecraft/net/minecraft/block/VineBlock.java.patch index abcb3072b..1d12e4263 100644 --- a/patches/minecraft/net/minecraft/block/VineBlock.java.patch +++ b/patches/minecraft/net/minecraft/block/VineBlock.java.patch @@ -26,16 +26,19 @@ Direction direction3 = direction.func_176746_e(); Direction direction4 = direction.func_176735_f(); boolean flag = p_225542_1_.func_177229_b(func_176267_a(direction3)); -@@ -216,7 +216,7 @@ +@@ -216,8 +216,9 @@ if (p_225542_3_.func_177956_o() > 0) { BlockPos blockpos1 = p_225542_3_.func_177977_b(); BlockState blockstate = p_225542_2_.func_180495_p(blockpos1); - if (blockstate.func_196958_f() || blockstate.func_203425_a(this)) { -+ if (blockstate.isAir(p_225542_2_, blockpos) || blockstate.func_203425_a(this)) { - BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate; +- BlockState blockstate1 = blockstate.func_196958_f() ? this.func_176223_P() : blockstate; ++ boolean isAir = blockstate.isAir(p_225542_2_, blockpos1); ++ if (isAir || blockstate.func_203425_a(this)) { ++ BlockState blockstate1 = isAir ? this.func_176223_P() : blockstate; BlockState blockstate2 = this.func_196544_a(p_225542_1_, blockstate1, p_225542_4_); if (blockstate1 != blockstate2 && this.func_196540_x(blockstate2)) { -@@ -322,4 +322,7 @@ + p_225542_2_.func_180501_a(blockpos1, blockstate2, 2); +@@ -322,4 +323,7 @@ public static BooleanProperty func_176267_a(Direction p_176267_0_) { return field_196546_A.get(p_176267_0_); } diff --git a/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch new file mode 100644 index 000000000..bfa14141f --- /dev/null +++ b/patches/minecraft/net/minecraft/util/ResourceLocation.java.patch @@ -0,0 +1,15 @@ +--- a/net/minecraft/util/ResourceLocation.java ++++ b/net/minecraft/util/ResourceLocation.java +@@ -112,6 +112,12 @@ + return i; + } + ++ // Normal compare sorts by path first, this compares namespace first. ++ public int compareNamespaced(ResourceLocation o) { ++ int ret = this.field_110626_a.compareTo(o.field_110626_a); ++ return ret != 0 ? ret : this.field_110625_b.compareTo(o.field_110625_b); ++ } ++ + public static ResourceLocation func_195826_a(StringReader p_195826_0_) throws CommandSyntaxException { + int i = p_195826_0_.getCursor(); + diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java index 424723a75..c16c9a7ef 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeBlockState.java @@ -20,8 +20,6 @@ package net.minecraftforge.common.extensions; import java.util.Optional; -import java.util.function.Predicate; - import javax.annotation.Nullable; import net.minecraft.block.*; @@ -33,8 +31,6 @@ import net.minecraft.entity.EntitySpawnPlacementRegistry.PlacementType; import net.minecraft.entity.EntityType; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; -import net.minecraft.item.DyeColor; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.pathfinding.PathNodeType; import net.minecraft.tileentity.TileEntity; @@ -239,7 +235,12 @@ public interface IForgeBlockState * @param world The current world * @param pos Block position in world * @return True if the block considered air + * @deprecated TODO: Remove in 1.17, in favor of state only version. This is a old hook from before + * block states were unlimited and people used TileEntities. If you still use the location + * information in your TileEntity please explain why and how you can't use BlockState only version + * here: https://github.com/MinecraftForge/MinecraftForge/issues/7409 */ + @Deprecated default boolean isAir(IBlockReader world, BlockPos pos) { return getBlockState().getBlock().isAir(getBlockState(), world, pos); diff --git a/src/main/java/net/minecraftforge/event/RegistryEvent.java b/src/main/java/net/minecraftforge/event/RegistryEvent.java index 264aae202..718ed6045 100644 --- a/src/main/java/net/minecraftforge/event/RegistryEvent.java +++ b/src/main/java/net/minecraftforge/event/RegistryEvent.java @@ -164,7 +164,7 @@ public class RegistryEvent> extends GenericEven REMAP } - public static class Mapping> + public static class Mapping> implements Comparable> { public final IForgeRegistry registry; private final IForgeRegistry pool; @@ -231,6 +231,14 @@ public class RegistryEvent> extends GenericEven { return target; } + + @Override + public int compareTo(Mapping o) + { + int ret = this.registry.getRegistryName().compareNamespaced(o.registry.getRegistryName()); + if (ret ==0) ret = this.key.compareNamespaced(o.key); + return ret; + } } } } diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index ffebdfbe6..4490de0a2 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -355,7 +355,7 @@ public class GameData fr.unfreeze(); }, executor).thenApply(v->Collections.emptyList()); } - + public static CompletableFuture> postRegistryEventDispatch(final Executor executor, final ModLoadingStage.EventGenerator> eventGenerator) { return CompletableFuture.runAsync(()-> { final RegistryEvent.Register event = eventGenerator.apply(null); @@ -727,7 +727,7 @@ public class GameData { LOGGER.error(REGISTRIES,()->new AdvancedLogMessageAdapter(sb->{ sb.append("Unidentified mapping from registry ").append(name).append('\n'); - lst.forEach(map->sb.append('\t').append(map.key).append(": ").append(map.id).append('\n')); + lst.stream().sorted().forEach(map->sb.append('\t').append(map.key).append(": ").append(map.id).append('\n')); })); } event.getAllMappings().stream().filter(e -> e.getAction() == MissingMappings.Action.FAIL).forEach(fail -> failed.put(name, fail.key)); @@ -750,7 +750,7 @@ public class GameData defaulted.asMap().forEach((name, entries) -> { buf.append("Missing ").append(name).append(":\n"); - entries.forEach(rl -> buf.append(" ").append(rl).append("\n")); + entries.stream().sorted((o1, o2) -> o1.compareNamespaced(o2)).forEach(rl -> buf.append(" ").append(rl).append("\n")); buf.append("\n"); }); }