fix GUI offsets and textures, finish charging table

This commit is contained in:
Adrian Siekierka 2014-11-08 10:31:47 +01:00
parent 19b3f81c91
commit b78bf28ead
21 changed files with 159 additions and 37 deletions

View file

@ -257,6 +257,8 @@ tile.blockFuel.name=Fuel
tile.blockHopper.name=Chute
tile.blockOil.name=Oil
tile.builderBlock.name=Builder
tile.chargingTableBlock.name=Charging Table
tile.constructionMarkerBlock.name=Construction Mark
tile.engineCreative.name=Creative Engine
tile.engineIron.name=Combustion Engine
tile.engineStone.name=Stirling Engine
@ -270,7 +272,6 @@ tile.laserBlock.name=Laser
tile.libraryBlock.name=Blueprint Library
tile.machineBlock.name=Quarry
tile.markerBlock.name=Land Mark
tile.constructionMarkerBlock.name=Construction Mark
tile.miningWellBlock.name=Mining Well
tile.pathMarkerBlock.name=Path Mark
tile.plainPipeBlock.name=Mining Pipe

Binary file not shown.

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 624 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 868 B

View file

@ -8,6 +8,7 @@
*/
package buildcraft;
import buildcraft.silicon.*;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
@ -56,18 +57,7 @@ import buildcraft.core.robots.boards.BoardRobotPickerNBT;
import buildcraft.core.robots.boards.BoardRobotPlanterNBT;
import buildcraft.core.robots.boards.BoardRobotPumpNBT;
import buildcraft.core.robots.boards.BoardRobotShovelmanNBT;
import buildcraft.silicon.BlockLaser;
import buildcraft.silicon.BlockLaserTable;
import buildcraft.silicon.GuiHandler;
import buildcraft.silicon.ItemLaserTable;
import buildcraft.silicon.ItemRedstoneBoard;
import buildcraft.silicon.ItemRedstoneChipset;
import buildcraft.silicon.ItemRedstoneChipset.Chipset;
import buildcraft.silicon.SiliconProxy;
import buildcraft.silicon.TileAdvancedCraftingTable;
import buildcraft.silicon.TileAssemblyTable;
import buildcraft.silicon.TileIntegrationTable;
import buildcraft.silicon.TileLaser;
import buildcraft.silicon.boards.BoardRecipe;
import buildcraft.silicon.boards.ImplRedstoneBoardRegistry;
import buildcraft.silicon.network.PacketHandlerSilicon;
@ -196,6 +186,8 @@ public class BuildCraftSilicon extends BuildCraftMod {
"net.minecraft.src.buildcraft.factory.TileAssemblyAdvancedWorkbench");
CoreProxy.proxy.registerTileEntity(TileIntegrationTable.class,
"net.minecraft.src.buildcraft.factory.TileIntegrationTable");
CoreProxy.proxy.registerTileEntity(TileChargingTable.class,
"net.minecraft.src.buildcraft.factory.TileChargingTable");
CoreProxy.proxy.registerTileEntity(TileZonePlan.class, "net.minecraft.src.buildcraft.commander.TileZonePlan");
CoreProxy.proxy.registerTileEntity(TileRequester.class, "net.minecraft.src.buildcraft.commander.TileRequester");

2
common/buildcraft/core/inventory/CrafterCopy.java Executable file → Normal file
View file

@ -56,7 +56,7 @@ public class CrafterCopy implements IFlexibleCrafter {
}
@Override
public ItemStack decrCraftingItemgStack(int slotid, int val) {
public ItemStack decrCraftingItemStack(int slotid, int val) {
ItemStack result;
if (val >= items[slotid].stackSize) {

4
common/buildcraft/core/recipes/FlexibleRecipe.java Executable file → Normal file
View file

@ -190,7 +190,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
removed = stack.copy();
removed.stackSize = expected;
} else {
removed = crafter.decrCraftingItemgStack(slotid, expected);
removed = crafter.decrCraftingItemStack(slotid, expected);
}
expected = 0;
@ -198,7 +198,7 @@ public class FlexibleRecipe<T> implements IFlexibleRecipe<T>, IFlexibleRecipeVie
if (preview) {
removed = stack.copy();
} else {
removed = crafter.decrCraftingItemgStack(slotid, stack.stackSize);
removed = crafter.decrCraftingItemStack(slotid, stack.stackSize);
}
expected -= removed.stackSize;

View file

@ -406,7 +406,7 @@ public class TileRefinery extends TileBuildCraft implements IFluidHandler, IInve
}
@Override
public ItemStack decrCraftingItemgStack(int slotid, int val) {
public ItemStack decrCraftingItemStack(int slotid, int val) {
return null;
}

View file

@ -31,6 +31,7 @@ import buildcraft.core.CreativeTabBuildCraft;
import buildcraft.core.utils.Utils;
public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBlock {
protected static final int TABLE_MAX = 4;
@SideOnly(Side.CLIENT)
private IIcon[][] icons;
@ -85,6 +86,10 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
@Override
public IIcon getIcon(int side, int meta) {
if (meta >= TABLE_MAX) {
return null;
}
int s = side > 1 ? 2 : side;
return icons[meta][s];
}
@ -98,6 +103,8 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
return new TileAdvancedCraftingTable();
case 2:
return new TileIntegrationTable();
case 3:
return new TileChargingTable();
}
return null;
}
@ -116,18 +123,18 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) {
par3List.add(new ItemStack(this, 1, 0));
par3List.add(new ItemStack(this, 1, 1));
par3List.add(new ItemStack(this, 1, 2));
for (int i = 0; i < TABLE_MAX; i++) {
par3List.add(new ItemStack(this, 1, i));
}
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[3][];
icons[0] = new IIcon[3];
icons[1] = new IIcon[3];
icons[2] = new IIcon[3];
icons = new IIcon[TABLE_MAX][];
for (int i = 0; i < TABLE_MAX; i++) {
icons[i] = new IIcon[3];
}
icons[0][0] = par1IconRegister.registerIcon("buildcraft:assemblytable_bottom");
icons[0][1] = par1IconRegister.registerIcon("buildcraft:assemblytable_top");
@ -140,5 +147,9 @@ public class BlockLaserTable extends BlockBuildCraft implements ILaserTargetBloc
icons[2][0] = par1IconRegister.registerIcon("buildcraft:integrationtable_bottom");
icons[2][1] = par1IconRegister.registerIcon("buildcraft:integrationtable_top");
icons[2][2] = par1IconRegister.registerIcon("buildcraft:integrationtable_side");
icons[3][0] = par1IconRegister.registerIcon("buildcraft:chargingtable_bottom");
icons[3][1] = par1IconRegister.registerIcon("buildcraft:chargingtable_top");
icons[3][2] = par1IconRegister.registerIcon("buildcraft:chargingtable_side");
}
}

View file

@ -8,19 +8,13 @@
*/
package buildcraft.silicon;
import buildcraft.silicon.gui.*;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import buildcraft.silicon.gui.ContainerAdvancedCraftingTable;
import buildcraft.silicon.gui.ContainerAssemblyTable;
import buildcraft.silicon.gui.ContainerIntegrationTable;
import buildcraft.silicon.gui.GuiAdvancedCraftingTable;
import buildcraft.silicon.gui.GuiAssemblyTable;
import buildcraft.silicon.gui.GuiIntegrationTable;
public class GuiHandler implements IGuiHandler {
@Override
@ -54,7 +48,14 @@ public class GuiHandler implements IGuiHandler {
return new GuiIntegrationTable(player.inventory, (TileIntegrationTable) tile);
}
default:
case 3:
if (!(tile instanceof TileChargingTable)) {
return null;
} else {
return new GuiChargingTable(player.inventory, (TileChargingTable) tile);
}
default:
return null;
}
}
@ -90,6 +91,13 @@ public class GuiHandler implements IGuiHandler {
return new ContainerIntegrationTable(player.inventory, (TileIntegrationTable) tile);
}
case 3:
if (!(tile instanceof TileChargingTable)) {
return null;
} else {
return new ContainerChargingTable(player.inventory, (TileChargingTable) tile);
}
default:
return null;
}

View file

@ -30,12 +30,14 @@ public class ItemLaserTable extends ItemBlockBuildCraft {
return "tile.assemblyWorkbenchBlock";
case 2:
return "tile.integrationTableBlock";
case 3:
return "tile.chargingTableBlock";
}
return super.getUnlocalizedName();
}
@Override
public int getMetadata(int meta) {
return meta <= 2 ? meta : 0;
return meta < BlockLaserTable.TABLE_MAX ? meta : 0;
}
}

View file

@ -322,7 +322,7 @@ public class TileAssemblyTable extends TileLaserTableBase implements IInventory,
}
@Override
public ItemStack decrCraftingItemgStack(int slotid, int val) {
public ItemStack decrCraftingItemStack(int slotid, int val) {
return decrStackSize(slotid, val);
}

View file

@ -3,9 +3,31 @@ package buildcraft.silicon;
import buildcraft.api.tiles.IHasWork;
import buildcraft.core.utils.StringUtils;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.item.ItemStack;
public class TileChargingTable extends TileLaserTableBase implements IHasWork {
@Override
public boolean canUpdate() {
return !FMLCommonHandler.instance().getEffectiveSide().isClient();
}
@Override
public void updateEntity() { // WARNING: run only server-side, see canUpdate()
super.updateEntity();
if (getEnergy() > 0) {
if (getRequiredEnergy() > 0) {
ItemStack stack = this.getStackInSlot(0);
IEnergyContainerItem containerItem = (IEnergyContainerItem) stack.getItem();
addEnergy(0 - containerItem.receiveEnergy(stack, getEnergy(), false));
this.setInventorySlotContents(0, stack);
} else {
addEnergy(-10);
}
}
}
@Override
public int getRequiredEnergy() {
ItemStack stack = this.getStackInSlot(0);

View file

@ -228,7 +228,7 @@ public class TileIntegrationTable extends TileLaserTableBase implements IFlexibl
}
@Override
public ItemStack decrCraftingItemgStack(int slotid, int val) {
public ItemStack decrCraftingItemStack(int slotid, int val) {
return decrStackSize(slotid + 3, val);
}

View file

@ -0,0 +1,58 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.silicon.gui;
import buildcraft.core.gui.BuildCraftContainer;
import buildcraft.core.gui.slots.SlotValidated;
import buildcraft.silicon.TileChargingTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
public class ContainerChargingTable extends BuildCraftContainer {
private TileChargingTable table;
public ContainerChargingTable(InventoryPlayer playerInventory, TileChargingTable table) {
super(table.getSizeInventory());
this.table = table;
addSlot(new SlotValidated(table, 0, 80, 18));
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(playerInventory, x + y * 9 + 9, 8 + x * 18, 50 + y * 18));
}
}
for (int x = 0; x < 9; x++) {
addSlotToContainer(new Slot(playerInventory, x, 8 + x * 18, 108));
}
}
@Override
public boolean canInteractWith(EntityPlayer var1) {
return table.isUseableByPlayer(var1);
}
@Override
public void updateProgressBar(int i, int j) {
table.getGUINetworkData(i, j);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (int i = 0; i < crafters.size(); i++) {
table.sendGUINetworkData(this, (ICrafting) crafters.get(i));
}
}
}

View file

@ -24,7 +24,7 @@ public class GuiAdvancedCraftingTable extends GuiLaserTable {
public GuiAdvancedCraftingTable(InventoryPlayer playerInventory, TileAdvancedCraftingTable advancedWorkbench) {
super(playerInventory, new ContainerAdvancedCraftingTable(playerInventory, advancedWorkbench), advancedWorkbench, TEXTURE);
this.workbench = advancedWorkbench;
xSize = 175;
xSize = 176;
ySize = 240;
}

View file

@ -95,7 +95,7 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
super(new ContainerAssemblyTable(playerInventory, assemblyTable), assemblyTable, TEXTURE);
this.table = assemblyTable;
xSize = 175;
xSize = 176;
ySize = 207;
for (int j = 0; j < 2; ++j) {

View file

@ -0,0 +1,28 @@
/**
* Copyright (c) 2011-2014, SpaceToad and the BuildCraft Team
* http://www.mod-buildcraft.com
*
* BuildCraft is distributed under the terms of the Minecraft Mod Public
* License 1.0, or MMPL. Please check the contents of the license located in
* http://www.mod-buildcraft.com/MMPL-1.0.txt
*/
package buildcraft.silicon.gui;
import buildcraft.core.DefaultProps;
import buildcraft.silicon.TileChargingTable;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
public class GuiChargingTable extends GuiLaserTable {
public static final ResourceLocation TEXTURE = new ResourceLocation("buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/charging_table.png");
private final TileChargingTable table;
public GuiChargingTable(InventoryPlayer playerInventory, TileChargingTable chargingTable) {
super(playerInventory, new ContainerChargingTable(playerInventory, chargingTable), chargingTable, TEXTURE);
this.table = chargingTable;
xSize = 176;
ySize = 132;
}
}

View file

@ -27,7 +27,7 @@ public class GuiIntegrationTable extends GuiLaserTable {
public GuiIntegrationTable(InventoryPlayer playerInventory, TileIntegrationTable table) {
super(playerInventory, new ContainerIntegrationTable(playerInventory, table), table, TEXTURE);
this.integrationTable = table;
xSize = 175;
xSize = 176;
ySize = 173;
}