Re-organised assets

This commit is contained in:
Emmanuel BENOîT 2016-06-14 17:12:51 +02:00
parent ebdacba9a7
commit 2519f88bbe
30 changed files with 62 additions and 36 deletions

View file

@ -3,10 +3,10 @@ package mmm.deco;
import java.util.List; import java.util.List;
import mmm.Mmm;
import mmm.utils.I_UBlockSeat; import mmm.utils.I_UBlockSeat;
import mmm.utils.I_URecipeRegistrar; import mmm.utils.I_URecipeRegistrar;
import mmm.utils.UMaths; import mmm.utils.UMaths;
import mmm.utils.URegistration;
import mmm.utils.USeat; import mmm.utils.USeat;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockHorizontal; import net.minecraft.block.BlockHorizontal;
@ -43,9 +43,6 @@ public class DBlockChair
extends Block extends Block
implements I_URecipeRegistrar , I_UBlockSeat implements I_URecipeRegistrar , I_UBlockSeat
{ {
public final static String ID = "deco_chair_";
public final static String NAME = Mmm.PREFIX + DBlockChair.ID;
public static final PropertyDirection FACING = BlockHorizontal.FACING; public static final PropertyDirection FACING = BlockHorizontal.FACING;
private static final AxisAlignedBB BOUNDING_BOX = UMaths.makeBlockAABB( 1 , 0 , 1 , 15 , 16 , 15 ); private static final AxisAlignedBB BOUNDING_BOX = UMaths.makeBlockAABB( 1 , 0 , 1 , 15 , 16 , 15 );
@ -65,8 +62,7 @@ public class DBlockChair
this.setDefaultState( this.blockState.getBaseState( ).withProperty( DBlockChair.FACING , EnumFacing.NORTH ) ); this.setDefaultState( this.blockState.getBaseState( ).withProperty( DBlockChair.FACING , EnumFacing.NORTH ) );
this.setCreativeTab( CreativeTabs.DECORATIONS ); this.setCreativeTab( CreativeTabs.DECORATIONS );
this.setRegistryName( DBlockChair.ID + type.suffix ); URegistration.setIdentifiers( this , "deco" , "chair" , type.suffix );
this.setUnlocalizedName( DBlockChair.NAME + type.suffix );
this.lightOpacity = 0; this.lightOpacity = 0;
this.translucent = false; this.translucent = false;

View file

@ -3,9 +3,9 @@ package mmm.deco;
import java.util.List; import java.util.List;
import mmm.Mmm;
import mmm.utils.I_URecipeRegistrar; import mmm.utils.I_URecipeRegistrar;
import mmm.utils.UMaths; import mmm.utils.UMaths;
import mmm.utils.URegistration;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -36,9 +36,6 @@ public class DBlockTable
implements I_URecipeRegistrar implements I_URecipeRegistrar
{ {
public final static String ID = "deco_table_";
public final static String NAME = Mmm.PREFIX + DBlockTable.ID;
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 ) , //
@ -79,8 +76,7 @@ public class DBlockTable
.withProperty( DBlockTable.SE , Boolean.valueOf( false ) ) ); .withProperty( DBlockTable.SE , Boolean.valueOf( false ) ) );
this.setCreativeTab( CreativeTabs.DECORATIONS ); this.setCreativeTab( CreativeTabs.DECORATIONS );
this.setRegistryName( DBlockTable.ID + type.suffix ); URegistration.setIdentifiers( this , "deco" , "table" , type.suffix );
this.setUnlocalizedName( DBlockTable.NAME + type.suffix );
this.lightOpacity = 0; this.lightOpacity = 0;
this.translucent = false; this.translucent = false;

View file

@ -5,12 +5,15 @@ import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map; import java.util.Map;
import mmm.Mmm;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.ResourceLocation;
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;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
@ -21,6 +24,37 @@ public class URegistration
private static final HashSet< Block > BLOCKS = new HashSet< Block >( ); private static final HashSet< Block > BLOCKS = new HashSet< Block >( );
public static void setIdentifiers( final IForgeRegistryEntry< ? > thing , String... strings )
{
int nStrings = strings.length;
if ( nStrings == 0 ) {
throw new IllegalArgumentException( "no identifier specified" );
}
StringBuilder sb = new StringBuilder( );
for ( int i = 0 ; i < nStrings ; i++ ) {
if ( i > 0 ) {
sb.append( '/' );
}
sb.append( strings[ i ] );
}
thing.setRegistryName( new ResourceLocation( Mmm.ID , sb.toString( ) ) );
if ( thing instanceof Block || thing instanceof Item ) {
sb.setLength( 0 );
sb.append( Mmm.ID );
for ( int i = 0 ; i < nStrings ; i++ ) {
sb.append( '.' ).append( strings[ i ] );
}
if ( thing instanceof Block ) {
( (Block) thing ).setUnlocalizedName( sb.toString( ) );
} else {
( (Item) thing ).setUnlocalizedName( sb.toString( ) );
}
}
}
public static void addItem( final Item item ) public static void addItem( final Item item )
{ {
URegistration.addItem( item , true ); URegistration.addItem( item , true );

View file

@ -1,13 +1,13 @@
tile.mmm.deco_table_oak.name=Oak table tile.mmm.deco.table.oak.name=Oak table
tile.mmm.deco_table_birch.name=Birch table tile.mmm.deco.table.birch.name=Birch table
tile.mmm.deco_table_spruce.name=Spruce table tile.mmm.deco.table.spruce.name=Spruce table
tile.mmm.deco_table_acacia.name=Acacia table tile.mmm.deco.table.acacia.name=Acacia table
tile.mmm.deco_table_jungle.name=Jungle wood table tile.mmm.deco.table.jungle.name=Jungle wood table
tile.mmm.deco_table_dark_oak.name=Dark oak table tile.mmm.deco.table.dark_oak.name=Dark oak table
tile.mmm.deco_chair_oak.name=Oak chair tile.mmm.deco.chair.oak.name=Oak chair
tile.mmm.deco_chair_birch.name=Birch chair tile.mmm.deco.chair.birch.name=Birch chair
tile.mmm.deco_chair_spruce.name=Spruce chair tile.mmm.deco.chair.spruce.name=Spruce chair
tile.mmm.deco_chair_acacia.name=Acacia chair tile.mmm.deco.chair.acacia.name=Acacia chair
tile.mmm.deco_chair_jungle.name=Jungle wood chair tile.mmm.deco.chair.jungle.name=Jungle wood chair
tile.mmm.deco_chair_dark_oak.name=Dark oak chair tile.mmm.deco.chair.dark_oak.name=Dark oak chair

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_acacia", "body": "minecraft:blocks/planks_acacia",
"legs": "minecraft:blocks/log_acacia" "legs": "minecraft:blocks/log_acacia"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_birch", "body": "minecraft:blocks/planks_birch",
"legs": "minecraft:blocks/log_birch" "legs": "minecraft:blocks/log_birch"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_big_oak", "body": "minecraft:blocks/planks_big_oak",
"legs": "minecraft:blocks/log_big_oak" "legs": "minecraft:blocks/log_big_oak"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_jungle", "body": "minecraft:blocks/planks_jungle",
"legs": "minecraft:blocks/log_jungle" "legs": "minecraft:blocks/log_jungle"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_oak", "body": "minecraft:blocks/planks_oak",
"legs": "minecraft:blocks/log_oak" "legs": "minecraft:blocks/log_oak"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/chair",
"textures": { "textures": {
"body": "minecraft:blocks/planks_spruce", "body": "minecraft:blocks/planks_spruce",
"legs": "minecraft:blocks/log_spruce" "legs": "minecraft:blocks/log_spruce"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_acacia", "body": "minecraft:blocks/planks_acacia",
"legs": "minecraft:blocks/log_acacia" "legs": "minecraft:blocks/log_acacia"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_birch", "body": "minecraft:blocks/planks_birch",
"legs": "minecraft:blocks/log_birch" "legs": "minecraft:blocks/log_birch"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_big_oak", "body": "minecraft:blocks/planks_big_oak",
"legs": "minecraft:blocks/log_big_oak" "legs": "minecraft:blocks/log_big_oak"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_chair", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_jungle", "body": "minecraft:blocks/planks_jungle",
"legs": "minecraft:blocks/log_jungle" "legs": "minecraft:blocks/log_jungle"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_oak", "body": "minecraft:blocks/planks_oak",
"legs": "minecraft:blocks/log_oak" "legs": "minecraft:blocks/log_oak"

View file

@ -1,5 +1,5 @@
{ {
"parent": "mmm:item/deco_table", "parent": "mmm:item/deco/table",
"textures": { "textures": {
"body": "minecraft:blocks/planks_spruce", "body": "minecraft:blocks/planks_spruce",
"legs": "minecraft:blocks/log_spruce" "legs": "minecraft:blocks/log_spruce"