Basic reformat, hit once, hope never again

This commit is contained in:
thatsIch
2015-04-03 08:54:31 +02:00
parent 4ff1631f89
commit d34c988c88
886 changed files with 31400 additions and 30990 deletions
+58 -57
View File
@@ -18,6 +18,7 @@
package appeng.block;
import java.util.List;
import net.minecraft.block.Block;
@@ -42,71 +43,78 @@ import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class AEBaseItemBlock extends ItemBlock
{
final AEBaseBlock blockType;
public AEBaseItemBlock(Block id)
public AEBaseItemBlock( Block id )
{
super( id );
this.blockType = (AEBaseBlock) id;
this.hasSubtypes = this.blockType.hasSubtypes;
if ( Platform.isClient() )
if( Platform.isClient() )
MinecraftForgeClient.registerItemRenderer( this, ItemRenderer.INSTANCE );
}
@Override
public int getMetadata(int dmg)
public int getMetadata( int dmg )
{
if ( this.hasSubtypes )
if( this.hasSubtypes )
return dmg;
return 0;
}
@Override
public String getUnlocalizedName(ItemStack is)
{
return this.blockType.getUnlocalizedName( is );
}
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public final void addInformation(ItemStack itemStack, EntityPlayer player, List toolTip, boolean advancedTooltips)
@SideOnly( Side.CLIENT )
@SuppressWarnings( "unchecked" )
public final void addInformation( ItemStack itemStack, EntityPlayer player, List toolTip, boolean advancedTooltips )
{
this.addCheckedInformation( itemStack, player, toolTip, advancedTooltips );
}
@SideOnly(Side.CLIENT)
public void addCheckedInformation(ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedToolTips)
@SideOnly( Side.CLIENT )
public void addCheckedInformation( ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedToolTips )
{
this.blockType.addInformation( itemStack, player, toolTip, advancedToolTips );
}
@Override
public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata)
public boolean isBookEnchantable( ItemStack itemstack1, ItemStack itemstack2 )
{
return false;
}
@Override
public String getUnlocalizedName( ItemStack is )
{
return this.blockType.getUnlocalizedName( is );
}
@Override
public boolean placeBlockAt( ItemStack stack, EntityPlayer player, World w, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata )
{
ForgeDirection up = ForgeDirection.UNKNOWN;
ForgeDirection forward = ForgeDirection.UNKNOWN;
IOrientable ori = null;
if ( this.blockType.hasBlockTileEntity() )
if( this.blockType.hasBlockTileEntity() )
{
if ( this.blockType instanceof BlockLightDetector )
if( this.blockType instanceof BlockLightDetector )
{
up = ForgeDirection.getOrientation( side );
if ( up == ForgeDirection.UP || up == ForgeDirection.DOWN )
if( up == ForgeDirection.UP || up == ForgeDirection.DOWN )
forward = ForgeDirection.SOUTH;
else
forward = ForgeDirection.UP;
}
else if ( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
{
forward = ForgeDirection.getOrientation( side );
if ( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
if( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
up = ForgeDirection.SOUTH;
else
up = ForgeDirection.UP;
@@ -115,31 +123,31 @@ public class AEBaseItemBlock extends ItemBlock
{
up = ForgeDirection.UP;
byte rotation = (byte) (MathHelper.floor_double( (player.rotationYaw * 4F) / 360F + 2.5D ) & 3);
byte rotation = (byte) ( MathHelper.floor_double( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
switch (rotation)
switch( rotation )
{
default:
case 0:
forward = ForgeDirection.SOUTH;
break;
case 1:
forward = ForgeDirection.WEST;
break;
case 2:
forward = ForgeDirection.NORTH;
break;
case 3:
forward = ForgeDirection.EAST;
break;
default:
case 0:
forward = ForgeDirection.SOUTH;
break;
case 1:
forward = ForgeDirection.WEST;
break;
case 2:
forward = ForgeDirection.NORTH;
break;
case 3:
forward = ForgeDirection.EAST;
break;
}
if ( player.rotationPitch > 65 )
if( player.rotationPitch > 65 )
{
up = forward.getOpposite();
forward = ForgeDirection.UP;
}
else if ( player.rotationPitch < -65 )
else if( player.rotationPitch < -65 )
{
up = forward.getOpposite();
forward = ForgeDirection.DOWN;
@@ -147,45 +155,45 @@ public class AEBaseItemBlock extends ItemBlock
}
}
if ( this.blockType instanceof IOrientableBlock )
if( this.blockType instanceof IOrientableBlock )
{
ori = ((IOrientableBlock) this.blockType).getOrientable( w, x, y, z );
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, x, y, z );
up = ForgeDirection.getOrientation( side );
forward = ForgeDirection.SOUTH;
if ( up.offsetY == 0 )
if( up.offsetY == 0 )
forward = ForgeDirection.UP;
ori.setOrientation( forward, up );
}
if ( !this.blockType.isValidOrientation( w, x, y, z, forward, up ) )
if( !this.blockType.isValidOrientation( w, x, y, z, forward, up ) )
return false;
if ( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
if( super.placeBlockAt( stack, player, w, x, y, z, side, hitX, hitY, hitZ, metadata ) )
{
if ( this.blockType.hasBlockTileEntity() && !(this.blockType instanceof BlockLightDetector) )
if( this.blockType.hasBlockTileEntity() && !( this.blockType instanceof BlockLightDetector ) )
{
AEBaseTile tile = this.blockType.getTileEntity( w, x, y, z );
ori = tile;
if ( tile == null )
if( tile == null )
return true;
if ( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
{
if ( ori.getForward() == null || ori.getUp() == null || // null
if( ori.getForward() == null || ori.getUp() == null || // null
tile.getForward() == ForgeDirection.UNKNOWN || ori.getUp() == ForgeDirection.UNKNOWN )
ori.setOrientation( forward, up );
}
if ( tile instanceof IGridProxyable )
if( tile instanceof IGridProxyable )
{
((IGridProxyable) tile).getProxy().setOwner( player );
( (IGridProxyable) tile ).getProxy().setOwner( player );
}
tile.onPlacement( stack, player, side );
}
else if ( this.blockType instanceof IOrientableBlock )
else if( this.blockType instanceof IOrientableBlock )
{
ori.setOrientation( forward, up );
}
@@ -194,11 +202,4 @@ public class AEBaseItemBlock extends ItemBlock
}
return false;
}
@Override
public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2)
{
return false;
}
}
@@ -38,40 +38,40 @@ import appeng.core.Api;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEItemPowerStorage
{
public AEBaseItemBlockChargeable(Block id) {
public AEBaseItemBlockChargeable( Block id )
{
super( id );
}
@Override
@SideOnly(Side.CLIENT)
public void addCheckedInformation(ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedTooltips)
@SideOnly( Side.CLIENT )
public void addCheckedInformation( ItemStack itemStack, EntityPlayer player, List<String> toolTip, boolean advancedTooltips )
{
NBTTagCompound tag = itemStack.getTagCompound();
double internalCurrentPower = 0;
double internalMaxPower = this.getMaxEnergyCapacity();
if ( tag != null )
if( tag != null )
{
internalCurrentPower = tag.getDouble( "internalCurrentPower" );
}
double percent = internalCurrentPower / internalMaxPower;
toolTip.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower )
+ Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
toolTip.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
}
private double getMaxEnergyCapacity()
{
Block blockID = Block.getBlockFromItem( this );
final IBlockDefinition energyCell = Api.INSTANCE.definitions().blocks().energyCell();
for ( Block block : energyCell.maybeBlock().asSet() )
for( Block block : energyCell.maybeBlock().asSet() )
{
if ( blockID == block )
if( blockID == block )
{
return 200000;
}
@@ -84,25 +84,13 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
return 0;
}
private double getInternal(ItemStack is)
{
NBTTagCompound nbt = Platform.openNbtData( is );
return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal(ItemStack is, double amt)
{
NBTTagCompound nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
}
@Override
public double injectAEPower(ItemStack is, double amt)
public double injectAEPower( ItemStack is, double amt )
{
double internalCurrentPower = this.getInternal( is );
double internalMaxPower = this.getMaxEnergyCapacity();
internalCurrentPower += amt;
if ( internalCurrentPower > internalMaxPower )
if( internalCurrentPower > internalMaxPower )
{
amt = internalCurrentPower - internalMaxPower;
internalCurrentPower = internalMaxPower;
@@ -114,11 +102,23 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
return 0;
}
private double getInternal( ItemStack is )
{
NBTTagCompound nbt = Platform.openNbtData( is );
return nbt.getDouble( "internalCurrentPower" );
}
private void setInternal( ItemStack is, double amt )
{
NBTTagCompound nbt = Platform.openNbtData( is );
nbt.setDouble( "internalCurrentPower", amt );
}
@Override
public double extractAEPower(ItemStack is, double amt)
public double extractAEPower( ItemStack is, double amt )
{
double internalCurrentPower = this.getInternal( is );
if ( internalCurrentPower > amt )
if( internalCurrentPower > amt )
{
internalCurrentPower -= amt;
this.setInternal( is, internalCurrentPower );
@@ -131,21 +131,20 @@ public class AEBaseItemBlockChargeable extends AEBaseItemBlock implements IAEIte
}
@Override
public double getAEMaxPower(ItemStack is)
public double getAEMaxPower( ItemStack is )
{
return this.getMaxEnergyCapacity();
}
@Override
public double getAECurrentPower(ItemStack is)
public double getAECurrentPower( ItemStack is )
{
return this.getInternal( is );
}
@Override
public AccessRestriction getPowerFlow(ItemStack is)
public AccessRestriction getPowerFlow( ItemStack is )
{
return AccessRestriction.WRITE;
}
}
@@ -21,11 +21,11 @@ package appeng.block;
import java.util.EnumSet;
import com.google.common.base.Optional;
import net.minecraft.block.Block;
import net.minecraft.block.BlockStairs;
import com.google.common.base.Optional;
import appeng.core.features.AEFeature;
import appeng.core.features.IAEFeature;
import appeng.core.features.IFeatureHandler;
@@ -40,7 +40,7 @@ public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature
{
super( block, meta );
this.features = new StairBlockFeatureHandler( features, this, Optional.<String> absent() );
this.features = new StairBlockFeatureHandler( features, this, Optional.<String>absent() );
this.setBlockName( block.getUnlocalizedName() );
this.setLightOpacity( 0 );
@@ -48,18 +48,24 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
this.setTileEntity( TileCraftingMonitorTile.class );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockCraftingCPUMonitor.class;
}
@Override
public IIcon getIcon( int direction, int metadata )
{
if ( direction != ForgeDirection.SOUTH.ordinal() )
if( direction != ForgeDirection.SOUTH.ordinal() )
{
for ( Block craftingUnitBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
for( Block craftingUnitBlock : AEApi.instance().definitions().blocks().craftingUnit().maybeBlock().asSet() )
{
return craftingUnitBlock.getIcon( direction, metadata );
}
}
switch ( metadata )
switch( metadata )
{
default:
case 0:
@@ -69,12 +75,6 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
}
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockCraftingCPUMonitor.class;
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
@@ -18,6 +18,7 @@
package appeng.block.crafting;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
@@ -31,6 +32,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import appeng.client.texture.ExtraBlockTextures;
import appeng.tile.crafting.TileCraftingStorageTile;
public class BlockCraftingStorage extends BlockCraftingUnit
{
public BlockCraftingStorage()
@@ -47,54 +49,54 @@ public class BlockCraftingStorage extends BlockCraftingUnit
}
@Override
public String getUnlocalizedName(ItemStack is)
public IIcon getIcon( int direction, int metadata )
{
if ( is.getItemDamage() == 1 )
return "tile.appliedenergistics2.BlockCraftingStorage4k";
if ( is.getItemDamage() == 2 )
return "tile.appliedenergistics2.BlockCraftingStorage16k";
if ( is.getItemDamage() == 3 )
return "tile.appliedenergistics2.BlockCraftingStorage64k";
return this.getItemUnlocalizedName( is );
}
@Override
public IIcon getIcon(int direction, int metadata)
{
switch (metadata & (~4))
switch( metadata & ( ~4 ) )
{
default:
default:
case 0:
return super.getIcon( 0, 0 );
case 1:
return ExtraBlockTextures.BlockCraftingStorage4k.getIcon();
case 2:
return ExtraBlockTextures.BlockCraftingStorage16k.getIcon();
case 3:
return ExtraBlockTextures.BlockCraftingStorage64k.getIcon();
case 0:
return super.getIcon( 0, 0 );
case 1:
return ExtraBlockTextures.BlockCraftingStorage4k.getIcon();
case 2:
return ExtraBlockTextures.BlockCraftingStorage16k.getIcon();
case 3:
return ExtraBlockTextures.BlockCraftingStorage64k.getIcon();
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage1kFit.getIcon();
case 1 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage4kFit.getIcon();
case 2 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage16kFit.getIcon();
case 3 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage64kFit.getIcon();
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage1kFit.getIcon();
case 1 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage4kFit.getIcon();
case 2 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage16kFit.getIcon();
case 3 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingStorage64kFit.getIcon();
}
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
itemStacks.add( new ItemStack( this, 1, 1 ) );
itemStacks.add( new ItemStack( this, 1, 2 ) );
itemStacks.add( new ItemStack( this, 1, 3 ) );
}
@Override
public String getUnlocalizedName( ItemStack is )
{
if( is.getItemDamage() == 1 )
return "tile.appliedenergistics2.BlockCraftingStorage4k";
if( is.getItemDamage() == 2 )
return "tile.appliedenergistics2.BlockCraftingStorage16k";
if( is.getItemDamage() == 3 )
return "tile.appliedenergistics2.BlockCraftingStorage64k";
return this.getItemUnlocalizedName( is );
}
}
@@ -18,6 +18,7 @@
package appeng.block.crafting;
import java.util.EnumSet;
import java.util.List;
@@ -43,18 +44,11 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
public class BlockCraftingUnit extends AEBaseBlock
{
public static final int FLAG_FORMED = 8;
public BlockCraftingUnit(Class<? extends BlockCraftingUnit> childClass)
{
super( childClass, Material.iron );
this.hasSubtypes = true;
this.setFeature( EnumSet.of( AEFeature.CraftingCPU ) );
}
public BlockCraftingUnit()
{
this( BlockCraftingUnit.class );
@@ -62,13 +56,44 @@ public class BlockCraftingUnit extends AEBaseBlock
this.setTileEntity( TileCraftingTile.class );
}
public BlockCraftingUnit( Class<? extends BlockCraftingUnit> childClass )
{
super( childClass, Material.iron );
this.hasSubtypes = true;
this.setFeature( EnumSet.of( AEFeature.CraftingCPU ) );
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockCraftingCPU.class;
}
@Override
public IIcon getIcon( int direction, int metadata )
{
switch( metadata )
{
default:
case 0:
return super.getIcon( 0, 0 );
case 1:
return ExtraBlockTextures.BlockCraftingAccelerator.getIcon();
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingUnitFit.getIcon();
case 1 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingAcceleratorFit.getIcon();
}
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
TileCraftingTile tg = this.getTileEntity( w, x, y, z );
if ( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
{
if ( Platform.isClient() )
if( Platform.isClient() )
return true;
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CRAFTING_CPU );
@@ -79,34 +104,15 @@ public class BlockCraftingUnit extends AEBaseBlock
}
@Override
public int getDamageValue(World w, int x, int y, int z)
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
int meta = w.getBlockMetadata( x, y, z );
return this.damageDropped( meta );
itemStacks.add( new ItemStack( this, 1, 0 ) );
itemStacks.add( new ItemStack( this, 1, 1 ) );
}
@Override
public int damageDropped(int meta)
{
return meta & 3;
}
@Override
public String getUnlocalizedName(ItemStack is)
{
if ( is.getItemDamage() == 1 )
return "tile.appliedenergistics2.BlockCraftingAccelerator";
return this.getItemUnlocalizedName( is );
}
protected String getItemUnlocalizedName(ItemStack is)
{
return super.getUnlocalizedName( is );
}
@Override
public void setRenderStateByMeta(int itemDamage)
public void setRenderStateByMeta( int itemDamage )
{
IIcon front = this.getIcon( ForgeDirection.SOUTH.ordinal(), itemDamage );
IIcon other = this.getIcon( ForgeDirection.NORTH.ordinal(), itemDamage );
@@ -114,51 +120,47 @@ public class BlockCraftingUnit extends AEBaseBlock
}
@Override
public IIcon getIcon(int direction, int metadata)
{
switch (metadata)
{
default:
case 0:
return super.getIcon( 0, 0 );
case 1:
return ExtraBlockTextures.BlockCraftingAccelerator.getIcon();
case FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingUnitFit.getIcon();
case 1 | FLAG_FORMED:
return ExtraBlockTextures.BlockCraftingAcceleratorFit.getIcon();
}
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockCraftingCPU.class;
}
@Override
public void breakBlock(World w, int x, int y, int z, Block a, int b)
public void breakBlock( World w, int x, int y, int z, Block a, int b )
{
TileCraftingTile cp = this.getTileEntity( w, x, y, z );
if ( cp != null )
if( cp != null )
cp.breakCluster();
super.breakBlock( w, x, y, z, a, b );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
public String getUnlocalizedName( ItemStack is )
{
if( is.getItemDamage() == 1 )
return "tile.appliedenergistics2.BlockCraftingAccelerator";
return this.getItemUnlocalizedName( is );
}
protected String getItemUnlocalizedName( ItemStack is )
{
return super.getUnlocalizedName( is );
}
@Override
public void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
{
TileCraftingTile cp = this.getTileEntity( w, x, y, z );
if ( cp != null )
if( cp != null )
cp.updateMultiBlock();
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
public int damageDropped( int meta )
{
itemStacks.add( new ItemStack( this, 1, 0 ) );
itemStacks.add( new ItemStack( this, 1, 1 ) );
return meta & 3;
}
@Override
public int getDamageValue( World w, int x, int y, int z )
{
int meta = w.getBlockMetadata( x, y, z );
return this.damageDropped( meta );
}
}
@@ -18,6 +18,7 @@
package appeng.block.crafting;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -36,10 +37,14 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.util.Platform;
public class BlockMolecularAssembler extends AEBaseBlock
{
public BlockMolecularAssembler() {
public static boolean booleanAlphaPass = false;
public BlockMolecularAssembler()
{
super( BlockMolecularAssembler.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.MolecularAssembler ) );
this.setTileEntity( TileMolecularAssembler.class );
@@ -47,15 +52,6 @@ public class BlockMolecularAssembler extends AEBaseBlock
this.lightOpacity = 1;
}
public static boolean booleanAlphaPass = false;
@Override
public boolean canRenderInPass(int pass)
{
booleanAlphaPass = pass == 1;
return pass == 0 || pass == 1;
}
@Override
public int getRenderBlockPass()
{
@@ -63,17 +59,24 @@ public class BlockMolecularAssembler extends AEBaseBlock
}
@Override
@SideOnly(Side.CLIENT)
public boolean canRenderInPass( int pass )
{
booleanAlphaPass = pass == 1;
return pass == 0 || pass == 1;
}
@Override
@SideOnly( Side.CLIENT )
public Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockAssembler.class;
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
TileMolecularAssembler tg = this.getTileEntity( w, x, y, z );
if ( tg != null && !p.isSneaking() )
if( tg != null && !p.isSneaking() )
{
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_MAC );
return true;
@@ -18,6 +18,7 @@
package appeng.block.crafting;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -26,27 +27,29 @@ import appeng.block.AEBaseItemBlock;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
public class ItemCraftingStorage extends AEBaseItemBlock
{
public ItemCraftingStorage(Block id) {
public ItemCraftingStorage( Block id )
{
super( id );
}
@Override
public boolean hasContainerItem(ItemStack stack)
public ItemStack getContainerItem( ItemStack itemStack )
{
return AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting );
}
@Override
public ItemStack getContainerItem(ItemStack itemStack)
{
for ( ItemStack stack : AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).asSet() )
for( ItemStack stack : AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 ).asSet() )
{
return stack;
}
return null;
}
@Override
public boolean hasContainerItem( ItemStack stack )
{
return AEConfig.instance.isFeatureEnabled( AEFeature.enableDisassemblyCrafting );
}
}
@@ -18,6 +18,7 @@
package appeng.block.grindstone;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -39,10 +40,12 @@ import appeng.core.stats.Stats;
import appeng.tile.AEBaseTile;
import appeng.tile.grindstone.TileCrank;
public class BlockCrank extends AEBaseBlock
{
public BlockCrank() {
public BlockCrank()
{
super( BlockCrank.class, Material.wood );
this.setFeature( EnumSet.of( AEFeature.GrindStone ) );
this.setTileEntity( TileCrank.class );
@@ -52,18 +55,24 @@ public class BlockCrank extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
public Class<? extends BaseBlockRender> getRenderer()
{
if ( player instanceof FakePlayer || player == null )
return RenderBlockCrank.class;
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if( player instanceof FakePlayer || player == null )
{
this.dropCrank(w, x, y, z);
this.dropCrank( w, x, y, z );
return true;
}
AEBaseTile tile = this.getTileEntity( w, x, y, z );
if ( tile instanceof TileCrank )
if( tile instanceof TileCrank )
{
if ( ((TileCrank) tile).power() )
if( ( (TileCrank) tile ).power() )
{
Stats.TurnedCranks.addToPlayer( player, 1 );
}
@@ -72,42 +81,6 @@ public class BlockCrank extends AEBaseBlock
return true;
}
@Override
public Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockCrank.class;
}
private boolean isCrankable( World world, int x, int y, int z, ForgeDirection offset )
{
TileEntity te = world.getTileEntity( x + offset.offsetX, y + offset.offsetY, z + offset.offsetZ );
return te instanceof ICrankable && ( ( ICrankable ) te ).canCrankAttach( offset.getOpposite() );
}
private ForgeDirection findCrankable( World world, int x, int y, int z )
{
for ( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
if ( this.isCrankable( world, x, y, z, dir ) )
{
return dir;
}
return ForgeDirection.UNKNOWN;
}
@Override
public boolean canPlaceBlockAt( World world, int x, int y, int z )
{
return this.findCrankable( world , x, y, z ) != ForgeDirection.UNKNOWN;
}
@Override
public boolean isValidOrientation( World world, int x, int y, int z, ForgeDirection forward, ForgeDirection up )
{
TileEntity te = world.getTileEntity( x, y, z );
return !(te instanceof TileCrank) || this.isCrankable( world, x, y, z, up.getOpposite() );
}
private void dropCrank( World world, int x, int y, int z )
{
world.func_147480_a( x, y, z, true ); // w.destroyBlock( x, y, z, true );
@@ -118,11 +91,11 @@ public class BlockCrank extends AEBaseBlock
public void onBlockPlacedBy( World world, int x, int y, int z, EntityLivingBase placer, ItemStack itemStack )
{
AEBaseTile tile = this.getTileEntity( world, x, y, z );
if ( tile != null )
if( tile != null )
{
ForgeDirection mnt = this.findCrankable( world, x, y, z );
ForgeDirection forward = ForgeDirection.UP;
if ( mnt == ForgeDirection.UP || mnt == ForgeDirection.DOWN )
if( mnt == ForgeDirection.UP || mnt == ForgeDirection.DOWN )
{
forward = ForgeDirection.SOUTH;
}
@@ -135,12 +108,36 @@ public class BlockCrank extends AEBaseBlock
}
@Override
public void onNeighborBlockChange (World world, int x, int y, int z, Block block )
public boolean isValidOrientation( World world, int x, int y, int z, ForgeDirection forward, ForgeDirection up )
{
TileEntity te = world.getTileEntity( x, y, z );
return !( te instanceof TileCrank ) || this.isCrankable( world, x, y, z, up.getOpposite() );
}
private ForgeDirection findCrankable( World world, int x, int y, int z )
{
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
if( this.isCrankable( world, x, y, z, dir ) )
{
return dir;
}
return ForgeDirection.UNKNOWN;
}
private boolean isCrankable( World world, int x, int y, int z, ForgeDirection offset )
{
TileEntity te = world.getTileEntity( x + offset.offsetX, y + offset.offsetY, z + offset.offsetZ );
return te instanceof ICrankable && ( (ICrankable) te ).canCrankAttach( offset.getOpposite() );
}
@Override
public void onNeighborBlockChange( World world, int x, int y, int z, Block block )
{
AEBaseTile tile = this.getTileEntity( world, x, y, z );
if ( tile != null )
if( tile != null )
{
if ( !this.isCrankable( world, x, y, z, tile.getUp().getOpposite() ) )
if( !this.isCrankable( world, x, y, z, tile.getUp().getOpposite() ) )
{
this.dropCrank( world, x, y, z );
}
@@ -151,4 +148,9 @@ public class BlockCrank extends AEBaseBlock
}
}
@Override
public boolean canPlaceBlockAt( World world, int x, int y, int z )
{
return this.findCrankable( world, x, y, z ) != ForgeDirection.UNKNOWN;
}
}
@@ -18,6 +18,7 @@
package appeng.block.grindstone;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -31,10 +32,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.grindstone.TileGrinder;
import appeng.util.Platform;
public class BlockGrinder extends AEBaseBlock
{
public BlockGrinder() {
public BlockGrinder()
{
super( BlockGrinder.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.GrindStone ) );
this.setTileEntity( TileGrinder.class );
@@ -42,15 +45,14 @@ public class BlockGrinder extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
TileGrinder tg = this.getTileEntity( w, x, y, z );
if ( tg != null && !p.isSneaking() )
if( tg != null && !p.isSneaking() )
{
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_GRINDER );
return true;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -31,29 +32,30 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCellWorkbench;
import appeng.util.Platform;
public class BlockCellWorkbench extends AEBaseBlock
{
public BlockCellWorkbench() {
public BlockCellWorkbench()
{
super( BlockCellWorkbench.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
this.setTileEntity( TileCellWorkbench.class );
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileCellWorkbench tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CELL_WORKBENCH );
return true;
}
return false;
}
}
@@ -48,10 +48,12 @@ import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
import appeng.util.Platform;
public class BlockCharger extends AEBaseBlock implements ICustomCollision
{
public BlockCharger() {
public BlockCharger()
{
super( BlockCharger.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setTileEntity( TileCharger.class );
@@ -59,24 +61,6 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
this.isFullSize = this.isOpaque = false;
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if ( player.isSneaking() )
return false;
if ( Platform.isServer() )
{
TileCharger tc = this.getTileEntity( w, x, y, z );
if ( tc != null )
{
tc.activate( player );
}
}
return true;
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
@@ -84,29 +68,47 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int x, int y, int z, Random r)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if ( !AEConfig.instance.enableEffects )
if( player.isSneaking() )
return false;
if( Platform.isServer() )
{
TileCharger tc = this.getTileEntity( w, x, y, z );
if( tc != null )
{
tc.activate( player );
}
}
return true;
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
if( !AEConfig.instance.enableEffects )
return;
if ( r.nextFloat() < 0.98 )
if( r.nextFloat() < 0.98 )
return;
AEBaseTile tile = this.getTileEntity( w, x, y, z );
if ( tile instanceof TileCharger )
if( tile instanceof TileCharger )
{
TileCharger tc = (TileCharger) tile;
if ( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getStackInSlot( 0 ) ) )
if( AEApi.instance().definitions().materials().certusQuartzCrystalCharged().isSameAs( tc.getStackInSlot( 0 ) ) )
{
double xOff = 0.0;
double yOff = 0.0;
double zOff = 0.0;
for (int bolts = 0; bolts < 3; bolts++)
for( int bolts = 0; bolts < 3; bolts++ )
{
if ( CommonHelper.proxy.shouldAddParticles( r ) )
if( CommonHelper.proxy.shouldAddParticles( r ) )
{
LightningFX fx = new LightningFX( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
@@ -117,54 +119,54 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
TileCharger tile = this.getTileEntity( w, x, y, z );
if ( tile != null )
if( tile != null )
{
double twoPixels = 2.0 / 16.0;
ForgeDirection up = tile.getUp();
ForgeDirection forward = tile.getForward();
AxisAlignedBB bb = AxisAlignedBB.getBoundingBox( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
if ( up.offsetX != 0 )
if( up.offsetX != 0 )
{
bb.minX = 0;
bb.maxX = 1;
}
if ( up.offsetY != 0 )
if( up.offsetY != 0 )
{
bb.minY = 0;
bb.maxY = 1;
}
if ( up.offsetZ != 0 )
if( up.offsetZ != 0 )
{
bb.minZ = 0;
bb.maxZ = 1;
}
switch (forward)
switch( forward )
{
case DOWN:
bb.maxY = 1;
break;
case UP:
bb.minY = 0;
break;
case NORTH:
bb.maxZ = 1;
break;
case SOUTH:
bb.minZ = 0;
break;
case EAST:
bb.minX = 0;
break;
case WEST:
bb.maxX = 1;
break;
default:
break;
case DOWN:
bb.maxY = 1;
break;
case UP:
bb.minY = 0;
break;
case NORTH:
bb.maxZ = 1;
break;
case SOUTH:
bb.minZ = 0;
break;
case EAST:
bb.minX = 0;
break;
case WEST:
bb.maxX = 1;
break;
default:
break;
}
return Collections.singletonList( bb );
@@ -173,7 +175,7 @@ public class BlockCharger extends AEBaseBlock implements ICustomCollision
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
out.add( AxisAlignedBB.getBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -31,32 +32,33 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileCondenser;
import appeng.util.Platform;
public class BlockCondenser extends AEBaseBlock
{
public BlockCondenser() {
public BlockCondenser()
{
super( BlockCondenser.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setTileEntity( TileCondenser.class );
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if ( player.isSneaking() )
if( player.isSneaking() )
return false;
if ( Platform.isServer() )
if( Platform.isServer() )
{
TileCondenser tc = this.getTileEntity( w, x, y, z );
if ( tc != null && !player.isSneaking() )
if( tc != null && !player.isSneaking() )
{
Platform.openGUI( player, tc, ForgeDirection.getOrientation(side), GuiBridge.GUI_CONDENSER );
Platform.openGUI( player, tc, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CONDENSER );
return true;
}
}
return true;
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -33,10 +34,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInscriber;
import appeng.util.Platform;
public class BlockInscriber extends AEBaseBlock
{
public BlockInscriber() {
public BlockInscriber()
{
super( BlockInscriber.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Inscriber ) );
this.setTileEntity( TileInscriber.class );
@@ -51,19 +54,18 @@ public class BlockInscriber extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileInscriber tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_INSCRIBER );
return true;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -34,10 +35,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileInterface;
import appeng.util.Platform;
public class BlockInterface extends AEBaseBlock
{
public BlockInterface() {
public BlockInterface()
{
super( BlockInterface.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setTileEntity( TileInterface.class );
@@ -49,6 +52,22 @@ public class BlockInterface extends AEBaseBlock
return RenderBlockInterface.class;
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if( p.isSneaking() )
return false;
TileInterface tg = this.getTileEntity( w, x, y, z );
if( tg != null )
{
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_INTERFACE );
return true;
}
return false;
}
@Override
protected boolean hasCustomRotation()
{
@@ -56,27 +75,11 @@ public class BlockInterface extends AEBaseBlock
}
@Override
protected void customRotateBlock(IOrientable rotatable, ForgeDirection axis)
protected void customRotateBlock( IOrientable rotatable, ForgeDirection axis )
{
if ( rotatable instanceof TileInterface )
if( rotatable instanceof TileInterface )
{
((TileInterface) rotatable).setSide( axis );
( (TileInterface) rotatable ).setSide( axis );
}
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
{
if ( p.isSneaking() )
return false;
TileInterface tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
{
if ( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_INTERFACE );
return true;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import java.util.Random;
@@ -30,39 +31,40 @@ import cpw.mods.fml.relauncher.SideOnly;
import appeng.core.features.AEFeature;
import appeng.tile.misc.TileLightDetector;
public class BlockLightDetector extends BlockQuartzTorch
{
public BlockLightDetector() {
public BlockLightDetector()
{
super( BlockLightDetector.class );
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
this.setTileEntity( TileLightDetector.class );
}
@Override
public void onNeighborChange(IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ)
public int isProvidingWeakPower( IBlockAccess w, int x, int y, int z, int side )
{
super.onNeighborChange( world, x, y, z, tileX, tileY, tileZ );
TileLightDetector tld = this.getTileEntity( world, x, y, z );
if ( tld != null )
tld.updateLight();
}
@Override
public int isProvidingWeakPower(IBlockAccess w, int x, int y, int z, int side)
{
if ( w instanceof World && ((TileLightDetector) this.getTileEntity( w, x, y, z )).isReady() )
return ((World) w).getBlockLightValue( x, y, z ) - 6;
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, x, y, z ) ).isReady() )
return ( (World) w ).getBlockLightValue( x, y, z ) - 6;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int x, int y, int z, Random r)
public void onNeighborChange( IBlockAccess world, int x, int y, int z, int tileX, int tileY, int tileZ )
{
super.onNeighborChange( world, x, y, z, tileX, tileY, tileZ );
TileLightDetector tld = this.getTileEntity( world, x, y, z );
if( tld != null )
tld.updateLight();
}
@Override
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
// cancel out lightning
}
}
+55 -54
View File
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
@@ -42,10 +43,12 @@ import appeng.core.features.AEFeature;
import appeng.tile.misc.TilePaint;
import appeng.util.Platform;
public class BlockPaint extends AEBaseBlock
{
public BlockPaint() {
public BlockPaint()
{
super( BlockPaint.class, new MaterialLiquid( MapColor.airColor ) );
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
this.setTileEntity( TilePaint.class );
@@ -61,11 +64,58 @@ public class BlockPaint extends AEBaseBlock
}
@Override
public int getLightValue(IBlockAccess w, int x, int y, int z)
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
// do nothing
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool( World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_ )
{
return null;
}
@Override
public boolean canCollideCheck( int p_149678_1_, boolean p_149678_2_ )
{
return false;
}
@Override
public void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
{
TilePaint tp = this.getTileEntity( w, x, y, z );
if ( tp != null )
if( tp != null )
tp.onNeighborBlockChange();
}
@Override
public Item getItemDropped( int p_149650_1_, Random p_149650_2_, int p_149650_3_ )
{
return null;
}
@Override
public void dropBlockAsItemWithChance( World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_, int p_149690_7_ )
{
}
@Override
public void fillWithRain( World w, int x, int y, int z )
{
if( Platform.isServer() )
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
}
@Override
public int getLightValue( IBlockAccess w, int x, int y, int z )
{
TilePaint tp = this.getTileEntity( w, x, y, z );
if( tp != null )
{
return tp.getLightLevel();
}
@@ -74,63 +124,14 @@ public class BlockPaint extends AEBaseBlock
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
{
// do nothing
}
@Override
public void fillWithRain(World w, int x, int y, int z)
{
if ( Platform.isServer() )
w.setBlock( x, y, z, Platform.AIR, 0, 3 );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
{
TilePaint tp = this.getTileEntity( w, x, y, z );
if ( tp != null )
tp.onNeighborBlockChange();
}
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)
{
return null;
}
@Override
public boolean canCollideCheck(int p_149678_1_, boolean p_149678_2_)
{
return false;
}
@Override
public void dropBlockAsItemWithChance(World p_149690_1_, int p_149690_2_, int p_149690_3_, int p_149690_4_, int p_149690_5_, float p_149690_6_,
int p_149690_7_)
{
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return null;
}
@Override
public boolean isAir(IBlockAccess world, int x, int y, int z)
public boolean isReplaceable( IBlockAccess world, int x, int y, int z )
{
return true;
}
@Override
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
public boolean isAir( IBlockAccess world, int x, int y, int z )
{
return true;
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import java.util.Random;
@@ -44,10 +45,12 @@ import appeng.helpers.MetaRotation;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.util.Platform;
public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrientableBlock
{
public BlockQuartzGrowthAccelerator() {
public BlockQuartzGrowthAccelerator()
{
super( BlockQuartzGrowthAccelerator.class, Material.rock );
this.setStepSound( Block.soundTypeMetal );
this.setFeature( EnumSet.of( AEFeature.Core ) );
@@ -61,21 +64,15 @@ public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrient
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
return new MetaRotation( w, x, y, z );
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int x, int y, int z, Random r)
{
if ( !AEConfig.instance.enableEffects )
if( !AEConfig.instance.enableEffects )
return;
TileQuartzGrowthAccelerator tileQuartzGrowthAccelerator = this.getTileEntity( w, x, y, z );
if ( tileQuartzGrowthAccelerator != null && tileQuartzGrowthAccelerator.hasPower && CommonHelper.proxy.shouldAddParticles( r ) )
if( tileQuartzGrowthAccelerator != null && tileQuartzGrowthAccelerator.hasPower && CommonHelper.proxy.shouldAddParticles( r ) )
{
double d0 = r.nextFloat() - 0.5F;
double d1 = r.nextFloat() - 0.5F;
@@ -95,34 +92,32 @@ public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrient
ry += up.offsetY * d0;
rz += up.offsetZ * d0;
switch (r.nextInt( 4 ))
switch( r.nextInt( 4 ) )
{
case 0:
dx = 0.6;
dz = d1;
if ( !w.getBlock( x + west.offsetX, y + west.offsetY, z + west.offsetZ ).isAir( w, x + west.offsetX, y + west.offsetY, z + west.offsetZ ) )
return;
break;
case 1:
dx = d1;
dz += 0.6;
if ( !w.getBlock( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ ).isAir( w, x + forward.offsetX, y + forward.offsetY,
z + forward.offsetZ ) )
return;
break;
case 2:
dx = d1;
dz = -0.6;
if ( !w.getBlock( x - forward.offsetX, y - forward.offsetY, z - forward.offsetZ ).isAir( w, x - forward.offsetX, y - forward.offsetY,
z - forward.offsetZ ) )
return;
break;
case 3:
dx = -0.6;
dz = d1;
if ( !w.getBlock( x - west.offsetX, y - west.offsetY, z - west.offsetZ ).isAir( w, x - west.offsetX, y - west.offsetY, z - west.offsetZ ) )
return;
break;
case 0:
dx = 0.6;
dz = d1;
if( !w.getBlock( x + west.offsetX, y + west.offsetY, z + west.offsetZ ).isAir( w, x + west.offsetX, y + west.offsetY, z + west.offsetZ ) )
return;
break;
case 1:
dx = d1;
dz += 0.6;
if( !w.getBlock( x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ ).isAir( w, x + forward.offsetX, y + forward.offsetY, z + forward.offsetZ ) )
return;
break;
case 2:
dx = d1;
dz = -0.6;
if( !w.getBlock( x - forward.offsetX, y - forward.offsetY, z - forward.offsetZ ).isAir( w, x - forward.offsetX, y - forward.offsetY, z - forward.offsetZ ) )
return;
break;
case 3:
dx = -0.6;
dz = d1;
if( !w.getBlock( x - west.offsetX, y - west.offsetY, z - west.offsetZ ).isAir( w, x - west.offsetX, y - west.offsetY, z - west.offsetZ ) )
return;
break;
}
rx += dx * west.offsetX;
@@ -143,4 +138,10 @@ public class BlockQuartzGrowthAccelerator extends AEBaseBlock implements IOrient
{
return true;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final int x, final int y, final int z )
{
return new MetaRotation( w, x, y, z );
}
}
@@ -48,21 +48,24 @@ import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.helpers.MetaRotation;
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision
{
protected BlockQuartzTorch(Class which) {
super( which, Material.circuits );
this.setLightOpacity( 0 );
this.isFullSize = this.isOpaque = false;
}
public BlockQuartzTorch() {
public BlockQuartzTorch()
{
this( BlockQuartzTorch.class );
this.setFeature( EnumSet.of( AEFeature.DecorativeLights ) );
this.setLightLevel( 0.9375F );
}
protected BlockQuartzTorch( Class which )
{
super( which, Material.circuits );
this.setLightOpacity( 0 );
this.isFullSize = this.isOpaque = false;
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
@@ -70,48 +73,18 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
public boolean isValidOrientation( World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up )
{
return new MetaRotation( w, x, y, z );
return this.canPlaceAt( w, x, y, z, up.getOpposite() );
}
private void dropTorch(World w, int x, int y, int z)
{
w.func_147480_a( x, y, z, true );
// w.destroyBlock( x, y, z, true );
w.markBlockForUpdate( x, y, z );
}
@Override
public boolean canPlaceBlockAt(World w, int x, int y, int z)
{
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
if ( this.canPlaceAt( w, x, y, z, dir ) )
return true;
return false;
}
private boolean canPlaceAt(World w, int x, int y, int z, ForgeDirection dir)
private boolean canPlaceAt( World w, int x, int y, int z, ForgeDirection dir )
{
return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
}
@Override
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
{
return this.canPlaceAt( w, x, y, z, up.getOpposite() );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block id)
{
ForgeDirection up = this.getOrientable( w, x, y, z ).getUp();
if ( !this.canPlaceAt( w, x, y, z, up.getOpposite() ) )
this.dropTorch( w, x, y, z );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
ForgeDirection up = this.getOrientable( w, x, y, z ).getUp();
double xOff = -0.3 * up.offsetX;
@@ -121,7 +94,7 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e )
{/*
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 * getUp().offsetY; double zOff = -0.15 *
* getUp().offsetZ; out.add( AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff + (double) y + 0.15, zOff
@@ -130,22 +103,22 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int x, int y, int z, Random r)
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
if ( !AEConfig.instance.enableEffects )
if( !AEConfig.instance.enableEffects )
return;
if ( r.nextFloat() < 0.98 )
if( r.nextFloat() < 0.98 )
return;
ForgeDirection up = this.getOrientable( w, x, y, z ).getUp();
double xOff = -0.3 * up.offsetX;
double yOff = -0.3 * up.offsetY;
double zOff = -0.3 * up.offsetZ;
for (int bolts = 0; bolts < 3; bolts++)
for( int bolts = 0; bolts < 3; bolts++ )
{
if ( CommonHelper.proxy.shouldAddParticles( r ) )
if( CommonHelper.proxy.shouldAddParticles( r ) )
{
LightningFX fx = new LightningFX( w, xOff + 0.5 + x, yOff + 0.5 + y, zOff + 0.5 + z, 0.0D, 0.0D, 0.0D );
@@ -154,10 +127,39 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
}
}
@Override
public void onNeighborBlockChange( World w, int x, int y, int z, Block id )
{
ForgeDirection up = this.getOrientable( w, x, y, z ).getUp();
if( !this.canPlaceAt( w, x, y, z, up.getOpposite() ) )
this.dropTorch( w, x, y, z );
}
private void dropTorch( World w, int x, int y, int z )
{
w.func_147480_a( x, y, z, true );
// w.destroyBlock( x, y, z, true );
w.markBlockForUpdate( x, y, z );
}
@Override
public boolean canPlaceBlockAt( World w, int x, int y, int z )
{
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
if( this.canPlaceAt( w, x, y, z, dir ) )
return true;
return false;
}
@Override
public boolean usesMetadata()
{
return true;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final int x, final int y, final int z )
{
return new MetaRotation( w, x, y, z );
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -33,10 +34,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.misc.TileSecurity;
import appeng.util.Platform;
public class BlockSecurity extends AEBaseBlock
{
public BlockSecurity() {
public BlockSecurity()
{
super( BlockSecurity.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Security ) );
this.setTileEntity( TileSecurity.class );
@@ -49,22 +52,20 @@ public class BlockSecurity extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileSecurity tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isClient() )
if( Platform.isClient() )
return true;
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SECURITY );
return true;
}
return false;
}
}
@@ -43,10 +43,12 @@ import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.tile.misc.TileSkyCompass;
public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
{
public BlockSkyCompass() {
public BlockSkyCompass()
{
super( BlockSkyCompass.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.MeteoriteCompass ) );
this.setTileEntity( TileSkyCompass.class );
@@ -54,20 +56,49 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
this.lightOpacity = 0;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)
{
return Blocks.iron_block.getIcon( direction, metadata );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockSkyCompass.class;
}
private void dropTorch(World w, int x, int y, int z)
@Override
@SideOnly( Side.CLIENT )
public IIcon getIcon( int direction, int metadata )
{
return Blocks.iron_block.getIcon( direction, metadata );
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
{
// :P
}
@Override
public boolean isValidOrientation( World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up )
{
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
if( sc != null )
return false;
return this.canPlaceAt( w, x, y, z, forward.getOpposite() );
}
private boolean canPlaceAt( World w, int x, int y, int z, ForgeDirection dir )
{
return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
}
@Override
public void onNeighborBlockChange( World w, int x, int y, int z, Block id )
{
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
ForgeDirection up = sc.getForward();
if( !this.canPlaceAt( w, x, y, z, up.getOpposite() ) )
this.dropTorch( w, x, y, z );
}
private void dropTorch( World w, int x, int y, int z )
{
w.func_147480_a( x, y, z, true );
// w.destroyBlock( x, y, z, true );
@@ -75,42 +106,19 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
}
@Override
public boolean canPlaceBlockAt(World w, int x, int y, int z)
public boolean canPlaceBlockAt( World w, int x, int y, int z )
{
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
if ( this.canPlaceAt( w, x, y, z, dir ) )
for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS )
if( this.canPlaceAt( w, x, y, z, dir ) )
return true;
return false;
}
private boolean canPlaceAt(World w, int x, int y, int z, ForgeDirection dir)
{
return w.isSideSolid( x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir.getOpposite(), false );
}
@Override
public boolean isValidOrientation(World w, int x, int y, int z, ForgeDirection forward, ForgeDirection up)
{
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
if ( sc != null )
return false;
return this.canPlaceAt( w, x, y, z, forward.getOpposite() );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block id)
{
TileSkyCompass sc = this.getTileEntity( w, x, y, z );
ForgeDirection up = sc.getForward();
if ( !this.canPlaceAt( w, x, y, z, up.getOpposite() ) )
this.dropTorch( w, x, y, z );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
TileSkyCompass tile = this.getTileEntity( w, x, y, z );
if ( tile != null )
if( tile != null )
{
ForgeDirection forward = tile.getForward();
@@ -121,46 +129,46 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
double maxY = 1;
double maxZ = 1;
switch (forward)
switch( forward )
{
case DOWN:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 1.0;
minY = 14.0 / 16.0;
break;
case EAST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 2.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 1.0;
minZ = 14.0 / 16.0;
break;
case SOUTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 2.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 2.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 1.0;
minX = 14.0 / 16.0;
break;
default:
break;
case DOWN:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 1.0;
minY = 14.0 / 16.0;
break;
case EAST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 2.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 1.0;
minZ = 14.0 / 16.0;
break;
case SOUTH:
minY = minX = 5.0 / 16.0;
maxY = maxX = 11.0 / 16.0;
maxZ = 2.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 5.0 / 16.0;
maxZ = maxX = 11.0 / 16.0;
maxY = 2.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 5.0 / 16.0;
maxZ = maxY = 11.0 / 16.0;
maxX = 1.0;
minX = 14.0 / 16.0;
break;
default:
break;
}
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
@@ -169,14 +177,8 @@ public class BlockSkyCompass extends AEBaseBlock implements ICustomCollision
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List out, Entity e )
{
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
// :P
}
}
@@ -52,10 +52,12 @@ import appeng.entity.EntityTinyTNTPrimed;
import appeng.helpers.ICustomCollision;
import appeng.hooks.DispenserBehaviorTinyTNT;
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
{
public BlockTinyTNT() {
public BlockTinyTNT()
{
super( BlockTinyTNT.class, Material.tnt );
this.setFeature( EnumSet.of( AEFeature.TinyTNT ) );
this.setLightOpacity( 1 );
@@ -67,6 +69,12 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.TINY_TNT, AppEng.instance, 16, 4, true );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderTinyTNT.class;
}
@Override
public void postInit()
{
@@ -75,64 +83,15 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderTinyTNT.class;
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
// no images required.
}
@Override
public IIcon getIcon(int direction, int metadata)
public IIcon getIcon( int direction, int metadata )
{
return new FullIcon( Blocks.tnt.getIcon( direction, metadata ) );
}
@Override
public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity entity)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if ( entity instanceof EntityArrow && !w.isRemote )
{
EntityArrow entityarrow = (EntityArrow) entity;
if ( entityarrow.isBurning() )
{
this.startFuse( w, x, y, z, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
w.setBlockToAir( x, y, z );
}
}
}
@Override
public void onBlockAdded(World w, int x, int y, int z)
{
super.onBlockAdded( w, x, y, z );
if ( w.isBlockIndirectlyGettingPowered( x, y, z ) )
{
this.startFuse( w, x, y, z, null );
w.setBlockToAir( x, y, z );
}
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block id)
{
if ( w.isBlockIndirectlyGettingPowered( x, y, z ) )
{
this.startFuse( w, x, y, z, null );
w.setBlockToAir( x, y, z );
}
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if ( player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel )
if( player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel )
{
this.startFuse( w, x, y, z, player );
w.setBlockToAir( x, y, z );
@@ -146,19 +105,14 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
@Override
public void onBlockDestroyedByExplosion(World w, int x, int y, int z, Explosion exp)
public void registerBlockIcons( IIconRegister iconRegistry )
{
if ( !w.isRemote )
{
EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, x + 0.5F, y + 0.5F, z + 0.5F, exp.getExplosivePlacedBy() );
primedTinyTNTEntity.fuse = w.rand.nextInt( primedTinyTNTEntity.fuse / 4 ) + primedTinyTNTEntity.fuse / 8;
w.spawnEntityInWorld( primedTinyTNTEntity );
}
// no images required.
}
public void startFuse(World w, int x, int y, int z, EntityLivingBase igniter)
public void startFuse( World w, int x, int y, int z, EntityLivingBase igniter )
{
if ( !w.isRemote )
if( !w.isRemote )
{
EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, x + 0.5F, y + 0.5F, z + 0.5F, igniter );
w.spawnEntityInWorld( primedTinyTNTEntity );
@@ -167,21 +121,68 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
}
@Override
public boolean canDropFromExplosion(Explosion exp)
public void onBlockAdded( World w, int x, int y, int z )
{
super.onBlockAdded( w, x, y, z );
if( w.isBlockIndirectlyGettingPowered( x, y, z ) )
{
this.startFuse( w, x, y, z, null );
w.setBlockToAir( x, y, z );
}
}
@Override
public void onNeighborBlockChange( World w, int x, int y, int z, Block id )
{
if( w.isBlockIndirectlyGettingPowered( x, y, z ) )
{
this.startFuse( w, x, y, z, null );
w.setBlockToAir( x, y, z );
}
}
@Override
public void onBlockDestroyedByExplosion( World w, int x, int y, int z, Explosion exp )
{
if( !w.isRemote )
{
EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed( w, x + 0.5F, y + 0.5F, z + 0.5F, exp.getExplosivePlacedBy() );
primedTinyTNTEntity.fuse = w.rand.nextInt( primedTinyTNTEntity.fuse / 4 ) + primedTinyTNTEntity.fuse / 8;
w.spawnEntityInWorld( primedTinyTNTEntity );
}
}
@Override
public void onEntityCollidedWithBlock( World w, int x, int y, int z, Entity entity )
{
if( entity instanceof EntityArrow && !w.isRemote )
{
EntityArrow entityarrow = (EntityArrow) entity;
if( entityarrow.isBurning() )
{
this.startFuse( w, x, y, z, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase) entityarrow.shootingEntity : null );
w.setBlockToAir( x, y, z );
}
}
}
@Override
public boolean canDropFromExplosion( Explosion exp )
{
return false;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
return Collections.singletonList( AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
out.add( AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 ) );
}
}
@@ -18,6 +18,7 @@
package appeng.block.misc;
import java.util.EnumSet;
import java.util.Random;
@@ -37,10 +38,12 @@ import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
public class BlockVibrationChamber extends AEBaseBlock
{
public BlockVibrationChamber() {
public BlockVibrationChamber()
{
super( BlockVibrationChamber.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.PowerGen ) );
this.setTileEntity( TileVibrationChamber.class );
@@ -48,15 +51,29 @@ public class BlockVibrationChamber extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
public IIcon getIcon( IBlockAccess w, int x, int y, int z, int s )
{
if ( player.isSneaking() )
IIcon ico = super.getIcon( w, x, y, z, s );
TileVibrationChamber tvc = this.getTileEntity( w, x, y, z );
if( tvc != null && tvc.isOn && ico == this.getRendererInstance().getTexture( ForgeDirection.SOUTH ) )
{
return ExtraBlockTextures.BlockVibrationChamberFrontOn.getIcon();
}
return ico;
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if( player.isSneaking() )
return false;
if ( Platform.isServer() )
if( Platform.isServer() )
{
TileVibrationChamber tc = this.getTileEntity( w, x, y, z );
if ( tc != null && !player.isSneaking() )
if( tc != null && !player.isSneaking() )
{
Platform.openGUI( player, tc, ForgeDirection.getOrientation( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
return true;
@@ -67,30 +84,16 @@ public class BlockVibrationChamber extends AEBaseBlock
}
@Override
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s)
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
IIcon ico = super.getIcon( w, x, y, z, s );
TileVibrationChamber tvc = this.getTileEntity( w, x, y, z );
if ( tvc != null && tvc.isOn && ico == this.getRendererInstance().getTexture( ForgeDirection.SOUTH ) )
{
return ExtraBlockTextures.BlockVibrationChamberFrontOn.getIcon();
}
return ico;
}
@Override
public void randomDisplayTick(World w, int x, int y, int z, Random r)
{
if ( !AEConfig.instance.enableEffects )
if( !AEConfig.instance.enableEffects )
return;
AEBaseTile tile = this.getTileEntity( w, x, y, z );
if ( tile instanceof TileVibrationChamber )
if( tile instanceof TileVibrationChamber )
{
TileVibrationChamber tc = (TileVibrationChamber) tile;
if ( tc.isOn )
if( tc.isOn )
{
float f1 = x + 0.5F;
float f2 = y + 0.5F;
@@ -110,18 +113,17 @@ public class BlockVibrationChamber extends AEBaseBlock
float ox = r.nextFloat();
float oy = r.nextFloat() * 0.2f;
f1 += up.offsetX * (-0.3 + oy);
f2 += up.offsetY * (-0.3 + oy);
f3 += up.offsetZ * (-0.3 + oy);
f1 += up.offsetX * ( -0.3 + oy );
f2 += up.offsetY * ( -0.3 + oy );
f3 += up.offsetZ * ( -0.3 + oy );
f1 += west_x * (0.3 * ox - 0.15);
f2 += west_y * (0.3 * ox - 0.15);
f3 += west_z * (0.3 * ox - 0.15);
f1 += west_x * ( 0.3 * ox - 0.15 );
f2 += west_y * ( 0.3 * ox - 0.15 );
f3 += west_z * ( 0.3 * ox - 0.15 );
w.spawnParticle( "smoke", f1, f2, f3, 0.0D, 0.0D, 0.0D );
w.spawnParticle( "flame", f1, f2, f3, 0.0D, 0.0D, 0.0D );
}
}
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
@@ -74,29 +75,22 @@ import appeng.transformer.annotations.Integration.Interface;
import appeng.transformer.annotations.Integration.Method;
import appeng.util.Platform;
@Interface(iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = "MFR")
@Interface( iface = "powercrystals.minefactoryreloaded.api.rednet.connectivity.IRedNetConnection", iname = "MFR" )
public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
{
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
static public Class<? extends TileEntity> noTesrTile;
static public Class<? extends TileEntity> tesrTile;
/**
* Immibis MB Support.
*/
boolean ImmibisMicroblocks_TransformableBlockMarker = true;
int myColorMultiplier = 0xffffff;
@Override
public <T extends TileEntity> T getTileEntity(IBlockAccess w, int x, int y, int z)
public BlockCableBus()
{
TileEntity te = w.getTileEntity( x, y, z );
if ( noTesrTile.isInstance( te ) )
return (T) te;
if ( tesrTile != null && tesrTile.isInstance( te ) )
return (T) te;
return null;
}
public BlockCableBus() {
super( BlockCableBus.class, AEGlassMaterial.INSTANCE );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setLightOpacity( 0 );
@@ -104,240 +98,41 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
}
@Override
public int getRenderBlockPass()
{
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
return 1;
return 0;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(World world, MovingObjectPosition target, EffectRenderer effectRenderer)
{
Object object = this.cb( world, target.blockX, target.blockY, target.blockZ );
if ( object instanceof IPartHost )
{
IPartHost host = (IPartHost) object;
for (ForgeDirection side : ForgeDirection.values())
{
IPart p = host.getPart( side );
IIcon ico = this.getIcon( p );
if ( ico == null )
continue;
byte b0 = (byte) (Platform.getRandomInt() % 2 == 0 ? 1 : 0);
for (int i1 = 0; i1 < b0; ++i1)
{
for (int j1 = 0; j1 < b0; ++j1)
{
for (int k1 = 0; k1 < b0; ++k1)
{
double d0 = target.blockX + (i1 + 0.5D) / b0;
double d1 = target.blockY + (j1 + 0.5D) / b0;
double d2 = target.blockZ + (k1 + 0.5D) / b0;
double dd0 = target.hitVec.xCoord;
double dd1 = target.hitVec.yCoord;
double dd2 = target.hitVec.zCoord;
EntityDiggingFX fx = (new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - target.blockY
- 0.5D, d2 - target.blockZ - 0.5D, this, 0 )).applyColourMultiplier( target.blockX, target.blockY, target.blockZ );
fx.setParticleIcon( ico );
effectRenderer.addEffect( fx );
}
}
}
}
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, int x, int y, int z, int meta, EffectRenderer effectRenderer)
{
Object object = this.cb( world, x, y, z );
if ( object instanceof IPartHost )
{
IPartHost host = (IPartHost) object;
for (ForgeDirection side : ForgeDirection.values())
{
IPart p = host.getPart( side );
IIcon ico = this.getIcon( p );
if ( ico == null )
continue;
byte b0 = 3;
for (int i1 = 0; i1 < b0; ++i1)
{
for (int j1 = 0; j1 < b0; ++j1)
{
for (int k1 = 0; k1 < b0; ++k1)
{
double d0 = x + (i1 + 0.5D) / b0;
double d1 = y + (j1 + 0.5D) / b0;
double d2 = z + (k1 + 0.5D) / b0;
EntityDiggingFX fx = (new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z
- 0.5D, this, meta )).applyColourMultiplier( x, y, z );
fx.setParticleIcon( ico );
effectRenderer.addEffect( fx );
}
}
}
}
}
return true;
}
private IIcon getIcon(IPart p)
{
if ( p == null )
return null;
try
{
IIcon ico = p.getBreakingTexture();
if ( ico != null )
return ico;
}
catch (Throwable t)
{
// nothing.
}
ItemStack is = p.getItemStack( PartItemStack.Network );
if ( is == null || is.getItem() == null )
return null;
return is.getItem().getIcon( is, 0 );
}
@Override
public boolean canRenderInPass(int pass)
{
BusRenderHelper.INSTANCE.setPass( pass );
if ( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
return true;
return pass == 0;
}
@Override
public boolean isLadder(IBlockAccess world, int x, int y, int z, EntityLivingBase entity)
{
return this.cb( world, x, y, z ).isLadder( entity );
}
@Override
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
{
return this.recolourBlock( world, x, y, z, side, colour, null );
}
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour, EntityPlayer who)
{
try
{
return this.cb( world, x, y, z ).recolourBlock( side, AEColor.values()[colour], who );
}
catch (Throwable ignored)
{
}
return false;
}
@Override
public void randomDisplayTick(World world, int x, int y, int z, Random r)
public void randomDisplayTick( World world, int x, int y, int z, Random r )
{
this.cb( world, x, y, z ).randomDisplayTick( world, x, y, z, r );
}
@Override
public int getLightValue(IBlockAccess world, int x, int y, int z)
public void onNeighborBlockChange( World w, int x, int y, int z, Block meh )
{
Block block = world.getBlock( x, y, z );
if ( block != null && block != this )
{
return block.getLightValue( world, x, y, z );
}
if ( block == null )
return 0;
return this.cb( world, x, y, z ).getLightValue();
this.cb( w, x, y, z ).onNeighborChanged();
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
public Item getItemDropped( int i, Random r, int k )
{
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
SelectedPart sp = this.cb( world, x, y, z ).selectPart( v3 );
if ( sp.part != null )
return sp.part.getItemStack( PartItemStack.Pick );
else if ( sp.facade != null )
return sp.facade.getItemStack();
return null;
}
@Override
public boolean isReplaceable(IBlockAccess world, int x, int y, int z)
public int getRenderBlockPass()
{
return this.cb( world, x, y, z ).isEmpty();
}
@SuppressWarnings("deprecation")
@Override
public boolean removedByPlayer(World world, EntityPlayer player, int x, int y, int z)
{
if ( player.capabilities.isCreativeMode )
{
AEBaseTile tile = this.getTileEntity( world, x, y, z );
if ( tile != null )
tile.disableDrops();
// maybe ray trace?
}
return super.removedByPlayer( world, player, x, y, z );
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
return 1;
return 0;
}
@Override
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s)
public int colorMultiplier( IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_ )
{
return this.getIcon( s, 0 );
return this.myColorMultiplier;
}
@Override
public IIcon getIcon(int direction, int metadata)
public int isProvidingWeakPower( IBlockAccess w, int x, int y, int z, int side )
{
IIcon i = super.getIcon( direction, metadata );
if ( i != null )
return i;
return ExtraBlockTextures.BlockQuartzGlassB.getIcon();
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RendererCableBus.class;
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
return this.cb( w, x, y, z ).isProvidingWeakPower( ForgeDirection.getOrientation( side ).getOpposite() );
}
@Override
@@ -347,85 +142,316 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
}
@Override
public boolean isSideSolid(IBlockAccess w, int x, int y, int z, ForgeDirection side)
{
return this.cb( w, x, y, z ).isSolidOnSide( side );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block meh)
{
this.cb( w, x, y, z ).onNeighborChanged();
}
@Override
public void onNeighborChange(IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ)
{
if ( Platform.isServer() )
this.cb( w, x, y, z ).onNeighborChanged();
}
@Override
public Item getItemDropped(int i, Random r, int k)
{
return null;
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
return this.cb( w, x, y, z ).activate( player, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
}
@Override
public void onEntityCollidedWithBlock(World w, int x, int y, int z, Entity e)
public void onEntityCollidedWithBlock( World w, int x, int y, int z, Entity e )
{
this.cb( w, x, y, z ).onEntityCollision( e );
}
@Override
public boolean canConnectRedstone(IBlockAccess w, int x, int y, int z, int side)
{
switch (side)
{
case -1:
case 4:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) );
case 0:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.NORTH ) );
case 1:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.EAST ) );
case 2:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.SOUTH ) );
case 3:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.WEST ) );
}
return false;
}
@Override
public int isProvidingWeakPower(IBlockAccess w, int x, int y, int z, int side)
{
return this.cb( w, x, y, z ).isProvidingWeakPower( ForgeDirection.getOrientation( side ).getOpposite() );
}
@Override
public int isProvidingStrongPower(IBlockAccess w, int x, int y, int z, int side)
public int isProvidingStrongPower( IBlockAccess w, int x, int y, int z, int side )
{
return this.cb( w, x, y, z ).isProvidingStrongPower( ForgeDirection.getOrientation( side ).getOpposite() );
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
public int getLightValue( IBlockAccess world, int x, int y, int z )
{
Block block = world.getBlock( x, y, z );
if( block != null && block != this )
{
return block.getLightValue( world, x, y, z );
}
if( block == null )
return 0;
return this.cb( world, x, y, z ).getLightValue();
}
@Override
public boolean isLadder( IBlockAccess world, int x, int y, int z, EntityLivingBase entity )
{
return this.cb( world, x, y, z ).isLadder( entity );
}
@Override
public boolean isSideSolid( IBlockAccess w, int x, int y, int z, ForgeDirection side )
{
return this.cb( w, x, y, z ).isSolidOnSide( side );
}
@Override
public boolean isReplaceable( IBlockAccess world, int x, int y, int z )
{
return this.cb( world, x, y, z ).isEmpty();
}
@SuppressWarnings( "deprecation" )
@Override
public boolean removedByPlayer( World world, EntityPlayer player, int x, int y, int z )
{
if( player.capabilities.isCreativeMode )
{
AEBaseTile tile = this.getTileEntity( world, x, y, z );
if( tile != null )
tile.disableDrops();
// maybe ray trace?
}
return super.removedByPlayer( world, player, x, y, z );
}
@Override
public boolean canConnectRedstone( IBlockAccess w, int x, int y, int z, int side )
{
switch( side )
{
case -1:
case 4:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.UP, ForgeDirection.DOWN ) );
case 0:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.NORTH ) );
case 1:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.EAST ) );
case 2:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.SOUTH ) );
case 3:
return this.cb( w, x, y, z ).canConnectRedstone( EnumSet.of( ForgeDirection.WEST ) );
}
return false;
}
@Override
public boolean canRenderInPass( int pass )
{
BusRenderHelper.INSTANCE.setPass( pass );
if( AEConfig.instance.isFeatureEnabled( AEFeature.AlphaPass ) )
return true;
return pass == 0;
}
@Override
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z )
{
Vec3 v3 = target.hitVec.addVector( -x, -y, -z );
SelectedPart sp = this.cb( world, x, y, z ).selectPart( v3 );
if( sp.part != null )
return sp.part.getItemStack( PartItemStack.Pick );
else if( sp.facade != null )
return sp.facade.getItemStack();
return null;
}
@Override
@SideOnly( Side.CLIENT )
public boolean addHitEffects( World world, MovingObjectPosition target, EffectRenderer effectRenderer )
{
Object object = this.cb( world, target.blockX, target.blockY, target.blockZ );
if( object instanceof IPartHost )
{
IPartHost host = (IPartHost) object;
for( ForgeDirection side : ForgeDirection.values() )
{
IPart p = host.getPart( side );
IIcon ico = this.getIcon( p );
if( ico == null )
continue;
byte b0 = (byte) ( Platform.getRandomInt() % 2 == 0 ? 1 : 0 );
for( int i1 = 0; i1 < b0; ++i1 )
{
for( int j1 = 0; j1 < b0; ++j1 )
{
for( int k1 = 0; k1 < b0; ++k1 )
{
double d0 = target.blockX + ( i1 + 0.5D ) / b0;
double d1 = target.blockY + ( j1 + 0.5D ) / b0;
double d2 = target.blockZ + ( k1 + 0.5D ) / b0;
double dd0 = target.hitVec.xCoord;
double dd1 = target.hitVec.yCoord;
double dd2 = target.hitVec.zCoord;
EntityDiggingFX fx = ( new EntityDiggingFX( world, dd0, dd1, dd2, d0 - target.blockX - 0.5D, d1 - target.blockY - 0.5D, d2 - target.blockZ - 0.5D, this, 0 ) ).applyColourMultiplier( target.blockX, target.blockY, target.blockZ );
fx.setParticleIcon( ico );
effectRenderer.addEffect( fx );
}
}
}
}
}
return true;
}
@Override
@SideOnly( Side.CLIENT )
public boolean addDestroyEffects( World world, int x, int y, int z, int meta, EffectRenderer effectRenderer )
{
Object object = this.cb( world, x, y, z );
if( object instanceof IPartHost )
{
IPartHost host = (IPartHost) object;
for( ForgeDirection side : ForgeDirection.values() )
{
IPart p = host.getPart( side );
IIcon ico = this.getIcon( p );
if( ico == null )
continue;
byte b0 = 3;
for( int i1 = 0; i1 < b0; ++i1 )
{
for( int j1 = 0; j1 < b0; ++j1 )
{
for( int k1 = 0; k1 < b0; ++k1 )
{
double d0 = x + ( i1 + 0.5D ) / b0;
double d1 = y + ( j1 + 0.5D ) / b0;
double d2 = z + ( k1 + 0.5D ) / b0;
EntityDiggingFX fx = ( new EntityDiggingFX( world, d0, d1, d2, d0 - x - 0.5D, d1 - y - 0.5D, d2 - z - 0.5D, this, meta ) ).applyColourMultiplier( x, y, z );
fx.setParticleIcon( ico );
effectRenderer.addEffect( fx );
}
}
}
}
}
return true;
}
@Override
public void onNeighborChange( IBlockAccess w, int x, int y, int z, int tileX, int tileY, int tileZ )
{
if( Platform.isServer() )
this.cb( w, x, y, z ).onNeighborChanged();
}
private IIcon getIcon( IPart p )
{
if( p == null )
return null;
try
{
IIcon ico = p.getBreakingTexture();
if( ico != null )
return ico;
}
catch( Throwable t )
{
// nothing.
}
ItemStack is = p.getItemStack( PartItemStack.Network );
if( is == null || is.getItem() == null )
return null;
return is.getItem().getIcon( is, 0 );
}
private ICableBusContainer cb( IBlockAccess w, int x, int y, int z )
{
TileEntity te = w.getTileEntity( x, y, z );
ICableBusContainer out = null;
if( te instanceof TileCableBus )
out = ( (TileCableBus) te ).cb;
else if( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
out = ( (IFMP) AppEng.instance.getIntegration( IntegrationType.FMP ) ).getCableContainer( te );
return out == null ? NULL_CABLE_BUS : out;
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RendererCableBus.class;
}
@Override
public IIcon getIcon( IBlockAccess w, int x, int y, int z, int s )
{
return this.getIcon( s, 0 );
}
@Override
public IIcon getIcon( int direction, int metadata )
{
IIcon i = super.getIcon( direction, metadata );
if( i != null )
return i;
return ExtraBlockTextures.BlockQuartzGlassB.getIcon();
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
return this.cb( w, x, y, z ).activate( player, Vec3.createVectorHelper( hitX, hitY, hitZ ) );
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
{
}
@Override
public boolean recolourBlock( World world, int x, int y, int z, ForgeDirection side, int colour )
{
return this.recolourBlock( world, x, y, z, side, colour, null );
}
public boolean recolourBlock( World world, int x, int y, int z, ForgeDirection side, int colour, EntityPlayer who )
{
try
{
return this.cb( world, x, y, z ).recolourBlock( side, AEColor.values()[colour], who );
}
catch( Throwable ignored )
{
}
return false;
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
// do nothing
}
@Override
public <T extends TileEntity> T getTileEntity( IBlockAccess w, int x, int y, int z )
{
TileEntity te = w.getTileEntity( x, y, z );
if( noTesrTile.isInstance( te ) )
return (T) te;
if( tesrTile != null && tesrTile.isInstance( te ) )
return (T) te;
return null;
}
public void setupTile()
{
this.setTileEntity( noTesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBus.class.getName() ) );
if ( Platform.isClient() )
if( Platform.isClient() )
{
tesrTile = Api.INSTANCE.getPartHelper().getCombinedInstance( TileCableBusTESR.class.getName() );
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
@@ -433,43 +459,15 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
}
}
private ICableBusContainer cb(IBlockAccess w, int x, int y, int z)
{
TileEntity te = w.getTileEntity( x, y, z );
ICableBusContainer out = null;
if ( te instanceof TileCableBus )
out = ((TileCableBus) te).cb;
else if ( AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
out = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getCableContainer( te );
return out == null ? NULL_CABLE_BUS : out;
}
/**
* Immibis MB Support.
*/
boolean ImmibisMicroblocks_TransformableBlockMarker = true;
@Override
@Method(iname = "MFR")
public RedNetConnectionType getConnectionType(World world, int x, int y, int z, ForgeDirection side)
@Method( iname = "MFR" )
public RedNetConnectionType getConnectionType( World world, int x, int y, int z, ForgeDirection side )
{
return this.cb( world, x, y, z ).canConnectRedstone( EnumSet.allOf( ForgeDirection.class ) ) ? RedNetConnectionType.CableSingle : RedNetConnectionType.None;
}
int myColorMultiplier = 0xffffff;
public void setRenderColor(int color)
public void setRenderColor( int color )
{
this.myColorMultiplier = color;
}
@Override
public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_)
{
return this.myColorMultiplier;
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -30,10 +31,12 @@ import appeng.client.render.blocks.RenderBlockController;
import appeng.core.features.AEFeature;
import appeng.tile.networking.TileController;
public class BlockController extends AEBaseBlock
{
public BlockController() {
public BlockController()
{
super( BlockController.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Channels ) );
this.setTileEntity( TileController.class );
@@ -41,10 +44,10 @@ public class BlockController extends AEBaseBlock
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block id_junk)
public void onNeighborBlockChange( World w, int x, int y, int z, Block id_junk )
{
TileController tc = this.getTileEntity( w, x, y, z );
if ( tc != null )
if( tc != null )
tc.onNeighborChange( false );
}
@@ -53,5 +56,4 @@ public class BlockController extends AEBaseBlock
{
return RenderBlockController.class;
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import appeng.block.AEBaseBlock;
@@ -25,13 +26,14 @@ import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileCreativeEnergyCell;
public class BlockCreativeEnergyCell extends AEBaseBlock
{
public BlockCreativeEnergyCell() {
public BlockCreativeEnergyCell()
{
super( BlockCreativeEnergyCell.class, AEGlassMaterial.INSTANCE );
this.setFeature( EnumSet.of( AEFeature.Creative ) );
this.setTileEntity( TileCreativeEnergyCell.class );
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import net.minecraft.util.IIcon;
@@ -26,45 +27,45 @@ import appeng.client.texture.ExtraBlockTextures;
import appeng.core.features.AEFeature;
import appeng.tile.networking.TileDenseEnergyCell;
public class BlockDenseEnergyCell extends BlockEnergyCell
{
@Override
public double getMaxPower()
public BlockDenseEnergyCell()
{
return 200000.0 * 8.0;
}
public BlockDenseEnergyCell() {
super( BlockDenseEnergyCell.class );
this.setFeature( EnumSet.of( AEFeature.DenseEnergyCells ) );
this.setTileEntity( TileDenseEnergyCell.class );
}
@Override
public IIcon getIcon(int direction, int metadata)
public IIcon getIcon( int direction, int metadata )
{
switch (metadata)
switch( metadata )
{
case 0:
return ExtraBlockTextures.MEDenseEnergyCell0.getIcon();
case 1:
return ExtraBlockTextures.MEDenseEnergyCell1.getIcon();
case 2:
return ExtraBlockTextures.MEDenseEnergyCell2.getIcon();
case 3:
return ExtraBlockTextures.MEDenseEnergyCell3.getIcon();
case 4:
return ExtraBlockTextures.MEDenseEnergyCell4.getIcon();
case 5:
return ExtraBlockTextures.MEDenseEnergyCell5.getIcon();
case 6:
return ExtraBlockTextures.MEDenseEnergyCell6.getIcon();
case 7:
return ExtraBlockTextures.MEDenseEnergyCell7.getIcon();
case 0:
return ExtraBlockTextures.MEDenseEnergyCell0.getIcon();
case 1:
return ExtraBlockTextures.MEDenseEnergyCell1.getIcon();
case 2:
return ExtraBlockTextures.MEDenseEnergyCell2.getIcon();
case 3:
return ExtraBlockTextures.MEDenseEnergyCell3.getIcon();
case 4:
return ExtraBlockTextures.MEDenseEnergyCell4.getIcon();
case 5:
return ExtraBlockTextures.MEDenseEnergyCell5.getIcon();
case 6:
return ExtraBlockTextures.MEDenseEnergyCell6.getIcon();
case 7:
return ExtraBlockTextures.MEDenseEnergyCell7.getIcon();
}
return super.getIcon( direction, metadata );
}
@Override
public double getMaxPower()
{
return 200000.0 * 8.0;
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -26,13 +27,14 @@ import appeng.block.AEBaseBlock;
import appeng.core.features.AEFeature;
import appeng.tile.networking.TileEnergyAcceptor;
public class BlockEnergyAcceptor extends AEBaseBlock
{
public BlockEnergyAcceptor() {
public BlockEnergyAcceptor()
{
super( BlockEnergyAcceptor.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setTileEntity( TileEnergyAcceptor.class );
}
}
@@ -18,6 +18,7 @@
package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
@@ -41,27 +42,56 @@ import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileEnergyCell;
import appeng.util.Platform;
public class BlockEnergyCell extends AEBaseBlock
{
public double getMaxPower()
public BlockEnergyCell()
{
return 200000.0;
}
public BlockEnergyCell(Class c) {
super( c, AEGlassMaterial.INSTANCE );
}
public BlockEnergyCell() {
this( BlockEnergyCell.class );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setTileEntity( TileEnergyCell.class );
}
public BlockEnergyCell( Class c )
{
super( c, AEGlassMaterial.INSTANCE );
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockEnergyCube.class;
}
@Override
public IIcon getIcon( int direction, int metadata )
{
switch( metadata )
{
case 0:
return ExtraBlockTextures.MEEnergyCell0.getIcon();
case 1:
return ExtraBlockTextures.MEEnergyCell1.getIcon();
case 2:
return ExtraBlockTextures.MEEnergyCell2.getIcon();
case 3:
return ExtraBlockTextures.MEEnergyCell3.getIcon();
case 4:
return ExtraBlockTextures.MEEnergyCell4.getIcon();
case 5:
return ExtraBlockTextures.MEEnergyCell5.getIcon();
case 6:
return ExtraBlockTextures.MEEnergyCell6.getIcon();
case 7:
return ExtraBlockTextures.MEEnergyCell7.getIcon();
}
return super.getIcon( direction, metadata );
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
super.getCheckedSubBlocks( item, tabs, itemStacks );
@@ -73,36 +103,9 @@ public class BlockEnergyCell extends AEBaseBlock
itemStacks.add( charged );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
public double getMaxPower()
{
return RenderBlockEnergyCube.class;
}
@Override
public IIcon getIcon(int direction, int metadata)
{
switch (metadata)
{
case 0:
return ExtraBlockTextures.MEEnergyCell0.getIcon();
case 1:
return ExtraBlockTextures.MEEnergyCell1.getIcon();
case 2:
return ExtraBlockTextures.MEEnergyCell2.getIcon();
case 3:
return ExtraBlockTextures.MEEnergyCell3.getIcon();
case 4:
return ExtraBlockTextures.MEEnergyCell4.getIcon();
case 5:
return ExtraBlockTextures.MEEnergyCell5.getIcon();
case 6:
return ExtraBlockTextures.MEEnergyCell6.getIcon();
case 7:
return ExtraBlockTextures.MEEnergyCell7.getIcon();
}
return super.getIcon( direction, metadata );
return 200000.0;
}
@Override
@@ -110,5 +113,4 @@ public class BlockEnergyCell extends AEBaseBlock
{
return AEBaseItemBlockChargeable.class;
}
}
@@ -39,10 +39,12 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class BlockWireless extends AEBaseBlock implements ICustomCollision
{
public BlockWireless() {
public BlockWireless()
{
super( BlockWireless.class, AEGlassMaterial.INSTANCE );
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
this.setTileEntity( TileWireless.class );
@@ -58,10 +60,26 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if( p.isSneaking() )
return false;
TileWireless tg = this.getTileEntity( w, x, y, z );
if( tg != null )
{
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_WIRELESS );
return true;
}
return false;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
TileWireless tile = this.getTileEntity( w, x, y, z );
if ( tile != null )
if( tile != null )
{
ForgeDirection forward = tile.getForward();
@@ -72,46 +90,46 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
double maxY = 1;
double maxZ = 1;
switch (forward)
switch( forward )
{
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
return Collections.singletonList( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
@@ -120,10 +138,10 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
TileWireless tile = this.getTileEntity( w, x, y, z );
if ( tile != null )
if( tile != null )
{
ForgeDirection forward = tile.getForward();
@@ -134,46 +152,46 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
double maxY = 1;
double maxZ = 1;
switch (forward)
switch( forward )
{
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
case DOWN:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 1.0;
minY = 5.0 / 16.0;
break;
case EAST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 11.0 / 16.0;
minX = 0.0;
break;
case NORTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 1.0;
minZ = 5.0 / 16.0;
break;
case SOUTH:
minY = minX = 3.0 / 16.0;
maxY = maxX = 13.0 / 16.0;
maxZ = 11.0 / 16.0;
minZ = 0.0;
break;
case UP:
minZ = minX = 3.0 / 16.0;
maxZ = maxX = 13.0 / 16.0;
maxY = 11.0 / 16.0;
minY = 0.0;
break;
case WEST:
minZ = minY = 3.0 / 16.0;
maxZ = maxY = 13.0 / 16.0;
maxX = 1.0;
minX = 5.0 / 16.0;
break;
default:
break;
}
out.add( AxisAlignedBB.getBoundingBox( minX, minY, minZ, maxX, maxY, maxZ ) );
@@ -181,21 +199,4 @@ public class BlockWireless extends AEBaseBlock implements ICustomCollision
else
out.add( AxisAlignedBB.getBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
{
if ( p.isSneaking() )
return false;
TileWireless tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
{
if ( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_WIRELESS );
return true;
}
return false;
}
}
@@ -46,10 +46,12 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.Platform;
public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomCollision
{
public BlockQuantumLinkChamber() {
public BlockQuantumLinkChamber()
{
super( BlockQuantumLinkChamber.class, AEGlassMaterial.INSTANCE );
this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
this.setTileEntity( TileQuantumBridge.class );
@@ -60,38 +62,28 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int bx, int by, int bz, Random r)
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int bx, int by, int bz, Random r )
{
TileQuantumBridge bridge = this.getTileEntity( w, bx, by, bz );
if ( bridge != null )
if( bridge != null )
{
if ( bridge.hasQES() )
if( bridge.hasQES() )
{
if ( CommonHelper.proxy.shouldAddParticles( r ) )
if( CommonHelper.proxy.shouldAddParticles( r ) )
CommonHelper.proxy.spawnEffect( EffectType.Energy, w, bx + 0.5, by + 0.5, bz + 0.5, null );
}
}
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block pointlessNumber)
public void onNeighborBlockChange( World w, int x, int y, int z, Block pointlessNumber )
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null )
if( bridge != null )
bridge.neighborUpdate();
}
@Override
public void breakBlock(World w, int x, int y, int z, Block a, int b)
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null )
bridge.breakCluster();
super.breakBlock( w, x, y, z, a, b );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
@@ -99,15 +91,15 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileQuantumBridge tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_QNB );
return true;
}
@@ -115,17 +107,26 @@ public class BlockQuantumLinkChamber extends AEBaseBlock implements ICustomColli
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public void breakBlock( World w, int x, int y, int z, Block a, int b )
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if( bridge != null )
bridge.breakCluster();
super.breakBlock( w, x, y, z, a, b );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
double OnePx = 2.0 / 16.0;
return Collections.singletonList( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
double OnePx = 2.0 / 16.0;
out.add( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
}
@@ -36,10 +36,12 @@ import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
import appeng.tile.qnb.TileQuantumBridge;
public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
{
public BlockQuantumRing() {
public BlockQuantumRing()
{
super( BlockQuantumRing.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
this.setTileEntity( TileQuantumBridge.class );
@@ -50,23 +52,13 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block pointlessNumber)
public void onNeighborBlockChange( World w, int x, int y, int z, Block pointlessNumber )
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null )
if( bridge != null )
bridge.neighborUpdate();
}
@Override
public void breakBlock(World w, int x, int y, int z, Block a, int b)
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null )
bridge.breakCluster();
super.breakBlock( w, x, y, z, a, b );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
@@ -74,15 +66,25 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public void breakBlock( World w, int x, int y, int z, Block a, int b )
{
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if( bridge != null )
bridge.breakCluster();
super.breakBlock( w, x, y, z, a, b );
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
double OnePx = 2.0 / 16.0;
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null && bridge.isCorner() )
if( bridge != null && bridge.isCorner() )
{
OnePx = 4.0 / 16.0;
}
else if ( bridge != null && bridge.isFormed() )
else if( bridge != null && bridge.isFormed() )
{
OnePx = 1.0 / 16.0;
}
@@ -90,19 +92,18 @@ public class BlockQuantumRing extends AEBaseBlock implements ICustomCollision
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
double OnePx = 2.0 / 16.0;
TileQuantumBridge bridge = this.getTileEntity( w, x, y, z );
if ( bridge != null && bridge.isCorner() )
if( bridge != null && bridge.isCorner() )
{
OnePx = 4.0 / 16.0;
}
else if ( bridge != null && bridge.isFormed() )
else if( bridge != null && bridge.isFormed() )
{
OnePx = 1.0 / 16.0;
}
out.add( AxisAlignedBB.getBoundingBox( OnePx, OnePx, OnePx, 1.0 - OnePx, 1.0 - OnePx, 1.0 - OnePx ) );
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -25,12 +26,13 @@ import net.minecraft.block.material.Material;
import appeng.block.AEDecorativeBlock;
import appeng.core.features.AEFeature;
public class BlockQuartz extends AEDecorativeBlock
{
public BlockQuartz() {
public BlockQuartz()
{
super( BlockQuartz.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -25,12 +26,13 @@ import net.minecraft.block.material.Material;
import appeng.block.AEDecorativeBlock;
import appeng.core.features.AEFeature;
public class BlockQuartzChiseled extends AEDecorativeBlock
{
public BlockQuartzChiseled() {
public BlockQuartzChiseled()
{
super( BlockQuartzChiseled.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -32,37 +33,39 @@ import appeng.client.render.blocks.RenderQuartzGlass;
import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
public class BlockQuartzGlass extends AEBaseBlock
{
public BlockQuartzGlass() {
public BlockQuartzGlass()
{
this( BlockQuartzGlass.class );
}
@Override
@SideOnly(Side.CLIENT)
public Class<? extends BaseBlockRender> getRenderer()
public BlockQuartzGlass( Class c )
{
return RenderQuartzGlass.class;
}
@Override
public boolean shouldSideBeRendered(IBlockAccess w, int x, int y, int z, int side)
{
Material mat = w.getBlock( x, y, z ).getMaterial();
if ( mat == Material.glass || mat == AEGlassMaterial.INSTANCE )
{
if ( w.getBlock( x, y, z ).getRenderType() == this.getRenderType() )
return false;
}
return super.shouldSideBeRendered( w, x, y, z, side );
}
public BlockQuartzGlass(Class c) {
super( c, Material.glass );
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
this.setLightOpacity( 0 );
this.isOpaque = false;
}
@Override
@SideOnly( Side.CLIENT )
public Class<? extends BaseBlockRender> getRenderer()
{
return RenderQuartzGlass.class;
}
@Override
public boolean shouldSideBeRendered( IBlockAccess w, int x, int y, int z, int side )
{
Material mat = w.getBlock( x, y, z ).getMaterial();
if( mat == Material.glass || mat == AEGlassMaterial.INSTANCE )
{
if( w.getBlock( x, y, z ).getRenderType() == this.getRenderType() )
return false;
}
return super.shouldSideBeRendered( w, x, y, z, side );
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import java.util.Random;
@@ -32,10 +33,12 @@ import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
public class BlockQuartzLamp extends BlockQuartzGlass
{
public BlockQuartzLamp() {
public BlockQuartzLamp()
{
super( BlockQuartzLamp.class );
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks, AEFeature.DecorativeLights ) );
this.setLightLevel( 1.0f );
@@ -43,22 +46,21 @@ public class BlockQuartzLamp extends BlockQuartzGlass
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World w, int x, int y, int z, Random r)
@SideOnly( Side.CLIENT )
public void randomDisplayTick( World w, int x, int y, int z, Random r )
{
if ( !AEConfig.instance.enableEffects )
if( !AEConfig.instance.enableEffects )
return;
if ( CommonHelper.proxy.shouldAddParticles( r ) )
if( CommonHelper.proxy.shouldAddParticles( r ) )
{
double d0 = (r.nextFloat() - 0.5F) * 0.96D;
double d1 = (r.nextFloat() - 0.5F) * 0.96D;
double d2 = (r.nextFloat() - 0.5F) * 0.96D;
double d0 = ( r.nextFloat() - 0.5F ) * 0.96D;
double d1 = ( r.nextFloat() - 0.5F ) * 0.96D;
double d2 = ( r.nextFloat() - 0.5F ) * 0.96D;
VibrantFX fx = new VibrantFX( w, 0.5 + x + d0, 0.5 + y + d1, 0.5 + z + d2, 0.0D, 0.0D, 0.0D );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -29,24 +30,25 @@ import appeng.block.AEBaseBlock;
import appeng.core.features.AEFeature;
import appeng.helpers.MetaRotation;
public class BlockQuartzPillar extends AEBaseBlock implements IOrientableBlock
{
public BlockQuartzPillar() {
public BlockQuartzPillar()
{
super( BlockQuartzPillar.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.DecorativeQuartzBlocks ) );
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
{
return new MetaRotation( w, x, y, z );
}
@Override
public boolean usesMetadata()
{
return true;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final int x, final int y, final int z )
{
return new MetaRotation( w, x, y, z );
}
}
@@ -18,6 +18,7 @@
package appeng.block.solids;
import java.util.EnumSet;
import java.util.List;
@@ -54,36 +55,22 @@ import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IRB;
import appeng.util.Platform;
@RotatableBlockEnable
public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
{
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
IIcon Block;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
IIcon Brick;
@SideOnly(Side.CLIENT)
@SideOnly( Side.CLIENT )
IIcon SmallBrick;
@SubscribeEvent
public void breakFaster(PlayerEvent.BreakSpeed Ev)
public BlockSkyStone()
{
if ( Ev.block == this && Ev.entityPlayer != null )
{
ItemStack is = Ev.entityPlayer.inventory.getCurrentItem();
int level = -1;
if ( is != null )
level = is.getItem().getHarvestLevel( is, "pickaxe" );
if ( Ev.metadata > 0 || level >= 3 || Ev.originalSpeed > 7.0 )
Ev.newSpeed /= 0.1;
}
}
public BlockSkyStone() {
super( BlockSkyStone.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.Core ) );
this.setHardness( 50 );
@@ -93,76 +80,28 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
MinecraftForge.EVENT_BUS.register( this );
}
@SubscribeEvent
public void breakFaster( PlayerEvent.BreakSpeed Ev )
{
if( Ev.block == this && Ev.entityPlayer != null )
{
ItemStack is = Ev.entityPlayer.inventory.getCurrentItem();
int level = -1;
if( is != null )
level = is.getItem().getHarvestLevel( is, "pickaxe" );
if( Ev.metadata > 0 || level >= 3 || Ev.originalSpeed > 7.0 )
Ev.newSpeed /= 0.1;
}
}
@Override
public int damageDropped(int meta)
public int damageDropped( int meta )
{
return meta;
}
@Override
public String getUnlocalizedName(ItemStack is)
{
if ( is.getItemDamage() == 1 )
return this.getUnlocalizedName() + ".Block";
if ( is.getItemDamage() == 2 )
return this.getUnlocalizedName() + ".Brick";
if ( is.getItemDamage() == 3 )
return this.getUnlocalizedName() + ".SmallBrick";
return this.getUnlocalizedName();
}
@Override
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z)
{
if ( AppEng.instance.isIntegrationEnabled( IntegrationType.RB ) )
{
TileEntity te = w.getTileEntity( x, y, z );
if ( te != null )
{
IOrientable out = ((IRB) AppEng.instance.getIntegration( IntegrationType.RB )).getOrientable( te );
if ( out != null )
return out;
}
}
if ( w.getBlockMetadata( x, y, z ) == 0 )
return new LocationRotation( w, x, y, z );
return new NullRotation();
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister ir)
{
super.registerBlockIcons( ir );
this.Block = ir.registerIcon( this.getTextureName() + ".Block" );
this.Brick = ir.registerIcon( this.getTextureName() + ".Brick" );
this.SmallBrick = ir.registerIcon( this.getTextureName() + ".SmallBrick" );
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)
{
if ( metadata == 1 )
return this.Block;
if ( metadata == 2 )
return this.Brick;
if ( metadata == 3 )
return this.SmallBrick;
return super.getIcon( direction, metadata );
}
@Override
public void setRenderStateByMeta(int metadata)
{
this.getRendererInstance().setTemporaryRenderIcon( this.getIcon( 0, metadata ) );
}
@Override
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
@@ -173,29 +112,10 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
{
super.getCheckedSubBlocks( item, tabs, itemStacks );
itemStacks.add( new ItemStack( item, 1, 1 ) );
itemStacks.add( new ItemStack( item, 1, 2 ) );
itemStacks.add( new ItemStack( item, 1, 3 ) );
}
@Override
public void onBlockAdded(World w, int x, int y, int z)
public void onBlockAdded( World w, int x, int y, int z )
{
super.onBlockAdded( w, x, y, z );
if ( Platform.isServer() )
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
}
@Override
public void breakBlock(World w, int x, int y, int z, Block b, int WTF)
{
super.breakBlock( w, x, y, z, b, WTF );
if ( Platform.isServer() )
if( Platform.isServer() )
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
}
@@ -211,4 +131,86 @@ public class BlockSkyStone extends AEBaseBlock implements IOrientableBlock
return false;
}
@Override
public IOrientable getOrientable( final IBlockAccess w, final int x, final int y, final int z )
{
if( AppEng.instance.isIntegrationEnabled( IntegrationType.RB ) )
{
TileEntity te = w.getTileEntity( x, y, z );
if( te != null )
{
IOrientable out = ( (IRB) AppEng.instance.getIntegration( IntegrationType.RB ) ).getOrientable( te );
if( out != null )
return out;
}
}
if( w.getBlockMetadata( x, y, z ) == 0 )
return new LocationRotation( w, x, y, z );
return new NullRotation();
}
@Override
public String getUnlocalizedName( ItemStack is )
{
if( is.getItemDamage() == 1 )
return this.getUnlocalizedName() + ".Block";
if( is.getItemDamage() == 2 )
return this.getUnlocalizedName() + ".Brick";
if( is.getItemDamage() == 3 )
return this.getUnlocalizedName() + ".SmallBrick";
return this.getUnlocalizedName();
}
@Override
@SideOnly( Side.CLIENT )
public void registerBlockIcons( IIconRegister ir )
{
super.registerBlockIcons( ir );
this.Block = ir.registerIcon( this.getTextureName() + ".Block" );
this.Brick = ir.registerIcon( this.getTextureName() + ".Brick" );
this.SmallBrick = ir.registerIcon( this.getTextureName() + ".SmallBrick" );
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getIcon( int direction, int metadata )
{
if( metadata == 1 )
return this.Block;
if( metadata == 2 )
return this.Brick;
if( metadata == 3 )
return this.SmallBrick;
return super.getIcon( direction, metadata );
}
@Override
public void setRenderStateByMeta( int metadata )
{
this.getRendererInstance().setTemporaryRenderIcon( this.getIcon( 0, metadata ) );
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
super.getCheckedSubBlocks( item, tabs, itemStacks );
itemStacks.add( new ItemStack( item, 1, 1 ) );
itemStacks.add( new ItemStack( item, 1, 2 ) );
itemStacks.add( new ItemStack( item, 1, 3 ) );
}
@Override
public void breakBlock( World w, int x, int y, int z, Block b, int WTF )
{
super.breakBlock( w, x, y, z, b, WTF );
if( Platform.isServer() )
WorldSettings.getInstance().getCompass().updateArea( w, x, y, z );
}
}
@@ -21,7 +21,6 @@ package appeng.block.solids;
import java.util.EnumSet;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.material.Material;
@@ -46,6 +45,11 @@ public class OreQuartz extends AEBaseBlock
private int boostBrightnessHigh;
private boolean enhanceBrightness;
public OreQuartz()
{
this( OreQuartz.class );
}
public OreQuartz( Class<? extends OreQuartz> self )
{
super( self, Material.rock );
@@ -57,27 +61,27 @@ public class OreQuartz extends AEBaseBlock
this.enhanceBrightness = false;
}
@Override
public void postInit()
{
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) );
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderQuartzOre.class;
}
@Override
public void postInit()
{
OreDictionary.registerOre( "oreCertusQuartz", new ItemStack( this ) );
}
@Override
public int getMixedBrightnessForBlock( IBlockAccess par1iBlockAccess, int par2, int par3, int par4 )
{
int j1 = super.getMixedBrightnessForBlock( par1iBlockAccess, par2, par3, par4 );
if ( this.enhanceBrightness )
if( this.enhanceBrightness )
{
j1 = Math.max( j1 >> 20, j1 >> 4 );
if ( j1 > 4 )
if( j1 > 4 )
{
j1 += this.boostBrightnessHigh;
}
@@ -86,55 +90,63 @@ public class OreQuartz extends AEBaseBlock
j1 += this.boostBrightnessLow;
}
if ( j1 > 15 )
if( j1 > 15 )
j1 = 15;
return j1 << 20 | j1 << 4;
}
return j1;
}
public OreQuartz()
{
this( OreQuartz.class );
}
@Nullable
@Override
public Item getItemDropped( int id, Random rand, int meta )
{
for ( Item crystalItem : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeItem().asSet() )
{
return crystalItem;
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
public int damageDropped( int id )
{
for ( ItemStack crystalStack : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeStack( 1 ).asSet() )
{
return crystalStack.getItemDamage();
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
public int quantityDropped( Random rand )
{
return 1 + rand.nextInt( 2 );
}
@Nullable
@Override
public Item getItemDropped( int id, Random rand, int meta )
{
for( Item crystalItem : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeItem().asSet() )
{
return crystalItem;
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
public void dropBlockAsItemWithChance( World w, int x, int y, int z, int blockID, float something, int meta )
{
super.dropBlockAsItemWithChance( w, x, y, z, blockID, something, meta );
if( this.getItemDropped( blockID, w.rand, meta ) != Item.getItemFromBlock( this ) )
{
int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 );
this.dropXpOnBlockBreak( w, x, y, z, xp );
}
}
@Override
public int damageDropped( int id )
{
for( ItemStack crystalStack : AEApi.instance().definitions().materials().certusQuartzCrystal().maybeStack( 1 ).asSet() )
{
return crystalStack.getItemDamage();
}
throw new MissingDefinition( "Tried to access certus quartz crystal, even though they are disabled" );
}
@Override
public int quantityDroppedWithBonus( int fortune, Random rand )
{
if ( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( 0, rand, fortune ) )
if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( 0, rand, fortune ) )
{
int j = rand.nextInt( fortune + 2 ) - 1;
if ( j < 0 )
if( j < 0 )
{
j = 0;
}
@@ -147,19 +159,6 @@ public class OreQuartz extends AEBaseBlock
}
}
@Override
public void dropBlockAsItemWithChance( World w, int x, int y, int z, int blockID, float something, int meta )
{
super.dropBlockAsItemWithChance( w, x, y, z, blockID, something, meta );
if ( this.getItemDropped( blockID, w.rand, meta ) != Item.getItemFromBlock( this ) )
{
int xp = MathHelper.getRandomIntegerInRange( w.rand, 2, 5 );
this.dropXpOnBlockBreak( w, x, y, z, xp );
}
}
public void setBoostBrightnessLow( int boostBrightnessLow )
{
this.boostBrightnessLow = boostBrightnessLow;
@@ -52,7 +52,7 @@ public class OreQuartzCharged extends OreQuartz
@Override
public Item getItemDropped( int id, Random rand, int meta )
{
for ( Item charged : AEApi.instance().definitions().materials().certusQuartzCrystalCharged().maybeItem().asSet() )
for( Item charged : AEApi.instance().definitions().materials().certusQuartzCrystalCharged().maybeItem().asSet() )
{
return charged;
}
@@ -82,7 +82,7 @@ public class OreQuartzCharged extends OreQuartz
double yOff = ( r.nextFloat() );
double zOff = ( r.nextFloat() );
switch ( r.nextInt( 6 ) )
switch( r.nextInt( 6 ) )
{
case 0:
xOff = -0.01;
@@ -107,11 +107,10 @@ public class OreQuartzCharged extends OreQuartz
break;
}
if ( CommonHelper.proxy.shouldAddParticles( r ) )
if( CommonHelper.proxy.shouldAddParticles( r ) )
{
ChargedOreFX fx = new ChargedOreFX( w, x + xOff, y + yOff, z + zOff, 0.0f, 0.0f, 0.0f );
Minecraft.getMinecraft().effectRenderer.addEffect( fx );
}
}
}
@@ -18,6 +18,7 @@
package appeng.block.spatial;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
@@ -42,6 +43,7 @@ import appeng.client.render.blocks.RenderNull;
import appeng.core.features.AEFeature;
import appeng.helpers.ICustomCollision;
public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
{
@@ -62,47 +64,46 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
public void registerBlockIcons( IIconRegister iconRegistry )
{
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
// do nothing
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity)
{
return false;
}
@Override
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion)
{
// Don't explode.
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
return Arrays.asList( new AxisAlignedBB[] {} );// AxisAlignedBB.getBoundingBox( 0.25, 0, 0.25, 0.75, 0.5, 0.75 )
// } );
// } );
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
out.add( AxisAlignedBB.getBoundingBox( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
}
@Override
public boolean canPlaceBlockAt(World world, int x, int y, int z)
public boolean canPlaceBlockAt( World world, int x, int y, int z )
{
return false;
}
@Override
public void onBlockExploded( World world, int x, int y, int z, Explosion explosion )
{
// Don't explode.
}
@Override
public boolean canEntityDestroy( IBlockAccess world, int x, int y, int z, Entity entity )
{
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.spatial;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -32,37 +33,38 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
public class BlockSpatialIOPort extends AEBaseBlock
{
public BlockSpatialIOPort() {
public BlockSpatialIOPort()
{
super( BlockSpatialIOPort.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
this.setTileEntity( TileSpatialIOPort.class );
}
@Override
public final void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
public final void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
{
TileSpatialIOPort te = this.getTileEntity( w, x, y, z );
if ( te != null )
if( te != null )
te.updateRedstoneState();
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileSpatialIOPort tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_SPATIAL_IO_PORT );
return true;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.spatial;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -31,28 +32,30 @@ import appeng.core.features.AEFeature;
import appeng.helpers.AEGlassMaterial;
import appeng.tile.spatial.TileSpatialPylon;
public class BlockSpatialPylon extends AEBaseBlock
{
public BlockSpatialPylon() {
public BlockSpatialPylon()
{
super( BlockSpatialPylon.class, AEGlassMaterial.INSTANCE );
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
this.setTileEntity( TileSpatialPylon.class );
}
@Override
public void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
public void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
{
TileSpatialPylon tsp = this.getTileEntity( w, x, y, z );
if ( tsp != null )
if( tsp != null )
tsp.onNeighborBlockChange();
}
@Override
public int getLightValue(IBlockAccess w, int x, int y, int z)
public int getLightValue( IBlockAccess w, int x, int y, int z )
{
TileSpatialPylon tsp = this.getTileEntity( w, x, y, z );
if ( tsp != null )
if( tsp != null )
return tsp.getLightValue();
return super.getLightValue( w, x, y, z );
}
@@ -62,5 +65,4 @@ public class BlockSpatialPylon extends AEBaseBlock
{
return RenderSpatialPylon.class;
}
}
@@ -18,6 +18,7 @@
package appeng.block.storage;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -37,10 +38,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileChest;
import appeng.util.Platform;
public class BlockChest extends AEBaseBlock
{
public BlockChest() {
public BlockChest()
{
super( BlockChest.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEChest ) );
this.setTileEntity( TileChest.class );
@@ -53,22 +56,22 @@ public class BlockChest extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
TileChest tg = this.getTileEntity( w, x, y, z );
if ( tg != null && !p.isSneaking() )
if( tg != null && !p.isSneaking() )
{
if ( Platform.isClient() )
if( Platform.isClient() )
return true;
if ( side != tg.getUp().ordinal() )
if( side != tg.getUp().ordinal() )
{
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_CHEST );
}
else
{
ItemStack cell = tg.getStackInSlot( 1 );
if ( cell != null )
if( cell != null )
{
ICellHandler ch = AEApi.instance().registries().cell().getHandler( cell );
@@ -18,6 +18,7 @@
package appeng.block.storage;
import java.util.EnumSet;
import net.minecraft.block.material.Material;
@@ -33,10 +34,12 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileDrive;
import appeng.util.Platform;
public class BlockDrive extends AEBaseBlock
{
public BlockDrive() {
public BlockDrive()
{
super( BlockDrive.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEDrive ) );
this.setTileEntity( TileDrive.class );
@@ -49,19 +52,18 @@ public class BlockDrive extends AEBaseBlock
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileDrive tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_DRIVE );
return true;
}
return false;
}
}
@@ -18,6 +18,7 @@
package appeng.block.storage;
import java.util.EnumSet;
import net.minecraft.block.Block;
@@ -32,33 +33,35 @@ import appeng.core.sync.GuiBridge;
import appeng.tile.storage.TileIOPort;
import appeng.util.Platform;
public class BlockIOPort extends AEBaseBlock
{
public BlockIOPort() {
public BlockIOPort()
{
super( BlockIOPort.class, Material.iron );
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.IOPort ) );
this.setTileEntity( TileIOPort.class );
}
@Override
public final void onNeighborBlockChange(World w, int x, int y, int z, Block junk)
public final void onNeighborBlockChange( World w, int x, int y, int z, Block junk )
{
TileIOPort te = this.getTileEntity( w, x, y, z );
if ( te != null )
if( te != null )
te.updateRedstoneState();
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ)
public boolean onActivated( World w, int x, int y, int z, EntityPlayer p, int side, float hitX, float hitY, float hitZ )
{
if ( p.isSneaking() )
if( p.isSneaking() )
return false;
TileIOPort tg = this.getTileEntity( w, x, y, z );
if ( tg != null )
if( tg != null )
{
if ( Platform.isServer() )
if( Platform.isServer() )
Platform.openGUI( p, tg, ForgeDirection.getOrientation( side ), GuiBridge.GUI_IOPORT );
return true;
}
@@ -51,10 +51,12 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform;
public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
{
public BlockSkyChest() {
public BlockSkyChest()
{
super( BlockSkyChest.class, Material.rock );
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.SkyStoneChests ) );
this.setTileEntity( TileSkyChest.class );
@@ -66,31 +68,11 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
public String getUnlocalizedName(ItemStack is)
public int damageDropped( int metadata )
{
if ( is.getItemDamage() == 1 )
return this.getUnlocalizedName() + ".Block";
return this.getUnlocalizedName();
}
@Override
public int damageDropped(int metadata) {
return metadata;
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon(int direction, int metadata)
{
for ( Block skyStoneBlock : AEApi.instance().definitions().blocks().skyStone().maybeBlock().asSet() )
{
return skyStoneBlock.getIcon( direction, metadata );
}
return Blocks.stone.getIcon( direction, metadata );
}
@Override
public ItemStack getPickBlock( MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player )
{
@@ -101,8 +83,40 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
@SideOnly(Side.CLIENT)
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks)
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockSkyChest.class;
}
@Override
@SideOnly( Side.CLIENT )
public IIcon getIcon( int direction, int metadata )
{
for( Block skyStoneBlock : AEApi.instance().definitions().blocks().skyStone().maybeBlock().asSet() )
{
return skyStoneBlock.getIcon( direction, metadata );
}
return Blocks.stone.getIcon( direction, metadata );
}
@Override
public boolean onActivated( World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ )
{
if( Platform.isServer() )
Platform.openGUI( player, this.getTileEntity( w, x, y, z ), ForgeDirection.getOrientation( side ), GuiBridge.GUI_SKYCHEST );
return true;
}
@Override
public void registerBlockIcons( IIconRegister iconRegistry )
{
}
@Override
@SideOnly( Side.CLIENT )
public void getCheckedSubBlocks( Item item, CreativeTabs tabs, List<ItemStack> itemStacks )
{
super.getCheckedSubBlocks( item, tabs, itemStacks );
@@ -110,28 +124,22 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
public String getUnlocalizedName( ItemStack is )
{
if ( Platform.isServer() )
Platform.openGUI( player, this.getTileEntity( w, x, y, z ), ForgeDirection.getOrientation( side ), GuiBridge.GUI_SKYCHEST );
if( is.getItemDamage() == 1 )
return this.getUnlocalizedName() + ".Block";
return true;
return this.getUnlocalizedName();
}
@Override
protected Class<? extends BaseBlockRender> getRenderer()
{
return RenderBlockSkyChest.class;
}
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(World w, int x, int y, int z, Entity e, boolean isVisual)
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
{
TileSkyChest sk = this.getTileEntity( w, x, y, z );
double sc = 0.06;
ForgeDirection o = ForgeDirection.UNKNOWN;
if ( sk != null )
if( sk != null )
o = sk.getUp();
double X = o.offsetX == 0 ? 0.06 : 0.0;
@@ -142,13 +150,8 @@ public class BlockSkyChest extends AEBaseBlock implements ICustomCollision
}
@Override
public void addCollidingBlockToList(World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e)
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
{
out.add( AxisAlignedBB.getBoundingBox( 0.05, 0.05, 0.05, 0.95, 0.95, 0.95 ) );
}
@Override
public void registerBlockIcons(IIconRegister iconRegistry)
{
}
}