├── logs └── latest.log ├── README.md ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── java │ └── vswe │ │ └── production │ │ ├── network │ │ ├── IBitCount.java │ │ ├── LengthCount.java │ │ ├── BasicCount.java │ │ ├── MaxCount.java │ │ ├── PacketId.java │ │ ├── StandardCounts.java │ │ ├── data │ │ │ ├── DataLit.java │ │ │ ├── DataBase.java │ │ │ ├── DataFuel.java │ │ │ ├── DataLava.java │ │ │ ├── DataPage.java │ │ │ ├── DataUnit.java │ │ │ ├── DataType.java │ │ │ └── DataSide.java │ │ ├── PacketHandler.java │ │ ├── DataReader.java │ │ └── DataWriter.java │ │ ├── nei │ │ ├── INEICallback.java │ │ ├── Overlay.java │ │ ├── NEICallback.java │ │ ├── NEIProductionConfig.java │ │ └── OverlayWrapper.java │ │ ├── gui │ │ ├── container │ │ │ ├── slot │ │ │ │ ├── SlotPlayer.java │ │ │ │ ├── SlotUnitFurnaceInput.java │ │ │ │ ├── SlotTable.java │ │ │ │ ├── SlotUnit.java │ │ │ │ ├── SlotValidity.java │ │ │ │ ├── SlotFuel.java │ │ │ │ ├── SlotUnitFurnaceQueue.java │ │ │ │ ├── SlotUnitCraftingOutput.java │ │ │ │ ├── SlotUnitCraftingStorage.java │ │ │ │ ├── SlotUnitFurnaceResult.java │ │ │ │ ├── SlotUnitCraftingResult.java │ │ │ │ ├── SlotUnitCraftingGrid.java │ │ │ │ ├── SlotUpgrade.java │ │ │ │ └── SlotBase.java │ │ │ └── ContainerTable.java │ │ ├── GuiHandler.java │ │ ├── component │ │ │ ├── Button.java │ │ │ ├── CheckBox.java │ │ │ ├── ArrowScroll.java │ │ │ └── TextBox.java │ │ ├── menu │ │ │ ├── GuiMenu.java │ │ │ └── GuiMenuItem.java │ │ ├── GuiTable.java │ │ └── GuiBase.java │ │ ├── page │ │ ├── setting │ │ │ ├── ItemSetting.java │ │ │ ├── SettingNormal.java │ │ │ ├── SettingCoal.java │ │ │ ├── Direction.java │ │ │ ├── Setting.java │ │ │ ├── TransferMode.java │ │ │ ├── Side.java │ │ │ └── Transfer.java │ │ ├── Page.java │ │ ├── PageMain.java │ │ ├── unit │ │ │ ├── UnitSmelting.java │ │ │ └── Unit.java │ │ ├── PageUpgrades.java │ │ └── PageTransfer.java │ │ ├── creativetab │ │ └── CreativeTabProduction.java │ │ ├── config │ │ └── ConfigLoader.java │ │ ├── block │ │ ├── ModBlocks.java │ │ └── BlockTable.java │ │ ├── StevesProduction.java │ │ └── item │ │ ├── ItemUpgrade.java │ │ ├── ModItems.java │ │ └── Upgrade.java │ └── resources │ ├── assets │ └── production │ │ └── textures │ │ ├── blocks │ │ ├── back.png │ │ ├── bot.png │ │ ├── left.png │ │ ├── top.png │ │ ├── Thumbs.db │ │ ├── front.png │ │ └── right.png │ │ ├── gui │ │ ├── Thumbs.db │ │ ├── elements.png │ │ └── background.png │ │ └── items │ │ ├── Thumbs.db │ │ ├── blank.png │ │ ├── lava.png │ │ ├── queue.png │ │ ├── solar.png │ │ ├── speed.png │ │ ├── charged.png │ │ ├── filter.png │ │ ├── pattern.png │ │ ├── restock.png │ │ ├── storage.png │ │ ├── efficiency.png │ │ ├── transfer.png │ │ ├── auto_crafter.png │ │ └── auto_transfer.png │ └── mcmod.info └── .gitignore /logs/latest.log: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Steve's Production 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/IBitCount.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | 4 | public interface IBitCount { 5 | int getBitCount(); 6 | } 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | eclipse/ 2 | build/ 3 | *.iml 4 | *.iws 5 | *.ipr 6 | .gradle/ 7 | libs/ 8 | out/ 9 | *.lnk 10 | *.py 11 | *.bat 12 | *gradle 13 | *gradlew 14 | logs/ -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/back.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/bot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/bot.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/left.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/top.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/gui/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/gui/Thumbs.db -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/Thumbs.db -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/blank.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/lava.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/lava.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/queue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/queue.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/solar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/solar.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/speed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/speed.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/Thumbs.db -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/front.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/front.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/blocks/right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/blocks/right.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/gui/elements.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/gui/elements.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/charged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/charged.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/filter.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/pattern.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/restock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/restock.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/storage.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/gui/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/gui/background.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/efficiency.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/efficiency.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/transfer.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/auto_crafter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/auto_crafter.png -------------------------------------------------------------------------------- /src/main/resources/assets/production/textures/items/auto_transfer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vswe/Production/HEAD/src/main/resources/assets/production/textures/items/auto_transfer.png -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/LengthCount.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | 4 | public class LengthCount extends MaxCount { 5 | public LengthCount(int length) { 6 | super(length - 1); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Jun 11 01:18:37 CEST 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-all.zip 7 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/BasicCount.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | 4 | public class BasicCount implements IBitCount { 5 | private final int count; 6 | 7 | public BasicCount(int count) { 8 | this.count = count; 9 | } 10 | 11 | @Override 12 | public int getBitCount() { 13 | return count; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/MaxCount.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | 4 | public class MaxCount implements IBitCount { 5 | private int bits; 6 | 7 | public MaxCount(int max) { 8 | bits = (int)(Math.log10(max + 1) / Math.log10(2)) + 1; 9 | } 10 | 11 | @Override 12 | public int getBitCount() { 13 | return bits; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/nei/INEICallback.java: -------------------------------------------------------------------------------- 1 | package vswe.production.nei; 2 | 3 | 4 | import vswe.production.page.unit.Unit; 5 | 6 | /** 7 | * This interface exists so the rest of the mod can refer to a few nei call back actions without knowing anything 8 | * at all whether nei exists nor what it does. 9 | */ 10 | public interface INEICallback { 11 | void onArrowClick(Unit unit); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "modid": "StevesWorkshop", 4 | "name": "Steve's Workshop", 5 | "description": "Adds a modular production table for crafting and smelting", 6 | "version": "${version}", 7 | "mcversion": "${mcversion}", 8 | "authorList": [ 9 | "Vswe" 10 | ], 11 | "credits": "Thanks to CyanideX for the block and item icons", 12 | "screenshots": [], 13 | "dependencies": [] 14 | } 15 | ] 16 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/PacketId.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | 4 | public enum PacketId { 5 | ALL(true), 6 | TYPE(true), 7 | CLOSE(false), 8 | UPGRADE_CHANGE(true), 9 | RE_OPEN(true), 10 | CLEAR(true); 11 | 12 | private boolean inInterface; 13 | 14 | PacketId(boolean inInterface) { 15 | this.inInterface = inInterface; 16 | } 17 | 18 | public boolean isInInterface() { 19 | return inInterface; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/StandardCounts.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network; 2 | 3 | public enum StandardCounts implements IBitCount { 4 | BOOLEAN(1), 5 | BYTE(8), 6 | SHORT(16), 7 | INTEGER(32), 8 | NBT_LENGTH(15), 9 | DEFAULT_STRING(31); 10 | 11 | private int bitCount; 12 | 13 | StandardCounts(int bitCount) { 14 | this.bitCount = bitCount; 15 | } 16 | 17 | @Override 18 | public int getBitCount() { 19 | return bitCount; 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/vswe/production/nei/Overlay.java: -------------------------------------------------------------------------------- 1 | package vswe.production.nei; 2 | 3 | import codechicken.nei.recipe.DefaultOverlayHandler; 4 | 5 | 6 | public class Overlay extends DefaultOverlayHandler { 7 | private int offsetX; 8 | private int offsetY; 9 | Overlay(int x, int y) { 10 | super(x, y); 11 | this.offsetX = x; 12 | this.offsetY = y; 13 | } 14 | 15 | public int getOffsetX() { 16 | return offsetX; 17 | } 18 | 19 | public int getOffsetY() { 20 | return offsetY; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/data/DataLit.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network.data; 2 | 3 | import vswe.production.network.DataReader; 4 | import vswe.production.network.DataWriter; 5 | import vswe.production.tileentity.TileEntityTable; 6 | 7 | 8 | public class DataLit extends DataBase { 9 | @Override 10 | public void save(TileEntityTable table, DataWriter dw, int id) { 11 | dw.writeBoolean(table.isLit()); 12 | } 13 | 14 | @Override 15 | public void load(TileEntityTable table, DataReader dr, int id) { 16 | table.setLit(dr.readBoolean()); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/data/DataBase.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network.data; 2 | 3 | 4 | import vswe.production.network.DataReader; 5 | import vswe.production.network.DataWriter; 6 | import vswe.production.tileentity.TileEntityTable; 7 | 8 | public abstract class DataBase { 9 | public abstract void save(TileEntityTable table, DataWriter dw, int id); 10 | public abstract void load(TileEntityTable table, DataReader dr, int id); 11 | public boolean shouldBounce(TileEntityTable table) { 12 | return true; 13 | } 14 | public boolean shouldBounceToAll(TileEntityTable table) { 15 | return false; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/nei/NEICallback.java: -------------------------------------------------------------------------------- 1 | package vswe.production.nei; 2 | 3 | 4 | import codechicken.nei.recipe.GuiCraftingRecipe; 5 | import vswe.production.page.unit.Unit; 6 | import vswe.production.page.unit.UnitCrafting; 7 | import vswe.production.page.unit.UnitSmelting; 8 | 9 | public class NEICallback implements INEICallback { 10 | 11 | @Override 12 | public void onArrowClick(Unit unit) { 13 | if (unit instanceof UnitCrafting) { 14 | GuiCraftingRecipe.openRecipeGui("crafting"); 15 | }else if(unit instanceof UnitSmelting) { 16 | GuiCraftingRecipe.openRecipeGui("smelting"); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotPlayer.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import net.minecraft.inventory.IInventory; 4 | import vswe.production.gui.GuiBase; 5 | import vswe.production.tileentity.TileEntityTable; 6 | 7 | 8 | public class SlotPlayer extends SlotBase { 9 | public SlotPlayer(IInventory inventory, TileEntityTable table, int id, int x, int y) { 10 | super(inventory, table, id, x, y); 11 | } 12 | 13 | @Override 14 | public int getTextureIndex(GuiBase gui) { 15 | return shouldHighlight(gui.getSelectedSlot(), this) && gui.getSelectedSlot().shouldSlotHighlightItems() ? 3 : super.getTextureIndex(gui); 16 | } 17 | 18 | @Override 19 | public boolean shouldSlotHighlightItems() { 20 | return false; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/data/DataFuel.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network.data; 2 | 3 | import vswe.production.network.DataReader; 4 | import vswe.production.network.DataWriter; 5 | import vswe.production.network.IBitCount; 6 | import vswe.production.network.MaxCount; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | 10 | public class DataFuel extends DataBase { 11 | private static IBitCount FUEL_BIT_COUNT = new MaxCount(TileEntityTable.MAX_POWER); 12 | 13 | @Override 14 | public void save(TileEntityTable table, DataWriter dw, int id) { 15 | dw.writeData(table.getPower(), FUEL_BIT_COUNT); 16 | } 17 | 18 | @Override 19 | public void load(TileEntityTable table, DataReader dr, int id) { 20 | table.setPower(dr.readData(FUEL_BIT_COUNT)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/data/DataLava.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network.data; 2 | 3 | import vswe.production.network.DataReader; 4 | import vswe.production.network.DataWriter; 5 | import vswe.production.network.IBitCount; 6 | import vswe.production.network.MaxCount; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | 10 | public class DataLava extends DataBase { 11 | private static IBitCount LAVA_BIT_COUNT = new MaxCount(TileEntityTable.MAX_LAVA); 12 | 13 | @Override 14 | public void save(TileEntityTable table, DataWriter dw, int id) { 15 | dw.writeData(table.getLava(), LAVA_BIT_COUNT); 16 | } 17 | 18 | @Override 19 | public void load(TileEntityTable table, DataReader dr, int id) { 20 | table.setLava(dr.readData(LAVA_BIT_COUNT)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/network/data/DataPage.java: -------------------------------------------------------------------------------- 1 | package vswe.production.network.data; 2 | 3 | 4 | import vswe.production.network.BasicCount; 5 | import vswe.production.network.DataReader; 6 | import vswe.production.network.DataWriter; 7 | import vswe.production.network.IBitCount; 8 | import vswe.production.tileentity.TileEntityTable; 9 | 10 | public class DataPage extends DataBase { 11 | private static final IBitCount BITS = new BasicCount(2); 12 | 13 | @Override 14 | public void save(TileEntityTable table, DataWriter dw, int id) { 15 | dw.writeData(table.getSelectedPage().getId(), BITS); 16 | } 17 | 18 | @Override 19 | public void load(TileEntityTable table, DataReader dr, int id) { 20 | table.setSelectedPage(table.getPages().get(dr.readData(BITS))); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/setting/ItemSetting.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page.setting; 2 | 3 | 4 | import net.minecraft.item.ItemStack; 5 | 6 | public class ItemSetting { 7 | public static final int ITEM_COUNT = 10; 8 | 9 | private int id; 10 | private ItemStack item; 11 | private TransferMode mode = TransferMode.PRECISE; 12 | 13 | 14 | public ItemSetting(int id) { 15 | this.id = id; 16 | } 17 | 18 | public ItemStack getItem() { 19 | return item; 20 | } 21 | 22 | public void setItem(ItemStack item) { 23 | this.item = item; 24 | } 25 | 26 | public int getId() { 27 | return id; 28 | } 29 | 30 | public TransferMode getMode() { 31 | return mode; 32 | } 33 | 34 | public void setMode(TransferMode mode) { 35 | this.mode = mode; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnitFurnaceInput.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import net.minecraft.item.crafting.FurnaceRecipes; 5 | import vswe.production.page.Page; 6 | import vswe.production.page.unit.Unit; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | 10 | public class SlotUnitFurnaceInput extends SlotUnit { 11 | public SlotUnitFurnaceInput(TileEntityTable table, Page page, int id, int x, int y, Unit unit) { 12 | super(table, page, id, x, y, unit); 13 | } 14 | 15 | @Override 16 | public boolean isItemValid(ItemStack itemstack) { 17 | return super.isItemValid(itemstack) && FurnaceRecipes.smelting().getSmeltingResult(itemstack) != null; 18 | } 19 | 20 | @Override 21 | public boolean canShiftClickInto(ItemStack item) { 22 | return true; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotTable.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import vswe.production.gui.GuiBase; 4 | import vswe.production.page.Page; 5 | import vswe.production.tileentity.TileEntityTable; 6 | 7 | 8 | public class SlotTable extends SlotBase { 9 | private Page page; 10 | 11 | public SlotTable(TileEntityTable table, Page page, int id, int x, int y) { 12 | super(table, table, id, x, y); 13 | 14 | this.page = page; 15 | } 16 | 17 | @Override 18 | public boolean isVisible() { 19 | return super.isVisible() && (page == null || page.equals(table.getSelectedPage())); 20 | } 21 | 22 | @Override 23 | public int getTextureIndex(GuiBase gui) { 24 | return shouldSlotHighlightSelf() && shouldHighlight(this, gui.getSelectedSlot()) && gui.getSelectedSlot() instanceof SlotPlayer ? 3 : super.getTextureIndex(gui); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/nei/NEIProductionConfig.java: -------------------------------------------------------------------------------- 1 | package vswe.production.nei; 2 | 3 | 4 | import codechicken.nei.api.API; 5 | import codechicken.nei.api.IConfigureNEI; 6 | import vswe.production.StevesProduction; 7 | import vswe.production.gui.GuiTable; 8 | 9 | @SuppressWarnings("UnusedDeclaration") 10 | public class NEIProductionConfig implements IConfigureNEI { 11 | @Override 12 | public void loadConfig() { 13 | OverlayWrapper overlay = new OverlayWrapper(); 14 | API.registerGuiOverlay(GuiTable.class, "crafting", overlay); 15 | API.registerGuiOverlayHandler(GuiTable.class, overlay, "crafting"); 16 | StevesProduction.nei = new NEICallback(); 17 | } 18 | 19 | @Override 20 | public String getName() { 21 | return StevesProduction.NAME; 22 | } 23 | 24 | @Override 25 | public String getVersion() { 26 | return StevesProduction.VERSION; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/creativetab/CreativeTabProduction.java: -------------------------------------------------------------------------------- 1 | package vswe.production.creativetab; 2 | 3 | import net.minecraft.block.Block; 4 | import net.minecraft.creativetab.CreativeTabs; 5 | import net.minecraft.item.Item; 6 | import vswe.production.StevesProduction; 7 | 8 | 9 | public class CreativeTabProduction extends CreativeTabs { 10 | private Item item; 11 | 12 | public CreativeTabProduction() { 13 | super("steves_production"); 14 | tab = this; 15 | } 16 | 17 | @Override 18 | public Item getTabIconItem() { 19 | return item; 20 | } 21 | 22 | public void init(Block block) { 23 | item = Item.getItemFromBlock(block); 24 | } 25 | 26 | private static CreativeTabProduction tab; 27 | public static CreativeTabProduction getTab() { 28 | return tab; 29 | } 30 | 31 | @Override 32 | public String getTranslatedTabLabel() { 33 | return StevesProduction.NAME; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnit.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import vswe.production.page.Page; 5 | import vswe.production.page.unit.Unit; 6 | import vswe.production.tileentity.TileEntityTable; 7 | 8 | 9 | public class SlotUnit extends SlotTable { 10 | protected Unit unit; 11 | public SlotUnit(TileEntityTable table, Page page, int id, int x, int y, Unit unit) { 12 | super(table, page, id, x, y); 13 | 14 | this.unit = unit; 15 | } 16 | 17 | @Override 18 | public boolean isVisible() { 19 | return super.isVisible() && isEnabled(); 20 | } 21 | 22 | @Override 23 | public boolean isEnabled() { 24 | return unit.isEnabled(); 25 | } 26 | 27 | 28 | @Override 29 | public boolean canSupplyItems() { 30 | return false; 31 | } 32 | 33 | @Override 34 | public boolean canShiftClickInto(ItemStack item) { 35 | return false; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotValidity.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | 4 | public enum SlotValidity { 5 | BOTH(true, true), 6 | INPUT(true, false), 7 | OUTPUT(false, true), 8 | NONE(false, false); 9 | 10 | private boolean isInput; 11 | private boolean isOutput; 12 | 13 | SlotValidity(boolean isInput, boolean isOutput) { 14 | this.isInput = isInput; 15 | this.isOutput = isOutput; 16 | } 17 | 18 | public boolean isInput() { 19 | return isInput; 20 | } 21 | 22 | public boolean isOutput() { 23 | return isOutput; 24 | } 25 | 26 | public static SlotValidity getValidity(boolean isSlotInput, boolean isSlotOutput) { 27 | if (isSlotInput && isSlotOutput) { 28 | return BOTH; 29 | }else if(isSlotInput) { 30 | return INPUT; 31 | }else if(isSlotOutput) { 32 | return OUTPUT; 33 | }else{ 34 | return NONE; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/config/ConfigLoader.java: -------------------------------------------------------------------------------- 1 | package vswe.production.config; 2 | 3 | 4 | import net.minecraftforge.common.config.Configuration; 5 | import vswe.production.item.Upgrade; 6 | 7 | import java.io.File; 8 | 9 | public final class ConfigLoader { 10 | 11 | private static final String UPGRADES = "Upgrades"; 12 | private static final String MAX_COUNT_SUFFIX = ".max_count"; 13 | 14 | 15 | public static void init(File file) { 16 | Configuration config = new Configuration(file); 17 | config.load(); 18 | 19 | 20 | for (Upgrade upgrade : Upgrade.values()) { 21 | Upgrade.MaxCount max = upgrade.getMaxCountObject(); 22 | if (max.getConfigurableMax() > 0) { 23 | upgrade.getMaxCountObject().setMax(config.getInt(upgrade.getUnlocalizedName() + MAX_COUNT_SUFFIX, UPGRADES, max.getMax(), 0, max.getConfigurableMax(), "Max count of the " + upgrade.getName() + " upgrade")); 24 | } 25 | } 26 | 27 | 28 | config.save(); 29 | } 30 | 31 | private ConfigLoader() {} 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotFuel.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | 4 | import net.minecraft.init.Blocks; 5 | import net.minecraft.item.Item; 6 | import net.minecraft.item.ItemStack; 7 | import net.minecraft.tileentity.TileEntityFurnace; 8 | import net.minecraftforge.fluids.FluidContainerRegistry; 9 | import vswe.production.item.Upgrade; 10 | import vswe.production.page.Page; 11 | import vswe.production.tileentity.TileEntityTable; 12 | 13 | public class SlotFuel extends SlotTable { 14 | public SlotFuel(TileEntityTable table, Page page, int id, int x, int y) { 15 | super(table, page, id, x, y); 16 | } 17 | 18 | @Override 19 | public boolean isItemValid(ItemStack itemstack) { 20 | return super.isItemValid(itemstack) && TileEntityFurnace.isItemFuel(itemstack) && !FluidContainerRegistry.isFilledContainer(itemstack); 21 | } 22 | 23 | @Override 24 | public boolean canShiftClickInto(ItemStack item) { 25 | return !item.getItem().equals(Item.getItemFromBlock(Blocks.crafting_table)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/setting/SettingNormal.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page.setting; 2 | 3 | 4 | import net.minecraft.item.ItemStack; 5 | import vswe.production.gui.container.slot.SlotBase; 6 | import vswe.production.page.unit.Unit; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | import java.util.List; 10 | 11 | public class SettingNormal extends Setting{ 12 | public SettingNormal(TileEntityTable table, int id, int x, int y) { 13 | super(table, id, x, y); 14 | } 15 | 16 | @Override 17 | public ItemStack getItem() { 18 | return table.getUpgradePage().getUpgradeMainItem(id); 19 | } 20 | 21 | @Override 22 | public List getSlots() { 23 | Unit unit = table.getMainPage().getCraftingList().get(id); 24 | if (!unit.isEnabled()) { 25 | unit = table.getMainPage().getSmeltingList().get(id); 26 | if (!unit.isEnabled()) { 27 | return null; 28 | } 29 | } 30 | 31 | return unit.getSlots(); 32 | } 33 | 34 | @Override 35 | public String getName() { 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/GuiHandler.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui; 2 | 3 | 4 | import cpw.mods.fml.common.network.IGuiHandler; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.tileentity.TileEntity; 7 | import net.minecraft.world.World; 8 | import vswe.production.gui.container.ContainerTable; 9 | import vswe.production.tileentity.TileEntityTable; 10 | 11 | public class GuiHandler implements IGuiHandler { 12 | @Override 13 | public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 14 | TileEntity te = world.getTileEntity(x, y, z); 15 | if (te instanceof TileEntityTable) { 16 | return new ContainerTable((TileEntityTable)te, player); 17 | } 18 | return null; 19 | } 20 | 21 | @Override 22 | public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { 23 | TileEntity te = world.getTileEntity(x, y, z); 24 | if (te instanceof TileEntityTable) { 25 | return new GuiTable((TileEntityTable)te, player); 26 | } 27 | return null; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/setting/SettingCoal.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page.setting; 2 | 3 | import cpw.mods.fml.relauncher.*; 4 | import cpw.mods.fml.relauncher.Side; 5 | import net.minecraft.init.Items; 6 | import net.minecraft.item.ItemStack; 7 | import vswe.production.gui.GuiBase; 8 | import vswe.production.gui.container.slot.SlotBase; 9 | import vswe.production.tileentity.TileEntityTable; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | 15 | public class SettingCoal extends Setting { 16 | private ItemStack itemStack; 17 | 18 | public SettingCoal(TileEntityTable table, int id, int x, int y) { 19 | super(table, id, x, y); 20 | itemStack = new ItemStack(Items.coal); 21 | } 22 | 23 | @Override 24 | public ItemStack getItem() { 25 | return itemStack; 26 | } 27 | 28 | @Override 29 | public List getSlots() { 30 | List slots = new ArrayList(); 31 | slots.add(table.getSlots().get(0)); 32 | return slots; 33 | } 34 | 35 | @Override 36 | public String getName() { 37 | return "Fuel"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnitFurnaceQueue.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | 4 | import net.minecraft.item.ItemStack; 5 | import vswe.production.item.Upgrade; 6 | import vswe.production.page.Page; 7 | import vswe.production.page.unit.Unit; 8 | import vswe.production.tileentity.TileEntityTable; 9 | 10 | public class SlotUnitFurnaceQueue extends SlotUnitFurnaceInput { 11 | private int queueId; 12 | public SlotUnitFurnaceQueue(TileEntityTable table, Page page, int id, int x, int y, Unit unit, int queueId) { 13 | super(table, page, id, x, y, unit); 14 | this.queueId = queueId; 15 | } 16 | 17 | @Override 18 | public boolean isVisible() { 19 | return isUsed() && super.isVisible(); 20 | } 21 | 22 | @Override 23 | public boolean isEnabled() { 24 | return isUsed() && super.isEnabled(); 25 | } 26 | 27 | private boolean isUsed() { 28 | return queueId < table.getUpgradePage().getUpgradeCount(unit.getId(), Upgrade.QUEUE); 29 | } 30 | 31 | @Override 32 | public boolean canShiftClickInto(ItemStack item) { 33 | return true; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/setting/Direction.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page.setting; 2 | 3 | 4 | public enum Direction { 5 | BOTTOM(1, 2), 6 | TOP(1, 0), 7 | FRONT(1, 1), 8 | BACK(3, 1), 9 | LEFT(2, 1, "Your right side when facing the front"), 10 | RIGHT(0, 1, "Your left side when facing the front"); 11 | 12 | private int interfaceX; 13 | private int interfaceY; 14 | private String name; 15 | private String description; 16 | 17 | Direction(int interfaceX, int interfaceY) { 18 | this(interfaceX, interfaceY, null); 19 | } 20 | 21 | Direction(int interfaceX, int interfaceY, String description) { 22 | this.interfaceX = interfaceX; 23 | this.interfaceY = interfaceY; 24 | 25 | this.name = toString().charAt(0) + toString().substring(1).toLowerCase() + " Side"; 26 | this.description = description; 27 | } 28 | 29 | public int getInterfaceX() { 30 | return interfaceX; 31 | } 32 | 33 | public int getInterfaceY() { 34 | return interfaceY; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public String getDescription() { 42 | return description; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/block/ModBlocks.java: -------------------------------------------------------------------------------- 1 | package vswe.production.block; 2 | 3 | 4 | import cpw.mods.fml.common.registry.GameRegistry; 5 | import cpw.mods.fml.common.registry.LanguageRegistry; 6 | import net.minecraftforge.oredict.ShapedOreRecipe; 7 | import vswe.production.creativetab.CreativeTabProduction; 8 | import vswe.production.item.Upgrade; 9 | import vswe.production.tileentity.TileEntityTable; 10 | 11 | public final class ModBlocks { 12 | public static BlockTable table; 13 | 14 | private static final String UNLOCALIZED_NAME = "production_table"; 15 | private static final String LOCALIZED_NAME = "Production Table"; 16 | 17 | private static final String PLANKS = "plankWood"; 18 | private static final String COBBLE = "cobblestone"; 19 | 20 | public static void init() { 21 | table = new BlockTable(); 22 | GameRegistry.registerBlock(table, UNLOCALIZED_NAME); 23 | GameRegistry.registerTileEntity(TileEntityTable.class, UNLOCALIZED_NAME); 24 | LanguageRegistry.addName(table, LOCALIZED_NAME); 25 | 26 | CreativeTabProduction.getTab().init(table); 27 | 28 | GameRegistry.addRecipe(new ShapedOreRecipe(table, "PPP", "CUC", "CCC", 'P', PLANKS, 'C', COBBLE, 'U', Upgrade.BLANK.getItemStack())); 29 | } 30 | 31 | private ModBlocks(){} 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnitCraftingOutput.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import net.minecraft.item.ItemStack; 4 | import vswe.production.item.Upgrade; 5 | import vswe.production.page.Page; 6 | import vswe.production.page.unit.Unit; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | 10 | public class SlotUnitCraftingOutput extends SlotUnit { 11 | public SlotUnitCraftingOutput(TileEntityTable table, Page page, int id, int x, int y, Unit unit) { 12 | super(table, page, id, x, y, unit); 13 | } 14 | 15 | @Override 16 | public boolean isVisible() { 17 | return isAutoCrafting() && super.isVisible(); 18 | } 19 | 20 | @Override 21 | public boolean isEnabled() { 22 | return isAutoCrafting() && super.isEnabled(); 23 | } 24 | 25 | private boolean isAutoCrafting() { 26 | return table.getUpgradePage().hasUpgrade(unit.getId(), Upgrade.AUTO_CRAFTER); 27 | } 28 | 29 | @Override 30 | public boolean canSupplyItems() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public boolean canAcceptItems() { 36 | return false; 37 | } 38 | 39 | @Override 40 | public boolean isItemValid(ItemStack itemstack) { 41 | return false; 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/setting/Setting.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page.setting; 2 | 3 | import cpw.mods.fml.relauncher.SideOnly; 4 | import net.minecraft.item.ItemStack; 5 | import vswe.production.gui.GuiBase; 6 | import vswe.production.gui.container.slot.SlotBase; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public abstract class Setting { 13 | private int x; 14 | private int y; 15 | protected int id; 16 | protected TileEntityTable table; 17 | private List sides; 18 | 19 | public Setting(TileEntityTable table, int id, int x, int y) { 20 | this.table = table; 21 | this.id = id; 22 | this.x = x; 23 | this.y = y; 24 | sides = new ArrayList(); 25 | } 26 | 27 | public boolean isValid() { 28 | return getItem() != null; 29 | } 30 | 31 | public abstract ItemStack getItem(); 32 | 33 | public int getX() { 34 | return x; 35 | } 36 | 37 | public int getY() { 38 | return y; 39 | } 40 | 41 | public List getSides() { 42 | return sides; 43 | } 44 | 45 | public int getId() { 46 | return id; 47 | } 48 | 49 | public abstract List getSlots(); 50 | 51 | public abstract String getName(); 52 | } -------------------------------------------------------------------------------- /src/main/java/vswe/production/page/Page.java: -------------------------------------------------------------------------------- 1 | package vswe.production.page; 2 | 3 | import cpw.mods.fml.relauncher.Side; 4 | import cpw.mods.fml.relauncher.SideOnly; 5 | import vswe.production.gui.GuiBase; 6 | import vswe.production.gui.GuiTable; 7 | import vswe.production.gui.container.slot.SlotBase; 8 | import vswe.production.tileentity.TileEntityTable; 9 | 10 | 11 | public abstract class Page { 12 | private String name; 13 | protected TileEntityTable table; 14 | private int id; 15 | 16 | 17 | public Page(TileEntityTable table, String name) { 18 | this.id = table.getPages().size(); 19 | this.table = table; 20 | this.name = name; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public abstract int createSlots(int id); 28 | 29 | protected void addSlot(SlotBase slot) { 30 | table.addSlot(slot); 31 | } 32 | 33 | @SideOnly(Side.CLIENT) 34 | public void draw(GuiBase gui, int mX, int mY) { 35 | gui.drawString(name, 8, 6, 0x404040); 36 | } 37 | @SideOnly(Side.CLIENT) 38 | public void onClick(GuiBase gui, int mX, int mY, int button) {} 39 | 40 | public int getId() { 41 | return id; 42 | } 43 | 44 | public void onUpdate() {} 45 | 46 | @SideOnly(Side.CLIENT) 47 | public void onRelease(GuiTable gui, int mX, int mY, int button) {} 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnitCraftingStorage.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | import vswe.production.item.Upgrade; 4 | import vswe.production.page.Page; 5 | import vswe.production.page.unit.Unit; 6 | import vswe.production.page.unit.UnitCrafting; 7 | import vswe.production.tileentity.TileEntityTable; 8 | 9 | 10 | public class SlotUnitCraftingStorage extends SlotUnit { 11 | public SlotUnitCraftingStorage(TileEntityTable table, Page page, int id, int x, int y, Unit unit) { 12 | super(table, page, id, x, y, unit); 13 | } 14 | 15 | @Override 16 | public boolean isVisible() { 17 | return isAvailable() && super.isVisible(); 18 | } 19 | 20 | @Override 21 | public boolean isEnabled() { 22 | return isAvailable() && super.isEnabled(); 23 | } 24 | 25 | private boolean isAvailable() { 26 | return table.getUpgradePage().hasUpgrade(unit.getId(), Upgrade.STORAGE); 27 | } 28 | 29 | @Override 30 | public boolean canAcceptItems() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public boolean shouldSlotHighlightItems() { 36 | return false; 37 | } 38 | 39 | @Override 40 | public boolean shouldSlotHighlightSelf() { 41 | return false; 42 | } 43 | 44 | @Override 45 | public void onSlotChanged() { 46 | super.onSlotChanged(); 47 | ((UnitCrafting)unit).onGridChanged(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/component/Button.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.component; 2 | 3 | 4 | import cpw.mods.fml.relauncher.Side; 5 | import cpw.mods.fml.relauncher.SideOnly; 6 | import vswe.production.gui.GuiBase; 7 | 8 | public abstract class Button { 9 | 10 | private String text; 11 | private int x; 12 | private int y; 13 | 14 | protected Button(String text, int x, int y) { 15 | this.text = text; 16 | this.x = x; 17 | this.y = y; 18 | } 19 | 20 | private static final int WIDTH = 42; 21 | private static final int HEIGHT = 16; 22 | private static final int SRC_X = 42; 23 | private static final int SRC_Y = 44; 24 | private static final int TEXT_Y = 7; 25 | 26 | @SideOnly(Side.CLIENT) 27 | public void draw(GuiBase gui, int mX, int mY) { 28 | if (isVisible()) { 29 | gui.prepare(); 30 | boolean hover = gui.inBounds(x, y, WIDTH, HEIGHT, mX, mY); 31 | 32 | gui.drawRect(x, y, SRC_X + (hover ? WIDTH : 0), SRC_Y, WIDTH, HEIGHT); 33 | gui.drawCenteredString(text, x, y + TEXT_Y, WIDTH, 0.7F, hover ? 0xDDD314 : 0x404040); 34 | } 35 | } 36 | 37 | @SideOnly(Side.CLIENT) 38 | public void onClick(GuiBase gui, int mX, int mY) { 39 | if (isVisible() && gui.inBounds(x, y, WIDTH, HEIGHT, mX, mY)) { 40 | clicked(); 41 | } 42 | } 43 | 44 | public abstract void clicked(); 45 | 46 | public boolean isVisible() { 47 | return true; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/component/CheckBox.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.component; 2 | 3 | 4 | import cpw.mods.fml.relauncher.Side; 5 | import cpw.mods.fml.relauncher.SideOnly; 6 | import vswe.production.gui.GuiBase; 7 | 8 | public abstract class CheckBox { 9 | 10 | private static final int SIZE = 8; 11 | private static final int SRC_X = 26; 12 | private static final int SRC_Y = 34; 13 | private static final int TEXT_X = 12; 14 | private static final int TEXT_Y = 2; 15 | 16 | private int x; 17 | private int y; 18 | private String text; 19 | 20 | 21 | public CheckBox(String text, int x, int y) { 22 | this.x = x; 23 | this.y = y; 24 | this.text = text; 25 | } 26 | 27 | @SideOnly(Side.CLIENT) 28 | public void draw(GuiBase gui, int mX, int mY) { 29 | if (isVisible()) { 30 | gui.prepare(); 31 | boolean hover = gui.inBounds(x, y, SIZE, SIZE, mX, mY); 32 | boolean checked = getValue(); 33 | gui.drawRect(x, y, SRC_X + (checked ? SIZE : 0), SRC_Y + (hover ? SIZE : 0), SIZE, SIZE); 34 | gui.drawString(text, x + TEXT_X, y + TEXT_Y, 0.7F, 0x404040); 35 | } 36 | } 37 | 38 | 39 | @SideOnly(Side.CLIENT) 40 | public void onClick(GuiBase gui, int mX, int mY) { 41 | if (isVisible() && gui.inBounds(x, y, SIZE, SIZE, mX, mY)) { 42 | setValue(!getValue()); 43 | onUpdate(); 44 | } 45 | } 46 | 47 | public abstract void setValue(boolean value); 48 | public abstract boolean getValue(); 49 | public void onUpdate() {} 50 | 51 | public boolean isVisible() { 52 | return true; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/container/slot/SlotUnitFurnaceResult.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.container.slot; 2 | 3 | 4 | import cpw.mods.fml.common.FMLCommonHandler; 5 | import net.minecraft.entity.player.EntityPlayer; 6 | import net.minecraft.init.Items; 7 | import net.minecraft.item.ItemStack; 8 | import net.minecraft.stats.AchievementList; 9 | import vswe.production.page.Page; 10 | import vswe.production.page.unit.Unit; 11 | import vswe.production.tileentity.TileEntityTable; 12 | 13 | 14 | public class SlotUnitFurnaceResult extends SlotUnit { 15 | public SlotUnitFurnaceResult(TileEntityTable table, Page page, int id, int x, int y, Unit unit) { 16 | super(table, page, id, x, y, unit); 17 | } 18 | 19 | @Override 20 | public boolean isBig() { 21 | return true; 22 | } 23 | 24 | @Override 25 | public boolean isItemValid(ItemStack itemstack) { 26 | return false; 27 | } 28 | 29 | @Override 30 | public boolean canSupplyItems() { 31 | return true; 32 | } 33 | 34 | @Override 35 | public boolean canAcceptItems() { 36 | return false; 37 | } 38 | 39 | @Override 40 | public void onPickupFromSlot(EntityPlayer player, ItemStack item) { 41 | super.onPickupFromSlot(player, item); 42 | FMLCommonHandler.instance().firePlayerSmeltedEvent(player, item); 43 | item.onCrafting(player.getEntityWorld(), player, item.stackSize); 44 | if (item.getItem() == Items.iron_ingot){ 45 | player.addStat(AchievementList.acquireIron, 1); 46 | }else if (item.getItem() == Items.cooked_fished) { 47 | player.addStat(AchievementList.cookFish, 1); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/vswe/production/gui/menu/GuiMenu.java: -------------------------------------------------------------------------------- 1 | package vswe.production.gui.menu; 2 | 3 | 4 | import cpw.mods.fml.relauncher.Side; 5 | import cpw.mods.fml.relauncher.SideOnly; 6 | import vswe.production.gui.GuiBase; 7 | import vswe.production.gui.component.Button; 8 | import vswe.production.tileentity.TileEntityTable; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public abstract class GuiMenu { 14 | 15 | protected List