diff options
author | Jordan Byrne <draknyte1@hotmail.com> | 2018-04-01 04:29:22 +1000 |
---|---|---|
committer | Jordan Byrne <draknyte1@hotmail.com> | 2018-04-01 04:29:22 +1000 |
commit | 9cc702601e69d789dbc7db453c6d070703158733 (patch) | |
tree | cbc7c98576226f08d5d830b7fd54a8698e273ecc /src/Java | |
parent | e09bbe0f8a8728ee49d54e95828e1972f1d90737 (diff) | |
download | GT5-Unofficial-9cc702601e69d789dbc7db453c6d070703158733.tar.gz GT5-Unofficial-9cc702601e69d789dbc7db453c6d070703158733.tar.bz2 GT5-Unofficial-9cc702601e69d789dbc7db453c6d070703158733.zip |
+ Added some support for Steve's Carts 2.
+ Base work for Exotic Farmer Module added.
Diffstat (limited to 'src/Java')
9 files changed, 575 insertions, 1 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index b1e2304474..9b8c9236df 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -51,7 +51,7 @@ import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_Recycling; import net.minecraftforge.oredict.OreDictionary; @MCVersion(value = "1.7.10") -@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks;") +@Mod(modid = CORE.MODID, name = CORE.name, version = CORE.VERSION, dependencies = "required-after:Forge; after:TConstruct; after:PlayerAPI; after:dreamcraft; after:IC2; after:ihl; after:psychedelicraft; after:gregtech; after:Forestry; after:MagicBees; after:CoFHCore; after:Growthcraft; after:Railcraft; after:CompactWindmills; after:ForbiddenMagic; after:MorePlanet; after:PneumaticCraft; after:ExtraUtilities; after:Thaumcraft; after:rftools; after:simplyjetpacks; after:BigReactors; after:EnderIO; after:tectech; after:GTRedtech; after:beyondrealitycore; after:OpenBlocks; after:IC2NuclearControl; after:TGregworks; after:StevesCarts;") public class GTplusplus implements ActionListener { //Mod Instance diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java index f788e3b0e4..35160c65cd 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_IntermodStaging.java @@ -6,6 +6,7 @@ import gtPlusPlus.xmod.forestry.HANDLER_FR; import gtPlusPlus.xmod.gregtech.HANDLER_GT; import gtPlusPlus.xmod.growthcraft.HANDLER_GC; import gtPlusPlus.xmod.ic2.HANDLER_IC2; +import gtPlusPlus.xmod.sc2.HANDLER_SC2; import gtPlusPlus.xmod.thaumcraft.HANDLER_Thaumcraft; import gtPlusPlus.xmod.thermalfoundation.HANDLER_TF; import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers; @@ -23,6 +24,7 @@ public class COMPAT_IntermodStaging { //HANDLER_Mekanism.preInit(); HANDLER_Thaumcraft.preInit(); HANDLER_Tinkers.preInit(); + HANDLER_SC2.preInit(); } public static void init(){ @@ -36,6 +38,7 @@ public class COMPAT_IntermodStaging { //HANDLER_Mekanism.init(); HANDLER_Thaumcraft.init(); HANDLER_Tinkers.init(); + HANDLER_SC2.init(); } public static void postInit(){ @@ -49,6 +52,7 @@ public class COMPAT_IntermodStaging { //HANDLER_Mekanism.postInit(); HANDLER_Thaumcraft.postInit(); HANDLER_Tinkers.postInit(); + HANDLER_SC2.postInit(); } diff --git a/src/Java/gtPlusPlus/core/lib/LoadedMods.java b/src/Java/gtPlusPlus/core/lib/LoadedMods.java index 81cae14a6b..7e30a14f6b 100644 --- a/src/Java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/Java/gtPlusPlus/core/lib/LoadedMods.java @@ -50,6 +50,7 @@ public class LoadedMods { public static boolean RedTech = false; //RedMage's Mod public static boolean TecTech = false; //Technus' Mod public static boolean TiCon = false; + public static boolean StevesCarts = false; @@ -127,6 +128,11 @@ public class LoadedMods { Logger.INFO("Components enabled for: RFTools"); totalMods++; } + if (Loader.isModLoaded("StevesCarts") == true){ + StevesCarts = true; + Logger.INFO("Components enabled for: StevesCarts"); + totalMods++; + } if (Loader.isModLoaded("Thaumcraft") == true){ Thaumcraft = true; Logger.INFO("Components enabled for: Thaumcraft"); diff --git a/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java b/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java new file mode 100644 index 0000000000..d94fb7b7f8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java @@ -0,0 +1,27 @@ +package gtPlusPlus.xmod.sc2; + +import gtPlusPlus.core.lib.LoadedMods; +import vswe.stevescarts.ModuleData.ModuleDataLoader; + +public class HANDLER_SC2 { + + public static void preInit(){ + if (LoadedMods.StevesCarts){ + ModuleDataLoader.load(); + } + } + + public static void init(){ + if (LoadedMods.StevesCarts){ + + } + } + + public static void postInit(){ + if (LoadedMods.StevesCarts){ + + } + } + + +} diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java b/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java new file mode 100644 index 0000000000..c552bd7e7c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java @@ -0,0 +1,7 @@ +package gtPlusPlus.xmod.sc2.modules; + +import vswe.stevescarts.Modules.ICropModule; + +public interface IExoticCropModule extends ICropModule { + +} diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java b/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java new file mode 100644 index 0000000000..50d544100f --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java @@ -0,0 +1,448 @@ +package gtPlusPlus.xmod.sc2.modules.workers.tools; + +import net.minecraft.block.BlockCrops; +import net.minecraft.init.Items; +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.item.ItemStack; +import net.minecraft.world.IBlockAccess; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.common.helpers.TreeFarmHelper; +import gtPlusPlus.xmod.sc2.modules.IExoticCropModule; +import gtPlusPlus.xmod.sc2.slots.SlotExoticSeed; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.common.IPlantable; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.util.Vec3; +import net.minecraft.inventory.IInventory; +import vswe.stevescarts.Slots.SlotBase; +import vswe.stevescarts.Modules.ModuleBase; +import vswe.stevescarts.Modules.Workers.Tools.ModuleFarmer; +import vswe.stevescarts.Carts.MinecartModular; +import java.util.ArrayList; +import vswe.stevescarts.Modules.ICropModule; + +public abstract class ModuleExoticFarmer extends ModuleFarmer { + + //Detect Forestry + protected boolean isForestryLoaded = false; + private final Block forestryHumus; + + private ArrayList<IExoticCropModule> plantModulesExotic; + + public ModuleExoticFarmer(final MinecartModular cart) { + super(cart); + isForestryLoaded = LoadedMods.Forestry; + if (isForestryLoaded) { + forestryHumus = TreeFarmHelper.getHumus(); + } + else { + forestryHumus = null; + } + } + + public void init() { + super.init(); + this.plantModulesExotic = new ArrayList<IExoticCropModule>(); + for (final ModuleBase module : this.getCart().getModules()) { + if (module instanceof ICropModule) { + this.plantModulesExotic.add((IExoticCropModule) module); + } + } + } + + public byte getWorkPriority() { + return 90; + } + + protected SlotBase getSlot(final int slotId, int x, final int y) { + if (x == 0) { + return super.getSlot(slotId, x, y); + } + --x; + return (SlotBase) new SlotExoticSeed((IInventory) this.getCart(), this, slotId, 8 + x * 18, 28 + y * 18); + } + + public boolean work() { + final Vec3 next = this.getNextblock(); + final int x = (int) next.xCoord; + final int y = (int) next.yCoord; + final int z = (int) next.zCoord; + for (int i = -this.getRange(); i <= this.getRange(); ++i) { + for (int j = -this.getRange(); j <= this.getRange(); ++j) { + final int coordX = x + i; + final int coordY = y - 1; + final int coordZ = z + j; + if (this.farm(coordX, coordY, coordZ)) { + return true; + } + if (this.till(coordX, coordY, coordZ)) { + return true; + } + if (this.plant(coordX, coordY, coordZ)) { + return true; + } + } + } + return false; + } + + protected boolean till(final int x, final int y, final int z) { + final Block b = this.getCart().worldObj.getBlock(x, y, z); + if (this.getCart().worldObj.isAirBlock(x, y + 1, z) && (b == Blocks.grass || b == Blocks.dirt)) { + if (this.doPreWork()) { + this.startWorking(10); + return true; + } + this.stopWorking(); + this.getCart().worldObj.setBlock(x, y, z, (isForestryLoaded ? forestryHumus : Blocks.farmland)); + } + return false; + } + + protected boolean plant(final int x, final int y, final int z) { + int hasSeeds = -1; + final Block soilblock = this.getCart().worldObj.getBlock(x, y, z); + if (soilblock != null) { + for (int i = 0; i < this.getInventorySize(); ++i) { + if (this.getStack(i) != null && this.isSeedValidHandler(this.getStack(i))) { + final Block cropblock = this.getCropFromSeedHandler(this.getStack(i)); + if (cropblock != null && cropblock instanceof IPlantable + && this.getCart().worldObj.isAirBlock(x, y + 1, z) + && soilblock.canSustainPlant((IBlockAccess) this.getCart().worldObj, x, y, z, + ForgeDirection.UP, (IPlantable) cropblock)) { + hasSeeds = i; + break; + } + } + } + if (hasSeeds != -1) { + if (this.doPreWork()) { + this.startWorking(25); + return true; + } + this.stopWorking(); + final Block cropblock2 = this.getCropFromSeedHandler(this.getStack(hasSeeds)); + this.getCart().worldObj.setBlock(x, y + 1, z, cropblock2); + final ItemStack stack = this.getStack(hasSeeds); + --stack.stackSize; + if (this.getStack(hasSeeds).stackSize <= 0) { + this.setStack(hasSeeds, (ItemStack) null); + } + } + } + return false; + } + + protected boolean farm(final int x, final int y, final int z) { + if (!this.isBroken()) { + final Block block = this.getCart().worldObj.getBlock(x, y + 1, z); + final int m = this.getCart().worldObj.getBlockMetadata(x, y + 1, z); + if (this.isReadyToHarvestHandler(x, y + 1, z)) { + if (this.doPreWork()) { + final int efficiency = (this.enchanter != null) ? this.enchanter.getEfficiencyLevel() : 0; + final int workingtime = (int) (this.getBaseFarmingTime() + / Math.pow(1.2999999523162842, efficiency)); + ReflectionUtils.invokeVoid(this, "setFarming", new Class[] {int.class}, new Object[] {((int) workingtime * 4)}); + this.startWorking(workingtime); + return true; + } + this.stopWorking(); + ArrayList<ItemStack> stuff; + if (this.shouldSilkTouch(block, x, y, z, m)) { + stuff = new ArrayList<ItemStack>(); + final ItemStack stack = this.getSilkTouchedItem(block, m); + if (stack != null) { + stuff.add(stack); + } + } else { + final int fortune = (this.enchanter != null) ? this.enchanter.getFortuneLevel() : 0; + stuff = (ArrayList<ItemStack>) block.getDrops(this.getCart().worldObj, x, y + 1, z, m, fortune); + } + for (final ItemStack iStack : stuff) { + this.getCart().addItemToChest(iStack); + if (iStack.stackSize != 0) { + final EntityItem entityitem = new EntityItem(this.getCart().worldObj, this.getCart().posX, + this.getCart().posY, this.getCart().posZ, iStack); + entityitem.motionX = (x - this.getCart().x()) / 10.0f; + entityitem.motionY = 0.15000000596046448; + entityitem.motionZ = (z - this.getCart().z()) / 10.0f; + this.getCart().worldObj.spawnEntityInWorld((Entity) entityitem); + } + } + this.getCart().worldObj.setBlockToAir(x, y + 1, z); + this.damageTool(3); + } + } + return false; + } + + protected int getBaseFarmingTime() { + return 15; + } + + public boolean isSeedValidHandler(final ItemStack seed) { + for (final IExoticCropModule module : this.plantModulesExotic) { + if (module.isSeedValid(seed)) { + return true; + } + } + return false; + } + + protected Block getCropFromSeedHandler(final ItemStack seed) { + for (final IExoticCropModule module : this.plantModulesExotic) { + if (module.isSeedValid(seed)) { + return module.getCropFromSeed(seed); + } + } + return null; + } + + protected boolean isReadyToHarvestHandler(final int x, final int y, final int z) { + for (final IExoticCropModule module : this.plantModulesExotic) { + if (module.isReadyToHarvest(x, y, z)) { + return true; + } + } + return false; + } + + public boolean isSeedValid(final ItemStack seed) { + return seed.getItem() == Items.wheat_seeds || seed.getItem() == Items.potato || seed.getItem() == Items.carrot; + } + + public Block getCropFromSeed(final ItemStack seed) { + Block pamCrop = getBlockFromPams(seed); + if (pamCrop != null) { + return pamCrop; + } + if (seed.getItem() == Items.carrot) { + return Blocks.carrots; + } + if (seed.getItem() == Items.potato) { + return Blocks.potatoes; + } + if (seed.getItem() == Items.wheat_seeds) { + return Blocks.wheat; + } + return null; + } + + + Class<?> mPamItemRegistry; + Class<?> mPamBlockRegistry; + + private synchronized Block getBlockFromPams(ItemStack seed) { + try { + return getBlockFromPamsInternal(seed); + } + catch (Throwable t) {} + return null; + } + + private synchronized Block getBlockFromPamsInternal(ItemStack seed) throws ClassNotFoundException, IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { + + if (!LoadedMods.PamsHarvestcraft) { + return null; + } + if (mPamItemRegistry == null) { + mPamItemRegistry = Class.forName("com.pam.harvestcraft.mPamItemRegistry"); + } + if (mPamBlockRegistry == null) { + mPamBlockRegistry = Class.forName("com.pam.harvestcraft.mPamBlockRegistry"); + } + + if (mPamItemRegistry == null | mPamBlockRegistry == null) { + return null; + } + + + if (seed == mPamItemRegistry.getDeclaredField("blackberryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamblackberryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("blueberryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamblueberryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("candleberryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcandleberryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("raspberryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamraspberryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("strawberryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamstrawberryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("grapeseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamgrapeCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cactusfruitseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcactusfruitCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("asparagusseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamasparagusCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("barleyseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambarleyCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("oatsseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamoatsCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("ryeseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamryeCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cornseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcornCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("bambooshootseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambambooshootCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cantaloupeseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcantaloupeCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cucumberseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcucumberCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("wintersquashseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamwintersquashCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("zucchiniseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamzucchiniCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("beetseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambeetCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("onionseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamonionCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("parsnipseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamparsnipCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("peanutseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pampeanutCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("radishseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamradishCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("rutabagaseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamrutabagaCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("sweetpotatoseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamsweetpotatoCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("turnipseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamturnipCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("rhubarbseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamrhubarbCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("celeryseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamceleryCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("garlicseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamgarlicCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("gingerseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamgingerCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("spiceleafseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamspiceleafCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("tealeafseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamteaCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("coffeebeanseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcoffeeCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("mustardseedsseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pammustardCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("broccoliseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambroccoliCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cauliflowerseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcauliflowerCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("leekseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamleekCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("lettuceseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamlettuceCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("scallionseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamscallionCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("artichokeseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamartichokeCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("brusselsproutseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambrusselsproutCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cabbageseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcabbageCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("spinachseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamspinachCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("whitemushroomseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamwhitemushroomCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("beanseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambeanCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("soybeanseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamsoybeanCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("bellpepperseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pambellpepperCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("chilipepperseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamchilipepperCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("eggplantseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pameggplantCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("okraseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamokraCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("peasseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pampeasCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("tomatoseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamtomatoCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("cottonseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcottonCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("pineappleseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pampineappleCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("kiwiseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamkiwiCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("curryleafseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamcurryleafCrop").get(null); + } + if (seed == mPamItemRegistry.getDeclaredField("sesameseedsseedItem").get(null)) { + return (Block) mPamBlockRegistry.getDeclaredField("pamsesameseedsCrop").get(null); + } + return null; + } + + public boolean isReadyToHarvest(final int x, final int y, final int z) { + final Block block = this.getCart().worldObj.getBlock(x, y, z); + final int m = this.getCart().worldObj.getBlockMetadata(x, y, z); + return block instanceof BlockCrops && m == 7; + } + + protected boolean isFarming() { + if (this.isPlaceholder()) { + return this.getSimInfo().getIsFarming(); + } + return this.getCart().isEngineBurning() && this.getDw(0) != 0; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmerUpgraded.java b/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmerUpgraded.java new file mode 100644 index 0000000000..33d204c45d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmerUpgraded.java @@ -0,0 +1,43 @@ +package gtPlusPlus.xmod.sc2.modules.workers.tools; + +import net.minecraft.item.ItemStack; + +import vswe.stevescarts.Carts.MinecartModular; + +public class ModuleExoticFarmerUpgraded extends ModuleExoticFarmer { + + public ModuleExoticFarmerUpgraded(MinecartModular cart) { + super(cart); + } + + @Override + protected int getRange() { + return 5; + } + + @Override + public int getMaxDurability() { + return Integer.MAX_VALUE; + } + + @Override + public String getRepairItemName() { + return null; + } + + @Override + public int getRepairItemUnits(ItemStack p0) { + return 0; + } + + @Override + public int getRepairSpeed() { + return 0; + } + + @Override + public boolean useDurability() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/sc2/slots/SlotExoticSeed.java b/src/Java/gtPlusPlus/xmod/sc2/slots/SlotExoticSeed.java new file mode 100644 index 0000000000..12871e93a1 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/slots/SlotExoticSeed.java @@ -0,0 +1,14 @@ +package gtPlusPlus.xmod.sc2.slots; + +import gtPlusPlus.xmod.sc2.modules.workers.tools.ModuleExoticFarmer; + +import net.minecraft.inventory.IInventory; +import vswe.stevescarts.Slots.SlotSeed; + +public class SlotExoticSeed extends SlotSeed { + + public SlotExoticSeed(final IInventory iinventory, final ModuleExoticFarmer module, final int i, final int j, final int k) { + super(iinventory, module, i, j, k); + } + +}
\ No newline at end of file diff --git a/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java b/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java new file mode 100644 index 0000000000..21d518f527 --- /dev/null +++ b/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java @@ -0,0 +1,25 @@ +package vswe.stevescarts.ModuleData; + +import java.util.HashMap; + +import gtPlusPlus.xmod.sc2.modules.workers.tools.ModuleExoticFarmerUpgraded; +import vswe.stevescarts.ModuleData.ModuleData; +import vswe.stevescarts.ModuleData.ModuleData.SIDE; +import vswe.stevescarts.ModuleData.ModuleDataGroup; +import vswe.stevescarts.ModuleData.ModuleDataTool; +import vswe.stevescarts.Modules.ModuleBase; + +public class ModuleDataLoader { + + public static void load() { + HashMap<Byte, ModuleData> u = ModuleData.getList(); + if (u.size() < Byte.MAX_VALUE) { + int mNextFreeID = u.size()+1; + final ModuleDataGroup farmerGroup = new ModuleDataGroup(vswe.stevescarts.Helpers.Localization.MODULE_INFO.FARMER_GROUP); + final ModuleData farmerExotic = new ModuleDataTool(mNextFreeID, "Exotic Farmer", + (Class<? extends ModuleBase>) ModuleExoticFarmerUpgraded.class, 75, true) + .addSide(SIDE.FRONT); + farmerGroup.add(farmerExotic); + } + } +} |