made progress for science book, for #1951
This commit is contained in:
parent
23e841f323
commit
0e408c5538
20 changed files with 167 additions and 163 deletions
|
@ -160,6 +160,7 @@ item.redstone_red_chipset.name=Redstone Chipset
|
|||
item.redstone_iron_chipset.name=Iron Chipset
|
||||
item.redstone_gold_chipset.name=Golden Chipset
|
||||
item.redstone_diamond_chipset.name=Diamond Chipset
|
||||
item.redstone_emerald_chipset.name=Emerald Chipset
|
||||
item.redstone_pulsating_chipset.name=Pulsating Chipset
|
||||
item.redstone_quartz_chipset.name=Quartz Chipset
|
||||
item.redstone_comp_chipset.name=Redstone Comp Chipset
|
||||
|
@ -248,6 +249,7 @@ tile.spring.water.name=Water Spring
|
|||
tile.tankBlock.name=Tank
|
||||
tile.energyConverter.name=Energy Converter
|
||||
tile.energyConverter.tooltip=Convert BC energy between old and new power API|Added for compatibility with other mods|while they not migrated to new power API.|Could be removed in the future.
|
||||
tile.zonePlan.name=Zone Planner
|
||||
|
||||
tile.architect.rotate=Rotate: On
|
||||
tile.architect.norotate=Rotate: Off
|
||||
|
|
BIN
buildcraft_resources/assets/buildcraft/textures/gui/science_blank.png
Executable file
BIN
buildcraft_resources/assets/buildcraft/textures/gui/science_blank.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
buildcraft_resources/assets/buildcraft/textures/gui/science_tab.png
Executable file
BIN
buildcraft_resources/assets/buildcraft/textures/gui/science_tab.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -133,11 +133,19 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
@Mod.Instance("BuildCraft|Transport")
|
||||
public static BuildCraftTransport instance;
|
||||
|
||||
public static BlockGenericPipe genericPipeBlock;
|
||||
public static float pipeDurability;
|
||||
|
||||
public static BlockGenericPipe genericPipeBlock;
|
||||
public static BlockFilteredBuffer filteredBufferBlock;
|
||||
|
||||
public static Item pipeWaterproof;
|
||||
public static Item pipeGate;
|
||||
public static Item pipeWire;
|
||||
public static Item plugItem;
|
||||
public static Item robotStationItem;
|
||||
public static Item pipeStructureCobblestone;
|
||||
public static ItemFacade facadeItem;
|
||||
|
||||
public static Item pipeItemsWood;
|
||||
public static Item pipeItemsEmerald;
|
||||
public static Item pipeItemsStone;
|
||||
|
@ -168,11 +176,7 @@ public class BuildCraftTransport extends BuildCraftMod {
|
|||
public static Item pipePowerIron;
|
||||
public static Item pipePowerGold;
|
||||
public static Item pipePowerDiamond;
|
||||
public static ItemFacade facadeItem;
|
||||
public static Item plugItem;
|
||||
public static Item robotStationItem;
|
||||
public static BlockFilteredBuffer filteredBufferBlock;
|
||||
public static Item pipeStructureCobblestone;
|
||||
|
||||
public static int groupItemsTrigger;
|
||||
public static String[] facadeBlacklist;
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
xSize = 176;
|
||||
ySize = 225;
|
||||
|
||||
slots = new AdvancedSlot[6 * 4];
|
||||
resetNullSlots(6 * 4);
|
||||
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
slots[i * 4 + j] = new ItemSlot(this, 179 + j * 18, 18 + i * 18);
|
||||
slots.set(i * 4 + j, new ItemSlot(this, 179 + j * 18, 18 + i * 18));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -70,8 +70,8 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
mc.renderEngine.bindTexture(BLUEPRINT_TEXTURE);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, 256, ySize);
|
||||
|
||||
for (int s = 0; s < slots.length; ++s) {
|
||||
((ItemSlot) slots[s]).stack = null;
|
||||
for (AdvancedSlot s : slots) {
|
||||
((ItemSlot) s).stack = null;
|
||||
}
|
||||
|
||||
Collection<ItemStack> needs = builder.getNeededItems();
|
||||
|
@ -80,11 +80,11 @@ public class GuiBuilder extends GuiAdvancedInterface {
|
|||
int s = 0;
|
||||
|
||||
for (ItemStack stack : needs) {
|
||||
if (s >= slots.length) {
|
||||
if (s >= slots.size()) {
|
||||
break;
|
||||
}
|
||||
|
||||
((ItemSlot) slots[s]).stack = stack.copy();
|
||||
((ItemSlot) slots.get(s)).stack = stack.copy();
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
*/
|
||||
package buildcraft.builders.urbanism;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -67,8 +65,6 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
|||
this.playerInventory = playerInventory;
|
||||
this.urbanist = urbanist;
|
||||
|
||||
slots = new AdvancedSlot[0];
|
||||
|
||||
urbanist.createUrbanistEntity();
|
||||
|
||||
tools [0] = new UrbanistToolBlock();
|
||||
|
@ -82,17 +78,13 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
|||
tools [8] = new UrbanistTool();
|
||||
tools [9] = new UrbanistTool();
|
||||
|
||||
LinkedList<AdvancedSlot> tmpSlots = new LinkedList<AdvancedSlot>();
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
tmpSlots.add(new ToolSlot(tools [i]));
|
||||
slots.add(new ToolSlot(tools[i]));
|
||||
}
|
||||
|
||||
for (UrbanistTool t : tools) {
|
||||
t.createSlots(this, tmpSlots);
|
||||
t.createSlots(this, slots);
|
||||
}
|
||||
|
||||
slots = tmpSlots.toArray(new AdvancedSlot [tmpSlots.size()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,8 +123,8 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
|||
drawTexturedModalRect(cornerX, cornerY, 0, 0, TOOLBAR_TEXTURE_WIDTH, TOOLBAR_TEXTURE_HEIGHT);
|
||||
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
slots [i].x = cornerX + 8 + i * 18;
|
||||
slots [i].y = cornerY + 8;
|
||||
slots.get(i).x = cornerX + 8 + i * 18;
|
||||
slots.get(i).y = cornerY + 8;
|
||||
}
|
||||
|
||||
if (selectedTool != -1) {
|
||||
|
@ -185,7 +177,7 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
int clicked = getSlotAtLocation(mouseX, mouseY);
|
||||
int clicked = getSlotIndexAtLocation(mouseX, mouseY);
|
||||
|
||||
if (clicked != -1 && clicked < 10) {
|
||||
if (clicked != selectedTool) {
|
||||
|
@ -199,7 +191,7 @@ public class GuiUrbanist extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
if (clicked != -1) {
|
||||
slots [clicked].selected();
|
||||
slots.get(clicked).selected();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*/
|
||||
package buildcraft.builders.urbanism;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
|
@ -49,7 +49,7 @@ class UrbanistTool {
|
|||
|
||||
}
|
||||
|
||||
public void createSlots(GuiUrbanist gui, LinkedList<AdvancedSlot> slots) {
|
||||
public void createSlots(GuiUrbanist gui, ArrayList<AdvancedSlot> slots) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ class UrbanistToolFiller extends UrbanistToolArea {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void createSlots(GuiUrbanist gui, LinkedList<AdvancedSlot> slots) {
|
||||
public void createSlots(GuiUrbanist gui, ArrayList<AdvancedSlot> slots) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
FillerSlot slot = new FillerSlot(gui, i);
|
||||
fillerSlots.add(slot);
|
||||
|
|
|
@ -107,15 +107,15 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
|||
cx = zonePlan.xCoord;
|
||||
cz = zonePlan.zCoord;
|
||||
|
||||
slots = new AdvancedSlot[16];
|
||||
resetNullSlots(16);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
slots[i * 4 + j] = new AreaSlot(this, 8 + 18 * i, 138 + 18 * j, EnumColor.values()[i * 4 + j]);
|
||||
slots.set(i * 4 + j, new AreaSlot(this, 8 + 18 * i, 138 + 18 * j, EnumColor.values()[i * 4 + j]));
|
||||
}
|
||||
}
|
||||
|
||||
colorSelected = (AreaSlot) slots[0];
|
||||
colorSelected = (AreaSlot) slots.get(0);
|
||||
|
||||
newSelection.setColor(0, 0, colorSelected.color.getDarkHex(), alpha);
|
||||
|
||||
|
@ -225,15 +225,7 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
|
||||
AdvancedSlot slot = null;
|
||||
|
||||
if (position < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
slot = slots[position];
|
||||
AdvancedSlot slot = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
|
||||
if (slot instanceof AreaSlot) {
|
||||
colorSelected = (AreaSlot) slot;
|
||||
|
@ -379,7 +371,7 @@ public class GuiZonePlan extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ContainerZonePlan getContainer() {
|
||||
public ContainerZonePlan getContainer() {
|
||||
return (ContainerZonePlan) super.getContainer();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.world.World;
|
|||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
|
||||
import buildcraft.core.gui.ContainerScienceBook;
|
||||
import buildcraft.core.gui.GuiScienceBook;
|
||||
import buildcraft.core.science.GuiScienceBook;
|
||||
|
||||
public class GuiHandler implements IGuiHandler {
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
*/
|
||||
package buildcraft.core.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
@ -20,15 +22,15 @@ import net.minecraft.util.ResourceLocation;
|
|||
|
||||
public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
||||
|
||||
public AdvancedSlot[] slots;
|
||||
public ArrayList<AdvancedSlot> slots = new ArrayList<AdvancedSlot>();
|
||||
|
||||
public GuiAdvancedInterface(BuildCraftContainer container, IInventory inventory, ResourceLocation texture) {
|
||||
super(container, inventory, texture);
|
||||
}
|
||||
|
||||
public int getSlotAtLocation(int i, int j) {
|
||||
for (int position = 0; position < slots.length; ++position) {
|
||||
AdvancedSlot s = slots[position];
|
||||
public int getSlotIndexAtLocation(int i, int j) {
|
||||
for (int position = 0; position < slots.size(); ++position) {
|
||||
AdvancedSlot s = slots.get(position);
|
||||
|
||||
if (s != null && i >= s.x && i <= s.x + 16 && j >= s.y && j <= s.y + 16) {
|
||||
return position;
|
||||
|
@ -37,6 +39,16 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
return -1;
|
||||
}
|
||||
|
||||
public AdvancedSlot getSlotAtLocation(int i, int j) {
|
||||
int id = getSlotIndexAtLocation(i, j);
|
||||
|
||||
if (id != -1) {
|
||||
return slots.get(id);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawBackgroundSlots() {
|
||||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
@ -65,14 +77,10 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
AdvancedSlot slot = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
|
||||
if (position != -1) {
|
||||
AdvancedSlot slot = slots[position];
|
||||
|
||||
if (slot != null) {
|
||||
slot.drawTooltip(this, mouseX, mouseY);
|
||||
}
|
||||
if (slot != null) {
|
||||
slot.drawTooltip(this, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,16 +134,18 @@ public abstract class GuiAdvancedInterface extends GuiBuildCraft {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
AdvancedSlot slot = getSlotAtLocation(mouseX - cornerX, mouseY - cornerY);
|
||||
|
||||
AdvancedSlot slot = null;
|
||||
|
||||
if (position < 0) {
|
||||
return;
|
||||
if (slot != null && slot.isDefined()) {
|
||||
slotClicked(slot);
|
||||
}
|
||||
}
|
||||
|
||||
if (slots[position].isDefined()) {
|
||||
slotClicked(slots[position]);
|
||||
public void resetNullSlots(int size) {
|
||||
slots.clear();
|
||||
|
||||
for (int i = 0; i < size; ++i) {
|
||||
slots.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -537,7 +537,7 @@ public abstract class GuiBuildCraft extends GuiContainer {
|
|||
}
|
||||
}
|
||||
|
||||
protected BuildCraftContainer getContainer() {
|
||||
public BuildCraftContainer getContainer() {
|
||||
return container;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
* 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.core.gui;
|
||||
package buildcraft.core.science;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
@ -19,10 +21,11 @@ import net.minecraft.util.IIcon;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.AdvancedSlot;
|
||||
import buildcraft.core.gui.ContainerScienceBook;
|
||||
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||
import buildcraft.core.gui.ItemSlot;
|
||||
import buildcraft.core.gui.slots.SlotHidden;
|
||||
import buildcraft.core.science.Technology;
|
||||
import buildcraft.core.science.TechnologyNBT;
|
||||
import buildcraft.core.science.Tier;
|
||||
|
||||
public class GuiScienceBook extends GuiAdvancedInterface {
|
||||
|
||||
|
@ -30,8 +33,13 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_gui.png");
|
||||
private static final ResourceLocation TEXTURE_FOCUS = new ResourceLocation(
|
||||
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_focus_gui.png");
|
||||
private static final ResourceLocation TEXTURE_INFO = new ResourceLocation(
|
||||
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_blank.png");
|
||||
|
||||
private static final ResourceLocation TEXTURE_ICONS = new ResourceLocation(
|
||||
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_icons.png");
|
||||
private static final ResourceLocation TEXTURE_TAB = new ResourceLocation(
|
||||
"buildcraft", DefaultProps.TEXTURE_PATH_GUI + "/science_tab.png");
|
||||
|
||||
private static final int EXTRA_ADVANCED_SLOTS = 1;
|
||||
|
||||
|
@ -40,6 +48,8 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
private Technology inFocus = null;
|
||||
|
||||
private GuiButton startResearch;
|
||||
private GuiButton wiki;
|
||||
private ArrayList<String> infoText = new ArrayList<String>();
|
||||
|
||||
static class EmptySlot extends AdvancedSlot {
|
||||
public EmptySlot(GuiAdvancedInterface gui, int x, int y) {
|
||||
|
@ -152,7 +162,7 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
xSize = 256;
|
||||
ySize = 181;
|
||||
|
||||
slots = new AdvancedSlot[50];
|
||||
resetNullSlots(50);
|
||||
|
||||
setTier(Tier.WoodenGear);
|
||||
}
|
||||
|
@ -165,6 +175,7 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
int j = (width - xSize) / 2;
|
||||
int k = (height - ySize) / 2;
|
||||
startResearch = new GuiButton(0, j + 10, k + 145, 70, 20, "Start");
|
||||
wiki = new GuiButton(0, j + 115, k + 145, 70, 20, "Wiki");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -184,11 +195,8 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
}
|
||||
}
|
||||
|
||||
if (inFocus == null) {
|
||||
texture = TEXTURE_BASE;
|
||||
} else {
|
||||
texture = TEXTURE_FOCUS;
|
||||
}
|
||||
bindTexture(TEXTURE_TAB);
|
||||
drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize);
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(f, mouseX, mouseY);
|
||||
|
||||
|
@ -226,6 +234,12 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
super.drawGuiContainerForegroundLayer(par1, par2);
|
||||
|
||||
if (infoText != null) {
|
||||
for (int i = 0; i < infoText.size(); ++i) {
|
||||
fontRendererObj.drawString(infoText.get(i), 10, 25 + i * 10, 0x404040);
|
||||
}
|
||||
}
|
||||
|
||||
drawTooltipForSlotAt(par1, par2);
|
||||
}
|
||||
|
||||
|
@ -233,6 +247,13 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
protected void actionPerformed(GuiButton button) {
|
||||
if (button == startResearch) {
|
||||
getContainer().startResearch(inFocus);
|
||||
} else if (button == wiki) {
|
||||
try {
|
||||
java.awt.Desktop.getDesktop().browse(
|
||||
java.net.URI.create(inFocus.getWikiLink()));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -274,8 +295,11 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
}
|
||||
|
||||
private void setTier(Tier newTier) {
|
||||
texture = TEXTURE_BASE;
|
||||
|
||||
if (inFocus != null || newTier != currentTier) {
|
||||
slots = new AdvancedSlot[50 + EXTRA_ADVANCED_SLOTS];
|
||||
resetNullSlots(50);
|
||||
|
||||
currentTier = newTier;
|
||||
|
||||
int id = 0;
|
||||
|
@ -286,7 +310,7 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
int j = id / 10;
|
||||
int i = id - j * 10;
|
||||
|
||||
slots[id] = new TechnologySlot(this, 9 + i * 18, 7 + j * 18, t);
|
||||
slots.set(id, new TechnologySlot(this, 9 + i * 18, 7 + j * 18, t));
|
||||
id++;
|
||||
}
|
||||
|
||||
|
@ -294,7 +318,7 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
int j = id / 10;
|
||||
int i = id - j * 10;
|
||||
|
||||
slots[id] = new EmptySlot(this, 9 + i * 18, 7 + j * 18);
|
||||
slots.set(id, new EmptySlot(this, 9 + i * 18, 7 + j * 18));
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
@ -316,6 +340,7 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
|
||||
private void setFocus(Technology techno) {
|
||||
inFocus = techno;
|
||||
texture = TEXTURE_FOCUS;
|
||||
|
||||
for (Object s : container.inventorySlots) {
|
||||
if (s instanceof SlotHidden) {
|
||||
|
@ -325,38 +350,36 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
}
|
||||
}
|
||||
|
||||
slots = new AdvancedSlot[5 + 3 + 1 + 10 + EXTRA_ADVANCED_SLOTS];
|
||||
|
||||
int id = 0;
|
||||
slots.clear();
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
if (techno.getPrerequisites().size() > i
|
||||
&& techno.getPrerequisites().get(i) != null) {
|
||||
slots[id++] = new TechnologySlot(this, 33, 43 + 18 * i, techno.getPrerequisites().get(i));
|
||||
slots.add(new TechnologySlot(this, 33, 43 + 18 * i, techno.getPrerequisites().get(i)));
|
||||
} else {
|
||||
id++;
|
||||
slots.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (techno.getRequirements() != null) {
|
||||
slots[id++] = new ItemSlot(this, 71 + 18 * i, 115, techno.getRequirements()[i]);
|
||||
slots.add(new ItemSlot(this, 71 + 18 * i, 115, techno.getRequirements()[i]));
|
||||
} else {
|
||||
id++;
|
||||
slots.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
slots[id++] = new TechnologySlot(this, 89, 79, techno);
|
||||
slots.add(new TechnologySlot(this, 89, 79, techno));
|
||||
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
int followupId = i * 2 + j;
|
||||
if (techno.getFollowups().size() > followupId
|
||||
&& techno.getFollowups().get(followupId) != null) {
|
||||
slots[id++] = new TechnologySlot(this, 145 + 18 * j, 43 + 18 * i, techno.getFollowups().get(
|
||||
followupId));
|
||||
slots.add(new TechnologySlot(this, 145 + 18 * j, 43 + 18 * i, techno.getFollowups().get(
|
||||
followupId)));
|
||||
} else {
|
||||
id++;
|
||||
slots.add(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,20 +390,24 @@ public class GuiScienceBook extends GuiAdvancedInterface {
|
|||
buttonList.add(startResearch);
|
||||
}
|
||||
|
||||
if (wiki != null) {
|
||||
buttonList.add(wiki);
|
||||
}
|
||||
|
||||
setExtraAdvancedSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ContainerScienceBook getContainer() {
|
||||
public ContainerScienceBook getContainer() {
|
||||
return (ContainerScienceBook) super.getContainer();
|
||||
}
|
||||
|
||||
public void setExtraAdvancedSlots() {
|
||||
slots[slots.length - 1] = new ResearchedSlot(this, 216, 28);
|
||||
slots.add(new ResearchedSlot(this, 216, 28));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGradientRect(int p1, int p2, int p3, int p4, int p5, int p6) {
|
||||
super.drawGradientRect(p1, p2, p3, p4, p5, p6);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -121,4 +121,8 @@ public abstract class Technology {
|
|||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
|
||||
}
|
||||
|
||||
public String getWikiLink() {
|
||||
return "http://www.mod-buildcraft.com/wiki/doku.php?id=techno:" + getID().replaceAll(":", "_");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraftforge.fluids.FluidStack;
|
|||
|
||||
import buildcraft.api.recipes.CraftingResult;
|
||||
import buildcraft.core.DefaultProps;
|
||||
import buildcraft.core.gui.AdvancedSlot;
|
||||
import buildcraft.core.gui.FluidSlot;
|
||||
import buildcraft.core.gui.GuiAdvancedInterface;
|
||||
import buildcraft.core.utils.StringUtils;
|
||||
|
@ -38,11 +37,9 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
|
||||
this.container = (ContainerRefinery) this.inventorySlots;
|
||||
|
||||
this.slots = new AdvancedSlot[3];
|
||||
|
||||
this.slots[0] = new FluidSlot(this, 38, 54);
|
||||
this.slots[1] = new FluidSlot(this, 126, 54);
|
||||
this.slots[2] = new FluidSlot(this, 82, 54);
|
||||
this.slots.add(new FluidSlot(this, 38, 54));
|
||||
this.slots.add(new FluidSlot(this, 126, 54));
|
||||
this.slots.add(new FluidSlot(this, 82, 54));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +72,7 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
int position = getSlotIndexAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
if (position >= 0 && position < 2) {
|
||||
if (k == 0) {
|
||||
|
@ -108,18 +105,18 @@ public class GuiRefinery extends GuiAdvancedInterface {
|
|||
Fluid filter0 = container.getFilter(0);
|
||||
Fluid filter1 = container.getFilter(1);
|
||||
|
||||
((FluidSlot) slots[0]).fluid = filter0;
|
||||
((FluidSlot) slots[0]).colorRenderCache = container.refinery.tanks[0].colorRenderCache;
|
||||
((FluidSlot) slots[1]).fluid = filter1;
|
||||
((FluidSlot) slots[1]).colorRenderCache = container.refinery.tanks[1].colorRenderCache;
|
||||
((FluidSlot) slots.get(0)).fluid = filter0;
|
||||
((FluidSlot) slots.get(0)).colorRenderCache = container.refinery.tanks[0].colorRenderCache;
|
||||
((FluidSlot) slots.get(1)).fluid = filter1;
|
||||
((FluidSlot) slots.get(1)).colorRenderCache = container.refinery.tanks[1].colorRenderCache;
|
||||
|
||||
CraftingResult<FluidStack> crafting = container.refinery.craftingResult;
|
||||
|
||||
if (crafting != null) {
|
||||
((FluidSlot) slots[2]).fluid = crafting.crafted.getFluid();
|
||||
((FluidSlot) slots[2]).colorRenderCache = crafting.crafted.getFluid().getColor(crafting.crafted);
|
||||
((FluidSlot) slots.get(2)).fluid = crafting.crafted.getFluid();
|
||||
((FluidSlot) slots.get(2)).colorRenderCache = crafting.crafted.getFluid().getColor(crafting.crafted);
|
||||
} else {
|
||||
((FluidSlot) slots[2]).fluid = null;
|
||||
((FluidSlot) slots.get(2)).fluid = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,14 +98,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
xSize = 175;
|
||||
ySize = 207;
|
||||
|
||||
slots = new AdvancedSlot[8];
|
||||
|
||||
int p = 0;
|
||||
|
||||
for (int j = 0; j < 2; ++j) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
slots[p] = new RecipeSlot(134 + 18 * j, 36 + 18 * i);
|
||||
p++;
|
||||
slots.add(new RecipeSlot(134 + 18 * j, 36 + 18 * i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,11 +111,11 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
List<CraftingResult<ItemStack>> potentialRecipes = table.getPotentialOutputs();
|
||||
Iterator<CraftingResult<ItemStack>> cur = potentialRecipes.iterator();
|
||||
|
||||
for (int p = 0; p < 8; ++p) {
|
||||
for (AdvancedSlot s : slots) {
|
||||
if (cur.hasNext()) {
|
||||
((RecipeSlot) slots[p]).crafting = cur.next();
|
||||
((RecipeSlot) s).crafting = cur.next();
|
||||
} else {
|
||||
((RecipeSlot) slots[p]).crafting = null;
|
||||
((RecipeSlot) s).crafting = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,11 +165,9 @@ public class GuiAssemblyTable extends GuiAdvancedInterface {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
if (position != -1) {
|
||||
RecipeSlot slot = (RecipeSlot) slots[position];
|
||||
RecipeSlot slot = (RecipeSlot) getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
if (slot != null) {
|
||||
if (slot.crafting == null) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -51,12 +51,11 @@ public class GuiRedstoneBoard extends GuiAdvancedInterface {
|
|||
board = RedstoneBoardRegistry.instance.getRedstoneBoard(boardNBT);
|
||||
params = board.getParameters(boardNBT);
|
||||
|
||||
slots = new AdvancedSlot[params.length];
|
||||
|
||||
for (int i = 0; i < params.length; ++i) {
|
||||
slots[i] = new ItemSlot(this, 10, 10 + i * 20);
|
||||
slots[i].drawBackround = true;
|
||||
((ItemSlot) slots[i]).stack = ((IBoardParameterStack) params[i]).getStack();
|
||||
ItemSlot s = new ItemSlot(this, 10, 10 + i * 20);
|
||||
slots.add(s);
|
||||
s.drawBackround = true;
|
||||
s.stack = ((IBoardParameterStack) params[i]).getStack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +89,7 @@ public class GuiRedstoneBoard extends GuiAdvancedInterface {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
int position = getSlotIndexAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
AdvancedSlot slot = null;
|
||||
|
||||
|
@ -98,7 +97,7 @@ public class GuiRedstoneBoard extends GuiAdvancedInterface {
|
|||
return;
|
||||
}
|
||||
|
||||
slot = slots[position];
|
||||
slot = slots.get(position);
|
||||
|
||||
if (slot instanceof ItemSlot) {
|
||||
ItemStack stackCopy = mc.thePlayer.inventory.getItemStack().copy();
|
||||
|
|
|
@ -216,91 +216,82 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
int position = 0;
|
||||
|
||||
if (gate.material == GateMaterial.REDSTONE) {
|
||||
slots = new AdvancedSlot[2];
|
||||
|
||||
slots[0] = new TriggerSlot(62, 26, pipe, 0);
|
||||
slots[1] = new ActionSlot(98, 26, pipe, 0);
|
||||
slots.add(new TriggerSlot(62, 26, pipe, 0));
|
||||
slots.add(new ActionSlot(98, 26, pipe, 0));
|
||||
} else if (gate.material == GateMaterial.IRON) {
|
||||
slots = new AdvancedSlot[4];
|
||||
|
||||
slots[0] = new TriggerSlot(62, 26, pipe, 0);
|
||||
slots[1] = new TriggerSlot(62, 44, pipe, 1);
|
||||
slots[2] = new ActionSlot(98, 26, pipe, 0);
|
||||
slots[3] = new ActionSlot(98, 44, pipe, 1);
|
||||
slots.add(new TriggerSlot(62, 26, pipe, 0));
|
||||
slots.add(new TriggerSlot(62, 44, pipe, 1));
|
||||
slots.add(new ActionSlot(98, 26, pipe, 0));
|
||||
slots.add(new ActionSlot(98, 44, pipe, 1));
|
||||
} else if (gate.material == GateMaterial.GOLD) {
|
||||
slots = new AdvancedSlot[12];
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new TriggerSlot(53, 26 + 18 * k, pipe, position);
|
||||
slots.add(new TriggerSlot(53, 26 + 18 * k, pipe, position));
|
||||
position++;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new ActionSlot(107, 26 + 18 * k, pipe, position - 4);
|
||||
slots.add(new ActionSlot(107, 26 + 18 * k, pipe, position - 4));
|
||||
position++;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new TriggerParameterSlot(71, 26 + 18 * k, pipe, 0, (TriggerSlot) slots[k]);
|
||||
slots.add(new TriggerParameterSlot(71, 26 + 18 * k, pipe, 0, (TriggerSlot) slots.get(k)));
|
||||
position++;
|
||||
|
||||
}
|
||||
} else if (gate.material == GateMaterial.DIAMOND) {
|
||||
slots = new AdvancedSlot[24];
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new TriggerSlot(8, 26 + 18 * k, pipe, position);
|
||||
slots.add(new TriggerSlot(8, 26 + 18 * k, pipe, position));
|
||||
position++;
|
||||
slots[position] = new TriggerSlot(98, 26 + 18 * k, pipe, position);
|
||||
slots.add(new TriggerSlot(98, 26 + 18 * k, pipe, position));
|
||||
position++;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new ActionSlot(62, 26 + 18 * k, pipe, position - 8);
|
||||
slots.add(new ActionSlot(62, 26 + 18 * k, pipe, position - 8));
|
||||
position++;
|
||||
slots[position] = new ActionSlot(152, 26 + 18 * k, pipe, position - 8);
|
||||
slots.add(new ActionSlot(152, 26 + 18 * k, pipe, position - 8));
|
||||
position++;
|
||||
}
|
||||
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
slots[position] = new TriggerParameterSlot(26, 26 + 18 * k, pipe, 0,
|
||||
(TriggerSlot) slots[k]);
|
||||
slots.add(new TriggerParameterSlot(26, 26 + 18 * k, pipe, 0,
|
||||
(TriggerSlot) slots.get(k)));
|
||||
position++;
|
||||
slots[position] = new TriggerParameterSlot(116, 26 + 18 * k, pipe, 0,
|
||||
(TriggerSlot) slots[k + 4]);
|
||||
slots.add(new TriggerParameterSlot(116, 26 + 18 * k, pipe, 0,
|
||||
(TriggerSlot) slots.get(k + 4)));
|
||||
position++;
|
||||
}
|
||||
} else if (gate.material == GateMaterial.EMERALD) {
|
||||
slots = new AdvancedSlot[32];
|
||||
int lastPos;
|
||||
|
||||
for (int y = 0; y < 4; ++y) {
|
||||
slots[position] = new TriggerSlot(8, 26 + 18 * y, pipe, y);
|
||||
slots.add(new TriggerSlot(8, 26 + 18 * y, pipe, y));
|
||||
lastPos = position;
|
||||
position++;
|
||||
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
slots[position] = new TriggerParameterSlot(
|
||||
slots.add(new TriggerParameterSlot(
|
||||
8 + 18 * (x + 1),
|
||||
26 + 18 * y,
|
||||
pipe,
|
||||
x,
|
||||
(TriggerSlot) slots[lastPos]);
|
||||
(TriggerSlot) slots.get(lastPos)));
|
||||
|
||||
position++;
|
||||
}
|
||||
|
||||
slots[position] = new ActionSlot(98, 26 + 18 * y, pipe, y);
|
||||
slots.add(new ActionSlot(98, 26 + 18 * y, pipe, y));
|
||||
lastPos = position;
|
||||
position++;
|
||||
|
||||
for (int x = 0; x < 3; ++x) {
|
||||
slots[position] = new ActionParameterSlot(
|
||||
slots.add(new ActionParameterSlot(
|
||||
98 + 18 * (x + 1),
|
||||
26 + 18 * y,
|
||||
pipe,
|
||||
x,
|
||||
(ActionSlot) slots[lastPos]);
|
||||
(ActionSlot) slots.get(lastPos)));
|
||||
position++;
|
||||
}
|
||||
}
|
||||
|
@ -384,15 +375,8 @@ public class GuiGateInterface extends GuiAdvancedInterface {
|
|||
int cornerX = (width - xSize) / 2;
|
||||
int cornerY = (height - ySize) / 2;
|
||||
|
||||
int position = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
AdvancedSlot slot = null;
|
||||
|
||||
if (position < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
slot = slots[position];
|
||||
AdvancedSlot slot = getSlotAtLocation(i - cornerX, j - cornerY);
|
||||
|
||||
if (slot instanceof TriggerSlot && container.hasTriggers()) {
|
||||
TriggerSlot triggerSlot = (TriggerSlot) slot;
|
||||
|
|
Loading…
Reference in a new issue