diff --git a/common/calclavia/lib/Calclavia.java b/common/calclavia/lib/Calclavia.java deleted file mode 100644 index 8005c8360..000000000 --- a/common/calclavia/lib/Calclavia.java +++ /dev/null @@ -1,44 +0,0 @@ -package calclavia.lib; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.util.ResourceLocation; - -public class Calclavia -{ - public static final String NAME = "Calclavia"; - - public static final String DOMAIN = "calclavia"; - public static final String TEXTURE_NAME_PREFIX = DOMAIN + ":"; - - public static final String RESOURCE_DIRECTORY = "/assets/calclavia/"; - - public static final String TEXTURE_DIRECTORY = "textures/"; - public static final String GUI_DIRECTORY = TEXTURE_DIRECTORY + "gui/"; - - public static final ResourceLocation GUI_EMPTY_FILE = new ResourceLocation(DOMAIN, GUI_DIRECTORY + "gui_empty.png"); - public static final ResourceLocation GUI_COMPONENTS = new ResourceLocation(DOMAIN, GUI_DIRECTORY + "gui_components.png"); - public static final ResourceLocation GUI_BASE = new ResourceLocation(DOMAIN, GUI_DIRECTORY + "gui_base.png"); - - public static List splitStringPerWord(String string, int wordsPerLine) - { - String[] words = string.split(" "); - List lines = new ArrayList(); - - for (int lineCount = 0; lineCount < Math.ceil((float) words.length / (float) wordsPerLine); lineCount++) - { - String stringInLine = ""; - - for (int i = lineCount * wordsPerLine; i < Math.min(wordsPerLine + lineCount * wordsPerLine, words.length); i++) - { - stringInLine += words[i] + " "; - } - - lines.add(stringInLine.trim()); - } - - return lines; - } - -} diff --git a/common/calclavia/lib/CustomPotion.java b/common/calclavia/lib/CustomPotion.java deleted file mode 100644 index 768451a15..000000000 --- a/common/calclavia/lib/CustomPotion.java +++ /dev/null @@ -1,35 +0,0 @@ -package calclavia.lib; - -import net.minecraft.potion.Potion; - -public abstract class CustomPotion extends Potion -{ - /** - * Creates a new type of potion - * - * @param id - The ID of this potion. Make it greater than 20. - * @param isBadEffect - Is this potion a good potion or a bad one? - * @param color - The color of this potion. - * @param name - The name of this potion. - */ - public CustomPotion(int id, boolean isBadEffect, int color, String name) - { - super(id, isBadEffect, color); - this.setPotionName("potion." + name); - Potion.potionTypes[this.getId()] = this; - } - - @Override - public Potion setIconIndex(int par1, int par2) - { - super.setIconIndex(par1, par2); - return this; - } - - @Override - protected Potion setEffectiveness(double par1) - { - super.setEffectiveness(par1); - return this; - } -} diff --git a/common/calclavia/lib/IPlayerUsing.java b/common/calclavia/lib/IPlayerUsing.java deleted file mode 100644 index 11d8b0a91..000000000 --- a/common/calclavia/lib/IPlayerUsing.java +++ /dev/null @@ -1,10 +0,0 @@ -package calclavia.lib; - -import java.util.HashSet; - -import net.minecraft.entity.player.EntityPlayer; - -public interface IPlayerUsing -{ - public HashSet getPlayersUsing(); -} diff --git a/common/calclavia/lib/NBTFileLoader.java b/common/calclavia/lib/NBTFileLoader.java deleted file mode 100644 index 5850af7d5..000000000 --- a/common/calclavia/lib/NBTFileLoader.java +++ /dev/null @@ -1,112 +0,0 @@ -package calclavia.lib; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; - -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.server.MinecraftServer; -import cpw.mods.fml.client.FMLClientHandler; -import cpw.mods.fml.common.FMLCommonHandler; -import cpw.mods.fml.common.FMLLog; - -public class NBTFileLoader -{ - /** - * Saves NBT data in the world folder. - * - * @return True on success. - */ - public static boolean saveData(File saveDirectory, String filename, NBTTagCompound data) - { - try - { - File tempFile = new File(saveDirectory, filename + "_tmp.dat"); - File file = new File(saveDirectory, filename + ".dat"); - - CompressedStreamTools.writeCompressed(data, new FileOutputStream(tempFile)); - - if (file.exists()) - { - file.delete(); - } - - tempFile.renameTo(file); - - FMLLog.fine("Saved " + filename + " NBT data file successfully."); - return true; - } - catch (Exception e) - { - System.out.println("Failed to save " + filename + ".dat!"); - e.printStackTrace(); - return false; - } - } - - public static boolean saveData(String filename, NBTTagCompound data) - { - return saveData(getSaveDirectory(MinecraftServer.getServer().getFolderName()), filename, data); - } - - /** - * Reads NBT data from the world folder. - * - * @return The NBT data - */ - public static NBTTagCompound loadData(File saveDirectory, String filename) - { - try - { - File file = new File(saveDirectory, filename + ".dat"); - - if (file.exists()) - { - FMLLog.fine("Loaded " + filename + " data."); - return CompressedStreamTools.readCompressed(new FileInputStream(file)); - } - else - { - FMLLog.fine("Created new " + filename + " data."); - return new NBTTagCompound(); - } - } - catch (Exception e) - { - System.out.println("Failed to load " + filename + ".dat!"); - e.printStackTrace(); - return null; - } - } - - public static NBTTagCompound loadData(String filename) - { - return loadData(getSaveDirectory(MinecraftServer.getServer().getFolderName()), filename); - } - - public static File getSaveDirectory(String worldName) - { - File parent = getBaseDirectory(); - - if (FMLCommonHandler.instance().getSide().isClient()) - { - parent = new File(getBaseDirectory(), "saves" + File.separator); - } - - return new File(parent, worldName + File.separator); - } - - public static File getBaseDirectory() - { - if (FMLCommonHandler.instance().getSide().isClient()) - { - FMLClientHandler.instance().getClient(); - return FMLClientHandler.instance().getClient().mcDataDir; - } - else - { - return new File("."); - } - } -} diff --git a/common/calclavia/lib/UniversalRecipes.java b/common/calclavia/lib/UniversalRecipes.java deleted file mode 100644 index 23063db89..000000000 --- a/common/calclavia/lib/UniversalRecipes.java +++ /dev/null @@ -1,153 +0,0 @@ -package calclavia.lib; - -import ic2.api.item.Items; - -import java.util.Arrays; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -import com.google.common.collect.Lists; - -import cpw.mods.fml.common.FMLLog; - -/** - * Allows recipes that are compatible with UE -> IC2 -> Buildcraft. - * - * @author Calclavia - * - */ -public class UniversalRecipes -{ - private static final String PREFIX = "calclavia:"; - /** - * Primary Metal: Steel - */ - public static final String PRIMARY_METAL = "ingotSteel"; - public static final String PRIMARY_PLATE = "plateSteel"; - - /** - * Secondary Metal: Bronze - */ - public static final String SECONDARY_METAL = "ingotBronze"; - public static final String SECONDARY_PLATE = "plateBronze"; - - /** - * Circuits - */ - public static final String CIRCUIT_T1 = PREFIX + "CIRCUIT_T1"; - public static final String CIRCUIT_T2 = PREFIX + "CIRCUIT_T2"; - public static final String CIRCUIT_T3 = PREFIX + "CIRCUIT_T3"; - - /** - * Battery - */ - public static String ADVANCED_BATTERY = PREFIX + "ADVANCED_BATTERY"; - public static String BATTERY = PREFIX + "BATTERY"; - public static String BATTERY_BOX = PREFIX + "BATTERY_BOX"; - - /** - * Misc - */ - public static final String WRENCH = PREFIX + "WRENCH"; - public static final String WIRE = PREFIX + "WIRE"; - public static final String MOTOR = PREFIX + "MOTOR"; - - public static boolean isInit = false; - - public static void init() - { - if (!isInit) - { - // Metals - /* - * register(PRIMARY_METAL, "ingotSteel", "ingotRefinedIron", new - * ItemStack(Item.ingotIron)); register(SECONDARY_METAL, "ingotBronze", new - * ItemStack(Item.brick)); - */ - - // Plates - register(PRIMARY_PLATE, "plateSteel", Items.getItem("advancedAlloy"), new ItemStack(Block.blockIron)); - register(SECONDARY_PLATE, "plateBronze", Items.getItem("carbonPlate"), new ItemStack(Block.brick)); - // Miscs - register(CIRCUIT_T1, "circuitBasic", Items.getItem("electronicCircuit"), new ItemStack(Block.torchRedstoneActive)); - register(CIRCUIT_T2, "circuitAdvanced", Items.getItem("advancedCircuit"), new ItemStack(Item.redstoneRepeater)); - register(CIRCUIT_T3, "circuitElite", Items.getItem("iridiumPlate"), new ItemStack(Item.comparator)); - - register(ADVANCED_BATTERY, "advancedBattery", Items.getItem("energyCrystal"), "battery", new ItemStack(Item.redstoneRepeater)); - register(BATTERY, "battery", Items.getItem("reBattery"), new ItemStack(Item.redstoneRepeater)); - register(BATTERY_BOX, "batteryBox", Items.getItem("batBox"), new ItemStack(Block.blockGold)); - - register(WRENCH, "wrench", Items.getItem("wrench"), new ItemStack(Item.axeIron)); - register(WIRE, "copperWire", "copperCableBlock", new ItemStack(Item.redstone)); - - register(MOTOR, "motor", Items.getItem("generator"), new ItemStack(Block.pistonBase)); - - isInit = true; - } - - } - - public static void register(String name, Object... possiblities) - { - for (Object possiblity : possiblities) - { - if (possiblity instanceof ItemStack) - { - if (registerItemStacksToDictionary(name, (ItemStack) possiblity)) - { - break; - } - - continue; - } - else if (possiblity instanceof String) - { - if (registerItemStacksToDictionary(name, (String) possiblity)) - { - break; - } - - continue; - } - - FMLLog.severe("Universal Recipes: Error Registering " + name); - - } - } - - public static boolean registerItemStacksToDictionary(String name, List itemStacks) - { - boolean returnValue = false; - - if (itemStacks != null) - { - if (itemStacks.size() > 0) - { - for (ItemStack stack : itemStacks.toArray(new ItemStack[0])) - { - if (stack != null) - { - OreDictionary.registerOre(name, stack); - returnValue = true; - } - } - } - } - - return returnValue; - } - - public static boolean registerItemStacksToDictionary(String name, ItemStack... itemStacks) - { - return registerItemStacksToDictionary(name, Arrays.asList(itemStacks)); - } - - public static boolean registerItemStacksToDictionary(String name, String stackName) - { - return registerItemStacksToDictionary(name, OreDictionary.getOres(stackName)); - } -} \ No newline at end of file diff --git a/common/calclavia/lib/base/ItemBase.java b/common/calclavia/lib/base/ItemBase.java deleted file mode 100644 index f5c649c58..000000000 --- a/common/calclavia/lib/base/ItemBase.java +++ /dev/null @@ -1,16 +0,0 @@ -package calclavia.lib.base; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraftforge.common.Configuration; - -public class ItemBase extends Item -{ - public ItemBase(int id, String name, Configuration config, String prefix, CreativeTabs tab) - { - super(config.getItem(name, id).getInt()); - this.setUnlocalizedName(prefix + name); - this.setCreativeTab(tab); - this.setTextureName(prefix + name); - } -} diff --git a/common/calclavia/lib/base/ItemElectricBase.java b/common/calclavia/lib/base/ItemElectricBase.java deleted file mode 100644 index 16a690c2f..000000000 --- a/common/calclavia/lib/base/ItemElectricBase.java +++ /dev/null @@ -1,16 +0,0 @@ -package calclavia.lib.base; - -import net.minecraft.creativetab.CreativeTabs; -import net.minecraftforge.common.Configuration; -import universalelectricity.compatibility.ItemUniversalElectric; - -public abstract class ItemElectricBase extends ItemUniversalElectric -{ - public ItemElectricBase(int id, String name, Configuration config, String prefix, CreativeTabs tab) - { - super(config.getItem(name, id).getInt()); - this.setUnlocalizedName(prefix + name); - this.setCreativeTab(tab); - this.setTextureName(prefix + name); - } -} diff --git a/common/calclavia/lib/flag/CommandFlag.java b/common/calclavia/lib/flag/CommandFlag.java deleted file mode 100644 index e58108cb3..000000000 --- a/common/calclavia/lib/flag/CommandFlag.java +++ /dev/null @@ -1,320 +0,0 @@ -package calclavia.lib.flag; - -import java.util.Iterator; -import java.util.List; - -import net.minecraft.command.CommandBase; -import net.minecraft.command.ICommandSender; -import net.minecraft.command.WrongUsageException; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.ChatMessageComponent; -import universalelectricity.core.vector.Vector3; - -/** - * Commands used for flags and regions. This can be used for protection for specific mod components - * that might be dangerous. - * - * @author Calclavia - * - */ -public class CommandFlag extends CommandBase -{ - public static final String[] COMMANDS = new String[] { "list", "setregion", "removeregion", "set" }; - public String commandName = "modflag"; - public ModFlag modFlagData; - - public CommandFlag(ModFlag modFlag) - { - this.modFlagData = modFlag; - } - - public CommandFlag(ModFlag modFlag, String commandName) - { - this(modFlag); - this.commandName = commandName; - } - - @Override - public String getCommandName() - { - return commandName; - } - - @Override - public String getCommandUsage(ICommandSender par1ICommandSender) - { - String returnString = ""; - - for (String command : COMMANDS) - { - returnString = returnString + "\n/" + this.getCommandName() + " " + command; - } - - return returnString; - } - - @Override - public void processCommand(ICommandSender sender, String[] args) - { - if (args.length > 0) - { - EntityPlayer entityPlayer = (EntityPlayer) sender; - - // The world data the player is on. - FlagWorld flagWorld = this.modFlagData.getFlagWorld(entityPlayer.worldObj); - - String commandName = args[0].toLowerCase(); - - if (commandName.equalsIgnoreCase("list")) - { - /** - * The list command lists out all regions in this world/region. - */ - if (args.length > 1) - { - String regionName = args[1]; - - if (regionName.equalsIgnoreCase("all")) - { - String msg = ""; - - Iterator itWorlds = this.modFlagData.getFlagWorlds().iterator(); - - while (itWorlds.hasNext()) - { - Iterator itRegion = itWorlds.next().getRegions().iterator(); - - while (itRegion.hasNext()) - { - FlagRegion flagRegion = itRegion.next(); - msg = msg + " " + flagRegion.name + " (" + flagRegion.region.min.x + "," + flagRegion.region.min.z + ")" + ","; - } - } - - if (msg != "") - { - msg = "List of regions in world:\n" + msg; - } - else - { - msg = "No regions in this world."; - } - - sender.sendChatToPlayer(ChatMessageComponent.createFromText(msg)); - } - else if (flagWorld.getRegion(regionName) != null) - { - String msg = ""; - - Iterator i = flagWorld.getRegion(regionName).getFlags().iterator(); - - while (i.hasNext()) - { - Flag flag = i.next(); - msg = msg + " " + flag.name + " => " + flag.value + ","; - } - - if (msg != "") - { - msg = "List of flags in region " + regionName + ":\n" + msg; - } - else - { - msg = "No flags in this region."; - } - - sender.sendChatToPlayer(ChatMessageComponent.createFromText(msg)); - } - else - { - String msg = "Region does not exist, but here are existing flags in the position you are standing on:\n"; - - Iterator i = flagWorld.getFlagsInPosition(new Vector3(entityPlayer)).iterator(); - - while (i.hasNext()) - { - Flag flag = i.next(); - msg = msg + " " + flag.name + "=>" + flag.value + ","; - } - - sender.sendChatToPlayer(ChatMessageComponent.createFromText(msg)); - } - - } - else - { - String msg = ""; - - Iterator i = flagWorld.getRegions().iterator(); - while (i.hasNext()) - { - FlagRegion flagRegion = i.next(); - msg = msg + " " + flagRegion.name + " (" + flagRegion.region.min.x + "," + flagRegion.region.min.z + ")" + ","; - } - - if (msg != "") - { - msg = "List of regions in this dimension:\n" + msg; - } - else - { - msg = "No regions in this dimension."; - } - - sender.sendChatToPlayer(ChatMessageComponent.createFromText(msg)); - } - - return; - } - else if (commandName.equalsIgnoreCase("setregion")) - { - if (args.length > 1) - { - String regionName = args[1]; - - if (regionName.equalsIgnoreCase(FlagWorld.GLOBAL_REGION)) - { - if (flagWorld.addRegion(regionName, new Vector3(entityPlayer), 1)) - { - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Created global dimension region setting.")); - return; - } - } - else if (args.length > 2) - { - int radius = 0; - - try - { - radius = Integer.parseInt(args[2]); - } - catch (Exception e) - { - throw new WrongUsageException("Radius not a number!"); - } - - if (radius > 0) - { - FlagRegion region = flagWorld.getRegion(regionName); - if (region == null) - { - if (flagWorld.addRegion(regionName, new Vector3(entityPlayer), radius)) - { - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Region " + regionName + " added.")); - } - } - else - { - region.edit(new Vector3(entityPlayer), radius); - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Region " + regionName + " already exists. Modified region to have a radius of: " + radius)); - } - } - else - { - throw new WrongUsageException("Radius has to be greater than zero!"); - } - - } - else - { - throw new WrongUsageException("/" + this.getCommandName() + " addregion "); - } - } - else - { - throw new WrongUsageException("Please specify the region name."); - } - - return; - } - else if (commandName.equalsIgnoreCase("removeregion")) - - { - if (args.length > 1) - { - String regionName = args[1]; - - if (flagWorld.removeRegion(regionName)) - { - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Region with name " + regionName + " is removed.")); - } - else - { - throw new WrongUsageException("The specified region does not exist in this world."); - } - } - else - { - throw new WrongUsageException("Please specify the region name."); - } - - return; - } - else if (commandName.equalsIgnoreCase("set")) - { - if (args.length > 2) - { - String regionName = args[1]; - String flagName = args[2]; - FlagRegion flagRegion = flagWorld.getRegion(regionName); - - if (flagRegion != null) - { - if (FlagRegistry.flags.contains(flagName)) - { - if (args.length > 3) - { - String flagValue = args[3]; - - flagRegion.setFlag(flagName, flagValue); - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Flag '" + flagName + "' has been set to '" + flagValue + "' in " + regionName + ".")); - } - else - { - flagRegion.removeFlag(flagName); - sender.sendChatToPlayer(ChatMessageComponent.createFromText("Removed flag '" + flagName + "'.")); - } - } - else - { - String flags = "Flag does not exist. Existing flags:\n"; - - for (String registeredFlag : FlagRegistry.flags) - { - flags = flags + registeredFlag + ", "; - } - - throw new WrongUsageException(flags); - } - } - else - { - throw new WrongUsageException("The specified region '" + regionName + "' does not exist."); - } - } - else - { - throw new WrongUsageException("/" + this.getCommandName() + " set "); - } - - return; - } - } - - throw new WrongUsageException(this.getCommandUsage(sender)); - - } - - @Override - public int getRequiredPermissionLevel() - { - return 2; - } - - @Override - public List addTabCompletionOptions(ICommandSender sender, String[] args) - { - return args.length == 1 ? getListOfStringsMatchingLastWord(args, COMMANDS) : null; - } - -} diff --git a/common/calclavia/lib/flag/Flag.java b/common/calclavia/lib/flag/Flag.java deleted file mode 100644 index c56079dea..000000000 --- a/common/calclavia/lib/flag/Flag.java +++ /dev/null @@ -1,43 +0,0 @@ -package calclavia.lib.flag; - -import net.minecraft.nbt.NBTTagCompound; - -public class Flag extends FlagBase -{ - /** - * The region in which this flag has affect in. - */ - public FlagRegion flagRegion; - - public String name; - - public String value; - - public Flag(FlagRegion flagRegion) - { - this.flagRegion = flagRegion; - } - - public Flag(FlagRegion flagRegion, String name, String value) - { - this(flagRegion); - this.name = name; - this.value = value; - - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - this.name = nbt.getString("name"); - this.value = nbt.getString("value"); - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setString("name", this.name); - nbt.setString("value", this.value); - - } -} diff --git a/common/calclavia/lib/flag/FlagBase.java b/common/calclavia/lib/flag/FlagBase.java deleted file mode 100644 index cd32acf27..000000000 --- a/common/calclavia/lib/flag/FlagBase.java +++ /dev/null @@ -1,26 +0,0 @@ -package calclavia.lib.flag; - -import net.minecraft.nbt.NBTTagCompound; - -public abstract class FlagBase -{ - public abstract void readFromNBT(NBTTagCompound nbt); - - public abstract void writeToNBT(NBTTagCompound nbt); - - public NBTTagCompound getNBT() - { - NBTTagCompound nbt = new NBTTagCompound(); - try - { - this.writeToNBT(nbt); - } - catch (Exception e) - { - System.out.println("Failed to read flag"); - e.printStackTrace(); - } - - return nbt; - } -} diff --git a/common/calclavia/lib/flag/FlagRegion.java b/common/calclavia/lib/flag/FlagRegion.java deleted file mode 100644 index e897ae143..000000000 --- a/common/calclavia/lib/flag/FlagRegion.java +++ /dev/null @@ -1,184 +0,0 @@ -package calclavia.lib.flag; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import universalelectricity.core.vector.Vector3; -import universalelectricity.prefab.vector.Region3; - -/** - * A defined region. - * - * @author Calclavia - * - */ -public class FlagRegion extends FlagBase -{ - /** - * The region in which this flag has affect in. - */ - public FlagWorld flagWorld; - - public String name; - public Region3 region; - private final List flags = new ArrayList(); - - public FlagRegion(FlagWorld worldFlagData) - { - this.flagWorld = worldFlagData; - } - - public FlagRegion(FlagWorld flagWorld, String name, Region3 region) - { - this.flagWorld = flagWorld; - this.name = name; - this.region = region; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - this.name = nbt.getName(); - - Vector3 startVector = Vector3.readFromNBT(nbt.getCompoundTag("min")); - Vector3 endVector = Vector3.readFromNBT(nbt.getCompoundTag("max")); - - this.region = new Region3(startVector, endVector); - - /** - * Child Data - */ - NBTTagList flagList = nbt.getTagList("flags"); - - for (int i = 0; i < flagList.tagCount(); i++) - { - NBTTagCompound childNode = (NBTTagCompound) flagList.tagAt(i); - - try - { - Flag flag = new Flag(this); - flag.readFromNBT(childNode); - this.flags.add(flag); - } - catch (Exception e) - { - System.out.println("Mod Flag: Failed to read flag data: " + childNode.getName()); - e.printStackTrace(); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - nbt.setName(this.name); - - nbt.setTag("min", this.region.min.writeToNBT(new NBTTagCompound())); - nbt.setTag("max", this.region.max.writeToNBT(new NBTTagCompound())); - - NBTTagList flagList = new NBTTagList(); - - for (Flag flag : this.getFlags()) - { - try - { - flagList.appendTag(flag.getNBT()); - } - catch (Exception e) - { - System.out.println("Failed to save world flag data: " + flag.name); - e.printStackTrace(); - } - } - - nbt.setTag("flags", flagList); - } - - public boolean containsValue(String flagName, String checkValue, Vector3 position) - { - for (Flag flag : this.flags) - { - if (flag.name.equalsIgnoreCase(flagName) && flag.value.equalsIgnoreCase(checkValue)) - { - return true; - } - } - - return false; - } - - public boolean setFlag(String flagName, String value) - { - this.removeFlag(flagName); - - if (value != null && value != "") - { - if (!containsFlag(flagName)) - { - return this.flags.add(new Flag(this, flagName, value)); - } - } - - return false; - } - - public boolean containsFlag(String flagName) - { - for (Flag region : this.flags) - { - if (region.name.equalsIgnoreCase(flagName)) - { - return true; - } - } - return false; - } - - public boolean removeFlag(String flagName) - { - for (Flag region : this.flags) - { - if (region.name.equalsIgnoreCase(flagName)) - { - this.flags.remove(region); - return true; - } - } - - return false; - } - - public List getFlags() - { - Iterator it = this.flags.iterator(); - - while (it.hasNext()) - { - Flag flag = it.next(); - - if (flag == null) - { - it.remove(); - continue; - } - - if (flag.name == null || flag.name == "") - { - it.remove(); - continue; - } - } - - return this.flags; - } - - public void edit(Vector3 position, int radius) - { - Vector3 minVec = new Vector3(position.intX() - radius, 0, position.intZ() - radius); - Vector3 maxVec = new Vector3(position.intX() + radius, this.flagWorld.world.getHeight(), position.intZ() + radius); - this.region = new Region3(minVec, maxVec); - } -} diff --git a/common/calclavia/lib/flag/FlagRegistry.java b/common/calclavia/lib/flag/FlagRegistry.java deleted file mode 100644 index 10d9ca353..000000000 --- a/common/calclavia/lib/flag/FlagRegistry.java +++ /dev/null @@ -1,52 +0,0 @@ -package calclavia.lib.flag; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * All the different types of flags that can be registered. - * - * @author Calclavia - * - */ -public class FlagRegistry -{ - public static final String DEFAULT_NAME = "ModFlags"; - - private static final HashMap MOD_FLAGS = new HashMap(); - - public static final List flags = new ArrayList(); - public static boolean isInitiated = false; - - public static void registerModFlag(String name, ModFlag flagData) - { - MOD_FLAGS.put(name, flagData); - } - - public static ModFlag getModFlag(String name) - { - return MOD_FLAGS.get(name); - } - - /** - * Registers a flag name, allowing it to be used and called by the player. Call this in your - * mod's init function. - */ - public static String registerFlag(String name) - { - if (!isInitiated) - { - isInitiated = true; - } - - name = name.toLowerCase(); - - if (!flags.contains(name)) - { - flags.add(name); - } - - return name; - } -} diff --git a/common/calclavia/lib/flag/FlagWorld.java b/common/calclavia/lib/flag/FlagWorld.java deleted file mode 100644 index 782ef58b3..000000000 --- a/common/calclavia/lib/flag/FlagWorld.java +++ /dev/null @@ -1,200 +0,0 @@ -package calclavia.lib.flag; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import universalelectricity.core.vector.Vector3; -import universalelectricity.prefab.vector.Region3; - -/** - * Data structure for world protection. - * - * @author Calclavia - * - */ -public class FlagWorld extends FlagBase -{ - public static final String GLOBAL_REGION = "dimension"; - - public World world; - private final List regions = new ArrayList(); - - public FlagWorld(World world) - { - this.world = world; - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - // A list containing all flags within it for this world. - Iterator childCompounds = nbt.getTags().iterator(); - - while (childCompounds.hasNext()) - { - NBTTagCompound childCompound = childCompounds.next(); - - try - { - FlagRegion flagRegion = new FlagRegion(this); - flagRegion.readFromNBT(childCompound); - this.regions.add(flagRegion); - } - catch (Exception e) - { - System.out.println("Mod Flag: Failed to read flag data: " + childCompound.getName()); - e.printStackTrace(); - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - for (FlagRegion region : this.regions) - { - try - { - NBTTagCompound flagCompound = new NBTTagCompound(); - region.writeToNBT(flagCompound); - nbt.setTag(region.name, flagCompound); - } - catch (Exception e) - { - System.out.println("Failed to save world flag data: " + region.name); - e.printStackTrace(); - } - } - } - - /** - * Gets all the flags that have an effect in this position. - * - * @param position - * @return - */ - public List getFlagsInPosition(Vector3 position) - { - List returnFlags = new ArrayList(); - - for (FlagRegion flagRegion : this.regions) - { - if (flagRegion.region.isIn(position) || flagRegion.name.equalsIgnoreCase(GLOBAL_REGION)) - { - for (Flag flag : flagRegion.getFlags()) - { - returnFlags.add(flag); - } - } - } - - return returnFlags; - } - - /** - * Gets all the values of the flags in this position. - */ - public List getValues(String flagName, Vector3 position) - { - List values = new ArrayList(); - - for (Flag flag : this.getFlagsInPosition(position)) - { - values.add(flag.value); - } - - return values; - } - - /** - * Checks if there is a flag in this position that has a specific value. - */ - public boolean containsValue(String flagName, String checkValue, Vector3 position) - { - for (Flag flag : this.getFlagsInPosition(position)) - { - if (flag.name.equalsIgnoreCase(flagName) && flag.value.equalsIgnoreCase(checkValue)) - { - return true; - } - } - - return false; - } - - public boolean addRegion(String name, Vector3 position, int radius) - { - Vector3 minVec = new Vector3(position.intX() - radius, 0, position.intZ() - radius); - Vector3 maxVec = new Vector3(position.intX() + radius, this.world.getHeight(), position.intZ() + radius); - - return this.regions.add(new FlagRegion(this, name, new Region3(minVec, maxVec))); - } - - public FlagRegion getRegion(String name) - { - for (FlagRegion region : this.regions) - { - if (region.name.equals(name)) - { - return region; - } - } - return null; - } - - /** - * Gets all regions that intersect this point. - */ - public List getRegions(Vector3 position) - { - List returnRegions = new ArrayList(); - for (FlagRegion region : this.regions) - { - if (region.region.isIn(position)) - { - returnRegions.add(region); - } - } - return returnRegions; - } - - public boolean removeRegion(String name) - { - for (FlagRegion region : this.regions) - { - if (region.name.equals(name)) - { - this.regions.remove(region); - return true; - } - } - - return false; - } - - public List getRegions() - { - Iterator it = this.regions.iterator(); - while (it.hasNext()) - { - FlagRegion region = it.next(); - - if (region == null) - { - it.remove(); - continue; - } - - if (region.name == null || region.name == "") - { - it.remove(); - continue; - } - } - - return this.regions; - } -} diff --git a/common/calclavia/lib/flag/ModFlag.java b/common/calclavia/lib/flag/ModFlag.java deleted file mode 100644 index fa1a8527d..000000000 --- a/common/calclavia/lib/flag/ModFlag.java +++ /dev/null @@ -1,117 +0,0 @@ -package calclavia.lib.flag; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import universalelectricity.core.vector.Vector3; - -public class ModFlag extends FlagBase -{ - /** - * An array of world flag data. Each representing a world. - */ - private final List flagWorlds = new ArrayList(); - - /** - * Initiates a new mod flag data and loads everything from NBT into memory. Only exists server - * side. - * - * @param nbt - */ - public ModFlag(NBTTagCompound nbt) - { - this.readFromNBT(nbt); - } - - @Override - public void readFromNBT(NBTTagCompound nbt) - { - if (nbt != null) - { - // A list containing all dimension ID and data within it. - Iterator dimensions = nbt.getTags().iterator(); - - while (dimensions.hasNext()) - { - NBTTagCompound dimensionCompound = (NBTTagCompound) dimensions.next(); - - try - { - int dimensionID = Integer.parseInt(dimensionCompound.getName().replace("dim_", "")); - World world = DimensionManager.getWorld(dimensionID); - FlagWorld flagWorld = new FlagWorld(world); - flagWorld.readFromNBT(dimensionCompound); - this.flagWorlds.add(flagWorld); - } - catch (Exception e) - { - System.out.println("Mod Flag: Failed to read dimension data: " + dimensionCompound.getName()); - e.printStackTrace(); - } - } - } - } - - @Override - public void writeToNBT(NBTTagCompound nbt) - { - if (nbt != null) - { - for (FlagWorld worldData : this.flagWorlds) - { - try - { - nbt.setTag("dim_" + worldData.world.provider.dimensionId, worldData.getNBT()); - } - catch (Exception e) - { - System.out.println("Mod Flag: Failed to save world flag data: " + worldData.world); - e.printStackTrace(); - } - } - } - } - - public FlagWorld getFlagWorld(World world) - { - FlagWorld worldData = null; - - if (world != null) - { - for (FlagWorld data : this.flagWorlds) - { - if (data.world != null && data.world.provider != null) - { - if (data.world.provider.dimensionId == world.provider.dimensionId) - { - worldData = data; - break; - } - } - } - - // If data is null, create it. - if (worldData == null) - { - worldData = new FlagWorld(world); - this.flagWorlds.add(worldData); - } - } - - return worldData; - } - - public boolean containsValue(World world, String flagName, String checkValue, Vector3 position) - { - return this.getFlagWorld(world).containsValue(flagName, checkValue, position); - } - - public List getFlagWorlds() - { - return this.flagWorlds; - } -} diff --git a/common/calclavia/lib/gui/ContainerBase.java b/common/calclavia/lib/gui/ContainerBase.java deleted file mode 100644 index 1cc8b03a7..000000000 --- a/common/calclavia/lib/gui/ContainerBase.java +++ /dev/null @@ -1,136 +0,0 @@ -package calclavia.lib.gui; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import calclavia.lib.IPlayerUsing; - -public class ContainerBase extends Container -{ - protected int slotCount = 0; - protected int xInventoryDisplacement = 8; - protected int yInventoryDisplacement = 135; - protected int yHotBarDisplacement = 193; - private IInventory inventory; - - public ContainerBase(IInventory inventory) - { - this.inventory = inventory; - this.slotCount = inventory.getSizeInventory(); - } - - @Override - public void onContainerClosed(EntityPlayer entityplayer) - { - super.onContainerClosed(entityplayer); - - if (this.inventory instanceof IPlayerUsing) - { - ((IPlayerUsing) this.inventory).getPlayersUsing().remove(entityplayer); - } - } - - public void addPlayerInventory(EntityPlayer player) - { - if (this.inventory instanceof IPlayerUsing) - { - ((IPlayerUsing) this.inventory).getPlayersUsing().add(player); - } - - for (int y = 0; y < 3; y++) - { - for (int x = 0; x < 9; x++) - { - this.addSlotToContainer(new Slot(player.inventory, x + y * 9 + 9, this.xInventoryDisplacement + x * 18, this.yInventoryDisplacement + y * 18)); - } - - } - - for (int x = 0; x < 9; x++) - { - this.addSlotToContainer(new Slot(player.inventory, x, this.xInventoryDisplacement + x * 18, this.yHotBarDisplacement)); - } - } - - /** - * Called to transfer a stack from one inventory to the other eg. when shift clicking. - */ - @Override - public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotID) - { - ItemStack var2 = null; - - Slot var3 = (Slot) this.inventorySlots.get(slotID); - - if (var3 != null && var3.getHasStack()) - { - ItemStack itemStack = var3.getStack(); - var2 = itemStack.copy(); - - // A slot ID greater than the slot count means it is inside the TileEntity GUI. - if (slotID >= this.slotCount) - { - // Player Inventory, Try to place into slot. - boolean didTry = false; - - for (int i = 0; i < this.slotCount; i++) - { - if (this.getSlot(i).isItemValid(itemStack)) - { - didTry = true; - - if (this.mergeItemStack(itemStack, i, i + 1, false)) - { - break; - } - } - } - - if (!didTry) - { - if (slotID < 27 + this.slotCount) - { - if (!this.mergeItemStack(itemStack, 27 + this.slotCount, 36 + this.slotCount, false)) - { - return null; - } - } - else if (slotID >= 27 + this.slotCount && slotID < 36 + this.slotCount && !this.mergeItemStack(itemStack, slotCount, 27 + slotCount, false)) - { - return null; - } - } - } - else if (!this.mergeItemStack(itemStack, this.slotCount, 36 + this.slotCount, false)) - { - return null; - } - - if (itemStack.stackSize == 0) - { - var3.putStack((ItemStack) null); - } - else - { - var3.onSlotChanged(); - } - - if (itemStack.stackSize == var2.stackSize) - { - return null; - } - - var3.onPickupFromSlot(par1EntityPlayer, itemStack); - } - - return var2; - } - - @Override - public boolean canInteractWith(EntityPlayer entityplayer) - { - return this.inventory.isUseableByPlayer(entityplayer); - } -} diff --git a/common/calclavia/lib/gui/GuiBase.java b/common/calclavia/lib/gui/GuiBase.java deleted file mode 100644 index 7e8fa1bb7..000000000 --- a/common/calclavia/lib/gui/GuiBase.java +++ /dev/null @@ -1,197 +0,0 @@ -package calclavia.lib.gui; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderHelper; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public abstract class GuiBase extends GuiScreen -{ - /** - * The X size of the inventory window in pixels. - */ - protected int xSize = 176; - - /** - * The Y size of the inventory window in pixels. - */ - protected int ySize = 166; - - /** - * Starting X position for the Gui. Inconsistent use for Gui backgrounds. - */ - protected int guiLeft; - - /** - * Starting Y position for the Gui. Inconsistent use for Gui backgrounds. - */ - protected int guiTop; - - /** - * Adds the buttons (and other controls) to the screen in question. - */ - @Override - public void initGui() - { - super.initGui(); - this.guiLeft = (this.width - this.xSize) / 2; - this.guiTop = (this.height - this.ySize) / 2; - } - - /** - * Draws the screen and all the components in it. - */ - @Override - public void drawScreen(int par1, int par2, float par3) - { - this.drawDefaultBackground(); - int var4 = this.guiLeft; - int var5 = this.guiTop; - this.drawBackgroundLayer(par1, par2, par3); - GL11.glPushMatrix(); - GL11.glTranslatef(var4, var5, 0.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - short var7 = 240; - short var8 = 240; - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var7 / 1.0F, var8 / 1.0F); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.drawForegroundLayer(par1, par2, par3); - - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - GL11.glPopMatrix(); - super.drawScreen(par1, par2, par3); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glEnable(GL11.GL_DEPTH_TEST); - } - - /** - * Draws the foreground layer for the GUI - */ - protected abstract void drawForegroundLayer(int var2, int var3, float var1); - - /** - * Draws the background layer for the GUI - */ - - protected abstract void drawBackgroundLayer(int var2, int var3, float var1); - - /** - * Fired when a key is typed. This is the equivalent of KeyListener.keyTyped(KeyEvent e). - */ - @Override - protected void keyTyped(char x, int y) - { - if (y == 1 || y == this.mc.gameSettings.keyBindInventory.keyCode) - { - this.mc.thePlayer.closeScreen(); - } - } - - /** - * Returns true if this GUI should pause the game when it is displayed in single-player - */ - @Override - public boolean doesGuiPauseGame() - { - return false; - } - - /** - * Called from the main game loop to update the screen. - */ - @Override - public void updateScreen() - { - super.updateScreen(); - - if (!this.mc.thePlayer.isEntityAlive() || this.mc.thePlayer.isDead) - { - this.mc.thePlayer.closeScreen(); - } - } - - public void drawTooltip(int x, int y, String... toolTips) - { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - if (toolTips != null) - { - int var5 = 0; - int var6; - int var7; - - for (var6 = 0; var6 < toolTips.length; ++var6) - { - var7 = this.fontRenderer.getStringWidth(toolTips[var6]); - - if (var7 > var5) - { - var5 = var7; - } - } - - var6 = x + 12; - var7 = y - 12; - int var9 = 8; - - if (toolTips.length > 1) - { - var9 += 2 + (toolTips.length - 1) * 10; - } - - if (this.guiTop + var7 + var9 + 6 > this.height) - { - var7 = this.height - var9 - this.guiTop - 6; - } - - this.zLevel = 300.0F; - int var10 = -267386864; - this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10); - this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10); - int var11 = 1347420415; - int var12 = (var11 & 16711422) >> 1 | var11 & -16777216; - this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11); - this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12); - - for (int var13 = 0; var13 < toolTips.length; ++var13) - { - String var14 = toolTips[var13]; - - this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1); - - if (var13 == 0) - { - var7 += 2; - } - - var7 += 10; - } - - this.zLevel = 0.0F; - } - - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_LIGHTING); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } -} diff --git a/common/calclavia/lib/gui/GuiContainerBase.java b/common/calclavia/lib/gui/GuiContainerBase.java deleted file mode 100644 index a2ee2417b..000000000 --- a/common/calclavia/lib/gui/GuiContainerBase.java +++ /dev/null @@ -1,470 +0,0 @@ -package calclavia.lib.gui; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.inventory.Container; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Icon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import universalelectricity.compatibility.Compatibility; -import universalelectricity.core.electricity.ElectricityDisplay; -import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit; -import universalelectricity.core.vector.Vector2; -import universalelectricity.prefab.TranslationHelper; -import universalelectricity.prefab.vector.Region2; -import calclavia.lib.Calclavia; -import calclavia.lib.render.CalclaviaRenderHelper; - -public class GuiContainerBase extends GuiContainer -{ - public ResourceLocation baseTexture; - - public enum SlotType - { - NONE, BATTERY, LIQUID, GAS, ARR_UP, ARR_DOWN, ARR_LEFT, ARR_RIGHT, ARR_UP_RIGHT, - ARR_UP_LEFT, ARR_DOWN_LEFT, ARR_DOWN_RIGHT - } - - protected int meterX = 54; - protected int meterHeight = 49; - protected int meterWidth = 14; - protected int meterEnd = meterX + meterWidth; - - protected int energyMode = 0; - - public String tooltip = ""; - protected HashMap tooltips = new HashMap(); - - protected int containerWidth; - protected int containerHeight; - - public GuiContainerBase(Container container) - { - super(container); - this.ySize = 217; - this.baseTexture = Calclavia.GUI_BASE; - } - - @Override - public void initGui() - { - super.initGui(); - } - - @Override - public void onGuiClosed() - { - Keyboard.enableRepeatEvents(false); - super.onGuiClosed(); - } - - @Override - protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) - { - Iterator> it = this.tooltips.entrySet().iterator(); - - while (it.hasNext()) - { - Entry entry = it.next(); - - if (entry.getKey().isIn(new Vector2(mouseX - this.guiLeft, mouseY - this.guiTop))) - { - this.tooltip = entry.getValue(); - break; - } - } - - if (this.tooltip != null && this.tooltip != "") - { - this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop, Calclavia.splitStringPerWord(this.tooltip, 5).toArray(new String[] {})); - } - - this.tooltip = ""; - - } - - @Override - protected void drawGuiContainerBackgroundLayer(float var1, int x, int y) - { - this.containerWidth = (this.width - this.xSize) / 2; - this.containerHeight = (this.height - this.ySize) / 2; - - this.mc.renderEngine.bindTexture(this.baseTexture); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize); - } - - protected void drawBulb(int x, int y, boolean isOn) - { - this.mc.renderEngine.bindTexture(this.baseTexture); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (isOn) - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 161, 0, 6, 6); - - } - else - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 161, 4, 6, 6); - } - } - - protected void drawSlot(int x, int y, ItemStack itemStack) - { - this.mc.renderEngine.bindTexture(this.baseTexture); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 0, 18, 18); - - this.drawItemStack(itemStack, this.containerWidth + x, this.containerHeight + y); - } - - protected void drawItemStack(ItemStack itemStack, int x, int y) - { - x += 1; - y += 1; - GL11.glTranslatef(0.0F, 0.0F, 32.0F); - - // drawTexturedModelRectFromIcon - // GL11.glEnable(GL11.GL_BLEND); - // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - itemRenderer.renderItemAndEffectIntoGUI(this.fontRenderer, this.mc.renderEngine, itemStack, x, y); - // GL11.glDisable(GL11.GL_BLEND); - } - - protected void drawTextWithTooltip(String textName, String format, int x, int y, int mouseX, int mouseY) - { - this.drawTextWithTooltip(textName, format, x, y, mouseX, mouseY, 4210752); - } - - protected void drawTextWithTooltip(String textName, String format, int x, int y, int mouseX, int mouseY, int color) - { - String name = TranslationHelper.getLocal("gui." + textName + ".name"); - String text = format.replaceAll("%1", name); - this.fontRenderer.drawString(text, x, y, color); - - String tooltip = TranslationHelper.getLocal("gui." + textName + ".tooltip"); - - if (tooltip != null && tooltip != "") - { - if (this.isPointInRegion(x, y, (int) (text.length() * 4.8), 12, mouseX, mouseY)) - { - this.tooltip = tooltip; - } - } - } - - protected void drawTextWithTooltip(String textName, int x, int y, int mouseX, int mouseY) - { - this.drawTextWithTooltip(textName, "%1", x, y, mouseX, mouseY); - } - - protected void drawSlot(int x, int y, GuiSlotType type, float r, float g, float b) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(r, g, b, 1.0F); - - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 0, 18, 18); - - if (type != GuiSlotType.NONE) - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 18 * type.ordinal(), 18, 18); - } - } - - protected void drawSlot(int x, int y, GuiSlotType type) - { - this.drawSlot(x, y, type, 1, 1, 1); - } - - protected void drawSlot(int x, int y) - { - this.drawSlot(x, y, GuiSlotType.NONE); - } - - protected void drawBar(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 18, 0, 22, 15); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 18, 15, 22 - (int) (scale * 22), 15); - } - } - - protected void drawForce(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 0, 107, 11); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, meterX, 11, (int) (scale * 107), 11); - } - } - - protected void drawElectricity(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 0, 107, 11); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 22, (int) (scale * 107), 11); - } - } - - protected void drawMeter(int x, int y, float scale, float r, float g, float b) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw the background meter. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 0, this.meterWidth, this.meterHeight); - - /** - * Draw liquid/gas inside - */ - GL11.glColor4f(r, g, b, 1.0F); - int actualScale = (int) ((this.meterHeight - 1) * scale); - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y + (this.meterHeight - 1 - actualScale), 40, 49, this.meterHeight - 1, actualScale); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - /** - * Draw measurement lines - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 49 * 2, this.meterWidth, this.meterHeight); - } - - protected void drawMeter(int x, int y, float scale, FluidStack liquidStack) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw the background meter. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 0, meterWidth, meterHeight); - - /** - * Draw liquid/gas inside - */ - this.displayGauge(this.containerWidth + x, this.containerHeight + y, -10, 1, 12, (int) ((meterHeight - 1) * scale), liquidStack); - - /** - * Draw measurement lines - */ - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 49 * 2, meterWidth, meterHeight); - } - - protected void drawSlot(int x, int y, SlotType type, float r, float g, float b) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_COMPONENTS); - GL11.glColor4f(r, g, b, 1.0F); - - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 0, 18, 18); - - if (type != SlotType.NONE) - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 18 * type.ordinal(), 18, 18); - } - } - - protected void drawSlot(int x, int y, SlotType type) - { - this.drawSlot(x, y, type, 1, 1, 1); - } - - public void renderUniversalDisplay(int x, int y, float energy, int mouseX, int mouseY) - { - String display; - switch (this.energyMode) - { - default: - display = ElectricityDisplay.getDisplay(energy, ElectricUnit.WATT); - break; - case 1: - display = ElectricityDisplay.roundDecimals(energy * Compatibility.TO_BC_RATIO) + " MJ"; - break; - case 2: - display = ElectricityDisplay.roundDecimals(energy * Compatibility.TO_IC2_RATIO) + " EU"; - break; - } - - if (Mouse.isButtonDown(0) && this.isPointInRegion(x, y, display.length() * 5, 9, mouseX, mouseY)) - { - this.energyMode = (this.energyMode + 1) % 3; - } - - this.fontRenderer.drawString(display, x, y, 4210752); - - } - - public void drawTooltip(int x, int y, String... toolTips) - { - if (!GuiScreen.isShiftKeyDown()) - { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - if (toolTips != null) - { - int var5 = 0; - int var6; - int var7; - - for (var6 = 0; var6 < toolTips.length; ++var6) - { - var7 = this.fontRenderer.getStringWidth(toolTips[var6]); - - if (var7 > var5) - { - var5 = var7; - } - } - - var6 = x + 12; - var7 = y - 12; - - int var9 = 8; - - if (toolTips.length > 1) - { - var9 += 2 + (toolTips.length - 1) * 10; - } - - if (this.guiTop + var7 + var9 + 6 > this.height) - { - var7 = this.height - var9 - this.guiTop - 6; - } - - this.zLevel = 300.0F; - int var10 = -267386864; - this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10); - this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10); - int var11 = 1347420415; - int var12 = (var11 & 16711422) >> 1 | var11 & -16777216; - this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11); - this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12); - - for (int var13 = 0; var13 < toolTips.length; ++var13) - { - String var14 = toolTips[var13]; - - this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1); - var7 += 10; - } - - this.zLevel = 0.0F; - - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_LIGHTING); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } - } - } - - /** - * Based on BuildCraft - */ - protected void displayGauge(int j, int k, int line, int col, int width, int squaled, FluidStack liquid) - { - squaled -= 1; - - if (liquid == null) - { - return; - } - - int start = 0; - - Icon liquidIcon = null; - Fluid fluid = liquid.getFluid(); - - if (fluid != null && fluid.getStillIcon() != null) - { - liquidIcon = fluid.getStillIcon(); - } - - CalclaviaRenderHelper.setSpriteTexture(fluid.getSpriteNumber()); - - if (liquidIcon != null) - { - while (true) - { - int x; - - if (squaled > 16) - { - x = 16; - squaled -= 16; - } - else - { - x = squaled; - squaled = 0; - } - - this.drawTexturedModelRectFromIcon(j + col, k + line + 58 - x - start, liquidIcon, width, 16 - (16 - x)); - start = start + 16; - - if (x == 0 || squaled == 0) - { - break; - } - } - } - } -} diff --git a/common/calclavia/lib/gui/GuiScreenBase.java b/common/calclavia/lib/gui/GuiScreenBase.java deleted file mode 100644 index a54c2a477..000000000 --- a/common/calclavia/lib/gui/GuiScreenBase.java +++ /dev/null @@ -1,370 +0,0 @@ -package calclavia.lib.gui; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import net.minecraft.block.Block; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.item.Item; -import net.minecraft.util.Icon; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; - -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - -import universalelectricity.core.vector.Vector2; -import universalelectricity.prefab.TranslationHelper; -import universalelectricity.prefab.vector.Region2; -import calclavia.lib.Calclavia; - -public class GuiScreenBase extends GuiBase -{ - private static final int METER_X = 54; - public static final int METER_HEIGHT = 49; - public static final int METER_WIDTH = 14; - public static final int METER_END = METER_X + METER_WIDTH; - - public String tooltip = ""; - protected HashMap tooltips = new HashMap(); - - protected int containerWidth; - protected int containerHeight; - - public GuiScreenBase() - { - this.ySize = 217; - } - - @Override - protected void drawForegroundLayer(int mouseX, int mouseY, float var1) - { - Iterator> it = this.tooltips.entrySet().iterator(); - - while (it.hasNext()) - { - Entry entry = it.next(); - - if (entry.getKey().isIn(new Vector2(mouseX - this.guiLeft, mouseY - this.guiTop))) - { - this.tooltip = entry.getValue(); - break; - } - } - - if (this.tooltip != null && this.tooltip != "") - { - this.drawTooltip(mouseX - this.guiLeft, mouseY - this.guiTop, Calclavia.splitStringPerWord(this.tooltip, 5).toArray(new String[] {})); - } - - this.tooltip = ""; - } - - @Override - protected void drawBackgroundLayer(int x, int y, float var1) - { - this.containerWidth = (this.width - this.xSize) / 2; - this.containerHeight = (this.height - this.ySize) / 2; - - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - this.drawTexturedModalRect(this.containerWidth, this.containerHeight, 0, 0, this.xSize, this.ySize); - } - - protected void drawBulb(int x, int y, boolean isOn) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - if (isOn) - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 161, 0, 6, 6); - - } - else - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 161, 4, 6, 6); - } - } - - protected void drawTextWithTooltip(String textName, String format, int x, int y, int mouseX, int mouseY) - { - this.drawTextWithTooltip(textName, format, x, y, mouseX, mouseY, 4210752); - } - - protected void drawTextWithTooltip(String textName, String format, int x, int y, int mouseX, int mouseY, int color) - { - String name = TranslationHelper.getLocal("gui." + textName + ".name"); - String text = format.replaceAll("%1", name); - this.fontRenderer.drawString(text, x, y, color); - - String tooltip = TranslationHelper.getLocal("gui." + textName + ".tooltip"); - - if (tooltip != null && tooltip != "") - { - if (this.isPointInRegion(x, y, (int) (text.length() * 4.8), 12, mouseX, mouseY)) - { - this.tooltip = tooltip; - } - } - } - - protected boolean isPointInRegion(int par1, int par2, int par3, int par4, int par5, int par6) - { - int k1 = this.guiLeft; - int l1 = this.guiTop; - par5 -= k1; - par6 -= l1; - return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1; - } - - protected void drawTextWithTooltip(String textName, int x, int y, int mouseX, int mouseY) - { - this.drawTextWithTooltip(textName, "%1", x, y, mouseX, mouseY); - } - - protected void drawSlot(int x, int y, GuiSlotType type, float r, float g, float b) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(r, g, b, 1.0F); - - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 0, 18, 18); - - if (type != GuiSlotType.NONE) - { - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 0, 18 * type.ordinal(), 18, 18); - } - } - - protected void drawSlot(int x, int y, GuiSlotType type) - { - this.drawSlot(x, y, type, 1, 1, 1); - } - - protected void drawSlot(int x, int y) - { - this.drawSlot(x, y, GuiSlotType.NONE); - } - - protected void drawBar(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 18, 0, 22, 15); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 18, 15, 22 - (int) (scale * 22), 15); - } - } - - protected void drawForce(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 0, 107, 11); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, METER_X, 11, (int) (scale * 107), 11); - } - } - - protected void drawElectricity(int x, int y, float scale) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw background progress bar/ - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 0, 107, 11); - - if (scale > 0) - { - /** - * Draw white color actual progress. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 54, 22, (int) (scale * 107), 11); - } - } - - protected void drawMeter(int x, int y, float scale, FluidStack fluidStack) - { - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - - /** - * Draw the background meter. - */ - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 0, METER_WIDTH, METER_HEIGHT); - - /** - * Draw liquid/gas inside - */ - this.displayGauge(this.containerWidth + x, this.containerHeight + y, 0, 0, (int) ((METER_HEIGHT - 1) * scale), fluidStack); - /** - * Draw measurement lines - */ - this.mc.renderEngine.bindTexture(Calclavia.GUI_EMPTY_FILE); - this.drawTexturedModalRect(this.containerWidth + x, this.containerHeight + y, 40, 49 * 2, METER_WIDTH, METER_HEIGHT); - } - - @Override - public void drawTooltip(int x, int y, String... toolTips) - { - if (!GuiScreen.isShiftKeyDown()) - { - GL11.glDisable(GL12.GL_RESCALE_NORMAL); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_DEPTH_TEST); - - if (toolTips != null) - { - int var5 = 0; - int var6; - int var7; - - for (var6 = 0; var6 < toolTips.length; ++var6) - { - var7 = this.fontRenderer.getStringWidth(toolTips[var6]); - - if (var7 > var5) - { - var5 = var7; - } - } - - var6 = x + 12; - var7 = y - 12; - - int var9 = 8; - - if (toolTips.length > 1) - { - var9 += 2 + (toolTips.length - 1) * 10; - } - - if (this.guiTop + var7 + var9 + 6 > this.height) - { - var7 = this.height - var9 - this.guiTop - 6; - } - - this.zLevel = 300.0F; - int var10 = -267386864; - this.drawGradientRect(var6 - 3, var7 - 4, var6 + var5 + 3, var7 - 3, var10, var10); - this.drawGradientRect(var6 - 3, var7 + var9 + 3, var6 + var5 + 3, var7 + var9 + 4, var10, var10); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 - 4, var7 - 3, var6 - 3, var7 + var9 + 3, var10, var10); - this.drawGradientRect(var6 + var5 + 3, var7 - 3, var6 + var5 + 4, var7 + var9 + 3, var10, var10); - int var11 = 1347420415; - int var12 = (var11 & 16711422) >> 1 | var11 & -16777216; - this.drawGradientRect(var6 - 3, var7 - 3 + 1, var6 - 3 + 1, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 + var5 + 2, var7 - 3 + 1, var6 + var5 + 3, var7 + var9 + 3 - 1, var11, var12); - this.drawGradientRect(var6 - 3, var7 - 3, var6 + var5 + 3, var7 - 3 + 1, var11, var11); - this.drawGradientRect(var6 - 3, var7 + var9 + 2, var6 + var5 + 3, var7 + var9 + 3, var12, var12); - - for (int var13 = 0; var13 < toolTips.length; ++var13) - { - String var14 = toolTips[var13]; - - this.fontRenderer.drawStringWithShadow(var14, var6, var7, -1); - var7 += 10; - } - - this.zLevel = 0.0F; - - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_LIGHTING); - RenderHelper.enableGUIStandardItemLighting(); - GL11.glEnable(GL12.GL_RESCALE_NORMAL); - } - } - } - - /** - * Based on BuildCraft - */ - protected void displayGauge(int j, int k, int line, int col, int squaled, FluidStack fluid) - { - if (fluid == null) - { - return; - } - int start = 0; - - Icon liquidIcon; - ResourceLocation textureSheet; - - if (fluid.getFluid().getIcon() != null) - { - if (fluid.getFluid().canBePlacedInWorld()) - { - textureSheet = new ResourceLocation("/terrain.png"); - } - else - { - textureSheet = new ResourceLocation("/terrain.png"); - } - liquidIcon = fluid.getFluid().getIcon(); - } - else - { - if (fluid.fluidID < Block.blocksList.length && Block.blocksList[fluid.fluidID].blockID > 0) - { - liquidIcon = Block.blocksList[fluid.fluidID].getIcon(0, 0); - textureSheet = new ResourceLocation("/terrain.png"); - } - else - { - liquidIcon = Item.itemsList[fluid.fluidID].getIconFromDamage(0); - textureSheet = new ResourceLocation("/gui/items.png"); - } - } - - this.mc.renderEngine.bindTexture(textureSheet); - - while (true) - { - int x = 0; - - if (squaled > 16) - { - x = 16; - squaled -= 16; - } - else - { - x = squaled; - squaled = 0; - } - - drawTexturedModelRectFromIcon(j + col, k + line + 58 - x - start, liquidIcon, 16, 16 - (16 - x)); - start = start + 16; - - if (x == 0 || squaled == 0) - { - break; - } - } - } -} diff --git a/common/calclavia/lib/gui/GuiSlotType.java b/common/calclavia/lib/gui/GuiSlotType.java deleted file mode 100644 index f3e646055..000000000 --- a/common/calclavia/lib/gui/GuiSlotType.java +++ /dev/null @@ -1,7 +0,0 @@ -package calclavia.lib.gui; - -public enum GuiSlotType -{ - NONE, BATTERY, LIQUID, ARR_UP, ARR_DOWN, ARR_LEFT, ARR_RIGHT, ARR_UP_RIGHT, ARR_UP_LEFT, - ARR_DOWN_LEFT, ARR_DOWN_RIGHT -} diff --git a/common/calclavia/lib/multiblock/BlockMulti.java b/common/calclavia/lib/multiblock/BlockMulti.java deleted file mode 100644 index d207304cc..000000000 --- a/common/calclavia/lib/multiblock/BlockMulti.java +++ /dev/null @@ -1,164 +0,0 @@ -package calclavia.lib.multiblock; - -import java.util.Random; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; -import net.minecraft.client.renderer.texture.IconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import universalelectricity.core.UniversalElectricity; -import universalelectricity.core.vector.Vector3; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class BlockMulti extends BlockContainer -{ - public String textureName = null; - public String channel = ""; - - public BlockMulti(int id) - { - super(id, UniversalElectricity.machine); - this.setHardness(0.8F); - this.setUnlocalizedName("multiBlock"); - } - - public BlockMulti setChannel(String channel) - { - this.channel = channel; - return this; - } - - @Override - public BlockMulti setTextureName(String name) - { - this.textureName = name; - return this; - } - - public void createMultiBlockStructure(IMultiBlock tile) - { - TileEntity tileEntity = (TileEntity) tile; - Vector3[] positions = tile.getMultiBlockVectors(); - - for (Vector3 position : positions) - { - makeFakeBlock(tileEntity.worldObj, new Vector3(tileEntity).translate(position), new Vector3(tileEntity)); - } - } - - public void destroyMultiBlockStructure(IMultiBlock tile) - { - TileEntity tileEntity = (TileEntity) tile; - Vector3[] positions = tile.getMultiBlockVectors(); - - for (Vector3 position : positions) - { - new Vector3(tileEntity).translate(position).setBlock(tileEntity.worldObj, 0); - } - - new Vector3(tileEntity).setBlock(tileEntity.worldObj, 0); - } - - public void makeFakeBlock(World worldObj, Vector3 position, Vector3 mainBlock) - { - // Creates a fake block, then sets the relative main block position. - worldObj.setBlock(position.intX(), position.intY(), position.intZ(), this.blockID); - ((TileEntityMultiBlockPart) worldObj.getBlockTileEntity(position.intX(), position.intY(), position.intZ())).setMainBlock(mainBlock); - } - - @SideOnly(Side.CLIENT) - @Override - public void registerIcons(IconRegister iconRegister) - { - if (this.textureName != null) - { - this.blockIcon = iconRegister.registerIcon(this.textureName); - } - else - { - super.registerIcons(iconRegister); - } - } - - @Override - public void breakBlock(World world, int x, int y, int z, int par5, int par6) - { - TileEntity tileEntity = world.getBlockTileEntity(x, y, z); - - if (tileEntity instanceof TileEntityMultiBlockPart) - { - ((TileEntityMultiBlockPart) tileEntity).onBlockRemoval(this); - } - - super.breakBlock(world, x, y, z, par5, par6); - } - - /** - * Called when the block is right clicked by the player. This modified version detects electric - * items and wrench actions on your machine block. Do not override this function. Use - * machineActivated instead! (It does the same thing) - */ - @Override - public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) - { - TileEntityMultiBlockPart tileEntity = (TileEntityMultiBlockPart) par1World.getBlockTileEntity(x, y, z); - return tileEntity.onBlockActivated(par1World, x, y, z, par5EntityPlayer); - } - - /** - * Returns the quantity of items to drop on block destruction. - */ - @Override - public int quantityDropped(Random par1Random) - { - return 0; - } - - @Override - public int getRenderType() - { - return -1; - } - - @Override - public boolean isOpaqueCube() - { - return false; - } - - @Override - public boolean renderAsNormalBlock() - { - return false; - } - - @Override - public TileEntity createNewTileEntity(World var1) - { - return new TileEntityMultiBlockPart(this.channel); - } - - @Override - public ItemStack getPickBlock(MovingObjectPosition target, World par1World, int x, int y, int z) - { - TileEntity tileEntity = par1World.getBlockTileEntity(x, y, z); - Vector3 mainBlockPosition = ((TileEntityMultiBlockPart) tileEntity).getMainBlock(); - - if (mainBlockPosition != null) - { - int mainBlockID = par1World.getBlockId(mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); - - if (mainBlockID > 0) - { - return Block.blocksList[mainBlockID].getPickBlock(target, par1World, mainBlockPosition.intX(), mainBlockPosition.intY(), mainBlockPosition.intZ()); - } - } - - return null; - } -} \ No newline at end of file diff --git a/common/calclavia/lib/multiblock/IBlockActivate.java b/common/calclavia/lib/multiblock/IBlockActivate.java deleted file mode 100644 index 76869be0b..000000000 --- a/common/calclavia/lib/multiblock/IBlockActivate.java +++ /dev/null @@ -1,17 +0,0 @@ -package calclavia.lib.multiblock; - -import net.minecraft.entity.player.EntityPlayer; - -/** - * A general interface to be implemented by anything that needs it. - * - * @author Calclavia - * - */ -public interface IBlockActivate -{ - /** - * Called when activated - */ - public boolean onActivated(EntityPlayer entityPlayer); -} \ No newline at end of file diff --git a/common/calclavia/lib/multiblock/IMultiBlock.java b/common/calclavia/lib/multiblock/IMultiBlock.java deleted file mode 100644 index af1068b16..000000000 --- a/common/calclavia/lib/multiblock/IMultiBlock.java +++ /dev/null @@ -1,18 +0,0 @@ -package calclavia.lib.multiblock; - -import universalelectricity.core.vector.Vector3; - -/** - * Interface to be applied to tile entity blocks that occupies more than one block space. Useful for - * large machines. - * - * @author Calclavia - * - */ -public interface IMultiBlock -{ - /** - * @return An array of Vector3 containing the multiblock relative coordinates to be constructed. - */ - public Vector3[] getMultiBlockVectors(); -} diff --git a/common/calclavia/lib/multiblock/MultiBlock.java b/common/calclavia/lib/multiblock/MultiBlock.java deleted file mode 100644 index 224947e10..000000000 --- a/common/calclavia/lib/multiblock/MultiBlock.java +++ /dev/null @@ -1,6 +0,0 @@ -package calclavia.lib.multiblock; - -public class MultiBlock -{ - -} diff --git a/common/calclavia/lib/multiblock/TileEntityMultiBlockPart.java b/common/calclavia/lib/multiblock/TileEntityMultiBlockPart.java deleted file mode 100644 index bc3359aac..000000000 --- a/common/calclavia/lib/multiblock/TileEntityMultiBlockPart.java +++ /dev/null @@ -1,158 +0,0 @@ -package calclavia.lib.multiblock; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.INetworkManager; -import net.minecraft.network.packet.Packet; -import net.minecraft.network.packet.Packet250CustomPayload; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import universalelectricity.core.vector.Vector3; -import universalelectricity.prefab.network.IPacketReceiver; -import universalelectricity.prefab.network.PacketManager; - -import com.google.common.io.ByteArrayDataInput; - -/** - * This is a multiblock to be used for blocks that are bigger than one block. - * - * @author Calclavia - * - */ -public class TileEntityMultiBlockPart extends TileEntity implements IPacketReceiver -{ - // The the position of the main block. Relative to this block's position. - private Vector3 mainBlockPosition; - public String channel; - - public TileEntityMultiBlockPart() - { - - } - - public TileEntityMultiBlockPart(String channel) - { - this.channel = channel; - } - - public Vector3 getMainBlock() - { - if (this.mainBlockPosition != null) - { - return new Vector3(this).translate(this.mainBlockPosition); - } - - return null; - } - - public void setMainBlock(Vector3 mainBlock) - { - this.mainBlockPosition = mainBlock.clone().translate(new Vector3(this).invert()); - - if (!this.worldObj.isRemote) - { - this.worldObj.markBlockForUpdate(this.xCoord, this.yCoord, this.zCoord); - } - } - - @Override - public Packet getDescriptionPacket() - { - if (this.mainBlockPosition != null) - { - if (this.channel == null || this.channel == "" && this.getBlockType() instanceof BlockMulti) - { - this.channel = ((BlockMulti) this.getBlockType()).channel; - } - - return PacketManager.getPacket(this.channel, this, this.mainBlockPosition.intX(), this.mainBlockPosition.intY(), this.mainBlockPosition.intZ()); - } - - return null; - } - - @Override - public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) - { - try - { - this.mainBlockPosition = new Vector3(dataStream.readInt(), dataStream.readInt(), dataStream.readInt()); - } - catch (Exception e) - { - e.printStackTrace(); - } - } - - public void onBlockRemoval(BlockMulti block) - { - if (this.getMainBlock() != null) - { - TileEntity tileEntity = this.getMainBlock().getTileEntity(this.worldObj); - - if (tileEntity instanceof IMultiBlock) - { - block.destroyMultiBlockStructure((IMultiBlock) tileEntity); - } - } - } - - public boolean onBlockActivated(World par1World, int x, int y, int z, EntityPlayer entityPlayer) - { - if (this.getMainBlock() != null) - { - TileEntity tileEntity = this.getMainBlock().getTileEntity(this.worldObj); - - if (tileEntity instanceof IBlockActivate) - { - return ((IBlockActivate) tileEntity).onActivated(entityPlayer); - } - } - - return false; - } - - /** - * Reads a tile entity from NBT. - */ - @Override - public void readFromNBT(NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - if (nbt.hasKey("mainBlockPosition")) - { - this.mainBlockPosition = new Vector3(nbt.getCompoundTag("mainBlockPosition")); - } - - this.channel = nbt.getString("channel"); - - } - - /** - * Writes a tile entity to NBT. - */ - @Override - public void writeToNBT(NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - if (this.mainBlockPosition != null) - { - nbt.setCompoundTag("mainBlockPosition", this.mainBlockPosition.writeToNBT(new NBTTagCompound())); - } - - nbt.setString("channel", this.channel); - } - - /** - * Determines if this TileEntity requires update calls. - * - * @return True if you want updateEntity() to be called, false if not - */ - @Override - public boolean canUpdate() - { - return false; - } -} \ No newline at end of file diff --git a/common/calclavia/lib/render/CalclaviaRenderHelper.java b/common/calclavia/lib/render/CalclaviaRenderHelper.java deleted file mode 100644 index 44b03df46..000000000 --- a/common/calclavia/lib/render/CalclaviaRenderHelper.java +++ /dev/null @@ -1,173 +0,0 @@ -package calclavia.lib.render; - -import static org.lwjgl.opengl.GL11.GL_BLEND; -import static org.lwjgl.opengl.GL11.GL_FLAT; -import static org.lwjgl.opengl.GL11.GL_LINE_SMOOTH; -import static org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.GL_POLYGON_SMOOTH; -import static org.lwjgl.opengl.GL11.GL_SMOOTH; -import static org.lwjgl.opengl.GL11.GL_SRC_ALPHA; -import static org.lwjgl.opengl.GL11.glBlendFunc; -import static org.lwjgl.opengl.GL11.glDisable; -import static org.lwjgl.opengl.GL11.glEnable; -import static org.lwjgl.opengl.GL11.glRotatef; -import static org.lwjgl.opengl.GL11.glShadeModel; -import static org.lwjgl.opengl.GL11.glTranslatef; -import net.minecraft.block.Block; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.client.FMLClientHandler; - -public class CalclaviaRenderHelper -{ - public static final ResourceLocation PARTICLE_RESOURCE = new ResourceLocation("textures/particle/particles.png"); - - public static void setTerrainTexture() - { - setSpriteTexture(0); - } - - public static void setSpriteTexture(ItemStack itemStack) - { - setSpriteTexture(itemStack.getItemSpriteNumber()); - } - - public static void setSpriteTexture(int sprite) - { - FMLClientHandler.instance().getClient().renderEngine.bindTexture(FMLClientHandler.instance().getClient().renderEngine.getResourceLocation(sprite)); - } - - /** - * Enables blending. - */ - public static void enableBlending() - { - glShadeModel(GL_SMOOTH); - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } - - /** - * Disables blending. - */ - public static void disableBlending() - { - glShadeModel(GL_FLAT); - glDisable(GL_LINE_SMOOTH); - glDisable(GL_POLYGON_SMOOTH); - glDisable(GL_BLEND); - } - - public static void enableLighting() - { - RenderHelper.enableStandardItemLighting(); - } - - /** - * Disables lighting and turns glow on. - */ - public static void disableLighting() - { - RenderHelper.disableStandardItemLighting(); - OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F); - } - - public static void renderNormalBlockAsItem(Block block, int metadata, RenderBlocks renderer) - { - Tessellator tessellator = Tessellator.instance; - - block.setBlockBoundsForItemRender(); - renderer.setRenderBoundsFromBlock(block); - glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - glTranslatef(-0.5F, -0.5F, -0.5F); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); - tessellator.draw(); - - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); - tessellator.draw(); - tessellator.startDrawingQuads(); - tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); - tessellator.draw(); - glTranslatef(0.5F, 0.5F, 0.5F); - } - - public static void renderFloatingText(String text, float x, float y, float z) - { - renderFloatingText(text, x, y, z, 0xFFFFFF); - } - - /** - * Renders a floating text in a specific position. - * - * @author Briman0094 - * - */ - public static void renderFloatingText(String text, float x, float y, float z, int color) - { - RenderManager renderManager = RenderManager.instance; - FontRenderer fontRenderer = renderManager.getFontRenderer(); - float scale = 0.027f; - GL11.glColor4f(1f, 1f, 1f, 0.5f); - GL11.glPushMatrix(); - GL11.glTranslatef(x + 0.0F, y + 2.3F, z); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GL11.glRotatef(-renderManager.playerViewY, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(renderManager.playerViewX, 1.0F, 0.0F, 0.0F); - GL11.glScalef(-scale, -scale, scale); - GL11.glDisable(GL11.GL_LIGHTING); - GL11.glDepthMask(false); - GL11.glDisable(GL11.GL_DEPTH_TEST); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - Tessellator tessellator = Tessellator.instance; - int yOffset = 0; - - GL11.glDisable(GL11.GL_TEXTURE_2D); - tessellator.startDrawingQuads(); - int stringMiddle = fontRenderer.getStringWidth(text) / 2; - tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.5F); - tessellator.addVertex(-stringMiddle - 1, -1 + yOffset, 0.0D); - tessellator.addVertex(-stringMiddle - 1, 8 + yOffset, 0.0D); - tessellator.addVertex(stringMiddle + 1, 8 + yOffset, 0.0D); - tessellator.addVertex(stringMiddle + 1, -1 + yOffset, 0.0D); - tessellator.draw(); - GL11.glEnable(GL11.GL_TEXTURE_2D); - GL11.glColor4f(1f, 1f, 1f, 0.5f); - fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color); - GL11.glEnable(GL11.GL_DEPTH_TEST); - GL11.glDepthMask(true); - fontRenderer.drawString(text, -fontRenderer.getStringWidth(text) / 2, yOffset, color); - GL11.glEnable(GL11.GL_LIGHTING); - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - -} diff --git a/common/calclavia/lib/render/ITagRender.java b/common/calclavia/lib/render/ITagRender.java deleted file mode 100644 index 90c551200..000000000 --- a/common/calclavia/lib/render/ITagRender.java +++ /dev/null @@ -1,23 +0,0 @@ -package calclavia.lib.render; - -import java.util.HashMap; - -import net.minecraft.entity.player.EntityPlayer; - -/** - * Applied to TileEntities to render a tag above them. - * - * @author Calclavia - * - */ -public interface ITagRender -{ - /** - * Gets the list of strings to render above the object. - * - * @param player The player this list will display for - * @param map HashMap of strings followed by there color Example {"Hello World",0x88FF88} - * @return The height in which the render should happen. - */ - public float addInformation(HashMap map, EntityPlayer player); -} diff --git a/common/calclavia/lib/render/RenderTaggedTile.java b/common/calclavia/lib/render/RenderTaggedTile.java deleted file mode 100644 index 0a47fa6f7..000000000 --- a/common/calclavia/lib/render/RenderTaggedTile.java +++ /dev/null @@ -1,89 +0,0 @@ -package calclavia.lib.render; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.entity.RendererLivingEntity; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -/** - * @author Rseifert & Calclavia - */ -@SideOnly(Side.CLIENT) -public abstract class RenderTaggedTile extends TileEntitySpecialRenderer -{ - @Override - public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f) - { - if (t != null) - { - if (t instanceof ITagRender && this.getPlayer().getDistance(t.xCoord, t.yCoord, t.zCoord) <= RendererLivingEntity.NAME_TAG_RANGE) - { - HashMap tags = new HashMap(); - float height = ((ITagRender) t).addInformation(tags, this.getPlayer()); - - EntityPlayer player = Minecraft.getMinecraft().thePlayer; - - if (player.ridingEntity == null) - { - MovingObjectPosition objectPosition = player.rayTrace(8, 1); - - if (objectPosition != null) - { - boolean isLooking = false; - - for (int h = 0; h < height; h++) - { - if (objectPosition.blockX == t.xCoord && objectPosition.blockY == t.yCoord + h && objectPosition.blockZ == t.zCoord) - { - isLooking = true; - } - } - - if (isLooking) - { - Iterator> it = tags.entrySet().iterator(); - int i = 0; - - while (it.hasNext()) - { - Entry entry = it.next(); - - if (entry.getKey() != null) - { - CalclaviaRenderHelper.renderFloatingText(entry.getKey(), (float) x + 0.5f, ((float) y + (i * 0.25f)) - 2f + height, (float) z + 0.5f, entry.getValue()); - } - - i++; - } - } - } - } - - } - } - } - - /** - * gets the player linked with the renderer - */ - public EntityPlayer getPlayer() - { - EntityLivingBase entity = this.tileEntityRenderer.entityLivingPlayer; - - if (entity instanceof EntityPlayer) - { - return (EntityPlayer) entity; - } - - return null; - } -} diff --git a/common/mekanism/induction/common/inventory/container/ContainerBattery.java b/common/mekanism/induction/common/inventory/container/ContainerBattery.java index 4628da2eb..7c7a3abbc 100644 --- a/common/mekanism/induction/common/inventory/container/ContainerBattery.java +++ b/common/mekanism/induction/common/inventory/container/ContainerBattery.java @@ -1,24 +1,23 @@ package mekanism.induction.common.inventory.container; -import mekanism.induction.common.BatteryManager; import mekanism.induction.common.BatteryManager.SlotBattery; import mekanism.induction.common.BatteryManager.SlotOut; import mekanism.induction.common.tileentity.TileEntityBattery; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Container; import net.minecraft.inventory.ICrafting; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import calclavia.lib.gui.ContainerBase; -public class ContainerBattery extends ContainerBase +public class ContainerBattery extends Container { private TileEntityBattery tileEntity; public ContainerBattery(InventoryPlayer inventory, TileEntityBattery unit) { - super(unit); tileEntity = unit; + addSlotToContainer(new SlotBattery(unit, 0, 8, 22)); addSlotToContainer(new SlotOut(unit, 1, 8, 58)); addSlotToContainer(new SlotBattery(unit, 2, 31, 22)); @@ -26,21 +25,21 @@ public class ContainerBattery extends ContainerBase int slotX; - for (slotX = 0; slotX < 3; ++slotX) + for(slotX = 0; slotX < 3; ++slotX) { - for (int slotY = 0; slotY < 9; ++slotY) + for(int slotY = 0; slotY < 9; ++slotY) { addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 125 + slotX * 18)); } } - for (slotX = 0; slotX < 9; ++slotX) + for(slotX = 0; slotX < 9; ++slotX) { addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 183)); } - tileEntity.openChest(); tileEntity.playersUsing.add(inventory.player); + tileEntity.openChest(); } @Override @@ -48,15 +47,15 @@ public class ContainerBattery extends ContainerBase { ItemStack stack = super.slotClick(slotID, par2, par3, par4EntityPlayer); - if (slotID == 1) + if(slotID == 1) { - ItemStack itemstack = ((Slot) inventorySlots.get(slotID)).getStack(); + ItemStack itemstack = ((Slot)inventorySlots.get(slotID)).getStack(); ItemStack itemstack1 = itemstack == null ? null : itemstack.copy(); inventoryItemStacks.set(slotID, itemstack1); - for (int j = 0; j < crafters.size(); ++j) + for(int j = 0; j < crafters.size(); ++j) { - ((ICrafting) crafters.get(j)).sendSlotContents(this, slotID, itemstack1); + ((ICrafting)crafters.get(j)).sendSlotContents(this, slotID, itemstack1); } } @@ -67,6 +66,7 @@ public class ContainerBattery extends ContainerBase public void onContainerClosed(EntityPlayer entityplayer) { super.onContainerClosed(entityplayer); + tileEntity.closeChest(); tileEntity.playersUsing.remove(entityplayer); } @@ -80,10 +80,11 @@ public class ContainerBattery extends ContainerBase @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int slotID) { - if (slotID != 1) + if(slotID != 1) { return super.transferStackInSlot(par1EntityPlayer, slotID); } + return null; } }