Implemented ME chest item + block model.
|
@ -22,12 +22,16 @@ package appeng.block.storage;
|
|||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
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.AEApi;
|
||||
|
@ -43,10 +47,19 @@ import appeng.util.Platform;
|
|||
public class BlockChest extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
private final static PropertyEnum<DriveSlotState> SLOT_STATE = PropertyEnum.create( "slot_state", DriveSlotState.class );
|
||||
|
||||
public BlockChest()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileChest.class );
|
||||
this.setDefaultState( getDefaultState().withProperty( SLOT_STATE, DriveSlotState.EMPTY ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { SLOT_STATE };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -55,6 +68,30 @@ public class BlockChest extends AEBaseTileBlock
|
|||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||
{
|
||||
DriveSlotState slotState = DriveSlotState.EMPTY;
|
||||
|
||||
TileChest te = getTileEntity( worldIn, pos );
|
||||
|
||||
if( te != null )
|
||||
{
|
||||
if( te.getCellCount() >= 1 )
|
||||
{
|
||||
slotState = DriveSlotState.fromCellStatus( te.getCellStatus( 0 ) );
|
||||
}
|
||||
// Power-state has to be checked separately
|
||||
if( !te.isPowered() && slotState != DriveSlotState.EMPTY )
|
||||
{
|
||||
slotState = DriveSlotState.OFFLINE;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.withProperty( SLOT_STATE, slotState );
|
||||
}
|
||||
|
||||
@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,23 @@
|
|||
package appeng.block.storage;
|
||||
|
||||
|
||||
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 ChestRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
// I checked, the ME chest doesn't keep its color in item form
|
||||
itemRendering.color( new StaticItemColor( AEColor.Transparent ) );
|
||||
rendering.blockColor( new ColorableTileBlockColor() );
|
||||
}
|
||||
|
||||
}
|
|
@ -19,25 +19,57 @@
|
|||
package appeng.block.storage;
|
||||
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
|
||||
/**
|
||||
* Describes the different states a single slot of a BlockDrive can be in in terms of rendering.
|
||||
*/
|
||||
public enum DriveSlotState
|
||||
public enum DriveSlotState implements IStringSerializable
|
||||
{
|
||||
|
||||
// No cell in slot
|
||||
EMPTY,
|
||||
EMPTY( "empty" ),
|
||||
|
||||
// Cell in slot, but unpowered
|
||||
OFFLINE,
|
||||
OFFLINE( "offline" ),
|
||||
|
||||
// Online and free space
|
||||
ONLINE,
|
||||
ONLINE( "online" ),
|
||||
|
||||
// Types full, space left
|
||||
TYPES_FULL,
|
||||
TYPES_FULL( "types_full" ),
|
||||
|
||||
// Completely full
|
||||
FULL
|
||||
FULL( "full" );
|
||||
|
||||
private final String name;
|
||||
|
||||
DriveSlotState( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public static DriveSlotState fromCellStatus( int cellStatus )
|
||||
{
|
||||
switch( cellStatus )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return DriveSlotState.EMPTY;
|
||||
case 1:
|
||||
return DriveSlotState.ONLINE;
|
||||
case 2:
|
||||
return DriveSlotState.TYPES_FULL;
|
||||
case 3:
|
||||
return DriveSlotState.FULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,22 +70,7 @@ public class DriveSlotsState
|
|||
}
|
||||
else
|
||||
{
|
||||
switch( chestOrDrive.getCellStatus( i ) )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
slots[i] = DriveSlotState.EMPTY;
|
||||
break;
|
||||
case 1:
|
||||
slots[i] = DriveSlotState.ONLINE;
|
||||
break;
|
||||
case 2:
|
||||
slots[i] = DriveSlotState.TYPES_FULL;
|
||||
break;
|
||||
case 3:
|
||||
slots[i] = DriveSlotState.FULL;
|
||||
break;
|
||||
}
|
||||
slots[i] = DriveSlotState.fromCellStatus( chestOrDrive.getCellStatus( i ) );
|
||||
}
|
||||
}
|
||||
return new DriveSlotsState( slots );
|
||||
|
|
|
@ -75,6 +75,7 @@ import appeng.block.storage.BlockDrive;
|
|||
import appeng.block.storage.BlockIOPort;
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.block.storage.BlockSkyChest.SkyChestType;
|
||||
import appeng.block.storage.ChestRendering;
|
||||
import appeng.block.storage.DriveRendering;
|
||||
import appeng.block.storage.SkyChestRenderingCustomizer;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
|
@ -288,7 +289,11 @@ public final class ApiBlocks implements IBlocks
|
|||
.useCustomItemModel()
|
||||
.rendering( new DriveRendering() )
|
||||
.build();
|
||||
this.chest = registry.block( "chest", BlockChest::new ).features( AEFeature.StorageCells, AEFeature.MEChest ).build();
|
||||
this.chest = registry.block( "chest", BlockChest::new )
|
||||
.features( AEFeature.StorageCells, AEFeature.MEChest )
|
||||
.useCustomItemModel()
|
||||
.rendering( new ChestRendering() )
|
||||
.build();
|
||||
this.iface = registry.block( "interface", BlockInterface::new ).build();
|
||||
this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new ).features( AEFeature.StorageCells ).build();
|
||||
this.iOPort = registry.block( "ioport", BlockIOPort::new ).features( AEFeature.StorageCells, AEFeature.IOPort ).build();
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"forge_marker": 1,
|
||||
"defaults": {
|
||||
"model": "appliedenergistics2:chest/base"
|
||||
},
|
||||
"variants": {
|
||||
"slot_state": {
|
||||
"empty": {
|
||||
"submodel": {
|
||||
"lights": {
|
||||
"model": "appliedenergistics2:chest/lights_off"
|
||||
},
|
||||
"state": {
|
||||
"model": "appliedenergistics2:chest/cell_state_empty"
|
||||
}
|
||||
}
|
||||
},
|
||||
"offline": {
|
||||
"submodel": {
|
||||
"lights": {
|
||||
"model": "appliedenergistics2:chest/lights_off"
|
||||
},
|
||||
"state": {
|
||||
"model": "appliedenergistics2:chest/cell_state_offline"
|
||||
}
|
||||
}
|
||||
},
|
||||
"online": {
|
||||
"submodel": {
|
||||
"lights": {
|
||||
"model": "appliedenergistics2:chest/lights_on"
|
||||
},
|
||||
"state": {
|
||||
"model": "appliedenergistics2:chest/cell_state_online"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types_full": {
|
||||
"submodel": {
|
||||
"lights": {
|
||||
"model": "appliedenergistics2:chest/lights_on"
|
||||
},
|
||||
"state": {
|
||||
"model": "appliedenergistics2:chest/cell_state_types_full"
|
||||
}
|
||||
}
|
||||
},
|
||||
"full": {
|
||||
"submodel": {
|
||||
"lights": {
|
||||
"model": "appliedenergistics2:chest/lights_on"
|
||||
},
|
||||
"state": {
|
||||
"model": "appliedenergistics2:chest/cell_state_full"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"parent": "block/cube",
|
||||
"textures": {
|
||||
"particle": "appliedenergistics2:blocks/chest/side",
|
||||
"up": "appliedenergistics2:blocks/chest/top",
|
||||
"down": "appliedenergistics2:blocks/chest/bottom",
|
||||
"north": "appliedenergistics2:blocks/chest/front",
|
||||
"east": "appliedenergistics2:blocks/chest/side",
|
||||
"south": "appliedenergistics2:blocks/chest/side",
|
||||
"west": "appliedenergistics2:blocks/chest/side"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"textures": {
|
||||
"state": "appliedenergistics2:blocks/chest/cell_state_empty"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#state"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"uvlMarker": true,
|
||||
"textures": {
|
||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||
"state": "appliedenergistics2:blocks/chest/cell_state_full"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#backdrop" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#state", "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"textures": {
|
||||
"state": "appliedenergistics2:blocks/chest/cell_state_offline"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#state"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"uvlMarker": true,
|
||||
"textures": {
|
||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||
"state": "appliedenergistics2:blocks/chest/cell_state_online"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#backdrop" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#state", "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"uvlMarker": true,
|
||||
"textures": {
|
||||
"backdrop": "appliedenergistics2:blocks/chest/cell_state_backdrop",
|
||||
"state": "appliedenergistics2:blocks/chest/cell_state_types_full"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#backdrop" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"north": {"texture": "#state", "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"textures": {
|
||||
"lights": "appliedenergistics2:blocks/chest/lights_off"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"up": { "texture": "#lights", "tintindex": 0 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"uvlMarker": true,
|
||||
"textures": {
|
||||
"lights_bright": "appliedenergistics2:blocks/chest/lights_on_bright",
|
||||
"lights_medium": "appliedenergistics2:blocks/chest/lights_on_medium",
|
||||
"lights_dark": "appliedenergistics2:blocks/chest/lights_on_dark"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"up": {"texture": "#lights_bright", "tintindex": 0, "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"up": {"texture": "#lights_medium", "tintindex": 1, "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [0, 0, 0],
|
||||
"to": [16, 16, 16],
|
||||
"faces": {
|
||||
"up": {"texture": "#lights_dark", "tintindex": 2, "uvlightmap": { "block": 0.007, "sky": 0.007 }}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"parent": "block/cube",
|
||||
"textures": {
|
||||
"up": "appliedenergistics2:blocks/chest/top_item",
|
||||
"down": "appliedenergistics2:blocks/chest/bottom",
|
||||
"north": "appliedenergistics2:blocks/chest/front_item",
|
||||
"east": "appliedenergistics2:blocks/chest/side",
|
||||
"south": "appliedenergistics2:blocks/chest/side",
|
||||
"west": "appliedenergistics2:blocks/chest/side"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 398 B |
After Width: | Height: | Size: 145 B |
After Width: | Height: | Size: 140 B |
After Width: | Height: | Size: 134 B |
After Width: | Height: | Size: 147 B |
After Width: | Height: | Size: 136 B |
After Width: | Height: | Size: 132 B |
After Width: | Height: | Size: 375 B |
After Width: | Height: | Size: 323 B |
After Width: | Height: | Size: 212 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 232 B |
After Width: | Height: | Size: 223 B |
After Width: | Height: | Size: 342 B |
After Width: | Height: | Size: 325 B |
After Width: | Height: | Size: 278 B |