From 4b53f0716b3b33a70f51fabe8a0c72cedded2087 Mon Sep 17 00:00:00 2001 From: RainWarrior Date: Mon, 21 Mar 2016 10:23:27 +0300 Subject: [PATCH] instance -> INSTANCE --- .../client/ForgeHooksClient.java | 2 +- .../client/model/ItemLayerModel.java | 6 +- .../client/model/ModelDynBucket.java | 2 +- .../client/model/ModelFluid.java | 10 ++-- .../client/model/ModelLoader.java | 30 +++++----- .../client/model/ModelLoaderRegistry.java | 28 ++++----- .../client/model/MultiLayerModel.java | 8 +-- .../model/animation/ModelBlockAnimation.java | 2 +- .../client/model/b3d/B3DClip.java | 4 +- .../client/model/b3d/B3DLoader.java | 14 ++--- .../client/model/obj/OBJLoader.java | 5 +- .../client/model/obj/OBJModel.java | 8 +-- .../common/animation/TimeValues.java | 4 +- .../animation/AnimationStateMachine.java | 2 +- .../common/model/animation/Clips.java | 8 +-- .../common/model/animation/JointClips.java | 2 +- .../debug/ModelAnimationDebug.java | 2 +- .../debug/ModelLoaderRegistryDebug.java | 57 +++++++++---------- 18 files changed, 95 insertions(+), 99 deletions(-) diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 80f7942bd..de9c86dde 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -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) diff --git a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java index a1f9bce91..7483baa75 100644 --- a/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/ItemLayerModel.java @@ -34,7 +34,7 @@ import com.google.common.collect.ImmutableMap; public final class ItemLayerModel implements IRetexturableModel { - public static final ItemLayerModel instance = new ItemLayerModel(ImmutableList.of()); + public static final ItemLayerModel INSTANCE = new ItemLayerModel(ImmutableList.of()); private final ImmutableList 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; } } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java index 5e035d794..90037fc10 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java +++ b/src/main/java/net/minecraftforge/client/model/ModelDynBucket.java @@ -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) diff --git a/src/main/java/net/minecraftforge/client/model/ModelFluid.java b/src/main/java/net/minecraftforge/client/model/ModelFluid.java index 5faa87258..6767265ac 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelFluid.java +++ b/src/main/java/net/minecraftforge/client/model/ModelFluid.java @@ -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)); } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoader.java b/src/main/java/net/minecraftforge/client/model/ModelLoader.java index 3b4a706ef..6f0e62bf8 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoader.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoader.java @@ -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 bakedModels = Maps.newHashMap(); HashMultimap 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 { - instance; + INSTANCE; public TextureAtlasSprite apply(ResourceLocation location) { @@ -1064,12 +1064,12 @@ public final class ModelLoader extends ModelBakery */ public static Function 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"; } } diff --git a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java index 4d0e6e33a..664fb4893 100644 --- a/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java +++ b/src/main/java/net/minecraftforge/client/model/ModelLoaderRegistry.java @@ -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 getTextures() diff --git a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java index d82f5fb89..80e0d4caf 100644 --- a/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java +++ b/src/main/java/net/minecraftforge/client/model/MultiLayerModel.java @@ -34,7 +34,7 @@ import com.google.gson.JsonParser; public final class MultiLayerModel implements IModelCustomData { - public static final MultiLayerModel instance = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); + public static final MultiLayerModel INSTANCE = new MultiLayerModel(ImmutableMap., ModelResourceLocation>of()); private final ImmutableMap, ModelResourceLocation> models; @@ -102,7 +102,7 @@ public final class MultiLayerModel implements IModelCustomData } } ImmutableMap, 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; } } } diff --git a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java index 792d83eaa..8ecae3906 100644 --- a/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java +++ b/src/main/java/net/minecraftforge/client/model/animation/ModelBlockAnimation.java @@ -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 diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java index dc667ee0a..a8b640e5d 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DClip.java @@ -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()); } diff --git a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java index 4eeefef5a..bd499275d 100644 --- a/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java +++ b/src/main/java/net/minecraftforge/client/model/b3d/B3DLoader.java @@ -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 { - instance; + INSTANCE; public String getName() { return "B3DFrame"; @@ -548,7 +548,7 @@ public final class B3DLoader implements ICustomModelLoader { if(name.equals("main")) { - return Optional.of(B3DClip.instance); + return Optional.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); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java index a84b680f6..b398fbaee 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJLoader.java @@ -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 enabledDomains = new HashSet(); private final Map cache = new HashMap(); diff --git a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java index 0d6186fed..86b3fd44f 100644 --- a/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java +++ b/src/main/java/net/minecraftforge/client/model/obj/OBJModel.java @@ -101,7 +101,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData public IBakedModel bake(IModelState state, VertexFormat format, Function bakedTextureGetter) { ImmutableMap.Builder 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 e : matLib.materials.entrySet()) { @@ -1278,7 +1278,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData public enum OBJProperty implements IUnlistedProperty { - instance; + INSTANCE; public String getName() { return "OBJPropery"; @@ -1310,7 +1310,7 @@ public class OBJModel implements IRetexturableModel, IModelCustomData private final VertexFormat format; private Set quads; private ImmutableMap textures; - private TextureAtlasSprite sprite = ModelLoader.White.instance; + private TextureAtlasSprite sprite = ModelLoader.White.INSTANCE; public OBJBakedModel(OBJModel model, IModelState state, VertexFormat format, ImmutableMap 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)); diff --git a/src/main/java/net/minecraftforge/common/animation/TimeValues.java b/src/main/java/net/minecraftforge/common/animation/TimeValues.java index d289cc744..74811384b 100644 --- a/src/main/java/net/minecraftforge/common/animation/TimeValues.java +++ b/src/main/java/net/minecraftforge/common/animation/TimeValues.java @@ -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("#")) { diff --git a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java index 29b8d964d..6418b0c5c 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java +++ b/src/main/java/net/minecraftforge/common/model/animation/AnimationStateMachine.java @@ -206,7 +206,7 @@ public final class AnimationStateMachine implements IAnimationStateMachine private static final AnimationStateMachine missing = new AnimationStateMachine( ImmutableMap.of(), - ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.instance), + ImmutableMap.of("missingno", (IClip)Clips.IdentityClip.INSTANCE), ImmutableList.of("missingno"), ImmutableMap.of(), "missingno"); diff --git a/src/main/java/net/minecraftforge/common/model/animation/Clips.java b/src/main/java/net/minecraftforge/common/model/animation/Clips.java index 4fab7d4e1..7f588db04 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/Clips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/Clips.java @@ -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 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("#")) diff --git a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java index 8e449a4fd..df64bec1e 100644 --- a/src/main/java/net/minecraftforge/common/model/animation/JointClips.java +++ b/src/main/java/net/minecraftforge/common/model/animation/JointClips.java @@ -9,7 +9,7 @@ public final class JointClips { public static enum IdentityJointClip implements IJointClip { - instance; + INSTANCE; public TRSRTransformation apply(float time) { diff --git a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java index 3cf9a6a76..727e1e9b9 100644 --- a/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelAnimationDebug.java @@ -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() { diff --git a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java index 94bfd2341..e59bea46f 100644 --- a/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java +++ b/src/test/java/net/minecraftforge/debug/ModelLoaderRegistryDebug.java @@ -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}); } }