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 d27edca05..e60c4e977 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/IBakedModel.java.patch @@ -6,7 +6,7 @@ @OnlyIn(Dist.CLIENT) -public interface IBakedModel { +public interface IBakedModel extends net.minecraftforge.client.extensions.IForgeBakedModel { -+ ++ /**@deprecated Forge: Use {@link net.minecraftforge.client.extensions.IForgeBakedModel#getQuads(IBlockState, EnumFacing, Random, net.minecraftforge.client.model.data.IModelData)}*/ + @Deprecated List func_200117_a(@Nullable BlockState p_200117_1_, @Nullable Direction p_200117_2_, Random p_200117_3_); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java index 819c5a275..780de4a68 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDataManager.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDataManager.java @@ -108,6 +108,7 @@ public class ModelDataManager public static Map getModelData(World world, ChunkPos pos) { + Preconditions.checkArgument(world.isRemote, "Asked ModelDataManager from server world!"); refreshModelData(world, pos); return modelDataCache.getOrDefault(pos, Collections.emptyMap()); } diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java index 5bd3c1687..0e4ac8e2f 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeTileEntity.java @@ -172,6 +172,10 @@ public interface IForgeTileEntity extends ICapabilitySerializable return false; } + /** + * Requests a refresh for the model data of your TE + * Call this every time your {@link #getModelData()} changes + */ default void requestModelDataUpdate() { TileEntity te = getTileEntity(); @@ -182,6 +186,13 @@ public interface IForgeTileEntity extends ICapabilitySerializable } } + /** + * Allows you to return additional model data. + * This data can be used to provide additional functionality in your {@link net.minecraft.client.renderer.model.IBakedModel} + * You need to schedule a refresh of you model data via {@link #requestModelDataUpdate()} if the result of this function changes. + * Note that this method may be called on a chunk render thread instead of the main client thread + * @return Your model data + */ default @Nonnull IModelData getModelData() { return EmptyModelData.INSTANCE;