Added Feature: #0633 - [Aesthetical] Recoloring of specific blocks
This commit is contained in:
@@ -28,6 +28,8 @@ import net.minecraft.world.World;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.implementations.items.IMemoryCard;
|
import appeng.api.implementations.items.IMemoryCard;
|
||||||
import appeng.api.implementations.items.MemoryCardMessages;
|
import appeng.api.implementations.items.MemoryCardMessages;
|
||||||
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.IOrientable;
|
import appeng.api.util.IOrientable;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import appeng.api.util.IOrientableBlock;
|
||||||
import appeng.block.networking.BlockCableBus;
|
import appeng.block.networking.BlockCableBus;
|
||||||
@@ -764,6 +766,28 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
|
||||||
|
{
|
||||||
|
TileEntity te = getTileEntity( world, x, y, z );
|
||||||
|
|
||||||
|
if ( te instanceof IColorableTile )
|
||||||
|
{
|
||||||
|
IColorableTile ct = (IColorableTile) te;
|
||||||
|
AEColor c = ct.getColor();
|
||||||
|
AEColor newColor = AEColor.values()[colour];
|
||||||
|
|
||||||
|
if ( c != newColor )
|
||||||
|
{
|
||||||
|
ct.setColor( newColor );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.recolourBlock( world, x, y, z, side, colour );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase player, ItemStack is)
|
public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase player, ItemStack is)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
|
|||||||
case 0:
|
case 0:
|
||||||
return super.getIcon( 0, 0 );
|
return super.getIcon( 0, 0 );
|
||||||
case 0 | FLAG_FORMED:
|
case 0 | FLAG_FORMED:
|
||||||
return ExtraBlockTextures.BlockCraftingMonitorFit.getIcon();
|
return ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,23 @@ public class BaseBlockRender
|
|||||||
final public boolean hasTESR;
|
final public boolean hasTESR;
|
||||||
final static private byte OrientationMap[][][] = new byte[6][6][6];
|
final static private byte OrientationMap[][][] = new byte[6][6][6];
|
||||||
|
|
||||||
|
protected int adjustBrightness(int v, double d)
|
||||||
|
{
|
||||||
|
int r = 0xff & (v >> 16);
|
||||||
|
int g = 0xff & (v >> 8);
|
||||||
|
int b = 0xff & (v >> 0);
|
||||||
|
|
||||||
|
r *= d;
|
||||||
|
g *= d;
|
||||||
|
b *= d;
|
||||||
|
|
||||||
|
r = Math.min( 255, Math.max( 0, r ) );
|
||||||
|
g = Math.min( 255, Math.max( 0, g ) );
|
||||||
|
b = Math.min( 255, Math.max( 0, b ) );
|
||||||
|
|
||||||
|
return (r << 16) | (g << 8) | b;
|
||||||
|
}
|
||||||
|
|
||||||
static public int getOrientation(ForgeDirection in, ForgeDirection forward, ForgeDirection up)
|
static public int getOrientation(ForgeDirection in, ForgeDirection forward, ForgeDirection up)
|
||||||
{
|
{
|
||||||
if ( in == null || in.equals( ForgeDirection.UNKNOWN ) // 1
|
if ( in == null || in.equals( ForgeDirection.UNKNOWN ) // 1
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.block.crafting.BlockCraftingMonitor;
|
import appeng.block.crafting.BlockCraftingMonitor;
|
||||||
import appeng.block.crafting.BlockCraftingUnit;
|
import appeng.block.crafting.BlockCraftingUnit;
|
||||||
@@ -17,6 +18,7 @@ import appeng.client.render.BaseBlockRender;
|
|||||||
import appeng.client.render.BusRenderHelper;
|
import appeng.client.render.BusRenderHelper;
|
||||||
import appeng.client.render.BusRenderer;
|
import appeng.client.render.BusRenderer;
|
||||||
import appeng.client.texture.ExtraBlockTextures;
|
import appeng.client.texture.ExtraBlockTextures;
|
||||||
|
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||||
import appeng.tile.crafting.TileCraftingTile;
|
import appeng.tile.crafting.TileCraftingTile;
|
||||||
|
|
||||||
public class RenderBlockCraftingCPU extends BaseBlockRender
|
public class RenderBlockCraftingCPU extends BaseBlockRender
|
||||||
@@ -179,7 +181,7 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit.getIcon() )
|
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||||
i.setTexture( ExtraBlockTextures.BlockCraftingMonitorOuter.getIcon() );
|
i.setTexture( ExtraBlockTextures.BlockCraftingMonitorOuter.getIcon() );
|
||||||
else
|
else
|
||||||
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
|
i.setTexture( ExtraBlockTextures.BlockCraftingFitSolid.getIcon() );
|
||||||
@@ -192,14 +194,52 @@ public class RenderBlockCraftingCPU extends BaseBlockRender
|
|||||||
|
|
||||||
if ( !emitsLight )
|
if ( !emitsLight )
|
||||||
{
|
{
|
||||||
|
if ( color == ExtraBlockTextures.BlockCraftingMonitorFit_Light.getIcon() )
|
||||||
|
{
|
||||||
|
int b = w.getLightBrightnessForSkyBlocks( x + side.offsetX, y + side.offsetY, z + side.offsetZ, 0 );
|
||||||
|
|
||||||
|
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
|
||||||
|
AEColor col = sr.getColor();
|
||||||
|
|
||||||
|
Tessellator.instance.setBrightness( b );
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.whiteVariant );
|
||||||
|
i.renderFace( x, y, z, color, side, renderer );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.mediumVariant );
|
||||||
|
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.blackVariant );
|
||||||
|
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||||
|
}
|
||||||
|
else
|
||||||
i.renderBlockCurrentBounds( x, y, z, renderer );
|
i.renderBlockCurrentBounds( x, y, z, renderer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if ( isMonitor )
|
||||||
|
{
|
||||||
|
TileCraftingMonitorTile sr = blk.getTileEntity( w, x, y, z );
|
||||||
|
AEColor col = sr.getColor();
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.whiteVariant );
|
||||||
|
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||||
|
i.renderFace( x, y, z, color, side, renderer );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.mediumVariant );
|
||||||
|
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||||
|
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Medium.getIcon(), side, renderer );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( col.blackVariant );
|
||||||
|
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||||
|
i.renderFace( x, y, z, ExtraBlockTextures.BlockCraftingMonitorFit_Dark.getIcon(), side, renderer );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
Tessellator.instance.setColorOpaque_F( 1.0f, 1.0f, 1.0f );
|
||||||
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
Tessellator.instance.setBrightness( 13 << 20 | 13 << 4 );
|
||||||
i.renderFace( x, y, z, color, side, renderer );
|
i.renderFace( x, y, z, color, side, renderer );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
|||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.storage.ICellHandler;
|
import appeng.api.storage.ICellHandler;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.render.BaseBlockRender;
|
import appeng.client.render.BaseBlockRender;
|
||||||
import appeng.client.texture.ExtraBlockTextures;
|
import appeng.client.texture.ExtraBlockTextures;
|
||||||
@@ -29,11 +30,13 @@ public class RenderMEChest extends BaseBlockRender
|
|||||||
@Override
|
@Override
|
||||||
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
public void renderInventory(AEBaseBlock block, ItemStack is, RenderBlocks renderer, ItemRenderType type, Object[] obj)
|
||||||
{
|
{
|
||||||
|
Tessellator.instance.setBrightness( 0 );
|
||||||
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
renderer.overrideBlockTexture = ExtraBlockTextures.getMissing();
|
||||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||||
|
|
||||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, 0xffffff, renderer );
|
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
|
||||||
|
renderer );
|
||||||
|
|
||||||
renderer.overrideBlockTexture = null;
|
renderer.overrideBlockTexture = null;
|
||||||
super.renderInventory( block, is, renderer, type, obj );
|
super.renderInventory( block, is, renderer, type, obj );
|
||||||
@@ -77,13 +80,11 @@ public class RenderMEChest extends BaseBlockRender
|
|||||||
else if ( forward == ForgeDirection.DOWN )
|
else if ( forward == ForgeDirection.DOWN )
|
||||||
fico.setFlip( true, false );
|
fico.setFlip( true, false );
|
||||||
|
|
||||||
/* 1.7.2
|
/*
|
||||||
|
* 1.7.2
|
||||||
else if ( forward == ForgeDirection.EAST && up == ForgeDirection.UP )
|
*
|
||||||
fico.setFlip( true, false );
|
* else if ( forward == ForgeDirection.EAST && up == ForgeDirection.UP ) fico.setFlip( true, false ); else if (
|
||||||
else if ( forward == ForgeDirection.NORTH && up == ForgeDirection.UP )
|
* forward == ForgeDirection.NORTH && up == ForgeDirection.UP ) fico.setFlip( true, false );
|
||||||
fico.setFlip( true, false );
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
renderFace( x, y, z, imb, fico, renderer, forward );
|
renderFace( x, y, z, imb, fico, renderer, forward );
|
||||||
@@ -118,9 +119,22 @@ public class RenderMEChest extends BaseBlockRender
|
|||||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||||
|
|
||||||
ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() );
|
ICellHandler ch = AEApi.instance().registries().cell().getHandler( sp.getStorageType() );
|
||||||
IIcon ico = ch == null ? null : ch.getTopTexture();
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||||
|
IIcon ico = ch == null ? null : ch.getTopTexture_Light();
|
||||||
renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||||
|
|
||||||
|
if ( ico != null )
|
||||||
|
{
|
||||||
|
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||||
|
ico = ch == null ? null : ch.getTopTexture_Medium();
|
||||||
|
renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( sp.getColor().blackVariant );
|
||||||
|
ico = ch == null ? null : ch.getTopTexture_Dark();
|
||||||
|
renderFace( x, y, z, imb, ico == null ? ExtraBlockTextures.MEChest.getIcon() : ico, renderer, up );
|
||||||
|
}
|
||||||
|
|
||||||
renderer.overrideBlockTexture = null;
|
renderer.overrideBlockTexture = null;
|
||||||
postRenderInWorld( renderer );
|
postRenderInWorld( renderer );
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import net.minecraft.util.IIcon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.render.BaseBlockRender;
|
import appeng.client.render.BaseBlockRender;
|
||||||
import appeng.client.texture.ExtraBlockTextures;
|
import appeng.client.texture.ExtraBlockTextures;
|
||||||
@@ -28,7 +29,8 @@ public class RendererSecurity extends BaseBlockRender
|
|||||||
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
this.renderInvBlock( EnumSet.of( ForgeDirection.SOUTH ), block, is, Tessellator.instance, 0x000000, renderer );
|
||||||
|
|
||||||
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
renderer.overrideBlockTexture = ExtraBlockTextures.MEChest.getIcon();
|
||||||
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, 0xffffff, renderer );
|
this.renderInvBlock( EnumSet.of( ForgeDirection.UP ), block, is, Tessellator.instance, adjustBrightness( AEColor.Transparent.whiteVariant, 0.7 ),
|
||||||
|
renderer );
|
||||||
|
|
||||||
renderer.overrideBlockTexture = null;
|
renderer.overrideBlockTexture = null;
|
||||||
super.renderInventory( block, is, renderer, type, obj );
|
super.renderInventory( block, is, renderer, type, obj );
|
||||||
@@ -56,8 +58,19 @@ public class RendererSecurity extends BaseBlockRender
|
|||||||
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
Tessellator.instance.setColorOpaque_I( 0xffffff );
|
||||||
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
renderer.setRenderBounds( 0, 0, 0, 1, 1, 1 );
|
||||||
|
|
||||||
IIcon ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
Tessellator.instance.setColorOpaque_I( sp.getColor().whiteVariant );
|
||||||
|
IIcon ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Light.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||||
renderFace( x, y, z, imb, ico, renderer, up );
|
renderFace( x, y, z, imb, ico, renderer, up );
|
||||||
|
if ( sp.isActive() )
|
||||||
|
{
|
||||||
|
Tessellator.instance.setColorOpaque_I( sp.getColor().mediumVariant );
|
||||||
|
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Medium.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||||
|
renderFace( x, y, z, imb, ico, renderer, up );
|
||||||
|
|
||||||
|
Tessellator.instance.setColorOpaque_I( sp.getColor().blackVariant );
|
||||||
|
ico = sp.isActive() ? ExtraBlockTextures.BlockMESecurityOn_Dark.getIcon() : ExtraBlockTextures.MEChest.getIcon();
|
||||||
|
renderFace( x, y, z, imb, ico, renderer, up );
|
||||||
|
}
|
||||||
|
|
||||||
renderer.overrideBlockTexture = null;
|
renderer.overrideBlockTexture = null;
|
||||||
postRenderInWorld( renderer );
|
postRenderInWorld( renderer );
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ public enum ExtraBlockTextures
|
|||||||
|
|
||||||
OreQuartzStone("OreQuartzStone"),
|
OreQuartzStone("OreQuartzStone"),
|
||||||
|
|
||||||
MEChest("BlockMEChest"), BlockMEChestItems("BlockMEChestItems"),
|
MEChest("BlockMEChest"),
|
||||||
|
|
||||||
|
BlockMEChestItems_Light("BlockMEChestItems_Light"), BlockMEChestItems_Dark("BlockMEChestItems_Dark"), BlockMEChestItems_Medium("BlockMEChestItems_Medium"),
|
||||||
|
|
||||||
BlockControllerPowered("BlockControllerPowered"), BlockControllerColumnPowered("BlockControllerColumnPowered"), BlockControllerColumn(
|
BlockControllerPowered("BlockControllerPowered"), BlockControllerColumnPowered("BlockControllerColumnPowered"), BlockControllerColumn(
|
||||||
"BlockControllerColumn"), BlockControllerLights("BlockControllerLights"), BlockControllerColumnLights("BlockControllerColumnLights"), BlockControllerColumnConflict(
|
"BlockControllerColumn"), BlockControllerLights("BlockControllerLights"), BlockControllerColumnLights("BlockControllerColumnLights"), BlockControllerColumnConflict(
|
||||||
@@ -50,7 +52,8 @@ public enum ExtraBlockTextures
|
|||||||
|
|
||||||
BlockSpatialPylonE("BlockSpatialPylon_end"), BlockSpatialPylonE_dim("BlockSpatialPylon_end_dim"), BlockSpatialPylonE_red("BlockSpatialPylon_end_red"),
|
BlockSpatialPylonE("BlockSpatialPylon_end"), BlockSpatialPylonE_dim("BlockSpatialPylon_end_dim"), BlockSpatialPylonE_red("BlockSpatialPylon_end_red"),
|
||||||
|
|
||||||
BlockMESecurityOn("BlockMESecurityOn"), BlockInscriberInside("BlockInscriberInside"),
|
BlockMESecurityOn_Light("BlockMESecurityOn_Light"), BlockMESecurityOn_Medium("BlockMESecurityOn_Medium"), BlockMESecurityOn_Dark("BlockMESecurityOn_Dark"), BlockInscriberInside(
|
||||||
|
"BlockInscriberInside"),
|
||||||
|
|
||||||
BlockQuartzGrowthAcceleratorOn("BlockQuartzGrowthAcceleratorOn"), BlockQuartzGrowthAcceleratorSideOn("BlockQuartzGrowthAcceleratorSideOn"),
|
BlockQuartzGrowthAcceleratorOn("BlockQuartzGrowthAcceleratorOn"), BlockQuartzGrowthAcceleratorSideOn("BlockQuartzGrowthAcceleratorSideOn"),
|
||||||
|
|
||||||
@@ -61,7 +64,10 @@ public enum ExtraBlockTextures
|
|||||||
BlockCraftingStorage1k("BlockCraftingStorage"), BlockCraftingStorage4k("BlockCraftingStorage4k"), BlockCraftingStorage16k("BlockCraftingStorage16k"), BlockCraftingStorage64k(
|
BlockCraftingStorage1k("BlockCraftingStorage"), BlockCraftingStorage4k("BlockCraftingStorage4k"), BlockCraftingStorage16k("BlockCraftingStorage16k"), BlockCraftingStorage64k(
|
||||||
"BlockCraftingStorage64k"),
|
"BlockCraftingStorage64k"),
|
||||||
|
|
||||||
BlockCraftingAcceleratorFit("BlockCraftingAcceleratorFit"), BlockCraftingMonitorFit("BlockCraftingMonitorFit"),
|
BlockCraftingAcceleratorFit("BlockCraftingAcceleratorFit"),
|
||||||
|
|
||||||
|
BlockCraftingMonitorFit_Light("BlockCraftingMonitorFit_Light"), BlockCraftingMonitorFit_Dark("BlockCraftingMonitorFit_Dark"), BlockCraftingMonitorFit_Medium(
|
||||||
|
"BlockCraftingMonitorFit_Medium"),
|
||||||
|
|
||||||
BlockCraftingStorage1kFit("BlockCraftingStorageFit"), BlockCraftingStorage4kFit("BlockCraftingStorage4kFit"), BlockCraftingStorage16kFit(
|
BlockCraftingStorage1kFit("BlockCraftingStorageFit"), BlockCraftingStorage4kFit("BlockCraftingStorage4kFit"), BlockCraftingStorage16kFit(
|
||||||
"BlockCraftingStorage16kFit"), BlockCraftingStorage64kFit("BlockCraftingStorage64kFit"),
|
"BlockCraftingStorage16kFit"), BlockCraftingStorage64kFit("BlockCraftingStorage64kFit"),
|
||||||
|
|||||||
@@ -35,9 +35,21 @@ public class BasicCellHandler implements ICellHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getTopTexture()
|
public IIcon getTopTexture_Dark()
|
||||||
{
|
{
|
||||||
return ExtraBlockTextures.BlockMEChestItems.getIcon();
|
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getTopTexture_Light()
|
||||||
|
{
|
||||||
|
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getTopTexture_Medium()
|
||||||
|
{
|
||||||
|
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,12 +32,6 @@ public class CreativeCellHandler implements ICellHandler
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public IIcon getTopTexture()
|
|
||||||
{
|
|
||||||
return ExtraBlockTextures.BlockMEChestItems.getIcon();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
public void openChestGui(EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan)
|
||||||
{
|
{
|
||||||
@@ -56,4 +50,22 @@ public class CreativeCellHandler implements ICellHandler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getTopTexture_Light()
|
||||||
|
{
|
||||||
|
return ExtraBlockTextures.BlockMEChestItems_Light.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getTopTexture_Medium()
|
||||||
|
{
|
||||||
|
return ExtraBlockTextures.BlockMEChestItems_Medium.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IIcon getTopTexture_Dark()
|
||||||
|
{
|
||||||
|
return ExtraBlockTextures.BlockMEChestItems_Dark.getIcon();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,17 @@ import io.netty.buffer.ByteBuf;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.tile.events.AETileEventHandler;
|
import appeng.tile.events.AETileEventHandler;
|
||||||
import appeng.tile.events.TileEventType;
|
import appeng.tile.events.TileEventType;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class TileCraftingMonitorTile extends TileCraftingTile
|
public class TileCraftingMonitorTile extends TileCraftingTile implements IColorableTile
|
||||||
{
|
{
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@@ -21,17 +24,21 @@ public class TileCraftingMonitorTile extends TileCraftingTile
|
|||||||
public boolean updateList;
|
public boolean updateList;
|
||||||
|
|
||||||
IAEItemStack dspPlay;
|
IAEItemStack dspPlay;
|
||||||
|
AEColor paintedColor = AEColor.Transparent;
|
||||||
|
|
||||||
class CraftingMonitorHandler extends AETileEventHandler
|
class CraftingMonitorHandler extends AETileEventHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
public CraftingMonitorHandler() {
|
public CraftingMonitorHandler() {
|
||||||
super( TileEventType.NETWORK );
|
super( TileEventType.NETWORK, TileEventType.WORLD_NBT );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean readFromStream(ByteBuf data) throws IOException
|
public boolean readFromStream(ByteBuf data) throws IOException
|
||||||
{
|
{
|
||||||
|
AEColor oldPaintedColor = paintedColor;
|
||||||
|
paintedColor = AEColor.values()[data.readByte()];
|
||||||
|
|
||||||
boolean hasItem = data.readBoolean();
|
boolean hasItem = data.readBoolean();
|
||||||
|
|
||||||
if ( hasItem )
|
if ( hasItem )
|
||||||
@@ -40,12 +47,14 @@ public class TileCraftingMonitorTile extends TileCraftingTile
|
|||||||
dspPlay = null;
|
dspPlay = null;
|
||||||
|
|
||||||
updateList = true;
|
updateList = true;
|
||||||
return false; // tesr!
|
return oldPaintedColor != paintedColor; // tesr!
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToStream(ByteBuf data) throws IOException
|
public void writeToStream(ByteBuf data) throws IOException
|
||||||
{
|
{
|
||||||
|
data.writeByte( paintedColor.ordinal() );
|
||||||
|
|
||||||
if ( dspPlay == null )
|
if ( dspPlay == null )
|
||||||
data.writeBoolean( false );
|
data.writeBoolean( false );
|
||||||
else
|
else
|
||||||
@@ -54,6 +63,20 @@ public class TileCraftingMonitorTile extends TileCraftingTile
|
|||||||
dspPlay.writeToPacket( data );
|
dspPlay.writeToPacket( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
if ( data.hasKey( "paintedColor" ) )
|
||||||
|
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound data)
|
||||||
|
{
|
||||||
|
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public TileCraftingMonitorTile() {
|
public TileCraftingMonitorTile() {
|
||||||
@@ -98,4 +121,15 @@ public class TileCraftingMonitorTile extends TileCraftingTile
|
|||||||
return getJobProgress() != null;
|
return getJobProgress() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AEColor getColor()
|
||||||
|
{
|
||||||
|
return paintedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(AEColor newPaintedColor)
|
||||||
|
{
|
||||||
|
paintedColor = newPaintedColor;
|
||||||
|
markDirty();
|
||||||
|
markForUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
|||||||
import appeng.api.features.ILocatable;
|
import appeng.api.features.ILocatable;
|
||||||
import appeng.api.features.IPlayerRegistry;
|
import appeng.api.features.IPlayerRegistry;
|
||||||
import appeng.api.implementations.items.IBiometricCard;
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
@@ -39,6 +40,7 @@ import appeng.api.storage.MEMonitorHandler;
|
|||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.DimensionalCoord;
|
import appeng.api.util.DimensionalCoord;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.helpers.PlayerSecuirtyWrapper;
|
import appeng.helpers.PlayerSecuirtyWrapper;
|
||||||
@@ -55,7 +57,7 @@ import appeng.util.IConfigManagerHost;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEAppEngInventory, ILocatable, IConfigManagerHost, ISecurityProvider
|
public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEAppEngInventory, ILocatable, IConfigManagerHost, ISecurityProvider, IColorableTile
|
||||||
{
|
{
|
||||||
|
|
||||||
private static int diffrence = 0;
|
private static int diffrence = 0;
|
||||||
@@ -66,6 +68,7 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
|||||||
|
|
||||||
private boolean isActive = false;
|
private boolean isActive = false;
|
||||||
|
|
||||||
|
AEColor paintedColor = AEColor.Transparent;
|
||||||
public long securityKey;
|
public long securityKey;
|
||||||
|
|
||||||
public AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
|
public AppEngInternalInventory configSlot = new AppEngInternalInventory( this, 1 );
|
||||||
@@ -131,20 +134,24 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
|||||||
boolean wasActive = isActive;
|
boolean wasActive = isActive;
|
||||||
isActive = data.readBoolean();
|
isActive = data.readBoolean();
|
||||||
|
|
||||||
return wasActive != isActive;
|
AEColor oldPaintedColor = paintedColor;
|
||||||
|
paintedColor = AEColor.values()[data.readByte()];
|
||||||
|
|
||||||
|
return oldPaintedColor != paintedColor || wasActive != isActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToStream(ByteBuf data) throws IOException
|
public void writeToStream(ByteBuf data) throws IOException
|
||||||
{
|
{
|
||||||
data.writeBoolean( gridProxy.isActive() );
|
data.writeBoolean( gridProxy.isActive() );
|
||||||
|
data.writeByte( paintedColor.ordinal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound data)
|
public void writeToNBT(NBTTagCompound data)
|
||||||
{
|
{
|
||||||
cm.writeToNBT( data );
|
cm.writeToNBT( data );
|
||||||
;
|
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
|
||||||
|
|
||||||
data.setLong( "securityKey", securityKey );
|
data.setLong( "securityKey", securityKey );
|
||||||
configSlot.writeToNBT( data, "config" );
|
configSlot.writeToNBT( data, "config" );
|
||||||
@@ -166,6 +173,8 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
|||||||
public void readFromNBT(NBTTagCompound data)
|
public void readFromNBT(NBTTagCompound data)
|
||||||
{
|
{
|
||||||
cm.readFromNBT( data );
|
cm.readFromNBT( data );
|
||||||
|
if ( data.hasKey( "paintedColor" ) )
|
||||||
|
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
|
||||||
|
|
||||||
securityKey = data.getLong( "securityKey" );
|
securityKey = data.getLong( "securityKey" );
|
||||||
configSlot.readFromNBT( data, "config" );
|
configSlot.readFromNBT( data, "config" );
|
||||||
@@ -314,4 +323,16 @@ public class TileSecurity extends AENetworkTile implements ITerminalHost, IAEApp
|
|||||||
return securityKey;
|
return securityKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AEColor getColor()
|
||||||
|
{
|
||||||
|
return paintedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(AEColor newPaintedColor)
|
||||||
|
{
|
||||||
|
paintedColor = newPaintedColor;
|
||||||
|
markDirty();
|
||||||
|
markForUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import appeng.api.config.Settings;
|
|||||||
import appeng.api.config.SortDir;
|
import appeng.api.config.SortDir;
|
||||||
import appeng.api.config.SortOrder;
|
import appeng.api.config.SortOrder;
|
||||||
import appeng.api.config.ViewItems;
|
import appeng.api.config.ViewItems;
|
||||||
|
import appeng.api.implementations.tiles.IColorableTile;
|
||||||
import appeng.api.implementations.tiles.IMEChest;
|
import appeng.api.implementations.tiles.IMEChest;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.energy.IEnergyGrid;
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
@@ -51,6 +52,7 @@ import appeng.api.storage.StorageChannel;
|
|||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
import appeng.me.GridAccessException;
|
import appeng.me.GridAccessException;
|
||||||
@@ -65,7 +67,7 @@ import appeng.util.IConfigManagerHost;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEFluidStack;
|
import appeng.util.item.AEFluidStack;
|
||||||
|
|
||||||
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost
|
public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHandler, ITerminalHost, IPriorityHost, IConfigManagerHost, IColorableTile
|
||||||
{
|
{
|
||||||
|
|
||||||
static private class ChestNoHandler extends Exception
|
static private class ChestNoHandler extends Exception
|
||||||
@@ -91,6 +93,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
int state = 0;
|
int state = 0;
|
||||||
boolean wasActive = false;
|
boolean wasActive = false;
|
||||||
|
|
||||||
|
AEColor paintedColor = AEColor.Transparent;
|
||||||
|
|
||||||
private void recalculateDisplay()
|
private void recalculateDisplay()
|
||||||
{
|
{
|
||||||
int oldState = state;
|
int oldState = state;
|
||||||
@@ -193,6 +197,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
state &= ~0x40;
|
state &= ~0x40;
|
||||||
|
|
||||||
data.writeByte( state );
|
data.writeByte( state );
|
||||||
|
data.writeByte( paintedColor.ordinal() );
|
||||||
|
|
||||||
ItemStack is = inv.getStackInSlot( 1 );
|
ItemStack is = inv.getStackInSlot( 1 );
|
||||||
|
|
||||||
if ( is == null )
|
if ( is == null )
|
||||||
@@ -212,6 +218,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
ItemStack oldType = storageType;
|
ItemStack oldType = storageType;
|
||||||
|
|
||||||
state = data.readByte();
|
state = data.readByte();
|
||||||
|
AEColor oldPaintedColor = paintedColor;
|
||||||
|
paintedColor = AEColor.values()[data.readByte()];
|
||||||
|
|
||||||
int item = data.readInt();
|
int item = data.readInt();
|
||||||
|
|
||||||
@@ -222,7 +230,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
|
|
||||||
lastStateChange = worldObj.getTotalWorldTime();
|
lastStateChange = worldObj.getTotalWorldTime();
|
||||||
|
|
||||||
return (state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB) || !Platform.isSameItemPrecise( oldType, storageType );
|
return oldPaintedColor != paintedColor || (state & 0xDB6DB6DB) != (oldState & 0xDB6DB6DB) || !Platform.isSameItemPrecise( oldType, storageType );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -230,6 +238,8 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
{
|
{
|
||||||
config.readFromNBT( data );
|
config.readFromNBT( data );
|
||||||
priority = data.getInteger( "priority" );
|
priority = data.getInteger( "priority" );
|
||||||
|
if ( data.hasKey( "paintedColor" ) )
|
||||||
|
paintedColor = AEColor.values()[data.getByte( "paintedColor" )];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -237,6 +247,7 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
{
|
{
|
||||||
config.writeToNBT( data );
|
config.writeToNBT( data );
|
||||||
data.setInteger( "priority", priority );
|
data.setInteger( "priority", priority );
|
||||||
|
data.setByte( "paintedColor", (byte) paintedColor.ordinal() );
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -811,4 +822,15 @@ public class TileChest extends AENetworkPowerTile implements IMEChest, IFluidHan
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AEColor getColor()
|
||||||
|
{
|
||||||
|
return paintedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(AEColor newPaintedColor)
|
||||||
|
{
|
||||||
|
paintedColor = newPaintedColor;
|
||||||
|
markDirty();
|
||||||
|
markForUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user