Implemented security station rendering.
This commit is contained in:
@@ -22,12 +22,16 @@ package appeng.block.misc;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -39,11 +43,20 @@ import appeng.util.Platform;
|
||||
public class BlockSecurityStation extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
private static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
|
||||
public BlockSecurityStation()
|
||||
{
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileSecurityStation.class );
|
||||
this.setDefaultState( getDefaultState().withProperty( POWERED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { POWERED };
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,6 +65,20 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
boolean powered = false;
|
||||
TileSecurityStation te = getTileEntity( world, pos );
|
||||
if( te != null )
|
||||
{
|
||||
powered = te.isActive();
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.withProperty( POWERED, powered );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.ColorableTileBlockColor;
|
||||
import appeng.client.render.StaticItemColor;
|
||||
|
||||
|
||||
public class SecurityStationRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.blockColor( ColorableTileBlockColor.INSTANCE );
|
||||
itemRendering.color( new StaticItemColor( AEColor.Transparent ) );
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,7 @@ import appeng.block.misc.BlockSecurityStation;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.block.misc.BlockVibrationChamber;
|
||||
import appeng.block.misc.SecurityStationRendering;
|
||||
import appeng.block.misc.SkyCompassRendering;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.block.networking.BlockController;
|
||||
@@ -265,7 +266,10 @@ public final class ApiBlocks implements IBlocks
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( item, new DispenserBehaviorTinyTNT() );
|
||||
} )
|
||||
.build();
|
||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new ).features( AEFeature.Security ).build();
|
||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||
.features( AEFeature.Security )
|
||||
.rendering( new SecurityStationRendering() )
|
||||
.build();
|
||||
this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new ).features( AEFeature.QuantumNetworkBridge ).build();
|
||||
this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new ).features( AEFeature.QuantumNetworkBridge ).build();
|
||||
this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new ).features( AEFeature.SpatialIO ).build();
|
||||
|
||||
Reference in New Issue
Block a user