add translations for gui's
This commit is contained in:
@@ -23,7 +23,7 @@ import storagecraft.proxy.CommonProxy;
|
||||
|
||||
@Mod(modid = SC.ID, version = SC.VERSION)
|
||||
public class SC {
|
||||
public static class GUI {
|
||||
public static final class GUI {
|
||||
public static final int CONTROLLER = 0;
|
||||
public static final int GRID = 1;
|
||||
public static final int DRIVE = 2;
|
||||
@@ -90,11 +90,8 @@ public class SC {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @author cpw
|
||||
* @see https://github.com/cpw/ironchest/blob/master/src/main/java/cpw/mods/ironchest/BlockIronChest.java#L195
|
||||
*/
|
||||
public static void dropInventoryContent(World world, IInventory inventory, int xCoord, int yCoord, int zCoord, int newSize) {
|
||||
// https://github.com/cpw/ironchest/blob/master/src/main/java/cpw/mods/ironchest/BlockIronChest.java#L200
|
||||
public static void dropInventory(World world, IInventory inventory, int x, int y, int z, int newSize) {
|
||||
Random random = world.rand;
|
||||
|
||||
for (int i = newSize; i < inventory.getSizeInventory(); ++i) {
|
||||
@@ -104,30 +101,30 @@ public class SC {
|
||||
continue;
|
||||
}
|
||||
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = random.nextFloat() * 0.8F + 0.1F;
|
||||
float xx = random.nextFloat() * 0.8F + 0.1F;
|
||||
float yy = random.nextFloat() * 0.8F + 0.1F;
|
||||
float zz = random.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (stack.stackSize > 0) {
|
||||
int i1 = random.nextInt(21) + 10;
|
||||
int amount = random.nextInt(21) + 10;
|
||||
|
||||
if (i1 > stack.stackSize) {
|
||||
i1 = stack.stackSize;
|
||||
if (amount > stack.stackSize) {
|
||||
amount = stack.stackSize;
|
||||
}
|
||||
|
||||
stack.stackSize -= i1;
|
||||
stack.stackSize -= amount;
|
||||
|
||||
EntityItem entityItem = new EntityItem(world, (float) xCoord + f, (float) yCoord + (newSize > 0 ? 1 : 0) + f1, (float) zCoord + f2, new ItemStack(stack.getItem(), i1, stack.getItemDamage()));
|
||||
EntityItem entity = new EntityItem(world, (float) x + xx, (float) y + (newSize > 0 ? 1 : 0) + yy, (float) z + zz, new ItemStack(stack.getItem(), amount, stack.getItemDamage()));
|
||||
|
||||
entityItem.motionX = (float) random.nextGaussian() * 0.05F;
|
||||
entityItem.motionY = (float) random.nextGaussian() * 0.05F + 0.2F;
|
||||
entityItem.motionZ = (float) random.nextGaussian() * 0.05F;
|
||||
entity.motionX = (float) random.nextGaussian() * 0.05F;
|
||||
entity.motionY = (float) random.nextGaussian() * 0.05F + 0.2F;
|
||||
entity.motionZ = (float) random.nextGaussian() * 0.05F;
|
||||
|
||||
if (stack.hasTagCompound()) {
|
||||
entityItem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
entity.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
world.spawnEntityInWorld(entityItem);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -64,7 +64,7 @@ public class BlockSC extends Block {
|
||||
TileEntity tile = world.getTileEntity(x, y, z);
|
||||
|
||||
if (tile instanceof IInventory) {
|
||||
SC.dropInventoryContent(world, (IInventory) tile, x, y, z, 0);
|
||||
SC.dropInventory(world, (IInventory) tile, x, y, z, 0);
|
||||
}
|
||||
|
||||
super.onBlockPreDestroy(world, x, y, z, meta);
|
||||
|
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import storagecraft.inventory.ContainerController;
|
||||
import storagecraft.tile.TileController;
|
||||
@@ -45,14 +46,14 @@ public class GuiController extends GuiContainer {
|
||||
|
||||
drawTexturedModalRect(barX, barY + barHeight - newBarHeight, 178, 0, barWidth, newBarHeight);
|
||||
|
||||
fontRendererObj.drawString("Controller", x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString("Inventory", x + 7, y + 96, 4210752);
|
||||
fontRendererObj.drawString("Energy usage: " + controller.getEnergyUsage() + " RF/t", x + 45, y + 24, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.storagecraft:controller"), x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), x + 7, y + 96, 4210752);
|
||||
fontRendererObj.drawString(String.format(StatCollector.translateToLocal("gui.storagecraft:controller.energyUsage"), controller.getEnergyUsage()), x + 45, y + 24, 4210752);
|
||||
|
||||
if (mouseX >= barX && mouseX <= barX + barWidth && mouseY >= barY && mouseY <= barY + barHeight) {
|
||||
List<String> lines = new ArrayList<String>();
|
||||
|
||||
lines.add(energy + " / " + maxEnergy + " RF");
|
||||
lines.add(String.format(StatCollector.translateToLocal("misc.storagecraft:energyStored"), energy, maxEnergy));
|
||||
|
||||
drawHoveringText(lines, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ package storagecraft.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import storagecraft.inventory.ContainerDrive;
|
||||
|
||||
@@ -26,7 +27,7 @@ public class GuiDrive extends GuiContainer {
|
||||
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
fontRendererObj.drawString("Drive", x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString("Inventory", x + 7, y + 96, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.storagecraft:drive"), x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), x + 7, y + 96, 4210752);
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import storagecraft.SC;
|
||||
@@ -41,8 +42,8 @@ public class GuiGrid extends GuiContainer {
|
||||
|
||||
drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
|
||||
|
||||
fontRendererObj.drawString("Grid", x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString("Inventory", x + 7, y + 96, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("gui.storagecraft:grid"), x + 7, y + 7, 4210752);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), x + 7, y + 96, 4210752);
|
||||
|
||||
int xx = getGridXStart();
|
||||
int yy = getGridYStart();
|
||||
|
@@ -1,5 +1,12 @@
|
||||
itemGroup.storagecraft=StorageCraft
|
||||
|
||||
gui.storagecraft:controller=Controller
|
||||
gui.storagecraft:controller.energyUsage=Energy Usage: %d RF/t
|
||||
gui.storagecraft:grid=Grid
|
||||
gui.storagecraft:drive=Drive
|
||||
|
||||
misc.storagecraft:energyStored=%d / %d RF
|
||||
|
||||
block.storagecraft:controller.name=Controller
|
||||
block.storagecraft:cable.name=Cable
|
||||
block.storagecraft:grid.name=Grid
|
||||
|
Reference in New Issue
Block a user