From f0bab0fb38aa233cd31d203a0ee2a773211f88cd Mon Sep 17 00:00:00 2001 From: tterrag Date: Sat, 23 May 2020 13:42:56 -0400 Subject: [PATCH] Add forge registries for applicable new registry types Expose constructors for all forge registry entries Also, remove deprecation on ItemCameraTransforms/TransformType --- .../renderer/model/IBakedModel.java.patch | 3 ++- .../model/ItemCameraTransforms.java.patch | 17 +++-------------- .../util/registry/Registry.java.patch | 19 +++++++++++++++---- .../blockplacer/BlockPlacerType.java.patch | 11 +++++++++++ .../BlockStateProviderType.java.patch | 11 +++++++++++ .../FoliagePlacerType.java.patch | 11 +++++++++++ .../TreeDecoratorType.java.patch | 11 +++++++++++ .../registries/ForgeRegistries.java | 10 +++++++++- .../minecraftforge/registries/GameData.java | 16 ++++++++++++++-- .../resources/META-INF/accesstransformer.cfg | 9 +++++++++ 10 files changed, 96 insertions(+), 22 deletions(-) create mode 100644 patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch create mode 100644 patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch diff --git a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch index 70bd2e6e8c..afff773e97 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch @@ -11,7 +11,7 @@ List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); boolean func_177555_b(); -@@ -21,9 +23,12 @@ +@@ -21,9 +23,13 @@ boolean func_188618_c(); @@ -20,6 +20,7 @@ TextureAtlasSprite func_177554_e(); - ItemCameraTransforms func_177552_f(); ++ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#handlePerspective(net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType, com.mojang.blaze3d.matrix.MatrixStack)} instead */ + @Deprecated + default ItemCameraTransforms func_177552_f() { return ItemCameraTransforms.field_178357_a; } diff --git a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch index 810547e4ff..6e7d969478 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/ItemCameraTransforms.java.patch @@ -1,17 +1,6 @@ --- a/net/minecraft/client/renderer/model/ItemCameraTransforms.java +++ b/net/minecraft/client/renderer/model/ItemCameraTransforms.java -@@ -9,6 +9,10 @@ - import net.minecraftforge.api.distmarker.Dist; - import net.minecraftforge.api.distmarker.OnlyIn; - -+/** -+ * @deprecated use {@link net.minecraft.client.renderer.model.IBakedModel#handlePerspective(TransformType)} instead -+ */ -+@Deprecated - @OnlyIn(Dist.CLIENT) - public class ItemCameraTransforms { - public static final ItemCameraTransforms field_178357_a = new ItemCameraTransforms(); -@@ -25,6 +29,7 @@ +@@ -25,6 +25,7 @@ this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a); } @@ -19,7 +8,7 @@ public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_) { this.field_188036_k = p_i46443_1_.field_188036_k; this.field_188037_l = p_i46443_1_.field_188037_l; -@@ -36,6 +41,7 @@ +@@ -36,6 +37,7 @@ this.field_181700_p = p_i46443_1_.field_181700_p; } @@ -27,7 +16,7 @@ public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_) { this.field_188036_k = p_i46569_1_; this.field_188037_l = p_i46569_2_; -@@ -47,6 +53,7 @@ +@@ -47,6 +49,7 @@ this.field_181700_p = p_i46569_8_; } diff --git a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch index 1b3b0c16b6..7745a7fdcb 100644 --- a/patches/minecraft/net/minecraft/util/registry/Registry.java.patch +++ b/patches/minecraft/net/minecraft/util/registry/Registry.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/util/registry/Registry.java +++ b/net/minecraft/util/registry/Registry.java -@@ -70,47 +70,51 @@ +@@ -70,88 +70,90 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -64,9 +64,20 @@ + @Deprecated public static final Registry field_212624_m = forge("biome", Biome.class, () -> { return Biomes.field_180279_ad; }); - public static final Registry> field_229387_t_ = func_222935_a("block_state_provider_type", () -> { -@@ -125,33 +129,31 @@ - public static final Registry> field_229390_w_ = func_222935_a("tree_decorator_type", () -> { +- public static final Registry> field_229387_t_ = func_222935_a("block_state_provider_type", () -> { ++ @Deprecated public static final Registry> field_229387_t_ = forge("block_state_provider_type", BlockStateProviderType.class, () -> { + return BlockStateProviderType.field_227394_a_; + }); +- public static final Registry> field_229388_u_ = func_222935_a("block_placer_type", () -> { ++ @Deprecated public static final Registry> field_229388_u_ = forge("block_placer_type", BlockPlacerType.class, () -> { + return BlockPlacerType.field_227259_a_; + }); +- public static final Registry> field_229389_v_ = func_222935_a("foliage_placer_type", () -> { ++ @Deprecated public static final Registry> field_229389_v_ = forge("foliage_placer_type", FoliagePlacerType.class, () -> { + return FoliagePlacerType.field_227386_a_; + }); +- public static final Registry> field_229390_w_ = func_222935_a("tree_decorator_type", () -> { ++ @Deprecated public static final Registry> field_229390_w_ = forge("tree_decorator_type", TreeDecoratorType.class, () -> { return TreeDecoratorType.field_227426_b_; }); - public static final Registry> field_212632_u = func_222935_a("particle_type", () -> { diff --git a/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch new file mode 100644 index 0000000000..3b7663ee31 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/blockplacer/BlockPlacerType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/blockplacer/BlockPlacerType.java ++++ b/net/minecraft/world/gen/blockplacer/BlockPlacerType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class BlockPlacerType

{ ++public class BlockPlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final BlockPlacerType field_227259_a_ = func_227264_a_("simple_block_placer", SimpleBlockPlacer::new); + public static final BlockPlacerType field_227260_b_ = func_227264_a_("double_plant_placer", DoublePlantBlockPlacer::new); + public static final BlockPlacerType field_227261_c_ = func_227264_a_("column_placer", ColumnBlockPlacer::new); diff --git a/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch new file mode 100644 index 0000000000..0a4da6d68a --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java ++++ b/net/minecraft/world/gen/blockstateprovider/BlockStateProviderType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class BlockStateProviderType

{ ++public class BlockStateProviderType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final BlockStateProviderType field_227394_a_ = func_227400_a_("simple_state_provider", SimpleBlockStateProvider::new); + public static final BlockStateProviderType field_227395_b_ = func_227400_a_("weighted_state_provider", WeightedBlockStateProvider::new); + public static final BlockStateProviderType field_227396_c_ = func_227400_a_("plain_flower_provider", PlainFlowerBlockStateProvider::new); diff --git a/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch new file mode 100644 index 0000000000..9a9f7fec2d --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java ++++ b/net/minecraft/world/gen/foliageplacer/FoliagePlacerType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class FoliagePlacerType

{ ++public class FoliagePlacerType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final FoliagePlacerType field_227386_a_ = func_227392_a_("blob_foliage_placer", BlobFoliagePlacer::new); + public static final FoliagePlacerType field_227387_b_ = func_227392_a_("spruce_foliage_placer", SpruceFoliagePlacer::new); + public static final FoliagePlacerType field_227388_c_ = func_227392_a_("pine_foliage_placer", PineFoliagePlacer::new); diff --git a/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch new file mode 100644 index 0000000000..c74c4f65f9 --- /dev/null +++ b/patches/minecraft/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java ++++ b/net/minecraft/world/gen/treedecorator/TreeDecoratorType.java +@@ -4,7 +4,7 @@ + import java.util.function.Function; + import net.minecraft.util.registry.Registry; + +-public class TreeDecoratorType

{ ++public class TreeDecoratorType

extends net.minecraftforge.registries.ForgeRegistryEntry> { + public static final TreeDecoratorType field_227425_a_ = func_227432_a_("trunk_vine", TrunkVineTreeDecorator::new); + public static final TreeDecoratorType field_227426_b_ = func_227432_a_("leave_vine", LeaveVineTreeDecorator::new); + public static final TreeDecoratorType field_227427_c_ = func_227432_a_("cocoa", CocoaTreeDecorator::new); diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java index de780920bc..6052eeb756 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistries.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistries.java @@ -44,10 +44,14 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.provider.BiomeProviderType; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.gen.ChunkGeneratorType; +import net.minecraft.world.gen.blockplacer.BlockPlacerType; +import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraft.world.gen.carver.WorldCarver; import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.foliageplacer.FoliagePlacerType; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; +import net.minecraft.world.gen.treedecorator.TreeDecoratorType; import net.minecraftforge.common.ModDimension; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -94,7 +98,11 @@ public class ForgeRegistries public static final IForgeRegistry> BIOME_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(BiomeProviderType.class); public static final IForgeRegistry> CHUNK_GENERATOR_TYPES = RegistryManager.ACTIVE.getRegistry(ChunkGeneratorType.class); public static final IForgeRegistry CHUNK_STATUS = RegistryManager.ACTIVE.getRegistry(ChunkStatus.class); - + public static final IForgeRegistry> BLOCK_STATE_PROVIDER_TYPES = RegistryManager.ACTIVE.getRegistry(BlockStateProviderType.class); + public static final IForgeRegistry> BLOCK_PLAYER_TYPES = RegistryManager.ACTIVE.getRegistry(BlockPlacerType.class); + public static final IForgeRegistry> FOLIAGE_PLAYER_TYPES = RegistryManager.ACTIVE.getRegistry(FoliagePlacerType.class); + public static final IForgeRegistry> TREE_DECORATOR_TYPES = RegistryManager.ACTIVE.getRegistry(TreeDecoratorType.class); + // Custom forge registries public static final IForgeRegistry MOD_DIMENSIONS = RegistryManager.ACTIVE.getRegistry(ModDimension.class); public static final IForgeRegistry DATA_SERIALIZERS = RegistryManager.ACTIVE.getRegistry(DataSerializerEntry.class); diff --git a/src/main/java/net/minecraftforge/registries/GameData.java b/src/main/java/net/minecraftforge/registries/GameData.java index f25f016534..17b58fb7d4 100644 --- a/src/main/java/net/minecraftforge/registries/GameData.java +++ b/src/main/java/net/minecraftforge/registries/GameData.java @@ -56,11 +56,15 @@ import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.provider.BiomeProviderType; import net.minecraft.world.chunk.ChunkStatus; import net.minecraft.world.gen.ChunkGeneratorType; +import net.minecraft.world.gen.blockplacer.BlockPlacerType; +import net.minecraft.world.gen.blockstateprovider.BlockStateProviderType; import net.minecraft.world.gen.carver.WorldCarver; import net.minecraft.world.gen.feature.Feature; import net.minecraft.world.gen.feature.structure.Structure; +import net.minecraft.world.gen.foliageplacer.FoliagePlacerType; import net.minecraft.world.gen.placement.Placement; import net.minecraft.world.gen.surfacebuilders.SurfaceBuilder; +import net.minecraft.world.gen.treedecorator.TreeDecoratorType; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ModDimension; import net.minecraftforge.common.loot.GlobalLootModifierSerializer; @@ -141,7 +145,11 @@ public class GameData public static final ResourceLocation BIOME_PROVIDER_TYPES = new ResourceLocation("biome_source_type"); public static final ResourceLocation CHUNK_GENERATOR_TYPES = new ResourceLocation("chunk_generator_type"); public static final ResourceLocation CHUNK_STATUS = new ResourceLocation("chunk_status"); - + public static final ResourceLocation BLOCK_STATE_PROVIDER_TYPES = new ResourceLocation("block_state_provider_type"); + public static final ResourceLocation BLOCK_PLACER_TYPES = new ResourceLocation("block_placer_type"); + public static final ResourceLocation FOLIAGE_PLACER_TYPES = new ResourceLocation("foliage_placer_type"); + public static final ResourceLocation TREE_DECORATOR_TYPES = new ResourceLocation("tree_decorator_type"); + // Custom forge registries public static final ResourceLocation MODDIMENSIONS = new ResourceLocation("forge:moddimensions"); public static final ResourceLocation SERIALIZERS = new ResourceLocation("minecraft:dataserializers"); @@ -208,7 +216,11 @@ public class GameData makeRegistry(BIOME_PROVIDER_TYPES, BiomeProviderType.class).disableSaving().disableSync().create(); makeRegistry(CHUNK_GENERATOR_TYPES, ChunkGeneratorType.class).disableSaving().disableSync().create(); makeRegistry(CHUNK_STATUS, ChunkStatus.class, new ResourceLocation("empty")).disableSaving().disableSync().create(); - + makeRegistry(BLOCK_STATE_PROVIDER_TYPES, BlockStateProviderType.class).disableSaving().disableSync().create(); + makeRegistry(BLOCK_PLACER_TYPES, BlockPlacerType.class).disableSaving().disableSync().create(); + makeRegistry(FOLIAGE_PLACER_TYPES, FoliagePlacerType.class).disableSaving().disableSync().create(); + makeRegistry(TREE_DECORATOR_TYPES, TreeDecoratorType.class).disableSaving().disableSync().create(); + // Custom forge registries makeRegistry(MODDIMENSIONS, ModDimension.class ).disableSaving().create(); makeRegistry(SERIALIZERS, DataSerializerEntry.class, 256 /*vanilla space*/, MAX_VARINT).disableSaving().disableOverrides().addCallback(SerializerCallbacks.INSTANCE).create(); diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index b482eeaa33..98bb14f930 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -106,6 +106,7 @@ public net.minecraft.entity.ai.brain.schedule.Activity (Ljava/lang/String; public net.minecraft.entity.ai.brain.sensor.SensorType (Ljava/util/function/Supplier;)V public net.minecraft.entity.item.ExperienceOrbEntity field_70530_e # xpValue protected net.minecraft.entity.item.TNTEntity func_70515_d()V # explode - make it easier to extend TNTEntity with custom explosion logic +public net.minecraft.entity.merchant.villager.VillagerProcession (Ljava/lang/String;Lnet/minecraft/village/PointOfInterestType;Lcom/google/common/collect/ImmutableSet;Lcom/google/common/collect/ImmutableSet;Lnet/minecraft/util/SoundEvent;)V protected net.minecraft.entity.monster.AbstractSkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.SkeletonEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable protected net.minecraft.entity.monster.StrayEntity func_190727_o()Lnet/minecraft/util/SoundEvent; # getStepSound - make AbstractSkeletonEntity implementable @@ -149,6 +150,9 @@ protected net.minecraft.util.ObjectIntIdentityMap field_148749_a # internal map protected net.minecraft.util.ObjectIntIdentityMap field_195868_a # nextId public net.minecraft.util.WeightedRandom$Item field_76292_a #probability public net.minecraft.util.concurrent.ThreadTaskExecutor func_213165_a(Ljava/lang/Runnable;)Ljava/util/concurrent/CompletableFuture; # func_213165_a +public net.minecraft.village.PointOfInterestType func_221042_a(Lnet/minecraft/block/Block;)Ljava/util/Set; # getAllStates +public net.minecraft.village.PointOfInterestType (Ljava/lang/String;Ljava/util/Set;ILjava/util/function/Predicate;I)V +public net.minecraft.village.PointOfInterestType (Ljava/lang/String;Ljava/util/Set;II)V public net.minecraft.world.GameRules func_223595_a(Ljava/lang/String;Lnet/minecraft/world/GameRules$RuleType;)Lnet/minecraft/world/GameRules$RuleKey; # register protected net.minecraft.world.Teleporter field_77187_a # random protected net.minecraft.world.Teleporter field_85192_a # world @@ -163,9 +167,14 @@ public net.minecraft.world.biome.Biome func_180626_a(Lnet/minecraft/util/math/Bl public net.minecraft.world.biome.DeepFrozenOceanBiome func_180626_a(Lnet/minecraft/util/math/BlockPos;)F # getTemperature public net.minecraft.world.biome.FrozenOceanBiome func_180626_a(Lnet/minecraft/util/math/BlockPos;)F # getTemperature public net.minecraft.world.biome.provider.BiomeProvider field_201540_a # BIOMES_TO_SPAWN_IN +public net.minecraft.world.biome.provider.BiomeProviderType (Ljava/util/function/Function;Ljava/util/function/Function;)V public net.minecraft.world.chunk.ChunkStatus (Ljava/lang/String;Lnet/minecraft/world/chunk/ChunkStatus;ILjava/util/EnumSet;Lnet/minecraft/world/chunk/ChunkStatus$Type;Lnet/minecraft/world/chunk/ChunkStatus$IGenerationWorker;Lnet/minecraft/world/chunk/ChunkStatus$ILoadingWorker;)V public net.minecraft.world.gen.IChunkGeneratorFactory public net.minecraft.world.gen.layer.LayerUtil func_202829_a(JLnet/minecraft/world/gen/layer/traits/IAreaTransformer1;Lnet/minecraft/world/gen/area/IAreaFactory;ILjava/util/function/LongFunction;)Lnet/minecraft/world/gen/area/IAreaFactory; # repeat +public net.minecraft.world.gen.blockplacer.BlockPlacerType (Ljava/util/function/Function;)V +public net.minecraft.world.gen.blockstateprovider.BlockStateProviderType (Ljava/util/function/Function;)V +public net.minecraft.world.gen.foliageplacer.FoliagePlacerType (Ljava/util/function/Function;)V +public net.minecraft.world.gen.treedecorator.TreeDecoratorType (Ljava/util/function/Function;)V private-f net.minecraft.world.server.ChunkHolder field_219320_o # block update location public net.minecraft.world.server.ServerChunkProvider field_186029_c # chunkGenerator public net.minecraft.world.server.ServerChunkProvider field_73251_h # worldObj