Model UV lock handling from the state to the model, fixed most compile errors in ModelLoader, disabled it (and ModelBakeEvent) until it's functional, fixed some errors in ForgeHooksClient.
This commit is contained in:
parent
70670d70ea
commit
3e22a2b90d
10 changed files with 131 additions and 112 deletions
|
@ -1,14 +1,15 @@
|
|||
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java
|
||||
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java
|
||||
@@ -24,9 +24,10 @@
|
||||
@@ -24,9 +24,11 @@
|
||||
|
||||
public void onResourceManagerReload(IResourceManager resourceManager)
|
||||
{
|
||||
- ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider);
|
||||
+ ModelBakery modelbakery = new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider);
|
||||
+ // FIXME: reenable after ModelLoader is fixed
|
||||
+ ModelBakery modelbakery = new ModelBakery(resourceManager, this.texMap, this.modelProvider); //new net.minecraftforge.client.model.ModelLoader(resourceManager, this.texMap, this.modelProvider);
|
||||
this.modelRegistry = modelbakery.setupModelRegistry();
|
||||
this.defaultModel = (IBakedModel)this.modelRegistry.getObject(ModelBakery.MODEL_MISSING);
|
||||
+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery);
|
||||
+ //net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.modelRegistry, modelbakery);
|
||||
this.modelProvider.reloadModels();
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,6 @@ import net.minecraftforge.client.event.RenderHandEvent;
|
|||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
import net.minecraftforge.client.model.IFlexibleBakedModel;
|
||||
import net.minecraftforge.client.model.IModelPart;
|
||||
import net.minecraftforge.client.model.IPerspectiveAwareModel;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
@ -356,11 +355,10 @@ public class ForgeHooksClient
|
|||
}
|
||||
*/
|
||||
|
||||
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelBakery modelBakery)
|
||||
public static void onModelBake(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
|
||||
{
|
||||
ModelLoader loader = (ModelLoader)modelBakery;
|
||||
MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, loader));
|
||||
loader.onPostBakeEvent(modelRegistry);
|
||||
MinecraftForge.EVENT_BUS.post(new ModelBakeEvent(modelManager, modelRegistry, modelLoader));
|
||||
modelLoader.onPostBakeEvent(modelRegistry);
|
||||
}
|
||||
|
||||
public static Matrix4f getMatrix(ItemTransformVec3f transform)
|
||||
|
@ -389,7 +387,7 @@ public class ForgeHooksClient
|
|||
{
|
||||
if(model instanceof IPerspectiveAwareModel)
|
||||
{
|
||||
Pair<? extends IFlexibleBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);
|
||||
Pair<? extends IBakedModel, Matrix4f> pair = ((IPerspectiveAwareModel)model).handlePerspective(cameraTransformType);
|
||||
|
||||
if(pair.getRight() != null) multiplyCurrentGlMatrix(pair.getRight());
|
||||
return pair.getLeft();
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelManager;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
|
@ -12,25 +11,32 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
|||
* Fired when the ModelManager is notified of the resource manager reloading.
|
||||
* Called after model registry is setup, but before it's passed to BlockModelShapes.
|
||||
*/
|
||||
// TODO: try to merge with ICustomModelLoader
|
||||
public class ModelBakeEvent extends Event
|
||||
{
|
||||
public final ModelManager modelManager;
|
||||
public final IRegistry<ModelResourceLocation, IBakedModel> modelRegistry;
|
||||
@Deprecated
|
||||
public final ModelBakery modelBakery;
|
||||
public final ModelLoader modelLoader;
|
||||
|
||||
@Deprecated
|
||||
public ModelBakeEvent(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelBakery modelBakery)
|
||||
{
|
||||
this(modelManager, modelRegistry, (ModelLoader)modelBakery);
|
||||
}
|
||||
private final ModelManager modelManager;
|
||||
private final IRegistry<ModelResourceLocation, IBakedModel> modelRegistry;
|
||||
private final ModelLoader modelLoader;
|
||||
|
||||
public ModelBakeEvent(ModelManager modelManager, IRegistry<ModelResourceLocation, IBakedModel> modelRegistry, ModelLoader modelLoader)
|
||||
{
|
||||
this.modelManager = modelManager;
|
||||
this.modelRegistry = modelRegistry;
|
||||
this.modelBakery = modelLoader;
|
||||
this.modelLoader = modelLoader;
|
||||
}
|
||||
|
||||
public ModelManager getModelManager()
|
||||
{
|
||||
return modelManager;
|
||||
}
|
||||
|
||||
public IRegistry<ModelResourceLocation, IBakedModel> getModelRegistry()
|
||||
{
|
||||
return modelRegistry;
|
||||
}
|
||||
|
||||
public ModelLoader getModelLoader()
|
||||
{
|
||||
return modelLoader;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,12 +146,13 @@ public class BlockStateLoader
|
|||
this.gui3d = gui3d;
|
||||
}
|
||||
|
||||
private IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, ImmutableMap<String, String> textureMap, ImmutableMap<String, String> customData)
|
||||
private IModel runModelHooks(IModel base, boolean smooth, boolean gui3d, boolean uvlock, ImmutableMap<String, String> textureMap, ImmutableMap<String, String> customData)
|
||||
{
|
||||
base = ModelProcessingHelper.customData(base, customData);
|
||||
base = ModelProcessingHelper.retexture(base, textureMap);
|
||||
base = ModelProcessingHelper.smoothLighting(base, smooth);
|
||||
base = ModelProcessingHelper.gui3d(base, gui3d);
|
||||
base = ModelProcessingHelper.uvlock(base, uvlock);
|
||||
return base;
|
||||
}
|
||||
|
||||
|
@ -166,7 +167,7 @@ public class BlockStateLoader
|
|||
|
||||
if (hasBase)
|
||||
{
|
||||
base = runModelHooks(base, smooth, gui3d, textures, customData);
|
||||
base = runModelHooks(base, smooth, gui3d, this.func_188049_c(), textures, customData);
|
||||
|
||||
if (size <= 0)
|
||||
return base;
|
||||
|
@ -193,9 +194,8 @@ public class BlockStateLoader
|
|||
}
|
||||
|
||||
IModelState partState = new ModelStateComposition(baseTr, part.getState());
|
||||
if (part.isUVLock()) partState = new ModelLoader.UVLock(partState);
|
||||
|
||||
models.put(entry.getKey(), Pair.<IModel, IModelState>of(runModelHooks(model, part.smooth, part.gui3d, part.getTextures(), part.getCustomData()), partState));
|
||||
models.put(entry.getKey(), Pair.<IModel, IModelState>of(runModelHooks(model, part.smooth, part.gui3d, part.uvLock, part.getTextures(), part.getCustomData()), partState));
|
||||
}
|
||||
|
||||
return new MultiModel(func_188046_a(), hasBase ? base : null, baseTr, models.build());
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
package net.minecraftforge.client.model;
|
||||
|
||||
public interface IModelUVLock extends IModel
|
||||
{
|
||||
public IModel uvlock(boolean value);
|
||||
}
|
|
@ -17,12 +17,14 @@ import java.util.Set;
|
|||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.*;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockModelShapes;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.BlockPart;
|
||||
import net.minecraft.client.renderer.block.model.BlockPartFace;
|
||||
import net.minecraft.client.renderer.block.model.BlockPartRotation;
|
||||
|
@ -162,16 +164,42 @@ public class ModelLoader extends ModelBakery
|
|||
ProgressBar blockBar = ProgressManager.push("ModelLoader: blocks", variants.size());
|
||||
for(ModelResourceLocation variant : variants)
|
||||
{
|
||||
loadVariants(ImmutableList.of(variant));
|
||||
loadVariant(variant);
|
||||
blockBar.step(variant.toString());
|
||||
}
|
||||
ProgressManager.pop(blockBar);
|
||||
}
|
||||
|
||||
// FIXME: all the new shiny multipart things
|
||||
private void loadVariant(ModelResourceLocation variant)
|
||||
{
|
||||
try
|
||||
{
|
||||
ModelBlockDefinition modelblockdefinition = this.getModelBlockDefinition(variant);
|
||||
|
||||
try
|
||||
{
|
||||
this.registerVariant(modelblockdefinition, variant);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FMLLog.getLogger().warn("Unable to load variant: " + variant.getVariant() + " from " + variant, ex);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FMLLog.getLogger().warn("Unable to load definition " + variant, ex);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: this is probably not the hook point anymore
|
||||
@Override
|
||||
protected void registerVariant(ModelBlockDefinition definition, ModelResourceLocation location)
|
||||
{
|
||||
VariantList variants = null;
|
||||
// for now
|
||||
super.registerVariant(definition, location);
|
||||
|
||||
/*VariantList variants = null;
|
||||
try
|
||||
{
|
||||
variants = definition.getVariants(location.getVariant());
|
||||
|
@ -190,7 +218,7 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void storeException(ResourceLocation location, Exception exception)
|
||||
|
@ -387,7 +415,7 @@ public class ModelLoader extends ModelBakery
|
|||
|
||||
IModel getVariantModel(ModelResourceLocation location)
|
||||
{
|
||||
loadVariants(ImmutableList.of(location));
|
||||
loadVariant(location);
|
||||
IModel model = stateModels.get(location);
|
||||
if(model == null) model = getMissingModel();
|
||||
return model;
|
||||
|
@ -409,16 +437,18 @@ public class ModelLoader extends ModelBakery
|
|||
textures.addAll(model.getTextures());
|
||||
}
|
||||
|
||||
private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IAnimatedModel
|
||||
private class VanillaModelWrapper implements IRetexturableModel, IModelSimpleProperties, IModelUVLock, IAnimatedModel
|
||||
{
|
||||
private final ResourceLocation location;
|
||||
private final ModelBlock model;
|
||||
private final boolean uvlock;
|
||||
private final ModelBlockAnimation animation;
|
||||
|
||||
public VanillaModelWrapper(ResourceLocation location, ModelBlock model, ModelBlockAnimation animation)
|
||||
public VanillaModelWrapper(ResourceLocation location, ModelBlock model, boolean uvlock, ModelBlockAnimation animation)
|
||||
{
|
||||
this.location = location;
|
||||
this.model = model;
|
||||
this.uvlock = uvlock;
|
||||
this.animation = animation;
|
||||
}
|
||||
|
||||
|
@ -500,7 +530,7 @@ public class ModelLoader extends ModelBakery
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
public IBakedModel bake(IModelState state, final VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
{
|
||||
if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT))
|
||||
{
|
||||
|
@ -517,12 +547,6 @@ public class ModelLoader extends ModelBakery
|
|||
}
|
||||
|
||||
ItemCameraTransforms transforms = model.func_181682_g();
|
||||
boolean uvlock = false;
|
||||
if(state instanceof UVLock)
|
||||
{
|
||||
uvlock = true;
|
||||
state = ((UVLock)state).getParent();
|
||||
}
|
||||
Map<TransformType, TRSRTransformation> tMap = Maps.newHashMap();
|
||||
tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(transforms));
|
||||
tMap.putAll(IPerspectiveAwareModel.MapWrapper.getTransforms(state));
|
||||
|
@ -532,14 +556,14 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
return new ItemLayerModel(model).bake(perState, format, bakedTextureGetter);
|
||||
}
|
||||
if(isCustomRenderer(model)) return new BuiltInModel(transforms);
|
||||
if(isCustomRenderer(model)) return new BuiltInModel(transforms, model.func_187967_g());
|
||||
return bakeNormal(model, perState, state.apply(Optional.<IModelPart>absent()).or(TRSRTransformation.identity()), newTransforms, format, bakedTextureGetter, uvlock);
|
||||
}
|
||||
|
||||
private IBakedModel bakeNormal(ModelBlock model, IModelState perState, final TRSRTransformation modelState, List<TRSRTransformation> newTransforms, VertexFormat format, final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, boolean uvLocked)
|
||||
{
|
||||
TextureAtlasSprite particle = bakedTextureGetter.apply(new ResourceLocation(model.resolveTextureName("particle")));
|
||||
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model)).setTexture(particle);
|
||||
SimpleBakedModel.Builder builder = (new SimpleBakedModel.Builder(model, model.func_187967_g())).setTexture(particle);
|
||||
for(int i = 0; i < model.getElements().size(); i++)
|
||||
{
|
||||
BlockPart part = model.getElements().get(i);
|
||||
|
@ -566,17 +590,10 @@ public class ModelLoader extends ModelBakery
|
|||
}
|
||||
}
|
||||
|
||||
// FIXME
|
||||
return new ISmartBlockModel.PerspectiveWrapper(new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState))
|
||||
return new IPerspectiveAwareModel.MapWrapper(builder.makeBakedModel(), perState)
|
||||
{
|
||||
public IBakedModel handleBlockState(IBlockState state)
|
||||
{
|
||||
return VanillaModelWrapper.this.handleBlockState(parent, bakedTextureGetter, modelState, state);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private IBakedModel handleBlockState(IBakedModel model, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter, TRSRTransformation modelState, IBlockState state)
|
||||
@Override
|
||||
public List<BakedQuad> func_188616_a(IBlockState state, EnumFacing side, long rand)
|
||||
{
|
||||
if(state instanceof IExtendedBlockState)
|
||||
{
|
||||
|
@ -584,13 +601,16 @@ public class ModelLoader extends ModelBakery
|
|||
if(exState.getUnlistedNames().contains(Properties.AnimationProperty))
|
||||
{
|
||||
IModelState newState = exState.getValue(Properties.AnimationProperty);
|
||||
IExtendedBlockState newExState = exState.withProperty(Properties.AnimationProperty, null);
|
||||
if(newState != null)
|
||||
{
|
||||
return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), model.getFormat(), bakedTextureGetter);
|
||||
return VanillaModelWrapper.this.bake(new ModelStateComposition(modelState, newState), format, bakedTextureGetter).func_188616_a(newExState, side, rand);
|
||||
}
|
||||
}
|
||||
}
|
||||
return model;
|
||||
return super.func_188616_a(state, side, rand);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -607,7 +627,7 @@ public class ModelLoader extends ModelBakery
|
|||
|
||||
ModelBlock newModel = new ModelBlock(this.model.getParentLocation(), elements,
|
||||
Maps.newHashMap(this.model.textures), this.model.isAmbientOcclusion(), this.model.isGui3d(), //New Textures man VERY IMPORTANT
|
||||
model.func_181682_g());
|
||||
model.func_181682_g(), Lists.newArrayList(model.func_187966_f()));
|
||||
newModel.name = this.model.name;
|
||||
newModel.parent = this.model.parent;
|
||||
|
||||
|
@ -651,7 +671,7 @@ public class ModelLoader extends ModelBakery
|
|||
}
|
||||
}
|
||||
|
||||
return new VanillaModelWrapper(location, newModel, animation);
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -676,10 +696,10 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
return this;
|
||||
}
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g());
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, value, model.isGui3d(), model.func_181682_g(), Lists.newArrayList(model.func_187966_f()));
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, animation);
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -689,31 +709,20 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
return this;
|
||||
}
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g());
|
||||
ModelBlock newModel = new ModelBlock(model.getParentLocation(), model.getElements(), model.textures, model.ambientOcclusion, value, model.func_181682_g(), Lists.newArrayList(model.func_187966_f()));
|
||||
newModel.parent = model.parent;
|
||||
newModel.name = model.name;
|
||||
return new VanillaModelWrapper(location, newModel, animation);
|
||||
}
|
||||
return new VanillaModelWrapper(location, newModel, uvlock, animation);
|
||||
}
|
||||
|
||||
@Deprecated // rework in 1.9
|
||||
public static class UVLock implements IModelState
|
||||
@Override
|
||||
public IModel uvlock(boolean value)
|
||||
{
|
||||
private final IModelState parent;
|
||||
|
||||
public UVLock(IModelState parent)
|
||||
if(uvlock == value)
|
||||
{
|
||||
this.parent = parent;
|
||||
return this;
|
||||
}
|
||||
|
||||
public IModelState getParent()
|
||||
{
|
||||
return parent;
|
||||
}
|
||||
|
||||
public Optional<TRSRTransformation> apply(Optional<? extends IModelPart> part)
|
||||
{
|
||||
return parent.apply(part);
|
||||
return new VanillaModelWrapper(location, model, value, animation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -730,7 +739,7 @@ public class ModelLoader extends ModelBakery
|
|||
ImmutableList.Builder<Pair<IModel, IModelState>> builder = ImmutableList.builder();
|
||||
for (Variant v : this.variants)
|
||||
{
|
||||
ResourceLocation loc = v.getModelLocation();
|
||||
ResourceLocation loc = v.func_188046_a();
|
||||
locations.add(loc);
|
||||
|
||||
IModel model = null;
|
||||
|
@ -787,12 +796,6 @@ public class ModelLoader extends ModelBakery
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
private IModelState addUV(boolean uv, IModelState state)
|
||||
{
|
||||
if(uv) return new UVLock(state);
|
||||
return state;
|
||||
}
|
||||
|
||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter)
|
||||
{
|
||||
if(!Attributes.moreSpecific(format, Attributes.DEFAULT_BAKED_FORMAT))
|
||||
|
@ -803,14 +806,14 @@ public class ModelLoader extends ModelBakery
|
|||
{
|
||||
Variant v = variants.get(0);
|
||||
IModel model = models.get(0);
|
||||
return model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, 0)), format, bakedTextureGetter);
|
||||
return model.bake(MultiModelState.getPartState(state, model, 0), format, bakedTextureGetter);
|
||||
}
|
||||
WeightedBakedModel.Builder builder = new WeightedBakedModel.Builder();
|
||||
for(int i = 0; i < variants.size(); i++)
|
||||
{
|
||||
IModel model = models.get(i);
|
||||
Variant v = variants.get(i);
|
||||
builder.add(model.bake(addUV(v.isUvLocked(), MultiModelState.getPartState(state, model, i)), format, bakedTextureGetter), variants.get(i).getWeight());
|
||||
builder.add(model.bake(MultiModelState.getPartState(state, model, i), format, bakedTextureGetter), variants.get(i).func_188047_d());
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
@ -878,7 +881,7 @@ public class ModelLoader extends ModelBakery
|
|||
}
|
||||
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json");
|
||||
ModelBlockAnimation animation = Animation.INSTANCE.loadVanillaAnimation(armatureLocation);
|
||||
return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), animation);
|
||||
return loader.new VanillaModelWrapper(modelLocation, loader.loadModel(modelLocation), false, animation);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -898,6 +901,7 @@ public class ModelLoader extends ModelBakery
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO: check if this code is correct
|
||||
@Override
|
||||
public boolean load(IResourceManager manager, ResourceLocation location)
|
||||
{
|
||||
|
@ -905,16 +909,10 @@ public class ModelLoader extends ModelBakery
|
|||
Graphics2D graphics = image.createGraphics();
|
||||
graphics.setBackground(Color.WHITE);
|
||||
graphics.clearRect(0, 0, 16, 16);
|
||||
BufferedImage[] images = new BufferedImage[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1];
|
||||
images[0] = image;
|
||||
try
|
||||
{
|
||||
loadSprite(images, null);
|
||||
}
|
||||
catch(IOException e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
int[][] pixels = new int[Minecraft.getMinecraft().gameSettings.mipmapLevels + 1][];
|
||||
pixels[0] = new int[image.getWidth() * image.getHeight()];
|
||||
image.getRGB(0, 0, image.getWidth(), image.getHeight(), pixels[0], 0, image.getWidth());
|
||||
this.framesTextureData.add(pixels);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,4 +39,13 @@ public class ModelProcessingHelper
|
|||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
public static IModel uvlock(IModel model, boolean uvlock)
|
||||
{
|
||||
if(model instanceof IModelUVLock)
|
||||
{
|
||||
model = ((IModelUVLock)model).uvlock(uvlock);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,6 +115,7 @@ protected net.minecraft.block.state.BlockStateContainer$StateImplementation fiel
|
|||
public net.minecraft.client.renderer.block.model.ModelBlock field_178318_c # textures
|
||||
public net.minecraft.client.renderer.block.model.ModelBlock field_178315_d # parent
|
||||
public net.minecraft.client.renderer.block.model.ModelBlock field_178322_i # ambientOcclusion
|
||||
public net.minecraft.client.renderer.block.model.ModelBlock func_187966_f()Ljava/util/List; # getOverrides
|
||||
protected net.minecraft.client.renderer.block.model.ModelBakery field_177602_b # LOCATIONS_BUILTIN_TEXTURES
|
||||
protected net.minecraft.client.renderer.block.model.ModelBakery field_177598_f # resourceManager
|
||||
protected net.minecraft.client.renderer.block.model.ModelBakery field_177599_g # sprites
|
||||
|
@ -141,8 +142,8 @@ protected net.minecraft.client.renderer.block.model.ModelBakery func_177580_d(Ln
|
|||
# EnumFacing
|
||||
public net.minecraft.util.EnumFacing field_82609_l # VALUES
|
||||
public net.minecraft.util.EnumFacing field_176754_o # HORIZONTALS
|
||||
#public net.minecraft.client.renderer.VertexBuffer func_78909_a(I)I # getColorIndex
|
||||
#public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putColorRGBA
|
||||
public net.minecraft.client.renderer.VertexBuffer func_78909_a(I)I # getColorIndex
|
||||
public net.minecraft.client.renderer.VertexBuffer func_178972_a(IIIII)V # putColorRGBA
|
||||
# ModelBlock Constructor
|
||||
#public net.minecraft.client.renderer.block.model.ModelBlock <init>(Lnet/minecraft/util/ResourceLocation;Ljava/util/List;Ljava/util/Map;ZZLnet/minecraft/client/renderer/block/model/ItemCameraTransforms;)V
|
||||
# RenderLivingEntity
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ItemTileDebug
|
|||
@SubscribeEvent
|
||||
public void onModelBakeEvent(ModelBakeEvent event)
|
||||
{
|
||||
event.modelManager.getBlockModelShapes().registerBuiltInBlocks(TestBlock.instance);
|
||||
event.getModelManager().getBlockModelShapes().registerBuiltInBlocks(TestBlock.instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -117,8 +117,8 @@ public class ModelBakeEventDebug
|
|||
TextureAtlasSprite base = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/slime");
|
||||
TextureAtlasSprite overlay = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite("minecraft:blocks/redstone_block");
|
||||
IBakedModel customModel = new CustomModel(base, overlay);
|
||||
event.modelRegistry.putObject(ClientProxy.blockLocation, customModel);
|
||||
event.modelRegistry.putObject(ClientProxy.itemLocation, customModel);
|
||||
event.getModelRegistry().putObject(ClientProxy.blockLocation, customModel);
|
||||
event.getModelRegistry().putObject(ClientProxy.itemLocation, customModel);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue