Major Refactoring of Bootstrap Code (#75)
- Refactored boostrap code: * Completely reworked item/block/tile registration. * Fixed server side startup. * Fixed server side startup. * More documentation. * More heavy cleanup * More cleanups. * Major refactoring of state mapping and fixes a lot of other issue related to item rendering. * Fixes sky chest item models (no item TESR). * Only use CachingRotatingBakedModel for tile entities automatically. Fix default rotation of quartz pillar for item model. * Used method reference instead of lambda for ItemMeshDefinition for multiparts. * Removed unnecessary IHasSpecialItemModel * Removed unused IconReg class. * Updated resource pack version.
This commit is contained in:
committed by
Sebastian Hartte
parent
66df324ef0
commit
6f2bbfab4c
@@ -20,21 +20,16 @@ package appeng.block;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -53,27 +48,19 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.core.features.AEBlockFeatureHandler;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.FeatureNameExtractor;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
public abstract class AEBaseBlock extends Block
|
||||
{
|
||||
|
||||
private final String featureFullName;
|
||||
private final Optional<String> featureSubName;
|
||||
private boolean isOpaque = true;
|
||||
private boolean isFullSize = true;
|
||||
private boolean hasSubtypes = false;
|
||||
private boolean isInventory = false;
|
||||
private IFeatureHandler handler;
|
||||
|
||||
protected AxisAlignedBB boundingBox = FULL_BLOCK_AABB;
|
||||
|
||||
@@ -84,15 +71,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
}
|
||||
|
||||
protected AEBaseBlock( final Material mat )
|
||||
{
|
||||
this( mat, Optional.<String>absent() );
|
||||
this.setLightOpacity( 255 );
|
||||
this.setLightLevel( 0 );
|
||||
this.setHardness( 2.2F );
|
||||
this.setHarvestLevel( "pickaxe", 0 );
|
||||
}
|
||||
|
||||
protected AEBaseBlock( final Material mat, final Optional<String> subName )
|
||||
{
|
||||
super( mat );
|
||||
|
||||
@@ -113,14 +91,17 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
this.setSoundType( SoundType.METAL );
|
||||
}
|
||||
|
||||
this.featureFullName = new FeatureNameExtractor( this.getClass(), subName ).get();
|
||||
this.featureSubName = subName;
|
||||
this.setLightOpacity( 255 );
|
||||
this.setLightLevel( 0 );
|
||||
this.setHardness( 2.2F );
|
||||
this.setHarvestLevel( "pickaxe", 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.featureFullName;
|
||||
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
|
||||
return getClass().getSimpleName() + "[" + regName + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,29 +115,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
return new IProperty[0];
|
||||
}
|
||||
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AEBlockFeatureHandler featureHandler = new AEBlockFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IFeatureHandler handler()
|
||||
{
|
||||
return this.handler;
|
||||
}
|
||||
|
||||
protected final void setHandler( final IFeatureHandler handler )
|
||||
{
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// override!
|
||||
}
|
||||
|
||||
public boolean isOpaque()
|
||||
{
|
||||
return this.isOpaque;
|
||||
@@ -379,7 +337,8 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
{
|
||||
if( this instanceof IOrientableBlock )
|
||||
{
|
||||
return ( (IOrientableBlock) this ).getOrientable( w, pos );
|
||||
IOrientableBlock orientable = (IOrientableBlock) this;
|
||||
return orientable.getOrientable( w, pos );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -445,12 +404,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
super.getSubBlocks( item, tabs, itemStacks );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void setRenderStateByMeta( final int itemDamage )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public String getUnlocalizedName( final ItemStack is )
|
||||
{
|
||||
return this.getUnlocalizedName();
|
||||
@@ -461,11 +414,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
|
||||
}
|
||||
|
||||
public Class<? extends AEBaseItemBlock> getItemBlockClass()
|
||||
{
|
||||
return AEBaseItemBlock.class;
|
||||
}
|
||||
|
||||
public boolean hasSubtypes()
|
||||
{
|
||||
return this.hasSubtypes;
|
||||
@@ -553,11 +501,6 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
public Optional<String> getFeatureSubName()
|
||||
{
|
||||
return this.featureSubName;
|
||||
}
|
||||
|
||||
public boolean isInventory()
|
||||
{
|
||||
return this.isInventory;
|
||||
@@ -573,15 +516,4 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
this.hasSubtypes = hasSubtypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the item mesh definition that should be used to determine the item model of an item stack,
|
||||
* instead of the default model. Return null if your Block doesn't use a custom ItemMeshDefinition (the default).
|
||||
* The returned ItemMeshDefinition will automatically be registered with the ItemModelMesher during the registration of the block.
|
||||
*/
|
||||
@SideOnly( Side.CLIENT )
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,25 +19,16 @@
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStairs;
|
||||
|
||||
import appeng.core.features.AEBlockFeatureHandler;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.core.features.IFeatureHandler;
|
||||
|
||||
|
||||
public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature, IHasSpecialItemModel
|
||||
public abstract class AEBaseStairBlock extends BlockStairs
|
||||
{
|
||||
private final IFeatureHandler features;
|
||||
|
||||
protected AEBaseStairBlock( final Block block, final EnumSet<AEFeature> features, final String type )
|
||||
protected AEBaseStairBlock( final Block block, final String type )
|
||||
{
|
||||
super( block.getDefaultState() );
|
||||
|
||||
@@ -45,21 +36,15 @@ public abstract class AEBaseStairBlock extends BlockStairs implements IAEFeature
|
||||
Preconditions.checkNotNull( block.getUnlocalizedName() );
|
||||
Preconditions.checkArgument( block.getUnlocalizedName().length() > 0 );
|
||||
|
||||
this.features = new AEBlockFeatureHandler( features, this, Optional.of( type ) );
|
||||
|
||||
this.setUnlocalizedName( "stair." + type );
|
||||
this.setLightOpacity( 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFeatureHandler handler()
|
||||
public String toString()
|
||||
{
|
||||
return this.features;
|
||||
String regName = getRegistryName() != null ? getRegistryName().getResourcePath() : "unregistered";
|
||||
return getClass().getSimpleName() + "[" + regName + "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
// Override to do stuff
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,22 +20,17 @@ package appeng.block;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
@@ -49,8 +44,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
@@ -58,9 +54,6 @@ import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AETileBlockFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
@@ -69,7 +62,7 @@ import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
|
||||
|
||||
public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature, ITileEntityProvider
|
||||
public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntityProvider
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
@@ -80,25 +73,35 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
super( mat );
|
||||
}
|
||||
|
||||
protected AEBaseTileBlock( final Material mat, final Optional<String> subName )
|
||||
{
|
||||
super( mat, subName );
|
||||
}
|
||||
|
||||
public static final PropertyDirection AE_BLOCK_FORWARD = PropertyDirection.create( "forward" );
|
||||
public static final PropertyDirection AE_BLOCK_UP = PropertyDirection.create( "up" );
|
||||
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP };
|
||||
// A subclass may decide it doesn't want extended block state for whatever reason
|
||||
if( !( state instanceof IExtendedBlockState ) )
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
AEBaseTile tile = getTileEntity( world, pos );
|
||||
if( tile == null )
|
||||
{
|
||||
return state; // No info available
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
AEBaseTile tile = (AEBaseTile) world.getTileEntity( pos );
|
||||
return super.getActualState( state, world, pos ).withProperty( AE_BLOCK_FORWARD, tile.getForward() ).withProperty( AE_BLOCK_UP, tile.getUp() );
|
||||
return new ExtendedBlockState( this, getAEStates(), new IUnlistedProperty[] {
|
||||
FORWARD,
|
||||
UP
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,24 +110,6 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public TileEntitySpecialRenderer<? extends AEBaseTile> getTESR()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean hasItemTESR()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AETileBlockFeatureHandler featureHandler = new AETileBlockFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
protected void setTileEntity( final Class<? extends AEBaseTile> c )
|
||||
{
|
||||
this.tileEntityType = c;
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
package appeng.block;
|
||||
|
||||
|
||||
public interface IHasSpecialItemModel
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public class UnlistedDirection implements IUnlistedProperty<EnumFacing>
|
||||
{
|
||||
|
||||
private final String name;
|
||||
|
||||
public UnlistedDirection( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( EnumFacing value )
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<EnumFacing> getType()
|
||||
{
|
||||
return EnumFacing.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( EnumFacing value )
|
||||
{
|
||||
return value.getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,10 +31,4 @@ public class BlockCraftingStorage extends BlockCraftingUnit
|
||||
this.setTileEntity( TileCraftingStorageTile.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<ItemCraftingStorage> getItemBlockClass()
|
||||
{
|
||||
return ItemCraftingStorage.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,41 +19,28 @@
|
||||
package appeng.block.crafting;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
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.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
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.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
{
|
||||
public static final PropertyBool POWERED = PropertyBool.create( "powered" );
|
||||
@@ -63,17 +50,16 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
|
||||
public BlockCraftingUnit( final CraftingUnitType type )
|
||||
{
|
||||
super( Material.IRON, Optional.of( type.name() ) );
|
||||
super( Material.IRON );
|
||||
|
||||
this.type = type;
|
||||
this.setTileEntity( TileCraftingTile.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.CraftingCPU ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, POWERED, FORMED };
|
||||
return new IProperty[] { POWERED, FORMED };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.crafting;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -35,12 +33,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -51,7 +47,6 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
|
||||
this.setTileEntity( TileMolecularAssembler.class );
|
||||
this.setOpaque( false );
|
||||
this.lightOpacity = 1;
|
||||
this.setFeature( EnumSet.of( AEFeature.MolecularAssembler ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.grindstone;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -38,12 +36,10 @@ import net.minecraftforge.common.util.FakePlayer;
|
||||
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.stats.Stats;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
|
||||
|
||||
public class BlockCrank extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -55,7 +51,6 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
this.setLightOpacity( 0 );
|
||||
this.setHarvestLevel( "axe", 0 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.GrindStone ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.grindstone;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,12 +31,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockGrinder extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -48,7 +44,6 @@ public class BlockGrinder extends AEBaseTileBlock
|
||||
|
||||
this.setTileEntity( TileGrinder.class );
|
||||
this.setHardness( 3.2F );
|
||||
this.setFeature( EnumSet.of( AEFeature.GrindStone ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,12 +31,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -47,7 +43,6 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileCellWorkbench.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,19 +20,17 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.lwjgl.util.vector.Matrix4f;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -53,7 +51,6 @@ import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
@@ -70,7 +67,6 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setTileEntity( TileCharger.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,13 +126,6 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public TileEntitySpecialRenderer<TileCharger> getTESR()
|
||||
{
|
||||
return new ModularTESR( new ItemRenderable<TileCharger>( tile -> new ImmutablePair( tile.getStackInSlot( 0 ), new Matrix4f().translate( new Vector3f( 0.5f, 0.4f, 0.5f ) ) ) ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
@@ -198,4 +187,10 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public static TileEntitySpecialRenderer<TileCharger> createTesr()
|
||||
{
|
||||
return new ModularTESR<>( new ItemRenderable<TileCharger>( tile -> new ImmutablePair<>( tile.getStackInSlot( 0 ), new Matrix4f().translate( new Vector3f( 0.5f, 0.4f, 0.5f ) ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,7 +31,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
@@ -47,7 +44,6 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileCondenser.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -33,12 +31,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockInscriber extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -49,7 +45,6 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
this.setTileEntity( TileInscriber.class );
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.Inscriber ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -37,12 +36,10 @@ import net.minecraft.world.World;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -53,7 +50,6 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileInterface.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,14 +20,11 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -36,15 +33,11 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
|
||||
|
||||
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
@@ -57,13 +50,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
this.setOpaque( false );
|
||||
|
||||
this.setTileEntity( TileLightDetector.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.LightDetector ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -39,11 +38,9 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockPaint extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -55,7 +52,6 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
@@ -32,12 +31,13 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
import appeng.util.Platform;
|
||||
|
||||
@@ -52,7 +52,6 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
super( Material.ROCK );
|
||||
this.setSoundType( SoundType.METAL );
|
||||
this.setTileEntity( TileQuartzGrowthAccelerator.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
this.setDefaultState( getDefaultState().withProperty( POWERED, false ) );
|
||||
}
|
||||
|
||||
@@ -69,9 +68,10 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, POWERED };
|
||||
return new IProperty[] { POWERED };
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public void randomDisplayTick( final IBlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -47,11 +46,9 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
|
||||
|
||||
public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, ICustomCollision
|
||||
{
|
||||
|
||||
@@ -66,7 +63,6 @@ public class BlockQuartzTorch extends AEBaseBlock implements IOrientableBlock, I
|
||||
super( Material.CIRCUITS );
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().withProperty( FACING, EnumFacing.UP ).withProperty( ODD, false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.DecorativeLights ) );
|
||||
this.setLightLevel( 0.9375F );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -34,12 +32,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSecurity extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -48,7 +44,6 @@ public class BlockSecurity extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
|
||||
this.setTileEntity( TileSecurity.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Security ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -33,11 +32,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
|
||||
|
||||
public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
@@ -47,7 +44,6 @@ public class BlockSkyCompass extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setTileEntity( TileSkyCompass.class );
|
||||
this.setOpaque( this.setFullSize( false ) );
|
||||
this.lightOpacity = 0;
|
||||
this.setFeature( EnumSet.of( AEFeature.MeteoriteCompass ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,13 +20,10 @@ package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -36,7 +33,6 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -49,12 +45,9 @@ import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.entity.EntityIds;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
|
||||
|
||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
@@ -67,18 +60,10 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setSoundType( SoundType.GROUND );
|
||||
this.setHardness( 0F );
|
||||
this.setFeature( EnumSet.of( AEFeature.TinyTNT ) );
|
||||
|
||||
EntityRegistry.registerModEntity( EntityTinyTNTPrimed.class, "EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
super.postInit();
|
||||
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject( Item.getItemFromBlock( this ), new DispenserBehaviorTinyTNT() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Random;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -39,13 +38,11 @@ import net.minecraft.world.World;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -57,7 +54,6 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileVibrationChamber.class );
|
||||
this.setHardness( 4.2F );
|
||||
this.setFeature( EnumSet.of( AEFeature.PowerGen ) );
|
||||
this.setDefaultState( getDefaultState().withProperty( ACTIVE, false ) );
|
||||
}
|
||||
|
||||
@@ -74,7 +70,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[]{ AE_BLOCK_FORWARD, AE_BLOCK_UP, ACTIVE };
|
||||
return new IProperty[]{ ACTIVE };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -22,7 +22,6 @@ package appeng.block.networking;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -60,7 +59,6 @@ import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.features.AECableBusFeatureHandler;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
@@ -88,7 +86,6 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
// this will actually be overwritten later through setupTile and the
|
||||
// combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
public static final CableBusContainerUnlistedProperty cableBus = new CableBusContainerUnlistedProperty();
|
||||
@@ -96,19 +93,14 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { cableBus } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return state;
|
||||
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { FORWARD, UP, cableBus } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
return ( (IExtendedBlockState) state ).withProperty( cableBus, ( (TileCableBus) world.getTileEntity( pos ) ).getCableBus() );
|
||||
return ( (IExtendedBlockState) super.getExtendedState( state, world, pos ) )
|
||||
.withProperty( cableBus, ( (TileCableBus) world.getTileEntity( pos ) ).getCableBus() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -359,13 +351,6 @@ public class BlockCableBus extends AEBaseTileBlock
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
final AECableBusFeatureHandler featureHandler = new AECableBusFeatureHandler( f, this, this.getFeatureSubName() );
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
public void setupTile()
|
||||
{
|
||||
noTesrTile = Api.INSTANCE.partHelper().getCombinedInstance( TileCableBus.class.getName() );
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
@@ -32,12 +30,11 @@ import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
|
||||
public class BlockController extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -77,7 +74,7 @@ public class BlockController extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, CONTROLLER_STATE, CONTROLLER_TYPE };
|
||||
return new IProperty[] { CONTROLLER_STATE, CONTROLLER_TYPE };
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,8 +87,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
// Only used for columns, really
|
||||
EnumFacing up = EnumFacing.UP;
|
||||
EnumFacing forward = EnumFacing.NORTH;
|
||||
ControllerRenderType type = ControllerRenderType.block;
|
||||
|
||||
int x = pos.getX();
|
||||
@@ -105,20 +100,14 @@ public class BlockController extends AEBaseTileBlock
|
||||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
up = EnumFacing.EAST;
|
||||
forward = EnumFacing.UP;
|
||||
type = ControllerRenderType.column;
|
||||
}
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
up = EnumFacing.UP;
|
||||
forward = EnumFacing.NORTH;
|
||||
type = ControllerRenderType.column;
|
||||
}
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
up = EnumFacing.NORTH;
|
||||
forward = EnumFacing.UP;
|
||||
type = ControllerRenderType.column;
|
||||
}
|
||||
else if( ( xx ? 1 : 0 ) + ( yy ? 1 : 0 ) + ( zz ? 1 : 0 ) >= 2 )
|
||||
@@ -137,7 +126,43 @@ public class BlockController extends AEBaseTileBlock
|
||||
}
|
||||
}
|
||||
|
||||
return state.withProperty( AE_BLOCK_FORWARD, forward ).withProperty( AE_BLOCK_UP, up ).withProperty( CONTROLLER_TYPE, type );
|
||||
return state.withProperty( CONTROLLER_TYPE, type );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
// Only used for columns, really
|
||||
EnumFacing up = EnumFacing.UP;
|
||||
EnumFacing forward = EnumFacing.NORTH;
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
|
||||
// Detect whether controllers are on both sides of the x, y, and z axes
|
||||
final boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y, z ) instanceof TileController;
|
||||
final boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1, z ) instanceof TileController;
|
||||
final boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y, z + 1 ) instanceof TileController;
|
||||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
up = EnumFacing.EAST;
|
||||
forward = EnumFacing.UP;
|
||||
}
|
||||
else if( !xx && yy && !zz )
|
||||
{
|
||||
up = EnumFacing.UP;
|
||||
forward = EnumFacing.NORTH;
|
||||
}
|
||||
else if( !xx && !yy && zz )
|
||||
{
|
||||
up = EnumFacing.NORTH;
|
||||
forward = EnumFacing.UP;
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.withProperty( FORWARD, forward ).withProperty( UP, up );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -164,7 +189,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileController.class );
|
||||
this.setHardness( 6 );
|
||||
this.setFeature( EnumSet.of( AEFeature.Channels ) );
|
||||
this.setDefaultState( getDefaultState().withProperty( CONTROLLER_STATE, ControllerBlockState.offline ).withProperty( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,10 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileCreativeEnergyCell;
|
||||
|
||||
|
||||
public class BlockCreativeEnergyCell extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -34,6 +30,5 @@ public class BlockCreativeEnergyCell extends AEBaseTileBlock
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setTileEntity( TileCreativeEnergyCell.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Creative ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,19 +19,14 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileDenseEnergyCell;
|
||||
|
||||
|
||||
public class BlockDenseEnergyCell extends BlockEnergyCell
|
||||
{
|
||||
|
||||
public BlockDenseEnergyCell()
|
||||
{
|
||||
this.setTileEntity( TileDenseEnergyCell.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.DenseEnergyCells ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,12 +19,9 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.tile.networking.TileEnergyAcceptor;
|
||||
|
||||
|
||||
@@ -35,6 +32,5 @@ public class BlockEnergyAcceptor extends AEBaseTileBlock
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileEnergyAcceptor.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,14 +19,11 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -34,11 +31,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.block.AEBaseItemBlockChargeable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
import appeng.util.Platform;
|
||||
@@ -66,7 +59,6 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
|
||||
this.setTileEntity( TileEnergyCell.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,48 +83,7 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, ENERGY_STORAGE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends AEBaseItemBlock> getItemBlockClass()
|
||||
{
|
||||
return AEBaseItemBlockChargeable.class;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
|
||||
* Returns 0 if the item stack has no fill factor.
|
||||
*/
|
||||
private static double getFillFactor( ItemStack is ) {
|
||||
if( !( is.getItem() instanceof IAEItemPowerStorage ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
|
||||
double curPower = itemChargeable.getAECurrentPower( is );
|
||||
double maxPower = itemChargeable.getAEMaxPower( is );
|
||||
|
||||
return curPower / maxPower;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines which version of the energy cell model should be used depending on the fill factor
|
||||
* of the item stack.
|
||||
*/
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public ItemMeshDefinition getItemMeshDefinition()
|
||||
{
|
||||
return is -> {
|
||||
double fillFactor = getFillFactor( is );
|
||||
|
||||
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor(fillFactor);
|
||||
|
||||
return new ModelResourceLocation( "appliedenergistics2:tile.BlockEnergyCell", "fullness=" + storageLevel );
|
||||
|
||||
};
|
||||
return new IProperty[] { ENERGY_STORAGE };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.block.AEBaseItemBlockChargeable;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
|
||||
|
||||
public class BlockEnergyCellRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
|
||||
private final ResourceLocation baseModel;
|
||||
|
||||
public BlockEnergyCellRendering( ResourceLocation baseModel )
|
||||
{
|
||||
this.baseModel = baseModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
itemRendering.meshDefinition( this::getItemModel );
|
||||
// Note: Since we use the block models, we dont need to register custom variants
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines which version of the energy cell model should be used depending on the fill factor
|
||||
* of the item stack.
|
||||
*/
|
||||
private ModelResourceLocation getItemModel( ItemStack is )
|
||||
{
|
||||
double fillFactor = getFillFactor( is );
|
||||
|
||||
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor( fillFactor );
|
||||
return new ModelResourceLocation( baseModel, "fullness=" + storageLevel );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
|
||||
* Returns 0 if the item stack has no fill factor.
|
||||
*/
|
||||
private static double getFillFactor( ItemStack is )
|
||||
{
|
||||
if( !( is.getItem() instanceof IAEItemPowerStorage ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
AEBaseItemBlockChargeable itemChargeable = (AEBaseItemBlockChargeable) is.getItem();
|
||||
double curPower = itemChargeable.getAECurrentPower( is );
|
||||
double maxPower = itemChargeable.getAEMaxPower( is );
|
||||
|
||||
return curPower / maxPower;
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,7 @@ package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -38,14 +36,12 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
@@ -56,7 +52,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.WirelessAccessTerminal ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.parts.CableBusContainer;
|
||||
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
public class CableBusColor implements IBlockColor
|
||||
{
|
||||
|
||||
@Override
|
||||
public int colorMultiplier( IBlockState state, IBlockAccess worldIn, BlockPos pos, int color )
|
||||
{
|
||||
AEPartLocation side = AEPartLocation.fromOrdinal( ( color >> 2 ) & 7 );
|
||||
CableBusContainer bus = ( (IExtendedBlockState) state ).getValue( BlockCableBus.cableBus );
|
||||
switch( color & 3 )
|
||||
{
|
||||
case 0:
|
||||
return bus.getGridNode( side ) != null && bus.getGridNode( side ).isActive() ? 0xffffff : 0;
|
||||
case 1:
|
||||
return bus.getColor().blackVariant;
|
||||
case 2:
|
||||
return bus.getColor().mediumVariant;
|
||||
case 3:
|
||||
return bus.getColor().whiteVariant;
|
||||
default:
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
|
||||
import appeng.api.client.BakingPipeline;
|
||||
import appeng.client.render.model.pipeline.BakingPipelineBakedModel;
|
||||
import appeng.client.render.model.pipeline.FacingQuadRotator;
|
||||
import appeng.client.render.model.pipeline.Merge;
|
||||
import appeng.client.render.model.pipeline.TintIndexModifier;
|
||||
import appeng.client.render.model.pipeline.TypeTransformer;
|
||||
import appeng.client.render.model.pipeline.cable.CableAndConnections;
|
||||
import appeng.client.render.model.pipeline.cable.Facades;
|
||||
import appeng.client.render.model.pipeline.cable.Parts;
|
||||
|
||||
|
||||
public class CableModelCustomizer
|
||||
{
|
||||
|
||||
private final BakingPipeline rotatingPipeline = new BakingPipeline( TypeTransformer.quads2vecs, new FacingQuadRotator(), TypeTransformer.vecs2quads );
|
||||
private final TintIndexModifier tintIndexModifier = new TintIndexModifier( tint -> tint );
|
||||
private final BakingPipeline tintIndexFixPipeline = new BakingPipeline( TypeTransformer.quads2vecs, tintIndexModifier, TypeTransformer.vecs2quads );
|
||||
|
||||
public IBakedModel customizeModel( ModelResourceLocation location, IBakedModel model )
|
||||
{
|
||||
return new BakingPipelineBakedModel( model, new Merge( new CableAndConnections( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ), new Facades( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ), new Parts( rotatingPipeline, tintIndexModifier, tintIndexFixPipeline ) ) );
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.qnb;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
@@ -30,11 +28,9 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
|
||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
@@ -46,7 +42,6 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setFeature( EnumSet.of( AEFeature.QuantumNetworkBridge ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ package appeng.block.spatial;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -38,10 +37,8 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
|
||||
|
||||
public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
@@ -52,7 +49,6 @@ public class BlockMatrixFrame extends AEBaseBlock implements ICustomCollision
|
||||
this.setBlockUnbreakable();
|
||||
this.setLightOpacity( 0 );
|
||||
this.setOpaque( false );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.spatial;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -35,12 +33,10 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -48,7 +44,6 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileSpatialIOPort.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.spatial;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -28,11 +26,9 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
|
||||
public class BlockSpatialPylon extends AEBaseTileBlock
|
||||
{
|
||||
|
||||
@@ -40,7 +36,6 @@ public class BlockSpatialPylon extends AEBaseTileBlock
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setTileEntity( TileSpatialPylon.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.SpatialIO ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -36,7 +34,6 @@ import appeng.api.AEApi;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileChest;
|
||||
@@ -50,7 +47,6 @@ public class BlockChest extends AEBaseTileBlock
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileChest.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEChest ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -34,7 +32,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
@@ -47,7 +44,6 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileDrive.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.MEDrive ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -35,7 +33,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
@@ -48,7 +45,6 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setTileEntity( TileIOPort.class );
|
||||
this.setFeature( EnumSet.of( AEFeature.StorageCells, AEFeature.IOPort ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,16 +20,11 @@ package appeng.block.storage;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -39,24 +34,19 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.IHasSpecialItemModel;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision, IHasSpecialItemModel
|
||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
public static enum SkyChestType
|
||||
public enum SkyChestType
|
||||
{
|
||||
STONE, BLOCK
|
||||
};
|
||||
@@ -65,7 +55,7 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
|
||||
|
||||
public BlockSkyChest( final SkyChestType type )
|
||||
{
|
||||
super( Material.ROCK, Optional.of( type.name() ) );
|
||||
super( Material.ROCK );
|
||||
this.setTileEntity( TileSkyChest.class );
|
||||
this.setOpaque( this.setFullSize( false ) );
|
||||
this.lightOpacity = 0;
|
||||
@@ -73,7 +63,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
|
||||
this.setHardness( 50 );
|
||||
this.blockResistance = 150.0f;
|
||||
this.type = type;
|
||||
this.setFeature( EnumSet.of( AEFeature.Core, AEFeature.SkyStoneChests ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,20 +70,8 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision,
|
||||
{
|
||||
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public TileEntitySpecialRenderer<TileSkyChest> getTESR()
|
||||
{
|
||||
return new SkyChestTESR();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasItemTESR()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
|
||||
|
||||
public class SkyChestRenderingCustomizer extends BlockRenderingCustomizer
|
||||
{
|
||||
|
||||
private final BlockSkyChest.SkyChestType type;
|
||||
|
||||
public SkyChestRenderingCustomizer( BlockSkyChest.SkyChestType type )
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@SideOnly( Side.CLIENT )
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.tesr( new SkyChestTESR() );
|
||||
|
||||
// Register a custom non-tesr item model
|
||||
String modelName = getModelFromType();
|
||||
itemRendering.model( new ModelResourceLocation( "appliedenergistics2:" + modelName, "inventory" ) );
|
||||
}
|
||||
|
||||
private String getModelFromType()
|
||||
{
|
||||
final String modelName;
|
||||
switch( type )
|
||||
{
|
||||
default:
|
||||
case STONE:
|
||||
modelName = "sky_chest_stone";
|
||||
break;
|
||||
case BLOCK:
|
||||
modelName = "sky_chest_block";
|
||||
break;
|
||||
}
|
||||
return modelName;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user