Fixed up the Tile Entity mess a bit, still need to look at the CableBus stuff a bit though.

This commit is contained in:
Gunther De Wachter
2017-06-30 17:22:06 +02:00
parent 10e050c35b
commit 49a6df5bc7
44 changed files with 167 additions and 77 deletions
@@ -112,7 +112,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return 0; return 0;
} }
protected void setTileEntity( final Class<? extends AEBaseTile> c ) // TODO : Was this change needed?
public void setTileEntity( final Class<? extends AEBaseTile> c )
{ {
this.tileEntityType = c; this.tileEntityType = c;
this.setInventory( IInventory.class.isAssignableFrom( c ) ); this.setInventory( IInventory.class.isAssignableFrom( c ) );
@@ -47,7 +47,6 @@ public class BlockCraftingMonitor extends BlockCraftingUnit
public BlockCraftingMonitor() public BlockCraftingMonitor()
{ {
super( CraftingUnitType.MONITOR ); super( CraftingUnitType.MONITOR );
this.setTileEntity( TileCraftingMonitorTile.class );
} }
@Override @Override
@@ -28,7 +28,6 @@ public class BlockCraftingStorage extends BlockCraftingUnit
public BlockCraftingStorage( final CraftingUnitType type ) public BlockCraftingStorage( final CraftingUnitType type )
{ {
super( type ); super( type );
this.setTileEntity( TileCraftingStorageTile.class );
} }
} }
@@ -60,7 +60,6 @@ public class BlockCraftingUnit extends AEBaseTileBlock
super( Material.IRON ); super( Material.IRON );
this.type = type; this.type = type;
this.setTileEntity( TileCraftingTile.class );
} }
@Override @Override
@@ -49,7 +49,6 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileMolecularAssembler.class );
this.setOpaque( false ); this.setOpaque( false );
this.lightOpacity = 1; this.lightOpacity = 1;
} }
@@ -48,7 +48,6 @@ public class BlockCrank extends AEBaseTileBlock
{ {
super( Material.WOOD ); super( Material.WOOD );
this.setTileEntity( TileCrank.class );
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
this.setHarvestLevel( "axe", 0 ); this.setHarvestLevel( "axe", 0 );
this.setFullSize( this.setOpaque( false ) ); this.setFullSize( this.setOpaque( false ) );
@@ -42,7 +42,6 @@ public class BlockGrinder extends AEBaseTileBlock
{ {
super( Material.ROCK ); super( Material.ROCK );
this.setTileEntity( TileGrinder.class );
this.setHardness( 3.2F ); this.setHardness( 3.2F );
} }
@@ -41,8 +41,6 @@ public class BlockCellWorkbench extends AEBaseTileBlock
public BlockCellWorkbench() public BlockCellWorkbench()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileCellWorkbench.class );
} }
@Override @Override
@@ -66,7 +66,6 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileCharger.class );
this.setLightOpacity( 2 ); this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) ); this.setFullSize( this.setOpaque( false ) );
} }
@@ -42,8 +42,6 @@ public class BlockCondenser extends AEBaseTileBlock
public BlockCondenser() public BlockCondenser()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileCondenser.class );
} }
@Override @Override
@@ -44,7 +44,6 @@ public class BlockInscriber extends AEBaseTileBlock
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileInscriber.class );
this.setLightOpacity( 2 ); this.setLightOpacity( 2 );
this.setFullSize( this.setOpaque( false ) ); this.setFullSize( this.setOpaque( false ) );
} }
@@ -49,8 +49,6 @@ public class BlockInterface extends AEBaseTileBlock
public BlockInterface() public BlockInterface()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileInterface.class );
} }
@Override @Override
@@ -63,8 +63,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
this.setFullSize( false ); this.setFullSize( false );
this.setOpaque( false ); this.setOpaque( false );
this.setTileEntity( TileLightDetector.class );
} }
@Override @Override
@@ -52,7 +52,6 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
{ {
super( Material.ROCK ); super( Material.ROCK );
this.setSoundType( SoundType.METAL ); this.setSoundType( SoundType.METAL );
this.setTileEntity( TileQuartzGrowthAccelerator.class );
this.setDefaultState( getDefaultState().withProperty( POWERED, false ) ); this.setDefaultState( getDefaultState().withProperty( POWERED, false ) );
} }
@@ -49,7 +49,6 @@ public class BlockSecurityStation extends AEBaseTileBlock
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileSecurityStation.class );
this.setDefaultState( getDefaultState().withProperty( POWERED, false ) ); this.setDefaultState( getDefaultState().withProperty( POWERED, false ) );
} }
@@ -49,7 +49,6 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
public BlockSkyCompass() public BlockSkyCompass()
{ {
super( Material.CIRCUITS ); super( Material.CIRCUITS );
this.setTileEntity( TileSkyCompass.class );
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
this.setFullSize( false ); this.setFullSize( false );
this.setOpaque( false ); this.setOpaque( false );
@@ -53,7 +53,6 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
public BlockVibrationChamber() public BlockVibrationChamber()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileVibrationChamber.class );
this.setHardness( 4.2F ); this.setHardness( 4.2F );
this.setDefaultState( getDefaultState().withProperty( ACTIVE, false ) ); this.setDefaultState( getDefaultState().withProperty( ACTIVE, false ) );
} }
@@ -100,7 +100,6 @@ public class BlockCableBus extends AEBaseTileBlock
// this will actually be overwritten later through setupTile and the // this will actually be overwritten later through setupTile and the
// combined layers // combined layers
this.setTileEntity( TileCableBus.class );
} }
@Override @Override
@@ -387,20 +386,22 @@ public class BlockCableBus extends AEBaseTileBlock
{ {
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class ); noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class );
this.setTileEntity( noTesrTile ); this.setTileEntity( noTesrTile );
// TODO: Change after transition phase
Platform.registerTileEntityWithAlternatives( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus", "BlockCableBus" );
if( Platform.isClient() ) if( Platform.isClient() )
{ {
setupTesr(); setupTesr();
} }
else
{
GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
}
} }
@SideOnly( Side.CLIENT ) @SideOnly( Side.CLIENT )
private static void setupTesr() private static void setupTesr()
{ {
tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class ); tesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBusTESR.class );
// TODO: Change after transition phase GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" );
Platform.registerTileEntityWithAlternatives( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus", "ClientOnly_TESR_CableBus" );
ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() ); ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
} }
@@ -73,7 +73,6 @@ public class BlockController extends AEBaseTileBlock
public BlockController() public BlockController()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileController.class );
this.setHardness( 6 ); this.setHardness( 6 );
this.setDefaultState( getDefaultState() this.setDefaultState( getDefaultState()
.withProperty( CONTROLLER_STATE, ControllerBlockState.offline ) .withProperty( CONTROLLER_STATE, ControllerBlockState.offline )
@@ -29,6 +29,5 @@ public class BlockCreativeEnergyCell extends AEBaseTileBlock
public BlockCreativeEnergyCell() public BlockCreativeEnergyCell()
{ {
super( AEGlassMaterial.INSTANCE ); super( AEGlassMaterial.INSTANCE );
this.setTileEntity( TileCreativeEnergyCell.class );
} }
} }
@@ -26,7 +26,7 @@ public class BlockDenseEnergyCell extends BlockEnergyCell
public BlockDenseEnergyCell() public BlockDenseEnergyCell()
{ {
this.setTileEntity( TileDenseEnergyCell.class );
} }
@Override @Override
@@ -31,6 +31,5 @@ public class BlockEnergyAcceptor extends AEBaseTileBlock
public BlockEnergyAcceptor() public BlockEnergyAcceptor()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileEnergyAcceptor.class );
} }
} }
@@ -56,8 +56,6 @@ public class BlockEnergyCell extends AEBaseTileBlock
public BlockEnergyCell() public BlockEnergyCell()
{ {
super( AEGlassMaterial.INSTANCE ); super( AEGlassMaterial.INSTANCE );
this.setTileEntity( TileEnergyCell.class );
} }
@Override @Override
@@ -66,7 +66,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
public BlockWireless() public BlockWireless()
{ {
super( AEGlassMaterial.INSTANCE ); super( AEGlassMaterial.INSTANCE );
this.setTileEntity( TileWireless.class );
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
this.setFullSize( false ); this.setFullSize( false );
this.setOpaque( false ); this.setOpaque( false );
@@ -58,7 +58,6 @@ public class BlockPaint extends AEBaseTileBlock
{ {
super( new MaterialLiquid( MapColor.AIR ) ); super( new MaterialLiquid( MapColor.AIR ) );
this.setTileEntity( TilePaint.class );
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
this.setFullSize( false ); this.setFullSize( false );
this.setOpaque( false ); this.setOpaque( false );
@@ -48,7 +48,6 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
public BlockQuantumBase( final Material mat ) public BlockQuantumBase( final Material mat )
{ {
super( mat ); super( mat );
this.setTileEntity( TileQuantumBridge.class );
final float shave = 2.0f / 16.0f; final float shave = 2.0f / 16.0f;
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave ); this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
this.setLightOpacity( 0 ); this.setLightOpacity( 0 );
@@ -43,7 +43,6 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
public BlockSpatialIOPort() public BlockSpatialIOPort()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileSpatialIOPort.class );
} }
@Override @Override
@@ -44,7 +44,6 @@ public class BlockSpatialPylon extends AEBaseTileBlock
public BlockSpatialPylon() public BlockSpatialPylon()
{ {
super( AEGlassMaterial.INSTANCE ); super( AEGlassMaterial.INSTANCE );
this.setTileEntity( TileSpatialPylon.class );
} }
@Override @Override
@@ -52,7 +52,6 @@ public class BlockChest extends AEBaseTileBlock
public BlockChest() public BlockChest()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileChest.class );
this.setDefaultState( getDefaultState().withProperty( SLOT_STATE, DriveSlotState.EMPTY ) ); this.setDefaultState( getDefaultState().withProperty( SLOT_STATE, DriveSlotState.EMPTY ) );
} }
@@ -52,7 +52,6 @@ public class BlockDrive extends AEBaseTileBlock
public BlockDrive() public BlockDrive()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileDrive.class );
} }
@Override @Override
@@ -44,7 +44,6 @@ public class BlockIOPort extends AEBaseTileBlock
public BlockIOPort() public BlockIOPort()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileIOPort.class );
} }
@Override @Override
@@ -61,7 +61,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
public BlockSkyChest( final SkyChestType type ) public BlockSkyChest( final SkyChestType type )
{ {
super( Material.ROCK ); super( Material.ROCK );
this.setTileEntity( TileSkyChest.class );
this.setOpaque( this.setFullSize( false ) ); this.setOpaque( this.setFullSize( false ) );
this.lightOpacity = 0; this.lightOpacity = 0;
this.setHardness( 50 ); this.setHardness( 50 );
@@ -74,6 +74,8 @@ class BlockDefinitionBuilder implements IBlockBuilder
private CreativeTabs creativeTab = CreativeTab.instance; private CreativeTabs creativeTab = CreativeTab.instance;
private Class<? extends AEBaseTile> teClass;
private boolean disableItem = false; private boolean disableItem = false;
private Function<Block, ItemBlock> itemFactory; private Function<Block, ItemBlock> itemFactory;
@@ -144,6 +146,12 @@ class BlockDefinitionBuilder implements IBlockBuilder
return this; return this;
} }
@Override
public IBlockBuilder tileEntity(Class<? extends AEBaseTile> tileEntityClass) {
teClass = tileEntityClass;
return this;
}
@Override @Override
public IBlockBuilder useCustomItemModel() public IBlockBuilder useCustomItemModel()
{ {
@@ -222,6 +230,9 @@ class BlockDefinitionBuilder implements IBlockBuilder
if( block instanceof AEBaseTileBlock ) if( block instanceof AEBaseTileBlock )
{ {
AEBaseTileBlock tileBlock = (AEBaseTileBlock) block; AEBaseTileBlock tileBlock = (AEBaseTileBlock) block;
// Fallback?
if ( teClass != null )
tileBlock.setTileEntity( teClass );
blockRendering.apply( factory, block, tileBlock.getTileEntityClass() ); blockRendering.apply( factory, block, tileBlock.getTileEntityClass() );
} }
else else
@@ -238,13 +249,14 @@ class BlockDefinitionBuilder implements IBlockBuilder
if( block instanceof AEBaseTileBlock ) if( block instanceof AEBaseTileBlock )
{ {
AEBaseTileBlock tileBlock = (AEBaseTileBlock) block; AEBaseTileBlock tileBlock = (AEBaseTileBlock) block;
if( teClass != null )
tileBlock.setTileEntity( teClass );
factory.addPreInit( side -> { factory.addPreInit( side -> {
Class<? extends AEBaseTile> tileEntityClass = tileBlock.getTileEntityClass(); AEBaseTile.registerTileItem( teClass, new BlockStackSrc( block, 0, ActivityState.Enabled ) );
AEBaseTile.registerTileItem( tileEntityClass, new BlockStackSrc( block, 0, ActivityState.Enabled ) );
// TODO: Change after transition phase // TODO: Change after transition phase
Platform.registerTileEntityWithAlternatives( tileEntityClass, AppEng.MOD_ID.toLowerCase() + ":" + registryName, registryName ); GameRegistry.registerTileEntity( teClass, AppEng.MOD_ID.toLowerCase() + ":" + registryName);
} ); } );
return (T) new TileDefinition( registryName, (AEBaseTileBlock) block, item ); return (T) new TileDefinition( registryName, (AEBaseTileBlock) block, item );
@@ -22,6 +22,7 @@ package appeng.bootstrap;
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.Function; import java.util.function.Function;
import appeng.tile.AEBaseTile;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@@ -45,6 +46,8 @@ public interface IBlockBuilder
IBlockBuilder rendering( BlockRenderingCustomizer callback ); IBlockBuilder rendering( BlockRenderingCustomizer callback );
IBlockBuilder tileEntity( Class<? extends AEBaseTile> teClass );
/** /**
* Don't register an item for this block. * Don't register an item for this block.
*/ */
@@ -19,6 +19,41 @@
package appeng.core.api.definitions; package appeng.core.api.definitions;
import appeng.debug.TileChunkLoader;
import appeng.debug.TileCubeGenerator;
import appeng.debug.TileItemGen;
import appeng.debug.TilePhantomNode;
import appeng.tile.crafting.TileCraftingMonitorTile;
import appeng.tile.crafting.TileCraftingStorageTile;
import appeng.tile.crafting.TileCraftingTile;
import appeng.tile.crafting.TileMolecularAssembler;
import appeng.tile.grindstone.TileCrank;
import appeng.tile.grindstone.TileGrinder;
import appeng.tile.misc.TileCellWorkbench;
import appeng.tile.misc.TileCharger;
import appeng.tile.misc.TileCondenser;
import appeng.tile.misc.TileInscriber;
import appeng.tile.misc.TileInterface;
import appeng.tile.misc.TileLightDetector;
import appeng.tile.misc.TilePaint;
import appeng.tile.misc.TileQuartzGrowthAccelerator;
import appeng.tile.misc.TileSecurityStation;
import appeng.tile.misc.TileSkyCompass;
import appeng.tile.misc.TileVibrationChamber;
import appeng.tile.networking.TileCableBus;
import appeng.tile.networking.TileController;
import appeng.tile.networking.TileCreativeEnergyCell;
import appeng.tile.networking.TileDenseEnergyCell;
import appeng.tile.networking.TileEnergyAcceptor;
import appeng.tile.networking.TileEnergyCell;
import appeng.tile.networking.TileWireless;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.tile.spatial.TileSpatialPylon;
import appeng.tile.storage.TileChest;
import appeng.tile.storage.TileDrive;
import appeng.tile.storage.TileIOPort;
import appeng.tile.storage.TileSkyChest;
import com.google.common.base.Verify; import com.google.common.base.Verify;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@@ -251,32 +286,39 @@ public final class ApiBlocks implements IBlocks
this.skyStoneChest = registry.block( "sky_stone_chest", () -> new BlockSkyChest( SkyChestType.STONE ) ) this.skyStoneChest = registry.block( "sky_stone_chest", () -> new BlockSkyChest( SkyChestType.STONE ) )
.features( AEFeature.SKY_STONE_CHESTS ) .features( AEFeature.SKY_STONE_CHESTS )
.tileEntity( TileSkyChest.Stone.class )
.rendering( new SkyChestRenderingCustomizer( SkyChestType.STONE ) ) .rendering( new SkyChestRenderingCustomizer( SkyChestType.STONE ) )
.build(); .build();
this.smoothSkyStoneChest = registry.block( "smooth_sky_stone_chest", () -> new BlockSkyChest( SkyChestType.BLOCK ) ) this.smoothSkyStoneChest = registry.block( "smooth_sky_stone_chest", () -> new BlockSkyChest( SkyChestType.BLOCK ) )
.features( AEFeature.SKY_STONE_CHESTS ) .features( AEFeature.SKY_STONE_CHESTS )
.tileEntity( TileSkyChest.Smooth.class )
.rendering( new SkyChestRenderingCustomizer( SkyChestType.BLOCK ) ) .rendering( new SkyChestRenderingCustomizer( SkyChestType.BLOCK ) )
.build(); .build();
this.skyCompass = registry.block( "sky_compass", BlockSkyCompass::new ) this.skyCompass = registry.block( "sky_compass", BlockSkyCompass::new )
.features( AEFeature.METEORITE_COMPASS ) .features( AEFeature.METEORITE_COMPASS )
.tileEntity( TileSkyCompass.class )
.rendering( new SkyCompassRendering() ) .rendering( new SkyCompassRendering() )
.build(); .build();
this.grindstone = registry.block( "grindstone", BlockGrinder::new ).features( AEFeature.GRIND_STONE ).build(); this.grindstone = registry.block( "grindstone", BlockGrinder::new ).features( AEFeature.GRIND_STONE ).tileEntity( TileGrinder.class ).build();
this.crank = registry.block( "crank", BlockCrank::new ) this.crank = registry.block( "crank", BlockCrank::new )
.features( AEFeature.GRIND_STONE ) .features( AEFeature.GRIND_STONE )
.tileEntity( TileCrank.class )
.rendering( new CrankRendering() ) .rendering( new CrankRendering() )
.build(); .build();
this.inscriber = registry.block( "inscriber", BlockInscriber::new ) this.inscriber = registry.block( "inscriber", BlockInscriber::new )
.features( AEFeature.INSCRIBER ) .features( AEFeature.INSCRIBER )
.tileEntity( TileInscriber.class )
.rendering( new InscriberRendering() ) .rendering( new InscriberRendering() )
.build(); .build();
this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new ) this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new )
.features( AEFeature.WIRELESS_ACCESS_TERMINAL ) .features( AEFeature.WIRELESS_ACCESS_TERMINAL )
.tileEntity( TileWireless.class )
.rendering( new WirelessRendering() ) .rendering( new WirelessRendering() )
.build(); .build();
this.charger = registry.block( "charger", BlockCharger::new ) this.charger = registry.block( "charger", BlockCharger::new )
.features( AEFeature.CHARGER ) .features( AEFeature.CHARGER )
.tileEntity( TileCharger.class )
.rendering( new BlockRenderingCustomizer() .rendering( new BlockRenderingCustomizer()
{ {
@Override @Override
@@ -296,102 +338,122 @@ public final class ApiBlocks implements IBlocks
.build(); .build();
this.securityStation = registry.block( "security_station", BlockSecurityStation::new ) this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
.features( AEFeature.SECURITY ) .features( AEFeature.SECURITY )
.tileEntity( TileSecurityStation.class )
.rendering( new SecurityStationRendering() ) .rendering( new SecurityStationRendering() )
.build(); .build();
this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new ) this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new )
.features( AEFeature.QUANTUM_NETWORK_BRIDGE ) .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
.tileEntity( TileQuantumBridge.TileQuantumBridgeRing.class )
.rendering( new QuantumBridgeRendering() ) .rendering( new QuantumBridgeRendering() )
.build(); .build();
this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new ) this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new )
.features( AEFeature.QUANTUM_NETWORK_BRIDGE ) .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
.tileEntity( TileQuantumBridge.TileQuantumBridgeGlass.class )
.rendering( new QuantumBridgeRendering() ) .rendering( new QuantumBridgeRendering() )
.build(); .build();
this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new ) this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new )
.features( AEFeature.SPATIAL_IO ) .features( AEFeature.SPATIAL_IO )
.tileEntity( TileSpatialPylon.class )
.useCustomItemModel() .useCustomItemModel()
.rendering( new SpatialPylonRendering() ) .rendering( new SpatialPylonRendering() )
.build(); .build();
this.spatialIOPort = registry.block( "spatial_io_port", BlockSpatialIOPort::new ).features( AEFeature.SPATIAL_IO ).build(); this.spatialIOPort = registry.block( "spatial_io_port", BlockSpatialIOPort::new ).features( AEFeature.SPATIAL_IO ).tileEntity( TileSpatialIOPort.class ).build();
this.controller = registry.block( "controller", BlockController::new ) this.controller = registry.block( "controller", BlockController::new )
.features( AEFeature.CHANNELS ) .features( AEFeature.CHANNELS )
.tileEntity( TileController.class )
.useCustomItemModel() .useCustomItemModel()
.rendering( new ControllerRendering() ) .rendering( new ControllerRendering() )
.build(); .build();
this.drive = registry.block( "drive", BlockDrive::new ) this.drive = registry.block( "drive", BlockDrive::new )
.features( AEFeature.STORAGE_CELLS, AEFeature.ME_DRIVE ) .features( AEFeature.STORAGE_CELLS, AEFeature.ME_DRIVE )
.tileEntity( TileDrive.class )
.useCustomItemModel() .useCustomItemModel()
.rendering( new DriveRendering() ) .rendering( new DriveRendering() )
.build(); .build();
this.chest = registry.block( "chest", BlockChest::new ) this.chest = registry.block( "chest", BlockChest::new )
.features( AEFeature.STORAGE_CELLS, AEFeature.ME_CHEST ) .features( AEFeature.STORAGE_CELLS, AEFeature.ME_CHEST )
.tileEntity( TileChest.class )
.useCustomItemModel() .useCustomItemModel()
.rendering( new ChestRendering() ) .rendering( new ChestRendering() )
.build(); .build();
this.iface = registry.block( "interface", BlockInterface::new ).features( AEFeature.INTERFACE ).build(); this.iface = registry.block( "interface", BlockInterface::new ).features( AEFeature.INTERFACE ).tileEntity( TileInterface.class ).build();
this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new ).features( AEFeature.STORAGE_CELLS ).build(); this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new ).features( AEFeature.STORAGE_CELLS ).tileEntity( TileCellWorkbench.class ).build();
this.iOPort = registry.block( "io_port", BlockIOPort::new ).features( AEFeature.STORAGE_CELLS, AEFeature.IO_PORT ).build(); this.iOPort = registry.block( "io_port", BlockIOPort::new ).features( AEFeature.STORAGE_CELLS, AEFeature.IO_PORT ).tileEntity( TileIOPort.class ).build();
this.condenser = registry.block( "condenser", BlockCondenser::new ).features( AEFeature.CONDENSER ).build(); this.condenser = registry.block( "condenser", BlockCondenser::new ).features( AEFeature.CONDENSER ).tileEntity( TileCondenser.class ).build();
this.energyAcceptor = registry.block( "energy_acceptor", BlockEnergyAcceptor::new ).features( AEFeature.ENERGY_ACCEPTOR ).build(); this.energyAcceptor = registry.block( "energy_acceptor", BlockEnergyAcceptor::new ).features( AEFeature.ENERGY_ACCEPTOR ).tileEntity( TileEnergyAcceptor.class ).build();
this.vibrationChamber = registry.block( "vibration_chamber", BlockVibrationChamber::new ).features( AEFeature.POWER_GEN ).build(); this.vibrationChamber = registry.block( "vibration_chamber", BlockVibrationChamber::new ).features( AEFeature.POWER_GEN ).tileEntity( TileVibrationChamber.class ).build();
this.quartzGrowthAccelerator = registry.block( "quartz_growth_accelerator", BlockQuartzGrowthAccelerator::new ) this.quartzGrowthAccelerator = registry.block( "quartz_growth_accelerator", BlockQuartzGrowthAccelerator::new )
.tileEntity( TileQuartzGrowthAccelerator.class )
.features( AEFeature.CRYSTAL_GROWTH_ACCELERATOR ) .features( AEFeature.CRYSTAL_GROWTH_ACCELERATOR )
.build(); .build();
this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new ) this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new )
.features( AEFeature.ENERGY_CELLS ) .features( AEFeature.ENERGY_CELLS )
.item( AEBaseItemBlockChargeable::new ) .item( AEBaseItemBlockChargeable::new )
.tileEntity( TileEnergyCell.class )
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) ) .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) )
.build(); .build();
this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new ) this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new )
.features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS ) .features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS )
.item( AEBaseItemBlockChargeable::new ) .item( AEBaseItemBlockChargeable::new )
.tileEntity( TileDenseEnergyCell.class )
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) ) .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) )
.build(); .build();
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new ) this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
.features( AEFeature.CREATIVE ) .features( AEFeature.CREATIVE )
.item( AEBaseItemBlockChargeable::new ) .item( AEBaseItemBlockChargeable::new )
.tileEntity( TileCreativeEnergyCell.class )
.build(); .build();
FeatureFactory crafting = registry.features( AEFeature.CRAFTING_CPU ); FeatureFactory crafting = registry.features( AEFeature.CRAFTING_CPU );
this.craftingUnit = crafting.block( "crafting_unit", () -> new BlockCraftingUnit( CraftingUnitType.UNIT ) ) this.craftingUnit = crafting.block( "crafting_unit", () -> new BlockCraftingUnit( CraftingUnitType.UNIT ) )
.rendering( new CraftingCubeRendering( "crafting_unit", CraftingUnitType.UNIT ) ) .rendering( new CraftingCubeRendering( "crafting_unit", CraftingUnitType.UNIT ) )
.tileEntity( TileCraftingTile.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingAccelerator = crafting.block( "crafting_accelerator", () -> new BlockCraftingUnit( CraftingUnitType.ACCELERATOR ) ) this.craftingAccelerator = crafting.block( "crafting_accelerator", () -> new BlockCraftingUnit( CraftingUnitType.ACCELERATOR ) )
.rendering( new CraftingCubeRendering( "crafting_accelerator", CraftingUnitType.ACCELERATOR ) ) .rendering( new CraftingCubeRendering( "crafting_accelerator", CraftingUnitType.ACCELERATOR ) )
.tileEntity( TileCraftingTile.TileCraftingTileAccelerator.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingStorage1k = crafting.block( "crafting_storage_1k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_1K ) ) this.craftingStorage1k = crafting.block( "crafting_storage_1k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_1K ) )
.item( ItemCraftingStorage::new ) .item( ItemCraftingStorage::new )
.tileEntity( TileCraftingStorageTile.TileCraftingStorageTile1k.class )
.rendering( new CraftingCubeRendering( "crafting_storage_1k", CraftingUnitType.STORAGE_1K ) ) .rendering( new CraftingCubeRendering( "crafting_storage_1k", CraftingUnitType.STORAGE_1K ) )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingStorage4k = crafting.block( "crafting_storage_4k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_4K ) ) this.craftingStorage4k = crafting.block( "crafting_storage_4k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_4K ) )
.item( ItemCraftingStorage::new ) .item( ItemCraftingStorage::new )
.tileEntity( TileCraftingStorageTile.TileCraftingStorageTile4k.class )
.rendering( new CraftingCubeRendering( "crafting_storage_4k", CraftingUnitType.STORAGE_4K ) ) .rendering( new CraftingCubeRendering( "crafting_storage_4k", CraftingUnitType.STORAGE_4K ) )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingStorage16k = crafting.block( "crafting_storage_16k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_16K ) ) this.craftingStorage16k = crafting.block( "crafting_storage_16k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_16K ) )
.item( ItemCraftingStorage::new ) .item( ItemCraftingStorage::new )
.tileEntity( TileCraftingStorageTile.TileCraftingStorageTile16k.class )
.rendering( new CraftingCubeRendering( "crafting_storage_16k", CraftingUnitType.STORAGE_16K ) ) .rendering( new CraftingCubeRendering( "crafting_storage_16k", CraftingUnitType.STORAGE_16K ) )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingStorage64k = crafting.block( "crafting_storage_64k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_64K ) ) this.craftingStorage64k = crafting.block( "crafting_storage_64k", () -> new BlockCraftingStorage( CraftingUnitType.STORAGE_64K ) )
.item( ItemCraftingStorage::new ) .item( ItemCraftingStorage::new )
.tileEntity( TileCraftingStorageTile.TileCraftingStorageTile64k.class )
.rendering( new CraftingCubeRendering( "crafting_storage_64k", CraftingUnitType.STORAGE_64K ) ) .rendering( new CraftingCubeRendering( "crafting_storage_64k", CraftingUnitType.STORAGE_64K ) )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.craftingMonitor = crafting.block( "crafting_monitor", BlockCraftingMonitor::new ) this.craftingMonitor = crafting.block( "crafting_monitor", BlockCraftingMonitor::new )
.tileEntity( TileCraftingMonitorTile.class )
.rendering( new CraftingCubeRendering( "crafting_monitor", CraftingUnitType.MONITOR ) ) .rendering( new CraftingCubeRendering( "crafting_monitor", CraftingUnitType.MONITOR ) )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.molecularAssembler = registry.block( "molecular_assembler", BlockMolecularAssembler::new ).features( AEFeature.MOLECULAR_ASSEMBLER ).build(); this.molecularAssembler = registry.block( "molecular_assembler", BlockMolecularAssembler::new ).features( AEFeature.MOLECULAR_ASSEMBLER ).tileEntity( TileMolecularAssembler.class ).build();
this.lightDetector = registry.block( "light_detector", BlockLightDetector::new ) this.lightDetector = registry.block( "light_detector", BlockLightDetector::new )
.features( AEFeature.LIGHT_DETECTOR ) .features( AEFeature.LIGHT_DETECTOR )
.tileEntity( TileLightDetector.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.paint = registry.block( "paint", BlockPaint::new ) this.paint = registry.block( "paint", BlockPaint::new )
.features( AEFeature.PAINT_BALLS ) .features( AEFeature.PAINT_BALLS )
.tileEntity( TilePaint.class )
.rendering( new PaintRendering() ) .rendering( new PaintRendering() )
.build(); .build();
@@ -406,6 +468,7 @@ public final class ApiBlocks implements IBlocks
this.multiPart = registry.block( "cable_bus", BlockCableBus::new ) this.multiPart = registry.block( "cable_bus", BlockCableBus::new )
.rendering( new CableBusRendering( partModels ) ) .rendering( new CableBusRendering( partModels ) )
.tileEntity( TileCableBus.class )
.postInit( ( block, item ) -> .postInit( ( block, item ) ->
{ {
( (BlockCableBus) block ).setupTile(); ( (BlockCableBus) block ).setupTile();
@@ -423,18 +486,22 @@ public final class ApiBlocks implements IBlocks
this.itemGen = registry.block( "debug_item_gen", BlockItemGen::new ) this.itemGen = registry.block( "debug_item_gen", BlockItemGen::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE ) .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( TileItemGen.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.chunkLoader = registry.block( "debug_chunk_loader", BlockChunkloader::new ) this.chunkLoader = registry.block( "debug_chunk_loader", BlockChunkloader::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE ) .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( TileChunkLoader.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.phantomNode = registry.block( "debug_phantom_node", BlockPhantomNode::new ) this.phantomNode = registry.block( "debug_phantom_node", BlockPhantomNode::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE ) .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( TilePhantomNode.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
this.cubeGenerator = registry.block( "debug_cube_gen", BlockCubeGenerator::new ) this.cubeGenerator = registry.block( "debug_cube_gen", BlockCubeGenerator::new )
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE ) .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
.tileEntity( TileCubeGenerator.class )
.useCustomItemModel() .useCustomItemModel()
.build(); .build();
} }
@@ -37,7 +37,6 @@ public class BlockChunkloader extends AEBaseTileBlock implements LoadingCallback
public BlockChunkloader() public BlockChunkloader()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileChunkLoader.class );
ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance(), this ); ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance(), this );
} }
@@ -38,7 +38,6 @@ public class BlockCubeGenerator extends AEBaseTileBlock
public BlockCubeGenerator() public BlockCubeGenerator()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileCubeGenerator.class );
} }
@Override @Override
@@ -30,7 +30,6 @@ public class BlockItemGen extends AEBaseTileBlock
public BlockItemGen() public BlockItemGen()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TileItemGen.class );
} }
} }
@@ -38,7 +38,6 @@ public class BlockPhantomNode extends AEBaseTileBlock
public BlockPhantomNode() public BlockPhantomNode()
{ {
super( Material.IRON ); super( Material.IRON );
this.setTileEntity( TilePhantomNode.class );
} }
@Override @Override
@@ -32,6 +32,34 @@ public class TileCraftingStorageTile extends TileCraftingTile
{ {
private static final int KILO_SCALAR = 1024; private static final int KILO_SCALAR = 1024;
public static class TileCraftingStorageTile1k extends TileCraftingTile
{
public TileCraftingStorageTile1k() {
super();
}
}
public static class TileCraftingStorageTile4k extends TileCraftingTile
{
public TileCraftingStorageTile4k() {
super();
}
}
public static class TileCraftingStorageTile16k extends TileCraftingTile
{
public TileCraftingStorageTile16k() {
super();
}
}
public static class TileCraftingStorageTile64k extends TileCraftingTile
{
public TileCraftingStorageTile64k() {
super();
}
}
@Override @Override
protected ItemStack getItemFromTile( final Object obj ) protected ItemStack getItemFromTile( final Object obj )
{ {
@@ -60,6 +60,13 @@ import appeng.util.Platform;
public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IPowerChannelState
{ {
public static class TileCraftingTileAccelerator extends TileCraftingTile
{
public TileCraftingTileAccelerator() {
super();
}
}
private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this ); private final CraftingCPUCalculator calc = new CraftingCPUCalculator( this );
private NBTTagCompound previousState = null; private NBTTagCompound previousState = null;
private boolean isCoreBlock = false; private boolean isCoreBlock = false;
@@ -55,6 +55,21 @@ import appeng.util.Platform;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickable public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickable
{ {
public static class TileQuantumBridgeGlass extends TileQuantumBridge
{
public TileQuantumBridgeGlass() {
super();
}
}
public static class TileQuantumBridgeRing extends TileQuantumBridge
{
public TileQuantumBridgeRing() {
super();
}
}
private final byte corner = 16; private final byte corner = 16;
private final int[] sidesRing = {}; private final int[] sidesRing = {};
private final int[] sidesLink = { 0 }; private final int[] sidesLink = { 0 };
@@ -39,6 +39,20 @@ import appeng.tile.inventory.InvOperation;
public class TileSkyChest extends AEBaseInvTile implements ITickable public class TileSkyChest extends AEBaseInvTile implements ITickable
{ {
public static class Smooth extends TileSkyChest
{
public Smooth() {
super();
}
}
public static class Stone extends TileSkyChest
{
public Stone() {
super();
}
}
private final int[] sides = { private final int[] sides = {
0, 0,
1, 1,
-20
View File
@@ -1821,24 +1821,4 @@ public class Platform
return isPurified; return isPurified;
} }
/**
* Added because the internal Forge GameRegistry method changed a bit
* @param tileEntityClass
* @param id
* @param alternatives
*/
public static void registerTileEntityWithAlternatives(Class<? extends TileEntity> tileEntityClass, String id, String... alternatives)
{
ResourceLocation rloc = GameData.getTileEntityRegistry().getNameForObject(tileEntityClass);
/**
* If there's no mention of said TE in the registry, add it, otherwise add the aliases.
*/
if(rloc == null) {
GameRegistry.registerTileEntityWithAlternatives( tileEntityClass, AppEng.MOD_ID.toLowerCase() + ":" + id, id );
} else {
GameData.getTileEntityRegistry().addLegacyName(new ResourceLocation(id), new ResourceLocation(AppEng.MOD_ID.toLowerCase() + ":" + id));
}
}
} }