Colored Item Definitions
This commit is contained in:
@@ -10,7 +10,8 @@ import net.minecraft.util.Icon;
|
|||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.api.util.AEColoredItemDefinition;
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.client.render.BaseBlockRender;
|
import appeng.client.render.BaseBlockRender;
|
||||||
import appeng.client.texture.ExtraTextures;
|
import appeng.client.texture.ExtraTextures;
|
||||||
@@ -92,15 +93,15 @@ public class RenderQNB extends BaseBlockRender
|
|||||||
{
|
{
|
||||||
if ( tqb.isFormed() )
|
if ( tqb.isFormed() )
|
||||||
{
|
{
|
||||||
AEItemDefinition cabldef = AEApi.instance().parts().partCableGlass;
|
AEColoredItemDefinition cabldef = AEApi.instance().parts().partCableGlass;
|
||||||
Item cable = cabldef.item();
|
Item cable = cabldef.item( AEColor.Transparent );
|
||||||
|
|
||||||
AEItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
AEColoredItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
||||||
Item ccable = ccabldef.item();
|
Item ccable = ccabldef.item( AEColor.Transparent );
|
||||||
|
|
||||||
EnumSet<ForgeDirection> sides = tqb.getConnections();
|
EnumSet<ForgeDirection> sides = tqb.getConnections();
|
||||||
renderCableAt( 0.11D, world, x, y, z, block, renderer, cable.getIconIndex( cabldef.stack( 1 ) ), 0.141D, sides );
|
renderCableAt( 0.11D, world, x, y, z, block, renderer, cable.getIconIndex( cabldef.stack( AEColor.Transparent, 1 ) ), 0.141D, sides );
|
||||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( 1 ) ), 0.1875D, tqb.getConnections() );
|
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( AEColor.Transparent, 1 ) ), 0.1875D, tqb.getConnections() );
|
||||||
}
|
}
|
||||||
|
|
||||||
float px = 2.0f / 16.0f;
|
float px = 2.0f / 16.0f;
|
||||||
@@ -120,12 +121,13 @@ public class RenderQNB extends BaseBlockRender
|
|||||||
}
|
}
|
||||||
else if ( tqb.isCorner() )
|
else if ( tqb.isCorner() )
|
||||||
{
|
{
|
||||||
// renderCableAt(0.11D, world, x, y, z, block, modelId, renderer,
|
// renderCableAt(0.11D, world, x, y, z, block, modelId,
|
||||||
|
// renderer,
|
||||||
// AppEngTextureRegistry.Blocks.MECable.get(), true, 0.0D);
|
// AppEngTextureRegistry.Blocks.MECable.get(), true, 0.0D);
|
||||||
AEItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
AEColoredItemDefinition ccabldef = AEApi.instance().parts().partCableCovered;
|
||||||
Item ccable = ccabldef.item();
|
Item ccable = ccabldef.item( AEColor.Transparent );
|
||||||
|
|
||||||
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( 1 ) ), 0.05D, tqb.getConnections() );
|
renderCableAt( 0.188D, world, x, y, z, block, renderer, ccable.getIconIndex( ccabldef.stack( AEColor.Transparent, 1 ) ), 0.05D, tqb.getConnections() );
|
||||||
|
|
||||||
float px = 4.0f / 16.0f;
|
float px = 4.0f / 16.0f;
|
||||||
float maxpx = 12.0f / 16.0f;
|
float maxpx = 12.0f / 16.0f;
|
||||||
|
|||||||
+17
-4
@@ -24,6 +24,7 @@ import appeng.api.networking.pathing.IPathingGrid;
|
|||||||
import appeng.api.networking.spatial.ISpatialCache;
|
import appeng.api.networking.spatial.ISpatialCache;
|
||||||
import appeng.api.networking.storage.IStorageGrid;
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
import appeng.api.networking.ticking.ITickManager;
|
import appeng.api.networking.ticking.ITickManager;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
import appeng.block.grindstone.BlockCrank;
|
import appeng.block.grindstone.BlockCrank;
|
||||||
import appeng.block.grindstone.BlockGrinder;
|
import appeng.block.grindstone.BlockGrinder;
|
||||||
@@ -66,8 +67,10 @@ import appeng.block.storage.BlockDrive;
|
|||||||
import appeng.block.storage.BlockIOPort;
|
import appeng.block.storage.BlockIOPort;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.AEFeatureHandler;
|
import appeng.core.features.AEFeatureHandler;
|
||||||
|
import appeng.core.features.ColoredItemDefinition;
|
||||||
import appeng.core.features.DamagedItemDefinition;
|
import appeng.core.features.DamagedItemDefinition;
|
||||||
import appeng.core.features.IAEFeature;
|
import appeng.core.features.IAEFeature;
|
||||||
|
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||||
import appeng.core.features.registries.entries.BasicCellHandler;
|
import appeng.core.features.registries.entries.BasicCellHandler;
|
||||||
import appeng.core.features.registries.entries.CreativeCellHandler;
|
import appeng.core.features.registries.entries.CreativeCellHandler;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
@@ -182,10 +185,17 @@ public class Registration
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (Enum v : varients)
|
if ( varients[0] instanceof AEColor )
|
||||||
{
|
{
|
||||||
ItemStack is = ((ItemPart) partItem.item()).createPart( type, v );
|
ColoredItemDefinition def = new ColoredItemDefinition();
|
||||||
f.set( parts, new DamagedItemDefinition( is ) );
|
|
||||||
|
for (Enum v : varients)
|
||||||
|
{
|
||||||
|
ItemStack is = ((ItemPart) partItem.item()).createPart( type, v );
|
||||||
|
def.add( (AEColor) v, is );
|
||||||
|
}
|
||||||
|
|
||||||
|
f.set( parts, def );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -408,6 +418,9 @@ public class Registration
|
|||||||
|
|
||||||
AEApi.instance().registries().matterCannon().registerAmmo( AEApi.instance().materials().materialMatterBall.stack( 1 ), 32.0 );
|
AEApi.instance().registries().matterCannon().registerAmmo( AEApi.instance().materials().materialMatterBall.stack( 1 ), 32.0 );
|
||||||
|
|
||||||
|
// default settings..
|
||||||
|
((P2PTunnelRegistry) AEApi.instance().registries().p2pTunnel()).configure();
|
||||||
|
|
||||||
NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler );
|
NetworkRegistry.instance().registerGuiHandler( AppEng.instance, GuiBridge.GUI_Handler );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,7 +468,7 @@ public class Registration
|
|||||||
// partStorageBus
|
// partStorageBus
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||||
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 1 );
|
||||||
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 3 );
|
Upgrades.CAPACITY.registerItem( AEApi.instance().parts().partStorageBus.stack( 1 ), 5 );
|
||||||
|
|
||||||
// matter cannon
|
// matter cannon
|
||||||
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
Upgrades.FUZZY.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package appeng.core.features;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.api.util.AEColoredItemDefinition;
|
||||||
|
|
||||||
|
public class ColoredItemDefinition implements AEColoredItemDefinition
|
||||||
|
{
|
||||||
|
|
||||||
|
ItemStack colors[] = new ItemStack[17];
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Item item(AEColor color)
|
||||||
|
{
|
||||||
|
ItemStack is = colors[color.ordinal()];
|
||||||
|
|
||||||
|
if ( is == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return is.getItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack stack(AEColor color, int stackSize)
|
||||||
|
{
|
||||||
|
ItemStack is = colors[color.ordinal()];
|
||||||
|
|
||||||
|
if ( is == null )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new ItemStack( is.getItem(), stackSize, is.getItemDamage() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean sameAs(AEColor color, ItemStack comparableItem)
|
||||||
|
{
|
||||||
|
ItemStack is = colors[color.ordinal()];
|
||||||
|
|
||||||
|
if ( comparableItem == null )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return comparableItem.getItem() == is.getItem() && comparableItem.getItemDamage() == is.getItemDamage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(AEColor v, ItemStack is)
|
||||||
|
{
|
||||||
|
colors[v.ordinal()] = is;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Block block(AEColor color)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends TileEntity> entity(AEColor color)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -141,7 +141,7 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
return CableBusTextures.MECovered_Yellow.getIcon();
|
return CableBusTextures.MECovered_Yellow.getIcon();
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
return AEApi.instance().parts().partCableCovered.item().getIconIndex( AEApi.instance().parts().partCableCovered.stack( 1 ) );
|
return AEApi.instance().parts().partCableCovered.item( AEColor.Transparent ).getIconIndex( AEApi.instance().parts().partCableCovered.stack( AEColor.Transparent, 1 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Icon getSmartTexture(AEColor c)
|
public Icon getSmartTexture(AEColor c)
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class PartDenseCable extends PartCable
|
|||||||
public Icon getTexture(AEColor c)
|
public Icon getTexture(AEColor c)
|
||||||
{
|
{
|
||||||
if ( c == AEColor.Transparent )
|
if ( c == AEColor.Transparent )
|
||||||
return AEApi.instance().parts().partCableSmart.stack( 1 ).getIconIndex();
|
return AEApi.instance().parts().partCableSmart.stack( AEColor.Transparent, 1 ).getIconIndex();
|
||||||
|
|
||||||
return getSmartTexture( c );
|
return getSmartTexture( c );
|
||||||
}
|
}
|
||||||
@@ -192,31 +192,40 @@ public class PartDenseCable extends PartCable
|
|||||||
boolean isGlass = false;
|
boolean isGlass = false;
|
||||||
AEColor myColor = getCableColor();
|
AEColor myColor = getCableColor();
|
||||||
/*
|
/*
|
||||||
* ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) == AECableType.GLASS && ccph.getPart(
|
* ( ghh != null && ccph != null && ghh.getCableConnectionType( of ) ==
|
||||||
* of.getOpposite() ) == null ) { isGlass = true; rh.setTexture( getGlassTexture( myColor = ccph.getColor() ) );
|
* AECableType.GLASS && ccph.getPart( of.getOpposite() ) == null ) {
|
||||||
* } else if ( ccph == null && ghh != null && ghh.getCableConnectionType( of ) != AECableType.GLASS ) {
|
* isGlass = true; rh.setTexture( getGlassTexture( myColor =
|
||||||
* rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN: rh.setBounds( 3, 0, 3, 13, 4, 13 );
|
* ccph.getColor() ) ); } else if ( ccph == null && ghh != null &&
|
||||||
* break; case EAST: rh.setBounds( 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13, 13, 4
|
* ghh.getCableConnectionType( of ) != AECableType.GLASS ) {
|
||||||
* ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 ); break; case UP: rh.setBounds( 3, 12, 3, 13, 16,
|
* rh.setTexture( getSmartTexture( myColor ) ); switch (of) { case DOWN:
|
||||||
* 13 ); break; case WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; } rh.renderBlock( x, y,
|
* rh.setBounds( 3, 0, 3, 13, 4, 13 ); break; case EAST: rh.setBounds(
|
||||||
* z, renderer );
|
* 12, 3, 3, 16, 13, 13 ); break; case NORTH: rh.setBounds( 3, 3, 0, 13,
|
||||||
|
* 13, 4 ); break; case SOUTH: rh.setBounds( 3, 3, 12, 13, 13, 16 );
|
||||||
|
* break; case UP: rh.setBounds( 3, 12, 3, 13, 16, 13 ); break; case
|
||||||
|
* WEST: rh.setBounds( 0, 3, 3, 4, 13, 13 ); break; default: return; }
|
||||||
|
* rh.renderBlock( x, y, z, renderer );
|
||||||
*
|
*
|
||||||
* if ( true ) { setSmartConnectionRotations( of, renderer ); Icon defa = new TaughtIcon( getChannelTex(
|
* if ( true ) { setSmartConnectionRotations( of, renderer ); Icon defa
|
||||||
* channels, false ).getIcon(), -0.2f ); Icon defb = new TaughtIcon( getChannelTex( channels, true ).getIcon(),
|
* = new TaughtIcon( getChannelTex( channels, false ).getIcon(), -0.2f
|
||||||
* -0.2f );
|
* ); Icon defb = new TaughtIcon( getChannelTex( channels, true
|
||||||
|
* ).getIcon(), -0.2f );
|
||||||
*
|
*
|
||||||
* if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) { AEBaseBlock blk = (AEBaseBlock)
|
* if ( of == ForgeDirection.EAST || of == ForgeDirection.WEST ) {
|
||||||
* rh.getBlock(); FlipableIcon ico = blk.getRendererInstance().getTexture( ForgeDirection.EAST ); ico.setFlip(
|
* AEBaseBlock blk = (AEBaseBlock) rh.getBlock(); FlipableIcon ico =
|
||||||
* false, true ); }
|
* blk.getRendererInstance().getTexture( ForgeDirection.EAST );
|
||||||
|
* ico.setFlip( false, true ); }
|
||||||
*
|
*
|
||||||
* Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 ); Tessellator.instance.setColorOpaque_I(
|
* Tessellator.instance.setBrightness( 15 << 20 | 15 << 5 );
|
||||||
* myColor.mediumVariant ); rh.setTexture( defa, defa, defa, defa, defa, defa ); renderAllFaces( (AEBaseBlock)
|
* Tessellator.instance.setColorOpaque_I( myColor.mediumVariant );
|
||||||
* rh.getBlock(), x, y, z, renderer );
|
* rh.setTexture( defa, defa, defa, defa, defa, defa ); renderAllFaces(
|
||||||
|
* (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
||||||
*
|
*
|
||||||
* Tessellator.instance.setColorOpaque_I( myColor.whiteVariant ); rh.setTexture( defb, defb, defb, defb, defb,
|
* Tessellator.instance.setColorOpaque_I( myColor.whiteVariant );
|
||||||
* defb ); renderAllFaces( (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
* rh.setTexture( defb, defb, defb, defb, defb, defb ); renderAllFaces(
|
||||||
|
* (AEBaseBlock) rh.getBlock(), x, y, z, renderer );
|
||||||
*
|
*
|
||||||
* renderer.uvRotateBottom = renderer.uvRotateEast = renderer.uvRotateNorth = renderer.uvRotateSouth =
|
* renderer.uvRotateBottom = renderer.uvRotateEast =
|
||||||
|
* renderer.uvRotateNorth = renderer.uvRotateSouth =
|
||||||
* renderer.uvRotateTop = renderer.uvRotateWest = 0; }
|
* renderer.uvRotateTop = renderer.uvRotateWest = 0; }
|
||||||
*
|
*
|
||||||
* rh.setTexture( getTexture( getCableColor() ) ); }
|
* rh.setTexture( getTexture( getCableColor() ) ); }
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
|
|||||||
|
|
||||||
public PartQuartzFiber(ItemStack is) {
|
public PartQuartzFiber(ItemStack is) {
|
||||||
super( PartQuartzFiber.class, is );
|
super( PartQuartzFiber.class, is );
|
||||||
|
proxy.setIdlePowerUsage( 0 );
|
||||||
proxy.setFlags( GridFlags.CANNOT_CARRY );
|
proxy.setFlags( GridFlags.CANNOT_CARRY );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user