aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/plugin')
-rw-r--r--src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java43
-rw-r--r--src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java21
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java40
-rw-r--r--src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java18
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java62
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java61
-rw-r--r--src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java2
7 files changed, 151 insertions, 96 deletions
diff --git a/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java
new file mode 100644
index 0000000000..d515375149
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/agrichem/Core_Agrichem.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.plugin.agrichem;
+
+import gtPlusPlus.api.interfaces.IPlugin;
+import gtPlusPlus.plugin.agrichem.fluids.FluidLoader;
+import gtPlusPlus.plugin.manager.Core_Manager;
+
+public class Core_Agrichem implements IPlugin {
+
+ final static Core_Agrichem mInstance;
+
+ static {
+ mInstance = new Core_Agrichem();
+ Core_Manager.registerPlugin(mInstance);
+ mInstance.log("Preparing "+mInstance.getPluginName()+" for use.");
+ }
+
+ @Override
+ public boolean preInit() {
+ FluidLoader.generate();
+ return true;
+ }
+
+ @Override
+ public boolean init() {
+ return true;
+ }
+
+ @Override
+ public boolean postInit() {
+ return true;
+ }
+
+ @Override
+ public String getPluginName() {
+ return "GT++ Agrichemistry Module";
+ }
+
+ @Override
+ public String getPluginAbbreviation() {
+ return "FARM";
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java b/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java
new file mode 100644
index 0000000000..a60a8c09de
--- /dev/null
+++ b/src/Java/gtPlusPlus/plugin/agrichem/fluids/FluidLoader.java
@@ -0,0 +1,21 @@
+package gtPlusPlus.plugin.agrichem.fluids;
+
+import gtPlusPlus.core.fluids.FluidFactory;
+
+public class FluidLoader {
+
+ private static final int ID_DIRTY_WATER = 50;
+ private static final int ID_RAW_SEWERAGE = 51;
+ private static final int ID_GUANO = 52;
+ private static final int ID_POOPJUICE = 53;
+
+ public static void generate() {
+
+ FluidFactory.generate(ID_DIRTY_WATER, "dirtywater", new short[] {25, 25, 180});
+ FluidFactory.generate(ID_RAW_SEWERAGE, "sewerage", new short[] {100, 45, 25});
+ FluidFactory.generate(ID_GUANO, "guano", new short[] {175, 175, 180});
+ FluidFactory.generate(ID_POOPJUICE, "poo", new short[] {75, 45, 10});
+
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
index 8e7b73ccdf..cf9676635d 100644
--- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
+++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/Core_VanillaFixes.java
@@ -1,7 +1,11 @@
package gtPlusPlus.plugin.fixes.vanilla;
import gtPlusPlus.api.interfaces.IPlugin;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.plugin.manager.Core_Manager;
+import net.minecraft.init.Blocks;
+import net.minecraft.init.Items;
+import net.minecraft.item.ItemStack;
public class Core_VanillaFixes implements IPlugin {
@@ -10,7 +14,7 @@ public class Core_VanillaFixes implements IPlugin {
static {
mInstance = new Core_VanillaFixes();
- mBedFixInstance = new VanillaBedHeightFix();
+ mBedFixInstance = new VanillaBedHeightFix(mInstance);
mInstance.log("Preparing "+mInstance.getPluginName()+" for use.");
}
@@ -19,18 +23,18 @@ public class Core_VanillaFixes implements IPlugin {
}
@Override
- public boolean preInit() {
- return false;
+ public boolean preInit() {
+ return fixVanillaOD();
}
@Override
public boolean init() {
- return false;
+ return true;
}
@Override
public boolean postInit() {
- return false;
+ return true;
}
@Override
@@ -42,5 +46,31 @@ public class Core_VanillaFixes implements IPlugin {
public String getPluginAbbreviation() {
return "VFIX";
}
+
+ private boolean fixVanillaOD() {
+ registerToOreDict(ItemUtils.getSimpleStack(Items.nether_wart), "cropNetherWart");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.reeds), "sugarcane");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.paper), "paper");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.ender_pearl), "enderpearl");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.bone), "bone");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.gunpowder), "gunpowder");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.string), "string");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.nether_star), "netherStar");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.leather), "leather");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.feather), "feather");
+ registerToOreDict(ItemUtils.getSimpleStack(Items.egg), "egg");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.end_stone), "endstone");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.vine), "vine");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.cactus), "blockCactus");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.grass), "grass");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.obsidian), "obsidian");
+ registerToOreDict(ItemUtils.getSimpleStack(Blocks.crafting_table), "workbench");
+ return true;
+ }
+
+ private void registerToOreDict(ItemStack aStack, String aString) {
+ mInstance.log("Registering "+aStack.getDisplayName()+" to OreDictionary under the tag '"+aString+"'. (Added to Forge in 1.8.9)");
+ ItemUtils.addItemToOreDictionary(aStack, aString);
+ }
}
diff --git a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java
index e0fef80b52..5f3b1d8abd 100644
--- a/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java
+++ b/src/Java/gtPlusPlus/plugin/fixes/vanilla/VanillaBedHeightFix.java
@@ -5,8 +5,10 @@ import java.lang.reflect.Method;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
+import gtPlusPlus.api.interfaces.IPlugin;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.plugin.fixes.interfaces.IBugFix;
import gtPlusPlus.preloader.DevHelper;
import net.minecraft.entity.player.EntityPlayer;
@@ -15,13 +17,21 @@ import net.minecraftforge.event.entity.player.PlayerSleepInBedEvent;
public class VanillaBedHeightFix implements IBugFix {
private final Method mSleepInBedAt;
+ private final IPlugin mParent;
- public VanillaBedHeightFix() {
- if (DevHelper.isValidHelperObject()) {
- Method m = DevHelper.getForgeMethod(EntityPlayer.class, "sleepInBedAt", int.class, int.class,
- int.class);
+ public VanillaBedHeightFix(IPlugin minstance) {
+ mParent = minstance;
+ if (DevHelper.isValidHelperObject()) {
+ Method m;
+ if (DevHelper.IsObfuscatedEnvironment()) {
+ m = ReflectionUtils.getMethod(EntityPlayer.class, "func_71018_a", int.class, int.class, int.class);
+ }
+ else {
+ m = ReflectionUtils.getMethod(net.minecraft.entity.player.EntityPlayer.class, "sleepInBedAt", int.class, int.class, int.class);
+ }
if (m != null) {
mSleepInBedAt = m;
+ mParent.log("Registering Bed Height Fix.");
Utils.registerEvent(this);
} else {
mSleepInBedAt = null;
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java
index 98e6d7ae1a..4dc5a15b4b 100644
--- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java
+++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityBaseVillager.java
@@ -169,15 +169,10 @@ public class EntityBaseVillager extends EntityVillager {
*/
protected float getField_82191_bN() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN");
try {
- v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN");
- try {
- return v82191 != null ? v82191.getFloat(this) : 0f;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return 0f;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? v82191.getFloat(this) : 0f;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return 0f;
}
}
@@ -190,15 +185,10 @@ public class EntityBaseVillager extends EntityVillager {
}
protected boolean getNeedsInitilization() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization");
try {
- v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization");
- try {
- return v82191 != null ? v82191.getBoolean(this) : false;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return false;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? v82191.getBoolean(this) : false;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return false;
}
}
@@ -213,20 +203,16 @@ public class EntityBaseVillager extends EntityVillager {
protected MerchantRecipeList getBuyingList() {
Field v82191;
MerchantRecipeList o;
+ v82191 = ReflectionUtils.getField(getClass(), "buyingList");
try {
- v82191 = ReflectionUtils.getField(getClass(), "buyingList");
- try {
- o = (MerchantRecipeList) v82191.get(this);
- Logger.WARNING("Is BuyingList Valid? "+(v82191 != null));
- return v82191 != null ? o : null;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- return null;
- }
- } catch (NoSuchFieldException e1) {
- e1.printStackTrace();
+ o = (MerchantRecipeList) v82191.get(this);
+ Logger.WARNING("Is BuyingList Valid? " + (v82191 != null));
+ return v82191 != null ? o : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ e.printStackTrace();
return null;
}
+
}
protected void setBuyingList(MerchantRecipeList f) {
@@ -238,29 +224,19 @@ public class EntityBaseVillager extends EntityVillager {
}
protected Village getVillageObject() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "villageObj");
try {
- v82191 = ReflectionUtils.getField(getClass(), "villageObj");
- try {
- return v82191 != null ? (Village) v82191.get(this) : null;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return null;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? (Village) v82191.get(this) : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return null;
}
}
protected String getLastBuyingPlayer() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer");
try {
- v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer");
- try {
- return v82191 != null ? (String) v82191.get(this) : "";
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return "";
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? (String) v82191.get(this) : "";
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return "";
}
}
diff --git a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java
index 6e7234297e..967647cff6 100644
--- a/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java
+++ b/src/Java/gtPlusPlus/plugin/villagers/entity/EntityNativeAustralian.java
@@ -157,15 +157,10 @@ public class EntityNativeAustralian extends EntityVillager {
*/
protected float getField_82191_bN() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN");
try {
- v82191 = ReflectionUtils.getField(getClass(), "field_82191_bN");
- try {
- return v82191 != null ? v82191.getFloat(this) : 0f;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return 0f;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? v82191.getFloat(this) : 0f;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return 0f;
}
}
@@ -178,15 +173,10 @@ public class EntityNativeAustralian extends EntityVillager {
}
protected boolean getNeedsInitilization() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization");
try {
- v82191 = ReflectionUtils.getField(EntityVillager.class, "needsInitilization");
- try {
- return v82191 != null ? v82191.getBoolean(this) : false;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return false;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? v82191.getBoolean(this) : false;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return false;
}
}
@@ -201,18 +191,13 @@ public class EntityNativeAustralian extends EntityVillager {
protected MerchantRecipeList getBuyingList() {
Field v82191;
MerchantRecipeList o;
+ v82191 = ReflectionUtils.getField(getClass(), "buyingList");
try {
- v82191 = ReflectionUtils.getField(getClass(), "buyingList");
- try {
- o = (MerchantRecipeList) v82191.get(this);
- Logger.WARNING("Is BuyingList Valid? "+(v82191 != null));
- return v82191 != null ? o : null;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- e.printStackTrace();
- return null;
- }
- } catch (NoSuchFieldException e1) {
- e1.printStackTrace();
+ o = (MerchantRecipeList) v82191.get(this);
+ Logger.WARNING("Is BuyingList Valid? " + (v82191 != null));
+ return v82191 != null ? o : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ e.printStackTrace();
return null;
}
}
@@ -226,29 +211,19 @@ public class EntityNativeAustralian extends EntityVillager {
}
protected Village getVillageObject() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "villageObj");
try {
- v82191 = ReflectionUtils.getField(getClass(), "villageObj");
- try {
- return v82191 != null ? (Village) v82191.get(this) : null;
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return null;
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? (Village) v82191.get(this) : null;
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return null;
}
}
protected String getLastBuyingPlayer() {
- Field v82191;
+ Field v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer");
try {
- v82191 = ReflectionUtils.getField(getClass(), "lastBuyingPlayer");
- try {
- return v82191 != null ? (String) v82191.get(this) : "";
- } catch (IllegalArgumentException | IllegalAccessException e) {
- return "";
- }
- } catch (NoSuchFieldException e1) {
+ return v82191 != null ? (String) v82191.get(this) : "";
+ } catch (IllegalArgumentException | IllegalAccessException e) {
return "";
}
}
diff --git a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java
index 232b6b6e87..45b8c9941b 100644
--- a/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java
+++ b/src/Java/gtPlusPlus/plugin/villagers/tile/TileEntityGenericSpawner.java
@@ -221,7 +221,7 @@ public class TileEntityGenericSpawner extends TileEntityMobSpawner {
}
}
}*/
- } catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
}
}
return false;