Fixes #675 No disabled feature should log spam or crash anymore.

Deprecates the old usage of the AEItemDefinitions via the direct method access of

* blocks()
* parts()
* items()
* materials()

and thus use the new re-direct via definitions().

All definitions are now initialized, no matter what. But SubItems, Items and Blocks are not registered, if by chance are disabled.
This commit is contained in:
thatsIch
2015-01-03 02:53:14 +01:00
parent 3dd81433ac
commit 9986ffc458
385 changed files with 12477 additions and 8292 deletions
+34 -31
View File
@@ -18,6 +18,7 @@
package appeng.parts;
import java.io.IOException;
import io.netty.buffer.ByteBuf;
@@ -40,7 +41,8 @@ import appeng.api.parts.IPartRenderHelper;
import appeng.client.texture.CableBusTextures;
import appeng.me.GridAccessException;
public class PartBasicState extends AEBasePart implements IPowerChannelState
public abstract class PartBasicState extends AEBasePart implements IPowerChannelState
{
protected final int POWERED_FLAG = 1;
@@ -48,19 +50,36 @@ public class PartBasicState extends AEBasePart implements IPowerChannelState
protected int clientFlags = 0; // sent as byte.
public PartBasicState( ItemStack is )
{
super( is );
this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL );
}
@MENetworkEventSubscribe
public void chanRender(MENetworkChannelsChanged c)
public void chanRender( MENetworkChannelsChanged c )
{
this.getHost().markForUpdate();
}
@MENetworkEventSubscribe
public void powerRender(MENetworkPowerStatusChange c)
public void powerRender( MENetworkPowerStatusChange c )
{
this.getHost().markForUpdate();
}
public void setColors(boolean hasChan, boolean hasPower)
@SideOnly( Side.CLIENT )
public void renderLights( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
{
rh.normalRendering();
this.setColors( ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG ), ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.EAST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.WEST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.UP, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.DOWN, renderer );
}
public void setColors( boolean hasChan, boolean hasPower )
{
if ( hasChan )
{
@@ -81,19 +100,8 @@ public class PartBasicState extends AEBasePart implements IPowerChannelState
}
}
@SideOnly(Side.CLIENT)
public void renderLights(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
{
rh.normalRendering();
this.setColors( (this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) == (this.POWERED_FLAG | this.CHANNEL_FLAG), (this.clientFlags & this.POWERED_FLAG) == this.POWERED_FLAG );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.EAST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.WEST, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.UP, renderer );
rh.renderFace( x, y, z, CableBusTextures.PartMonitorSidesStatusLights.getIcon(), ForgeDirection.DOWN, renderer );
}
@Override
public void writeToStream(ByteBuf data) throws IOException
public void writeToStream( ByteBuf data ) throws IOException
{
super.writeToStream( data );
@@ -109,7 +117,7 @@ public class PartBasicState extends AEBasePart implements IPowerChannelState
this.clientFlags = this.populateFlags( this.clientFlags );
}
catch (GridAccessException e)
catch ( GridAccessException e )
{
// meh
}
@@ -117,13 +125,13 @@ public class PartBasicState extends AEBasePart implements IPowerChannelState
data.writeByte( (byte) this.clientFlags );
}
protected int populateFlags(int cf)
protected int populateFlags( int cf )
{
return cf;
}
@Override
public boolean readFromStream(ByteBuf data) throws IOException
public boolean readFromStream( ByteBuf data ) throws IOException
{
boolean eh = super.readFromStream( data );
@@ -133,27 +141,22 @@ public class PartBasicState extends AEBasePart implements IPowerChannelState
return eh || old != this.clientFlags;
}
public PartBasicState(Class c, ItemStack is) {
super( c, is );
this.proxy.setFlags( GridFlags.REQUIRE_CHANNEL );
@Override
@SideOnly( Side.CLIENT )
public IIcon getBreakingTexture()
{
return CableBusTextures.PartTransitionPlaneBack.getIcon();
}
@Override
public boolean isPowered()
{
return (this.clientFlags & this.POWERED_FLAG) == this.POWERED_FLAG;
return ( this.clientFlags & this.POWERED_FLAG ) == this.POWERED_FLAG;
}
@Override
public boolean isActive()
{
return (this.clientFlags & this.CHANNEL_FLAG) == this.CHANNEL_FLAG;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getBreakingTexture()
{
return CableBusTextures.PartTransitionPlaneBack.getIcon();
return ( this.clientFlags & this.CHANNEL_FLAG ) == this.CHANNEL_FLAG;
}
}