instance -> INSTANCE
This commit is contained in:
parent
286c8c05b7
commit
4b53f0716b
18 changed files with 95 additions and 99 deletions
|
@ -135,7 +135,7 @@ public class ForgeHooksClient
|
|||
public static void onTextureStitchedPre(TextureMap map)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new TextureStitchEvent.Pre(map));
|
||||
ModelLoader.White.instance.register(map);
|
||||
ModelLoader.White.INSTANCE.register(map);
|
||||
}
|
||||
|
||||
public static void onTextureStitchedPost(TextureMap map)
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableMap;
|
|||
|
||||
public final class ItemLayerModel implements IRetexturableModel
|
||||
{
|
||||
public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.<ResourceLocation>of());
|
||||
public static final ItemLayerModel INSTANCE = new ItemLayerModel(ImmutableList.<ResourceLocation>of());
|
||||
|
||||
private final ImmutableList<ResourceLocation> textures;
|
||||
private final ItemOverrideList overrides;
|
||||
|
@ -400,7 +400,7 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
|
||||
public static enum Loader implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {}
|
||||
|
||||
|
@ -414,7 +414,7 @@ public final class ItemLayerModel implements IRetexturableModel
|
|||
|
||||
public IModel loadModel(ResourceLocation modelLocation)
|
||||
{
|
||||
return ItemLayerModel.instance;
|
||||
return ItemLayerModel.INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ public final class ModelDynBucket implements IModel, IModelCustomData, IRetextur
|
|||
|
||||
public enum LoaderDynBucket implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation)
|
||||
|
|
|
@ -48,8 +48,8 @@ import com.google.gson.JsonParser;
|
|||
|
||||
public final class ModelFluid implements IModelCustomData
|
||||
{
|
||||
public static final ModelFluid waterModel = new ModelFluid(FluidRegistry.WATER);
|
||||
public static final ModelFluid lavaModel = new ModelFluid(FluidRegistry.LAVA);
|
||||
public static final ModelFluid WATER = new ModelFluid(FluidRegistry.WATER);
|
||||
public static final ModelFluid LAVA = new ModelFluid(FluidRegistry.LAVA);
|
||||
private final Fluid fluid;
|
||||
|
||||
public ModelFluid(Fluid fluid)
|
||||
|
@ -80,7 +80,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
|
||||
public static enum FluidLoader implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
|
||||
public IModel loadModel(ResourceLocation modelLocation)
|
||||
{
|
||||
return waterModel;
|
||||
return WATER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ public final class ModelFluid implements IModelCustomData
|
|||
if(!FluidRegistry.isFluidRegistered(fluid))
|
||||
{
|
||||
FMLLog.severe("fluid '%s' not found", fluid);
|
||||
return waterModel;
|
||||
return WATER;
|
||||
}
|
||||
return new ModelFluid(FluidRegistry.getFluid(fluid));
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ public final class ModelLoader extends ModelBakery
|
|||
public ModelLoader(IResourceManager manager, TextureMap map, BlockModelShapes shapes)
|
||||
{
|
||||
super(manager, map, shapes);
|
||||
VanillaLoader.instance.setLoader(this);
|
||||
VariantLoader.instance.setLoader(this);
|
||||
VanillaLoader.INSTANCE.setLoader(this);
|
||||
VariantLoader.INSTANCE.setLoader(this);
|
||||
ModelLoaderRegistry.clearModelCache(manager);
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ public final class ModelLoader extends ModelBakery
|
|||
}
|
||||
});
|
||||
|
||||
IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance);
|
||||
IBakedModel missingBaked = missingModel.bake(missingModel.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE);
|
||||
Map<IModel, IBakedModel> bakedModels = Maps.newHashMap();
|
||||
HashMultimap<IModel, ModelResourceLocation> models = HashMultimap.create();
|
||||
Multimaps.invertFrom(Multimaps.forMap(stateModels), models);
|
||||
|
@ -155,7 +155,7 @@ public final class ModelLoader extends ModelBakery
|
|||
}
|
||||
else
|
||||
{
|
||||
bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.instance));
|
||||
bakedModels.put(model, model.bake(model.getDefaultState(), DefaultVertexFormats.ITEM, DefaultTextureGetter.INSTANCE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,7 @@ public final class ModelLoader extends ModelBakery
|
|||
{
|
||||
try
|
||||
{
|
||||
missingModel = VanillaLoader.instance.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath()));
|
||||
missingModel = VanillaLoader.INSTANCE.loadModel(new ResourceLocation(MODEL_MISSING.getResourceDomain(), MODEL_MISSING.getResourcePath()));
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -783,7 +783,7 @@ public final class ModelLoader extends ModelBakery
|
|||
|
||||
protected static enum VanillaLoader implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
private ModelLoader loader;
|
||||
|
||||
|
@ -821,7 +821,7 @@ public final class ModelLoader extends ModelBakery
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "VanillaLoader.instance";
|
||||
return "VanillaLoader.INSTANCE";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -830,12 +830,12 @@ public final class ModelLoader extends ModelBakery
|
|||
*/
|
||||
public static final class White extends TextureAtlasSprite
|
||||
{
|
||||
public static ResourceLocation loc = new ResourceLocation("white");
|
||||
public static White instance = new White();
|
||||
public static ResourceLocation LOCATION = new ResourceLocation("white");
|
||||
public static White INSTANCE = new White();
|
||||
|
||||
private White()
|
||||
{
|
||||
super(loc.toString());
|
||||
super(LOCATION.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -861,7 +861,7 @@ public final class ModelLoader extends ModelBakery
|
|||
|
||||
public void register(TextureMap map)
|
||||
{
|
||||
map.setTextureEntry(White.loc.toString(), White.instance);
|
||||
map.setTextureEntry(White.LOCATION.toString(), White.INSTANCE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1051,7 +1051,7 @@ public final class ModelLoader extends ModelBakery
|
|||
|
||||
private static enum DefaultTextureGetter implements Function<ResourceLocation, TextureAtlasSprite>
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public TextureAtlasSprite apply(ResourceLocation location)
|
||||
{
|
||||
|
@ -1064,12 +1064,12 @@ public final class ModelLoader extends ModelBakery
|
|||
*/
|
||||
public static Function<ResourceLocation, TextureAtlasSprite> defaultTextureGetter()
|
||||
{
|
||||
return DefaultTextureGetter.instance;
|
||||
return DefaultTextureGetter.INSTANCE;
|
||||
}
|
||||
|
||||
protected static enum VariantLoader implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
private ModelLoader loader;
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ public final class ModelLoader extends ModelBakery
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "VariantLoader.instance";
|
||||
return "VariantLoader.INSTANCE";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,12 @@ public class ModelLoaderRegistry
|
|||
// Forge built-in loaders
|
||||
static
|
||||
{
|
||||
registerLoader(B3DLoader.instance);
|
||||
registerLoader(OBJLoader.instance);
|
||||
registerLoader(ModelFluid.FluidLoader.instance);
|
||||
registerLoader(ItemLayerModel.Loader.instance);
|
||||
registerLoader(MultiLayerModel.Loader.instance);
|
||||
registerLoader(ModelDynBucket.LoaderDynBucket.instance);
|
||||
registerLoader(B3DLoader.INSTANCE);
|
||||
registerLoader(OBJLoader.INSTANCE);
|
||||
registerLoader(ModelFluid.FluidLoader.INSTANCE);
|
||||
registerLoader(ItemLayerModel.Loader.INSTANCE);
|
||||
registerLoader(MultiLayerModel.Loader.INSTANCE);
|
||||
registerLoader(ModelDynBucket.LoaderDynBucket.INSTANCE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -111,13 +111,13 @@ public class ModelLoaderRegistry
|
|||
// no custom loaders found, try vanilla ones
|
||||
if(accepted == null)
|
||||
{
|
||||
if(VariantLoader.instance.accepts(actual))
|
||||
if(VariantLoader.INSTANCE.accepts(actual))
|
||||
{
|
||||
accepted = VariantLoader.instance;
|
||||
accepted = VariantLoader.INSTANCE;
|
||||
}
|
||||
else if(VanillaLoader.instance.accepts(actual))
|
||||
else if(VanillaLoader.INSTANCE.accepts(actual))
|
||||
{
|
||||
accepted = VanillaLoader.instance;
|
||||
accepted = VanillaLoader.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ public class ModelLoaderRegistry
|
|||
|
||||
public static IModel getMissingModel()
|
||||
{
|
||||
return ModelLoader.VanillaLoader.instance.getLoader().getMissingModel();
|
||||
return ModelLoader.VanillaLoader.INSTANCE.getLoader().getMissingModel();
|
||||
}
|
||||
|
||||
public static void clearModelCache(IResourceManager manager)
|
||||
|
@ -200,9 +200,9 @@ public class ModelLoaderRegistry
|
|||
ModelLoaderRegistry.manager = manager;
|
||||
cache.clear();
|
||||
// putting the builtin models in
|
||||
cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.instance);
|
||||
cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.instance);
|
||||
cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.instance);
|
||||
cache.put(new ResourceLocation("minecraft:builtin/generated"), ItemLayerModel.INSTANCE);
|
||||
cache.put(new ResourceLocation("minecraft:block/builtin/generated"), ItemLayerModel.INSTANCE);
|
||||
cache.put(new ResourceLocation("minecraft:item/builtin/generated"), ItemLayerModel.INSTANCE);
|
||||
}
|
||||
|
||||
static Iterable<ResourceLocation> getTextures()
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.google.gson.JsonParser;
|
|||
|
||||
public final class MultiLayerModel implements IModelCustomData
|
||||
{
|
||||
public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap.<Optional<BlockRenderLayer>, ModelResourceLocation>of());
|
||||
public static final MultiLayerModel INSTANCE = new MultiLayerModel(ImmutableMap.<Optional<BlockRenderLayer>, ModelResourceLocation>of());
|
||||
|
||||
private final ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models;
|
||||
|
||||
|
@ -102,7 +102,7 @@ public final class MultiLayerModel implements IModelCustomData
|
|||
}
|
||||
}
|
||||
ImmutableMap<Optional<BlockRenderLayer>, ModelResourceLocation> models = builder.build();
|
||||
if(models.isEmpty()) return instance;
|
||||
if(models.isEmpty()) return INSTANCE;
|
||||
return new MultiLayerModel(models);
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ public final class MultiLayerModel implements IModelCustomData
|
|||
|
||||
public static enum Loader implements ICustomModelLoader
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager) {}
|
||||
|
||||
|
@ -237,7 +237,7 @@ public final class MultiLayerModel implements IModelCustomData
|
|||
|
||||
public IModel loadModel(ResourceLocation modelLocation)
|
||||
{
|
||||
return MultiLayerModel.instance;
|
||||
return MultiLayerModel.INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -170,7 +170,7 @@ public class ModelBlockAnimation
|
|||
MBJointClip clip = jointClips.get(mbJoint.getName());
|
||||
if(clip != null) return clip;
|
||||
}
|
||||
return JointClips.IdentityJointClip.instance;
|
||||
return JointClips.IdentityJointClip.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,13 +15,13 @@ import com.google.common.collect.ImmutableSet;
|
|||
// FIXME: is this fast enough?
|
||||
public enum B3DClip implements IClip
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public IJointClip apply(final IJoint joint)
|
||||
{
|
||||
if(!(joint instanceof NodeJoint))
|
||||
{
|
||||
return JointClips.IdentityJointClip.instance;
|
||||
return JointClips.IdentityJointClip.INSTANCE;
|
||||
}
|
||||
return new NodeClip(((NodeJoint)joint).getNode());
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ import com.google.gson.JsonParser;
|
|||
* To enable for your mod call instance.addDomain(modid).
|
||||
* If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry.
|
||||
*/
|
||||
public final class B3DLoader implements ICustomModelLoader
|
||||
public enum B3DLoader implements ICustomModelLoader
|
||||
{
|
||||
public static final B3DLoader instance = new B3DLoader();
|
||||
INSTANCE;
|
||||
|
||||
private IResourceManager manager;
|
||||
|
||||
|
@ -366,7 +366,7 @@ public final class B3DLoader implements ICustomModelLoader
|
|||
|
||||
public static enum B3DFrameProperty implements IUnlistedProperty<B3DState>
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
public String getName()
|
||||
{
|
||||
return "B3DFrame";
|
||||
|
@ -548,7 +548,7 @@ public final class B3DLoader implements ICustomModelLoader
|
|||
{
|
||||
if(name.equals("main"))
|
||||
{
|
||||
return Optional.<IClip>of(B3DClip.instance);
|
||||
return Optional.<IClip>of(B3DClip.INSTANCE);
|
||||
}
|
||||
return Optional.absent();
|
||||
}
|
||||
|
@ -633,9 +633,9 @@ public final class B3DLoader implements ICustomModelLoader
|
|||
if(state instanceof IExtendedBlockState)
|
||||
{
|
||||
IExtendedBlockState exState = (IExtendedBlockState)state;
|
||||
if(exState.getUnlistedNames().contains(B3DFrameProperty.instance))
|
||||
if(exState.getUnlistedNames().contains(B3DFrameProperty.INSTANCE))
|
||||
{
|
||||
B3DState s = exState.getValue(B3DFrameProperty.instance);
|
||||
B3DState s = exState.getValue(B3DFrameProperty.INSTANCE);
|
||||
if(s != null)
|
||||
{
|
||||
//return getCachedModel(s.getFrame());
|
||||
|
@ -727,7 +727,7 @@ public final class B3DLoader implements ICustomModelLoader
|
|||
if(f.getBrush() != null) textures = f.getBrush().getTextures();
|
||||
TextureAtlasSprite sprite;
|
||||
if(textures == null || textures.isEmpty()) sprite = this.textures.get("missingno");
|
||||
else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.instance;
|
||||
else if(textures.get(0) == B3DModel.Texture.White) sprite = ModelLoader.White.INSTANCE;
|
||||
else sprite = this.textures.get(textures.get(0).getPath());
|
||||
quadBuilder.setTexture(sprite);
|
||||
putVertexData(quadBuilder, f.getV1(), f.getNormal(), sprite);
|
||||
|
|
|
@ -21,8 +21,9 @@ import org.apache.logging.log4j.Level;
|
|||
* To enable your mod call instance.addDomain(modid).
|
||||
* If you need more control over accepted resources - extend the class, and register a new instance with ModelLoaderRegistry.
|
||||
*/
|
||||
public final class OBJLoader implements ICustomModelLoader {
|
||||
public static final OBJLoader instance = new OBJLoader();
|
||||
public enum OBJLoader implements ICustomModelLoader {
|
||||
INSTANCE;
|
||||
|
||||
private IResourceManager manager;
|
||||
private final Set<String> enabledDomains = new HashSet<String>();
|
||||
private final Map<ResourceLocation, OBJModel> cache = new HashMap<ResourceLocation, OBJModel>();
|
||||
|
|
|
@ -101,7 +101,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
|
|||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
{
|
||||
ImmutableMap.Builder<String, TextureAtlasSprite> builder = ImmutableMap.builder();
|
||||
builder.put(ModelLoader.White.loc.toString(), ModelLoader.White.instance);
|
||||
builder.put(ModelLoader.White.LOCATION.toString(), ModelLoader.White.INSTANCE);
|
||||
TextureAtlasSprite missing = bakedTextureGetter.apply(new ResourceLocation("missingno"));
|
||||
for (Map.Entry<String, Material> e : matLib.materials.entrySet())
|
||||
{
|
||||
|
@ -1278,7 +1278,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
|
|||
|
||||
public enum OBJProperty implements IUnlistedProperty<OBJState>
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
public String getName()
|
||||
{
|
||||
return "OBJPropery";
|
||||
|
@ -1310,7 +1310,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
|
|||
private final VertexFormat format;
|
||||
private Set<BakedQuad> quads;
|
||||
private ImmutableMap<String, TextureAtlasSprite> textures;
|
||||
private TextureAtlasSprite sprite = ModelLoader.White.instance;
|
||||
private TextureAtlasSprite sprite = ModelLoader.White.INSTANCE;
|
||||
|
||||
public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap<String, TextureAtlasSprite> textures)
|
||||
{
|
||||
|
@ -1399,7 +1399,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData
|
|||
v.setMaterial(this.model.getMatLib().getMaterial(v.getMaterial().getName()));
|
||||
}
|
||||
}
|
||||
sprite = ModelLoader.White.instance;
|
||||
sprite = ModelLoader.White.INSTANCE;
|
||||
} else sprite = this.textures.get(f.getMaterialName());
|
||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder(format);
|
||||
builder.setQuadOrientation(EnumFacing.getFacingFromVector(f.getNormal().x, f.getNormal().y, f.getNormal().z));
|
||||
|
|
|
@ -23,7 +23,7 @@ public final class TimeValues
|
|||
{
|
||||
public static enum IdentityValue implements ITimeValue, IStringSerializable
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public float apply(float input)
|
||||
{
|
||||
|
@ -352,7 +352,7 @@ public final class TimeValues
|
|||
String string = in.nextString();
|
||||
if(string.equals("#identity"))
|
||||
{
|
||||
return IdentityValue.instance;
|
||||
return IdentityValue.INSTANCE;
|
||||
}
|
||||
if(!string.startsWith("#"))
|
||||
{
|
||||
|
|
|
@ -206,7 +206,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine
|
|||
|
||||
private static final AnimationStateMachine missing = new AnimationStateMachine(
|
||||
ImmutableMap.<String, ITimeValue>of(),
|
||||
ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance),
|
||||
ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.INSTANCE),
|
||||
ImmutableList.of("missingno"),
|
||||
ImmutableMap.<String, String>of(),
|
||||
"missingno");
|
||||
|
|
|
@ -44,11 +44,11 @@ public final class Clips
|
|||
*/
|
||||
public static enum IdentityClip implements IClip, IStringSerializable
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public IJointClip apply(IJoint joint)
|
||||
{
|
||||
return JointClips.IdentityJointClip.instance;
|
||||
return JointClips.IdentityJointClip.INSTANCE;
|
||||
}
|
||||
|
||||
public Iterable<Event> pastEvents(float lastPollTime, float time)
|
||||
|
@ -79,7 +79,7 @@ public final class Clips
|
|||
FMLLog.getLogger().error("Unable to find clip " + clipName + " in the model " + modelLocation);
|
||||
}
|
||||
// FIXME: missing clip?
|
||||
return new ModelClip(IdentityClip.instance, modelLocation, clipName);
|
||||
return new ModelClip(IdentityClip.INSTANCE, modelLocation, clipName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -502,7 +502,7 @@ public final class Clips
|
|||
// IdentityClip
|
||||
if(string.equals("#identity"))
|
||||
{
|
||||
return IdentityClip.instance;
|
||||
return IdentityClip.INSTANCE;
|
||||
}
|
||||
// Clip reference
|
||||
if(string.startsWith("#"))
|
||||
|
|
|
@ -9,7 +9,7 @@ public final class JointClips
|
|||
{
|
||||
public static enum IdentityJointClip implements IJointClip
|
||||
{
|
||||
instance;
|
||||
INSTANCE;
|
||||
|
||||
public TRSRTransformation apply(float time)
|
||||
{
|
||||
|
|
|
@ -178,7 +178,7 @@ public class ModelAnimationDebug
|
|||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
super.preInit(event);
|
||||
B3DLoader.instance.addDomain(MODID);
|
||||
B3DLoader.INSTANCE.addDomain(MODID);
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(GameRegistry.findBlock(MODID, blockName)), 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + blockName, "inventory"));
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(Chest.class, new AnimationTESR<Chest>()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package net.minecraftforge.debug;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -20,7 +19,6 @@ import net.minecraft.block.properties.PropertyDirection;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -28,13 +26,13 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
|
@ -43,7 +41,6 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
|||
import net.minecraftforge.client.model.b3d.B3DLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.client.model.obj.OBJModel;
|
||||
import net.minecraftforge.client.model.obj.OBJModel.OBJBakedModel;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
@ -54,9 +51,7 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
|
|||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@Mod(modid = ModelLoaderRegistryDebug.MODID, version = ModelLoaderRegistryDebug.VERSION)
|
||||
|
@ -71,33 +66,33 @@ public class ModelLoaderRegistryDebug
|
|||
GameRegistry.registerBlock(CustomModelBlock.instance, CustomModelBlock.name);
|
||||
GameRegistry.registerBlock(OBJTesseractBlock.instance, OBJTesseractBlock.name);
|
||||
GameRegistry.registerBlock(OBJVertexColoring1.instance, OBJVertexColoring1.name);
|
||||
GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name);
|
||||
//GameRegistry.registerBlock(OBJDirectionEye.instance, OBJDirectionEye.name);
|
||||
GameRegistry.registerBlock(OBJVertexColoring2.instance, OBJVertexColoring2.name);
|
||||
GameRegistry.registerBlock(OBJDirectionBlock.instance, OBJDirectionBlock.name);
|
||||
GameRegistry.registerBlock(OBJCustomDataBlock.instance, OBJCustomDataBlock.name);
|
||||
GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name);
|
||||
//GameRegistry.registerBlock(OBJDynamicEye.instance, OBJDynamicEye.name);
|
||||
GameRegistry.registerTileEntity(OBJTesseractTileEntity.class, OBJTesseractBlock.name);
|
||||
GameRegistry.registerTileEntity(OBJVertexColoring2TileEntity.class, OBJVertexColoring2.name);
|
||||
GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name);
|
||||
//GameRegistry.registerTileEntity(OBJDynamicEyeTileEntity.class, OBJDynamicEye.name);
|
||||
if (event.getSide() == Side.CLIENT)
|
||||
clientPreInit();
|
||||
}
|
||||
|
||||
private void clientPreInit()
|
||||
{
|
||||
B3DLoader.instance.addDomain(MODID.toLowerCase());
|
||||
B3DLoader.INSTANCE.addDomain(MODID.toLowerCase());
|
||||
Item item = Item.getItemFromBlock(CustomModelBlock.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + CustomModelBlock.name, "inventory"));
|
||||
|
||||
OBJLoader.instance.addDomain(MODID.toLowerCase());
|
||||
OBJLoader.INSTANCE.addDomain(MODID.toLowerCase());
|
||||
Item item2 = Item.getItemFromBlock(OBJTesseractBlock.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item2, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJTesseractBlock.name, "inventory"));
|
||||
|
||||
Item item3 = Item.getItemFromBlock(OBJVertexColoring1.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item3, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring1.name, "inventory"));
|
||||
|
||||
Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory"));
|
||||
//Item item4 = Item.getItemFromBlock(OBJDirectionEye.instance);
|
||||
//ModelLoader.setCustomModelResourceLocation(item4, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDirectionEye.name, "inventory"));
|
||||
|
||||
Item item5 = Item.getItemFromBlock(OBJVertexColoring2.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item5, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJVertexColoring2.name, "inventory"));
|
||||
|
@ -108,8 +103,8 @@ public class ModelLoaderRegistryDebug
|
|||
Item item7 = Item.getItemFromBlock(OBJCustomDataBlock.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item7, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJCustomDataBlock.name, "inventory"));
|
||||
|
||||
Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance);
|
||||
ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory"));
|
||||
//Item item8 = Item.getItemFromBlock(OBJDynamicEye.instance);
|
||||
//ModelLoader.setCustomModelResourceLocation(item8, 0, new ModelResourceLocation(MODID.toLowerCase() + ":" + OBJDynamicEye.name, "inventory"));
|
||||
}
|
||||
|
||||
public static class CustomModelBlock extends Block
|
||||
|
@ -118,7 +113,7 @@ public class ModelLoaderRegistryDebug
|
|||
public static final CustomModelBlock instance = new CustomModelBlock();
|
||||
public static final String name = "CustomModelBlock";
|
||||
private int counter = 1;
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.instance});
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.INSTANCE});
|
||||
|
||||
private CustomModelBlock()
|
||||
{
|
||||
|
@ -160,7 +155,7 @@ public class ModelLoaderRegistryDebug
|
|||
{
|
||||
//Only return an IExtendedBlockState from this method and createState(), otherwise block placement might break!
|
||||
B3DLoader.B3DState newState = new B3DLoader.B3DState(null, counter);
|
||||
return ((IExtendedBlockState) state).withProperty(B3DLoader.B3DFrameProperty.instance, newState);
|
||||
return ((IExtendedBlockState) state).withProperty(B3DLoader.B3DFrameProperty.INSTANCE, newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -180,7 +175,7 @@ public class ModelLoaderRegistryDebug
|
|||
@Override
|
||||
public BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.instance});
|
||||
return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{B3DLoader.B3DFrameProperty.INSTANCE});
|
||||
}
|
||||
|
||||
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
|
||||
|
@ -218,7 +213,7 @@ public class ModelLoaderRegistryDebug
|
|||
{
|
||||
public static final OBJTesseractBlock instance = new OBJTesseractBlock();
|
||||
public static final String name = "OBJTesseractBlock";
|
||||
private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.instance});
|
||||
private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE});
|
||||
|
||||
private OBJTesseractBlock()
|
||||
{
|
||||
|
@ -247,7 +242,7 @@ public class ModelLoaderRegistryDebug
|
|||
{
|
||||
OBJTesseractTileEntity tileEntity = (OBJTesseractTileEntity) world.getTileEntity(pos);
|
||||
OBJModel.OBJState retState = new OBJModel.OBJState(tileEntity == null ? Lists.newArrayList(OBJModel.Group.ALL) : tileEntity.visible, true);
|
||||
return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.instance, retState);
|
||||
return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.INSTANCE, retState);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -395,7 +390,7 @@ public class ModelLoaderRegistryDebug
|
|||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final OBJDirectionEye instance = new OBJDirectionEye();
|
||||
public static final String name = "OBJDirectionEye";
|
||||
private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance});
|
||||
private ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE});
|
||||
|
||||
private OBJDirectionEye()
|
||||
{
|
||||
|
@ -426,7 +421,7 @@ public class ModelLoaderRegistryDebug
|
|||
@Override
|
||||
public BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[] {OBJModel.OBJProperty.instance});
|
||||
return new ExtendedBlockState(this, new IProperty[] {FACING}, new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -444,7 +439,7 @@ public class ModelLoaderRegistryDebug
|
|||
EnumFacing facing = (EnumFacing) state.getValue(FACING);
|
||||
TRSRTransformation transform = new TRSRTransformation(facing);
|
||||
OBJModel.OBJState retState = new OBJModel.OBJState(Arrays.asList(new String[]{OBJModel.Group.ALL}), true, transform);
|
||||
return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, retState);
|
||||
return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.INSTANCE, retState);
|
||||
}
|
||||
|
||||
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
|
||||
|
@ -579,7 +574,7 @@ public class ModelLoaderRegistryDebug
|
|||
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||
public static final OBJDirectionBlock instance = new OBJDirectionBlock();
|
||||
public static final String name = "OBJDirectionBlock";
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance});
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE});
|
||||
|
||||
private OBJDirectionBlock()
|
||||
{
|
||||
|
@ -623,13 +618,13 @@ public class ModelLoaderRegistryDebug
|
|||
EnumFacing facing = (EnumFacing) state.getValue(FACING);
|
||||
TRSRTransformation transform = new TRSRTransformation(facing);
|
||||
OBJModel.OBJState newState = new OBJModel.OBJState(Lists.newArrayList(OBJModel.Group.ALL), true, transform);
|
||||
return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.instance, newState);
|
||||
return ((IExtendedBlockState) state).withProperty(OBJModel.OBJProperty.INSTANCE, newState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.instance});
|
||||
return new ExtendedBlockState(this, new IProperty[]{FACING}, new IUnlistedProperty[]{OBJModel.OBJProperty.INSTANCE});
|
||||
}
|
||||
|
||||
public static EnumFacing getFacingFromEntity(World worldIn, BlockPos clickedBlock, EntityLivingBase entityIn)
|
||||
|
@ -723,7 +718,7 @@ public class ModelLoaderRegistryDebug
|
|||
{
|
||||
public static final OBJDynamicEye instance = new OBJDynamicEye();
|
||||
public static final String name = "OBJDynamicEye";
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.instance});
|
||||
public ExtendedBlockState state = new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE});
|
||||
private OBJDynamicEye()
|
||||
{
|
||||
super(Material.iron);
|
||||
|
@ -763,7 +758,7 @@ public class ModelLoaderRegistryDebug
|
|||
OBJDynamicEyeTileEntity te = (OBJDynamicEyeTileEntity) world.getTileEntity(pos);
|
||||
if (te.state != null)
|
||||
{
|
||||
return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.instance, te.state);
|
||||
return ((IExtendedBlockState) this.state.getBaseState()).withProperty(OBJModel.OBJProperty.INSTANCE, te.state);
|
||||
}
|
||||
}
|
||||
return state;
|
||||
|
@ -772,7 +767,7 @@ public class ModelLoaderRegistryDebug
|
|||
@Override
|
||||
public BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.instance});
|
||||
return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[] {OBJModel.OBJProperty.INSTANCE});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue