Convert turtle rendering to use tinting
This uses Minecraft's colour tinting system in order to change the colour of turtle models. This removes the need to have 16 models and textures for each colour, reducing texture atlas space and hopefully memory consumption. See #145
@ -13,16 +13,19 @@ import dan200.computercraft.client.render.TurtleSmartItemModel;
|
|||||||
import dan200.computercraft.shared.proxy.CCTurtleProxyCommon;
|
import dan200.computercraft.shared.proxy.CCTurtleProxyCommon;
|
||||||
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
import dan200.computercraft.shared.turtle.blocks.TileTurtle;
|
||||||
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
import dan200.computercraft.shared.turtle.core.TurtleBrain;
|
||||||
|
import dan200.computercraft.shared.turtle.items.ItemTurtleBase;
|
||||||
|
import dan200.computercraft.shared.util.Colour;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
import net.minecraft.client.resources.SimpleReloadableResourceManager;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@ -32,12 +35,9 @@ import net.minecraftforge.client.model.IModel;
|
|||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
||||||
{
|
{
|
||||||
public CCTurtleProxyClient()
|
public CCTurtleProxyClient()
|
||||||
@ -65,16 +65,19 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
|||||||
String[] turtleModelNames = new String[] {
|
String[] turtleModelNames = new String[] {
|
||||||
"turtle_dynamic",
|
"turtle_dynamic",
|
||||||
"CC-Turtle", "CC-TurtleAdvanced",
|
"CC-Turtle", "CC-TurtleAdvanced",
|
||||||
"turtle_black", "turtle_red", "turtle_green", "turtle_brown",
|
"turtle_white",
|
||||||
"turtle_blue", "turtle_purple", "turtle_cyan", "turtle_lightGrey",
|
|
||||||
"turtle_grey", "turtle_pink", "turtle_lime", "turtle_yellow",
|
|
||||||
"turtle_lightBlue", "turtle_magenta", "turtle_orange", "turtle_white",
|
|
||||||
"turtle_elf_overlay"
|
"turtle_elf_overlay"
|
||||||
};
|
};
|
||||||
registerItemModel( ComputerCraft.Blocks.turtle, turtleMeshDefinition, turtleModelNames );
|
registerItemModel( ComputerCraft.Blocks.turtle, turtleMeshDefinition, turtleModelNames );
|
||||||
registerItemModel( ComputerCraft.Blocks.turtleExpanded, turtleMeshDefinition, turtleModelNames );
|
registerItemModel( ComputerCraft.Blocks.turtleExpanded, turtleMeshDefinition, turtleModelNames );
|
||||||
registerItemModel( ComputerCraft.Blocks.turtleAdvanced, turtleMeshDefinition, turtleModelNames );
|
registerItemModel( ComputerCraft.Blocks.turtleAdvanced, turtleMeshDefinition, turtleModelNames );
|
||||||
|
|
||||||
|
// Setup turtle colours
|
||||||
|
Minecraft.getMinecraft().getItemColors().registerItemColorHandler(
|
||||||
|
new TurtleItemColour(),
|
||||||
|
ComputerCraft.Blocks.turtle, ComputerCraft.Blocks.turtleExpanded, ComputerCraft.Blocks.turtleAdvanced
|
||||||
|
);
|
||||||
|
|
||||||
// Setup renderers
|
// Setup renderers
|
||||||
ClientRegistry.bindTileEntitySpecialRenderer( TileTurtle.class, new TileEntityTurtleRenderer() );
|
ClientRegistry.bindTileEntitySpecialRenderer( TileTurtle.class, new TileEntityTurtleRenderer() );
|
||||||
|
|
||||||
@ -181,4 +184,20 @@ public class CCTurtleProxyClient extends CCTurtleProxyCommon
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class TurtleItemColour implements IItemColor
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public int getColorFromItemstack( ItemStack stack, int tintIndex )
|
||||||
|
{
|
||||||
|
if( tintIndex == 0 )
|
||||||
|
{
|
||||||
|
ItemTurtleBase turtle = (ItemTurtleBase) stack.getItem();
|
||||||
|
Colour colour = turtle.getColour( stack );
|
||||||
|
if( colour != null ) return colour.getHex();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0xFFFFFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,47 +22,33 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
import net.minecraft.client.renderer.VertexBuffer;
|
import net.minecraft.client.renderer.VertexBuffer;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ModelManager;
|
import net.minecraft.client.renderer.block.model.ModelManager;
|
||||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.*;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraftforge.client.ForgeHooksClient;
|
import net.minecraftforge.client.ForgeHooksClient;
|
||||||
|
import net.minecraftforge.client.model.pipeline.LightUtil;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Matrix4f;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurtle>
|
public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurtle>
|
||||||
{
|
{
|
||||||
private static ModelResourceLocation NORMAL_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-Turtle", "inventory" );
|
private static ModelResourceLocation NORMAL_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-Turtle", "inventory" );
|
||||||
private static ModelResourceLocation ADVANCED_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-TurtleAdvanced", "inventory" );
|
private static ModelResourceLocation ADVANCED_TURTLE_MODEL = new ModelResourceLocation( "computercraft:CC-TurtleAdvanced", "inventory" );
|
||||||
private static ModelResourceLocation[] COLOUR_TURTLE_MODELS = new ModelResourceLocation[] {
|
private static ModelResourceLocation COLOUR_TURTLE_MODEL = new ModelResourceLocation( "computercraft:turtle_white", "inventory" );
|
||||||
new ModelResourceLocation( "computercraft:turtle_black", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_red", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_green", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_brown", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_blue", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_purple", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_cyan", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_lightGrey", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_grey", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_pink", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_lime", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_yellow", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_lightBlue", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_magenta", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_orange", "inventory" ),
|
|
||||||
new ModelResourceLocation( "computercraft:turtle_white", "inventory" ),
|
|
||||||
};
|
|
||||||
private static ModelResourceLocation BEGINNER_TURTLE_MODEL = new ModelResourceLocation( "computercraftedu:CC-TurtleJunior", "inventory" );
|
private static ModelResourceLocation BEGINNER_TURTLE_MODEL = new ModelResourceLocation( "computercraftedu:CC-TurtleJunior", "inventory" );
|
||||||
private static ModelResourceLocation[] BEGINNER_TURTLE_COLOUR_MODELS = new ModelResourceLocation[] {
|
private static ModelResourceLocation[] BEGINNER_TURTLE_COLOUR_MODELS = new ModelResourceLocation[] {
|
||||||
new ModelResourceLocation( "computercraftedu:turtleJunior_black", "inventory" ),
|
new ModelResourceLocation( "computercraftedu:turtleJunior_black", "inventory" ),
|
||||||
@ -115,38 +101,11 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
{
|
{
|
||||||
case Normal:
|
case Normal:
|
||||||
default:
|
default:
|
||||||
{
|
return colour != null ? COLOUR_TURTLE_MODEL : NORMAL_TURTLE_MODEL;
|
||||||
if( colour != null )
|
|
||||||
{
|
|
||||||
return COLOUR_TURTLE_MODELS[ colour.ordinal() ];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NORMAL_TURTLE_MODEL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Advanced:
|
case Advanced:
|
||||||
{
|
return colour != null ? COLOUR_TURTLE_MODEL : ADVANCED_TURTLE_MODEL;
|
||||||
if( colour != null )
|
|
||||||
{
|
|
||||||
return COLOUR_TURTLE_MODELS[ colour.ordinal() ];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ADVANCED_TURTLE_MODEL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case Beginners:
|
case Beginners:
|
||||||
{
|
return colour != null ? BEGINNER_TURTLE_COLOUR_MODELS[ colour.ordinal() ] : BEGINNER_TURTLE_MODEL;
|
||||||
if( colour != null )
|
|
||||||
{
|
|
||||||
return BEGINNER_TURTLE_COLOUR_MODELS[ colour.ordinal() ];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return BEGINNER_TURTLE_MODEL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +175,8 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
family = ComputerFamily.Normal;
|
family = ComputerFamily.Normal;
|
||||||
overlay = null;
|
overlay = null;
|
||||||
}
|
}
|
||||||
renderModel( state, getTurtleModel( family, colour ) );
|
|
||||||
|
renderModel( state, getTurtleModel( family, colour ), colour == null ? null : new int[] { colour.getHex() } );
|
||||||
|
|
||||||
// Render the overlay
|
// Render the overlay
|
||||||
ModelResourceLocation overlayModel = getTurtleOverlayModel(
|
ModelResourceLocation overlayModel = getTurtleOverlayModel(
|
||||||
@ -231,7 +191,7 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
GlStateManager.blendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
renderModel( state, overlayModel );
|
renderModel( state, overlayModel, null );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -275,7 +235,7 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
}
|
}
|
||||||
if( pair.getLeft() != null )
|
if( pair.getLeft() != null )
|
||||||
{
|
{
|
||||||
renderModel( state, pair.getLeft() );
|
renderModel( state, pair.getLeft(), null );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,35 +246,32 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderModel( IBlockState state, ModelResourceLocation modelLocation )
|
private void renderModel( IBlockState state, ModelResourceLocation modelLocation, int[] tints )
|
||||||
{
|
{
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
ModelManager modelManager = mc.getRenderItem().getItemModelMesher().getModelManager();
|
ModelManager modelManager = mc.getRenderItem().getItemModelMesher().getModelManager();
|
||||||
renderModel( state, modelManager.getModel( modelLocation ) );
|
renderModel( state, modelManager.getModel( modelLocation ), tints );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderModel( IBlockState state, IBakedModel model )
|
private void renderModel( IBlockState state, IBakedModel model, int[] tints )
|
||||||
{
|
{
|
||||||
Minecraft mc = Minecraft.getMinecraft();
|
Minecraft mc = Minecraft.getMinecraft();
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
mc.getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||||
renderQuads( tessellator, model.getQuads( state, null, 0 ) );
|
renderQuads( tessellator, model.getQuads( state, null, 0 ), tints );
|
||||||
for( EnumFacing facing : EnumFacing.VALUES )
|
for( EnumFacing facing : EnumFacing.VALUES )
|
||||||
{
|
{
|
||||||
renderQuads( tessellator, model.getQuads( state, facing, 0 ) );
|
renderQuads( tessellator, model.getQuads( state, facing, 0 ), tints );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderQuads( Tessellator tessellator, List quads )
|
private void renderQuads( Tessellator tessellator, List<BakedQuad> quads, int[] tints )
|
||||||
{
|
{
|
||||||
int color = 0xFFFFFFFF;
|
|
||||||
Iterator it = quads.iterator();
|
|
||||||
VertexBuffer buffer = tessellator.getBuffer();
|
VertexBuffer buffer = tessellator.getBuffer();
|
||||||
VertexFormat format = DefaultVertexFormats.ITEM;
|
VertexFormat format = DefaultVertexFormats.ITEM;
|
||||||
buffer.begin( GL11.GL_QUADS, format );
|
buffer.begin( GL11.GL_QUADS, format );
|
||||||
while( it.hasNext() )
|
for (BakedQuad quad : quads)
|
||||||
{
|
{
|
||||||
BakedQuad quad = (BakedQuad)it.next();
|
|
||||||
VertexFormat quadFormat = quad.getFormat();
|
VertexFormat quadFormat = quad.getFormat();
|
||||||
if( quadFormat != format )
|
if( quadFormat != format )
|
||||||
{
|
{
|
||||||
@ -322,7 +279,15 @@ public class TileEntityTurtleRenderer extends TileEntitySpecialRenderer<TileTurt
|
|||||||
format = quadFormat;
|
format = quadFormat;
|
||||||
buffer.begin( GL11.GL_QUADS, format );
|
buffer.begin( GL11.GL_QUADS, format );
|
||||||
}
|
}
|
||||||
net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor( buffer, quad, color );
|
|
||||||
|
int colour = 0xFFFFFFFF;
|
||||||
|
if( quad.hasTintIndex() && tints != null )
|
||||||
|
{
|
||||||
|
int index = quad.getTintIndex();
|
||||||
|
if( index >= 0 && index < tints.length ) colour = tints[ index ] | 0xFF000000;
|
||||||
|
}
|
||||||
|
|
||||||
|
LightUtil.renderQuadColor( buffer, quad, colour );
|
||||||
}
|
}
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,18 @@
|
|||||||
package dan200.computercraft.client.render;
|
package dan200.computercraft.client.render;
|
||||||
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.*;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import javax.vecmath.Matrix4f;
|
import javax.vecmath.Matrix4f;
|
||||||
import javax.vecmath.Point3f;
|
import javax.vecmath.Point3f;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Dictionary;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TurtleMultiModel implements IBakedModel
|
public class TurtleMultiModel implements IBakedModel
|
||||||
@ -49,7 +46,7 @@ public class TurtleMultiModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
if( m_faceQuads[ side.ordinal() ] == null )
|
if( m_faceQuads[ side.ordinal() ] == null )
|
||||||
{
|
{
|
||||||
List<BakedQuad> quads = new ArrayList<BakedQuad>();
|
ArrayList<BakedQuad> quads = new ArrayList<BakedQuad>();
|
||||||
if( m_overlayModel != null )
|
if( m_overlayModel != null )
|
||||||
{
|
{
|
||||||
quads.addAll( m_overlayModel.getQuads( state, side, rand ) );
|
quads.addAll( m_overlayModel.getQuads( state, side, rand ) );
|
||||||
@ -62,6 +59,7 @@ public class TurtleMultiModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
quads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) );
|
quads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) );
|
||||||
}
|
}
|
||||||
|
quads.trimToSize();
|
||||||
m_faceQuads[ side.ordinal() ] = quads;
|
m_faceQuads[ side.ordinal() ] = quads;
|
||||||
}
|
}
|
||||||
return m_faceQuads[ side.ordinal() ];
|
return m_faceQuads[ side.ordinal() ];
|
||||||
@ -70,20 +68,22 @@ public class TurtleMultiModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
if( m_generalQuads == null )
|
if( m_generalQuads == null )
|
||||||
{
|
{
|
||||||
m_generalQuads = new ArrayList<BakedQuad>();
|
ArrayList<BakedQuad> quads = new ArrayList<BakedQuad>();
|
||||||
m_generalQuads.addAll( m_baseModel.getQuads( state, side, rand ) );
|
quads.addAll( m_baseModel.getQuads( state, side, rand ) );
|
||||||
if( m_overlayModel != null )
|
if( m_overlayModel != null )
|
||||||
{
|
{
|
||||||
m_generalQuads.addAll( m_overlayModel.getQuads( state, side, rand ) );
|
quads.addAll( m_overlayModel.getQuads( state, side, rand ) );
|
||||||
}
|
}
|
||||||
if( m_leftUpgradeModel != null )
|
if( m_leftUpgradeModel != null )
|
||||||
{
|
{
|
||||||
m_generalQuads.addAll( transformQuads( m_leftUpgradeModel.getQuads( state, side, rand ), m_leftUpgradeTransform ) );
|
quads.addAll( transformQuads( m_leftUpgradeModel.getQuads( state, side, rand ), m_leftUpgradeTransform ) );
|
||||||
}
|
}
|
||||||
if( m_rightUpgradeModel != null )
|
if( m_rightUpgradeModel != null )
|
||||||
{
|
{
|
||||||
m_generalQuads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) );
|
quads.addAll( transformQuads( m_rightUpgradeModel.getQuads( state, side, rand ), m_rightUpgradeTransform ) );
|
||||||
}
|
}
|
||||||
|
quads.trimToSize();
|
||||||
|
m_generalQuads = quads;
|
||||||
}
|
}
|
||||||
return m_generalQuads;
|
return m_generalQuads;
|
||||||
}
|
}
|
||||||
@ -147,7 +147,7 @@ public class TurtleMultiModel implements IBakedModel
|
|||||||
{
|
{
|
||||||
int[] vertexData = quad.getVertexData().clone();
|
int[] vertexData = quad.getVertexData().clone();
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
BakedQuad copy = new BakedQuad( vertexData, quad.getTintIndex(), quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat() );
|
BakedQuad copy = new BakedQuad( vertexData, -1, quad.getFace(), quad.getSprite(), quad.shouldApplyDiffuseLighting(), quad.getFormat() );
|
||||||
VertexFormat format = copy.getFormat();
|
VertexFormat format = copy.getFormat();
|
||||||
for( int i=0; i<format.getElementCount(); ++i ) // For each vertex element
|
for( int i=0; i<format.getElementCount(); ++i ) // For each vertex element
|
||||||
{
|
{
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_black"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_blue"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_brown"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_cyan"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_green"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_grey"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_lightBlue"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_lightGrey"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_lime"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_magenta"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_orange"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_pink"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_purple"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_red"
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,5 +2,53 @@
|
|||||||
"parent": "computercraft:block/turtle_base",
|
"parent": "computercraft:block/turtle_base",
|
||||||
"textures": {
|
"textures": {
|
||||||
"texture": "computercraft:blocks/turtle_white"
|
"texture": "computercraft:blocks/turtle_white"
|
||||||
}
|
},
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"from": [ 2, 2, 2 ],
|
||||||
|
"to": [ 14, 14, 13 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 2.75, 0, 5.75, 2.75 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 5.75, 0, 8.75, 2.75 ], "texture": "#texture" },
|
||||||
|
"north": { "uv": [ 8.5, 5.75, 11.5, 2.75 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 2.75, 5.75, 5.75, 2.75 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 0, 5.75, 2.75, 2.75 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 5.75, 5.75, 8.5, 2.75 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 3, 6, 13 ],
|
||||||
|
"to": [ 13, 13, 15 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 9.25, 0, 11.75, 0.5 ], "texture": "#texture" },
|
||||||
|
"up": { "uv": [ 11.75, 0, 14.25, 0.5 ], "texture": "#texture" },
|
||||||
|
"south": { "uv": [ 9.25, 2.25, 11.75, 0.5 ], "texture": "#texture" },
|
||||||
|
"west": { "uv": [ 8.75, 2.25, 9.25, 0.5 ], "texture": "#texture" },
|
||||||
|
"east": { "uv": [ 11.75, 2.25, 12.25, 0.5 ], "texture": "#texture" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 2, 2, 2 ],
|
||||||
|
"to": [ 14, 14, 13 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 2.75, 5.75, 5.75, 8.5 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"up": { "uv": [ 5.75, 5.75, 8.75, 8.5 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"north": { "uv": [ 8.5, 11.5, 11.5, 8.5 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"south": { "uv": [ 2.75, 11.5, 5.75, 8.5 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"west": { "uv": [ 0, 11.5, 2.75, 8.5 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"east": { "uv": [ 5.75, 11.5, 8.5, 8.555 ], "texture": "#texture", "tintindex":0 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"from": [ 3, 6, 13 ],
|
||||||
|
"to": [ 13, 13, 15 ],
|
||||||
|
"faces": {
|
||||||
|
"down": { "uv": [ 9.25, 5.75, 11.75, 6.25 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"up": { "uv": [ 11.75, 5.75, 14.25, 6.25 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"south": { "uv": [ 9.25, 8, 11.75, 6.25 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"west": { "uv": [ 8.75, 8, 9.25, 6.25 ], "texture": "#texture", "tintindex":0 },
|
||||||
|
"east": { "uv": [ 11.75, 8, 12.25, 6.25 ], "texture": "#texture", "tintindex":0 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_base",
|
|
||||||
"textures": {
|
|
||||||
"texture": "computercraft:blocks/turtle_yellow"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_black"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_blue"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_brown"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_cyan"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_green"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_grey"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_lightBlue"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_lightGrey"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_lime"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_magenta"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_orange"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_pink"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_purple"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_red"
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "computercraft:block/turtle_yellow"
|
|
||||||
}
|
|
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.9 KiB |