Updates BuildCraft to 7.0.9

Split dependency logic on the BuildCraft modules.
Config needs to be reset, if BuildCraft was disabled actively,
because now there are 3 BC modules to be taken account of
This commit is contained in:
thatsIch
2015-06-08 01:41:35 +02:00
parent 57836848ae
commit 71ce42f26a
25 changed files with 947 additions and 621 deletions
@@ -35,7 +35,7 @@ import appeng.api.parts.IFacadePart;
import appeng.api.parts.IPartHost;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.items.parts.ItemFacade;
import appeng.parts.CableBusStorage;
@@ -137,11 +137,13 @@ public class FacadeContainer implements IFacadeContainer
boolean isBC = ids[0] < 0;
ids[0] = Math.abs( ids[0] );
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
final IFacadePart created = bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side );
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, bc.createFacadePart( (Block) Block.blockRegistry.getObjectById( ids[0] ), ids[1], side ) );
this.storage.setFacade( x, created );
}
else if( !isBC )
{
@@ -187,9 +189,9 @@ public class FacadeContainer implements IFacadeContainer
}
else
{
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( bc.isFacade( is ) )
{
this.storage.setFacade( x, bc.createFacadePart( is, ForgeDirection.getOrientation( x ) ) );
@@ -221,7 +223,7 @@ public class FacadeContainer implements IFacadeContainer
{
int itemID = Item.getIdFromItem( part.getItem() );
int dmgValue = part.getItemDamage();
out.writeInt( itemID * ( part.isBC() ? -1 : 1 ) );
out.writeInt( itemID * ( part.notAEFacade() ? -1 : 1 ) );
out.writeInt( dmgValue );
}
}
+126 -121
View File
@@ -20,6 +20,7 @@ package appeng.facade;
import java.util.EnumSet;
import javax.annotation.Nullable;
import org.lwjgl.opengl.GL11;
@@ -53,7 +54,7 @@ import appeng.client.render.RenderBlocksWorkaround;
import appeng.core.AELog;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.util.Platform;
@@ -131,10 +132,10 @@ public class FacadePart implements IFacadePart, IBoxProvider
}
IIcon myIcon = null;
if( this.isBC() )
if( this.notAEFacade() && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
myIcon = bc.getFacadeTexture();
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
myIcon = bc.getCobbleStructurePipeTexture();
}
if( myIcon == null )
@@ -144,7 +145,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
instance.setTexture( myIcon );
if( this.isBC() )
if( this.notAEFacade() )
{
instance.setBounds( 6, 6, 10, 10, 10, 15 );
}
@@ -342,6 +343,124 @@ public class FacadePart implements IFacadePart, IBoxProvider
}
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
{
if( this.facade != null )
{
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
try
{
if( fi != null )
{
ItemStack randomItem = fi.getTextureItem( this.facade );
instance.setTexture( this.facade.getIconIndex() );
instance.setBounds( 7, 7, 4, 9, 9, 14 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
if( randomItem != null )
{
if( randomItem.getItem() instanceof ItemBlock )
{
ItemBlock ib = (ItemBlock) randomItem.getItem();
Block blk = Block.getBlockFromItem( ib );
try
{
int color = ib.getColorFromItemStack( randomItem, 0 );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( color );
}
catch( Throwable error )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( 0xffffff );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
instance.setBounds( 0, 0, 14, 16, 16, 16 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
}
}
}
}
catch( Exception ignored )
{
}
}
}
@Override
public ForgeDirection getSide()
{
return this.side;
}
@Override
public AxisAlignedBB getPrimaryBox()
{
return Platform.getPrimaryBox( this.side, this.thickness );
}
@Override
public Item getItem()
{
ItemStack is = this.getTexture();
if( is == null )
{
return null;
}
return is.getItem();
}
@Override
public int getItemDamage()
{
ItemStack is = this.getTexture();
if( is == null )
{
return 0;
}
return is.getItemDamage();
}
@Override
public boolean notAEFacade()
{
return !( this.facade.getItem() instanceof IFacadeItem );
}
@Override
public void setThinFacades( boolean useThinFacades )
{
this.thickness = useThinFacades ? 1 : 2;
}
@Override
public boolean isTransparent()
{
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
{
return true;
}
ItemStack is = this.getTexture();
Block blk = Block.getBlockFromItem( is.getItem() );
return !blk.isOpaqueCube();
}
@Nullable
ItemStack getTexture()
{
final Item maybeFacade = this.facade.getItem();
@@ -353,9 +472,9 @@ public class FacadePart implements IFacadePart, IBoxProvider
return facade.getTextureItem( this.facade );
}
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BC ) )
else if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBC bc = (IBC) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
return bc.getTextureForFacade( this.facade );
}
@@ -484,120 +603,6 @@ public class FacadePart implements IFacadePart, IBoxProvider
return true;
}
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
{
if( this.facade != null )
{
IFacadeItem fi = (IFacadeItem) this.facade.getItem();
try
{
ItemStack randomItem = fi.getTextureItem( this.facade );
instance.setTexture( this.facade.getIconIndex() );
instance.setBounds( 7, 7, 4, 9, 9, 14 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
if( randomItem != null )
{
if( randomItem.getItem() instanceof ItemBlock )
{
ItemBlock ib = (ItemBlock) randomItem.getItem();
Block blk = Block.getBlockFromItem( ib );
try
{
int color = ib.getColorFromItemStack( randomItem, 0 );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( color );
}
catch( Throwable error )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( 0xffffff );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
instance.setBounds( 0, 0, 14, 16, 16, 16 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
}
}
}
catch( Throwable ignored )
{
}
}
}
@Override
public ForgeDirection getSide()
{
return this.side;
}
@Override
public AxisAlignedBB getPrimaryBox()
{
return Platform.getPrimaryBox( this.side, this.thickness );
}
@Override
public Item getItem()
{
ItemStack is = this.getTexture();
if( is == null )
{
return null;
}
return is.getItem();
}
@Override
public int getItemDamage()
{
ItemStack is = this.getTexture();
if( is == null )
{
return 0;
}
return is.getItemDamage();
}
@Override
public boolean isBC()
{
return !( this.facade.getItem() instanceof IFacadeItem );
}
@Override
public void setThinFacades( boolean useThinFacades )
{
this.thickness = useThinFacades ? 1 : 2;
}
@Override
public boolean isTransparent()
{
if( AEApi.instance().partHelper().getCableRenderMode().transparentFacades )
{
return true;
}
ItemStack is = this.getTexture();
Block blk = Block.getBlockFromItem( is.getItem() );
return !blk.isOpaqueCube();
}
@Override
public void getBoxes( IPartCollisionHelper bch )
{