Basic reformat, hit once, hope never again
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user