Fix Crash When using Debug Blocks.

Register Quartz/Fluix Blocks with BC Facades.
This commit is contained in:
AlgorithmX2 2014-02-23 14:06:07 -06:00
parent 15f300c553
commit 5e0bf9c5b9
6 changed files with 85 additions and 10 deletions

View file

@ -32,6 +32,7 @@ import appeng.client.render.BaseBlockRender;
import appeng.client.render.BlockRenderInfo;
import appeng.client.render.WorldRender;
import appeng.client.texture.FlipableIcon;
import appeng.client.texture.MissingIcon;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;
@ -134,6 +135,13 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
info.updateIcons( bottomIcon, topIcon, northIcon, southIcon, eastIcon, westIcon );
}
public void registerNoIcons()
{
BlockRenderInfo info = getRendererInstance();
FlipableIcon i = new FlipableIcon( new MissingIcon() );
info.updateIcons( i, i, i, i, i, i );
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)

View file

@ -1,9 +1,9 @@
package appeng.client.render;
import appeng.client.texture.FlipableIcon;
import appeng.client.texture.TmpFlipableIcon;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.client.texture.FlipableIcon;
import appeng.client.texture.TmpFlipableIcon;
public class BlockRenderInfo
{
@ -29,8 +29,7 @@ public class BlockRenderInfo
private FlipableIcon eastIcon = null;
private FlipableIcon westIcon = null;
public void updateIcons(FlipableIcon Bottom, FlipableIcon Top, FlipableIcon North, FlipableIcon South, FlipableIcon East,
FlipableIcon West)
public void updateIcons(FlipableIcon Bottom, FlipableIcon Top, FlipableIcon North, FlipableIcon South, FlipableIcon East, FlipableIcon West)
{
topIcon = Top;
bottomIcon = Bottom;
@ -57,8 +56,7 @@ public class BlockRenderInfo
}
}
public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon,
IIcon nWestIcon)
public void setTemporaryRenderIcons(IIcon nTopIcon, IIcon nBottomIcon, IIcon nSouthIcon, IIcon nNorthIcon, IIcon nEastIcon, IIcon nWestIcon)
{
tmpTopIcon.setOriginal( nTopIcon == null ? getTexture( ForgeDirection.UP ) : nTopIcon );
tmpBottomIcon.setOriginal( nBottomIcon == null ? getTexture( ForgeDirection.DOWN ) : nBottomIcon );
@ -115,8 +113,7 @@ public class BlockRenderInfo
public boolean isValid()
{
return topIcon != null && bottomIcon != null && southIcon != null && northIcon != null && eastIcon != null
&& westIcon != null;
return topIcon != null && bottomIcon != null && southIcon != null && northIcon != null && eastIcon != null && westIcon != null;
}
}

View file

@ -0,0 +1,62 @@
package appeng.client.texture;
import net.minecraft.util.IIcon;
public class MissingIcon implements IIcon
{
@Override
public int getIconWidth()
{
return ExtraTextures.getMissing().getIconWidth();
}
@Override
public int getIconHeight()
{
return ExtraTextures.getMissing().getIconHeight();
}
@Override
public float getMinU()
{
return ExtraTextures.getMissing().getMinU();
}
@Override
public float getMaxU()
{
return ExtraTextures.getMissing().getMaxU();
}
@Override
public float getInterpolatedU(double var1)
{
return ExtraTextures.getMissing().getInterpolatedU( var1 );
}
@Override
public float getMinV()
{
return ExtraTextures.getMissing().getMinV();
}
@Override
public float getMaxV()
{
return ExtraTextures.getMissing().getMaxV();
}
@Override
public float getInterpolatedV(double var1)
{
return ExtraTextures.getMissing().getInterpolatedV( var1 );
}
@Override
public String getIconName()
{
return ExtraTextures.getMissing().getIconName();
}
}

View file

@ -32,7 +32,7 @@ public class BlockChunkloader extends AEBaseBlock implements LoadingCallback
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
return;
registerNoIcons();
}
}

View file

@ -19,7 +19,7 @@ public class BlockItemGen extends AEBaseBlock
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
return;
registerNoIcons();
}
}

View file

@ -9,6 +9,7 @@ import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.TunnelType;
import appeng.api.definitions.Blocks;
import appeng.api.features.IP2PTunnelRegistry;
import appeng.api.parts.IFacadePart;
import appeng.facade.FacadePart;
@ -187,6 +188,13 @@ public class BC extends BaseModule implements IBC
{
registerPowerP2P();
registerItemP2P();
Blocks b = AEApi.instance().blocks();
addFacade( b.blockFluix.stack( 1 ) );
addFacade( b.blockQuartz.stack( 1 ) );
addFacade( b.blockQuartzChiseled.stack( 1 ) );
addFacade( b.blockQuartzPiller.stack( 1 ) );
registerLiquidsP2P();
}