mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-21 04:32:15 +00:00
Update to 1.14.2
This commit is contained in:
1 parent
d3e8804dbf
commit
a7df63e1a1
1010 files changed
+15254
-19520
No files matched your search
@@ -21,8 +21,8 @@ package net.minecraftforge.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumType;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Type;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
|
||||
|
||||
public class Attributes
|
||||
{
|
||||
@@ -34,10 +34,10 @@ public class Attributes
|
||||
static
|
||||
{
|
||||
DEFAULT_BAKED_FORMAT = new VertexFormat();
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.POSITION, 3));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.UBYTE, EnumUsage.COLOR, 4));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.FLOAT, EnumUsage.UV, 2));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, EnumType.BYTE, EnumUsage.PADDING, 4));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.FLOAT, Usage.POSITION, 3));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.UBYTE, Usage.COLOR, 4));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.FLOAT, Usage.UV, 2));
|
||||
DEFAULT_BAKED_FORMAT.addElement(new VertexFormatElement(0, Type.BYTE, Usage.PADDING, 4));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -52,7 +52,7 @@ public class Attributes
|
||||
int j = 0;
|
||||
for(VertexFormatElement firstAttr : first.getElements())
|
||||
{
|
||||
while(j < second.getElementCount() && second.getElement(j).getUsage() == EnumUsage.PADDING)
|
||||
while(j < second.getElementCount() && second.getElement(j).getUsage() == Usage.PADDING)
|
||||
{
|
||||
padding += second.getElement(j++).getSize();
|
||||
}
|
||||
|
||||
@@ -27,13 +27,13 @@ import java.util.Random;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BakedItemModel implements IBakedModel
|
||||
@Override public ItemOverrideList getOverrides() { return overrides; }
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
if (side == null)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ public class BakedItemModel implements IBakedModel
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
for (BakedQuad quad : originalModel.quads)
|
||||
{
|
||||
if (quad.getFace() == EnumFacing.SOUTH)
|
||||
if (quad.getFace() == Direction.SOUTH)
|
||||
{
|
||||
builder.add(quad);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class BakedItemModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads (@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads (@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
if(side == null)
|
||||
{
|
||||
|
||||
@@ -24,13 +24,13 @@ import javax.vecmath.Matrix4f;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
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.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public abstract class BakedModelWrapper<T extends IBakedModel> implements IBakedModel
|
||||
@@ -43,7 +43,7 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
return originalModel.getQuads(state, side, rand);
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public abstract class BakedModelWrapper<T extends IBakedModel> implements IBaked
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion(IBlockState state)
|
||||
public boolean isAmbientOcclusion(BlockState state)
|
||||
{
|
||||
return originalModel.isAmbientOcclusion(state);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
|
||||
public class BasicState implements ISprite
|
||||
{
|
||||
private final IModelState defaultState;
|
||||
private final boolean uvLock;
|
||||
|
||||
public BasicState(IModelState defaultState, boolean uvLock)
|
||||
{
|
||||
this.defaultState = defaultState;
|
||||
this.uvLock = uvLock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getState()
|
||||
{
|
||||
return defaultState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUvLock()
|
||||
{
|
||||
return uvLock;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelBlockDefinition;
|
||||
import net.minecraft.client.renderer.model.BlockModelDefinition;
|
||||
import net.minecraft.client.renderer.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.model.Variant;
|
||||
import net.minecraft.client.renderer.model.VariantList;
|
||||
@@ -75,7 +75,7 @@ public class BlockStateLoader
|
||||
*
|
||||
* @return Model definition including variants for all known combinations.
|
||||
*/
|
||||
public static ModelBlockDefinition load(Reader reader, ResourceLocation location, final Gson vanillaGSON)
|
||||
public static BlockModelDefinition load(Reader reader, ResourceLocation location, final Gson vanillaGSON)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -106,10 +106,10 @@ public class BlockStateLoader
|
||||
variants.put(entry.getKey(), new VariantList(mcVars));
|
||||
}
|
||||
|
||||
return new ModelBlockDefinition(variants, null);
|
||||
return new BlockModelDefinition(variants, null);
|
||||
|
||||
default: //Unknown version.. try loading it as normal.
|
||||
return vanillaGSON.fromJson(reader, ModelBlockDefinition.class);
|
||||
return vanillaGSON.fromJson(reader, BlockModelDefinition.class);
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
|
||||
@@ -26,16 +26,13 @@ import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
@@ -100,18 +97,19 @@ final class FancyMissingModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
IBakedModel bigMissing = missingModel.bake(modelGetter, bakedTextureGetter, state, uvlock, format);
|
||||
IModelState smallState = new ModelStateComposition(state, smallTransformation);
|
||||
IBakedModel smallMissing = missingModel.bake(modelGetter, bakedTextureGetter, smallState, uvlock, format);
|
||||
return new BakedModel(bigMissing, smallMissing, fontCache.getUnchecked(format), message, bakedTextureGetter.apply(font2));
|
||||
IBakedModel bigMissing = missingModel.bake(modelGetter, spriteGetter, sprite, format);
|
||||
ModelStateComposition smallState = new ModelStateComposition(sprite.getState(), smallTransformation);
|
||||
IBakedModel smallMissing = missingModel.bake(modelGetter, spriteGetter, smallState, format);
|
||||
return new BakedModel(bigMissing, smallMissing, fontCache.getUnchecked(format), message, spriteGetter.apply(font2));
|
||||
}
|
||||
|
||||
static final class BakedModel implements IBakedModel
|
||||
@@ -145,7 +143,7 @@ final class FancyMissingModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
if (side == null)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ModelRotation;
|
||||
import net.minecraft.util.JsonUtils;
|
||||
import net.minecraft.util.JSONUtils;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.BlockStateLoader.Marker;
|
||||
import net.minecraftforge.client.model.BlockStateLoader.SubModel;
|
||||
@@ -76,7 +76,7 @@ public class ForgeBlockStateV1 extends Marker
|
||||
{
|
||||
JsonObject json = element.getAsJsonObject();
|
||||
ForgeBlockStateV1 ret = new ForgeBlockStateV1();
|
||||
ret.forge_marker = JsonUtils.getInt(json, "forge_marker");
|
||||
ret.forge_marker = JSONUtils.getInt(json, "forge_marker");
|
||||
|
||||
if (json.has("defaults")) // Load defaults Variant.
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public class ForgeBlockStateV1 extends Marker
|
||||
Map<String, Map<String, ForgeBlockStateV1.Variant>> condensed = Maps.newLinkedHashMap(); // map(property name -> map(property value -> variant))
|
||||
Multimap<String, ForgeBlockStateV1.Variant> specified = LinkedHashMultimap.create(); // Multimap containing all the states specified with "property=value".
|
||||
|
||||
for (Entry<String, JsonElement> e : JsonUtils.getJsonObject(json, "variants").entrySet())
|
||||
for (Entry<String, JsonElement> e : JSONUtils.getJsonObject(json, "variants").entrySet())
|
||||
{
|
||||
if (e.getValue().isJsonArray())
|
||||
{
|
||||
@@ -470,7 +470,7 @@ public class ForgeBlockStateV1 extends Marker
|
||||
if (json.get("model").isJsonNull())
|
||||
ret.model = null; // Allow overriding base model to remove it from a state.
|
||||
else
|
||||
ret.model = getBlockLocation(JsonUtils.getString(json, "model"));
|
||||
ret.model = getBlockLocation(JSONUtils.getString(json, "model"));
|
||||
ret.modelSet = true;
|
||||
}
|
||||
|
||||
@@ -487,8 +487,8 @@ public class ForgeBlockStateV1 extends Marker
|
||||
|
||||
if (json.has("x") || json.has("y"))
|
||||
{ // Load rotation values.
|
||||
int x = JsonUtils.getInt(json, "x", 0);
|
||||
int y = JsonUtils.getInt(json, "y", 0);
|
||||
int x = JSONUtils.getInt(json, "x", 0);
|
||||
int y = JSONUtils.getInt(json, "y", 0);
|
||||
ret.state = Optional.ofNullable(ModelRotation.getModelRotation(x, y));
|
||||
if (!ret.state.isPresent())
|
||||
throw new JsonParseException("Invalid BlockModelRotation x: " + x + " y: " + y);
|
||||
@@ -612,22 +612,22 @@ public class ForgeBlockStateV1 extends Marker
|
||||
|
||||
if (json.has("uvlock"))
|
||||
{ // Load uvlock.
|
||||
ret.uvLock = Optional.of(JsonUtils.getBoolean(json, "uvlock"));
|
||||
ret.uvLock = Optional.of(JSONUtils.getBoolean(json, "uvlock"));
|
||||
}
|
||||
|
||||
if (json.has("smooth_lighting"))
|
||||
{
|
||||
ret.smooth = Optional.of(JsonUtils.getBoolean(json, "smooth_lighting"));
|
||||
ret.smooth = Optional.of(JSONUtils.getBoolean(json, "smooth_lighting"));
|
||||
}
|
||||
|
||||
if (json.has("gui3d"))
|
||||
{
|
||||
ret.gui3d = Optional.of(JsonUtils.getBoolean(json, "gui3d"));
|
||||
ret.gui3d = Optional.of(JSONUtils.getBoolean(json, "gui3d"));
|
||||
}
|
||||
|
||||
if (json.has("weight"))
|
||||
{ // Load weight.
|
||||
ret.weight = Optional.of(JsonUtils.getInt(json, "weight"));
|
||||
ret.weight = Optional.of(JSONUtils.getInt(json, "weight"));
|
||||
}
|
||||
|
||||
if (json.has("submodel"))
|
||||
|
||||
@@ -28,6 +28,8 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -41,9 +43,9 @@ import net.minecraftforge.common.model.animation.IClip;
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public interface IModel<T extends IModel<T>>
|
||||
{
|
||||
{
|
||||
@Nullable
|
||||
IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, IModelState state, boolean uvlock, VertexFormat format);
|
||||
IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format);
|
||||
|
||||
/*
|
||||
* Default state this model will be baked with.
|
||||
|
||||
@@ -19,20 +19,18 @@
|
||||
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelBlock;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
import net.minecraftforge.client.model.pipeline.TRSRTransformer;
|
||||
@@ -56,8 +54,8 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
{
|
||||
public static final ItemLayerModel INSTANCE = new ItemLayerModel(ImmutableList.of());
|
||||
|
||||
private static final EnumFacing[] HORIZONTALS = {EnumFacing.UP, EnumFacing.DOWN};
|
||||
private static final EnumFacing[] VERTICALS = {EnumFacing.WEST, EnumFacing.EAST};
|
||||
private static final Direction[] HORIZONTALS = {Direction.UP, Direction.DOWN};
|
||||
private static final Direction[] VERTICALS = {Direction.WEST, Direction.EAST};
|
||||
|
||||
private final ImmutableList<ResourceLocation> textures;
|
||||
private final ItemOverrideList overrides;
|
||||
@@ -73,12 +71,12 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
this.overrides = overrides;
|
||||
}
|
||||
|
||||
public ItemLayerModel(ModelBlock model)
|
||||
public ItemLayerModel(BlockModel model)
|
||||
{
|
||||
this(getTextures(model), model.getOverrides(model, ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter()));
|
||||
}
|
||||
|
||||
private static ImmutableList<ResourceLocation> getTextures(ModelBlock model)
|
||||
private static ImmutableList<ResourceLocation> getTextures(BlockModel model)
|
||||
{
|
||||
ImmutableList.Builder<ResourceLocation> builder = ImmutableList.builder();
|
||||
for(int i = 0; model.isTexturePresent("layer" + i); i++)
|
||||
@@ -95,7 +93,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -118,18 +116,20 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
return new ItemLayerModel(builder.build(), overrides);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format) {
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
Optional<TRSRTransformation> transform = state.apply(Optional.empty());
|
||||
Optional<TRSRTransformation> transform = sprite.getState().apply(Optional.empty());
|
||||
boolean identity = !transform.isPresent() || transform.get().isIdentity();
|
||||
for(int i = 0; i < textures.size(); i++)
|
||||
{
|
||||
TextureAtlasSprite sprite = bakedTextureGetter.apply(textures.get(i));
|
||||
builder.addAll(getQuadsForSprite(i, sprite, format, transform));
|
||||
TextureAtlasSprite tas = spriteGetter.apply(textures.get(i));
|
||||
builder.addAll(getQuadsForSprite(i, tas, format, transform));
|
||||
}
|
||||
TextureAtlasSprite particle = bakedTextureGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
|
||||
ImmutableMap<TransformType, TRSRTransformation> map = PerspectiveMapWrapper.getTransforms(state);
|
||||
TextureAtlasSprite particle = spriteGetter.apply(textures.isEmpty() ? new ResourceLocation("missingno") : textures.get(0));
|
||||
ImmutableMap<TransformType, TRSRTransformation> map = PerspectiveMapWrapper.getTransforms(sprite.getState());
|
||||
return new BakedItemModel(builder.build(), particle, map, overrides, identity);
|
||||
}
|
||||
|
||||
@@ -163,19 +163,19 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
|
||||
if(ptu && !t) // left - transparent, right - opaque
|
||||
{
|
||||
faceData.set(EnumFacing.WEST, u, v);
|
||||
faceData.set(Direction.WEST, u, v);
|
||||
}
|
||||
if(!ptu && t) // left - opaque, right - transparent
|
||||
{
|
||||
faceData.set(EnumFacing.EAST, u-1, v);
|
||||
faceData.set(Direction.EAST, u-1, v);
|
||||
}
|
||||
if(ptv[u] && !t) // up - transparent, down - opaque
|
||||
{
|
||||
faceData.set(EnumFacing.UP, u, v);
|
||||
faceData.set(Direction.UP, u, v);
|
||||
}
|
||||
if(!ptv[u] && t) // up - opaque, down - transparent
|
||||
{
|
||||
faceData.set(EnumFacing.DOWN, u, v-1);
|
||||
faceData.set(Direction.DOWN, u, v-1);
|
||||
}
|
||||
|
||||
ptu = t;
|
||||
@@ -183,7 +183,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
}
|
||||
if(!ptu) // last - opaque
|
||||
{
|
||||
faceData.set(EnumFacing.EAST, uMax-1, v);
|
||||
faceData.set(Direction.EAST, uMax-1, v);
|
||||
}
|
||||
}
|
||||
// last line
|
||||
@@ -191,13 +191,13 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
{
|
||||
if(!ptv[u])
|
||||
{
|
||||
faceData.set(EnumFacing.DOWN, u, vMax-1);
|
||||
faceData.set(Direction.DOWN, u, vMax-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// horizontal quads
|
||||
for (EnumFacing facing : HORIZONTALS)
|
||||
for (Direction facing : HORIZONTALS)
|
||||
{
|
||||
for (int v = 0; v < vMax; v++)
|
||||
{
|
||||
@@ -223,7 +223,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
if (building && !face) // finish current quad
|
||||
{
|
||||
// make quad [uStart, u]
|
||||
int off = facing == EnumFacing.DOWN ? 1 : 0;
|
||||
int off = facing == Direction.DOWN ? 1 : 0;
|
||||
builder.add(buildSideQuad(format, transform, facing, tint, sprite, uStart, v+off, u-uStart));
|
||||
building = false;
|
||||
}
|
||||
@@ -237,14 +237,14 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
if (building) // build remaining quad
|
||||
{
|
||||
// make quad [uStart, uEnd]
|
||||
int off = facing == EnumFacing.DOWN ? 1 : 0;
|
||||
int off = facing == Direction.DOWN ? 1 : 0;
|
||||
builder.add(buildSideQuad(format, transform, facing, tint, sprite, uStart, v+off, uEnd-uStart));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// vertical quads
|
||||
for (EnumFacing facing : VERTICALS)
|
||||
for (Direction facing : VERTICALS)
|
||||
{
|
||||
for (int u = 0; u < uMax; u++)
|
||||
{
|
||||
@@ -270,7 +270,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
if (building && !face) // finish current quad
|
||||
{
|
||||
// make quad [vStart, v]
|
||||
int off = facing == EnumFacing.EAST ? 1 : 0;
|
||||
int off = facing == Direction.EAST ? 1 : 0;
|
||||
builder.add(buildSideQuad(format, transform, facing, tint, sprite, u+off, vStart, v-vStart));
|
||||
building = false;
|
||||
}
|
||||
@@ -284,21 +284,21 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
if (building) // build remaining quad
|
||||
{
|
||||
// make quad [vStart, vEnd]
|
||||
int off = facing == EnumFacing.EAST ? 1 : 0;
|
||||
int off = facing == Direction.EAST ? 1 : 0;
|
||||
builder.add(buildSideQuad(format, transform, facing, tint, sprite, u+off, vStart, vEnd-vStart));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// front
|
||||
builder.add(buildQuad(format, transform, EnumFacing.NORTH, sprite, tint,
|
||||
builder.add(buildQuad(format, transform, Direction.NORTH, sprite, tint,
|
||||
0, 0, 7.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
|
||||
0, 1, 7.5f / 16f, sprite.getMinU(), sprite.getMinV(),
|
||||
1, 1, 7.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
|
||||
1, 0, 7.5f / 16f, sprite.getMaxU(), sprite.getMaxV()
|
||||
));
|
||||
// back
|
||||
builder.add(buildQuad(format, transform, EnumFacing.SOUTH, sprite, tint,
|
||||
builder.add(buildQuad(format, transform, Direction.SOUTH, sprite, tint,
|
||||
0, 0, 8.5f / 16f, sprite.getMinU(), sprite.getMaxV(),
|
||||
1, 0, 8.5f / 16f, sprite.getMaxU(), sprite.getMaxV(),
|
||||
1, 1, 8.5f / 16f, sprite.getMaxU(), sprite.getMinV(),
|
||||
@@ -310,7 +310,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
|
||||
private static class FaceData
|
||||
{
|
||||
private final EnumMap<EnumFacing, BitSet> data = new EnumMap<>(EnumFacing.class);
|
||||
private final EnumMap<Direction, BitSet> data = new EnumMap<>(Direction.class);
|
||||
|
||||
private final int vMax;
|
||||
|
||||
@@ -318,18 +318,18 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
{
|
||||
this.vMax = vMax;
|
||||
|
||||
data.put(EnumFacing.WEST, new BitSet(uMax * vMax));
|
||||
data.put(EnumFacing.EAST, new BitSet(uMax * vMax));
|
||||
data.put(EnumFacing.UP, new BitSet(uMax * vMax));
|
||||
data.put(EnumFacing.DOWN, new BitSet(uMax * vMax));
|
||||
data.put(Direction.WEST, new BitSet(uMax * vMax));
|
||||
data.put(Direction.EAST, new BitSet(uMax * vMax));
|
||||
data.put(Direction.UP, new BitSet(uMax * vMax));
|
||||
data.put(Direction.DOWN, new BitSet(uMax * vMax));
|
||||
}
|
||||
|
||||
public void set(EnumFacing facing, int u, int v)
|
||||
public void set(Direction facing, int u, int v)
|
||||
{
|
||||
data.get(facing).set(getIndex(u, v));
|
||||
}
|
||||
|
||||
public boolean get(EnumFacing facing, int u, int v)
|
||||
public boolean get(Direction facing, int u, int v)
|
||||
{
|
||||
return data.get(facing).get(getIndex(u, v));
|
||||
}
|
||||
@@ -340,7 +340,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
}
|
||||
}
|
||||
|
||||
private static BakedQuad buildSideQuad(VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, int tint, TextureAtlasSprite sprite, int u, int v, int size)
|
||||
private static BakedQuad buildSideQuad(VertexFormat format, Optional<TRSRTransformation> transform, Direction side, int tint, TextureAtlasSprite sprite, int u, int v, int size)
|
||||
{
|
||||
final float eps = 1e-2f;
|
||||
|
||||
@@ -387,14 +387,14 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
);
|
||||
}
|
||||
|
||||
private static EnumFacing remap(EnumFacing side)
|
||||
private static Direction remap(Direction side)
|
||||
{
|
||||
// getOpposite is related to the swapping of V direction
|
||||
return side.getAxis() == EnumFacing.Axis.Y ? side.getOpposite() : side;
|
||||
return side.getAxis() == Direction.Axis.Y ? side.getOpposite() : side;
|
||||
}
|
||||
|
||||
private static BakedQuad buildQuad(
|
||||
VertexFormat format, Optional<TRSRTransformation> transform, EnumFacing side, TextureAtlasSprite sprite, int tint,
|
||||
VertexFormat format, Optional<TRSRTransformation> transform, Direction side, TextureAtlasSprite sprite, int tint,
|
||||
float x0, float y0, float z0, float u0, float v0,
|
||||
float x1, float y1, float z1, float u1, float v1,
|
||||
float x2, float y2, float z2, float u2, float v2,
|
||||
@@ -417,7 +417,7 @@ public final class ItemLayerModel implements IUnbakedModel
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static void putVertex(IVertexConsumer consumer, VertexFormat format, EnumFacing side, float x, float y, float z, float u, float v)
|
||||
private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side, float x, float y, float z, float u, float v)
|
||||
{
|
||||
for(int e = 0; e < format.getElementCount(); e++)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
import net.minecraftforge.client.model.pipeline.TRSRTransformer;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
@@ -52,7 +52,7 @@ public final class ItemTextureQuadConverter
|
||||
* @param sprite The texture whose UVs shall be used
|
||||
* @return The generated quads.
|
||||
*/
|
||||
public static List<UnpackedBakedQuad> convertTexture(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color, int tint)
|
||||
public static List<UnpackedBakedQuad> convertTexture(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
|
||||
{
|
||||
List<UnpackedBakedQuad> horizontal = convertTextureHorizontal(format, transform, template, sprite, z, facing, color, tint);
|
||||
List<UnpackedBakedQuad> vertical = convertTextureVertical(format, transform, template, sprite, z, facing, color, tint);
|
||||
@@ -64,7 +64,7 @@ public final class ItemTextureQuadConverter
|
||||
* Scans a texture and converts it into a list of horizontal strips stacked on top of each other.
|
||||
* The height of the strips is as big as possible.
|
||||
*/
|
||||
public static List<UnpackedBakedQuad> convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color, int tint)
|
||||
public static List<UnpackedBakedQuad> convertTextureHorizontal(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
|
||||
{
|
||||
int w = template.getWidth();
|
||||
int h = template.getHeight();
|
||||
@@ -135,7 +135,7 @@ public final class ItemTextureQuadConverter
|
||||
* Scans a texture and converts it into a list of vertical strips stacked next to each other from left to right.
|
||||
* The width of the strips is as big as possible.
|
||||
*/
|
||||
public static List<UnpackedBakedQuad> convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, EnumFacing facing, int color, int tint)
|
||||
public static List<UnpackedBakedQuad> convertTextureVertical(VertexFormat format, TRSRTransformation transform, TextureAtlasSprite template, TextureAtlasSprite sprite, float z, Direction facing, int color, int tint)
|
||||
{
|
||||
int w = template.getWidth();
|
||||
int h = template.getHeight();
|
||||
@@ -211,7 +211,7 @@ public final class ItemTextureQuadConverter
|
||||
* Generates a Front/Back quad for an itemmodel. Therefore only supports facing NORTH and SOUTH.
|
||||
* Coordinates are [0,16] to match the usual coordinates used in TextureAtlasSprites
|
||||
*/
|
||||
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, EnumFacing facing, int color, int tint)
|
||||
public static UnpackedBakedQuad genQuad(VertexFormat format, TRSRTransformation transform, float x1, float y1, float x2, float y2, float z, TextureAtlasSprite sprite, Direction facing, int color, int tint)
|
||||
{
|
||||
float u1 = sprite.getInterpolatedU(x1);
|
||||
float v1 = sprite.getInterpolatedV(y1);
|
||||
@@ -230,7 +230,7 @@ public final class ItemTextureQuadConverter
|
||||
return putQuad(format, transform, facing, sprite, color, tint, x1, y1, x2, y2, z, u1, v1, u2, v2);
|
||||
}
|
||||
|
||||
private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, EnumFacing side, TextureAtlasSprite sprite, int color, int tint,
|
||||
private static UnpackedBakedQuad putQuad(VertexFormat format, TRSRTransformation transform, Direction side, TextureAtlasSprite sprite, int color, int tint,
|
||||
float x1, float y1, float x2, float y2, float z,
|
||||
float u1, float v1, float u2, float v2)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ public final class ItemTextureQuadConverter
|
||||
boolean hasTransform = !transform.isIdentity();
|
||||
IVertexConsumer consumer = hasTransform ? new TRSRTransformer(builder, transform) : builder;
|
||||
|
||||
if (side == EnumFacing.SOUTH)
|
||||
if (side == Direction.SOUTH)
|
||||
{
|
||||
putVertex(consumer, format, side, x1, y1, z, u1, v2, color);
|
||||
putVertex(consumer, format, side, x2, y1, z, u2, v2, color);
|
||||
@@ -261,7 +261,7 @@ public final class ItemTextureQuadConverter
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private static void putVertex(IVertexConsumer consumer, VertexFormat format, EnumFacing side,
|
||||
private static void putVertex(IVertexConsumer consumer, VertexFormat format, Direction side,
|
||||
float x, float y, float z, float u, float v, int color)
|
||||
{
|
||||
for (int e = 0; e < format.getElementCount(); e++)
|
||||
|
||||
@@ -28,22 +28,19 @@ import javax.annotation.Nullable;
|
||||
import javax.vecmath.Quat4f;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.PngSizeInfo;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.data.AnimationMetadataSection;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
@@ -122,21 +119,23 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
|
||||
IModelState state = sprite.getState();
|
||||
ImmutableMap<TransformType, TRSRTransformation> transformMap = PerspectiveMapWrapper.getTransforms(state);
|
||||
|
||||
// if the fluid is lighter than air, will manipulate the initial state to be rotated 180° to turn it upside down
|
||||
if (flipGas && fluid != null && fluid.isLighterThanAir())
|
||||
{
|
||||
state = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null)));
|
||||
sprite = new ModelStateComposition(state, TRSRTransformation.blockCenterToCorner(new TRSRTransformation(null, new Quat4f(0, 0, 1, 0), null, null)));
|
||||
state = sprite.getState();
|
||||
}
|
||||
|
||||
TRSRTransformation transform = state.apply(Optional.empty()).orElse(TRSRTransformation.identity());
|
||||
@@ -145,32 +144,32 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
|
||||
if(fluid != null) {
|
||||
fluidSprite = bakedTextureGetter.apply(fluid.getStill());
|
||||
fluidSprite = spriteGetter.apply(fluid.getStill());
|
||||
}
|
||||
|
||||
Random random = new Random();
|
||||
if (baseLocation != null)
|
||||
{
|
||||
// build base (insidest)
|
||||
IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(modelGetter, bakedTextureGetter, state, uvlock, format);
|
||||
IBakedModel model = (new ItemLayerModel(ImmutableList.of(baseLocation))).bake(modelGetter, spriteGetter, sprite, format);
|
||||
random.setSeed(42);
|
||||
builder.addAll(model.getQuads(null, null, random));
|
||||
particleSprite = model.getParticleTexture();
|
||||
}
|
||||
if (liquidLocation != null && fluidSprite != null)
|
||||
{
|
||||
TextureAtlasSprite liquid = bakedTextureGetter.apply(liquidLocation);
|
||||
TextureAtlasSprite liquid = spriteGetter.apply(liquidLocation);
|
||||
// build liquid layer (inside)
|
||||
builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, NORTH_Z_FLUID, EnumFacing.NORTH, tint ? fluid.getColor() : 0xFFFFFFFF, 1));
|
||||
builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, SOUTH_Z_FLUID, EnumFacing.SOUTH, tint ? fluid.getColor() : 0xFFFFFFFF, 1));
|
||||
builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, NORTH_Z_FLUID, Direction.NORTH, tint ? fluid.getColor() : 0xFFFFFFFF, 1));
|
||||
builder.addAll(ItemTextureQuadConverter.convertTexture(format, transform, liquid, fluidSprite, SOUTH_Z_FLUID, Direction.SOUTH, tint ? fluid.getColor() : 0xFFFFFFFF, 1));
|
||||
particleSprite = fluidSprite;
|
||||
}
|
||||
if (coverLocation != null)
|
||||
{
|
||||
// cover (the actual item around the other two)
|
||||
TextureAtlasSprite cover = bakedTextureGetter.apply(coverLocation);
|
||||
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, NORTH_Z_COVER, cover, EnumFacing.NORTH, 0xFFFFFFFF, 2));
|
||||
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, SOUTH_Z_COVER, cover, EnumFacing.SOUTH, 0xFFFFFFFF, 2));
|
||||
TextureAtlasSprite cover = spriteGetter.apply(coverLocation);
|
||||
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, NORTH_Z_COVER, cover, Direction.NORTH, 0xFFFFFFFF, 2));
|
||||
builder.add(ItemTextureQuadConverter.genQuad(format, transform, 0, 0, 16, 16, SOUTH_Z_COVER, cover, Direction.SOUTH, 0xFFFFFFFF, 2));
|
||||
if (particleSprite == null)
|
||||
{
|
||||
particleSprite = cover;
|
||||
@@ -267,7 +266,7 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
{
|
||||
try
|
||||
{
|
||||
return new PngSizeInfo(resource);
|
||||
return new PngSizeInfo(resource.toString(), resource.getInputStream());
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@@ -297,7 +296,7 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
// no need to clear cache since we create a new model instance
|
||||
}
|
||||
|
||||
public void register(TextureMap map)
|
||||
public void register(AtlasTexture map)
|
||||
{
|
||||
// only create these textures if they are not added by a resource pack
|
||||
|
||||
@@ -431,7 +430,7 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
private BakedDynBucketOverrideHandler() {}
|
||||
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
|
||||
{
|
||||
return FluidUtil.getFluidContained(stack)
|
||||
.map(fluidStack -> {
|
||||
@@ -446,7 +445,7 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
Function<ResourceLocation, TextureAtlasSprite> textureGetter;
|
||||
textureGetter = location -> Minecraft.getInstance().getTextureMap().getAtlasSprite(location.toString());
|
||||
|
||||
IBakedModel bakedModel = parent.bake(ModelLoader.defaultModelGetter(), textureGetter, new SimpleModelState(model.transforms), false, model.format);
|
||||
IBakedModel bakedModel = parent.bake(ModelLoader.defaultModelGetter(), textureGetter, new SimpleModelState(model.transforms), model.format);
|
||||
model.cache.put(name, bakedModel);
|
||||
return bakedModel;
|
||||
}
|
||||
|
||||
@@ -31,16 +31,14 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
@@ -87,21 +85,22 @@ public final class ModelFluid implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations() {
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
return new CachingBakedFluid(
|
||||
state.apply(Optional.empty()),
|
||||
PerspectiveMapWrapper.getTransforms(state),
|
||||
sprite.getState().apply(Optional.empty()),
|
||||
PerspectiveMapWrapper.getTransforms(sprite.getState()),
|
||||
format,
|
||||
fluid.getColor(),
|
||||
bakedTextureGetter.apply(fluid.getStill()),
|
||||
bakedTextureGetter.apply(fluid.getFlowing()),
|
||||
Optional.ofNullable(fluid.getOverlay()).map(bakedTextureGetter),
|
||||
spriteGetter.apply(fluid.getStill()),
|
||||
spriteGetter.apply(fluid.getFlowing()),
|
||||
Optional.ofNullable(fluid.getOverlay()).map(spriteGetter),
|
||||
fluid.isLighterThanAir(),
|
||||
null
|
||||
);
|
||||
@@ -229,7 +228,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand, IModelData modelData)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData)
|
||||
{
|
||||
if (side != null)
|
||||
{
|
||||
@@ -275,7 +274,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
protected final TextureAtlasSprite still, flowing;
|
||||
protected final Optional<TextureAtlasSprite> overlay;
|
||||
protected final boolean gas;
|
||||
protected final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faceQuads;
|
||||
protected final ImmutableMap<Direction, ImmutableList<BakedQuad>> faceQuads;
|
||||
|
||||
public BakedFluid(Optional<TRSRTransformation> transformation, ImmutableMap<TransformType, TRSRTransformation> transforms, VertexFormat format, int color, TextureAtlasSprite still, TextureAtlasSprite flowing, Optional<TextureAtlasSprite> overlay, boolean gas, boolean statePresent, int[] cornerRound, int flowRound, boolean[] sideOverlays)
|
||||
{
|
||||
@@ -290,10 +289,10 @@ public final class ModelFluid implements IUnbakedModel
|
||||
this.faceQuads = buildQuads(statePresent, cornerRound, flowRound, sideOverlays);
|
||||
}
|
||||
|
||||
private ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> buildQuads(boolean statePresent, int[] cornerRound, int flowRound, boolean[] sideOverlays)
|
||||
private ImmutableMap<Direction, ImmutableList<BakedQuad>> buildQuads(boolean statePresent, int[] cornerRound, int flowRound, boolean[] sideOverlays)
|
||||
{
|
||||
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faceQuads = new EnumMap<>(EnumFacing.class);
|
||||
for (EnumFacing side : EnumFacing.values())
|
||||
EnumMap<Direction, ImmutableList<BakedQuad>> faceQuads = new EnumMap<>(Direction.class);
|
||||
for (Direction side : Direction.values())
|
||||
{
|
||||
faceQuads.put(side, ImmutableList.of());
|
||||
}
|
||||
@@ -321,7 +320,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
float s = MathHelper.sin(flow) * scale;
|
||||
|
||||
// top
|
||||
EnumFacing top = gas ? EnumFacing.DOWN : EnumFacing.UP;
|
||||
Direction top = gas ? Direction.DOWN : Direction.UP;
|
||||
|
||||
// base uv offset for flow direction
|
||||
VertexParameter uv = i -> c * (x[i] * 2 - 1) + s * (z[i] * 2 - 1);
|
||||
@@ -342,7 +341,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
}
|
||||
|
||||
// bottom
|
||||
EnumFacing bottom = top.getOpposite();
|
||||
Direction bottom = top.getOpposite();
|
||||
faceQuads.put(bottom, ImmutableList.of(
|
||||
buildQuad(bottom, still, gas, false,
|
||||
i -> z[i],
|
||||
@@ -356,7 +355,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
// sides
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
EnumFacing side = EnumFacing.byHorizontalIndex((5 - i) % 4); // [W, S, E, N]
|
||||
Direction side = Direction.byHorizontalIndex((5 - i) % 4); // [W, S, E, N]
|
||||
boolean useOverlay = overlay.isPresent() && sideOverlays[side.getHorizontalIndex()];
|
||||
int si = i; // local var for lambda capture
|
||||
|
||||
@@ -377,8 +376,8 @@ public final class ModelFluid implements IUnbakedModel
|
||||
else
|
||||
{
|
||||
// inventory
|
||||
faceQuads.put(EnumFacing.SOUTH, ImmutableList.of(
|
||||
buildQuad(EnumFacing.UP, still, false, false,
|
||||
faceQuads.put(Direction.SOUTH, ImmutableList.of(
|
||||
buildQuad(Direction.UP, still, false, false,
|
||||
i -> z[i],
|
||||
i -> x[i],
|
||||
i -> 0,
|
||||
@@ -397,7 +396,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
float get(int index);
|
||||
}
|
||||
|
||||
private BakedQuad buildQuad(EnumFacing side, TextureAtlasSprite texture, boolean flip, boolean offset, VertexParameter x, VertexParameter y, VertexParameter z, VertexParameter u, VertexParameter v)
|
||||
private BakedQuad buildQuad(Direction side, TextureAtlasSprite texture, boolean flip, boolean offset, VertexParameter x, VertexParameter y, VertexParameter z, VertexParameter u, VertexParameter v)
|
||||
{
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
|
||||
@@ -422,7 +421,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private void putVertex(IVertexConsumer consumer, EnumFacing side, boolean offset, float x, float y, float z, float u, float v)
|
||||
private void putVertex(IVertexConsumer consumer, Direction side, boolean offset, float x, float y, float z, float u, float v)
|
||||
{
|
||||
for(int e = 0; e < format.getElementCount(); e++)
|
||||
{
|
||||
@@ -486,7 +485,7 @@ public final class ModelFluid implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
return side == null ? ImmutableList.of() : faceQuads.get(side);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockModelShapes;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
@@ -52,9 +52,8 @@ import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemModelGenerator;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.model.ModelBlock;
|
||||
import net.minecraft.client.renderer.model.ModelBlockDefinition;
|
||||
import net.minecraft.client.renderer.model.ModelBlockDefinition.ContainerHolder;
|
||||
import net.minecraft.client.renderer.model.BlockModel;
|
||||
import net.minecraft.client.renderer.model.BlockModelDefinition;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.model.MultipartBakedModel;
|
||||
@@ -64,17 +63,18 @@ import net.minecraft.client.renderer.model.VariantList;
|
||||
import net.minecraft.client.renderer.model.WeightedBakedModel;
|
||||
import net.minecraft.client.renderer.model.multipart.Multipart;
|
||||
import net.minecraft.client.renderer.model.multipart.Selector;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.MissingTextureSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraftforge.client.model.animation.AnimationItemOverrideList;
|
||||
import net.minecraftforge.client.model.animation.ModelBlockAnimation;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
@@ -123,8 +123,8 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private final Map<ModelResourceLocation, IUnbakedModel> stateModels = Maps.newHashMap();
|
||||
private final Map<ModelResourceLocation, ModelBlockDefinition> multipartDefinitions = Maps.newHashMap();
|
||||
private final Map<ModelBlockDefinition, IUnbakedModel> multipartModels = Maps.newHashMap();
|
||||
private final Map<ModelResourceLocation, BlockModelDefinition> multipartDefinitions = Maps.newHashMap();
|
||||
private final Map<BlockModelDefinition, IUnbakedModel> multipartModels = Maps.newHashMap();
|
||||
// TODO: nothing adds to missingVariants, remove it?
|
||||
private final Set<ModelResourceLocation> missingVariants = Sets.newHashSet();
|
||||
private final Map<ResourceLocation, Exception> loadingExceptions = Maps.newHashMap();
|
||||
@@ -136,9 +136,9 @@ public final class ModelLoader extends ModelBakery
|
||||
return isLoading;
|
||||
}
|
||||
|
||||
public ModelLoader(IResourceManager manager, TextureMap map)
|
||||
public ModelLoader(IResourceManager manager, AtlasTexture map, IProfiler profiler)
|
||||
{
|
||||
super(manager, map);
|
||||
super(manager, map, profiler);
|
||||
VanillaLoader.INSTANCE.setLoader(this);
|
||||
VariantLoader.INSTANCE.setLoader(this);
|
||||
ModelLoaderRegistry.clearModelCache(manager);
|
||||
@@ -167,7 +167,7 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
textureMap.stitch(resourceManager, textures);
|
||||
|
||||
field_209607_C.forEach((p_209602_2_, p_209602_3_) -> {
|
||||
STATE_CONTAINER_OVERRIDES.forEach((p_209602_2_, p_209602_3_) -> {
|
||||
p_209602_3_.getValidStates().forEach((p_209601_3_) -> {
|
||||
this.getUnbakedModel(map, BlockModelShapes.getModelLocation(p_209602_2_, p_209601_3_));
|
||||
});
|
||||
@@ -354,11 +354,11 @@ public final class ModelLoader extends ModelBakery
|
||||
private final FaceBakery faceBakery = new FaceBakery();
|
||||
|
||||
private final ResourceLocation location;
|
||||
private final ModelBlock model;
|
||||
private final BlockModel model;
|
||||
private final boolean uvlock;
|
||||
private final ModelBlockAnimation animation;
|
||||
|
||||
public VanillaModelWrapper(ResourceLocation location, ModelBlock model, boolean uvlock, ModelBlockAnimation animation)
|
||||
public VanillaModelWrapper(ResourceLocation location, BlockModel model, boolean uvlock, ModelBlockAnimation animation)
|
||||
{
|
||||
this.location = location;
|
||||
this.model = model;
|
||||
@@ -367,10 +367,10 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
Set<ResourceLocation> set = Sets.newHashSet();
|
||||
for(ResourceLocation dep : model.getOverrideLocations())
|
||||
for(ResourceLocation dep : model.getDependencies())
|
||||
{
|
||||
if(!location.equals(dep))
|
||||
{
|
||||
@@ -434,10 +434,11 @@ public final class ModelLoader extends ModelBakery
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
return VanillaLoader.INSTANCE.modelCache.getUnchecked(new BakedModelCacheKey(this, modelGetter, bakedTextureGetter, state, uvlock, format));
|
||||
return VanillaLoader.INSTANCE.modelCache.getUnchecked(new BakedModelCacheKey(this, modelGetter, spriteGetter, sprite.getState(), uvlock, format));
|
||||
}
|
||||
|
||||
public IBakedModel bakeImpl(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
@@ -446,8 +447,8 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
throw new IllegalArgumentException("can't bake vanilla models to the format that doesn't fit into the default one: " + format);
|
||||
}
|
||||
ModelBlock model = this.model;
|
||||
if(model == null) return getMissingModel().bake(modelGetter, bakedTextureGetter, getMissingModel().getDefaultState(), uvlock, format);
|
||||
BlockModel model = this.model;
|
||||
if(model == null) return getMissingModel().bake(modelGetter, bakedTextureGetter, new BasicState(getMissingModel().getDefaultState(), uvlock), format);
|
||||
|
||||
List<TRSRTransformation> newTransforms = Lists.newArrayList();
|
||||
for(int i = 0; i < model.getElements().size(); i++)
|
||||
@@ -464,13 +465,14 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
if(model == ModelBakery.MODEL_GENERATED)
|
||||
{
|
||||
return new ItemLayerModel(model).bake(modelGetter, bakedTextureGetter, perState, uvlock, format);
|
||||
return new ItemLayerModel(model).bake(modelGetter, bakedTextureGetter, new BasicState(perState, uvlock), format);
|
||||
}
|
||||
if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.getOverrides(model, modelGetter, bakedTextureGetter));
|
||||
TextureAtlasSprite textureatlassprite = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
|
||||
if(model == ModelBakery.MODEL_ENTITY) return new BuiltInModel(transforms, model.getOverrides(model, modelGetter, bakedTextureGetter), textureatlassprite);
|
||||
return bakeNormal(model, perState, state, newTransforms, format, modelGetter, bakedTextureGetter, uvlock);
|
||||
}
|
||||
|
||||
private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final IModelState modelState, List<TRSRTransformation> newTransforms, final VertexFormat format, final Function<ResourceLocation, IUnbakedModel> modelGetter, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
|
||||
private IBakedModel bakeNormal(BlockModel model, IModelState perState, final IModelState modelState, List<TRSRTransformation> newTransforms, final VertexFormat format, final Function<ResourceLocation, IUnbakedModel> modelGetter, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
|
||||
{
|
||||
final TRSRTransformation baseState = modelState.apply(Optional.empty()).orElse(TRSRTransformation.identity());
|
||||
TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
|
||||
@@ -487,20 +489,20 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
transformation = transformation.compose(newTransforms.get(i));
|
||||
BlockPartRotation rot = part.partRotation;
|
||||
if(rot == null) rot = new BlockPartRotation(new Vector3f(), EnumFacing.Axis.Y, 0, false);
|
||||
if(rot == null) rot = new BlockPartRotation(new Vector3f(), Direction.Axis.Y, 0, false);
|
||||
part = new BlockPart(part.positionFrom, part.positionTo, part.mapFaces, rot, part.shade);
|
||||
}
|
||||
for(Map.Entry<EnumFacing, BlockPartFace> e : part.mapFaces.entrySet())
|
||||
for(Map.Entry<Direction, BlockPartFace> e : part.mapFaces.entrySet())
|
||||
{
|
||||
TextureAtlasSprite textureatlassprite1 = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName(e.getValue().texture)));
|
||||
|
||||
if (e.getValue().cullFace == null || !TRSRTransformation.isInteger(transformation.getMatrixVec()))
|
||||
{
|
||||
builder.addGeneralQuad(ModelBlock.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked));
|
||||
builder.addGeneralQuad(BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked)));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.addFaceQuad(baseState.rotate(e.getValue().cullFace), ModelBlock.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), transformation, uvLocked));
|
||||
builder.addFaceQuad(baseState.rotate(e.getValue().cullFace), BlockModel.makeBakedQuad(part, e.getValue(), textureatlassprite1, e.getKey(), new BasicState(transformation, uvLocked)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -510,12 +512,12 @@ public final class ModelLoader extends ModelBakery
|
||||
private final ItemOverrideList overrides = new AnimationItemOverrideList(VanillaModelWrapper.this, modelState, format, bakedTextureGetter, super.getOverrides());
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand, IModelData modelData)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData modelData)
|
||||
{
|
||||
IModelState newState = modelData.getData(Properties.AnimationProperty);
|
||||
if(newState != null)
|
||||
{
|
||||
return VanillaModelWrapper.this.bake(modelGetter, bakedTextureGetter, new ModelStateComposition(modelState, newState), uvlock, format).getQuads(state, side, rand, modelData);
|
||||
return VanillaModelWrapper.this.bake(modelGetter, bakedTextureGetter, new ModelStateComposition(modelState, newState, uvlock), format).getQuads(state, side, rand, modelData);
|
||||
}
|
||||
return super.getQuads(state, side, rand);
|
||||
}
|
||||
@@ -540,7 +542,7 @@ public final class ModelLoader extends ModelBakery
|
||||
elements.add(new BlockPart(part.positionFrom, part.positionTo, Maps.newHashMap(part.mapFaces), part.partRotation, part.shade));
|
||||
}
|
||||
|
||||
ModelBlock newModel = new ModelBlock(this.model.getParentLocation(), elements,
|
||||
BlockModel newModel = new BlockModel(this.model.getParentLocation(), elements,
|
||||
Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT
|
||||
model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.name = this.model.name;
|
||||
@@ -600,7 +602,7 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
return this;
|
||||
}
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
@@ -613,7 +615,7 @@ public final class ModelLoader extends ModelBakery
|
||||
{
|
||||
return this;
|
||||
}
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
BlockModel newModel = new BlockModel(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.getAllTransforms(), Lists.newArrayList(model.getOverrides()));
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
@@ -657,7 +659,7 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
// FIXME: is this the place? messes up dependency and texture resolution
|
||||
model = v.process(model);
|
||||
for(ResourceLocation location : model.getOverrideLocations())
|
||||
for(ResourceLocation location : model.getDependencies())
|
||||
{
|
||||
ModelLoaderRegistry.getModelOrMissing(location);
|
||||
}
|
||||
@@ -668,7 +670,7 @@ public final class ModelLoader extends ModelBakery
|
||||
|
||||
IModelState modelDefaultState = model.getDefaultState();
|
||||
Preconditions.checkNotNull(modelDefaultState, "Model %s returned null as default state", loc);
|
||||
builder.add(Pair.of(model, new ModelStateComposition(v.getState(), modelDefaultState)));
|
||||
builder.add(Pair.of(model, new ModelStateComposition(v.getState(), modelDefaultState, v.isUvLock())));
|
||||
}
|
||||
|
||||
if (models.size() == 0) //If all variants are missing, add one with the missing model and default rotation.
|
||||
@@ -692,7 +694,7 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return ImmutableList.copyOf(locations);
|
||||
}
|
||||
@@ -703,8 +705,9 @@ public final class ModelLoader extends ModelBakery
|
||||
return ImmutableSet.copyOf(textures);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT))
|
||||
{
|
||||
@@ -713,13 +716,13 @@ public final class ModelLoader extends ModelBakery
|
||||
if(variants.size() == 1)
|
||||
{
|
||||
IUnbakedModel model = models.get(0);
|
||||
return model.bake(modelGetter, bakedTextureGetter, MultiModelState.getPartState(state, model, 0), uvlock, format);
|
||||
return model.bake(modelGetter, spriteGetter, new BasicState(MultiModelState.getPartState(sprite.getState(), model, 0), sprite.isUvLock()), format);
|
||||
}
|
||||
WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder();
|
||||
for(int i = 0; i < variants.size(); i++)
|
||||
{
|
||||
IUnbakedModel model = models.get(i);
|
||||
builder.add(model.bake(modelGetter, bakedTextureGetter, MultiModelState.getPartState(state, model, i), uvlock, format), variants.get(i).getWeight());
|
||||
builder.add(model.bake(modelGetter, spriteGetter, new BasicState(MultiModelState.getPartState(sprite.getState(), model, i), sprite.isUvLock()), format), variants.get(i).getWeight());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
@@ -859,7 +862,7 @@ public final class ModelLoader extends ModelBakery
|
||||
}
|
||||
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + modelPath + ".json");
|
||||
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(loader.resourceManager, armatureLocation);
|
||||
ModelBlock model = loader.loadModel(modelLocation);
|
||||
BlockModel model = loader.loadModel(modelLocation);
|
||||
IUnbakedModel iModel = loader.new VanillaModelWrapper(modelLocation, model, false, animation);
|
||||
if(loader.missingModel == null && modelLocation.equals(MODEL_MISSING))
|
||||
{
|
||||
@@ -878,7 +881,7 @@ public final class ModelLoader extends ModelBakery
|
||||
// Temporary to compile things
|
||||
public static final class White {
|
||||
public static final ResourceLocation LOCATION = new ResourceLocation("white");
|
||||
public static final TextureAtlasSprite INSTANCE = MissingTextureSprite.getSprite();
|
||||
public static final TextureAtlasSprite INSTANCE = MissingTextureSprite.func_217790_a();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine;
|
||||
public class ModelLoaderRegistry
|
||||
{
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
|
||||
private static final Set<ICustomModelLoader> loaders = Sets.newHashSet();
|
||||
private static final Map<ResourceLocation, IUnbakedModel> cache = Maps.newHashMap();
|
||||
private static final Deque<ResourceLocation> loadingModels = Queues.newArrayDeque();
|
||||
@@ -79,7 +79,7 @@ public class ModelLoaderRegistry
|
||||
public static void registerLoader(ICustomModelLoader loader)
|
||||
{
|
||||
loaders.add(loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).addReloadListener(loader);
|
||||
((IReloadableResourceManager) Minecraft.getInstance().getResourceManager()).func_219534_a(loader);
|
||||
}
|
||||
|
||||
public static boolean loaded(ResourceLocation location)
|
||||
@@ -185,7 +185,7 @@ public class ModelLoaderRegistry
|
||||
}
|
||||
}
|
||||
cache.put(location, model);
|
||||
for (ResourceLocation dep : model.getOverrideLocations())
|
||||
for (ResourceLocation dep : model.getDependencies())
|
||||
{
|
||||
getModelOrMissing(dep);
|
||||
}
|
||||
|
||||
@@ -20,21 +20,41 @@
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraftforge.common.model.IModelPart;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class ModelStateComposition implements IModelState
|
||||
public class ModelStateComposition implements IModelState, ISprite
|
||||
{
|
||||
private final IModelState first;
|
||||
private final IModelState second;
|
||||
private final boolean uvLock;
|
||||
|
||||
public ModelStateComposition(IModelState first, IModelState second)
|
||||
{
|
||||
this(first, second, false);
|
||||
}
|
||||
|
||||
public ModelStateComposition(IModelState first, IModelState second, boolean uvLock)
|
||||
{
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.uvLock = uvLock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getState()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUvLock()
|
||||
{
|
||||
return uvLock;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -26,18 +26,15 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
@@ -71,7 +68,7 @@ public final class MultiLayerModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return ImmutableList.copyOf(models.values());
|
||||
}
|
||||
@@ -82,25 +79,26 @@ public final class MultiLayerModel implements IUnbakedModel
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private static ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> buildModels(ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models, IModelState state, boolean uvlock, VertexFormat format, Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
private static ImmutableMap<Optional<BlockRenderLayer>, IBakedModel> buildModels(ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models, ISprite sprite, VertexFormat format, Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter)
|
||||
{
|
||||
ImmutableMap.Builder<Optional<BlockRenderLayer>, IBakedModel> builder = ImmutableMap.builder();
|
||||
for(Optional<BlockRenderLayer> key : models.keySet())
|
||||
{
|
||||
IUnbakedModel model = ModelLoaderRegistry.getModelOrLogError(models.get(key), "Couldn't load MultiLayerModel dependency: " + models.get(key));
|
||||
builder.put(key, model.bake(modelGetter, bakedTextureGetter, new ModelStateComposition(state, model.getDefaultState()), uvlock, format));
|
||||
builder.put(key, model.bake(modelGetter, spriteGetter, new ModelStateComposition(sprite.getState(), model.getDefaultState(), sprite.isUvLock()), format));
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
IUnbakedModel missing = ModelLoaderRegistry.getMissingModel();
|
||||
return new MultiLayerBakedModel(
|
||||
buildModels(models, state, uvlock, format, modelGetter, bakedTextureGetter),
|
||||
missing.bake(modelGetter, bakedTextureGetter, missing.getDefaultState(), uvlock, format),
|
||||
PerspectiveMapWrapper.getTransforms(state)
|
||||
buildModels(models, sprite, format, modelGetter, spriteGetter),
|
||||
missing.bake(modelGetter, spriteGetter, new BasicState(missing.getDefaultState(), sprite.isUvLock()), format),
|
||||
PerspectiveMapWrapper.getTransforms(sprite.getState())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -154,7 +152,7 @@ public final class MultiLayerModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
BlockRenderLayer layer = MinecraftForgeClient.getRenderLayer();
|
||||
if (layer == null)
|
||||
@@ -177,7 +175,7 @@ public final class MultiLayerModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion(IBlockState state)
|
||||
public boolean isAmbientOcclusion(BlockState state)
|
||||
{
|
||||
return base.isAmbientOcclusion(state);
|
||||
}
|
||||
|
||||
@@ -31,18 +31,15 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
@@ -76,7 +73,7 @@ public final class MultiModel implements IUnbakedModel
|
||||
private final ItemOverrideList overrides = new ItemOverrideList()
|
||||
{
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
|
||||
{
|
||||
if(originalModel != Baked.this)
|
||||
{
|
||||
@@ -158,7 +155,7 @@ public final class MultiModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion(IBlockState state)
|
||||
public boolean isAmbientOcclusion(BlockState state)
|
||||
{
|
||||
return internalBase.isAmbientOcclusion(state);
|
||||
}
|
||||
@@ -188,7 +185,7 @@ public final class MultiModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand)
|
||||
{
|
||||
ImmutableList.Builder<BakedQuad> quads = ImmutableList.builder();
|
||||
if (base != null)
|
||||
@@ -235,15 +232,15 @@ public final class MultiModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
Set<ResourceLocation> deps = Sets.newHashSet();
|
||||
|
||||
if (base != null)
|
||||
deps.addAll(base.getOverrideLocations());
|
||||
deps.addAll(base.getDependencies());
|
||||
|
||||
for (Pair<IUnbakedModel, IModelState> pair : parts.values())
|
||||
deps.addAll(pair.getLeft().getOverrideLocations());
|
||||
deps.addAll(pair.getLeft().getDependencies());
|
||||
|
||||
return deps;
|
||||
}
|
||||
@@ -262,27 +259,28 @@ public final class MultiModel implements IUnbakedModel
|
||||
return deps;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
IBakedModel bakedBase = null;
|
||||
|
||||
if (base != null)
|
||||
bakedBase = base.bake(modelGetter, bakedTextureGetter, state, uvlock, format);
|
||||
bakedBase = base.bake(modelGetter, spriteGetter, sprite, format);
|
||||
|
||||
ImmutableMap.Builder<String, IBakedModel> mapBuilder = ImmutableMap.builder();
|
||||
|
||||
for (Entry<String, Pair<IUnbakedModel, IModelState>> entry : parts.entrySet())
|
||||
{
|
||||
Pair<IUnbakedModel, IModelState> pair = entry.getValue();
|
||||
mapBuilder.put(entry.getKey(), pair.getLeft().bake(modelGetter, bakedTextureGetter, new ModelStateComposition(state, pair.getRight()), uvlock, format));
|
||||
mapBuilder.put(entry.getKey(), pair.getLeft().bake(modelGetter, spriteGetter, new ModelStateComposition(sprite.getState(), pair.getRight(), sprite.isUvLock()), format));
|
||||
}
|
||||
|
||||
if(bakedBase == null && parts.isEmpty())
|
||||
{
|
||||
LOGGER.error("MultiModel {} is empty (no base model or parts were provided/resolved)", location);
|
||||
IUnbakedModel missing = ModelLoaderRegistry.getMissingModel();
|
||||
return missing.bake(modelGetter, bakedTextureGetter, missing.getDefaultState(), uvlock, format);
|
||||
return missing.bake(modelGetter, spriteGetter, new BasicState(missing.getDefaultState(), sprite.isUvLock()), format);
|
||||
}
|
||||
return new Baked(location, true, bakedBase, mapBuilder.build());
|
||||
}
|
||||
|
||||
@@ -24,13 +24,13 @@ import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
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.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
@@ -104,13 +104,13 @@ public class PerspectiveMapWrapper implements IBakedModel
|
||||
}
|
||||
|
||||
@Override public boolean isAmbientOcclusion() { return parent.isAmbientOcclusion(); }
|
||||
@Override public boolean isAmbientOcclusion(IBlockState state) { return parent.isAmbientOcclusion(state); }
|
||||
@Override public boolean isAmbientOcclusion(BlockState state) { return parent.isAmbientOcclusion(state); }
|
||||
@Override public boolean isGui3d() { return parent.isGui3d(); }
|
||||
@Override public boolean isBuiltInRenderer() { return parent.isBuiltInRenderer(); }
|
||||
@Override public TextureAtlasSprite getParticleTexture() { return parent.getParticleTexture(); }
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override public ItemCameraTransforms getItemCameraTransforms() { return parent.getItemCameraTransforms(); }
|
||||
@Override public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand) { return parent.getQuads(state, side, rand); }
|
||||
@Override public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) { return parent.getQuads(state, side, rand); }
|
||||
@Override public ItemOverrideList getOverrides() { return parent.getOverrides(); }
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public abstract class SimpleModelFontRenderer extends FontRenderer {
|
||||
@@ -45,7 +45,7 @@ public abstract class SimpleModelFontRenderer extends FontRenderer {
|
||||
private ImmutableList.Builder<BakedQuad> builder = ImmutableList.builder();
|
||||
private final VertexFormat format;
|
||||
private final Vector3f normal = new Vector3f(0, 0, 1);
|
||||
private final EnumFacing orientation;
|
||||
private final Direction orientation;
|
||||
private boolean fillBlanks = false;
|
||||
|
||||
private TextureAtlasSprite sprite;
|
||||
@@ -56,7 +56,7 @@ public abstract class SimpleModelFontRenderer extends FontRenderer {
|
||||
this.transform = new TRSRTransformation(matrix);
|
||||
this.format = format;
|
||||
transform.transformNormal(normal);
|
||||
orientation = EnumFacing.getFacingFromVector(normal.x, normal.y, normal.z);
|
||||
orientation = Direction.getFacingFromVector(normal.x, normal.y, normal.z);
|
||||
}
|
||||
|
||||
public void setSprite(TextureAtlasSprite sprite)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package net.minecraftforge.client.model;
|
||||
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraftforge.common.model.IModelPart;
|
||||
import net.minecraftforge.common.model.IModelState;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
@@ -29,7 +30,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
/*
|
||||
* Simple implementation of IModelState via a map and a default value.
|
||||
*/
|
||||
public final class SimpleModelState implements IModelState
|
||||
public final class SimpleModelState implements IModelState, ISprite
|
||||
{
|
||||
private final ImmutableMap<? extends IModelPart, TRSRTransformation> map;
|
||||
private final Optional<TRSRTransformation> def;
|
||||
@@ -45,6 +46,12 @@ public final class SimpleModelState implements IModelState
|
||||
this.def = def;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getState()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
|
||||
{
|
||||
|
||||
+4
-4
@@ -28,7 +28,7 @@ import net.minecraft.client.renderer.model.ItemOverride;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -57,7 +57,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
|
||||
public AnimationItemOverrideList(IUnbakedModel model, IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, List<ItemOverride> overrides)
|
||||
{
|
||||
super(model, ModelLoader.defaultModelGetter(), bakedTextureGetter, overrides);
|
||||
super(model, ModelLoader.defaultModelGetter(), overrides, bakedTextureGetter);
|
||||
this.model = model;
|
||||
this.state = state;
|
||||
this.format = format;
|
||||
@@ -65,7 +65,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
|
||||
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable LivingEntity entity)
|
||||
{
|
||||
return stack.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
|
||||
.map(asm ->
|
||||
@@ -83,7 +83,7 @@ public final class AnimationItemOverrideList extends ItemOverrideList
|
||||
return asm.apply(Animation.getWorldTime(world, Animation.getPartialTickTime())).getLeft();
|
||||
})
|
||||
// TODO where should uvlock data come from?
|
||||
.map(state -> model.bake(ModelLoader.defaultModelGetter(), bakedTextureGetter, new ModelStateComposition(state, this.state), false, format))
|
||||
.map(state -> model.bake(ModelLoader.defaultModelGetter(), bakedTextureGetter, new ModelStateComposition(state, this.state), format))
|
||||
.orElseGet(() -> super.getModelWithOverrides(originalModel, stack, world, entity));
|
||||
}
|
||||
}
|
||||
@@ -23,19 +23,19 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.entity.model.ModelBase;
|
||||
import net.minecraft.client.renderer.model.Model;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.BasicState;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.client.model.pipeline.VertexLighterFlat;
|
||||
@@ -46,12 +46,15 @@ import net.minecraftforge.common.model.animation.CapabilityAnimation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
/**
|
||||
* ModelBase that works with the Forge model system and animations.
|
||||
* Some quirks are still left, deprecated for the moment.
|
||||
*/
|
||||
/*
|
||||
@Deprecated
|
||||
public class AnimationModelBase<T extends Entity> extends ModelBase implements IEventHandler<T>
|
||||
public class AnimationModelBase<T extends Entity> extends Model implements IEventHandler<T>
|
||||
{
|
||||
private final VertexLighterFlat lighter;
|
||||
private final ResourceLocation modelLocation;
|
||||
@@ -63,7 +66,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
//@Override
|
||||
public void render(Entity entity, float limbSwing, float limbSwingSpeed, float timeAlive, float yawHead, float rotationPitch, float scale)
|
||||
{
|
||||
entity.getCapability(CapabilityAnimation.ANIMATION_CAPABILITY, null)
|
||||
@@ -72,7 +75,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
|
||||
handleEvents((T) entity, timeAlive / 20, pair.getRight());
|
||||
IUnbakedModel unbaked = ModelLoaderRegistry.getModelOrMissing(modelLocation);
|
||||
// TODO where should uvlock data come from?
|
||||
return unbaked.bake(ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter(), pair.getLeft(), false, DefaultVertexFormats.ITEM);
|
||||
return unbaked.bake(ModelLoader.defaultModelGetter(), ModelLoader.defaultTextureGetter(), new BasicState(pair.getLeft(), false), DefaultVertexFormats.ITEM);
|
||||
}).ifPresent(model -> drawModel(model, entity));
|
||||
}
|
||||
|
||||
@@ -105,7 +108,7 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
|
||||
quad.pipe(lighter);
|
||||
}
|
||||
}
|
||||
for(EnumFacing side : EnumFacing.values())
|
||||
for(Direction side : Direction.values())
|
||||
{
|
||||
random.setSeed(42);
|
||||
quads = bakedModel.getQuads(null, side, random);
|
||||
@@ -121,10 +124,10 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
|
||||
}
|
||||
|
||||
// debug quad
|
||||
/*VertexBuffer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex();
|
||||
VertexBuffer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex();
|
||||
VertexBuffer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex();
|
||||
VertexBuffer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();*/
|
||||
//VertexBuffer.pos(0, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 0).lightmap(240, 0).endVertex();
|
||||
//VertexBuffer.pos(0, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(0, 1).lightmap(240, 0).endVertex();
|
||||
//VertexBuffer.pos(1, 1, 1).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 1).lightmap(240, 0).endVertex();
|
||||
//VertexBuffer.pos(1, 1, 0).color(0xFF, 0xFF, 0xFF, 0xFF).tex(1, 0).lightmap(240, 0).endVertex();
|
||||
|
||||
builder.setTranslation(0, 0, 0);
|
||||
|
||||
@@ -136,3 +139,4 @@ public class AnimationModelBase<T extends Entity> extends ModelBase implements I
|
||||
@Override
|
||||
public void handleEvents(T instance, float time, Iterable<Event> pastEvents) {}
|
||||
}
|
||||
*/
|
||||
+3
-3
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model.animation;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
@@ -56,8 +56,8 @@ public class TileEntityRendererAnimation<T extends TileEntity> extends TileEntit
|
||||
}
|
||||
if(blockRenderer == null) blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
BlockPos pos = te.getPos();
|
||||
IWorldReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
net.minecraft.world.IEnviromentBlockReader world = MinecraftForgeClient.getRegionRenderCache(te.getWorld(), pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
IBakedModel model = blockRenderer.getBlockModelShapes().getModel(state);
|
||||
IModelData data = model.getModelData(world, pos, state, ModelDataManager.getModelData(te.getWorld(), pos));
|
||||
if (data.hasProperty(Properties.AnimationProperty))
|
||||
|
||||
@@ -21,12 +21,13 @@ package net.minecraftforge.client.model.animation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
@@ -59,7 +60,7 @@ public abstract class TileEntityRendererFast<T extends TileEntity> extends TileE
|
||||
{
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder buffer = tessellator.getBuffer();
|
||||
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
this.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
@@ -37,6 +37,8 @@ import javax.annotation.Nullable;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.commons.lang3.tuple.Triple;
|
||||
@@ -54,17 +56,13 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||
@@ -460,16 +458,17 @@ public enum B3DLoader implements ICustomModelLoader
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
|
||||
TextureAtlasSprite missing = spriteGetter.apply(new ResourceLocation("missingno"));
|
||||
for(Map.Entry<String, ResourceLocation> e : textures.entrySet())
|
||||
{
|
||||
if(e.getValue().getPath().startsWith("#"))
|
||||
@@ -479,11 +478,11 @@ public enum B3DLoader implements ICustomModelLoader
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue()));
|
||||
builder.put(e.getKey(), spriteGetter.apply(e.getValue()));
|
||||
}
|
||||
}
|
||||
builder.put("missingno", missing);
|
||||
return new BakedWrapper(model.getRoot(), state, smooth, gui3d, format, meshes, builder.build());
|
||||
return new BakedWrapper(model.getRoot(), sprite.getState(), smooth, gui3d, format, meshes, builder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -647,7 +646,7 @@ public enum B3DLoader implements ICustomModelLoader
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, Random rand, IModelData data)
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand, IModelData data)
|
||||
{
|
||||
if(side != null) return ImmutableList.of();
|
||||
IModelState modelState = this.state;
|
||||
@@ -723,7 +722,7 @@ public enum B3DLoader implements ICustomModelLoader
|
||||
{
|
||||
UnpackedBakedQuad.Builder quadBuilder = new UnpackedBakedQuad.Builder(format);
|
||||
quadBuilder.setContractUVs(true);
|
||||
quadBuilder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
quadBuilder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
List<Texture> textures = null;
|
||||
if(f.getBrush() != null) textures = f.getBrush().getTextures();
|
||||
TextureAtlasSprite sprite;
|
||||
|
||||
@@ -25,10 +25,10 @@ import java.util.Random;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
/**
|
||||
* Convenience interface with default implementation of {@link IBakedModel#getQuads(net.minecraft.block.state.IBlockState, net.minecraft.util.EnumFacing, java.util.Random)}.
|
||||
@@ -36,7 +36,7 @@ import net.minecraft.util.EnumFacing;
|
||||
public interface IDynamicBakedModel extends IBakedModel
|
||||
{
|
||||
@Override
|
||||
default @Nonnull List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, @Nonnull Random rand)
|
||||
default @Nonnull List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand)
|
||||
{
|
||||
return getQuads(state, side, rand, EmptyModelData.INSTANCE);
|
||||
}
|
||||
@@ -44,5 +44,5 @@ public interface IDynamicBakedModel extends IBakedModel
|
||||
// Force this to be overriden otherwise this introduces a default cycle between the two overloads.
|
||||
@Override
|
||||
@Nonnull
|
||||
List<BakedQuad> getQuads(@Nullable IBlockState state, @Nullable EnumFacing side, @Nonnull Random rand, @Nonnull IModelData extraData);
|
||||
List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData);
|
||||
}
|
||||
@@ -41,17 +41,15 @@ import javax.vecmath.Vector2f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.*;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.ISprite;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.resources.IResource;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.*;
|
||||
import net.minecraftforge.client.model.data.IDynamicBakedModel;
|
||||
@@ -118,17 +116,18 @@ public class OBJModel implements IUnbakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ResourceLocation> getOverrideLocations()
|
||||
public Collection<ResourceLocation> getDependencies()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, IModelState state, boolean uvlock, VertexFormat format)
|
||||
public IBakedModel bake(Function<ResourceLocation, IUnbakedModel> modelGetter, Function<ResourceLocation, TextureAtlasSprite> spriteGetter, ISprite sprite, VertexFormat format)
|
||||
{
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
|
||||
TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
|
||||
TextureAtlasSprite missing = spriteGetter.apply(new ResourceLocation("missingno"));
|
||||
for (Map.Entry<String, Material> e : matLib.materials.entrySet())
|
||||
{
|
||||
if (e.getValue().getTexture().getTextureLocation().getPath().startsWith("#"))
|
||||
@@ -138,11 +137,11 @@ public class OBJModel implements IUnbakedModel
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.put(e.getKey(), bakedTextureGetter.apply(e.getValue().getTexture().getTextureLocation()));
|
||||
builder.put(e.getKey(), spriteGetter.apply(e.getValue().getTexture().getTextureLocation()));
|
||||
}
|
||||
}
|
||||
builder.put("missingno", missing);
|
||||
return new OBJBakedModel(this, state, format, builder.build());
|
||||
return new OBJBakedModel(this, sprite.getState(), format, builder.build());
|
||||
}
|
||||
|
||||
public MaterialLibrary getMatLib()
|
||||
@@ -1279,7 +1278,7 @@ public class OBJModel implements IUnbakedModel
|
||||
|
||||
// FIXME: merge with getQuads
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState blockState, EnumFacing side, Random rand, IModelData modelData)
|
||||
public List<BakedQuad> getQuads(BlockState blockState, Direction side, Random rand, IModelData modelData)
|
||||
{
|
||||
if (side != null) return ImmutableList.of();
|
||||
if (quads == null)
|
||||
@@ -1373,7 +1372,7 @@ public class OBJModel implements IUnbakedModel
|
||||
else sprite = this.textures.get(f.getMaterialName());
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setContractUVs(true);
|
||||
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
builder.setQuadOrientation(Direction.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
builder.setTexture(sprite);
|
||||
Normal faceNormal = f.getNormal();
|
||||
putVertexData(builder, f.verts[0], faceNormal, TextureCoordinate.getDefaultUVs()[0], sprite);
|
||||
|
||||
@@ -19,20 +19,21 @@
|
||||
|
||||
package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
|
||||
public class BlockInfo
|
||||
{
|
||||
private static final EnumFacing[] SIDES = EnumFacing.values();
|
||||
private static final Direction[] SIDES = Direction.values();
|
||||
|
||||
private final BlockColors colors;
|
||||
private IWorldReader world;
|
||||
private IBlockState state;
|
||||
private IEnviromentBlockReader world;
|
||||
private BlockState state;
|
||||
private BlockPos blockPos;
|
||||
|
||||
private final boolean[][][] t = new boolean[3][3][3];
|
||||
@@ -60,7 +61,7 @@ public class BlockInfo
|
||||
{
|
||||
if(cachedTint == tint) return cachedMultiplier;
|
||||
cachedTint = tint;
|
||||
cachedMultiplier = colors.getColor(state, world, blockPos, tint);
|
||||
cachedMultiplier = colors.func_216860_a(state, world, blockPos, tint);
|
||||
return cachedMultiplier;
|
||||
}
|
||||
|
||||
@@ -72,14 +73,14 @@ public class BlockInfo
|
||||
shz = (float) offset.z;
|
||||
}
|
||||
|
||||
public void setWorld(IWorldReader world)
|
||||
public void setWorld(IEnviromentBlockReader world)
|
||||
{
|
||||
this.world = world;
|
||||
cachedTint = -1;
|
||||
cachedMultiplier = -1;
|
||||
}
|
||||
|
||||
public void setState(IBlockState state)
|
||||
public void setState(BlockState state)
|
||||
{
|
||||
this.state = state;
|
||||
cachedTint = -1;
|
||||
@@ -122,16 +123,16 @@ public class BlockInfo
|
||||
for(int z = 0; z <= 2; z++)
|
||||
{
|
||||
BlockPos pos = blockPos.add(x - 1, y - 1, z - 1);
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
BlockState state = world.getBlockState(pos);
|
||||
t[x][y][z] = state.getOpacity(world, pos) < 15;
|
||||
int brightness = state.getPackedLightmapCoords(world, pos);
|
||||
int brightness = state.func_215684_a(world, pos);
|
||||
s[x][y][z] = (brightness >> 0x14) & 0xF;
|
||||
b[x][y][z] = (brightness >> 0x04) & 0xF;
|
||||
ao[x][y][z] = state.getAmbientOcclusionLightValue();
|
||||
ao[x][y][z] = state.func_215703_d(world, pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(EnumFacing side : SIDES)
|
||||
for(Direction side : SIDES)
|
||||
{
|
||||
if(!state.doesSideBlockRendering(world, blockPos, side))
|
||||
{
|
||||
@@ -185,22 +186,22 @@ public class BlockInfo
|
||||
|
||||
public void updateFlatLighting()
|
||||
{
|
||||
full = state.isFullCube();
|
||||
packed[0] = state.getPackedLightmapCoords(world, blockPos);
|
||||
full = Block.isOpaque(state.getCollisionShape(world, blockPos));
|
||||
packed[0] = state.func_215684_a(world, blockPos);
|
||||
|
||||
for (EnumFacing side : SIDES)
|
||||
for (Direction side : SIDES)
|
||||
{
|
||||
int i = side.ordinal() + 1;
|
||||
packed[i] = state.getPackedLightmapCoords(world, blockPos.offset(side));
|
||||
packed[i] = state.func_215684_a(world, blockPos.offset(side));
|
||||
}
|
||||
}
|
||||
|
||||
public IWorldReader getWorld()
|
||||
public IEnviromentBlockReader getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
public IBlockState getState()
|
||||
public BlockState getState()
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
+14
-12
@@ -23,16 +23,18 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.BlockModelRenderer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
|
||||
public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
@@ -50,7 +52,7 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderModelFlat(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
|
||||
public boolean renderModelFlat(IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
{
|
||||
if(ForgeMod.forgeLightPipelineEnabled)
|
||||
{
|
||||
@@ -61,16 +63,16 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
VertexLighterFlat lighter = lighterFlat.get();
|
||||
lighter.setParent(consumer);
|
||||
|
||||
return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed);
|
||||
return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed, modelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.renderModelFlat(world, model, state, pos, buffer, checkSides, rand, seed);
|
||||
return super.renderModelFlat(world, model, state, pos, buffer, checkSides, rand, seed, modelData);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderModelSmooth(IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed)
|
||||
public boolean renderModelSmooth(IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder buffer, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
{
|
||||
if(ForgeMod.forgeLightPipelineEnabled)
|
||||
{
|
||||
@@ -81,22 +83,22 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
VertexLighterSmoothAo lighter = lighterSmooth.get();
|
||||
lighter.setParent(consumer);
|
||||
|
||||
return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed);
|
||||
return render(lighter, world, model, state, pos, buffer, checkSides, rand, seed, modelData);
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.renderModelSmooth(world, model, state, pos, buffer, checkSides, rand, seed);
|
||||
return super.renderModelSmooth(world, model, state, pos, buffer, checkSides, rand, seed, modelData);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean render(VertexLighterFlat lighter, IWorldReader world, IBakedModel model, IBlockState state, BlockPos pos, BufferBuilder wr, boolean checkSides, Random rand, long seed)
|
||||
public static boolean render(VertexLighterFlat lighter, IEnviromentBlockReader world, IBakedModel model, BlockState state, BlockPos pos, BufferBuilder wr, boolean checkSides, Random rand, long seed, IModelData modelData)
|
||||
{
|
||||
lighter.setWorld(world);
|
||||
lighter.setState(state);
|
||||
lighter.setBlockPos(pos);
|
||||
boolean empty = true;
|
||||
rand.setSeed(seed);
|
||||
List<BakedQuad> quads = model.getQuads(state, null, rand);
|
||||
List<BakedQuad> quads = model.getQuads(state, null, rand, modelData);
|
||||
if(!quads.isEmpty())
|
||||
{
|
||||
lighter.updateBlockInfo();
|
||||
@@ -106,10 +108,10 @@ public class ForgeBlockModelRenderer extends BlockModelRenderer
|
||||
quad.pipe(lighter);
|
||||
}
|
||||
}
|
||||
for(EnumFacing side : EnumFacing.values())
|
||||
for(Direction side : Direction.values())
|
||||
{
|
||||
rand.setSeed(seed);
|
||||
quads = model.getQuads(state, side, rand);
|
||||
quads = model.getQuads(state, side, rand, modelData);
|
||||
if(!quads.isEmpty())
|
||||
{
|
||||
if(!checkSides || Block.shouldSideBeRendered(state, world, pos, side))
|
||||
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
/**
|
||||
* Assumes that the data length is not less than e.getElementCount().
|
||||
@@ -36,7 +36,7 @@ public interface IVertexConsumer
|
||||
VertexFormat getVertexFormat();
|
||||
|
||||
void setQuadTint(int tint);
|
||||
void setQuadOrientation(EnumFacing orientation);
|
||||
void setQuadOrientation(Direction orientation);
|
||||
void setApplyDiffuseLighting(boolean diffuse);
|
||||
void setTexture(TextureAtlasSprite texture);
|
||||
void put(int element, float... data);
|
||||
|
||||
@@ -25,8 +25,8 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
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;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class LightUtil
|
||||
return Math.min(x * x * 0.6f + y * y * ((3f + y) / 4f) + z * z * 0.8f, 1f);
|
||||
}
|
||||
|
||||
public static float diffuseLight(EnumFacing side)
|
||||
public static float diffuseLight(Direction side)
|
||||
{
|
||||
switch(side)
|
||||
{
|
||||
@@ -56,32 +56,32 @@ public class LightUtil
|
||||
}
|
||||
}
|
||||
|
||||
public static EnumFacing toSide(float x, float y, float z)
|
||||
public static Direction toSide(float x, float y, float z)
|
||||
{
|
||||
if(Math.abs(x) > Math.abs(y))
|
||||
{
|
||||
if(Math.abs(x) > Math.abs(z))
|
||||
{
|
||||
if(x < 0) return EnumFacing.WEST;
|
||||
return EnumFacing.EAST;
|
||||
if(x < 0) return Direction.WEST;
|
||||
return Direction.EAST;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(z < 0) return EnumFacing.NORTH;
|
||||
return EnumFacing.SOUTH;
|
||||
if(z < 0) return Direction.NORTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(Math.abs(y) > Math.abs(z))
|
||||
{
|
||||
if(y < 0) return EnumFacing.DOWN;
|
||||
return EnumFacing.UP;
|
||||
if(y < 0) return Direction.DOWN;
|
||||
return Direction.UP;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(z < 0) return EnumFacing.NORTH;
|
||||
return EnumFacing.SOUTH;
|
||||
if(z < 0) return Direction.NORTH;
|
||||
return Direction.SOUTH;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ public class LightUtil
|
||||
VertexFormatElement element = formatFrom.getElement(e);
|
||||
int vertexStart = v * formatFrom.getSize() + formatFrom.getOffset(e);
|
||||
int count = element.getElementCount();
|
||||
VertexFormatElement.EnumType type = element.getType();
|
||||
VertexFormatElement.Type type = element.getType();
|
||||
int size = type.getSize();
|
||||
int mask = (256 << (8 * (size - 1))) - 1;
|
||||
for(int i = 0; i < length; i++)
|
||||
@@ -177,27 +177,27 @@ public class LightUtil
|
||||
bits |= from[index + 1] << ((4 - offset) * 8);
|
||||
}
|
||||
bits &= mask;
|
||||
if(type == VertexFormatElement.EnumType.FLOAT)
|
||||
if(type == VertexFormatElement.Type.FLOAT)
|
||||
{
|
||||
to[i] = Float.intBitsToFloat(bits);
|
||||
}
|
||||
else if(type == VertexFormatElement.EnumType.UBYTE || type == VertexFormatElement.EnumType.USHORT)
|
||||
else if(type == VertexFormatElement.Type.UBYTE || type == VertexFormatElement.Type.USHORT)
|
||||
{
|
||||
to[i] = (float)bits / mask;
|
||||
}
|
||||
else if(type == VertexFormatElement.EnumType.UINT)
|
||||
else if(type == VertexFormatElement.Type.UINT)
|
||||
{
|
||||
to[i] = (float)((double)(bits & 0xFFFFFFFFL) / 0xFFFFFFFFL);
|
||||
}
|
||||
else if(type == VertexFormatElement.EnumType.BYTE)
|
||||
else if(type == VertexFormatElement.Type.BYTE)
|
||||
{
|
||||
to[i] = ((float)(byte)bits) / (mask >> 1);
|
||||
}
|
||||
else if(type == VertexFormatElement.EnumType.SHORT)
|
||||
else if(type == VertexFormatElement.Type.SHORT)
|
||||
{
|
||||
to[i] = ((float)(short)bits) / (mask >> 1);
|
||||
}
|
||||
else if(type == VertexFormatElement.EnumType.INT)
|
||||
else if(type == VertexFormatElement.Type.INT)
|
||||
{
|
||||
to[i] = (float)((double)(bits & 0xFFFFFFFFL) / (0xFFFFFFFFL >> 1));
|
||||
}
|
||||
@@ -214,7 +214,7 @@ public class LightUtil
|
||||
VertexFormatElement element = formatTo.getElement(e);
|
||||
int vertexStart = v * formatTo.getSize() + formatTo.getOffset(e);
|
||||
int count = element.getElementCount();
|
||||
VertexFormatElement.EnumType type = element.getType();
|
||||
VertexFormatElement.Type type = element.getType();
|
||||
int size = type.getSize();
|
||||
int mask = (256 << (8 * (size - 1))) - 1;
|
||||
for(int i = 0; i < 4; i++)
|
||||
@@ -226,14 +226,14 @@ public class LightUtil
|
||||
int offset = pos & 3;
|
||||
int bits = 0;
|
||||
float f = i < from.length ? from[i] : 0;
|
||||
if(type == VertexFormatElement.EnumType.FLOAT)
|
||||
if(type == VertexFormatElement.Type.FLOAT)
|
||||
{
|
||||
bits = Float.floatToRawIntBits(f);
|
||||
}
|
||||
else if(
|
||||
type == VertexFormatElement.EnumType.UBYTE ||
|
||||
type == VertexFormatElement.EnumType.USHORT ||
|
||||
type == VertexFormatElement.EnumType.UINT
|
||||
type == VertexFormatElement.Type.UBYTE ||
|
||||
type == VertexFormatElement.Type.USHORT ||
|
||||
type == VertexFormatElement.Type.UINT
|
||||
)
|
||||
{
|
||||
bits = Math.round(f * mask);
|
||||
@@ -339,7 +339,7 @@ public class LightUtil
|
||||
@Override
|
||||
public void put(int element, float... data)
|
||||
{
|
||||
if(getVertexFormat().getElement(element).getUsage() == EnumUsage.COLOR)
|
||||
if(getVertexFormat().getElement(element).getUsage() == Usage.COLOR)
|
||||
{
|
||||
System.arraycopy(auxColor, 0, buf, 0, buf.length);
|
||||
int n = Math.min(4, data.length);
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
// advantages: non-fixed-length vertex format, no overhead of packing and unpacking attributes to transform the model
|
||||
// disadvantages: (possibly) larger memory footprint, overhead on packing the attributes at the final rendering stage
|
||||
@@ -33,7 +33,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
protected final VertexFormat format;
|
||||
protected boolean packed = false;
|
||||
|
||||
public UnpackedBakedQuad(float[][][] unpackedData, int tint, EnumFacing orientation, TextureAtlasSprite texture, boolean applyDiffuseLighting, VertexFormat format)
|
||||
public UnpackedBakedQuad(float[][][] unpackedData, int tint, Direction orientation, TextureAtlasSprite texture, boolean applyDiffuseLighting, VertexFormat format)
|
||||
{
|
||||
super(new int[format.getSize() /* / 4 * 4 */], tint, orientation, texture, applyDiffuseLighting, format);
|
||||
this.unpackedData = unpackedData;
|
||||
@@ -90,7 +90,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
private final VertexFormat format;
|
||||
private final float[][][] unpackedData;
|
||||
private int tint = -1;
|
||||
private EnumFacing orientation;
|
||||
private Direction orientation;
|
||||
private TextureAtlasSprite texture;
|
||||
private boolean applyDiffuseLighting = true;
|
||||
|
||||
@@ -122,7 +122,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuadOrientation(EnumFacing orientation)
|
||||
public void setQuadOrientation(Direction orientation)
|
||||
{
|
||||
this.orientation = orientation;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ public class UnpackedBakedQuad extends BakedQuad
|
||||
while(uve < format.getElementCount())
|
||||
{
|
||||
VertexFormatElement e = format.getElement(uve);
|
||||
if(e.getUsage() == VertexFormatElement.EnumUsage.UV && e.getIndex() == 0)
|
||||
if(e.getUsage() == VertexFormatElement.Usage.UV && e.getIndex() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ package net.minecraftforge.client.model.pipeline;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.EnumUsage;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement.Usage;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
/**
|
||||
* Assumes VertexFormatElement is present in the BufferBuilder's vertex format.
|
||||
@@ -55,7 +55,7 @@ public class VertexBufferConsumer implements IVertexConsumer
|
||||
public void put(int e, float... data)
|
||||
{
|
||||
VertexFormat format = getVertexFormat();
|
||||
if(renderer.isColorDisabled() && format.getElement(e).getUsage() == EnumUsage.COLOR)
|
||||
if(renderer.isColorDisabled() && format.getElement(e).getUsage() == Usage.COLOR)
|
||||
{
|
||||
data = dummyColor;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ public class VertexBufferConsumer implements IVertexConsumer
|
||||
@Override
|
||||
public void setQuadTint(int tint) {}
|
||||
@Override
|
||||
public void setQuadOrientation(EnumFacing orientation) {}
|
||||
public void setQuadOrientation(Direction orientation) {}
|
||||
@Override
|
||||
public void setApplyDiffuseLighting(boolean diffuse) {}
|
||||
@Override
|
||||
|
||||
@@ -21,22 +21,23 @@ package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
{
|
||||
protected static final VertexFormatElement NORMAL_4F = new VertexFormatElement(0, VertexFormatElement.EnumType.FLOAT, VertexFormatElement.EnumUsage.NORMAL, 4);
|
||||
protected static final VertexFormatElement NORMAL_4F = new VertexFormatElement(0, VertexFormatElement.Type.FLOAT, VertexFormatElement.Usage.NORMAL, 4);
|
||||
|
||||
protected final BlockInfo blockInfo;
|
||||
private int tint = -1;
|
||||
@@ -243,14 +244,14 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
final float e2 = 0.95f;
|
||||
|
||||
boolean full = blockInfo.isFullCube();
|
||||
EnumFacing side = null;
|
||||
Direction side = null;
|
||||
|
||||
if((full || y < -e1) && normal[1] < -e2) side = EnumFacing.DOWN;
|
||||
else if((full || y > e1) && normal[1] > e2) side = EnumFacing.UP;
|
||||
else if((full || z < -e1) && normal[2] < -e2) side = EnumFacing.NORTH;
|
||||
else if((full || z > e1) && normal[2] > e2) side = EnumFacing.SOUTH;
|
||||
else if((full || x < -e1) && normal[0] < -e2) side = EnumFacing.WEST;
|
||||
else if((full || x > e1) && normal[0] > e2) side = EnumFacing.EAST;
|
||||
if((full || y < -e1) && normal[1] < -e2) side = Direction.DOWN;
|
||||
else if((full || y > e1) && normal[1] > e2) side = Direction.UP;
|
||||
else if((full || z < -e1) && normal[2] < -e2) side = Direction.NORTH;
|
||||
else if((full || z > e1) && normal[2] > e2) side = Direction.SOUTH;
|
||||
else if((full || x < -e1) && normal[0] < -e2) side = Direction.WEST;
|
||||
else if((full || x > e1) && normal[0] > e2) side = Direction.EAST;
|
||||
|
||||
int i = side == null ? 0 : side.ordinal() + 1;
|
||||
int brightness = blockInfo.getPackedLight()[i];
|
||||
@@ -275,7 +276,7 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
this.tint = tint;
|
||||
}
|
||||
@Override
|
||||
public void setQuadOrientation(EnumFacing orientation) {}
|
||||
public void setQuadOrientation(Direction orientation) {}
|
||||
public void setQuadCulled() {}
|
||||
@Override
|
||||
public void setTexture(TextureAtlasSprite texture) {}
|
||||
@@ -285,12 +286,12 @@ public class VertexLighterFlat extends QuadGatheringTransformer
|
||||
this.diffuse = diffuse;
|
||||
}
|
||||
|
||||
public void setWorld(IWorldReader world)
|
||||
public void setWorld(IEnviromentBlockReader world)
|
||||
{
|
||||
blockInfo.setWorld(world);
|
||||
}
|
||||
|
||||
public void setState(IBlockState state)
|
||||
public void setState(BlockState state)
|
||||
{
|
||||
blockInfo.setState(state);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ package net.minecraftforge.client.model.pipeline;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
public class VertexTransformer implements IVertexConsumer
|
||||
{
|
||||
@@ -51,7 +51,7 @@ public class VertexTransformer implements IVertexConsumer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuadOrientation(EnumFacing orientation)
|
||||
public void setQuadOrientation(Direction orientation)
|
||||
{
|
||||
parent.setQuadOrientation(orientation);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user