Source formatting
Imported my usual settings and applied them
This commit is contained in:
parent
4e3a03d04a
commit
830693a060
6 changed files with 293 additions and 204 deletions
|
@ -1,5 +1,6 @@
|
||||||
package mmm;
|
package mmm;
|
||||||
|
|
||||||
|
|
||||||
import mmm.deco.DecorativeBlocks;
|
import mmm.deco.DecorativeBlocks;
|
||||||
import mmm.utils.URegistration;
|
import mmm.utils.URegistration;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
@ -8,51 +9,67 @@ import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
|
||||||
@Mod(modid = Mmm.ID, name = Mmm.NAME, version = Mmm.VERSION)
|
|
||||||
public class Mmm {
|
|
||||||
|
@Mod( modid = Mmm.ID , name = Mmm.NAME , version = Mmm.VERSION )
|
||||||
|
public class Mmm
|
||||||
|
{
|
||||||
|
|
||||||
public static final String ID = "mmm";
|
public static final String ID = "mmm";
|
||||||
public static final String NAME = "MMM!";
|
public static final String NAME = "MMM!";
|
||||||
public static final String VERSION = "0.1-1.9.4";
|
public static final String VERSION = "0.1-1.9.4";
|
||||||
public static final String PREFIX = ID + ".";
|
public static final String PREFIX = Mmm.ID + ".";
|
||||||
|
|
||||||
@SidedProxy
|
@SidedProxy
|
||||||
public static CommonProxy proxy = null;
|
public static CommonProxy proxy = null;
|
||||||
|
|
||||||
public static abstract class CommonProxy {
|
public static abstract class CommonProxy
|
||||||
|
{
|
||||||
|
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit( final FMLPreInitializationEvent event )
|
||||||
DecorativeBlocks.preInit();
|
{
|
||||||
URegistration.registerRecipes();
|
DecorativeBlocks.preInit( );
|
||||||
|
URegistration.registerRecipes( );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FMLInitializationEvent event) {
|
|
||||||
|
public void init( final FMLInitializationEvent event )
|
||||||
|
{
|
||||||
// EMPTY
|
// EMPTY
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ServerProxy extends CommonProxy {
|
public static class ServerProxy
|
||||||
|
extends CommonProxy
|
||||||
|
{
|
||||||
|
// EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class ClientProxy extends CommonProxy {
|
public static class ClientProxy
|
||||||
|
extends CommonProxy
|
||||||
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit( final FMLPreInitializationEvent event )
|
||||||
super.preInit(event);
|
{
|
||||||
URegistration.setupItemModels();
|
super.preInit( event );
|
||||||
|
URegistration.setupItemModels( );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void preInit(FMLPreInitializationEvent event) {
|
public void preInit( final FMLPreInitializationEvent event )
|
||||||
proxy.preInit(event);
|
{
|
||||||
|
Mmm.proxy.preInit( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init( final FMLInitializationEvent event )
|
||||||
proxy.init(event);
|
{
|
||||||
|
Mmm.proxy.init( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mmm.deco;
|
package mmm.deco;
|
||||||
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import mmm.Mmm;
|
import mmm.Mmm;
|
||||||
|
@ -31,71 +32,81 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class DBlockTable extends Block implements I_URecipeRegistrar {
|
|
||||||
|
|
||||||
|
public class DBlockTable
|
||||||
|
extends Block
|
||||||
|
implements I_URecipeRegistrar
|
||||||
|
{
|
||||||
|
|
||||||
public final static String ID = "deco_table_";
|
public final static String ID = "deco_table_";
|
||||||
public final static String NAME = Mmm.PREFIX + ID;
|
public final static String NAME = Mmm.PREFIX + DBlockTable.ID;
|
||||||
|
|
||||||
public static enum E_WoodType {
|
public static enum E_WoodType {
|
||||||
OAK("oak", BlockPlanks.EnumType.OAK), //
|
OAK( "oak" , BlockPlanks.EnumType.OAK ) , //
|
||||||
BIRCH("birch", BlockPlanks.EnumType.BIRCH), //
|
BIRCH( "birch" , BlockPlanks.EnumType.BIRCH ) , //
|
||||||
SPRUCE("spruce", BlockPlanks.EnumType.SPRUCE), //
|
SPRUCE( "spruce" , BlockPlanks.EnumType.SPRUCE ) , //
|
||||||
JUNGLE("jungle", BlockPlanks.EnumType.JUNGLE), //
|
JUNGLE( "jungle" , BlockPlanks.EnumType.JUNGLE ) , //
|
||||||
DARK_OAK("dark_oak", BlockPlanks.EnumType.DARK_OAK), //
|
DARK_OAK( "dark_oak" , BlockPlanks.EnumType.DARK_OAK ) , //
|
||||||
ACACIA("acacia", BlockPlanks.EnumType.ACACIA);
|
ACACIA( "acacia" , BlockPlanks.EnumType.ACACIA );
|
||||||
|
|
||||||
public final String suffix;
|
public final String suffix;
|
||||||
public final int metaData;
|
public final int metaData;
|
||||||
public final MapColor mapColor;
|
public final MapColor mapColor;
|
||||||
public final Block block;
|
public final Block block;
|
||||||
|
|
||||||
private E_WoodType(String suffix, BlockPlanks.EnumType planks) {
|
|
||||||
|
private E_WoodType( final String suffix , final BlockPlanks.EnumType planks )
|
||||||
|
{
|
||||||
this.suffix = suffix;
|
this.suffix = suffix;
|
||||||
this.metaData = planks.getMetadata();
|
this.metaData = planks.getMetadata( );
|
||||||
this.mapColor = planks.getMapColor();
|
this.mapColor = planks.getMapColor( );
|
||||||
this.block = Blocks.PLANKS;
|
this.block = Blocks.PLANKS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static final AxisAlignedBB COLLISION_TOP = UMaths.makeBlockAABB(0, 12, 0, 16, 16, 16);
|
protected static final AxisAlignedBB COLLISION_TOP = UMaths.makeBlockAABB( 0 , 12 , 0 , 16 , 16 , 16 );
|
||||||
protected static final AxisAlignedBB COLLISION_LEGS[] = { //
|
protected static final AxisAlignedBB COLLISION_LEGS[] = { //
|
||||||
UMaths.makeBlockAABB(1, 0, 1, 3, 12, 3), //
|
UMaths.makeBlockAABB( 1 , 0 , 1 , 3 , 12 , 3 ) , //
|
||||||
UMaths.makeBlockAABB(13, 0, 1, 15, 12, 3), //
|
UMaths.makeBlockAABB( 13 , 0 , 1 , 15 , 12 , 3 ) , //
|
||||||
UMaths.makeBlockAABB(13, 0, 13, 15, 12, 15), //
|
UMaths.makeBlockAABB( 13 , 0 , 13 , 15 , 12 , 15 ) , //
|
||||||
UMaths.makeBlockAABB(1, 0, 13, 3, 12, 15), //
|
UMaths.makeBlockAABB( 1 , 0 , 13 , 3 , 12 , 15 ), //
|
||||||
};
|
};
|
||||||
|
|
||||||
public static final PropertyBool NORTH = PropertyBool.create("north");
|
public static final PropertyBool NORTH = PropertyBool.create( "north" );
|
||||||
public static final PropertyBool EAST = PropertyBool.create("east");
|
public static final PropertyBool EAST = PropertyBool.create( "east" );
|
||||||
public static final PropertyBool SOUTH = PropertyBool.create("south");
|
public static final PropertyBool SOUTH = PropertyBool.create( "south" );
|
||||||
public static final PropertyBool WEST = PropertyBool.create("west");
|
public static final PropertyBool WEST = PropertyBool.create( "west" );
|
||||||
public static final PropertyBool NW = PropertyBool.create("nw");
|
public static final PropertyBool NW = PropertyBool.create( "nw" );
|
||||||
public static final PropertyBool NE = PropertyBool.create("ne");
|
public static final PropertyBool NE = PropertyBool.create( "ne" );
|
||||||
public static final PropertyBool SW = PropertyBool.create("sw");
|
public static final PropertyBool SW = PropertyBool.create( "sw" );
|
||||||
public static final PropertyBool SE = PropertyBool.create("se");
|
public static final PropertyBool SE = PropertyBool.create( "se" );
|
||||||
private static final PropertyBool[] DIRECTIONS = { //
|
private static final PropertyBool[] DIRECTIONS = { //
|
||||||
NORTH, NE, EAST, SE, SOUTH, SW, WEST, NW//
|
DBlockTable.NORTH , DBlockTable.NE , DBlockTable.EAST , DBlockTable.SE , DBlockTable.SOUTH ,
|
||||||
|
DBlockTable.SW , DBlockTable.WEST , DBlockTable.NW//
|
||||||
};
|
};
|
||||||
|
|
||||||
public final E_WoodType type;
|
public final E_WoodType type;
|
||||||
|
|
||||||
public DBlockTable(E_WoodType type) {
|
|
||||||
super(Material.WOOD, type.mapColor);
|
public DBlockTable( final E_WoodType type )
|
||||||
|
{
|
||||||
|
super( Material.WOOD , type.mapColor );
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
this.setDefaultState(this.blockState.getBaseState()//
|
this.setDefaultState( this.blockState.getBaseState( )//
|
||||||
.withProperty(NORTH, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.NORTH , Boolean.valueOf( false ) )//
|
||||||
.withProperty(EAST, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.EAST , Boolean.valueOf( false ) )//
|
||||||
.withProperty(SOUTH, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.SOUTH , Boolean.valueOf( false ) )//
|
||||||
.withProperty(WEST, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.WEST , Boolean.valueOf( false ) )//
|
||||||
.withProperty(NW, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.NW , Boolean.valueOf( false ) )//
|
||||||
.withProperty(NE, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.NE , Boolean.valueOf( false ) )//
|
||||||
.withProperty(SW, Boolean.valueOf(false))//
|
.withProperty( DBlockTable.SW , Boolean.valueOf( false ) )//
|
||||||
.withProperty(SE, Boolean.valueOf(false)));
|
.withProperty( DBlockTable.SE , Boolean.valueOf( false ) ) );
|
||||||
|
|
||||||
this.setCreativeTab(CreativeTabs.DECORATIONS);
|
this.setCreativeTab( CreativeTabs.DECORATIONS );
|
||||||
this.setRegistryName(ID + type.suffix);
|
this.setRegistryName( DBlockTable.ID + type.suffix );
|
||||||
this.setUnlocalizedName(NAME + type.suffix);
|
this.setUnlocalizedName( DBlockTable.NAME + type.suffix );
|
||||||
|
|
||||||
this.lightOpacity = 0;
|
this.lightOpacity = 0;
|
||||||
this.translucent = false;
|
this.translucent = false;
|
||||||
|
@ -105,155 +116,183 @@ public class DBlockTable extends Block implements I_URecipeRegistrar {
|
||||||
this.blockSoundType = SoundType.LADDER;
|
this.blockSoundType = SoundType.LADDER;
|
||||||
this.enableStats = false;
|
this.enableStats = false;
|
||||||
|
|
||||||
this.setHarvestLevel("axe", 0);
|
this.setHarvestLevel( "axe" , 0 );
|
||||||
|
|
||||||
URegistration.addBlock(this);
|
URegistration.addBlock( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerRecipe() {
|
public void registerRecipe( )
|
||||||
GameRegistry.addShapedRecipe(new ItemStack(this), //
|
{
|
||||||
"BBB", //
|
GameRegistry.addShapedRecipe( new ItemStack( this ) , //
|
||||||
"S S", //
|
"BBB" , //
|
||||||
'B', new ItemStack(this.type.block, 1, this.type.metaData), //
|
"S S" , //
|
||||||
'S', Items.STICK //
|
'B' , new ItemStack( this.type.block , 1 , this.type.metaData ) , //
|
||||||
|
'S' , Items.STICK //
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube(IBlockState state) {
|
public boolean isOpaqueCube( final IBlockState state )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isFullCube(IBlockState state) {
|
public boolean isFullCube( final IBlockState state )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) {
|
|
||||||
return worldIn.getBlockState(pos).getBlock() == this;
|
public boolean canConnectTo( final IBlockAccess worldIn , final BlockPos pos )
|
||||||
|
{
|
||||||
|
return worldIn.getBlockState( pos ).getBlock( ) == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, new IProperty[] { NORTH, EAST, WEST, SOUTH, NE, NW, SE, SW });
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMetaFromState(IBlockState state) {
|
protected BlockStateContainer createBlockState( )
|
||||||
|
{
|
||||||
|
return new BlockStateContainer( this , new IProperty[] {
|
||||||
|
DBlockTable.NORTH , DBlockTable.EAST , DBlockTable.WEST , DBlockTable.SOUTH , DBlockTable.NE ,
|
||||||
|
DBlockTable.NW , DBlockTable.SE , DBlockTable.SW
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState( final IBlockState state )
|
||||||
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
|
public IBlockState getActualState( final IBlockState state , final IBlockAccess worldIn , final BlockPos pos )
|
||||||
BlockPos n = pos.north();
|
{
|
||||||
BlockPos s = pos.south();
|
final BlockPos n = pos.north( );
|
||||||
BlockPos w = pos.west();
|
final BlockPos s = pos.south( );
|
||||||
BlockPos e = pos.east();
|
final BlockPos w = pos.west( );
|
||||||
return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, n)))//
|
final BlockPos e = pos.east( );
|
||||||
.withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, e)))//
|
return state.withProperty( DBlockTable.NORTH , Boolean.valueOf( this.canConnectTo( worldIn , n ) ) )//
|
||||||
.withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, s)))//
|
.withProperty( DBlockTable.EAST , Boolean.valueOf( this.canConnectTo( worldIn , e ) ) )//
|
||||||
.withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, w)))//
|
.withProperty( DBlockTable.SOUTH , Boolean.valueOf( this.canConnectTo( worldIn , s ) ) )//
|
||||||
.withProperty(NW, Boolean.valueOf(this.canConnectTo(worldIn, n.west())))//
|
.withProperty( DBlockTable.WEST , Boolean.valueOf( this.canConnectTo( worldIn , w ) ) )//
|
||||||
.withProperty(NE, Boolean.valueOf(this.canConnectTo(worldIn, n.east())))//
|
.withProperty( DBlockTable.NW , Boolean.valueOf( this.canConnectTo( worldIn , n.west( ) ) ) )//
|
||||||
.withProperty(SW, Boolean.valueOf(this.canConnectTo(worldIn, s.west())))//
|
.withProperty( DBlockTable.NE , Boolean.valueOf( this.canConnectTo( worldIn , n.east( ) ) ) )//
|
||||||
.withProperty(SE, Boolean.valueOf(this.canConnectTo(worldIn, s.east())))//
|
.withProperty( DBlockTable.SW , Boolean.valueOf( this.canConnectTo( worldIn , s.west( ) ) ) )//
|
||||||
|
.withProperty( DBlockTable.SE , Boolean.valueOf( this.canConnectTo( worldIn , s.east( ) ) ) )//
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
public IBlockState withRotation( final IBlockState state , final Rotation rot )
|
||||||
switch (rot) {
|
{
|
||||||
|
switch ( rot ) {
|
||||||
case CLOCKWISE_180:
|
case CLOCKWISE_180:
|
||||||
return state.withProperty(NORTH, state.getValue(SOUTH))//
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )//
|
||||||
.withProperty(EAST, state.getValue(WEST))//
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )//
|
||||||
.withProperty(SOUTH, state.getValue(NORTH))//
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )//
|
||||||
.withProperty(WEST, state.getValue(EAST))//
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )//
|
||||||
.withProperty(NW, state.getValue(SE))//
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SE ) )//
|
||||||
.withProperty(NE, state.getValue(SW))//
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SW ) )//
|
||||||
.withProperty(SE, state.getValue(NW))//
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NW ) )//
|
||||||
.withProperty(SW, state.getValue(NE))//
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NE ) )//
|
||||||
;
|
;
|
||||||
case COUNTERCLOCKWISE_90:
|
case COUNTERCLOCKWISE_90:
|
||||||
return state.withProperty(NORTH, state.getValue(EAST))//
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.EAST ) )//
|
||||||
.withProperty(EAST, state.getValue(SOUTH))//
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.SOUTH ) )//
|
||||||
.withProperty(SOUTH, state.getValue(WEST))//
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.WEST ) )//
|
||||||
.withProperty(WEST, state.getValue(NORTH))//
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.NORTH ) )//
|
||||||
.withProperty(NW, state.getValue(NE))//
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )//
|
||||||
.withProperty(NE, state.getValue(SE))//
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )//
|
||||||
.withProperty(SE, state.getValue(SW))//
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )//
|
||||||
.withProperty(SW, state.getValue(NW))//
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )//
|
||||||
;
|
;
|
||||||
case CLOCKWISE_90:
|
case CLOCKWISE_90:
|
||||||
return state.withProperty(NORTH, state.getValue(WEST))//
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.WEST ) )//
|
||||||
.withProperty(EAST, state.getValue(NORTH))//
|
.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.NORTH ) )//
|
||||||
.withProperty(SOUTH, state.getValue(EAST))//
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.EAST ) )//
|
||||||
.withProperty(WEST, state.getValue(SOUTH))//
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.SOUTH ) )//
|
||||||
.withProperty(NW, state.getValue(SW))//
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )//
|
||||||
.withProperty(NE, state.getValue(NW))//
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )//
|
||||||
.withProperty(SE, state.getValue(NE))//
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )//
|
||||||
.withProperty(SW, state.getValue(SE))//
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )//
|
||||||
;
|
;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
public IBlockState withMirror( final IBlockState state , final Mirror mirrorIn )
|
||||||
switch (mirrorIn) {
|
{
|
||||||
|
switch ( mirrorIn ) {
|
||||||
case LEFT_RIGHT:
|
case LEFT_RIGHT:
|
||||||
return state.withProperty(NORTH, state.getValue(SOUTH))//
|
return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )//
|
||||||
.withProperty(SOUTH, state.getValue(NORTH))//
|
.withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )//
|
||||||
.withProperty(NW, state.getValue(SW))//
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )//
|
||||||
.withProperty(NE, state.getValue(SE))//
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )//
|
||||||
.withProperty(SW, state.getValue(NW))//
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )//
|
||||||
.withProperty(SE, state.getValue(NE))//
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )//
|
||||||
;
|
;
|
||||||
case FRONT_BACK:
|
case FRONT_BACK:
|
||||||
return state.withProperty(EAST, state.getValue(WEST))//
|
return state.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )//
|
||||||
.withProperty(WEST, state.getValue(EAST))//
|
.withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )//
|
||||||
.withProperty(NW, state.getValue(NE))//
|
.withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )//
|
||||||
.withProperty(NE, state.getValue(NW))//
|
.withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )//
|
||||||
.withProperty(SW, state.getValue(SE))//
|
.withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )//
|
||||||
.withProperty(SE, state.getValue(SW))//
|
.withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )//
|
||||||
;
|
;
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {
|
|
||||||
IBlockState actual = this.getActualState(state, source, pos);
|
|
||||||
for (int i = 0, dir = 0; i < 4; i++, dir += 2) {
|
|
||||||
boolean c0 = actual.getValue(DIRECTIONS[dir]);
|
|
||||||
boolean c1 = actual.getValue(DIRECTIONS[(dir + 6) % 8]);
|
|
||||||
boolean c10 = actual.getValue(DIRECTIONS[(dir + 7) % 8]);
|
|
||||||
if (!(c0 || c1) || (c0 && c1 && !c10)) {
|
|
||||||
return FULL_BLOCK_AABB;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return COLLISION_TOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB container,
|
public AxisAlignedBB getBoundingBox( final IBlockState state , final IBlockAccess source , final BlockPos pos )
|
||||||
List<AxisAlignedBB> output, Entity entity) {
|
{
|
||||||
IBlockState actual = this.getActualState(state, worldIn, pos);
|
final IBlockState actual = this.getActualState( state , source , pos );
|
||||||
addCollisionBoxToList(pos, container, output, COLLISION_TOP);
|
for ( int i = 0 , dir = 0 ; i < 4 ; i++ , dir += 2 ) {
|
||||||
for (int i = 0, dir = 0; i < 4; i++, dir += 2) {
|
final boolean c0 = actual.getValue( DBlockTable.DIRECTIONS[ dir ] );
|
||||||
boolean c0 = actual.getValue(DIRECTIONS[dir]);
|
final boolean c1 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 6 ) % 8 ] );
|
||||||
boolean c1 = actual.getValue(DIRECTIONS[(dir + 6) % 8]);
|
final boolean c10 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 7 ) % 8 ] );
|
||||||
boolean c10 = actual.getValue(DIRECTIONS[(dir + 7) % 8]);
|
if ( ! ( c0 || c1 ) || c0 && c1 && !c10 ) {
|
||||||
if (!(c0 || c1) || (c0 && c1 && !c10)) {
|
return Block.FULL_BLOCK_AABB;
|
||||||
addCollisionBoxToList(pos, container, output, COLLISION_LEGS[i]);
|
}
|
||||||
|
}
|
||||||
|
return DBlockTable.COLLISION_TOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addCollisionBoxToList( final IBlockState state , final World worldIn , final BlockPos pos ,
|
||||||
|
final AxisAlignedBB container , final List< AxisAlignedBB > output , final Entity entity )
|
||||||
|
{
|
||||||
|
final IBlockState actual = this.getActualState( state , worldIn , pos );
|
||||||
|
Block.addCollisionBoxToList( pos , container , output , DBlockTable.COLLISION_TOP );
|
||||||
|
for ( int i = 0 , dir = 0 ; i < 4 ; i++ , dir += 2 ) {
|
||||||
|
final boolean c0 = actual.getValue( DBlockTable.DIRECTIONS[ dir ] );
|
||||||
|
final boolean c1 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 6 ) % 8 ] );
|
||||||
|
final boolean c10 = actual.getValue( DBlockTable.DIRECTIONS[ ( dir + 7 ) % 8 ] );
|
||||||
|
if ( ! ( c0 || c1 ) || c0 && c1 && !c10 ) {
|
||||||
|
Block.addCollisionBoxToList( pos , container , output , DBlockTable.COLLISION_LEGS[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public BlockRenderLayer getBlockLayer() {
|
@Override
|
||||||
|
@SideOnly( Side.CLIENT )
|
||||||
|
public BlockRenderLayer getBlockLayer( )
|
||||||
|
{
|
||||||
return BlockRenderLayer.CUTOUT;
|
return BlockRenderLayer.CUTOUT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package mmm.deco;
|
package mmm.deco;
|
||||||
|
|
||||||
public class DecorativeBlocks {
|
|
||||||
|
public class DecorativeBlocks
|
||||||
|
{
|
||||||
|
|
||||||
public static final DBlockTable TABLE_OAK;
|
public static final DBlockTable TABLE_OAK;
|
||||||
public static final DBlockTable TABLE_BIRCH;
|
public static final DBlockTable TABLE_BIRCH;
|
||||||
|
@ -18,7 +20,9 @@ public class DecorativeBlocks {
|
||||||
TABLE_ACACIA = new DBlockTable( DBlockTable.E_WoodType.ACACIA );
|
TABLE_ACACIA = new DBlockTable( DBlockTable.E_WoodType.ACACIA );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void preInit() {
|
|
||||||
|
public static void preInit( )
|
||||||
|
{
|
||||||
// EMPTY
|
// EMPTY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package mmm.utils;
|
package mmm.utils;
|
||||||
|
|
||||||
public interface I_URecipeRegistrar {
|
|
||||||
|
|
||||||
public void registerRecipe();
|
public interface I_URecipeRegistrar
|
||||||
|
{
|
||||||
|
|
||||||
|
public void registerRecipe( );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
package mmm.utils;
|
package mmm.utils;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
|
||||||
public class UMaths {
|
|
||||||
|
|
||||||
public static AxisAlignedBB makeBlockAABB(int x1, int y1, int z1, int x2, int y2, int z2) {
|
|
||||||
return new AxisAlignedBB(x1 * .0625, y1 * .0625, z1 * .0625, x2 * .0625, y2 * .0625, z2 * .0625);
|
public class UMaths
|
||||||
|
{
|
||||||
|
|
||||||
|
public static AxisAlignedBB makeBlockAABB( final int x1 , final int y1 , final int z1 , final int x2 ,
|
||||||
|
final int y2 , final int z2 )
|
||||||
|
{
|
||||||
|
return new AxisAlignedBB( x1 * .0625 , y1 * .0625 , z1 * .0625 , x2 * .0625 , y2 * .0625 , z2 * .0625 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package mmm.utils;
|
package mmm.utils;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -11,62 +12,82 @@ import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class URegistration {
|
|
||||||
|
|
||||||
private static final HashMap<Item, Boolean> ITEMS = new HashMap<Item, Boolean>();
|
|
||||||
private static final HashSet<Block> BLOCKS = new HashSet<Block>();
|
|
||||||
|
|
||||||
public static void addItem(Item item) {
|
public class URegistration
|
||||||
addItem(item, true);
|
{
|
||||||
|
|
||||||
|
private static final HashMap< Item , Boolean > ITEMS = new HashMap< Item , Boolean >( );
|
||||||
|
private static final HashSet< Block > BLOCKS = new HashSet< Block >( );
|
||||||
|
|
||||||
|
|
||||||
|
public static void addItem( final Item item )
|
||||||
|
{
|
||||||
|
URegistration.addItem( item , true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addItem(Item item, boolean registerModel) {
|
|
||||||
GameRegistry.register(item);
|
public static void addItem( final Item item , final boolean registerModel )
|
||||||
ITEMS.put(item, registerModel);
|
{
|
||||||
|
GameRegistry.register( item );
|
||||||
|
URegistration.ITEMS.put( item , registerModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addBlock(Block block) {
|
|
||||||
addBlock(block, true);
|
public static void addBlock( final Block block )
|
||||||
|
{
|
||||||
|
URegistration.addBlock( block , true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addBlock(Block block, Item blockItem) {
|
|
||||||
addBlock(block, blockItem, true);
|
public static void addBlock( final Block block , final Item blockItem )
|
||||||
|
{
|
||||||
|
URegistration.addBlock( block , blockItem , true );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addBlock(Block block, boolean registerItemModel) {
|
|
||||||
addBlock(block, new ItemBlock(block).setRegistryName(block.getRegistryName()), registerItemModel);
|
public static void addBlock( final Block block , final boolean registerItemModel )
|
||||||
|
{
|
||||||
|
URegistration.addBlock( block , new ItemBlock( block ).setRegistryName( block.getRegistryName( ) ) ,
|
||||||
|
registerItemModel );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addBlock(Block block, Item blockItem, boolean registerItemModel) {
|
|
||||||
GameRegistry.register(block);
|
public static void addBlock( final Block block , final Item blockItem , final boolean registerItemModel )
|
||||||
BLOCKS.add(block);
|
{
|
||||||
if (blockItem != null) {
|
GameRegistry.register( block );
|
||||||
addItem(blockItem, registerItemModel);
|
URegistration.BLOCKS.add( block );
|
||||||
|
if ( blockItem != null ) {
|
||||||
|
URegistration.addItem( blockItem , registerItemModel );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerRecipes() {
|
|
||||||
for (Block block : BLOCKS) {
|
public static void registerRecipes( )
|
||||||
if (block instanceof I_URecipeRegistrar) {
|
{
|
||||||
((I_URecipeRegistrar) block).registerRecipe();
|
for ( final Block block : URegistration.BLOCKS ) {
|
||||||
|
if ( block instanceof I_URecipeRegistrar ) {
|
||||||
|
( (I_URecipeRegistrar) block ).registerRecipe( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Item item : ITEMS.keySet()) {
|
for ( final Item item : URegistration.ITEMS.keySet( ) ) {
|
||||||
if (item instanceof I_URecipeRegistrar) {
|
if ( item instanceof I_URecipeRegistrar ) {
|
||||||
((I_URecipeRegistrar) item).registerRecipe();
|
( (I_URecipeRegistrar) item ).registerRecipe( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupItemModels() {
|
|
||||||
for (Map.Entry<Item, Boolean> entry : ITEMS.entrySet()) {
|
public static void setupItemModels( )
|
||||||
if (!entry.getValue()) {
|
{
|
||||||
|
for ( final Map.Entry< Item , Boolean > entry : URegistration.ITEMS.entrySet( ) ) {
|
||||||
|
if ( !entry.getValue( ) ) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Item item = entry.getKey();
|
final Item item = entry.getKey( );
|
||||||
ModelLoader.setCustomModelResourceLocation(item, 0,
|
ModelLoader.setCustomModelResourceLocation( item , 0 ,
|
||||||
new ModelResourceLocation(item.getRegistryName(), "inventory"));
|
new ModelResourceLocation( item.getRegistryName( ) , "inventory" ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue