diff --git a/src/java/mmm/Mmm.java b/src/java/mmm/Mmm.java index 3e210bd..2ba37a1 100644 --- a/src/java/mmm/Mmm.java +++ b/src/java/mmm/Mmm.java @@ -1,5 +1,6 @@ package mmm; + import mmm.deco.DecorativeBlocks; import mmm.utils.URegistration; 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.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 NAME = "MMM!"; public static final String VERSION = "0.1-1.9.4"; - public static final String PREFIX = ID + "."; + public static final String PREFIX = Mmm.ID + "."; @SidedProxy public static CommonProxy proxy = null; - public static abstract class CommonProxy { + public static abstract class CommonProxy + { - public void preInit(FMLPreInitializationEvent event) { - DecorativeBlocks.preInit(); - URegistration.registerRecipes(); + public void preInit( final FMLPreInitializationEvent event ) + { + DecorativeBlocks.preInit( ); + URegistration.registerRecipes( ); } - public void init(FMLInitializationEvent event) { + + public void init( final FMLInitializationEvent event ) + { // 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 - public void preInit(FMLPreInitializationEvent event) { - super.preInit(event); - URegistration.setupItemModels(); + public void preInit( final FMLPreInitializationEvent event ) + { + super.preInit( event ); + URegistration.setupItemModels( ); } } - @EventHandler - public void preInit(FMLPreInitializationEvent event) { - proxy.preInit(event); - } @EventHandler - public void init(FMLInitializationEvent event) { - proxy.init(event); + public void preInit( final FMLPreInitializationEvent event ) + { + Mmm.proxy.preInit( event ); + } + + + @EventHandler + public void init( final FMLInitializationEvent event ) + { + Mmm.proxy.init( event ); } } diff --git a/src/java/mmm/deco/DBlockTable.java b/src/java/mmm/deco/DBlockTable.java index fb6c77a..a8ac911 100644 --- a/src/java/mmm/deco/DBlockTable.java +++ b/src/java/mmm/deco/DBlockTable.java @@ -1,5 +1,6 @@ package mmm.deco; + import java.util.List; 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.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 NAME = Mmm.PREFIX + ID; + public final static String NAME = Mmm.PREFIX + DBlockTable.ID; public static enum E_WoodType { - OAK("oak", BlockPlanks.EnumType.OAK), // - BIRCH("birch", BlockPlanks.EnumType.BIRCH), // - SPRUCE("spruce", BlockPlanks.EnumType.SPRUCE), // - JUNGLE("jungle", BlockPlanks.EnumType.JUNGLE), // - DARK_OAK("dark_oak", BlockPlanks.EnumType.DARK_OAK), // - ACACIA("acacia", BlockPlanks.EnumType.ACACIA); + OAK( "oak" , BlockPlanks.EnumType.OAK ) , // + BIRCH( "birch" , BlockPlanks.EnumType.BIRCH ) , // + SPRUCE( "spruce" , BlockPlanks.EnumType.SPRUCE ) , // + JUNGLE( "jungle" , BlockPlanks.EnumType.JUNGLE ) , // + DARK_OAK( "dark_oak" , BlockPlanks.EnumType.DARK_OAK ) , // + ACACIA( "acacia" , BlockPlanks.EnumType.ACACIA ); public final String suffix; public final int metaData; public final MapColor mapColor; 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.metaData = planks.getMetadata(); - this.mapColor = planks.getMapColor(); + this.metaData = planks.getMetadata( ); + this.mapColor = planks.getMapColor( ); 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[] = { // - UMaths.makeBlockAABB(1, 0, 1, 3, 12, 3), // - UMaths.makeBlockAABB(13, 0, 1, 15, 12, 3), // - UMaths.makeBlockAABB(13, 0, 13, 15, 12, 15), // - UMaths.makeBlockAABB(1, 0, 13, 3, 12, 15), // + UMaths.makeBlockAABB( 1 , 0 , 1 , 3 , 12 , 3 ) , // + UMaths.makeBlockAABB( 13 , 0 , 1 , 15 , 12 , 3 ) , // + UMaths.makeBlockAABB( 13 , 0 , 13 , 15 , 12 , 15 ) , // + UMaths.makeBlockAABB( 1 , 0 , 13 , 3 , 12 , 15 ), // }; - public static final PropertyBool NORTH = PropertyBool.create("north"); - public static final PropertyBool EAST = PropertyBool.create("east"); - public static final PropertyBool SOUTH = PropertyBool.create("south"); - public static final PropertyBool WEST = PropertyBool.create("west"); - public static final PropertyBool NW = PropertyBool.create("nw"); - public static final PropertyBool NE = PropertyBool.create("ne"); - public static final PropertyBool SW = PropertyBool.create("sw"); - public static final PropertyBool SE = PropertyBool.create("se"); + public static final PropertyBool NORTH = PropertyBool.create( "north" ); + public static final PropertyBool EAST = PropertyBool.create( "east" ); + public static final PropertyBool SOUTH = PropertyBool.create( "south" ); + public static final PropertyBool WEST = PropertyBool.create( "west" ); + public static final PropertyBool NW = PropertyBool.create( "nw" ); + public static final PropertyBool NE = PropertyBool.create( "ne" ); + public static final PropertyBool SW = PropertyBool.create( "sw" ); + public static final PropertyBool SE = PropertyBool.create( "se" ); 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 DBlockTable(E_WoodType type) { - super(Material.WOOD, type.mapColor); + + public DBlockTable( final E_WoodType type ) + { + super( Material.WOOD , type.mapColor ); this.type = type; - this.setDefaultState(this.blockState.getBaseState()// - .withProperty(NORTH, Boolean.valueOf(false))// - .withProperty(EAST, Boolean.valueOf(false))// - .withProperty(SOUTH, Boolean.valueOf(false))// - .withProperty(WEST, Boolean.valueOf(false))// - .withProperty(NW, Boolean.valueOf(false))// - .withProperty(NE, Boolean.valueOf(false))// - .withProperty(SW, Boolean.valueOf(false))// - .withProperty(SE, Boolean.valueOf(false))); + this.setDefaultState( this.blockState.getBaseState( )// + .withProperty( DBlockTable.NORTH , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.EAST , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.SOUTH , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.WEST , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.NW , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.NE , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.SW , Boolean.valueOf( false ) )// + .withProperty( DBlockTable.SE , Boolean.valueOf( false ) ) ); - this.setCreativeTab(CreativeTabs.DECORATIONS); - this.setRegistryName(ID + type.suffix); - this.setUnlocalizedName(NAME + type.suffix); + this.setCreativeTab( CreativeTabs.DECORATIONS ); + this.setRegistryName( DBlockTable.ID + type.suffix ); + this.setUnlocalizedName( DBlockTable.NAME + type.suffix ); this.lightOpacity = 0; this.translucent = false; @@ -105,155 +116,183 @@ public class DBlockTable extends Block implements I_URecipeRegistrar { this.blockSoundType = SoundType.LADDER; this.enableStats = false; - this.setHarvestLevel("axe", 0); + this.setHarvestLevel( "axe" , 0 ); - URegistration.addBlock(this); + URegistration.addBlock( this ); } + @Override - public void registerRecipe() { - GameRegistry.addShapedRecipe(new ItemStack(this), // - "BBB", // - "S S", // - 'B', new ItemStack(this.type.block, 1, this.type.metaData), // - 'S', Items.STICK // + public void registerRecipe( ) + { + GameRegistry.addShapedRecipe( new ItemStack( this ) , // + "BBB" , // + "S S" , // + 'B' , new ItemStack( this.type.block , 1 , this.type.metaData ) , // + 'S' , Items.STICK // ); } + @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube( final IBlockState state ) + { return false; } + @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube( final IBlockState state ) + { 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 - 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; } + @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - BlockPos n = pos.north(); - BlockPos s = pos.south(); - BlockPos w = pos.west(); - BlockPos e = pos.east(); - return state.withProperty(NORTH, Boolean.valueOf(this.canConnectTo(worldIn, n)))// - .withProperty(EAST, Boolean.valueOf(this.canConnectTo(worldIn, e)))// - .withProperty(SOUTH, Boolean.valueOf(this.canConnectTo(worldIn, s)))// - .withProperty(WEST, Boolean.valueOf(this.canConnectTo(worldIn, w)))// - .withProperty(NW, Boolean.valueOf(this.canConnectTo(worldIn, n.west())))// - .withProperty(NE, Boolean.valueOf(this.canConnectTo(worldIn, n.east())))// - .withProperty(SW, Boolean.valueOf(this.canConnectTo(worldIn, s.west())))// - .withProperty(SE, Boolean.valueOf(this.canConnectTo(worldIn, s.east())))// + public IBlockState getActualState( final IBlockState state , final IBlockAccess worldIn , final BlockPos pos ) + { + final BlockPos n = pos.north( ); + final BlockPos s = pos.south( ); + final BlockPos w = pos.west( ); + final BlockPos e = pos.east( ); + return state.withProperty( DBlockTable.NORTH , Boolean.valueOf( this.canConnectTo( worldIn , n ) ) )// + .withProperty( DBlockTable.EAST , Boolean.valueOf( this.canConnectTo( worldIn , e ) ) )// + .withProperty( DBlockTable.SOUTH , Boolean.valueOf( this.canConnectTo( worldIn , s ) ) )// + .withProperty( DBlockTable.WEST , Boolean.valueOf( this.canConnectTo( worldIn , w ) ) )// + .withProperty( DBlockTable.NW , Boolean.valueOf( this.canConnectTo( worldIn , n.west( ) ) ) )// + .withProperty( DBlockTable.NE , Boolean.valueOf( this.canConnectTo( worldIn , n.east( ) ) ) )// + .withProperty( DBlockTable.SW , Boolean.valueOf( this.canConnectTo( worldIn , s.west( ) ) ) )// + .withProperty( DBlockTable.SE , Boolean.valueOf( this.canConnectTo( worldIn , s.east( ) ) ) )// ; } + @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { - switch (rot) { - case CLOCKWISE_180: - return state.withProperty(NORTH, state.getValue(SOUTH))// - .withProperty(EAST, state.getValue(WEST))// - .withProperty(SOUTH, state.getValue(NORTH))// - .withProperty(WEST, state.getValue(EAST))// - .withProperty(NW, state.getValue(SE))// - .withProperty(NE, state.getValue(SW))// - .withProperty(SE, state.getValue(NW))// - .withProperty(SW, state.getValue(NE))// - ; - case COUNTERCLOCKWISE_90: - return state.withProperty(NORTH, state.getValue(EAST))// - .withProperty(EAST, state.getValue(SOUTH))// - .withProperty(SOUTH, state.getValue(WEST))// - .withProperty(WEST, state.getValue(NORTH))// - .withProperty(NW, state.getValue(NE))// - .withProperty(NE, state.getValue(SE))// - .withProperty(SE, state.getValue(SW))// - .withProperty(SW, state.getValue(NW))// - ; - case CLOCKWISE_90: - return state.withProperty(NORTH, state.getValue(WEST))// - .withProperty(EAST, state.getValue(NORTH))// - .withProperty(SOUTH, state.getValue(EAST))// - .withProperty(WEST, state.getValue(SOUTH))// - .withProperty(NW, state.getValue(SW))// - .withProperty(NE, state.getValue(NW))// - .withProperty(SE, state.getValue(NE))// - .withProperty(SW, state.getValue(SE))// - ; - default: - return state; + public IBlockState withRotation( final IBlockState state , final Rotation rot ) + { + switch ( rot ) { + case CLOCKWISE_180: + return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )// + .withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )// + .withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )// + .withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )// + .withProperty( DBlockTable.NW , state.getValue( DBlockTable.SE ) )// + .withProperty( DBlockTable.NE , state.getValue( DBlockTable.SW ) )// + .withProperty( DBlockTable.SE , state.getValue( DBlockTable.NW ) )// + .withProperty( DBlockTable.SW , state.getValue( DBlockTable.NE ) )// + ; + case COUNTERCLOCKWISE_90: + return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.EAST ) )// + .withProperty( DBlockTable.EAST , state.getValue( DBlockTable.SOUTH ) )// + .withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.WEST ) )// + .withProperty( DBlockTable.WEST , state.getValue( DBlockTable.NORTH ) )// + .withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )// + .withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )// + .withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )// + .withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )// + ; + case CLOCKWISE_90: + return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.WEST ) )// + .withProperty( DBlockTable.EAST , state.getValue( DBlockTable.NORTH ) )// + .withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.EAST ) )// + .withProperty( DBlockTable.WEST , state.getValue( DBlockTable.SOUTH ) )// + .withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )// + .withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )// + .withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )// + .withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )// + ; + default: + return state; } } + @Override - public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { - switch (mirrorIn) { - case LEFT_RIGHT: - return state.withProperty(NORTH, state.getValue(SOUTH))// - .withProperty(SOUTH, state.getValue(NORTH))// - .withProperty(NW, state.getValue(SW))// - .withProperty(NE, state.getValue(SE))// - .withProperty(SW, state.getValue(NW))// - .withProperty(SE, state.getValue(NE))// - ; - case FRONT_BACK: - return state.withProperty(EAST, state.getValue(WEST))// - .withProperty(WEST, state.getValue(EAST))// - .withProperty(NW, state.getValue(NE))// - .withProperty(NE, state.getValue(NW))// - .withProperty(SW, state.getValue(SE))// - .withProperty(SE, state.getValue(SW))// - ; - default: - return state; + public IBlockState withMirror( final IBlockState state , final Mirror mirrorIn ) + { + switch ( mirrorIn ) { + case LEFT_RIGHT: + return state.withProperty( DBlockTable.NORTH , state.getValue( DBlockTable.SOUTH ) )// + .withProperty( DBlockTable.SOUTH , state.getValue( DBlockTable.NORTH ) )// + .withProperty( DBlockTable.NW , state.getValue( DBlockTable.SW ) )// + .withProperty( DBlockTable.NE , state.getValue( DBlockTable.SE ) )// + .withProperty( DBlockTable.SW , state.getValue( DBlockTable.NW ) )// + .withProperty( DBlockTable.SE , state.getValue( DBlockTable.NE ) )// + ; + case FRONT_BACK: + return state.withProperty( DBlockTable.EAST , state.getValue( DBlockTable.WEST ) )// + .withProperty( DBlockTable.WEST , state.getValue( DBlockTable.EAST ) )// + .withProperty( DBlockTable.NW , state.getValue( DBlockTable.NE ) )// + .withProperty( DBlockTable.NE , state.getValue( DBlockTable.NW ) )// + .withProperty( DBlockTable.SW , state.getValue( DBlockTable.SE ) )// + .withProperty( DBlockTable.SE , state.getValue( DBlockTable.SW ) )// + ; + default: + 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; + public AxisAlignedBB getBoundingBox( final IBlockState state , final IBlockAccess source , final BlockPos pos ) + { + final IBlockState actual = this.getActualState( state , source , pos ); + 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 ) { + return Block.FULL_BLOCK_AABB; } } - return COLLISION_TOP; + return DBlockTable.COLLISION_TOP; } + @Override - public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB container, - List output, Entity entity) { - IBlockState actual = this.getActualState(state, worldIn, pos); - addCollisionBoxToList(pos, container, output, COLLISION_TOP); - 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)) { - addCollisionBoxToList(pos, container, output, COLLISION_LEGS[i]); + 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; } } diff --git a/src/java/mmm/deco/DecorativeBlocks.java b/src/java/mmm/deco/DecorativeBlocks.java index 14719fc..c9bcd3a 100644 --- a/src/java/mmm/deco/DecorativeBlocks.java +++ b/src/java/mmm/deco/DecorativeBlocks.java @@ -1,7 +1,9 @@ package mmm.deco; -public class DecorativeBlocks { - + +public class DecorativeBlocks +{ + public static final DBlockTable TABLE_OAK; public static final DBlockTable TABLE_BIRCH; public static final DBlockTable TABLE_SPRUCE; @@ -18,7 +20,9 @@ public class DecorativeBlocks { TABLE_ACACIA = new DBlockTable( DBlockTable.E_WoodType.ACACIA ); } - public static void preInit() { + + public static void preInit( ) + { // EMPTY } diff --git a/src/java/mmm/utils/I_URecipeRegistrar.java b/src/java/mmm/utils/I_URecipeRegistrar.java index 955a773..8e15f0f 100644 --- a/src/java/mmm/utils/I_URecipeRegistrar.java +++ b/src/java/mmm/utils/I_URecipeRegistrar.java @@ -1,7 +1,9 @@ package mmm.utils; -public interface I_URecipeRegistrar { - public void registerRecipe(); +public interface I_URecipeRegistrar +{ + + public void registerRecipe( ); } diff --git a/src/java/mmm/utils/UMaths.java b/src/java/mmm/utils/UMaths.java index 4c78461..2df1b65 100644 --- a/src/java/mmm/utils/UMaths.java +++ b/src/java/mmm/utils/UMaths.java @@ -1,11 +1,17 @@ package mmm.utils; + 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 ); } } diff --git a/src/java/mmm/utils/URegistration.java b/src/java/mmm/utils/URegistration.java index 6453fc9..18298d8 100644 --- a/src/java/mmm/utils/URegistration.java +++ b/src/java/mmm/utils/URegistration.java @@ -1,5 +1,6 @@ package mmm.utils; + import java.util.HashMap; import java.util.HashSet; import java.util.Map; @@ -11,62 +12,82 @@ import net.minecraft.item.ItemBlock; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.common.registry.GameRegistry; -public class URegistration { - private static final HashMap ITEMS = new HashMap(); - private static final HashSet BLOCKS = new HashSet(); - public static void addItem(Item item) { - addItem(item, true); +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( final Item item ) + { + URegistration.addItem( item , true ); } - public static void addItem(Item item, boolean registerModel) { - GameRegistry.register(item); - ITEMS.put(item, registerModel); + + public static void addItem( final Item item , final boolean 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); - BLOCKS.add(block); - if (blockItem != null) { - addItem(blockItem, registerItemModel); + + public static void addBlock( final Block block , final Item blockItem , final boolean registerItemModel ) + { + GameRegistry.register( block ); + URegistration.BLOCKS.add( block ); + if ( blockItem != null ) { + URegistration.addItem( blockItem , registerItemModel ); } } - public static void registerRecipes() { - for (Block block : BLOCKS) { - if (block instanceof I_URecipeRegistrar) { - ((I_URecipeRegistrar) block).registerRecipe(); + + public static void registerRecipes( ) + { + for ( final Block block : URegistration.BLOCKS ) { + if ( block instanceof I_URecipeRegistrar ) { + ( (I_URecipeRegistrar) block ).registerRecipe( ); } } - for (Item item : ITEMS.keySet()) { - if (item instanceof I_URecipeRegistrar) { - ((I_URecipeRegistrar) item).registerRecipe(); + for ( final Item item : URegistration.ITEMS.keySet( ) ) { + if ( item instanceof I_URecipeRegistrar ) { + ( (I_URecipeRegistrar) item ).registerRecipe( ); } } } - public static void setupItemModels() { - for (Map.Entry entry : ITEMS.entrySet()) { - if (!entry.getValue()) { + + public static void setupItemModels( ) + { + for ( final Map.Entry< Item , Boolean > entry : URegistration.ITEMS.entrySet( ) ) { + if ( !entry.getValue( ) ) { continue; } - Item item = entry.getKey(); - ModelLoader.setCustomModelResourceLocation(item, 0, - new ModelResourceLocation(item.getRegistryName(), "inventory")); + final Item item = entry.getKey( ); + ModelLoader.setCustomModelResourceLocation( item , 0 , + new ModelResourceLocation( item.getRegistryName( ) , "inventory" ) ); } } }