Add the new rendering methods to all of our Baked models that allows for IModelData.

This commit is contained in:
alexbegt committed 2020-03-26 01:21:24 -04:00
1 parent 62f00253ba
commit 001433cc20
4 files changed
+80 -6

No files matched your search

@@ -8,6 +8,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import java.util.List;
import java.util.Random;
@@ -31,7 +33,14 @@ public class BakedCompositeModel extends BakedWrapper {
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
@Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
return this.parts.get(Optional.fromNullable(side));
}
@@ -12,6 +12,8 @@ import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraftforge.client.model.PerspectiveMapWrapper;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -60,7 +62,14 @@ public class BakedSimple implements IBakedModel {
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
@Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
return this.quads;
}
@@ -86,12 +95,20 @@ public class BakedSimple implements IBakedModel {
@Nonnull
@Override
@Deprecated
public TextureAtlasSprite getParticleTexture() {
return this.particle;
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) {
return this.particle;
}
@Nonnull
@Override
@Deprecated
public ItemCameraTransforms getItemCameraTransforms() {
return ItemCameraTransforms.DEFAULT;
}
@@ -10,7 +10,11 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraftforge.client.model.PerspectiveMapWrapper;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -28,8 +32,14 @@ public class BakedWrapper implements IBakedModel {
@Nonnull
@Override
@Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
return this.parent.getQuads(state, side, rand);
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
return this.parent.getQuads(state, side, rand, extraData);
}
@Override
@@ -54,10 +64,17 @@ public class BakedWrapper implements IBakedModel {
@Nonnull
@Override
@Deprecated
public TextureAtlasSprite getParticleTexture() {
return this.parent.getParticleTexture();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) {
return this.parent.getParticleTexture(data);
}
@Nonnull
@Override
@Deprecated
@@ -71,6 +88,12 @@ public class BakedWrapper implements IBakedModel {
return this.parent.getOverrides();
}
@Nonnull
@Override
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
return this.parent.getModelData(world, pos, state, tileData);
}
public static class Perspective extends BakedWrapper implements IBakedModel {
protected final ImmutableMap<ItemCameraTransforms.TransformType, TransformationMatrix> transforms;
@@ -1,5 +1,6 @@
package slimeknights.mantle.client.model;
import com.google.common.base.Optional;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
@@ -9,6 +10,10 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ILightReader;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.client.model.data.IModelData;
import slimeknights.mantle.client.ModelHelper;
import javax.annotation.Nonnull;
@@ -46,8 +51,15 @@ public class BlockItemModelWrapper implements IBakedModel {
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
return this.parent.getQuads(state, side, rand);
@Deprecated
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand) {
return this.getQuads(state, side, rand, EmptyModelData.INSTANCE);
}
@Nonnull
@Override
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
return this.parent.getQuads(state, side, rand, extraData);
}
@Override
@@ -72,10 +84,23 @@ public class BlockItemModelWrapper implements IBakedModel {
@Nonnull
@Override
@Deprecated
public TextureAtlasSprite getParticleTexture() {
return this.parent.getParticleTexture();
}
@Nonnull
@Override
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) {
return this.parent.getParticleTexture(data);
}
@Nonnull
@Override
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
return this.parent.getModelData(world, pos, state, tileData);
}
@Nonnull
@Override
@Deprecated