Patch up config stuff

This commit is contained in:
Justin Aquadro committed 2014-09-13 19:04:49 -04:00
1 parent 66de84a37b
commit 113faed30b
7 files changed
+76 -11

No files matched your search

@@ -43,6 +43,8 @@ tile.halfDrawers4.jungle.name=Compact Jungle Drawers 2x2
tile.halfDrawers4.acacia.name=Compact Acacia Drawers 2x2
tile.halfDrawers4.big_oak.name=Compact Dark Oak Drawers 2x2
tile.compDrawers.name=Compacting Drawer
storageDrawers.drawers.description=Holds %d stacks per drawer
storageDrawers.upgrade.description=Increases storage to %d times base value
@@ -64,6 +66,7 @@ storageDrawers.config.blocks.fullDrawers2=Drawers 1x2
storageDrawers.config.blocks.fullDrawers4=Drawers 2x2
storageDrawers.config.blocks.halfDrawers2=Compact Drawers 1x2
storageDrawers.config.blocks.halfDrawers4=Compact Drawers 2x2
storageDrawers.config.blocks.compDrawers=Compacting Drawer
storageDrawers.config.upgrades=Upgrade Settings
storageDrawers.config.upgrades.tooltip=Configure individual storage upgrades.
@@ -9,7 +9,9 @@ import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockWood;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -34,7 +36,9 @@ public class BlockCompDrawers extends BlockDrawers
private IIcon iconSideEtched;
public BlockCompDrawers (String blockName) {
super(blockName, 3, false);
super(Material.rock, blockName, 3, false);
setStepSound(Block.soundTypeStone);
}
@Override
@@ -67,7 +67,11 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
private IIcon iconIndicatorOff;
public BlockDrawers (String blockName, int drawerCount, boolean halfDepth) {
super(Material.wood);
this(Material.wood, blockName, drawerCount, halfDepth);
}
protected BlockDrawers (Material material, String blockName, int drawerCount, boolean halfDepth) {
super(material);
this.drawerCount = drawerCount;
this.halfDepth = halfDepth;
@@ -78,6 +78,7 @@ public class ConfigManager
public final ConfigSection sectionBlocksFullDrawers2x2 = new ConfigSection(blockSections, sectionBlocks, "fulldrawers4", "blocks.fullDrawers4");
public final ConfigSection sectionBlocksHalfDrawers1x2 = new ConfigSection(blockSections, sectionBlocks, "halfdrawers2", "blocks.halfDrawers2");
public final ConfigSection sectionBlocksHalfDrawers2x2 = new ConfigSection(blockSections, sectionBlocks, "halfdrawers4", "blocks.halfDrawers4");
public final ConfigSection sectionBlocksCompDrawers = new ConfigSection(blockSections, sectionBlocks, "compDrawers", "blocks.compDrawers");
public Map<String, ConfigSection> blockSectionsMap = new HashMap<String, ConfigSection>();
@@ -118,6 +119,9 @@ public class ConfigManager
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksHalfDrawers2x2.getQualifiedName(), "baseStorage", 2).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "enabled", true).setLanguageKey(LANG_PREFIX + "prop.enabled").setRequiresMcRestart(true);
config.get(sectionBlocksCompDrawers.getQualifiedName(), "baseStorage", 8).setLanguageKey(LANG_PREFIX + "prop.baseStorage").setRequiresWorldRestart(true);
cache.level2Mult = config.get(sectionUpgrades.getQualifiedName(), "level2Mult", 2).setLanguageKey(LANG_PREFIX + "upgrades.level2Mult").setRequiresWorldRestart(true).getInt();
cache.level3Mult = config.get(sectionUpgrades.getQualifiedName(), "level3Mult", 3).setLanguageKey(LANG_PREFIX + "upgrades.level3Mult").setRequiresWorldRestart(true).getInt();
cache.level4Mult = config.get(sectionUpgrades.getQualifiedName(), "level4Mult", 5).setLanguageKey(LANG_PREFIX + "upgrades.level4Mult").setRequiresWorldRestart(true).getInt();
@@ -6,6 +6,7 @@ import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityCompDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import com.jaquadro.minecraft.storagedrawers.item.ItemCompDrawers;
import com.jaquadro.minecraft.storagedrawers.item.ItemDrawers;
import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -45,7 +46,7 @@ public class ModBlocks
GameRegistry.registerTileEntity(TileEntityDrawers.class, ModBlocks.getQualifiedName(halfDrawers4));
}
GameRegistry.registerBlock(compDrawers, ItemDrawers.class, "compDrawers");
GameRegistry.registerBlock(compDrawers, ItemCompDrawers.class, "compDrawers");
GameRegistry.registerTileEntity(TileEntityCompDrawers.class, ModBlocks.getQualifiedName(compDrawers));
}
@@ -0,0 +1,48 @@
package com.jaquadro.minecraft.storagedrawers.item;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawersBase;
import com.jaquadro.minecraft.storagedrawers.config.ConfigManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class ItemCompDrawers extends ItemBlock
{
public ItemCompDrawers (Block block) {
super(block);
}
@Override
public boolean placeBlockAt (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) {
if (!super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata))
return false;
TileEntityDrawersBase tile = (TileEntityDrawersBase) world.getTileEntity(x, y, z);
if (tile != null) {
if (side > 1)
tile.setDirection(side);
int initCapacity = StorageDrawers.config.getBlockBaseStorage("compDrawers");
tile.setDrawerCapacity(initCapacity);
}
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
ConfigManager config = StorageDrawers.config;
int count = config.getBlockBaseStorage("compDrawers");
list.add(StatCollector.translateToLocalFormatted("storageDrawers.drawers.description", count));
}
}
@@ -40,12 +40,7 @@ public class ItemDrawers extends ItemMultiTexture
if (tile instanceof TileEntityDrawers)
((TileEntityDrawers)tile).setDrawerCount(block.drawerCount);
if (block.drawerCount == 2)
tile.setDrawerCapacity(block.halfDepth ? 4 : 8);
else if (block.drawerCount == 4)
tile.setDrawerCapacity(block.halfDepth ? 2 : 4);
else if (block.drawerCount == 3)
tile.setDrawerCapacity(8);
tile.setDrawerCapacity(getCapacityForBlock(block));
}
return true;
@@ -55,9 +50,13 @@ public class ItemDrawers extends ItemMultiTexture
@SideOnly(Side.CLIENT)
public void addInformation (ItemStack itemStack, EntityPlayer player, List list, boolean par4) {
Block block = Block.getBlockFromItem(itemStack.getItem());
ConfigManager config = StorageDrawers.config;
list.add(StatCollector.translateToLocalFormatted("storageDrawers.drawers.description", getCapacityForBlock(block)));
}
private int getCapacityForBlock (Block block) {
ConfigManager config = StorageDrawers.config;
int count = 0;
if (block == ModBlocks.fullDrawers2)
count = config.getBlockBaseStorage("fulldrawers2");
else if (block == ModBlocks.fullDrawers4)
@@ -66,7 +65,9 @@ public class ItemDrawers extends ItemMultiTexture
count = config.getBlockBaseStorage("halfdrawers2");
else if (block == ModBlocks.halfDrawers4)
count = config.getBlockBaseStorage("halfdrawers4");
else if (block == ModBlocks.compDrawers)
count = config.getBlockBaseStorage("compDrawers");
list.add(StatCollector.translateToLocalFormatted("storageDrawers.drawers.description", count));
return count;
}
}