Implemented security station rendering.

This commit is contained in:
Sebastian Hartte 2016-08-26 13:59:59 +02:00
parent 0316c1de58
commit b28d468935
11 changed files with 157 additions and 15 deletions

View file

@ -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 )
{

View file

@ -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 ) );
}
}

View file

@ -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();

View file

@ -1,7 +1,6 @@
{
"variants": {
"normal": {
"model": "appliedenergistics2:security_station"
}
}
}
"variants": {
"powered=false": { "model": "appliedenergistics2:security_station_off" },
"powered=true": { "model": "appliedenergistics2:security_station_on" }
}
}

View file

@ -1,8 +0,0 @@
{
"parent": "block/cube_bottom_top",
"textures": {
"bottom": "appliedenergistics2:blocks/security_station_bottom",
"side": "appliedenergistics2:blocks/security_station_side",
"top": "appliedenergistics2:blocks/security_station"
}
}

View file

@ -0,0 +1,47 @@
{
"parent": "block/block",
"textures": {
"particle": "appliedenergistics2:blocks/security_station_side",
"side": "appliedenergistics2:blocks/security_station_side",
"bottom": "appliedenergistics2:blocks/security_station_bottom",
"top": "appliedenergistics2:blocks/security_station_top",
"lightsBright": "appliedenergistics2:blocks/security_station_light_bright",
"lightsMedium": "appliedenergistics2:blocks/security_station_light_medium",
"lightsDark": "appliedenergistics2:blocks/security_station_light_dark"
},
"elements": [
{
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "texture": "#bottom" },
"up": { "texture": "#top"},
"north": { "texture": "#side"},
"south": { "texture": "#side"},
"west": { "texture": "#side"},
"east": { "texture": "#side"}
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsBright", "tintindex": 0 }
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsMedium", "tintindex": 1 }
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsDark", "tintindex": 2 }
}
}
]
}

View file

@ -0,0 +1,48 @@
{
"uvlMarker": true,
"parent": "block/block",
"textures": {
"particle": "appliedenergistics2:blocks/security_station_side",
"side": "appliedenergistics2:blocks/security_station_side",
"bottom": "appliedenergistics2:blocks/security_station_bottom",
"top": "appliedenergistics2:blocks/security_station_top",
"lightsBright": "appliedenergistics2:blocks/security_station_light_bright",
"lightsMedium": "appliedenergistics2:blocks/security_station_light_medium",
"lightsDark": "appliedenergistics2:blocks/security_station_light_dark"
},
"elements": [
{
"from": [ 0, 0, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"down": { "texture": "#bottom" },
"up": { "texture": "#top"},
"north": { "texture": "#side"},
"south": { "texture": "#side"},
"west": { "texture": "#side"},
"east": { "texture": "#side"}
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsBright", "tintindex": 0, "uvlightmap": { "sky": 0.007, "block": 0.007 } }
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsMedium", "tintindex": 1, "uvlightmap": { "sky": 0.007, "block": 0.007 } }
}
},
{
"from": [ 0, 15, 0 ],
"to": [ 16, 16, 16 ],
"faces": {
"up": { "texture": "#lightsDark", "tintindex": 2, "uvlightmap": { "sky": 0.007, "block": 0.007 } }
}
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 223 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B