mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-19 11:59:19 +00:00
Fix a bunch of API bugs
This commit is contained in:
1 parent
cd6d33659f
commit
ee1042200d
5 files changed
+41
-6
No files matched your search
@@ -6,12 +6,18 @@ public class StandardDataResolver implements IPackDataResolver
|
||||
{
|
||||
private String modID;
|
||||
private String[] unlocalizedNames;
|
||||
private CreativeTabs creativeTab;
|
||||
|
||||
public StandardDataResolver (String modID, String[] unlocalizedNames) {
|
||||
this.modID = modID;
|
||||
this.unlocalizedNames = unlocalizedNames;
|
||||
}
|
||||
|
||||
public StandardDataResolver (String modID, String[] unlocalizedNames, CreativeTabs creativeTab) {
|
||||
this(modID, unlocalizedNames);
|
||||
this.creativeTab = creativeTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPackModID () {
|
||||
return modID;
|
||||
@@ -45,12 +51,12 @@ public class StandardDataResolver implements IPackDataResolver
|
||||
|
||||
@Override
|
||||
public CreativeTabs getCreativeTabs (BlockType type) {
|
||||
return null;
|
||||
return creativeTab;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidMetaValue (int meta) {
|
||||
if (meta < 0 || meta >= 16)
|
||||
if (meta < 0 || meta >= unlocalizedNames.length)
|
||||
return false;
|
||||
|
||||
return unlocalizedNames != null && unlocalizedNames[meta] != null;
|
||||
@@ -76,11 +82,11 @@ public class StandardDataResolver implements IPackDataResolver
|
||||
public String getTexturePath (TextureType type, int meta) {
|
||||
switch (type) {
|
||||
case Front1:
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front1_1";
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_1";
|
||||
case Front2:
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front1_2";
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_2";
|
||||
case Front4:
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front1_4";
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_front_4";
|
||||
case Side:
|
||||
return getBaseTexturePath() + "drawers_" + getTextureMetaName(meta) + "_side";
|
||||
case SideSort:
|
||||
|
||||
@@ -33,6 +33,16 @@ public class BlockSortingDrawersPack extends BlockSortingDrawers
|
||||
setCreativeTab(ModCreativeTabs.tabStorageDrawers);
|
||||
}
|
||||
|
||||
public String[] getUnlocalizedNames () {
|
||||
String[] names = new String[16];
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (resolver.isValidMetaValue(i))
|
||||
names[i] = resolver.getUnlocalizedName(i);
|
||||
}
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item item, CreativeTabs creativeTabs, List list) {
|
||||
if (!StorageDrawers.config.cache.addonShowVanilla)
|
||||
|
||||
@@ -57,6 +57,13 @@ public class BlockTrimPack extends BlockTrim
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta) {
|
||||
meta = meta % 16;
|
||||
return iconTrim[meta];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister register) {
|
||||
|
||||
@@ -10,6 +10,10 @@ public class ItemDrawersPack extends ItemDrawers
|
||||
super(block, getUnlocalizedNames(block));
|
||||
}
|
||||
|
||||
protected ItemDrawersPack (Block block, String[] unlocalizedNames) {
|
||||
super(block, unlocalizedNames);
|
||||
}
|
||||
|
||||
private static String[] getUnlocalizedNames (Block block) {
|
||||
if (block instanceof BlockDrawersPack)
|
||||
return ((BlockDrawersPack) block).getUnlocalizedNames();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.item.pack;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.block.pack.BlockSortingDrawersPack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -13,7 +14,14 @@ import java.util.List;
|
||||
public class ItemSortingDrawersPack extends ItemDrawersPack
|
||||
{
|
||||
public ItemSortingDrawersPack (Block block) {
|
||||
super(block);
|
||||
super(block, getUnlocalizedNames(block));
|
||||
}
|
||||
|
||||
private static String[] getUnlocalizedNames (Block block) {
|
||||
if (block instanceof BlockSortingDrawersPack)
|
||||
return ((BlockSortingDrawersPack) block).getUnlocalizedNames();
|
||||
else
|
||||
return new String[16];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user