mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-11-07 00:42:59 +00:00
Merge pull request #203 from SquidDev-CC/feature/turtle-models
Convert turtle rendering to use tinting
This commit is contained in:
@@ -34,7 +34,6 @@ public class BlockTurtle extends BlockComputerBase
|
||||
public static class Properties
|
||||
{
|
||||
public static final PropertyDirection FACING = PropertyDirection.create( "facing", EnumFacing.Plane.HORIZONTAL );
|
||||
public static final PropertyEnum<BlockTurtleDyeVariant> DYE = PropertyEnum.<BlockTurtleDyeVariant>create( "dye", BlockTurtleDyeVariant.class );
|
||||
}
|
||||
|
||||
public static BlockTurtle createTurtleBlock()
|
||||
@@ -52,7 +51,6 @@ public class BlockTurtle extends BlockComputerBase
|
||||
setCreativeTab( ComputerCraft.mainCreativeTab );
|
||||
setDefaultState( this.blockState.getBaseState()
|
||||
.withProperty( Properties.FACING, EnumFacing.NORTH )
|
||||
.withProperty( Properties.DYE, BlockTurtleDyeVariant.None )
|
||||
);
|
||||
}
|
||||
|
||||
@@ -77,10 +75,7 @@ public class BlockTurtle extends BlockComputerBase
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {
|
||||
Properties.FACING,
|
||||
Properties.DYE
|
||||
});
|
||||
return new BlockStateContainer(this, Properties.FACING );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,18 +93,7 @@ public class BlockTurtle extends BlockComputerBase
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
state = state.withProperty( Properties.FACING, getDirection( world, pos ) );
|
||||
TileEntity tile = world.getTileEntity( pos );
|
||||
if( tile != null && tile instanceof ITurtleTile )
|
||||
{
|
||||
ITurtleTile turtle = (ITurtleTile)tile;
|
||||
state = state.withProperty( Properties.DYE, BlockTurtleDyeVariant.fromColour( turtle.getColour() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
state = state.withProperty( Properties.DYE, BlockTurtleDyeVariant.None );
|
||||
}
|
||||
return state;
|
||||
return state.withProperty( Properties.FACING, getDirection( world, pos ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/**
|
||||
* This file is part of ComputerCraft - http://www.computercraft.info
|
||||
* Copyright Daniel Ratcliffe, 2011-2016. Do not distribute without permission.
|
||||
* Send enquiries to dratcliffe@gmail.com
|
||||
*/
|
||||
|
||||
package dan200.computercraft.shared.turtle.blocks;
|
||||
|
||||
import dan200.computercraft.shared.util.Colour;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public enum BlockTurtleDyeVariant implements IStringSerializable
|
||||
{
|
||||
None( "none", null ),
|
||||
Black( "black", Colour.Black ),
|
||||
Red( "red", Colour.Red ),
|
||||
Green( "green", Colour.Green ),
|
||||
Brown( "brown", Colour.Brown ),
|
||||
Blue( "blue", Colour.Blue ),
|
||||
Purple( "purple", Colour.Purple ),
|
||||
Cyan( "cyan", Colour.Cyan ),
|
||||
LightGrey( "light_grey", Colour.LightGrey ),
|
||||
Grey( "grey", Colour.Grey ),
|
||||
Pink( "pink", Colour.Pink ),
|
||||
Lime( "lime", Colour.Lime ),
|
||||
Yellow( "yellow", Colour.Yellow ),
|
||||
LightBlue( "light_blue", Colour.LightBlue ),
|
||||
Magenta( "magenta", Colour.Magenta ),
|
||||
Orange( "orange", Colour.Orange ),
|
||||
White( "white", Colour.Orange );
|
||||
|
||||
public static BlockTurtleDyeVariant fromColour( Colour colour )
|
||||
{
|
||||
if( colour != null )
|
||||
{
|
||||
switch( colour )
|
||||
{
|
||||
case Black: return Black;
|
||||
case Red: return Red;
|
||||
case Green: return Green;
|
||||
case Brown: return Brown;
|
||||
case Blue: return Blue;
|
||||
case Purple: return Purple;
|
||||
case Cyan: return Cyan;
|
||||
case LightGrey: return LightGrey;
|
||||
case Grey: return Grey;
|
||||
case Pink: return Pink;
|
||||
case Lime: return Lime;
|
||||
case Yellow: return Yellow;
|
||||
case LightBlue: return LightBlue;
|
||||
case Magenta: return Magenta;
|
||||
case Orange: return Orange;
|
||||
case White: return White;
|
||||
}
|
||||
}
|
||||
return None;
|
||||
}
|
||||
|
||||
private String m_name;
|
||||
private Colour m_colour;
|
||||
|
||||
private BlockTurtleDyeVariant( String name, Colour colour )
|
||||
{
|
||||
m_name = name;
|
||||
m_colour = colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return m_name;
|
||||
}
|
||||
|
||||
public Colour getColour()
|
||||
{
|
||||
return m_colour;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user