mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 00:07:45 +00:00
Model stuff: updated to generics, fixed various warnings, added handling of new perspective types.
This commit is contained in:
1 parent
fe7f713b67
commit
c5ee4e6451
10 files changed
+34
-41
No files matched your search
@@ -1,18 +1,6 @@
|
||||
--- ../src-base/minecraft/net/minecraft/client/resources/model/IBakedModel.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/resources/model/IBakedModel.java
|
||||
@@ -8,7 +8,11 @@
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
+/*
|
||||
+ * @deprecated use {@link net.minecraftforge.client.model.IFlexibleBakedModel}, {@link net.minecraftforge.client.model.IPerspectiveAwareModel}
|
||||
+ */
|
||||
@SideOnly(Side.CLIENT)
|
||||
+@Deprecated
|
||||
public interface IBakedModel
|
||||
{
|
||||
List<BakedQuad> getFaceQuads(EnumFacing p_177551_1_);
|
||||
@@ -23,5 +27,6 @@
|
||||
@@ -23,5 +23,6 @@
|
||||
|
||||
TextureAtlasSprite getTexture();
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.model.ModelRotation;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -90,6 +91,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
||||
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class ForgeHooksClient
|
||||
@@ -510,7 +512,7 @@ public class ForgeHooksClient
|
||||
}
|
||||
*/
|
||||
|
||||
public static void onModelBake(ModelManager modelManager, IRegistry modelRegistry, ModelBakery modelBakery)
|
||||
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelBakery modelBakery)
|
||||
{
|
||||
ModelLoader loader = (ModelLoader)modelBakery;
|
||||
MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, loader));
|
||||
|
||||
@@ -43,7 +43,6 @@ public class BlockStateLoader
|
||||
*
|
||||
* @return Model definition including variants for all known combinations.
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ModelBlockDefinition load(Reader reader, final Gson vanillaGSON)
|
||||
{
|
||||
try
|
||||
@@ -75,7 +74,7 @@ public class BlockStateLoader
|
||||
variants.add(new ModelBlockDefinition.Variants(entry.getKey(), mcVars));
|
||||
}
|
||||
|
||||
return new ModelBlockDefinition((Collection)variants); //Damn lists being collections!
|
||||
return new ModelBlockDefinition(variants);
|
||||
|
||||
default: //Unknown version.. try loading it as normal.
|
||||
return vanillaGSON.fromJson(reader, ModelBlockDefinition.class);
|
||||
|
||||
@@ -534,17 +534,29 @@ public class ForgeBlockStateV1 extends Marker
|
||||
transform.remove("firstperson");
|
||||
transforms.put(TransformType.FIRST_PERSON, TRSRTransformation.blockCenterToCorner(t));
|
||||
}
|
||||
if(transform.has("head"))
|
||||
{
|
||||
TRSRTransformation t = context.deserialize(transform.get("head"), TRSRTransformation.class);
|
||||
transform.remove("head");
|
||||
transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t));
|
||||
}
|
||||
if(transform.has("gui"))
|
||||
{
|
||||
TRSRTransformation t = context.deserialize(transform.get("gui"), TRSRTransformation.class);
|
||||
transform.remove("gui");
|
||||
transforms.put(TransformType.GUI, TRSRTransformation.blockCenterToCorner(t));
|
||||
}
|
||||
if(transform.has("head"))
|
||||
if(transform.has("ground"))
|
||||
{
|
||||
TRSRTransformation t = context.deserialize(transform.get("head"), TRSRTransformation.class);
|
||||
transform.remove("head");
|
||||
transforms.put(TransformType.HEAD, TRSRTransformation.blockCenterToCorner(t));
|
||||
TRSRTransformation t = context.deserialize(transform.get("ground"), TRSRTransformation.class);
|
||||
transform.remove("ground");
|
||||
transforms.put(TransformType.GROUND, TRSRTransformation.blockCenterToCorner(t));
|
||||
}
|
||||
if(transform.has("fixed"))
|
||||
{
|
||||
TRSRTransformation t = context.deserialize(transform.get("fixed"), TRSRTransformation.class);
|
||||
transform.remove("fixed");
|
||||
transforms.put(TransformType.FIXED, TRSRTransformation.blockCenterToCorner(t));
|
||||
}
|
||||
int k = transform.entrySet().size();
|
||||
if(transform.has("matrix")) k--;
|
||||
|
||||
@@ -14,9 +14,6 @@ import net.minecraft.util.EnumFacing;
|
||||
*/
|
||||
public interface IFlexibleBakedModel extends IBakedModel
|
||||
{
|
||||
// non-erased versions of the IBakedModel methods
|
||||
List<BakedQuad> getFaceQuads(EnumFacing side);
|
||||
List<BakedQuad> getGeneralQuads();
|
||||
/*
|
||||
* Specifies the format which BakedQuads' getVertexData will have.
|
||||
*/
|
||||
@@ -36,13 +33,11 @@ public interface IFlexibleBakedModel extends IBakedModel
|
||||
this.format = format;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<BakedQuad> getFaceQuads(EnumFacing side)
|
||||
{
|
||||
return parent.getFaceQuads(side);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<BakedQuad> getGeneralQuads()
|
||||
{
|
||||
return parent.getGeneralQuads();
|
||||
|
||||
@@ -14,7 +14,6 @@ import net.minecraft.util.EnumFacing;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
/*
|
||||
|
||||
@@ -38,11 +38,10 @@ public interface IPerspectiveState extends IModelState
|
||||
private static ImmutableMap<TransformType, IModelState> getMap(ItemCameraTransforms transforms)
|
||||
{
|
||||
Map<TransformType, IModelState> map = Maps.newHashMap();
|
||||
map.put(TransformType.NONE, TRSRTransformation.identity());
|
||||
map.put(TransformType.THIRD_PERSON, transforms.thirdPerson);
|
||||
map.put(TransformType.FIRST_PERSON, transforms.firstPerson);
|
||||
map.put(TransformType.GUI, transforms.gui);
|
||||
map.put(TransformType.HEAD, transforms.head);
|
||||
for(TransformType type : TransformType.values())
|
||||
{
|
||||
map.put(type, transforms.func_181688_b(type));
|
||||
}
|
||||
return Maps.immutableEnumMap(map);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.minecraftforge.client.model;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
@@ -38,6 +38,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.resources.IResourceManager;
|
||||
import net.minecraft.client.resources.model.BuiltInModel;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelBakery;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.model.ModelRotation;
|
||||
@@ -85,7 +86,7 @@ public class ModelLoader extends ModelBakery
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegistry setupModelRegistry()
|
||||
public IRegistry<ModelResourceLocation, IBakedModel> setupModelRegistry()
|
||||
{
|
||||
isLoading = true;
|
||||
loadBlocks();
|
||||
@@ -717,12 +718,12 @@ public class ModelLoader extends ModelBakery
|
||||
}
|
||||
}
|
||||
|
||||
public void onPostBakeEvent(IRegistry modelRegistry)
|
||||
public void onPostBakeEvent(IRegistry<ModelResourceLocation, IBakedModel> modelRegistry)
|
||||
{
|
||||
Object missingModel = modelRegistry.getObject(MODEL_MISSING);
|
||||
IBakedModel missingModel = modelRegistry.getObject(MODEL_MISSING);
|
||||
for(ModelResourceLocation missing : missingVariants)
|
||||
{
|
||||
Object model = modelRegistry.getObject(missing);
|
||||
IBakedModel model = modelRegistry.getObject(missing);
|
||||
if(model == null || model == missingModel)
|
||||
{
|
||||
FMLLog.severe("Model definition for location %s not found", missing);
|
||||
|
||||
@@ -185,12 +185,12 @@ public class B3DModel
|
||||
{
|
||||
chunk("BB3D");
|
||||
int version = buf.getInt();
|
||||
if(version / 100 > this.version / 100)
|
||||
if(version / 100 > Parser.version / 100)
|
||||
throw new IOException("Unsupported major model version: " + ((float)version / 100));
|
||||
if(version % 100 > this.version % 100)
|
||||
if(version % 100 > Parser.version % 100)
|
||||
logger.warn(String.format("Minor version differnce in model: ", ((float)version / 100)));
|
||||
List<Texture> textures = Collections.EMPTY_LIST;
|
||||
List<Brush> brushes = Collections.EMPTY_LIST;
|
||||
List<Texture> textures = Collections.emptyList();
|
||||
List<Brush> brushes = Collections.emptyList();
|
||||
Node<?> root = null;
|
||||
while(buf.hasRemaining())
|
||||
{
|
||||
@@ -400,7 +400,6 @@ public class B3DModel
|
||||
chunk("NODE");
|
||||
animations.push(HashBasedTable.<Integer, Optional<Node<?>>, Key>create());
|
||||
Triple<Integer, Integer, Float> animData = null;
|
||||
Animation animation = null;
|
||||
Pair<Brush, List<Face>> mesh = null;
|
||||
List<Pair<Vertex, Float>> bone = null;
|
||||
Map<Integer, Key> keys = new HashMap<Integer, Key>();
|
||||
|
||||
Reference in new issue
Block a user