mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-18 19:39:22 +00:00
Update mappings to 20151122.
This commit is contained in:
1 parent
84c3ef0f5c
commit
68dfcccd57
15 files changed
+65
-65
No files matched your search
@@ -36,7 +36,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
public class ForgeBlockStatesLoaderDebug {
|
||||
public static final String MODID = "ForgeBlockStatesLoader";
|
||||
public static final String ASSETS = "forgeblockstatesloader:";
|
||||
|
||||
|
||||
public static final Block blockCustom = new CustomMappedBlock();
|
||||
public static final String nameCustomWall = "custom_wall";
|
||||
public static final BlockWall blockCustomWall = new BlockWall(Blocks.cobblestone);
|
||||
@@ -48,42 +48,42 @@ public class ForgeBlockStatesLoaderDebug {
|
||||
return BlockWall.EnumType.byMetadata(stack.getMetadata()).getUnlocalizedName();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event)
|
||||
{
|
||||
{
|
||||
blockCustom.setUnlocalizedName(MODID + ".customBlock");
|
||||
GameRegistry.registerBlock(blockCustom, "customBlock");
|
||||
|
||||
|
||||
blockCustomWall.setUnlocalizedName(MODID + ".customWall");
|
||||
GameRegistry.registerBlock(blockCustomWall, null, nameCustomWall);
|
||||
GameRegistry.registerItem(itemCustomWall, nameCustomWall);
|
||||
GameData.getBlockItemMap().put(blockCustomWall, itemCustomWall);
|
||||
|
||||
|
||||
if (event.getSide() == Side.CLIENT)
|
||||
preInitClient(event);
|
||||
}
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void preInitClient(FMLPreInitializationEvent event)
|
||||
{
|
||||
ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().setProperty(CustomMappedBlock.VARIANT).build());
|
||||
|
||||
ModelLoader.setCustomStateMapper(blockCustom, new StateMap.Builder().withName(CustomMappedBlock.VARIANT).build());
|
||||
|
||||
ModelLoader.setCustomStateMapper(blockCustomWall, new IStateMapper()
|
||||
{
|
||||
StateMap stateMap = new StateMap.Builder().setProperty(BlockWall.VARIANT).setBuilderSuffix("_wall").build();
|
||||
StateMap stateMap = new StateMap.Builder().withName(BlockWall.VARIANT).withSuffix("_wall").build();
|
||||
@Override
|
||||
public Map putStateModelLocations(Block block)
|
||||
{
|
||||
Map<IBlockState, ModelResourceLocation> map = (Map<IBlockState, ModelResourceLocation>) stateMap.putStateModelLocations(block);
|
||||
Map<IBlockState, ModelResourceLocation> newMap = Maps.newHashMap();
|
||||
|
||||
|
||||
for (Entry<IBlockState, ModelResourceLocation> e : map.entrySet())
|
||||
{
|
||||
ModelResourceLocation loc = e.getValue();
|
||||
newMap.put(e.getKey(), new ModelResourceLocation(ASSETS + loc.getResourcePath(), loc.getVariant()));
|
||||
}
|
||||
|
||||
|
||||
return newMap;
|
||||
}
|
||||
});
|
||||
@@ -92,41 +92,41 @@ public class ForgeBlockStatesLoaderDebug {
|
||||
ModelLoader.setCustomModelResourceLocation(customWallItem, 1, new ModelResourceLocation(ASSETS + "mossy_cobblestone_wall", "inventory"));
|
||||
ModelBakery.addVariantName(customWallItem, ASSETS + "cobblestone_wall", ASSETS + "mossy_cobblestone_wall");
|
||||
}
|
||||
|
||||
|
||||
// this block is never actually used, it's only needed for the error message on load to see the variant it maps to
|
||||
public static class CustomMappedBlock extends Block {
|
||||
public static final PropertyEnum VARIANT = PropertyEnum.create("type", CustomVariant.class);
|
||||
|
||||
|
||||
protected CustomMappedBlock() {
|
||||
super(Material.rock);
|
||||
|
||||
|
||||
this.setUnlocalizedName(MODID + ".customMappedBlock");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected BlockState createBlockState() {
|
||||
return new BlockState(this, VARIANT);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
return ((CustomVariant)state.getValue(VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
if(meta > CustomVariant.values().length || meta < 0)
|
||||
meta = 0;
|
||||
|
||||
|
||||
return this.getDefaultState().withProperty(VARIANT, CustomVariant.values()[meta]);
|
||||
}
|
||||
|
||||
|
||||
public static enum CustomVariant implements IStringSerializable {
|
||||
TypeA,
|
||||
TypeB;
|
||||
|
||||
|
||||
public String getName() { return this.toString(); };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user