Passing rotations to models
Implemented passing of rotations to models. Removed unused unlisted properties. Included dummy grinder model. Found bugs that have to be fixed. Referencing #10.
This commit is contained in:
@@ -128,19 +128,10 @@ public abstract class AEBaseBlock extends Block implements IAEFeature
|
||||
return this.featureFullName;
|
||||
}
|
||||
|
||||
public static final UnlistedBlockPos AE_BLOCK_POS = new UnlistedBlockPos();
|
||||
public static final UnlistedBlockAccess AE_BLOCK_ACCESS = new UnlistedBlockAccess();
|
||||
|
||||
@Override
|
||||
protected final BlockStateContainer createBlockState()
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { AE_BLOCK_POS, AE_BLOCK_ACCESS } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IBlockState getExtendedState( final IBlockState state, final IBlockAccess world, final BlockPos pos )
|
||||
{
|
||||
return ( (IExtendedBlockState) super.getExtendedState( state, world, pos ) ).withProperty( AE_BLOCK_POS, pos ).withProperty( AE_BLOCK_ACCESS, world );
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {} );
|
||||
}
|
||||
|
||||
protected IProperty[] getAEStates()
|
||||
|
||||
@@ -32,6 +32,9 @@ 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.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -46,6 +49,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.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
@@ -69,7 +75,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
{
|
||||
|
||||
@Nonnull
|
||||
private Class<? extends TileEntity> tileEntityType;
|
||||
private Class<? extends AEBaseTile> tileEntityType;
|
||||
|
||||
public AEBaseTileBlock( final Material mat )
|
||||
{
|
||||
@@ -80,7 +86,29 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
{
|
||||
super( mat, subName );
|
||||
}
|
||||
|
||||
|
||||
public static final PropertyDirection AE_BLOCK_FORWARD = PropertyDirection.create( "forward" );
|
||||
public static final PropertyDirection AE_BLOCK_UP = PropertyDirection.create( "up" );
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP };
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||
{
|
||||
AEBaseTile tile = (AEBaseTile) world.getTileEntity( pos );
|
||||
return super.getActualState( state, world, pos ).withProperty( AE_BLOCK_FORWARD, tile.getForward()).withProperty( AE_BLOCK_UP, tile.getUp() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( IBlockState state )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setFeature( final EnumSet<AEFeature> f )
|
||||
{
|
||||
@@ -88,7 +116,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements IAEFeature,
|
||||
this.setHandler( featureHandler );
|
||||
}
|
||||
|
||||
protected void setTileEntity( final Class<? extends TileEntity> c )
|
||||
protected void setTileEntity( final Class<? extends AEBaseTile> c )
|
||||
{
|
||||
this.tileEntityType = c;
|
||||
this.setInventory( IInventory.class.isAssignableFrom( c ) );
|
||||
|
||||
@@ -138,7 +138,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { POWERED, FORMED };
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, POWERED, FORMED };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -75,7 +75,8 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { BlockTorch.FACING };
|
||||
//TODO 1.10-R - wtf?
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, BlockTorch.FACING };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -78,8 +78,8 @@ public class BlockCableBus extends AEBaseTileBlock // implements
|
||||
{
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
private static Class<? extends TileEntity> noTesrTile;
|
||||
private static Class<? extends TileEntity> tesrTile;
|
||||
private static Class<? extends AEBaseTile> noTesrTile;
|
||||
private static Class<? extends AEBaseTile> tesrTile;
|
||||
|
||||
/**
|
||||
* Immibis MB Support.
|
||||
@@ -390,12 +390,12 @@ public class BlockCableBus extends AEBaseTileBlock // implements
|
||||
}
|
||||
}
|
||||
|
||||
public static Class<? extends TileEntity> getTesrTile()
|
||||
public static Class<? extends AEBaseTile> getTesrTile()
|
||||
{
|
||||
return tesrTile;
|
||||
}
|
||||
|
||||
public static Class<? extends TileEntity> getNoTesrTile()
|
||||
public static Class<? extends AEBaseTile> getNoTesrTile()
|
||||
{
|
||||
return noTesrTile;
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class BlockController extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { CONTROLLER_STATE };
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, CONTROLLER_STATE };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -88,7 +88,7 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { ENERGY_STORAGE };
|
||||
return new IProperty[] { AE_BLOCK_FORWARD, AE_BLOCK_UP, ENERGY_STORAGE };
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -62,7 +62,8 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
//TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all Block#onItemUseFirst overrides.
|
||||
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
if( b.rotateBlock( world, pos, side ) )
|
||||
|
||||
Reference in New Issue
Block a user