diff --git a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch index 2c9e531fee..8d8d18d4e0 100644 --- a/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch +++ b/patches.mcp/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java.patch @@ -1,13 +1,47 @@ --- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java +++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java -@@ -6,8 +6,9 @@ +@@ -6,15 +6,25 @@ import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) -public class BakedQuad +public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer { -+ @Override public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) { net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); } protected final int[] vertexData; protected final int tintIndex; protected final EnumFacing face; + protected final TextureAtlasSprite field_187509_d; + ++ /** ++ * @deprecated Use constructor with the format argument. ++ */ ++ @Deprecated + public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_) + { ++ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.ITEM); ++ } ++ ++ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, net.minecraft.client.renderer.vertex.VertexFormat format) ++ { ++ this.format = format; + this.vertexData = p_i46574_1_; + this.tintIndex = p_i46574_2_; + this.face = p_i46574_3_; +@@ -45,4 +55,17 @@ + { + return this.face; + } ++ ++ private final net.minecraft.client.renderer.vertex.VertexFormat format; ++ ++ @Override ++ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer) ++ { ++ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this); ++ } ++ ++ public net.minecraft.client.renderer.vertex.VertexFormat getFormat() ++ { ++ return format; ++ } + } diff --git a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java index 2a5a1322a4..dc177896e3 100644 --- a/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java +++ b/src/main/java/net/minecraftforge/client/model/BlockStateLoader.java @@ -6,10 +6,13 @@ import java.io.InputStreamReader; import java.io.Reader; import java.util.Collection; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import net.minecraft.client.renderer.block.model.ModelBlockDefinition; import net.minecraft.client.renderer.block.model.ModelRotation; +import net.minecraft.client.renderer.block.model.Variant; +import net.minecraft.client.renderer.block.model.VariantList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.FMLLog; @@ -20,6 +23,7 @@ import org.apache.commons.lang3.tuple.Pair; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import com.google.common.collect.Maps; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -55,11 +59,11 @@ public class BlockStateLoader { case 1: // Version 1 ForgeBlockStateV1 v1 = GSON.fromJson(reader, ForgeBlockStateV1.class); - List variants = Lists.newArrayList(); + Map variants = Maps.newHashMap(); for (Entry> entry : v1.variants.asMap().entrySet()) { // Convert Version1 variants into vanilla variants for the ModelBlockDefinition. - List mcVars = Lists.newArrayList(); + List mcVars = Lists.newArrayList(); for (ForgeBlockStateV1.Variant var : entry.getValue()) { boolean uvLock = var.getUvLock().or(false); @@ -68,14 +72,14 @@ public class BlockStateLoader int weight = var.getWeight().or(1); if (var.getModel() != null && var.getSubmodels().size() == 0 && var.getTextures().size() == 0 && var.getCustomData().size() == 0 && var.getState().orNull() instanceof ModelRotation) - mcVars.add(new ModelBlockDefinition.Variant(var.getModel(), (ModelRotation)var.getState().get(), uvLock, weight)); + mcVars.add(new Variant(var.getModel(), (ModelRotation)var.getState().get(), uvLock, weight)); else mcVars.add(new ForgeVariant(var.getModel(), var.getState().or(TRSRTransformation.identity()), uvLock, smooth, gui3d, weight, var.getTextures(), var.getOnlyPartsVariant(), var.getCustomData())); } - variants.add(new ModelBlockDefinition.Variants(entry.getKey(), mcVars)); + variants.put(entry.getKey(), new VariantList(mcVars)); } - return new ModelBlockDefinition(variants); + return new ModelBlockDefinition(variants, null); default: //Unknown version.. try loading it as normal. return vanillaGSON.fromJson(reader, ModelBlockDefinition.class); @@ -128,7 +132,7 @@ public class BlockStateLoader public ImmutableMap getCustomData() { return customData; } } - private static class ForgeVariant extends ModelBlockDefinition.Variant implements ISmartVariant + private static class ForgeVariant extends Variant implements ISmartVariant { private final ImmutableMap textures; private final ImmutableMap parts; @@ -211,7 +215,7 @@ public class BlockStateLoader models.put(entry.getKey(), Pair.of(runModelHooks(model, part.smooth, part.gui3d, part.getTextures(), part.getCustomData()), partState)); } - return new MultiModel(getModelLocation(), hasBase ? base : null, baseTr, models.build()); + return new MultiModel(func_188046_a(), hasBase ? base : null, baseTr, models.build()); } @Override diff --git a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java index fd915c7564..39fa4c2ddd 100644 --- a/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java +++ b/src/main/java/net/minecraftforge/client/model/ForgeBlockStateV1.java @@ -481,7 +481,7 @@ public class ForgeBlockStateV1 extends Marker { ret.state = Optional.of(TRSRTransformation.identity()); } - else if (transform.equals("forge:default-block")) + /*else if (transform.equals("forge:default-block")) { TRSRTransformation thirdperson = TRSRTransformation.blockCenterToCorner(new TRSRTransformation( new Vector3f(0, 1.5f / 16, -2.75f / 16), @@ -517,7 +517,7 @@ public class ForgeBlockStateV1 extends Marker new Vector3f(1.7f, 1.7f, 1.7f), null)); ret.state = Optional.of(new SimpleModelState(ImmutableMap.of(TransformType.THIRD_PERSON, thirdperson, TransformType.FIRST_PERSON, firstperson))); - } + }*/ // FIXME else { throw new JsonParseException("transform: unknown default string: " + transform); @@ -543,13 +543,37 @@ public class ForgeBlockStateV1 extends Marker { TRSRTransformation t = context.deserialize(transform.get("thirdperson"), TRSRTransformation.class); transform.remove("thirdperson"); - transforms.put(TransformType.THIRD_PERSON, TRSRTransformation.blockCenterToCorner(t)); + transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("thirdperson_righthand")) + { + TRSRTransformation t = context.deserialize(transform.get("thirdperson_righthand"), TRSRTransformation.class); + transform.remove("thirdperson_righthand"); + transforms.put(TransformType.THIRD_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("thirdperson_lefthand")) + { + TRSRTransformation t = context.deserialize(transform.get("thirdperson_lefthand"), TRSRTransformation.class); + transform.remove("thirdperson_lefthand"); + transforms.put(TransformType.THIRD_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); } if(transform.has("firstperson")) { TRSRTransformation t = context.deserialize(transform.get("firstperson"), TRSRTransformation.class); transform.remove("firstperson"); - transforms.put(TransformType.FIRST_PERSON, TRSRTransformation.blockCenterToCorner(t)); + transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("firstperson_righthand")) + { + TRSRTransformation t = context.deserialize(transform.get("firstperson_righthand"), TRSRTransformation.class); + transform.remove("firstperson_righthand"); + transforms.put(TransformType.FIRST_PERSON_RIGHT_HAND, TRSRTransformation.blockCenterToCorner(t)); + } + if(transform.has("firstperson_lefthand")) + { + TRSRTransformation t = context.deserialize(transform.get("firstperson_lefthand"), TRSRTransformation.class); + transform.remove("firstperson_lefthand"); + transforms.put(TransformType.FIRST_PERSON_LEFT_HAND, TRSRTransformation.blockCenterToCorner(t)); } if(transform.has("head")) { diff --git a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java b/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java index 95fce88a7a..e8acab1cb7 100644 --- a/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/IColoredBakedQuad.java @@ -1,14 +1,16 @@ package net.minecraftforge.client.model; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; public interface IColoredBakedQuad { public static class ColoredBakedQuad extends BakedQuad implements IColoredBakedQuad { - public ColoredBakedQuad(int[] data, int tintIndex, EnumFacing side) + public ColoredBakedQuad(int[] data, int tintIndex, EnumFacing side, TextureAtlasSprite sprite, VertexFormat format) { - super(data, tintIndex, side); + super(data, tintIndex, side, sprite, format); } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java b/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java deleted file mode 100644 index 3ea4c32645..0000000000 --- a/src/main/java/net/minecraftforge/client/model/IFlexibleBakedModel.java +++ /dev/null @@ -1,78 +0,0 @@ -package net.minecraftforge.client.model; - -import java.util.List; - -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.EnumFacing; - -/* - * Version of IBakedModel with less restriction on camera transformations and with explicit format of the baked array. - */ -@SuppressWarnings("deprecation") -public interface IFlexibleBakedModel extends IBakedModel -{ - /* - * Specifies the format which BakedQuads' getVertexData will have. - */ - VertexFormat getFormat(); - - /* - * Default implementation of IFlexibleBakedModel that should be useful in most cases - */ - public static class Wrapper implements IFlexibleBakedModel - { - private final IBakedModel parent; - VertexFormat format; - - public Wrapper(IBakedModel parent, VertexFormat format) - { - this.parent = parent; - this.format = format; - } - - public List getFaceQuads(EnumFacing side) - { - return parent.getFaceQuads(side); - } - - public List getGeneralQuads() - { - return parent.getGeneralQuads(); - } - - public boolean isAmbientOcclusion() - { - return parent.isAmbientOcclusion(); - } - - public boolean isGui3d() - { - return parent.isGui3d(); - } - - public boolean isBuiltInRenderer() - { - return parent.isBuiltInRenderer(); - } - - public TextureAtlasSprite getParticleTexture() - { - return parent.getParticleTexture(); - } - - @Deprecated - public ItemCameraTransforms getItemCameraTransforms() - { - return parent.getItemCameraTransforms(); - } - - public VertexFormat getFormat() - { - return new VertexFormat(format); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/IModel.java b/src/main/java/net/minecraftforge/client/model/IModel.java index 6a9e1c47fd..884b2f27ef 100644 --- a/src/main/java/net/minecraftforge/client/model/IModel.java +++ b/src/main/java/net/minecraftforge/client/model/IModel.java @@ -2,6 +2,7 @@ package net.minecraftforge.client.model; import java.util.Collection; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.ResourceLocation; @@ -36,7 +37,7 @@ public interface IModel * format argument (some attributes can be replaced with padding), * if there's no such info in this model. */ - IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter); + IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter); /* * Default state this model will be baked with. diff --git a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java index 16fd01d013..8db0df2509 100644 --- a/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java +++ b/src/main/java/net/minecraftforge/client/model/IPerspectiveAwareModel.java @@ -4,11 +4,13 @@ import java.util.List; import javax.vecmath.Matrix4f; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; @@ -20,26 +22,26 @@ import com.google.common.collect.ImmutableMap; * Model that changes based on the rendering perspective * (first-person, GUI, e.t.c - see TransformType) */ -public interface IPerspectiveAwareModel extends IFlexibleBakedModel +public interface IPerspectiveAwareModel extends IBakedModel { /* * Returns the pair of the model for the given perspective, and the matrix * that should be applied to the GL state before rendering it (matrix may be null). */ - Pair handlePerspective(TransformType cameraTransformType); + Pair handlePerspective(TransformType cameraTransformType); public static class MapWrapper implements IPerspectiveAwareModel { - private final IFlexibleBakedModel parent; + private final IBakedModel parent; private final ImmutableMap transforms; - public MapWrapper(IFlexibleBakedModel parent, ImmutableMap transforms) + public MapWrapper(IBakedModel parent, ImmutableMap transforms) { this.parent = parent; this.transforms = transforms; } - public MapWrapper(IFlexibleBakedModel parent, IModelState state) + public MapWrapper(IBakedModel parent, IModelState state) { this(parent, getTransforms(state)); } @@ -58,6 +60,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return builder.build(); } + @SuppressWarnings("deprecation") public static ImmutableMap getTransforms(ItemCameraTransforms transforms) { ImmutableMap.Builder builder = ImmutableMap.builder(); @@ -68,7 +71,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return builder.build(); } - public static Pair handlePerspective(IFlexibleBakedModel model, ImmutableMap transforms, TransformType cameraTransformType) + public static Pair handlePerspective(IBakedModel model, ImmutableMap transforms, TransformType cameraTransformType) { TRSRTransformation tr = transforms.get(cameraTransformType); Matrix4f mat = null; @@ -76,7 +79,7 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel return Pair.of(model, mat); } - public static Pair handlePerspective(IFlexibleBakedModel model, IModelState state, TransformType cameraTransformType) + public static Pair handlePerspective(IBakedModel model, IModelState state, TransformType cameraTransformType) { TRSRTransformation tr = state.apply(Optional.of(cameraTransformType)).or(TRSRTransformation.identity()); if(tr != TRSRTransformation.identity()) @@ -88,15 +91,15 @@ public interface IPerspectiveAwareModel extends IFlexibleBakedModel public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); } public boolean isGui3d() { return parent.isGui3d(); } - public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); } + public boolean func_188618_c() { return parent.func_188618_c(); } public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); } + @SuppressWarnings("deprecation") public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); } - public List getFaceQuads(EnumFacing side) { return parent.getFaceQuads(side); } - public List getGeneralQuads() { return parent.getGeneralQuads(); } - public VertexFormat getFormat() { return parent.getFormat(); } + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { return parent.func_188616_a(state, side, rand); } + public ItemOverrideList func_188617_f() { return parent.func_188617_f(); } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return handlePerspective(this, transforms, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java b/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java deleted file mode 100644 index 797456109d..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ISmartBlockModel.java +++ /dev/null @@ -1,94 +0,0 @@ -package net.minecraftforge.client.model; - -import java.util.List; - -import javax.vecmath.Matrix4f; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.EnumFacing; - -import org.apache.commons.lang3.tuple.Pair; - -public interface ISmartBlockModel extends IBakedModel -{ - IBakedModel handleBlockState(IBlockState state); - - public static abstract class Wrapper implements ISmartBlockModel, IFlexibleBakedModel - { - protected final IFlexibleBakedModel parent; - - public Wrapper(IFlexibleBakedModel parent) - { - this.parent = parent; - } - - public List getFaceQuads(EnumFacing side) - { - return parent.getFaceQuads(side); - } - - public List getGeneralQuads() - { - return parent.getGeneralQuads(); - } - - public boolean isAmbientOcclusion() - { - return parent.isAmbientOcclusion(); - } - - public boolean isGui3d() - { - return parent.isGui3d(); - } - - public boolean isBuiltInRenderer() - { - return parent.isBuiltInRenderer(); - } - - public TextureAtlasSprite getParticleTexture() - { - return parent.getParticleTexture(); - } - - public ItemCameraTransforms getItemCameraTransforms() - { - return parent.getItemCameraTransforms(); - } - - public VertexFormat getFormat() - { - return parent.getFormat(); - } - } - - public static abstract class PerspectiveWrapper extends Wrapper implements IPerspectiveAwareModel - { - protected final IPerspectiveAwareModel parent; - - public PerspectiveWrapper(IPerspectiveAwareModel parent) - { - super(parent); - this.parent = parent; - } - - public Pair handlePerspective(TransformType type) - { - Pair pair = parent.handlePerspective(type); - return Pair.of(new ISmartBlockModel.Wrapper(pair.getLeft()) - { - public IBakedModel handleBlockState(IBlockState state) - { - return PerspectiveWrapper.this.handleBlockState(state); - } - }, pair.getRight()); - } - } -} diff --git a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java b/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java deleted file mode 100644 index 46703fc83c..0000000000 --- a/src/main/java/net/minecraftforge/client/model/ISmartItemModel.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.minecraftforge.client.model; - -import net.minecraft.item.ItemStack; -import net.minecraft.client.renderer.block.model.IBakedModel; - -public interface ISmartItemModel extends IBakedModel -{ - IBakedModel handleItemState(ItemStack stack); -} diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index 873bceae93..208522a766 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -10,9 +10,12 @@ import javax.vecmath.Vector4f; import org.apache.commons.lang3.tuple.Pair; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.block.model.ModelBlock; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; @@ -85,7 +88,7 @@ public class ItemLayerModel implements IRetexturableModel return new ItemLayerModel(builder.build()); } - public IFlexibleBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, final VertexFormat format, Function bakedTextureGetter) { ImmutableList.Builder builder = ImmutableList.builder(); Optional transform = state.apply(Optional.absent()); @@ -96,47 +99,21 @@ public class ItemLayerModel implements IRetexturableModel } TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0)); ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); - return new BakedItemModel(builder.build(), particle, format, map, null); + return new BakedItemModel(builder.build(), particle, map, null); } - @Deprecated // remove 1.9 - public static class BakedModel implements IFlexibleBakedModel + private static class BakedItemModel implements IPerspectiveAwareModel { private final ImmutableList quads; private final TextureAtlasSprite particle; - private final VertexFormat format; - - public BakedModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format) - { - this.quads = quads; - this.particle = particle; - this.format = format; - } - - public boolean isAmbientOcclusion() { return true; } - public boolean isGui3d() { return false; } - public boolean isBuiltInRenderer() { return false; } - public TextureAtlasSprite getParticleTexture() { return particle; } - public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) { return ImmutableList.of(); } - public List getGeneralQuads() { return quads; } - public VertexFormat getFormat() { return format; } - } - - private static class BakedItemModel implements IFlexibleBakedModel, IPerspectiveAwareModel - { - private final ImmutableList quads; - private final TextureAtlasSprite particle; - private final VertexFormat format; private final ImmutableMap transforms; - private final IFlexibleBakedModel otherModel; + private final IBakedModel otherModel; private final boolean isCulled; - public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, IFlexibleBakedModel otherModel) + public BakedItemModel(ImmutableList quads, TextureAtlasSprite particle, ImmutableMap transforms, IBakedModel otherModel) { this.quads = quads; this.particle = particle; - this.format = format; this.transforms = transforms; if(otherModel != null) { @@ -153,23 +130,26 @@ public class ItemLayerModel implements IRetexturableModel builder.add(quad); } } - this.otherModel = new BakedItemModel(builder.build(), particle, format, transforms, this); + this.otherModel = new BakedItemModel(builder.build(), particle, transforms, this); isCulled = false; } } public boolean isAmbientOcclusion() { return true; } public boolean isGui3d() { return false; } - public boolean isBuiltInRenderer() { return false; } + public boolean func_188618_c() { return false; } public TextureAtlasSprite getParticleTexture() { return particle; } public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) { return ImmutableList.of(); } - public List getGeneralQuads() { return quads; } - public VertexFormat getFormat() { return format; } - - public Pair handlePerspective(TransformType type) + public ItemOverrideList func_188617_f() { return ItemOverrideList.field_188022_a; } + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - Pair pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); + if(side == null) return quads; + return ImmutableList.of(); + } + + public Pair handlePerspective(TransformType type) + { + Pair pair = IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); if(type == TransformType.GUI && !isCulled && pair.getRight() == null) { return Pair.of(otherModel, null); diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 93fa9aaf59..8b36e5e09c 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -1,31 +1,43 @@ package net.minecraftforge.client.model; +import java.io.IOException; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import javax.vecmath.Matrix4f; +import javax.vecmath.Quat4f; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms; +import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.renderer.vertex.VertexFormat; +import net.minecraft.client.resources.IResourceManager; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidContainerItem; + +import org.apache.commons.lang3.tuple.Pair; + import com.google.common.base.Function; import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Maps; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; -import net.minecraft.client.renderer.texture.TextureAtlasSprite; -import net.minecraft.client.renderer.vertex.VertexFormat; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.*; -import org.apache.commons.lang3.tuple.Pair; - -import javax.vecmath.Matrix4f; -import javax.vecmath.Quat4f; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; public class ModelDynBucket implements IModel, IModelCustomData, IRetexturableModel { @@ -81,7 +93,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { @@ -104,8 +116,8 @@ public class ModelDynBucket implements IModel, IModelCustomData, if (baseLocation != null) { // build base (insidest) - IFlexibleBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); - builder.addAll(model.getGeneralQuads()); + IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(state, format, bakedTextureGetter); + builder.addAll(model.func_188616_a(null, null, 0)); } if (liquidLocation != null && fluidSprite != null) { @@ -123,7 +135,7 @@ public class ModelDynBucket implements IModel, IModelCustomData, } - return new BakedDynBucket(this, builder.build(), fluidSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap()); + return new BakedDynBucket(this, builder.build(), fluidSprite, format, Maps.immutableEnumMap(transformMap), Maps.newHashMap()); } @Override @@ -211,26 +223,16 @@ public class ModelDynBucket implements IModel, IModelCustomData, } } - // the dynamic bucket is based on the empty bucket - protected static class BakedDynBucket extends ItemLayerModel.BakedModel implements ISmartItemModel, IPerspectiveAwareModel + protected static final class BakedDynBucketOverrideHandler extends ItemOverrideList { - - private final ModelDynBucket parent; - private final Map cache; // contains all the baked models since they'll never change - private final ImmutableMap transforms; - - public BakedDynBucket(ModelDynBucket parent, - ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, - Map cache) + public static final BakedDynBucketOverrideHandler INSTANCE = new BakedDynBucketOverrideHandler(); + private BakedDynBucketOverrideHandler() { - super(quads, particle, format); - this.parent = parent; - this.transforms = transforms; - this.cache = cache; + super(ImmutableList.of()); } @Override - public IBakedModel handleItemState(ItemStack stack) + public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(stack); if (fluidStack == null) @@ -245,16 +247,17 @@ public class ModelDynBucket implements IModel, IModelCustomData, if (fluidStack == null) { // empty bucket - return this; + return originalModel; } + BakedDynBucket model = (BakedDynBucket)originalModel; Fluid fluid = fluidStack.getFluid(); String name = fluid.getName(); - if (!cache.containsKey(name)) + if (!model.cache.containsKey(name)) { - IModel model = parent.process(ImmutableMap.of("fluid", name)); + IModel parent = model.parent.process(ImmutableMap.of("fluid", name)); Function textureGetter; textureGetter = new Function() { @@ -264,18 +267,62 @@ public class ModelDynBucket implements IModel, IModelCustomData, } }; - IFlexibleBakedModel bakedModel = model.bake(new SimpleModelState(transforms), this.getFormat(), textureGetter); - cache.put(name, bakedModel); + IBakedModel bakedModel = parent.bake(new SimpleModelState(model.transforms), model.format, textureGetter); + model.cache.put(name, bakedModel); return bakedModel; } - return cache.get(name); + return model.cache.get(name); + } + } + + // the dynamic bucket is based on the empty bucket + protected static class BakedDynBucket implements IPerspectiveAwareModel + { + + private final ModelDynBucket parent; + // FIXME: guava cache? + private final Map cache; // contains all the baked models since they'll never change + private final ImmutableMap transforms; + private final ImmutableList quads; + private final TextureAtlasSprite particle; + private final VertexFormat format; + + public BakedDynBucket(ModelDynBucket parent, + ImmutableList quads, TextureAtlasSprite particle, VertexFormat format, ImmutableMap transforms, + Map cache) + { + this.quads = quads; + this.particle = particle; + this.format = format; + this.parent = parent; + this.transforms = transforms; + this.cache = cache; } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public ItemOverrideList func_188617_f() + { + return BakedDynBucketOverrideHandler.INSTANCE; + } + + @Override + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, cameraTransformType); } + + @Override + public List func_188616_a(IBlockState state, EnumFacing side, long rand) + { + if(side == null) return quads; + return ImmutableList.of(); + } + + public boolean isAmbientOcclusion() { return true; } + public boolean isGui3d() { return false; } + public boolean func_188618_c() { return false; } + public TextureAtlasSprite getParticleTexture() { return particle; } + public ItemCameraTransforms getItemCameraTransforms() { return ItemCameraTransforms.DEFAULT; } } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index e6235e30dc..2bb21944d6 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -12,14 +12,15 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.pipeline.LightUtil; import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad; import net.minecraftforge.common.property.IExtendedBlockState; @@ -42,7 +43,6 @@ import com.google.common.collect.Maps; import com.google.gson.JsonElement; import com.google.gson.JsonParser; -@SuppressWarnings("deprecation") public class ModelFluid implements IModelCustomData { public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER); @@ -64,7 +64,7 @@ public class ModelFluid implements IModelCustomData return ImmutableSet.of(fluid.getStill(), fluid.getFlowing()); } - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap map = IPerspectiveAwareModel.MapWrapper.getTransforms(state); return new BakedFluid(state.apply(Optional.absent()), map, format, fluid.getColor(), bakedTextureGetter.apply(fluid.getStill()), bakedTextureGetter.apply(fluid.getFlowing()), fluid.isGaseous(), Optional.absent()); @@ -95,7 +95,7 @@ public class ModelFluid implements IModelCustomData } } - public static class BakedFluid implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel + public static class BakedFluid implements IPerspectiveAwareModel { private static final int x[] = { 0, 0, 1, 1 }; private static final int z[] = { 0, 1, 1, 0 }; @@ -341,7 +341,7 @@ public class ModelFluid implements IModelCustomData return false; } - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -356,23 +356,9 @@ public class ModelFluid implements IModelCustomData return ItemCameraTransforms.DEFAULT; } - public List getFaceQuads(EnumFacing side) - { - return faceQuads.get(side); - } - - public List getGeneralQuads() - { - return ImmutableList.of(); - } - - public VertexFormat getFormat() - { - return format; - } - - public IBakedModel handleBlockState(IBlockState state) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { + BakedFluid model = this; if(state instanceof IExtendedBlockState) { IExtendedBlockState exState = (IExtendedBlockState)state; @@ -386,13 +372,19 @@ public class ModelFluid implements IModelCustomData } key <<= 1; key |= 1; - return modelCache.getUnchecked(key); + model = modelCache.getUnchecked(key); } - return this; + if(side == null) return ImmutableList.of(); + return model.faceQuads.get(side); + } + + public ItemOverrideList func_188617_f() + { + return ItemOverrideList.field_188022_a; } @Override - public Pair handlePerspective(TransformType type) + public Pair handlePerspective(TransformType type) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, transforms, type); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index ae6a230f48..1342d7ed32 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -7,10 +7,8 @@ import java.util.Map; import java.util.Set; import net.minecraft.client.Minecraft; -import net.minecraft.client.resources.IReloadableResourceManager; -import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader.VanillaLoader; import net.minecraftforge.client.model.b3d.B3DLoader; diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index c04dd6e07d..ea725a3de3 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -7,17 +7,17 @@ import java.util.List; import javax.vecmath.Matrix4f; import net.minecraft.block.state.IBlockState; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.resources.IResourceManager; -import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.util.EnumFacing; import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.fml.common.FMLLog; @@ -55,9 +55,9 @@ public class MultiLayerModel implements IModelCustomData return ImmutableList.of(); } - private static ImmutableMap, IFlexibleBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) + private static ImmutableMap, IBakedModel> buildModels(ImmutableMap, ModelResourceLocation> models, IModelState state, VertexFormat format, Function bakedTextureGetter) { - ImmutableMap.Builder, IFlexibleBakedModel> builder = ImmutableMap.builder(); + ImmutableMap.Builder, IBakedModel> builder = ImmutableMap.builder(); for(Optional key : models.keySet()) { IModel model; @@ -76,13 +76,12 @@ public class MultiLayerModel implements IModelCustomData } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { IModel missing = ModelLoaderRegistry.getMissingModel(); return new MultiLayerBakedModel( buildModels(models, state, format, bakedTextureGetter), missing.bake(missing.getDefaultState(), format, bakedTextureGetter), - format, IPerspectiveAwareModel.MapWrapper.getTransforms(state) ); } @@ -127,38 +126,17 @@ public class MultiLayerModel implements IModelCustomData return new ModelResourceLocation("builtin/missing", "missing"); } - public static class MultiLayerBakedModel implements IFlexibleBakedModel, ISmartBlockModel, IPerspectiveAwareModel + public static class MultiLayerBakedModel implements IPerspectiveAwareModel { - private final ImmutableMap, IFlexibleBakedModel> models; - private final VertexFormat format; + private final ImmutableMap, IBakedModel> models; private final ImmutableMap cameraTransforms;; - private final IFlexibleBakedModel base; - private final IFlexibleBakedModel missing; + private final IBakedModel base; + private final IBakedModel missing; private final ImmutableMap, ImmutableList> quads; - private static final Function defaultTextureGetter = new Function() - { - public TextureAtlasSprite apply(ResourceLocation location) - { - return Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(location.toString()); - } - }; - - @Deprecated // remove 1.9 - public MultiLayerBakedModel(ImmutableMap, ModelResourceLocation> models, VertexFormat format, ImmutableMap cameraTransforms) - { - this( - buildModels(models, TRSRTransformation.identity(), format, defaultTextureGetter), - ModelLoaderRegistry.getMissingModel().bake(ModelLoaderRegistry.getMissingModel().getDefaultState(), format, defaultTextureGetter), - format, - cameraTransforms - ); - } - - public MultiLayerBakedModel(ImmutableMap, IFlexibleBakedModel> models, IFlexibleBakedModel missing, VertexFormat format, ImmutableMap cameraTransforms) + public MultiLayerBakedModel(ImmutableMap, IBakedModel> models, IBakedModel missing, ImmutableMap cameraTransforms) { this.models = models; - this.format = format; this.cameraTransforms = cameraTransforms; this.missing = missing; if(models.containsKey(Optional.absent())) @@ -178,33 +156,34 @@ public class MultiLayerModel implements IModelCustomData quads = quadBuilder.build(); } - private static ImmutableList buildQuads(ImmutableMap, IFlexibleBakedModel> models, Optional side) + private static ImmutableList buildQuads(ImmutableMap, IBakedModel> models, Optional side) { ImmutableList.Builder builder = ImmutableList.builder(); for(IBakedModel model : models.values()) { - if(side.isPresent()) - { - builder.addAll(model.getFaceQuads(side.get())); - } - else - { - builder.addAll(model.getGeneralQuads()); - } + builder.addAll(model.func_188616_a(null, side.orNull(), 0)); } return builder.build(); } @Override - public List getFaceQuads(EnumFacing side) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - return quads.get(Optional.of(side)); - } - - @Override - public List getGeneralQuads() - { - return quads.get(Optional.absent()); + IBakedModel model; + BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer(); + if(layer == null) + { + return quads.get(Optional.fromNullable(side)); + } + else if(!models.containsKey(layer)) + { + model = missing; + } + else + { + model = models.get(Optional.of(layer)); + } + return model.func_188616_a(state, side, rand); } @Override @@ -220,9 +199,9 @@ public class MultiLayerModel implements IModelCustomData } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { - return base.isBuiltInRenderer(); + return base.func_188618_c(); } @Override @@ -238,27 +217,16 @@ public class MultiLayerModel implements IModelCustomData } @Override - public IBakedModel handleBlockState(IBlockState state) - { - Optional layer = Optional.of(MinecraftForgeClient.getRenderLayer()); - if(!models.containsKey(layer)) - { - return missing; - } - return models.get(layer); - } - - @Override - public VertexFormat getFormat() - { - return format; - } - - @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, cameraTransforms, cameraTransformType); } + + @Override + public ItemOverrideList func_188617_f() + { + return ItemOverrideList.field_188022_a; + } } public static enum Loader implements ICustomModelLoader diff --git a/src/main/java/net/minecraftforge/client/model/MultiModel.java b/src/main/java/net/minecraftforge/client/model/MultiModel.java index f90a747df7..6280f598c7 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiModel.java @@ -1,7 +1,6 @@ package net.minecraftforge.client.model; import java.util.Collection; -import java.util.EnumMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -10,9 +9,12 @@ import java.util.Set; import javax.vecmath.Matrix4f; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; +import net.minecraft.client.renderer.block.model.ItemOverrideList; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; @@ -23,30 +25,30 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.logging.log4j.Level; import com.google.common.base.Function; +import com.google.common.base.Optional; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@SuppressWarnings("deprecation") +// TODO: Switch to vanilla class, or to something similar +@Deprecated public class MultiModel implements IModel { - public static class Baked implements IFlexibleBakedModel, IPerspectiveAwareModel + public static class Baked implements IPerspectiveAwareModel { - protected final IFlexibleBakedModel base; - protected final ImmutableMap parts; + protected final IBakedModel base; + protected final ImmutableMap parts; - protected final IFlexibleBakedModel internalBase; - protected ImmutableList general; - protected ImmutableMap> faces; + protected final IBakedModel internalBase; + protected ImmutableMap, ImmutableList> quads; protected final ImmutableMap> transforms; - public Baked(IFlexibleBakedModel base, ImmutableMap parts) + public Baked(IBakedModel base, ImmutableMap parts) { this(null, false, base, parts); } - public Baked(ResourceLocation location, boolean perspective, IFlexibleBakedModel base, ImmutableMap parts) + public Baked(ResourceLocation location, boolean perspective, IBakedModel base, ImmutableMap parts) { this.base = base; this.parts = parts; @@ -55,7 +57,7 @@ public class MultiModel implements IModel internalBase = base; else { - Iterator iter = parts.values().iterator(); + Iterator iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else @@ -69,8 +71,8 @@ public class MultiModel implements IModel ImmutableMap.Builder> builder = ImmutableMap.builder(); for(TransformType type : TransformType.values()) { - Pair p = perBase.handlePerspective(type); - IFlexibleBakedModel newBase = p.getLeft(); + Pair p = perBase.handlePerspective(type); + IBakedModel newBase = p.getLeft(); builder.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight()))); } transforms = builder.build(); @@ -94,9 +96,9 @@ public class MultiModel implements IModel } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { - return internalBase.isBuiltInRenderer(); + return internalBase.func_188618_c(); } @Override @@ -112,66 +114,64 @@ public class MultiModel implements IModel } @Override - public List getFaceQuads(EnumFacing side) + public List func_188616_a(IBlockState state, EnumFacing side, long rand) { - if(faces == null) + if(quads == null) { - // Create map of each face's quads. - EnumMap> faces = Maps.newEnumMap(EnumFacing.class); + ImmutableMap.Builder, ImmutableList> builder = ImmutableMap.builder(); for (EnumFacing face : EnumFacing.values()) { - ImmutableList.Builder faceQuads = ImmutableList.builder(); + ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) - faceQuads.addAll(base.getFaceQuads(face)); - for (IFlexibleBakedModel bakedPart : parts.values()) - faceQuads.addAll(bakedPart.getFaceQuads(face)); - faces.put(face, faceQuads.build()); + { + quads.addAll(base.func_188616_a(null, face, 0)); + } + for (IBakedModel bakedPart : parts.values()) + { + quads.addAll(bakedPart.func_188616_a(null, face, 0)); + } + builder.put(Optional.of(face), quads.build()); } - this.faces = Maps.immutableEnumMap(faces); - } - return faces.get(side); - } - - @Override - public List getGeneralQuads() - { - if(general == null) - { - // Create list of general quads. - ImmutableList.Builder genQuads = ImmutableList.builder(); + ImmutableList.Builder quads = ImmutableList.builder(); if (base != null) - genQuads.addAll(base.getGeneralQuads()); - for (IFlexibleBakedModel bakedPart : parts.values()) - genQuads.addAll(bakedPart.getGeneralQuads()); - general = genQuads.build(); + { + quads.addAll(base.func_188616_a(null, null, 0)); + } + for (IBakedModel bakedPart : parts.values()) + { + quads.addAll(bakedPart.func_188616_a(null, null, 0)); + } + builder.put(Optional.absent(), quads.build()); + this.quads = builder.build(); } - return general; + return quads.get(Optional.fromNullable(side)); } - @Override - public VertexFormat getFormat() - { - return internalBase.getFormat(); - } - - public IFlexibleBakedModel getBaseModel() + public IBakedModel getBaseModel() { return base; } - public Map getParts() + public Map getParts() { return parts; } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { if(transforms.isEmpty()) return Pair.of(this, null); Pair p = transforms.get(cameraTransformType); return Pair.of(p.getLeft(), p.getRight().getMatrix()); } + + @Override + public ItemOverrideList func_188617_f() + { + // TODO Auto-generated method stub + return null; + } } protected final ResourceLocation location; @@ -231,14 +231,14 @@ public class MultiModel implements IModel } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { - IFlexibleBakedModel bakedBase = null; + IBakedModel bakedBase = null; if (base != null) bakedBase = base.bake(state, format, bakedTextureGetter); - ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); + ImmutableMap.Builder mapBuilder = ImmutableMap.builder(); for (Entry> entry : parts.entrySet()) { diff --git a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java index 05492f7bee..2cd3bef15f 100644 --- a/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java +++ b/src/main/java/net/minecraftforge/client/model/TRSRTransformation.java @@ -11,7 +11,7 @@ import javax.vecmath.Vector4f; import net.minecraft.client.renderer.block.model.ItemTransformVec3f; import net.minecraft.client.renderer.block.model.ModelRotation; import net.minecraft.util.EnumFacing; -import net.minecraft.util.Vec3i; +import net.minecraft.util.math.Vec3i; import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Triple; diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java index dbdc076294..766242af82 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationModelBase.java @@ -58,16 +58,16 @@ public class AnimationModelBase extends M GlStateManager.pushMatrix(); GlStateManager.rotate(180, 0, 0, 1); Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); VertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); VertexBuffer.setTranslation(-0.5, -1.5, -0.5); lighter.setParent(new VertexBufferConsumer(VertexBuffer)); lighter.setWorld(entity.worldObj); - lighter.setBlock(Blocks.air); + lighter.setState(Blocks.air.getDefaultState()); lighter.setBlockPos(pos); boolean empty = true; - List quads = bakedModel.getGeneralQuads(); + List quads = bakedModel.func_188616_a(null, null, 0); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -79,7 +79,7 @@ public class AnimationModelBase extends M } for(EnumFacing side : EnumFacing.values()) { - quads = bakedModel.getFaceQuads(side); + quads = bakedModel.func_188616_a(null, side, 0); if(!quads.isEmpty()) { if(empty) lighter.updateBlockInfo(); diff --git a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java index 62224462cd..ac6ec94d6f 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/AnimationTESR.java @@ -1,7 +1,5 @@ package net.minecraftforge.client.model.animation; -import java.util.concurrent.TimeUnit; - import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -12,16 +10,11 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.model.IModelState; -import net.minecraftforge.client.model.ISmartBlockModel; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.Properties; import org.apache.commons.lang3.tuple.Pair; -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; - /** * Generic TileEntitySpecialRenderer that works with the Forge model system and animations. */ @@ -29,24 +22,6 @@ public class AnimationTESR extends Fa { protected static BlockRendererDispatcher blockRenderer; - protected static final LoadingCache, IBakedModel> modelCache = CacheBuilder.newBuilder().maximumSize(10).expireAfterWrite(100, TimeUnit.MILLISECONDS).build(new CacheLoader, IBakedModel>() - { - public IBakedModel load(Pair key) throws Exception - { - IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(key.getLeft().getClean()); - if(model instanceof ISmartBlockModel) - { - model = ((ISmartBlockModel)model).handleBlockState(key.getLeft().withProperty(Properties.AnimationProperty, key.getRight())); - } - return model; - } - }); - - protected static IBakedModel getModel(IExtendedBlockState state, IModelState modelState) - { - return modelCache.getUnchecked(Pair.of(state, modelState)); - } - public void renderTileEntityFast(T te, double x, double y, double z, float partialTick, int breakStage, VertexBuffer renderer) { if(blockRenderer == null) blockRenderer = Minecraft.getMinecraft().getBlockRendererDispatcher(); @@ -66,11 +41,13 @@ public class AnimationTESR extends Fa Pair> pair = te.asm().apply(time); handleEvents(te, time, pair.getRight()); - IBakedModel model = getModel(exState, pair.getLeft()); + // TODO: caching? + IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(exState.getClean()); + exState = exState.withProperty(Properties.AnimationProperty, pair.getLeft()); renderer.setTranslation(x - pos.getX(), y - pos.getY(), z - pos.getZ()); - blockRenderer.getBlockModelRenderer().renderModel(world, model, state, pos, renderer, false); + blockRenderer.getBlockModelRenderer().renderModel(world, model, exState, pos, renderer, false); } } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/Clips.java b/src/main/java/net/minecraftforge/client/model/animation/Clips.java index 1fbb8711f3..6e760694ea 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/client/model/animation/Clips.java @@ -4,7 +4,7 @@ import java.io.IOException; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.util.IStringSerializable; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.IModel; import net.minecraftforge.client.model.IModelPart; diff --git a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java index 3b8bcdd452..80a238eb4b 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java +++ b/src/main/java/net/minecraftforge/client/model/animation/FastTESR.java @@ -18,7 +18,7 @@ public abstract class FastTESR extends TileEntitySpecialRe public final void renderTileEntityAt(T te, double x, double y, double z, float partialTicks, int destroyStage) { Tessellator tessellator = Tessellator.getInstance(); - VertexBuffer VertexBuffer = tessellator.getVertexBuffer(); + VertexBuffer VertexBuffer = tessellator.getWorldRenderer(); this.bindTexture(TextureMap.locationBlocksTexture); RenderHelper.disableStandardItemLighting(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index a7480b20d7..2e5598975c 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -13,7 +13,7 @@ import javax.vecmath.Quat4f; import javax.vecmath.Vector3f; import net.minecraft.client.renderer.block.model.BlockPart; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.client.model.IModelState; import net.minecraftforge.client.model.TRSRTransformation; import net.minecraftforge.client.model.animation.ModelBlockAnimation.Parameter.Interpolation; diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 3dfbcc041b..eb60e170fe 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -16,6 +16,7 @@ import javax.vecmath.Vector3f; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.ItemCameraTransforms; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.texture.TextureAtlasSprite; @@ -24,7 +25,7 @@ import net.minecraft.client.resources.IResource; import net.minecraft.client.resources.IResourceManager; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.*; import net.minecraftforge.client.model.animation.IClip; @@ -127,65 +128,11 @@ public class B3DLoader implements ICustomModelLoader } B3DModel model = cache.get(file); if(model == null) return ModelLoaderRegistry.getMissingModel(); - if(modelLocation instanceof B3DMeshLocation) - { - String mesh = ((B3DMeshLocation)modelLocation).getMesh(); - if(!model.getMeshes().containsKey(mesh)) - { - FMLLog.severe("No mesh named %s in model %s, skipping", mesh, modelLocation); - return ModelLoaderRegistry.getMissingModel(); - } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(mesh), 1); - } if(!(model.getRoot().getKind() instanceof Mesh)) { - return new ModelWrapper(modelLocation, model, ImmutableSet.of(), 1); - } - return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), 1); - } - - /** - * @deprecated Use json or IModelCustomData.process - */ - @Deprecated - public static class B3DMeshLocation extends ResourceLocation - { - public final String mesh; - - public B3DMeshLocation(String domain, String path, String mesh) - { - super(domain, path); - this.mesh = mesh; - } - - public String getMesh() - { - return mesh; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = super.hashCode(); - result = prime * result + ((mesh == null) ? 0 : mesh.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) return true; - if (!super.equals(obj)) return false; - if (getClass() != obj.getClass()) return false; - B3DMeshLocation other = (B3DMeshLocation) obj; - if (mesh == null) - { - if (other.mesh != null) return false; - } - else if (!mesh.equals(other.mesh)) return false; - return true; + return new ModelWrapper(modelLocation, model, ImmutableSet.of(), true, true, 1); } + return new ModelWrapper(modelLocation, model, ImmutableSet.of(((Node)model.getRoot()).getName()), true, true, 1); } public static class B3DState implements IModelState @@ -454,166 +401,6 @@ public class B3DLoader implements ICustomModelLoader } } - /** - * @deprecated Use ModelWrapper, this will be removed in 1.9 - */ - @Deprecated - public static class Wrapper extends PartWrapper implements IRetexturableModel, IModelCustomData - { - private final ResourceLocation location; - private final ImmutableSet meshes; - private final ImmutableMap textures; - - public Wrapper(ResourceLocation location, List textures, B3DModel.Node mesh) - { - this(location, ImmutableSet.of(), buildTextures(textures), mesh); - } - - public Wrapper(ResourceLocation location, ImmutableMap textures, B3DModel.Node mesh) - { - this(location, ImmutableSet.of(), textures, mesh); - } - - public Wrapper(ResourceLocation location, ImmutableSet meshes, List textures, B3DModel.Node mesh) - { - this(location, meshes, buildTextures(textures), mesh); - } - - public Wrapper(ResourceLocation location, ImmutableSet meshes, ImmutableMap textures, B3DModel.Node mesh) - { - super(mesh); - this.location = location; - this.meshes = meshes; - this.textures = textures; - } - - private static ImmutableMap buildTextures(List textures) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - - for(Texture t : textures) - { - String path = t.getPath(); - String location = getLocation(path); - if(!location.startsWith("#")) location = "#" + location; - builder.put(path, new ResourceLocation(location)); - } - return builder.build(); - } - - private static String getLocation(String path) - { - if(path.endsWith(".png")) path = path.substring(0, path.length() - ".png".length()); - return path; - } - - public Collection getDependencies() - { - // no dependencies for in-file models - // FIXME maybe add child meshes - return Collections.emptyList(); - } - - public Collection getTextures() - { - return Collections2.filter(textures.values(), new Predicate() - { - public boolean apply(ResourceLocation loc) - { - return !loc.getResourcePath().startsWith("#"); - } - }); - } - - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); - for(Map.Entry e : textures.entrySet()) - { - if(e.getValue().getResourcePath().startsWith("#")) - { - FMLLog.severe("unresolved texture '%s' for b3d model '%s'", e.getValue().getResourcePath(), location); - builder.put(e.getKey(), missing); - } - else - { - builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue())); - } - } - builder.put("missingno", missing); - return new BakedWrapper(getNode(), state, format, meshes, builder.build()); - } - - public ResourceLocation getLocation() - { - return location; - } - - public ImmutableMap getTextureMap() - { - return textures; - } - - @Override - public int hashCode() - { - final int prime = 31; - int result = 1; - result = prime * result + ((location == null) ? 0 : location.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) - { - if (this == obj) return true; - if (obj == null) return false; - if (getClass() != obj.getClass()) return false; - Wrapper other = (Wrapper) obj; - if (location == null) - { - if (other.location != null) return false; - } - else if (!location.equals(other.location)) return false; - return true; - } - - @Override - public IModel retexture(ImmutableMap textures) - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for(Map.Entry e : this.textures.entrySet()) - { - String path = e.getKey(); - String loc = getLocation(path); - if(textures.containsKey(loc)) - { - String newLoc = textures.get(loc); - if(newLoc == null) newLoc = getLocation(path); - builder.put(e.getKey(), new ResourceLocation(newLoc)); - } - else - { - builder.put(e); - } - } - return new Wrapper(location, builder.build(), getNode()); - } - - @Override - public IModel process(ImmutableMap customData) - { - return this; - } - - @Override - public IModelState getDefaultState() - { - return new B3DState(getNode().getAnimation(), 1); - } - } - public static class ModelWrapper implements IRetexturableModel, IModelCustomData, IModelSimpleProperties, IAnimatedModel { private final ResourceLocation modelLocation; @@ -624,23 +411,11 @@ public class B3DLoader implements ICustomModelLoader private final boolean gui3d; private final int defaultKey; - @Deprecated // remove in 1.9 - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey) - { - this(modelLocation, model, meshes, true, true, defaultKey); - } - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey) { this(modelLocation, model, meshes, smooth, gui3d, defaultKey, buildTextures(model.getTextures())); } - @Deprecated // remove in 1.9 - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, int defaultKey, ImmutableMap textures) - { - this(modelLocation, model, meshes, true, true, defaultKey, textures); - } - public ModelWrapper(ResourceLocation modelLocation, B3DModel model, ImmutableSet meshes, boolean smooth, boolean gui3d, int defaultKey, ImmutableMap textures) { this.modelLocation = modelLocation; @@ -691,7 +466,7 @@ public class B3DLoader implements ICustomModelLoader } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder builder = ImmutableMap.builder(); TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno")); @@ -730,7 +505,7 @@ public class B3DLoader implements ICustomModelLoader builder.put(e); } } - return new ModelWrapper(modelLocation, model, meshes, defaultKey, builder.build()); + return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, defaultKey, builder.build()); } @Override @@ -741,7 +516,7 @@ public class B3DLoader implements ICustomModelLoader JsonElement e = new JsonParser().parse(data.get("mesh")); if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isString()) { - return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), defaultKey, textures); + return new ModelWrapper(modelLocation, model, ImmutableSet.of(e.getAsString()), smooth, gui3d, defaultKey, textures); } else if (e.isJsonArray()) { @@ -758,7 +533,7 @@ public class B3DLoader implements ICustomModelLoader return this; } } - return new ModelWrapper(modelLocation, model, builder.build(), defaultKey, textures); + return new ModelWrapper(modelLocation, model, builder.build(), smooth, gui3d, defaultKey, textures); } else { @@ -771,7 +546,7 @@ public class B3DLoader implements ICustomModelLoader JsonElement e = new JsonParser().parse(data.get("key")); if(e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) { - return new ModelWrapper(modelLocation, model, meshes, e.getAsNumber().intValue(), textures); + return new ModelWrapper(modelLocation, model, meshes, smooth, gui3d, e.getAsNumber().intValue(), textures); } else { @@ -817,7 +592,7 @@ public class B3DLoader implements ICustomModelLoader } } - private static class BakedWrapper implements IFlexibleBakedModel, ISmartBlockModel, ISmartItemModel, IPerspectiveAwareModel + private static class BakedWrapper implements IPerspectiveAwareModel { private final Node node; private final IModelState state; @@ -830,12 +605,6 @@ public class B3DLoader implements ICustomModelLoader private ImmutableList quads; - @Deprecated // remove in 1.9 - public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures) - { - this(node, state, true, true, format, meshes, textures); - } - public BakedWrapper(final Node node, final IModelState state, final boolean smooth, final boolean gui3d, final VertexFormat format, final ImmutableSet meshes, final ImmutableMap textures) { this(node, state, smooth, gui3d, format, meshes, textures, CacheBuilder.newBuilder() @@ -857,12 +626,6 @@ public class B3DLoader implements ICustomModelLoader })); } - @Deprecated // remove in 1.9 - public BakedWrapper(Node node, IModelState state, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) - { - this(node, state, true, true, format, meshes, textures, cache); - } - public BakedWrapper(Node node, IModelState state, boolean smooth, boolean gui3d, VertexFormat format, ImmutableSet meshes, ImmutableMap textures, LoadingCache cache) { this.node = node; @@ -875,11 +638,8 @@ public class B3DLoader implements ICustomModelLoader this.cache = cache; } - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); - } - + // FIXME merge with handleBlockState + @Override public List getGeneralQuads() { if(quads == null) @@ -887,7 +647,7 @@ public class B3DLoader implements ICustomModelLoader ImmutableList.Builder builder = ImmutableList.builder(); for(Node child : node.getNodes().values()) { - builder.addAll(new BakedWrapper(child, state, format, meshes, textures).getGeneralQuads()); + builder.addAll(new BakedWrapper(child, state, smooth, gui3d, format, meshes, textures).getGeneralQuads()); } if(node.getKind() instanceof Mesh && meshes.contains(node.getName())) { @@ -996,7 +756,7 @@ public class B3DLoader implements ICustomModelLoader return gui3d; } - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -1012,6 +772,7 @@ public class B3DLoader implements ICustomModelLoader return ItemCameraTransforms.DEFAULT; } + // FIXME merge with getQuads @Override public BakedWrapper handleBlockState(IBlockState state) { @@ -1040,7 +801,7 @@ public class B3DLoader implements ICustomModelLoader return cache.getUnchecked(s.getFrame()); } B3DState newState = new B3DState(newAnimation, s.getFrame(), s.getNextFrame(), s.getProgress(), parent); - return new BakedWrapper(node, newState, format, meshes, textures); + return new BakedWrapper(node, newState, smooth, gui3d, format, meshes, textures); } } else if(exState.getUnlistedNames().contains(Properties.AnimationProperty)) @@ -1055,25 +816,14 @@ public class B3DLoader implements ICustomModelLoader IModelState newState = exState.getValue(Properties.AnimationProperty); if(newState != null) { - return new BakedWrapper(node, new ModelStateComposition(parent, newState), format, meshes, textures); + return new BakedWrapper(node, new ModelStateComposition(parent, newState), smooth, gui3d, format, meshes, textures); } } } return this; } - public VertexFormat getFormat() - { - return format; - } - - public BakedWrapper handleItemState(ItemStack stack) - { - // TODO specify how to get B3DState from ItemStack - return this; - } - - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 1c6cb7a585..07ab890824 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -53,7 +53,6 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; -@SuppressWarnings("deprecation") public class OBJModel implements IRetexturableModel, IModelCustomData { //private Gson GSON = new GsonBuilder().create(); @@ -95,7 +94,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public IFlexibleBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) + public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder builder = ImmutableMap.builder(); builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance); @@ -1300,7 +1299,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } } - public class OBJBakedModel implements IFlexibleBakedModel, ISmartBlockModel, ISmartItemModel, IPerspectiveAwareModel + public class OBJBakedModel implements IPerspectiveAwareModel { private final OBJModel model; private IModelState state; @@ -1323,12 +1322,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< this.quads = null; } - @Override - public List getFaceQuads(EnumFacing side) - { - return Collections.emptyList(); - } - + // FIXME: merge with getQuads @Override public List getGeneralQuads() { @@ -1479,7 +1473,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public boolean isBuiltInRenderer() + public boolean func_188618_c() { return false; } @@ -1496,18 +1490,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< return ItemCameraTransforms.DEFAULT; } - @Override - public VertexFormat getFormat() - { - return format; - } - - @Override - public IBakedModel handleItemState(ItemStack stack) - { - return this; - } - + // FIXME: merge with getQuads @Override public OBJBakedModel handleBlockState(IBlockState state) { @@ -1591,7 +1574,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData< } @Override - public Pair handlePerspective(TransformType cameraTransformType) + public Pair handlePerspective(TransformType cameraTransformType) { return IPerspectiveAwareModel.MapWrapper.handlePerspective(this, state, cameraTransformType); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java index abc813a1e8..0198580e9e 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/BlockInfo.java @@ -1,16 +1,18 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.block.Block; import net.minecraft.block.Block.EnumOffsetType; -import net.minecraft.util.math.BlockPos; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; public class BlockInfo { + private final BlockColors colors; private IBlockAccess world; - private Block block; + private IBlockState state; private BlockPos blockPos; private final boolean[][][] translucent = new boolean[3][3][3]; @@ -25,11 +27,16 @@ public class BlockInfo private int cachedTint = -1; private int cachedMultiplier = -1; + public BlockInfo(BlockColors colors) + { + this.colors = colors; + } + public int getColorMultiplier(int tint) { if(cachedTint == tint) return cachedMultiplier; cachedTint = tint; - cachedMultiplier = block.colorMultiplier(world, blockPos, tint); + cachedMultiplier = colors.func_186724_a(state, world, blockPos, tint); return cachedMultiplier; } @@ -41,12 +48,12 @@ public class BlockInfo public void updateShift(boolean ignoreY) { long rand = 0; - if(block.getOffsetType() != EnumOffsetType.NONE) + if(state.getBlock().getOffsetType() != EnumOffsetType.NONE) { rand = MathHelper.getCoordinateRandom(blockPos.getX(), ignoreY ? 0 : blockPos.getY(), blockPos.getZ()); shx = ((float)((rand >> 16) & 0xF) / 0xF - .5f) * .5f; shz = ((float)((rand >> 24) & 0xF) / 0xF - .5f) * .5f; - if(block.getOffsetType() == EnumOffsetType.XYZ) + if(state.getBlock().getOffsetType() == EnumOffsetType.XYZ) { shy = ((float)((rand >> 20) & 0xF) / 0xF - 1) * .2f; } @@ -60,9 +67,9 @@ public class BlockInfo cachedMultiplier = -1; } - public void setBlock(Block block) + public void setState(IBlockState state) { - this.block = block; + this.state = state; cachedTint = -1; cachedMultiplier = -1; } @@ -94,16 +101,16 @@ public class BlockInfo for(int z = 0; z <= 2; z++) { BlockPos pos = blockPos.add(x - 1, y - 1, z - 1); - Block block = world.getBlockState(pos).getBlock(); - translucent[x][y][z] = block.isTranslucent(); + IBlockState state = world.getBlockState(pos); + translucent[x][y][z] = state.func_185895_e(); //translucent[x][y][z] = world.getBlockState(pos).getBlock().getLightOpacity(world, pos) == 0; - int brightness = this.block.getMixedBrightnessForBlock(world, pos); + int brightness = state.func_185889_a(world, pos); s[x][y][z] = (brightness >> 0x14) & 0xF; b[x][y][z] = (brightness >> 0x04) & 0xF; - ao[x][y][z] = block.getAmbientOcclusionLightValue(); + ao[x][y][z] = state.func_185892_j(); if(x == 1 && y == 1 && z == 1) { - full = block.isFullCube(); + full = state.func_185917_h(); } } } @@ -150,9 +157,9 @@ public class BlockInfo return world; } - public Block getBlock() + public IBlockState getState() { - return block; + return state; } public BlockPos getBlockPos() diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java index e6efd48a45..cb4635dcfc 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/ForgeBlockModelRenderer.java @@ -2,13 +2,14 @@ package net.minecraftforge.client.model.pipeline; import java.util.List; -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; import net.minecraft.client.renderer.block.model.IBakedModel; -import net.minecraft.util.math.BlockPos; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.common.ForgeModContainer; @@ -19,7 +20,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer @Override protected VertexLighterFlat initialValue() { - return new VertexLighterFlat(); + return new VertexLighterFlat(colors); } }; @@ -28,7 +29,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer @Override protected VertexLighterSmoothAo initialValue() { - return new VertexLighterSmoothAo(); + return new VertexLighterSmoothAo(colors); } }; @@ -37,55 +38,64 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer private final ThreadLocal lastRendererFlat = new ThreadLocal(); private final ThreadLocal lastRendererSmooth = new ThreadLocal(); + private final BlockColors colors; + + public ForgeBlockModelRenderer(BlockColors colors) + { + // TODO Auto-generated constructor stub + super(colors); + this.colors = colors; + } + @Override - public boolean renderModelStandard(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public boolean func_187497_c(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { - if(wr != lastRendererFlat.get()) + if(buffer != lastRendererFlat.get()) { - lastRendererFlat.set(wr); - VertexBufferConsumer newCons = new VertexBufferConsumer(wr); + lastRendererFlat.set(buffer); + VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); wrFlat.set(newCons); lighterFlat.get().setParent(newCons); } wrFlat.get().setOffset(pos); - return render(lighterFlat.get(), world, model, block, pos, wr, checkSides); + return render(lighterFlat.get(), world, model, state, pos, buffer, checkSides, rand); } else { - return super.renderModelStandard(world, model, block, pos, wr, checkSides); + return super.func_187497_c(world, model, state, pos, buffer, checkSides, rand); } } @Override - public boolean renderModelAmbientOcclusion(IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public boolean func_187498_b(IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer buffer, boolean checkSides, long rand) { if(ForgeModContainer.forgeLightPipelineEnabled) { - if(wr != lastRendererSmooth.get()) + if(buffer != lastRendererSmooth.get()) { - lastRendererSmooth.set(wr); - VertexBufferConsumer newCons = new VertexBufferConsumer(wr); + lastRendererSmooth.set(buffer); + VertexBufferConsumer newCons = new VertexBufferConsumer(buffer); wrSmooth.set(newCons); lighterSmooth.get().setParent(newCons); } wrSmooth.get().setOffset(pos); - return render(lighterSmooth.get(), world, model, block, pos, wr, checkSides); + return render(lighterSmooth.get(), world, model, state, pos, buffer, checkSides, rand); } else { - return super.renderModelAmbientOcclusion(world, model, block, pos, wr, checkSides); + return super.func_187498_b(world, model, state, pos, buffer, checkSides, rand); } } - public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, Block block, BlockPos pos, VertexBuffer wr, boolean checkSides) + public static boolean render(VertexLighterFlat lighter, IBlockAccess world, IBakedModel model, IBlockState state, BlockPos pos, VertexBuffer wr, boolean checkSides, long rand) { lighter.setWorld(world); - lighter.setBlock(block); + lighter.setState(state); lighter.setBlockPos(pos); boolean empty = true; - List quads = model.getGeneralQuads(); + List quads = model.func_188616_a(state, null, rand); if(!quads.isEmpty()) { lighter.updateBlockInfo(); @@ -97,10 +107,10 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer } for(EnumFacing side : EnumFacing.values()) { - quads = model.getFaceQuads(side); + quads = model.func_188616_a(state, side, rand); if(!quads.isEmpty()) { - if(!checkSides || block.shouldSideBeRendered(world, pos.offset(side), side)) + if(!checkSides || state.func_185894_c(world, pos.offset(side), side)) { if(empty) lighter.updateBlockInfo(); empty = false; diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java index cd5cfa5dab..b30431b493 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/LightUtil.java @@ -3,7 +3,6 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.BakedQuad; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage; @@ -11,6 +10,8 @@ import net.minecraft.util.EnumFacing; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.IColoredBakedQuad; +import org.apache.commons.lang3.tuple.Pair; + import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -71,18 +72,16 @@ public class LightUtil } } - private static final LoadingCache formatMaps = CacheBuilder.newBuilder() + private static final LoadingCache, int[]> formatMaps = CacheBuilder.newBuilder() .maximumSize(10) - .build(new CacheLoader() + .build(new CacheLoader, int[]>() { - public int[] load(VertexFormat format) + public int[] load(Pair pair) { - return mapFormats(format, DefaultVertexFormats.ITEM); + return mapFormats(pair.getLeft(), pair.getRight()); } }); - private static final int itemCount = DefaultVertexFormats.ITEM.getElementCount(); - public static void putBakedQuad(IVertexConsumer consumer, BakedQuad quad) { consumer.setQuadOrientation(quad.getFace()); @@ -96,16 +95,18 @@ public class LightUtil } //int[] eMap = mapFormats(consumer.getVertexFormat(), DefaultVertexFormats.ITEM); float[] data = new float[4]; - VertexFormat format = consumer.getVertexFormat(); - int count = format.getElementCount(); - int[] eMap = formatMaps.getUnchecked(format); + VertexFormat formatFrom = consumer.getVertexFormat(); + VertexFormat formatTo = quad.getFormat(); + int countFrom = formatFrom.getElementCount(); + int countTo = formatTo.getElementCount(); + int[] eMap = formatMaps.getUnchecked(Pair.of(formatFrom, formatTo)); for(int v = 0; v < 4; v++) { - for(int e = 0; e < count; e++) + for(int e = 0; e < countFrom; e++) { - if(eMap[e] != itemCount) + if(eMap[e] != countTo) { - unpack(quad.getVertexData(), data, DefaultVertexFormats.ITEM, v, eMap[e]); + unpack(quad.getVertexData(), data, quad.getFormat(), v, eMap[e]); consumer.put(e, data); } else @@ -240,7 +241,7 @@ public class LightUtil if(tessellator == null) { Tessellator tes = Tessellator.getInstance(); - VertexBuffer wr = tes.getVertexBuffer(); + VertexBuffer wr = tes.getWorldRenderer(); tessellator = new VertexBufferConsumer(wr); } return tessellator; @@ -260,7 +261,7 @@ public class LightUtil public static void renderQuadColorSlow(VertexBuffer wr, BakedQuad quad, int auxColor) { ItemConsumer cons; - if(wr == Tessellator.getInstance().getVertexBuffer()) + if(wr == Tessellator.getInstance().getWorldRenderer()) { cons = getItemConsumer(); } diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java index 430207d08b..8e04342919 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/UnpackedBakedQuad.java @@ -1,6 +1,7 @@ package net.minecraftforge.client.model.pipeline; import net.minecraft.client.renderer.block.model.BakedQuad; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.util.EnumFacing; import net.minecraftforge.client.model.IColoredBakedQuad; @@ -13,9 +14,9 @@ public class UnpackedBakedQuad extends BakedQuad protected final VertexFormat format; protected boolean packed = false; - public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, VertexFormat format) + public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) { - super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation); + super(new int[format.getNextOffset() /* / 4 * 4 */], tint, orientation, texture, format); this.unpackedData = unpackedData; this.format = format; } @@ -69,9 +70,9 @@ public class UnpackedBakedQuad extends BakedQuad public static class Colored extends UnpackedBakedQuad implements IColoredBakedQuad { - public Colored(float[][][] unpackedData, int tint, EnumFacing orientation, VertexFormat format) + public Colored(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, VertexFormat format) { - super(unpackedData, tint, orientation, format); + super(unpackedData, tint, orientation, texture, format); } } @@ -81,6 +82,7 @@ public class UnpackedBakedQuad extends BakedQuad private final float[][][] unpackedData; private int tint = -1; private EnumFacing orientation; + private TextureAtlasSprite texture; private boolean isColored = false; private int vertices = 0; @@ -108,6 +110,11 @@ public class UnpackedBakedQuad extends BakedQuad this.orientation = orientation; } + public void setTexture(TextureAtlasSprite texture) + { + this.texture = texture; + } + public void setQuadColored() { this.isColored = true; @@ -146,9 +153,9 @@ public class UnpackedBakedQuad extends BakedQuad } if(isColored) { - return new Colored(unpackedData, tint, orientation, format); + return new Colored(unpackedData, tint, orientation, texture, format); } - return new UnpackedBakedQuad(unpackedData, tint, orientation, format); + return new UnpackedBakedQuad(unpackedData, tint, orientation, texture, format); } } } \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java similarity index 96% rename from src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java rename to src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java index a1b9537110..7a783b4d97 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/WorldRendererConsumer.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexBufferConsumer.java @@ -7,7 +7,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; /** - * Assumes VertexFormatElement is present in the WorlRenderer's vertex format. + * Assumes VertexFormatElement is present in the VertexBuffer's vertex format. */ public class VertexBufferConsumer implements IVertexConsumer { diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java index 2e6bec66b1..32cb394e58 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterFlat.java @@ -2,19 +2,20 @@ package net.minecraftforge.client.model.pipeline; import javax.vecmath.Vector3f; -import com.google.common.base.Objects; - -import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.color.BlockColors; import net.minecraft.client.renderer.vertex.VertexFormat; import net.minecraft.client.renderer.vertex.VertexFormatElement; -import net.minecraft.util.math.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import com.google.common.base.Objects; + public class VertexLighterFlat extends QuadGatheringTransformer { - protected final BlockInfo blockInfo = new BlockInfo(); + protected final BlockInfo blockInfo; private int tint = -1; protected int posIndex = -1; @@ -22,6 +23,11 @@ public class VertexLighterFlat extends QuadGatheringTransformer protected int colorIndex = -1; protected int lightmapIndex = -1; + public VertexLighterFlat(BlockColors colors) + { + this.blockInfo = new BlockInfo(colors); + } + @Override public void setParent(IVertexConsumer parent) { @@ -197,7 +203,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer float e2 = 0.95f; BlockPos pos = blockInfo.getBlockPos(); - boolean full = blockInfo.getBlock().isFullCube(); + boolean full = blockInfo.getState().func_185917_h(); if((full || y < -e1) && normal[1] < -e2) pos = pos.down(); if((full || y > e1) && normal[1] > e2) pos = pos.up(); @@ -206,7 +212,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer if((full || x < -e1) && normal[0] < -e2) pos = pos.west(); if((full || x > e1) && normal[0] > e2) pos = pos.east(); - int brightness = blockInfo.getBlock().getMixedBrightnessForBlock(blockInfo.getWorld(), pos); + int brightness = blockInfo.getState().func_185889_a(blockInfo.getWorld(), pos); lightmap[0] = ((float)((brightness >> 0x04) & 0xF) * 0x20) / 0xFFFF; lightmap[1] = ((float)((brightness >> 0x14) & 0xF) * 0x20) / 0xFFFF; @@ -235,9 +241,9 @@ public class VertexLighterFlat extends QuadGatheringTransformer blockInfo.setWorld(world); } - public void setBlock(Block block) + public void setState(IBlockState state) { - blockInfo.setBlock(block); + blockInfo.setState(state); } public void setBlockPos(BlockPos blockPos) diff --git a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java index bc1d80ebbd..160f689b3d 100644 --- a/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java +++ b/src/main/java/net/minecraftforge/client/model/pipeline/VertexLighterSmoothAo.java @@ -1,10 +1,16 @@ package net.minecraftforge.client.model.pipeline; -import net.minecraft.util.MathHelper; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.util.math.MathHelper; public class VertexLighterSmoothAo extends VertexLighterFlat { + public VertexLighterSmoothAo(BlockColors colors) + { + super(colors); + } + @Override protected void updateLightmap(float[] normal, float[] lightmap, float x, float y, float z) { diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 3a3c51171b..70ab22e1b3 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -45,3 +45,4 @@ net/minecraft/stats/StatList.mergeStatBases([Lnet/minecraft/stats/StatBase;Lnet/ net/minecraft/item/ItemStack.(Lnet/minecraft/item/Item;IILnet/minecraft/nbt/NBTTagCompound;)V=|p_i1881_1_,p_i1881_2_,p_i1881_3_,capNBT net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/EnumFacing;Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/util/math/BlockPos;)Z=p_176343_0_,p_176343_1_,world,pos +net/minecraft/client/renderer/block/model/BakedQuad.([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/client/renderer/vertex/VertexFormat)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,format