Fixed the wand charging station texture, moved the baubles API to package it, and using the @API annotation for it. Added the Config GUIs existing in MinecraftForge for EMT! Awesome!

This commit is contained in:
Tombenpotter committed 2014-07-15 15:00:03 +02:00
1 parent bfdc4d5f9c
commit f0ee38df32
44 files changed
+347 -289

No files matched your search

@@ -0,0 +1,7 @@
package baubles.api;
public enum BaubleType {
RING,
AMULET,
BELT
}
+34
View File
@@ -0,0 +1,34 @@
package baubles.api;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import java.lang.reflect.Method;
/**
* @author Azanor
*/
public class BaublesApi {
static Method getBaubles;
/**
* Retrieves the baubles inventory for the supplied player
*/
public static IInventory getBaubles(EntityPlayer player) {
IInventory ot = null;
try {
if(getBaubles == null) {
Class fake = Class.forName("baubles.common.lib.PlayerHandler");
getBaubles = fake.getMethod("getPlayerBaubles", EntityPlayer.class);
}
ot = (IInventory) getBaubles.invoke(null, player);
} catch(Exception ex) {
FMLLog.warning("[Baubles API] Could not invoke baubles.common.lib.PlayerHandler method getPlayerBaubles");
}
return ot;
}
}
+46
View File
@@ -0,0 +1,46 @@
package baubles.api;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* This interface should be extended by items that can be worn in bauble slots
*
*/
public interface IBauble {
/**
* This method return the type of bauble this is.
* Type is used to determine the slots it can go into.
*/
public BaubleType getBaubleType(ItemStack itemstack);
/**
* This method is called once per tick if the bauble is being worn by a player
*/
public void onWornTick(ItemStack itemstack, EntityLivingBase player);
/**
* This method is called when the bauble is equipped by a player
*/
public void onEquipped(ItemStack itemstack, EntityLivingBase player);
/**
* This method is called when the bauble is unequipped by a player
*/
public void onUnequipped(ItemStack itemstack, EntityLivingBase player);
/**
* can this bauble be placed in a bauble slot
*/
public boolean canEquip(ItemStack itemstack, EntityLivingBase player);
/**
* Can this bauble be removed from a bauble slot
*/
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player);
}
@@ -0,0 +1,3 @@
@API(apiVersion = "1.0.0.16", owner = "Baubles", provides = "Baubles|API")
package baubles.api;
import cpw.mods.fml.common.API;
@@ -0,0 +1,73 @@
package electricMagicTools.tombenpotter.electricmagictools.client.gui;
import cpw.mods.fml.client.config.DummyConfigElement;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.GuiConfigEntries;
import cpw.mods.fml.client.config.IConfigElement;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import electricMagicTools.tombenpotter.electricmagictools.common.ElectricMagicTools;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import java.util.ArrayList;
import java.util.List;
public class EMTGuiConfig extends GuiConfig {
public EMTGuiConfig(GuiScreen parentScreen) {
super(parentScreen, getConfigElements(), ElectricMagicTools.modid, false, false, GuiConfig.getAbridgedConfigPath(Config.config.toString()));
}
private static List<IConfigElement> getConfigElements() {
List<IConfigElement> list = new ArrayList<IConfigElement>();
list.add(new DummyConfigElement.DummyCategoryElement("General Config", "emt.config.general", GeneralEntry.class));
list.add(new DummyConfigElement.DummyCategoryElement("Values Config", "emt.config.valuezs", ValuesEntry.class));
list.add(new DummyConfigElement.DummyCategoryElement("Research Disabling Config", "emt.config.research.disable", ResearchEntry.class));
return list;
}
public static class GeneralEntry extends GuiConfigEntries.CategoryEntry {
public GeneralEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen() {
return new GuiConfig(this.owningScreen,
(new ConfigElement(Config.config.getCategory(Configuration.CATEGORY_GENERAL))).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath("emt/config/general"));
}
}
public static class ValuesEntry extends GuiConfigEntries.CategoryEntry {
public ValuesEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen() {
return new GuiConfig(this.owningScreen,
(new ConfigElement(Config.config.getCategory(Config.CATEGORY_VALUES))).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath("emt/config/values"));
}
}
public static class ResearchEntry extends GuiConfigEntries.CategoryEntry {
public ResearchEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop) {
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen() {
return new GuiConfig(this.owningScreen,
(new ConfigElement(Config.config.getCategory(Config.CATEGORY_RESEARCH))).getChildElements(),
this.owningScreen.modID, Configuration.CATEGORY_GENERAL, this.configElement.requiresWorldRestart() || this.owningScreen.allRequireWorldRestart,
this.configElement.requiresMcRestart() || this.owningScreen.allRequireMcRestart,
GuiConfig.getAbridgedConfigPath("emt/config/research"));
}
}
}
@@ -11,7 +11,6 @@
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.common.config.Configuration;
public class Config {
@@ -95,97 +94,97 @@ public class Config {
public static boolean nanoWingResearch;
public static boolean quantumWingsResearch;
public static String CATEGORY_RESEARCH = "Research";
public static String CATEGORY_VALUES = "Numeric Values";
public static String CATEGORY_RESEARCH = "research";
public static String CATEGORY_VALUES = "numeric values";
public static Configuration config;
public static void create(FMLPreInitializationEvent event) {
Configuration config = new Configuration(event.getSuggestedConfigurationFile());
public static void create() {
config.addCustomCategoryComment(CATEGORY_VALUES, "The only way to change some numbers that my machines uses.");
config.addCustomCategoryComment(CATEGORY_RESEARCH, "The only way to disable some researches. " + "Be careful, if you disable some researches, " + "all researches linked to it will be removed too. " + "Really, don't touch that unless you know exactly what you are doing.");
config.load();
/** Random Booleans **/
capesOn = config.get(Configuration.CATEGORY_GENERAL, "Enable showing capes", true, "This config option is to enable or disable capes for people who have them. " + "Seriously, you shouldn't touch that unless you have another cape and " + "it conflicts with it.").getBoolean(capesOn);
toolsInBore = config.get(Configuration.CATEGORY_GENERAL, "Making the tools worth begin used in the Arcane Bore.", false, "This will augment the durablilty of the tools, and will also decrease the EU cost to 1. " + "The tools should have the same number of uses than before.").getBoolean(toolsInBore);
nightVisionOff = config.get(Configuration.CATEGORY_GENERAL, "Disable totally the nightvision ability of the Nanosuit Googles of Revealing, " + "Quantum Googles of Revealing and of the Quantum Solar Helmet of Revealing", false, "This was added because of mods making you totally blind if using nightvision. For example, enable that when in the Deep Dark.").getBoolean(nightVisionOff);
enchanting = config.get(Configuration.CATEGORY_GENERAL, "Enable enchanting my tools and amors", false, "Warning: the enchantability is low.").getBoolean(enchanting);
smoke = config.get(Configuration.CATEGORY_GENERAL, "Disable the smoke effect for the Electric/Nano/Quantum Boots of the Traveller", false, "This effect only appears when the player isn't on the ground").getBoolean(smoke);
oneRingSpawn = config.get(Configuration.CATEGORY_GENERAL, "Disable the One Ring spawning in dungeon chests", false, "There is no other way to get this item.").getBoolean(oneRingSpawn);
chanceTaintedMjolnir = config.get(Configuration.CATEGORY_GENERAL, "Chance for the Tainted Mjolnir to spawn inside of dungeon chests", 25, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt();
chanceOneRing = config.get(Configuration.CATEGORY_GENERAL, "Chance for The One Ring to spawn inside of dungeon chests", 15, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt();
removeAmberAndCinnabarMacerating = config.get(Configuration.CATEGORY_GENERAL, "Remove Existing Amber and Cinnabar Macerating Recipes", true, "This is here because of conflicts between mods that add the same input and different outputs").getBoolean(removeAmberAndCinnabarMacerating);
capesOn = config.get(Configuration.CATEGORY_GENERAL, "Enable capes", true, "This config option is to enable or disable capes for people who have them. " + "Seriously, you shouldn't touch that unless you have another cape and " + "it conflicts with it.").getBoolean(capesOn);
toolsInBore = config.get(Configuration.CATEGORY_GENERAL, "Tools for Arcane Bore", false, "This will augment the durablilty of the tools, and will also decrease the EU cost to 1. " + "The tools should have the same number of uses than before.").getBoolean(toolsInBore);
nightVisionOff = config.get(Configuration.CATEGORY_GENERAL, "Disable nightvision helmets", false, "This was added because of mods making you totally blind if using nightvision. For example, enable that when in the Deep Dark.").getBoolean(nightVisionOff);
enchanting = config.get(Configuration.CATEGORY_GENERAL, "Enable enchanting tools", false, "Warning: the enchantability is low.").getBoolean(enchanting);
smoke = config.get(Configuration.CATEGORY_GENERAL, "Disable smoke effect for boots", false, "This effect only appears when the player isn't on the ground").getBoolean(smoke);
oneRingSpawn = config.get(Configuration.CATEGORY_GENERAL, "Disable One Ring in dungeon chests", false, "There is no other way to get this item.").getBoolean(oneRingSpawn);
chanceTaintedMjolnir = config.get(Configuration.CATEGORY_GENERAL, "Tainted Mjolnir spawning change", 25, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt();
chanceOneRing = config.get(Configuration.CATEGORY_GENERAL, "One Ring spawning chance", 15, "If you have a lot of mods adding dungeon loot, you should definetely increase this").getInt();
removeAmberAndCinnabarMacerating = config.get(Configuration.CATEGORY_GENERAL, "Clear Amber/Cinnabar Macerating", true, "This is here because of conflicts between mods that add the same input and different outputs").getBoolean(removeAmberAndCinnabarMacerating);
/** EU Yield/Consumption modifier **/
potentiaGenOutput = config.get("Numeric Values", "Potentia Generator EU Output", 3500, "This is the number you have to modify if you want to make the Potentia Generator yield " + "more or less EU per unit of essentia.").getDouble(potentiaGenOutput);
arborGenOutput = config.get("Numeric Values", "Arbor Generator EU Output", 325, "This is the number you have to modify if you want to make the Arbor Generator yield " + "more or less EU per unit of essentia.").getDouble(arborGenOutput);
auramGenOutput = config.get("Numeric Values", "Auram Generator EU Output", 3200, "This is the number you have to modify if you want to make the Auram Generator yield " + "more or less EU per unit of essentia.").getDouble(auramGenOutput);
ignisGenOutput = config.get("Numeric Values", "Ignis Generator EU Output", 3200, "This is the number you have to modify if you want to make the Ignis Generator yield " + "more or less EU per unit of essentia.").getDouble(ignisGenOutput);
saxumGenOutput = config.get("Numeric Values", "Saxum Generator Output", 350, "This is the number you have to modify if you want to make the Saxum Generator yield " + "more or less EU per unit of essentia.").getDouble(saxumGenOutput);
wandChargerConsumption = config.get("Numeric Values", "Industrial Wand Charging Station EU Consumption", 50000, "This is the number you have to modify if you want to make the Industrial Wand Charging " + "Station use more or less EU to charge 1 unit of Vis on your wand.").getDouble(wandChargerConsumption);
compressedSolarOutput = config.get("Numeric Values", "Compressed Solar Panel EU Output", 10, "This is the number you have to modify if you want to make the Compressed Solar Panel yield " + "more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(compressedSolarOutput);
doubleCompressedSolarOutput = config.get("Numeric Values", "Double Compressed Solar Panel EU Output", 100, "This is the number you have to modify if you want to make the Double Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(doubleCompressedSolarOutput);
tripleCompressedSolarOutput = config.get("Numeric Values", "Triple Compressed Solar Panel EU Output", 1000, "This is the number you have to modify if you want to make the Triple Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(tripleCompressedSolarOutput);
essentiaGeneratorsDelay = config.get("Numeric Values", "Essentia Generators draw rate", 120, "The number of ticks the Essentia Generators wait before using 2 Essentia. " + "If you want them to be slower, increase the number.").getInt(essentiaGeneratorsDelay);
nanoBootsSpeed = config.get("Numeric Values", "Speed of the Nano Boots of the Traveller", 0.25, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsSpeed);
quantumBootsSpeed = config.get("Numeric Values", "Speed of the Quantum Boots of the Traveller", 0.5, "Watch out, that goes up REALLY quickly.").getDouble(quantumBootsSpeed);
nanoBootsJump = config.get("Numeric Values", "Jump height for the Nano Boots of the Traveller", 0.6, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump);
quantumBootsJump = config.get("Numeric Values", "Jump height for the Quantum Boots of the Traveller", 0.9, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump);
etherealProcessorBaseSpeed = config.get("Numeric Values", "Base Time the Etheral Processor takes to process a single item in number of ticks.", 400, "Default is 400, the double of a regular furnace").getInt();
etherealProcessorBonus = config.get("Numeric Values", "Ethereal Processor Bonus", 10, "This number is the chance of getting a Thaumium Ingot as a bonus when " + "processing an item in the machine. It is 1 out of the number you will enter. " + "The default is 1/10 chance.").getInt();
chargeFocusProduction = config.get("Numeric Values", "Wand Focus: Charge production in EU/T", 64, "Default is 64").getInt();
armorBaubleProduction = config.get("Numeric Values", "Armor Charging Ring produciton in EU/T", 32, "Default is 32").getInt();
inventoryBaubleProdution = config.get("Numeric Values", "Inventory Charging Ring produciton in EU/T", 32, "Default is 32").getInt();
wandChargeFocusCost = config.get("Numeric Values", "Wand Focus: Wand Charging Cost in EU/T", 40000, "Default is 40000").getInt();
potentiaGenOutput = config.get(CATEGORY_VALUES, "Potentia Generator Output", 3500, "This is the number you have to modify if you want to make the Potentia Generator yield " + "more or less EU per unit of essentia.").getDouble(potentiaGenOutput);
arborGenOutput = config.get(CATEGORY_VALUES, "Arbor Generator Output", 325, "This is the number you have to modify if you want to make the Arbor Generator yield " + "more or less EU per unit of essentia.").getDouble(arborGenOutput);
auramGenOutput = config.get(CATEGORY_VALUES, "Auram Generator Output", 3200, "This is the number you have to modify if you want to make the Auram Generator yield " + "more or less EU per unit of essentia.").getDouble(auramGenOutput);
ignisGenOutput = config.get(CATEGORY_VALUES, "Ignis Generator Output", 3200, "This is the number you have to modify if you want to make the Ignis Generator yield " + "more or less EU per unit of essentia.").getDouble(ignisGenOutput);
saxumGenOutput = config.get(CATEGORY_VALUES, "Saxum Generator Output", 350, "This is the number you have to modify if you want to make the Saxum Generator yield " + "more or less EU per unit of essentia.").getDouble(saxumGenOutput);
wandChargerConsumption = config.get(CATEGORY_VALUES, "Wand Charging Station Consumption", 50000, "This is the number you have to modify if you want to make the Industrial Wand Charging " + "Station use more or less EU to charge 1 unit of Vis on your wand.").getDouble(wandChargerConsumption);
compressedSolarOutput = config.get(CATEGORY_VALUES, "Compressed Solar Panel Output", 10, "This is the number you have to modify if you want to make the Compressed Solar Panel yield " + "more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(compressedSolarOutput);
doubleCompressedSolarOutput = config.get(CATEGORY_VALUES, "Double Compressed Solar Panel Output", 100, "This is the number you have to modify if you want to make the Double Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(doubleCompressedSolarOutput);
tripleCompressedSolarOutput = config.get(CATEGORY_VALUES, "Triple Compressed Solar Panel Output", 1000, "This is the number you have to modify if you want to make the Triple Compressed Solar Panel " + "yield more or less EU per tick. Really, you shouldn't touch that, " + "since it's pretty balanced as it is.").getDouble(tripleCompressedSolarOutput);
essentiaGeneratorsDelay = config.get(CATEGORY_VALUES, "Essentia Generators draw rate", 120, "The number of ticks the Essentia Generators wait before using 2 Essentia. " + "If you want them to be slower, increase the number.").getInt(essentiaGeneratorsDelay);
nanoBootsSpeed = config.get(CATEGORY_VALUES, "Nano Boots of the Traveller Speed", 0.25, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsSpeed);
quantumBootsSpeed = config.get(CATEGORY_VALUES, "Quantum Boots of the Traveller Speed", 0.5, "Watch out, that goes up REALLY quickly.").getDouble(quantumBootsSpeed);
nanoBootsJump = config.get(CATEGORY_VALUES, "Nano Boots of the Traveller jump", 0.6, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump);
quantumBootsJump = config.get(CATEGORY_VALUES, "Quantum Boots of the Traveller jump", 0.9, "Watch out, that goes up REALLY quickly.").getDouble(nanoBootsJump);
etherealProcessorBaseSpeed = config.get(CATEGORY_VALUES, "Etheral Processor speed", 400, "Default is 400, the double of a regular furnace").getInt();
etherealProcessorBonus = config.get(CATEGORY_VALUES, "Ethereal Processor Bonus", 10, "This number is the chance of getting a Thaumium Ingot as a bonus when " + "processing an item in the machine. It is 1 out of the number you will enter. " + "The default is 1/10 chance.").getInt();
chargeFocusProduction = config.get(CATEGORY_VALUES, "Wand Focus: Charge production", 64, "Default is 64").getInt();
armorBaubleProduction = config.get(CATEGORY_VALUES, "Armor Charging Ring production", 32, "Default is 32").getInt();
inventoryBaubleProdution = config.get(CATEGORY_VALUES, "Inventory Charging Ring production", 32, "Default is 32").getInt();
wandChargeFocusCost = config.get(CATEGORY_VALUES, "Wand Focus: Wand Charging Cost", 40000, "Default is 40000").getInt();
/** Disable Researches **/
thaumiumDrillResearch = config.get("Research", "Thaumium Drill", false).getBoolean(thaumiumDrillResearch);
thaumiumChainsawResearch = config.get("Research", "Thaumium Chainsaw", false).getBoolean(thaumiumChainsawResearch);
thaumiumDrillResearch = config.get("Research", "Thaumium Omnitool", false).getBoolean(thaumiumOmnitoolResearch);
rockbreakerDrillResearch = config.get("Research", "Drill of the Rockbreaker", false).getBoolean(rockbreakerDrillResearch);
streamChainsawResearch = config.get("Research", "Chainsaw of the Stream", false).getBoolean(streamChainsawResearch);
electricGooglesResearch = config.get("Research", "Electric Googles of Revealing", false).getBoolean(electricGooglesResearch);
nanoGooglesResearch = config.get("Research", "Nanosuit Googles of Revealing", false).getBoolean(nanoGooglesResearch);
quantumGooglesResearch = config.get("Research", "Quantum Googles of Revealing", false).getBoolean(quantumGooglesResearch);
ironOmnitoolResearch = config.get("Research", "Omnitool", false).getBoolean(ironOmnitoolResearch);
diamondOmnitoolResearch = config.get("Research", "Diamond Omnitool", false).getBoolean(diamondOmnitoolResearch);
explosionFocusResearch = config.get("Research", "Explosion Focus", false).getBoolean(explosionFocusResearch);
christmasFocusResearch = config.get("Research", "Kris-tmas Focus", false).getBoolean(christmasFocusResearch);
shieldFocusResearch = config.get("Research", "Shield Focus", false).getBoolean(shieldFocusResearch);
shieldBlockResearch = config.get("Research", "Shield Block", false).getBoolean(shieldBlockResearch);
potentiaGeneratorResearch = config.get("Research", "Potentia Generator", false).getBoolean(potentiaGeneratorResearch);
ignisGeneratorResearch = config.get("Research", "Ignis Generator", false).getBoolean(ignisGeneratorResearch);
auramGeneratorResearch = config.get("Research", "Auram Generator", false).getBoolean(auramGeneratorResearch);
arborGeneratorResearch = config.get("Research", "Arbor Generator", false).getBoolean(arborGeneratorResearch);
wandChargingSationResearch = config.get("Research", "Industrial Wand Charging Station", false).getBoolean(wandChargingSationResearch);
tinyUraniumResearch = config.get("Research", "Tiny Piles of Uranium", false).getBoolean(tinyUraniumResearch);
thorHammerResearch = config.get("Research", "Mjolnir", false).getBoolean(thorHammerResearch);
superchargedThorHammerResearch = config.get("Research", "Supercharged Mjolnir", false).getBoolean(superchargedThorHammerResearch);
compressedSolarsResearch = config.get("Research", "Compressed Solars", false).getBoolean(compressedSolarsResearch);
solarHelmetResearch = config.get("Research", "Solar Helmet of Revealing", false).getBoolean(solarHelmetResearch);
electricBootsResearch = config.get("Research", "Electric Boots of the Traveller", false).getBoolean(electricBootsResearch);
nanoBootsResearch = config.get("Research", "Nano Boots of the Traveller", false).getBoolean(nanoBootsResearch);
quantumBootsResearch = config.get("Research", "Quantum Boots of the Traveller", false).getBoolean(quantumBootsResearch);
electricScribingToolsResearch = config.get("Research", "Electric Scribing Tools", false).getBoolean(electricScribingToolsResearch);
etherealProcessorResearch = config.get("Research", "Ethereal Processor", false).getBoolean(etherealProcessorResearch);
waterSolarsResearch = config.get("Research", "Water Solar Panels", false).getBoolean(waterSolarsResearch);
darkSolarsResearch = config.get("Research", "Entropy Solar Panels", false).getBoolean(darkSolarsResearch);
orderSolarsResearch = config.get("Research", "Order Solar Panels", false).getBoolean(orderSolarsResearch);
fireSolarsResearch = config.get("Research", "Fire Solar Panels", false).getBoolean(fireSolarsResearch);
airSolarsResearch = config.get("Research", "Air Solar Panels", false).getBoolean(airSolarsResearch);
earthSolarsResearch = config.get("Research", "Earth Solar Panels", false).getBoolean(earthSolarsResearch);
saxumGenResearch = config.get("Research", "Saxum Generator", false).getBoolean(saxumGenResearch);
uuMInfusionResearch = config.get("Research", "UU-Mater Infusion", false).getBoolean(uuMInfusionResearch);
portableNodeResarch = config.get("Research", "Portable Node", false).getBoolean(portableNodeResarch);
electricHoeGrowthResearch = config.get("Research", "Electric Hoe of Growth", false).getBoolean(electricHoeGrowthResearch);
chargeFocusResearch = config.get("Research", "Wand Focus: Charging", false).getBoolean(chargeFocusResearch);
wandChargeFocusResearch = config.get("Research", "Wand Focus: Wand Charging", false).getBoolean(wandChargeFocusResearch);
inventoryChargingRing = config.get("Research", "Inventory Charging Ring", false).getBoolean(inventoryChargingRing);
armorChargingRing = config.get("Research", "Armor Charging Ring", false).getBoolean(armorChargingRing);
thaumiumWingResearch = config.get("Research", "Thaumium Reinforced Wings", false).getBoolean(thaumiumWingResearch);
nanoWingResearch = config.get("Research", "Nanosuit Wings", false).getBoolean(nanoWingResearch);
quantumWingsResearch = config.get("Research", "Quantum Wings", false).getBoolean(quantumWingsResearch);
thaumiumDrillResearch = config.get(CATEGORY_RESEARCH, "Thaumium Drill", false).getBoolean(thaumiumDrillResearch);
thaumiumChainsawResearch = config.get(CATEGORY_RESEARCH, "Thaumium Chainsaw", false).getBoolean(thaumiumChainsawResearch);
thaumiumDrillResearch = config.get(CATEGORY_RESEARCH, "Thaumium Omnitool", false).getBoolean(thaumiumOmnitoolResearch);
rockbreakerDrillResearch = config.get(CATEGORY_RESEARCH, "Drill of the Rockbreaker", false).getBoolean(rockbreakerDrillResearch);
streamChainsawResearch = config.get(CATEGORY_RESEARCH, "Chainsaw of the Stream", false).getBoolean(streamChainsawResearch);
electricGooglesResearch = config.get(CATEGORY_RESEARCH, "Electric Googles of Revealing", false).getBoolean(electricGooglesResearch);
nanoGooglesResearch = config.get(CATEGORY_RESEARCH, "Nanosuit Googles of Revealing", false).getBoolean(nanoGooglesResearch);
quantumGooglesResearch = config.get(CATEGORY_RESEARCH, "Quantum Googles of Revealing", false).getBoolean(quantumGooglesResearch);
ironOmnitoolResearch = config.get(CATEGORY_RESEARCH, "Omnitool", false).getBoolean(ironOmnitoolResearch);
diamondOmnitoolResearch = config.get(CATEGORY_RESEARCH, "Diamond Omnitool", false).getBoolean(diamondOmnitoolResearch);
explosionFocusResearch = config.get(CATEGORY_RESEARCH, "Explosion Focus", false).getBoolean(explosionFocusResearch);
christmasFocusResearch = config.get(CATEGORY_RESEARCH, "Kris-tmas Focus", false).getBoolean(christmasFocusResearch);
shieldFocusResearch = config.get(CATEGORY_RESEARCH, "Shield Focus", false).getBoolean(shieldFocusResearch);
shieldBlockResearch = config.get(CATEGORY_RESEARCH, "Shield Block", false).getBoolean(shieldBlockResearch);
potentiaGeneratorResearch = config.get(CATEGORY_RESEARCH, "Potentia Generator", false).getBoolean(potentiaGeneratorResearch);
ignisGeneratorResearch = config.get(CATEGORY_RESEARCH, "Ignis Generator", false).getBoolean(ignisGeneratorResearch);
auramGeneratorResearch = config.get(CATEGORY_RESEARCH, "Auram Generator", false).getBoolean(auramGeneratorResearch);
arborGeneratorResearch = config.get(CATEGORY_RESEARCH, "Arbor Generator", false).getBoolean(arborGeneratorResearch);
wandChargingSationResearch = config.get(CATEGORY_RESEARCH, "Industrial Wand Charging Station", false).getBoolean(wandChargingSationResearch);
tinyUraniumResearch = config.get(CATEGORY_RESEARCH, "Tiny Piles of Uranium", false).getBoolean(tinyUraniumResearch);
thorHammerResearch = config.get(CATEGORY_RESEARCH, "Mjolnir", false).getBoolean(thorHammerResearch);
superchargedThorHammerResearch = config.get(CATEGORY_RESEARCH, "Supercharged Mjolnir", false).getBoolean(superchargedThorHammerResearch);
compressedSolarsResearch = config.get(CATEGORY_RESEARCH, "Compressed Solars", false).getBoolean(compressedSolarsResearch);
solarHelmetResearch = config.get(CATEGORY_RESEARCH, "Solar Helmet of Revealing", false).getBoolean(solarHelmetResearch);
electricBootsResearch = config.get(CATEGORY_RESEARCH, "Electric Boots of the Traveller", false).getBoolean(electricBootsResearch);
nanoBootsResearch = config.get(CATEGORY_RESEARCH, "Nano Boots of the Traveller", false).getBoolean(nanoBootsResearch);
quantumBootsResearch = config.get(CATEGORY_RESEARCH, "Quantum Boots of the Traveller", false).getBoolean(quantumBootsResearch);
electricScribingToolsResearch = config.get(CATEGORY_RESEARCH, "Electric Scribing Tools", false).getBoolean(electricScribingToolsResearch);
etherealProcessorResearch = config.get(CATEGORY_RESEARCH, "Ethereal Processor", false).getBoolean(etherealProcessorResearch);
waterSolarsResearch = config.get(CATEGORY_RESEARCH, "Water Solar Panels", false).getBoolean(waterSolarsResearch);
darkSolarsResearch = config.get(CATEGORY_RESEARCH, "Entropy Solar Panels", false).getBoolean(darkSolarsResearch);
orderSolarsResearch = config.get(CATEGORY_RESEARCH, "Order Solar Panels", false).getBoolean(orderSolarsResearch);
fireSolarsResearch = config.get(CATEGORY_RESEARCH, "Fire Solar Panels", false).getBoolean(fireSolarsResearch);
airSolarsResearch = config.get(CATEGORY_RESEARCH, "Air Solar Panels", false).getBoolean(airSolarsResearch);
earthSolarsResearch = config.get(CATEGORY_RESEARCH, "Earth Solar Panels", false).getBoolean(earthSolarsResearch);
saxumGenResearch = config.get(CATEGORY_RESEARCH, "Saxum Generator", false).getBoolean(saxumGenResearch);
uuMInfusionResearch = config.get(CATEGORY_RESEARCH, "UU-Mater Infusion", false).getBoolean(uuMInfusionResearch);
portableNodeResarch = config.get(CATEGORY_RESEARCH, "Portable Node", false).getBoolean(portableNodeResarch);
electricHoeGrowthResearch = config.get(CATEGORY_RESEARCH, "Electric Hoe of Growth", false).getBoolean(electricHoeGrowthResearch);
chargeFocusResearch = config.get(CATEGORY_RESEARCH, "Wand Focus: Charging", false).getBoolean(chargeFocusResearch);
wandChargeFocusResearch = config.get(CATEGORY_RESEARCH, "Wand Focus: Wand Charging", false).getBoolean(wandChargeFocusResearch);
inventoryChargingRing = config.get(CATEGORY_RESEARCH, "Inventory Charging Ring", false).getBoolean(inventoryChargingRing);
armorChargingRing = config.get(CATEGORY_RESEARCH, "Armor Charging Ring", false).getBoolean(armorChargingRing);
thaumiumWingResearch = config.get(CATEGORY_RESEARCH, "Thaumium Reinforced Wings", false).getBoolean(thaumiumWingResearch);
nanoWingResearch = config.get(CATEGORY_RESEARCH, "Nanosuit Wings", false).getBoolean(nanoWingResearch);
quantumWingsResearch = config.get(CATEGORY_RESEARCH, "Quantum Wings", false).getBoolean(quantumWingsResearch);
config.save();
config.save();
}
}
@@ -11,6 +11,7 @@
******************************************************************************/
package electricMagicTools.tombenpotter.electricmagictools.common;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
@@ -35,4 +36,10 @@ public class EMTEventHandler {
}
}
}
@SubscribeEvent
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs) {
if (eventArgs.modID.equals(ElectricMagicTools.modid))
Config.create();
}
}
@@ -0,0 +1,30 @@
package electricMagicTools.tombenpotter.electricmagictools.common;
import cpw.mods.fml.client.IModGuiFactory;
import electricMagicTools.tombenpotter.electricmagictools.client.gui.EMTGuiConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import java.util.Set;
public class EMTGuiFactory implements IModGuiFactory{
@Override
public void initialize(Minecraft minecraftInstance) {
}
@Override
public Class<? extends GuiScreen> mainConfigGuiClass() {
return EMTGuiConfig.class;
}
@Override
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
return null;
}
@Override
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
return null;
}
}
@@ -26,8 +26,9 @@ import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTInit
import electricMagicTools.tombenpotter.electricmagictools.common.recipes.EMTPostInitRecipes;
import electricMagicTools.tombenpotter.electricmagictools.common.recipes.UuMInfusionRecipes;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
@Mod(modid = ElectricMagicTools.modid, name = "Electro-MagicTools", version = "1.1.1", dependencies = "required-after:Thaumcraft ; required-after:IC2")
@Mod(modid = ElectricMagicTools.modid, name = "Electro-MagicTools", version = "1.2", guiFactory = "electricMagicTools.tombenpotter.electricmagictools.common.EMTGuiFactory",dependencies = "required-after:Thaumcraft ; required-after:IC2")
public class ElectricMagicTools {
@SidedProxy(clientSide = "electricMagicTools.tombenpotter.electricmagictools.client.ClientProxy", serverSide = "electricMagicTools.tombenpotter.electricmagictools.common.CommonProxy")
@@ -42,15 +43,11 @@ public class ElectricMagicTools {
public void preInit(FMLPreInitializationEvent event) {
FMLLog.info("[EMT] Electro-Magic Tools : Starting planning the world domination");
/** Creating the config file **/
FMLLog.info("[EMT] Electro-Magic Tools : Creating/Reading the config file");
Config.create(event);
/** Items Registry **/
Config.config = new Configuration(event.getSuggestedConfigurationFile());
Config.create();
FMLLog.info("[EMT] Electro-Magic Tools : Registering the mod items");
ItemRegistry.registerEMTItems();
/** Blocks registry **/
FMLLog.info("[EMT] Electro-Magic Tools : Registering the mod blocks");
BlockRegistry.registerEMTBlocks();
@@ -61,35 +58,21 @@ public class ElectricMagicTools {
public void load(FMLInitializationEvent event) {
FMLLog.info("[EMT] Electro-Magic Tools : Starting gathering allies");
/** Loading the proxies **/
FMLLog.info("[EMT] Electro-Magic Tools : Loading the proxies");
proxy.load();
/** Making mobs drop additional items **/
FMLLog.info("[EMT] Electro-Magic Tools : Making mobs drop additional items");
MinecraftForge.EVENT_BUS.register(new EMTEventHandler());
/** Tile entities registry **/
FMLLog.info("[EMT] Electro-Magic Tools : Registering Tile entities");
TileEntityRegistry.registerEMTTileEntites();
/** Generating loot in dungeon chests **/
FMLLog.info("[EMT] Electro-Magic Tools : Generating loot in dungeon chests");
DungeonChestGenerator.generateLoot();
/** Adding the recipes that go in Init **/
FMLLog.info("[EMT] Electro-Magic Tools : Adding the Init recipes");
EMTInitRecipes.add();
/** Entities Registry **/
FMLLog.info("[EMT] Electro-Magic Tools : Registering entities");
EMTEntityRegistry.registerEMTEntities();
/** GUI Handler Registry **/
FMLLog.info("[EMT] Electro-Magic Tools : Registering the GUI Handler");
NetworkRegistry.INSTANCE.registerGuiHandler(this, proxy);
/** Adds Capes **/
if (event.getSide() == Side.CLIENT && Config.capesOn == true) {
FMLLog.info("[EMT] Electro-Magic Tools : Adding capes");
MinecraftForge.EVENT_BUS.register(new CapeEventHandler());
@@ -102,19 +85,12 @@ public class ElectricMagicTools {
public void postInit(FMLPostInitializationEvent event) {
FMLLog.info("[EMT] Electro-Magic Tools : Starting the world takeover");
/** Adding the recipes that go in PostInit **/
FMLLog.info("[EMT] Electro-Magic Tools : Adding PostInit recipes");
EMTPostInitRecipes.add();
/** Adding the UU-Matter Infusion recipes **/
FMLLog.info("[EMT] Electro-Magic Tools : Adding the UU-Matter Infusion recipes");
UuMInfusionRecipes.add();
/** Adding the EMT research tab to the Thaumonomicon **/
FMLLog.info("[EMT] Electro-Magic Tools : Adding the EMT research tab to the Thaumonomicon");
ThaumonomiconResearch.addResearchTab();
/** Adding the actual research to the game **/
FMLLog.info("[EMT] Electro-Magic Tools : Adding research to the game");
ThaumonomiconResearch.addResearch();
@@ -19,7 +19,9 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.Random;
@@ -30,7 +32,7 @@ public class BlockShield extends Block {
super(Material.rock);
this.setCreativeTab(CreativeTab.tabTombenpotter);
this.setHardness(1F);
this.setResistance(200000000F);
this.setResistance(10000000000000000000000000000000000000F);
}
@Override
@@ -65,14 +67,25 @@ public class BlockShield extends Block {
return false;
}
public boolean canEntityDestroy(World world, int x, int y, int z, Entity entity) {
@Override
public boolean canBeReplacedByLeaves(IBlockAccess world, int x, int y, int z)
{
return false;
}
@Override
public boolean canEntityDestroy(IBlockAccess world, int x, int y, int z, Entity entity)
{
return false;
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z)
{
return false;
}
@Override
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
}
public boolean canDragonDestroy(World world, int x, int y, int z) {
return false;
}
}
@@ -21,8 +21,6 @@ import ic2.api.item.IC2Items;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.RecipeInputItemStack;
import ic2.api.recipe.Recipes;
import ic2.core.Ic2Items;
import ic2.core.util.StackUtil;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@@ -232,14 +230,19 @@ public class EMTPostInitRecipes {
NBTTagCompound waterAmount = new NBTTagCompound();
waterAmount.setInteger("amount", 1000);
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 1)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 2), StackUtil.copyWithSize(Ic2Items.smallCopperDust, 2), Ic2Items.stoneDust});
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 3)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 4), StackUtil.copyWithSize(Ic2Items.smallTinDust, 2), Ic2Items.stoneDust});
ItemStack smallCopperDust = IC2Items.getItem("smallCopperDust");
smallCopperDust.stackSize = 2;
ItemStack smallTinDust = IC2Items.getItem("smallTinDust");
smallCopperDust.stackSize = 2;
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 1)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 2), smallCopperDust, IC2Items.getItem("stoneDust")});
Recipes.oreWashing.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 3)), waterAmount, new ItemStack[]{new ItemStack(ItemRegistry.itemEMTItems, 1, 4), smallTinDust, IC2Items.getItem("stoneDust")});
NBTTagCompound heatAmount = new NBTTagCompound();
heatAmount.setInteger("minHeat", 1000);
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 2)), heatAmount, new ItemStack[]{Ic2Items.smallCopperDust, new ItemStack(ConfigItems.itemResource, 1, 6)});
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 4)), heatAmount, new ItemStack[]{Ic2Items.smallTinDust, new ItemStack(ConfigItems.itemResource, 1, 3)});
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 2)), heatAmount, new ItemStack[]{IC2Items.getItem("smallCopperDust"), new ItemStack(ConfigItems.itemResource, 1, 6)});
Recipes.centrifuge.addRecipe(new RecipeInputItemStack(new ItemStack(ItemRegistry.itemEMTItems, 1, 4)), heatAmount, new ItemStack[]{IC2Items.getItem("smallTinDust"), new ItemStack(ConfigItems.itemResource, 1, 3)});
}
public static InfusionRecipe thaumiumDrill;
@@ -13,8 +13,8 @@ package electricMagicTools.tombenpotter.electricmagictools.common.tile;
import electricMagicTools.tombenpotter.electricmagictools.common.BlockRegistry;
import electricMagicTools.tombenpotter.electricmagictools.common.Config;
import ic2.api.item.IC2Items;
import ic2.api.tile.IWrenchable;
import ic2.core.Ic2Items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -245,7 +245,7 @@ public class TileEntityEtherealMacerator extends TileEntityEMT implements ISided
|| this.slots[0].getItem() == Items.beef
|| this.slots[0].getItem() == Items.chicken
|| this.slots[0].getItem() == Items.fish
|| this.slots[0].getItem() == Ic2Items.hydratedCoalDust.getItem()
|| this.slots[0].getItem() == IC2Items.getItem("coalDust").getItem()
|| (OreDictionary.getOreName(OreDictionary.getOreID(this.slots[0])).toLowerCase().contains("dust") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("armour") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("armor") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("helm") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("legging") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("boot") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("chestp") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("pick")
|| this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("shovel") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("axe") || this.slots[0].getItem().getUnlocalizedName(this.slots[0]).toLowerCase().contains("pick"))) {
return true;
@@ -12,19 +12,15 @@
package electricMagicTools.tombenpotter.electricmagictools.common.tile.container;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityEtherealMacerator;
import ic2.core.IC2;
import ic2.core.slot.SlotInvSlot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntity;
import thaumcraft.common.container.SlotOutput;
import java.util.List;
import java.util.ListIterator;
public class ContainerEtheralMacerator extends Container {
TileEntityEtherealMacerator te;
@@ -49,79 +45,50 @@ public class ContainerEtheralMacerator extends Container {
return this.te.isUseableByPlayer(player);
}
@SuppressWarnings("unchecked")
@Override
public final ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex) {
Slot sourceSlot = (Slot) inventorySlots.get(sourceSlotIndex);
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2);
if (sourceSlot != null && sourceSlot.getHasStack()) {
ItemStack sourceItemStack = sourceSlot.getStack();
int oldSourceItemStackSize = sourceItemStack.stackSize;
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (sourceSlot.inventory == player.inventory) { // player inventory
// clicked
// 0: fill input existing stacks, 1: fill input empty stacks, 2:
// fill existing stacks, 3: fill empty stacks
for (int run = 0; run < 4 && sourceItemStack.stackSize > 0; run++) {
if (run < 2) {
for (Slot targetSlot : (List<Slot>) inventorySlots) {
if (targetSlot instanceof SlotInvSlot && ((SlotInvSlot) targetSlot).invSlot.canInput() && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 1) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
}
} else {
for (Slot targetSlot : (List<Slot>) inventorySlots) {
if (targetSlot.inventory != player.inventory && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 3) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
}
}
if (par2 == 1) {
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
return null;
}
} else { // Shift-Click on a GUIslot of the container
for (int run = 0; run < 2 && sourceItemStack.stackSize > 0; run++) {
for (ListIterator<Slot> it = ((List<Slot>) inventorySlots).listIterator(inventorySlots.size()); it.hasPrevious(); ) {
Slot targetSlot = it.previous();
if (targetSlot.inventory == player.inventory && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 1) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
slot.onSlotChange(itemstack1, itemstack);
} else if (par2 != 0) {
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return null;
}
} else if (par2 >= 2 && par2 < 29) {
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
return null;
}
} else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
return null;
}
} else if (!this.mergeItemStack(itemstack1, 3, 38, false)) {
return null;
}
if (sourceItemStack.stackSize != oldSourceItemStackSize) {
if (sourceItemStack.stackSize == 0) {
sourceSlot.putStack(null);
} else {
sourceSlot.onPickupFromSlot(player, sourceItemStack);
}
// vanilla doesn't fully re-sync after processing the slot click
// packet,
// causing a race condition of the client received an old state
// through packet delay after the slot click
// this forces a proper sync
if (IC2.platform.isSimulating()) {
detectAndSendChanges();
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return null;
return itemstack;
}
}
@@ -12,16 +12,12 @@
package electricMagicTools.tombenpotter.electricmagictools.common.tile.container;
import electricMagicTools.tombenpotter.electricmagictools.common.tile.TileEntityIndustrialWandRecharge;
import ic2.core.IC2;
import ic2.core.slot.SlotInvSlot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import java.util.List;
import java.util.ListIterator;
import net.minecraft.item.crafting.FurnaceRecipes;
public class ContainerIndustrialWandRecharge extends Container {
@@ -48,79 +44,50 @@ public class ContainerIndustrialWandRecharge extends Container {
return charger.isUseableByPlayer(player);
}
@SuppressWarnings("unchecked")
@Override
public final ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex) {
Slot sourceSlot = (Slot) inventorySlots.get(sourceSlotIndex);
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2);
if (sourceSlot != null && sourceSlot.getHasStack()) {
ItemStack sourceItemStack = sourceSlot.getStack();
int oldSourceItemStackSize = sourceItemStack.stackSize;
if (slot != null && slot.getHasStack()) {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
if (sourceSlot.inventory == player.inventory) { // player inventory
// clicked
// 0: fill input existing stacks, 1: fill input empty stacks, 2:
// fill existing stacks, 3: fill empty stacks
for (int run = 0; run < 4 && sourceItemStack.stackSize > 0; run++) {
if (run < 2) {
for (Slot targetSlot : (List<Slot>) inventorySlots) {
if (targetSlot instanceof SlotInvSlot && ((SlotInvSlot) targetSlot).invSlot.canInput() && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 1) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
}
} else {
for (Slot targetSlot : (List<Slot>) inventorySlots) {
if (targetSlot.inventory != player.inventory && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 3) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
}
}
if (par2 == 1) {
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
return null;
}
} else { // Shift-Click on a GUIslot of the container
for (int run = 0; run < 2 && sourceItemStack.stackSize > 0; run++) {
for (ListIterator<Slot> it = ((List<Slot>) inventorySlots).listIterator(inventorySlots.size()); it.hasPrevious(); ) {
Slot targetSlot = it.previous();
if (targetSlot.inventory == player.inventory && targetSlot.isItemValid(sourceItemStack)) {
if (targetSlot.getStack() != null || run == 1) {
mergeItemStack(sourceItemStack, targetSlot.slotNumber, targetSlot.slotNumber + 1, false);
if (sourceItemStack.stackSize == 0)
break;
}
}
slot.onSlotChange(itemstack1, itemstack);
} else if (par2 != 0) {
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
return null;
}
} else if (par2 >= 2 && par2 < 29) {
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
return null;
}
} else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
return null;
}
} else if (!this.mergeItemStack(itemstack1, 2, 38, false)) {
return null;
}
if (sourceItemStack.stackSize != oldSourceItemStackSize) {
if (sourceItemStack.stackSize == 0) {
sourceSlot.putStack(null);
} else {
sourceSlot.onPickupFromSlot(player, sourceItemStack);
}
// vanilla doesn't fully re-sync after processing the slot click
// packet,
// causing a race condition of the client received an old state
// through packet delay after the slot click
// this forces a proper sync
if (IC2.platform.isSimulating()) {
detectAndSendChanges();
}
if (itemstack1.stackSize == 0) {
slot.putStack((ItemStack) null);
} else {
slot.onSlotChanged();
}
if (itemstack1.stackSize == itemstack.stackSize) {
return null;
}
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
}
return null;
return itemstack;
}
}