Updated Calclavia Core

This commit is contained in:
Calclavia 2014-01-07 19:08:59 +08:00
parent 4d2e0aaab2
commit 751d040487
10 changed files with 40 additions and 42 deletions

View file

@ -47,10 +47,10 @@ import resonantinduction.transport.transformer.ItemTransformer;
import resonantinduction.transport.wire.EnumWireMaterial; import resonantinduction.transport.wire.EnumWireMaterial;
import resonantinduction.transport.wire.ItemWire; import resonantinduction.transport.wire.ItemWire;
import resonantinduction.utility.multimeter.ItemMultimeter; import resonantinduction.utility.multimeter.ItemMultimeter;
import calclavia.lib.UniversalRecipe;
import calclavia.lib.network.PacketHandler; import calclavia.lib.network.PacketHandler;
import calclavia.lib.network.PacketTile; import calclavia.lib.network.PacketTile;
import calclavia.lib.prefab.TranslationHelper; import calclavia.lib.recipe.UniversalRecipe;
import calclavia.lib.utility.LanguageUtility;
import codechicken.lib.colour.ColourRGBA; import codechicken.lib.colour.ColourRGBA;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
@ -262,16 +262,16 @@ public class ResonantInduction
@EventHandler @EventHandler
public void init(FMLInitializationEvent evt) public void init(FMLInitializationEvent evt)
{ {
LOGGER.fine("Languages Loaded:" + TranslationHelper.loadLanguages(LANGUAGE_DIRECTORY, LANGUAGES)); LOGGER.fine("Languages Loaded:" + LanguageUtility.loadLanguages(LANGUAGE_DIRECTORY, LANGUAGES));
// TODO localize this // TODO localize this
metadata.modId = ID; metadata.modId = ID;
metadata.name = NAME; metadata.name = NAME;
metadata.description = TranslationHelper.getLocal("meta.resonantinduction.description"); metadata.description = LanguageUtility.getLocal("meta.resonantinduction.description");
metadata.url = "http://calclavia.com/resonant-induction"; metadata.url = "http://calclavia.com/resonant-induction";
metadata.logoFile = "ri_logo.png"; metadata.logoFile = "ri_logo.png";
metadata.version = VERSION + "." + BUILD_VERSION; metadata.version = VERSION + "." + BUILD_VERSION;
metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Alex_hawks" }); metadata.authorList = Arrays.asList(new String[] { "Calclavia", "Alex_hawks" });
metadata.credits = TranslationHelper.getLocal("meta.resonantinduction.credits"); metadata.credits = LanguageUtility.getLocal("meta.resonantinduction.credits");
metadata.autogenerated = false; metadata.autogenerated = false;
MultipartRI.INSTANCE = new MultipartRI(); MultipartRI.INSTANCE = new MultipartRI();

View file

@ -28,8 +28,8 @@ import resonantinduction.api.MachineRecipes;
import resonantinduction.api.MachineRecipes.RecipeType; import resonantinduction.api.MachineRecipes.RecipeType;
import resonantinduction.api.OreDetectionBlackList; import resonantinduction.api.OreDetectionBlackList;
import resonantinduction.core.base.ItemBase; import resonantinduction.core.base.ItemBase;
import calclavia.lib.Calclavia; import calclavia.lib.utility.LanguageUtility;
import calclavia.lib.prefab.TranslationHelper; import calclavia.lib.utility.NBTUtility;
import cpw.mods.fml.relauncher.ReflectionHelper; import cpw.mods.fml.relauncher.ReflectionHelper;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -58,8 +58,8 @@ public class ItemDust extends ItemBase
String dustName = getDustFromStack(is); String dustName = getDustFromStack(is);
ItemStack type = OreDictionary.getOres("ingot" + dustName.substring(0, 1).toUpperCase() + dustName.substring(1)).get(0); ItemStack type = OreDictionary.getOres("ingot" + dustName.substring(0, 1).toUpperCase() + dustName.substring(1)).get(0);
String name = type.getDisplayName().replace(TranslationHelper.getLocal("misc.resonantinduction.ingot"), ""); String name = type.getDisplayName().replace(LanguageUtility.getLocal("misc.resonantinduction.ingot"), "");
return (TranslationHelper.getLocal(this.getUnlocalizedName() + ".name")).replace("%v", name).replace(" ", " "); return (LanguageUtility.getLocal(this.getUnlocalizedName() + ".name")).replace("%v", name).replace(" ", " ");
} }
@ForgeSubscribe @ForgeSubscribe
@ -192,14 +192,14 @@ public class ItemDust extends ItemBase
public static ItemStack getStackFromDust(String name) public static ItemStack getStackFromDust(String name)
{ {
ItemStack itemStack = new ItemStack(ResonantInduction.itemDust); ItemStack itemStack = new ItemStack(ResonantInduction.itemDust);
NBTTagCompound nbt = Calclavia.getNBTTagCompound(itemStack); NBTTagCompound nbt = NBTUtility.getNBTTagCompound(itemStack);
nbt.setString("name", name); nbt.setString("name", name);
return itemStack; return itemStack;
} }
public static String getDustFromStack(ItemStack itemStack) public static String getDustFromStack(ItemStack itemStack)
{ {
NBTTagCompound nbt = Calclavia.getNBTTagCompound(itemStack); NBTTagCompound nbt = NBTUtility.getNBTTagCompound(itemStack);
if (nbt.hasKey("name")) if (nbt.hasKey("name"))
{ {

View file

@ -2,9 +2,8 @@ package resonantinduction.transport.battery;
import java.util.List; import java.util.List;
import calclavia.lib.prefab.TranslationHelper;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
import calclavia.lib.utility.LanguageUtility;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
@ -49,7 +48,7 @@ public class ItemBlockBattery extends ItemBlock implements IEnergyItem, IVoltage
color = "\u00a76"; color = "\u00a76";
} }
list.add(TranslationHelper.getLocal("tooltip.battery.energy").replace("%0", color).replace("%1", EnumColor.GREY.toString()).replace("%v0", UnitDisplay.getDisplayShort(joules, Unit.JOULES)).replace("%v1", UnitDisplay.getDisplayShort(this.getEnergyCapacity(itemStack), Unit.JOULES))); list.add(LanguageUtility.getLocal("tooltip.battery.energy").replace("%0", color).replace("%1", EnumColor.GREY.toString()).replace("%v0", UnitDisplay.getDisplayShort(joules, Unit.JOULES)).replace("%v1", UnitDisplay.getDisplayShort(this.getEnergyCapacity(itemStack), Unit.JOULES)));
} }
@Override @Override

View file

@ -12,8 +12,8 @@ import resonantinduction.utility.multimeter.ContainerMultimeter;
import resonantinduction.utility.multimeter.PartMultimeter; import resonantinduction.utility.multimeter.PartMultimeter;
import universalelectricity.api.energy.UnitDisplay.Unit; import universalelectricity.api.energy.UnitDisplay.Unit;
import calclavia.lib.gui.GuiContainerBase; import calclavia.lib.gui.GuiContainerBase;
import calclavia.lib.prefab.TranslationHelper;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
import calclavia.lib.utility.LanguageUtility;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -44,7 +44,7 @@ public class GuiMultimeter extends GuiContainerBase
public void initGui() public void initGui()
{ {
super.initGui(); super.initGui();
this.buttonList.add(new GuiButton(0, this.width / 2 + 20, this.height / 2 - 30, 50, 20, TranslationHelper.getLocal("gui.resonantinduction.multimeter.toggle"))); this.buttonList.add(new GuiButton(0, this.width / 2 + 20, this.height / 2 - 30, 50, 20, LanguageUtility.getLocal("gui.resonantinduction.multimeter.toggle")));
this.textFieldLimit = new GuiTextField(fontRenderer, 35, 82, 65, 12); this.textFieldLimit = new GuiTextField(fontRenderer, 35, 82, 65, 12);
this.textFieldLimit.setMaxStringLength(8); this.textFieldLimit.setMaxStringLength(8);
this.textFieldLimit.setText("" + this.multimeter.getLimit()); this.textFieldLimit.setText("" + this.multimeter.getLimit());
@ -76,14 +76,14 @@ public class GuiMultimeter extends GuiContainerBase
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{ {
super.drawGuiContainerForegroundLayer(mouseX, mouseY); super.drawGuiContainerForegroundLayer(mouseX, mouseY);
String s = TranslationHelper.getLocal("tile.resonantinduction:multimeter.name"); String s = LanguageUtility.getLocal("tile.resonantinduction:multimeter.name");
this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752); this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 15, 4210752);
this.fontRenderer.drawString(EnumColor.DARK_GREEN + TranslationHelper.getLocal("gui.resonantinduction.multimeter.averageEnergy"), 35, 15, 4210752); this.fontRenderer.drawString(EnumColor.DARK_GREEN + LanguageUtility.getLocal("gui.resonantinduction.multimeter.averageEnergy"), 35, 15, 4210752);
this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), mouseX, mouseY, Unit.JOULES); this.renderUniversalDisplay(35, 25, this.multimeter.getAverageDetectedEnergy(), mouseX, mouseY, Unit.JOULES);
this.fontRenderer.drawString(EnumColor.DARK_GREEN + TranslationHelper.getLocal("gui.resonantinduction.multimeter.energy"), 35, 35, 4210752); this.fontRenderer.drawString(EnumColor.DARK_GREEN + LanguageUtility.getLocal("gui.resonantinduction.multimeter.energy"), 35, 35, 4210752);
this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), mouseX, mouseY, Unit.JOULES); this.renderUniversalDisplay(35, 45, this.multimeter.getDetectedEnergy(), mouseX, mouseY, Unit.JOULES);
this.fontRenderer.drawString(EnumColor.ORANGE + TranslationHelper.getLocal("gui.resonantinduction.multimeter.redstone"), 35, 58, 4210752); this.fontRenderer.drawString(EnumColor.ORANGE + LanguageUtility.getLocal("gui.resonantinduction.multimeter.redstone"), 35, 58, 4210752);
this.fontRenderer.drawString(EnumColor.RED + TranslationHelper.getLocal("gui.resonantinduction.multimeter." + this.multimeter.getMode().display), 35, 68, 4210752); this.fontRenderer.drawString(EnumColor.RED + LanguageUtility.getLocal("gui.resonantinduction.multimeter." + this.multimeter.getMode().display), 35, 68, 4210752);
this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752); this.fontRenderer.drawString(Unit.JOULES.name + "(s)", 35, 100, 4210752);
this.textFieldLimit.drawTextBox(); this.textFieldLimit.drawTextBox();

View file

@ -14,8 +14,8 @@ import resonantinduction.core.base.BlockIOBase;
import resonantinduction.core.render.BlockRenderingHandler; import resonantinduction.core.render.BlockRenderingHandler;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import universalelectricity.api.vector.VectorWorld; import universalelectricity.api.vector.VectorWorld;
import calclavia.lib.prefab.TranslationHelper;
import calclavia.lib.prefab.item.ItemCoordLink; import calclavia.lib.prefab.item.ItemCoordLink;
import calclavia.lib.utility.LanguageUtility;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -71,7 +71,7 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
if (!world.isRemote) if (!world.isRemote)
{ {
entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.toggleAttack").replace("%v", status + "")); entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.toggleAttack").replace("%v", status + ""));
} }
return true; return true;
@ -93,7 +93,7 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
{ {
tileEntity.setLink(new Vector3(((TileTesla) linkVec.getTileEntity(otherWorld)).getTopTelsa()), linkVec.world.provider.dimensionId, true); tileEntity.setLink(new Vector3(((TileTesla) linkVec.getTileEntity(otherWorld)).getTopTelsa()), linkVec.world.provider.dimensionId, true);
entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.pair").replace("%v0", this.getLocalizedName()).replace("%v1", linkVec.x + "").replace("%v2", linkVec.y + "").replace("%v3", linkVec.z + "")); entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.pair").replace("%v0", this.getLocalizedName()).replace("%v1", linkVec.x + "").replace("%v2", linkVec.y + "").replace("%v3", linkVec.z + ""));
link.clearLink(entityPlayer.getCurrentEquippedItem()); link.clearLink(entityPlayer.getCurrentEquippedItem());
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "ambient.weather.thunder", 5, 1); world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, "ambient.weather.thunder", 5, 1);
@ -122,7 +122,7 @@ public class BlockTesla extends BlockIOBase implements ITileEntityProvider
if (world.isRemote) if (world.isRemote)
{ {
entityPlayer.addChatMessage(TranslationHelper.getLocal("message.tesla.mode").replace("%v", receiveMode + "")); entityPlayer.addChatMessage(LanguageUtility.getLocal("message.tesla.mode").replace("%v", receiveMode + ""));
} }
return true; return true;

View file

@ -23,9 +23,9 @@ import resonantinduction.ResonantInduction;
import resonantinduction.api.ITesla; import resonantinduction.api.ITesla;
import universalelectricity.api.energy.EnergyStorageHandler; import universalelectricity.api.energy.EnergyStorageHandler;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.CustomDamageSource;
import calclavia.lib.network.IPacketReceiver; import calclavia.lib.network.IPacketReceiver;
import calclavia.lib.network.IPacketSender; import calclavia.lib.network.IPacketSender;
import calclavia.lib.prefab.CustomDamageSource;
import calclavia.lib.prefab.tile.TileElectrical; import calclavia.lib.prefab.tile.TileElectrical;
import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteArrayDataInput;

View file

@ -9,8 +9,8 @@ import org.lwjgl.opengl.GL11;
import resonantinduction.ResonantInduction; import resonantinduction.ResonantInduction;
import universalelectricity.api.vector.Vector3; import universalelectricity.api.vector.Vector3;
import calclavia.lib.prefab.TranslationHelper;
import calclavia.lib.render.CalclaviaRenderHelper; import calclavia.lib.render.CalclaviaRenderHelper;
import calclavia.lib.utility.LanguageUtility;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -23,7 +23,7 @@ public class RenderTransformer
public static void render(PartTransformer part, double x, double y, double z) public static void render(PartTransformer part, double x, double y, double z)
{ {
String status = TranslationHelper.getLocal((part.stepUp() ? "tooltip.transformer.stepUp" : "tooltip.transformer.stepDown")); String status = LanguageUtility.getLocal((part.stepUp() ? "tooltip.transformer.stepUp" : "tooltip.transformer.stepDown"));
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
MovingObjectPosition movingPosition = player.rayTrace(5, 1f); MovingObjectPosition movingPosition = player.rayTrace(5, 1f);

View file

@ -22,9 +22,8 @@ import resonantinduction.transport.wire.framed.PartFramedWire;
import resonantinduction.transport.wire.framed.RenderPartWire; import resonantinduction.transport.wire.framed.RenderPartWire;
import universalelectricity.api.energy.UnitDisplay; import universalelectricity.api.energy.UnitDisplay;
import universalelectricity.api.energy.UnitDisplay.Unit; import universalelectricity.api.energy.UnitDisplay.Unit;
import calclavia.lib.Calclavia;
import calclavia.lib.prefab.TranslationHelper;
import calclavia.lib.render.EnumColor; import calclavia.lib.render.EnumColor;
import calclavia.lib.utility.LanguageUtility;
import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.BlockCoord;
import codechicken.lib.vec.Vector3; import codechicken.lib.vec.Vector3;
import codechicken.multipart.ControlKeyModifer; import codechicken.multipart.ControlKeyModifer;
@ -99,14 +98,14 @@ public class ItemWire extends JItemMultiPart
{ {
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
{ {
list.add(TranslationHelper.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString())); list.add(LanguageUtility.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString()));
} }
else else
{ {
list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.resistance").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE))); list.add(EnumColor.AQUA + LanguageUtility.getLocal("tooltip.wire.resistance").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].resistance, Unit.RESISTANCE)));
list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.current").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE))); list.add(EnumColor.AQUA + LanguageUtility.getLocal("tooltip.wire.current").replace("%v", "" + EnumColor.ORANGE + UnitDisplay.getDisplay(EnumWireMaterial.values()[itemstack.getItemDamage()].maxAmps, Unit.AMPERE)));
list.add(EnumColor.AQUA + TranslationHelper.getLocal("tooltip.wire.damage").replace("%v", "" + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage)); list.add(EnumColor.AQUA + LanguageUtility.getLocal("tooltip.wire.damage").replace("%v", "" + EnumColor.ORANGE + EnumWireMaterial.values()[itemstack.getItemDamage()].damage));
list.addAll(Calclavia.splitStringPerWord(TranslationHelper.getLocal("tooltip.wire.helpText"), 5)); list.addAll(LanguageUtility.splitStringPerWord(LanguageUtility.getLocal("tooltip.wire.helpText"), 5));
} }
} }

View file

@ -16,7 +16,7 @@ import net.minecraftforge.common.ForgeDirection;
import resonantinduction.Utility; import resonantinduction.Utility;
import universalelectricity.api.CompatibilityModule; import universalelectricity.api.CompatibilityModule;
import universalelectricity.api.energy.IConductor; import universalelectricity.api.energy.IConductor;
import calclavia.lib.prefab.CustomDamageSource; import calclavia.lib.CustomDamageSource;
import codechicken.lib.data.MCDataInput; import codechicken.lib.data.MCDataInput;
import codechicken.lib.data.MCDataOutput; import codechicken.lib.data.MCDataOutput;
import codechicken.multipart.IRedstonePart; import codechicken.multipart.IRedstonePart;

View file

@ -2,7 +2,7 @@ package resonantinduction.utility.multimeter;
import java.util.List; import java.util.List;
import calclavia.lib.prefab.TranslationHelper; import calclavia.lib.utility.LanguageUtility;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -47,18 +47,18 @@ public class ItemMultimeter extends ItemMultipartBase
@Override @Override
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{ {
par3List.add(TranslationHelper.getLocal("tooltip.multimeter.line1")); par3List.add(LanguageUtility.getLocal("tooltip.multimeter.line1"));
par3List.add(TranslationHelper.getLocal("tooltip.multimeter.line2")); par3List.add(LanguageUtility.getLocal("tooltip.multimeter.line2"));
float detection = this.getDetection(itemStack); float detection = this.getDetection(itemStack);
if (detection != -1) if (detection != -1)
{ {
par3List.add(TranslationHelper.getLocal("tooltip.multimeter.lastSave").replace("%v", detection + "")); par3List.add(LanguageUtility.getLocal("tooltip.multimeter.lastSave").replace("%v", detection + ""));
} }
else else
{ {
par3List.add(TranslationHelper.getLocal("tooltip.multimeter.noSave")); par3List.add(LanguageUtility.getLocal("tooltip.multimeter.noSave"));
} }
} }
@ -69,7 +69,7 @@ public class ItemMultimeter extends ItemMultipartBase
{ {
if (!world.isRemote) if (!world.isRemote)
{ {
par2EntityPlayer.addChatMessage(TranslationHelper.getLocal("message.multimeter.onUse").replace("%v", "" + PartMultimeter.getDetectedEnergy(ForgeDirection.getOrientation(par7), world.getBlockTileEntity(x, y, z)))); par2EntityPlayer.addChatMessage(LanguageUtility.getLocal("message.multimeter.onUse").replace("%v", "" + PartMultimeter.getDetectedEnergy(ForgeDirection.getOrientation(par7), world.getBlockTileEntity(x, y, z))));
} }
return true; return true;