diff options
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java | 91 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/items/ItemCartModuleEx.java | 102 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java | 7 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/modules/ModuleExoticSeeds.java | 53 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java | 440 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmerUpgraded.java | 43 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/sc2/slots/SlotExoticSeed.java | 14 | ||||
-rw-r--r-- | src/Java/vswe/stevescarts/ModuleData/GppModuleData.java | 48 | ||||
-rw-r--r-- | src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java | 57 | ||||
-rw-r--r-- | src/resources/assets/stevescarts/textures/items/crop_exotic_seeds_icon.png (renamed from src/resources/assets/stevescarts/textures/items/exotic_farmer_icon.png) | bin | 540 -> 540 bytes |
10 files changed, 105 insertions, 750 deletions
diff --git a/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java b/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java index d575c4925f..f39a69dfbc 100644 --- a/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java +++ b/src/Java/gtPlusPlus/xmod/sc2/HANDLER_SC2.java @@ -1,103 +1,20 @@ package gtPlusPlus.xmod.sc2; -import java.lang.reflect.Field; -import java.util.HashMap; - -import cpw.mods.fml.common.registry.GameRegistry; - -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import vswe.stevescarts.Items.ItemCartModule; -import vswe.stevescarts.ModuleData.ModuleData; -import vswe.stevescarts.ModuleData.ModuleDataLoader; +import vswe.stevescarts.ModuleData.GppModuleData; public class HANDLER_SC2 { - private static final String MODITEMS = "vswe.stevescarts.Items.ModItems"; - private static Class<?> MODITEMSCLASS; - public static ItemCartModule modules; - - @SuppressWarnings("unchecked") - public synchronized static void preInit(){ - if (LoadedMods.StevesCarts){ - - HashMap<Byte, Boolean> validModulesOld = null; - HashMap<Byte, Boolean> validModulesNew = new HashMap<Byte, Boolean>(); - try { - MODITEMSCLASS = Class.forName(MODITEMS); - if (MODITEMSCLASS == null) { - Logger.REFLECTION("Failed Registering Custom SC2 Modules. [1]"); - return; - } - Field validModulesField = ReflectionUtils.getField(MODITEMSCLASS, "validModules"); - if (validModulesField != null) { - validModulesOld = (HashMap<Byte, Boolean>) validModulesField.get(null); - } - } - catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException | ClassNotFoundException e) { - e.printStackTrace(); - Logger.REFLECTION("Failed Registering Custom SC2 Modules. [2]"); - return; - } - - if (validModulesOld == null) { - Logger.REFLECTION("Failed Registering Custom SC2 Modules. [3]"); - return; - } - else { - validModulesNew.putAll(validModulesOld); - } - - if (validModulesNew == null || validModulesNew.isEmpty()) { - Logger.REFLECTION("Failed Registering Custom SC2 Modules. [4]"); - return; - } - - modules = vswe.stevescarts.Items.ModItems.modules; - //GameRegistry.registerItem((Item) modules, "CartModule++"); - ModuleDataLoader.load(); - for (final ModuleData module : ModuleDataLoader.moduleListCustom.values()) { - if (!module.getIsLocked()) { - Logger.REFLECTION("Mapping Custom SC2 Module. Using ID: "+module.getID()); - validModulesNew.put(module.getID(), true); - } - } - for (final ModuleData module : ModuleDataLoader.moduleListCustom.values()) { - final ItemStack submodule = new ItemStack((Item) modules, 1, (int) module.getID()); - if (submodule != null) { - Logger.REFLECTION("Registering Custom SC2 Module. Using ID: "+module.getID()); - GameRegistry.registerCustomItemStack(submodule.getUnlocalizedName(), submodule); - } - } - - try { - Logger.REFLECTION("Setting 'validModules' field in "+MODITEMS+". Old Map was "+validModulesOld.size()+" objects, New map is "+validModulesNew.size()+" objects."); - ReflectionUtils.setFieldValue(MODITEMSCLASS, "validModules", validModulesNew); - } - catch (Exception e) { - e.printStackTrace(); - } - } - else { - Logger.REFLECTION("Failed Registering Custom SC2 Modules. [0]"); - return; + public synchronized static void preInit() { + if (LoadedMods.StevesCarts){ + GppModuleData.loadGpp(); } } public static void init(){ - if (LoadedMods.StevesCarts){ - ModuleDataLoader.load2(); - } } public static void postInit(){ - if (LoadedMods.StevesCarts){ - - } } diff --git a/src/Java/gtPlusPlus/xmod/sc2/items/ItemCartModuleEx.java b/src/Java/gtPlusPlus/xmod/sc2/items/ItemCartModuleEx.java deleted file mode 100644 index 3da3225360..0000000000 --- a/src/Java/gtPlusPlus/xmod/sc2/items/ItemCartModuleEx.java +++ /dev/null @@ -1,102 +0,0 @@ -package gtPlusPlus.xmod.sc2.items; - -import vswe.stevescarts.TileEntities.TileEntityCartAssembler; -import net.minecraft.entity.player.EntityPlayer; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import vswe.stevescarts.ModuleData.ModuleData; -import vswe.stevescarts.ModuleData.ModuleDataLoader; - -import net.minecraft.item.ItemStack; -import net.minecraft.creativetab.CreativeTabs; -import vswe.stevescarts.Items.ItemCartModule; - -import net.minecraft.util.IIcon; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; - -import net.minecraft.item.Item; - -public class ItemCartModuleEx extends ItemCartModule { - IIcon unknownIcon; - - public ItemCartModuleEx() { - this.setCreativeTab(AddToCreativeTab.tabMisc); - } - - public String getName(final ItemStack par1ItemStack) { - final ModuleData data = this.getModuleData(par1ItemStack, true); - if (data == null) { - return "Unknown SC2 module"; - } - return data.getName(); - } - - @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage(final int dmg) { - final ModuleData data = ModuleData.getList().get((byte) dmg); - if (data != null) { - return data.getIcon(); - } - return this.unknownIcon; - } - - @SideOnly(Side.CLIENT) - public void registerIcons(final IIconRegister register) { - for (final ModuleData module : ModuleDataLoader.moduleListCustom.values()) { - final StringBuilder sb = new StringBuilder(); - String x = (sb.append("stevescarts").append(":").append(module.getRawName()).append("_icon").toString()); - Logger.REFLECTION("Icon Path for Module: "+x); - module.createIcon(register); - } - final StringBuilder sb = new StringBuilder(); - this.unknownIcon = register - .registerIcon(sb.append("stevescarts").append(":").append("unknown_icon").toString()); - } - - public String getUnlocalizedName() { - return "item.SC2:unknownexoticmodule"; - } - - public String getUnlocalizedName(final ItemStack item) { - final ModuleData data = this.getModuleData(item, true); - if (data != null) { - return "item.SC2:" + data.getRawName(); - } - return this.getUnlocalizedName(); - } - - @SideOnly(Side.CLIENT) - public void getSubItems(final Item item, final CreativeTabs par2CreativeTabs, final List par3List) { - for (final ModuleData module : ModuleDataLoader.getList().values()) { - if (module.getIsValid()) { - par3List.add(module.getItemStack()); - } - } - } - - @SideOnly(Side.CLIENT) - public void addInformation(final ItemStack par1ItemStack, final EntityPlayer par2EntityPlayer, final List par3List, - final boolean par4) { - final ModuleData module = this.getModuleData(par1ItemStack, true); - if (module != null) { - module.addInformation(par3List, par1ItemStack.getTagCompound()); - } else if (par1ItemStack != null && par1ItemStack.getItem() instanceof ItemCartModuleEx) { - par3List.add("Module id " + par1ItemStack.getItemDamage()); - } else { - par3List.add("Unknown exotic module id"); - } - } - - public ModuleData getModuleData(final ItemStack itemstack, final boolean ignoreSize) { - if (itemstack != null && itemstack.getItem() instanceof ItemCartModuleEx - && (ignoreSize || itemstack.stackSize != TileEntityCartAssembler.getRemovedSize())) { - return ModuleData.getList().get((byte) itemstack.getItemDamage()); - } - return null; - } - -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java b/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java deleted file mode 100644 index c552bd7e7c..0000000000 --- a/src/Java/gtPlusPlus/xmod/sc2/modules/IExoticCropModule.java +++ /dev/null @@ -1,7 +0,0 @@ -package gtPlusPlus.xmod.sc2.modules; - -import vswe.stevescarts.Modules.ICropModule; - -public interface IExoticCropModule extends ICropModule { - -} diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/ModuleExoticSeeds.java b/src/Java/gtPlusPlus/xmod/sc2/modules/ModuleExoticSeeds.java new file mode 100644 index 0000000000..0add3fcb9b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/sc2/modules/ModuleExoticSeeds.java @@ -0,0 +1,53 @@ +package gtPlusPlus.xmod.sc2.modules; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockCrops; +import net.minecraft.item.Item; +import net.minecraft.item.ItemSeeds; +import net.minecraft.item.ItemStack; +import vswe.stevescarts.Carts.MinecartModular; +import vswe.stevescarts.Modules.ICropModule; +import vswe.stevescarts.Modules.Addons.ModuleAddon; + +public class ModuleExoticSeeds extends ModuleAddon implements ICropModule { + + public ModuleExoticSeeds(MinecartModular cart) { + super(cart); + } + + private synchronized Block getBlockFromItemSeeds(ItemStack seed) { + try { + + Item seedItem = seed.getItem(); + if (!(seedItem instanceof ItemSeeds)) return null; + + Block cropBlock = (Block) ReflectionUtils.getField(ItemSeeds.class, "field_150925_a").get(seedItem); + + return cropBlock; + } catch (Throwable t) { + + } + return null; + } + + @Override + public boolean isSeedValid(ItemStack seed) { + return getBlockFromItemSeeds(seed) != null; + } + + @Override + public Block getCropFromSeed(ItemStack seed) { + return getBlockFromItemSeeds(seed); + } + + @Override + public boolean isReadyToHarvest(int x, int y, int z) { + Block b = getCart().worldObj.getBlock(x, y, z); + int m = getCart().worldObj.getBlockMetadata(x, y, z); + + return b instanceof BlockCrops && m == 7; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java b/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java deleted file mode 100644 index 065c2efdd9..0000000000 --- a/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmer.java +++ /dev/null @@ -1,440 +0,0 @@ -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.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<ICropModule> 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<ICropModule>(); - for (final ModuleBase module : this.getCart().getModules()) { - if (module instanceof ICropModule) { - this.plantModulesExotic.add((ICropModule) 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 ICropModule module : this.plantModulesExotic) { - if (module.isSeedValid(seed)) { - return true; - } - } - return false; - } - - protected Block getCropFromSeedHandler(final ItemStack seed) { - for (final ICropModule 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 ICropModule module : this.plantModulesExotic) { - if (module.isReadyToHarvest(x, y, z)) { - return true; - } - } - return false; - } - - public boolean isSeedValid(final ItemStack seed) { - return getBlockFromPams(seed) != null || 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; - } - -}
\ 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 deleted file mode 100644 index 33d204c45d..0000000000 --- a/src/Java/gtPlusPlus/xmod/sc2/modules/workers/tools/ModuleExoticFarmerUpgraded.java +++ /dev/null @@ -1,43 +0,0 @@ -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 deleted file mode 100644 index 12871e93a1..0000000000 --- a/src/Java/gtPlusPlus/xmod/sc2/slots/SlotExoticSeed.java +++ /dev/null @@ -1,14 +0,0 @@ -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/GppModuleData.java b/src/Java/vswe/stevescarts/ModuleData/GppModuleData.java new file mode 100644 index 0000000000..d7fa1d8161 --- /dev/null +++ b/src/Java/vswe/stevescarts/ModuleData/GppModuleData.java @@ -0,0 +1,48 @@ +package vswe.stevescarts.ModuleData; + +import java.util.ArrayList; +import java.util.HashMap; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.sc2.modules.ModuleExoticSeeds; +import net.minecraft.init.Items; +import vswe.stevescarts.Helpers.ComponentTypes; +import vswe.stevescarts.Items.ModItems; +import vswe.stevescarts.Modules.ModuleBase; + +public class GppModuleData extends ModuleData { + + static byte ID_ExoticSeedAddon = 105; + public static ArrayList<ModuleData> moduleListCustom = new ArrayList<>(); + + public GppModuleData(int id, String name, Class<? extends ModuleBase> moduleClass, int modularCost) { + super(id, name, moduleClass, modularCost); + } + + public static void loadGpp() { + try { + HashMap<Byte, ModuleData> moduleList = + (HashMap<Byte, ModuleData>) (ReflectionUtils.getField(ModuleData.class, "moduleList").get(ModuleData.class)); + ModuleData netherWartModule = moduleList.get((byte)58); + + ModuleDataGroup farmerGroup = netherWartModule.getRequirement().get(0); + + ModuleData exoticSeedModule = + new ModuleData(ID_ExoticSeedAddon, "Crop: Exotic Seeds", ModuleExoticSeeds.class, 20).addRequirement(farmerGroup) + .addRecipe(new Object[][]{{Items.wheat_seeds}, + {ComponentTypes.EMPTY_DISK.getItemStack()} + }); + + moduleListCustom.add(exoticSeedModule); + + HashMap<Byte, Boolean> validModules = + (HashMap<Byte, Boolean>) (ReflectionUtils.getField(ModItems.class, "validModules").get(ModItems.class)); + + validModules.put(ID_ExoticSeedAddon, true); + + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } + +} diff --git a/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java b/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java deleted file mode 100644 index 85e91e9122..0000000000 --- a/src/Java/vswe/stevescarts/ModuleData/ModuleDataLoader.java +++ /dev/null @@ -1,57 +0,0 @@ -package vswe.stevescarts.ModuleData; - -import java.util.HashMap; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.xmod.sc2.modules.workers.tools.ModuleExoticFarmerUpgraded; -import vswe.stevescarts.Helpers.ComponentTypes; -import vswe.stevescarts.Helpers.ResourceHelper; -import vswe.stevescarts.Models.Cart.ModelCartbase; -import vswe.stevescarts.Models.Cart.ModelFarmer; -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 { - - static int ID_ExoticFarmer = 0; - public static HashMap<Byte, ModuleData> moduleListCustom = new HashMap<Byte, ModuleData>(); - - public synchronized static HashMap<Byte, ModuleData> getList() { - return ModuleData.getList(); - } - - public static void load() { - HashMap<Byte, ModuleData> u = getList(); - if (u.size() < Byte.MAX_VALUE) { - ID_ExoticFarmer= 105; - final ModuleDataGroup farmerGroup = new ModuleDataGroup(vswe.stevescarts.Helpers.Localization.MODULE_INFO.FARMER_GROUP); - final ModuleData farmerExotic = new ModuleDataTool(ID_ExoticFarmer, "Exotic Farmer", - (Class<? extends ModuleBase>) ModuleExoticFarmerUpgraded.class, 75, true) - .addSide(SIDE.FRONT).addRecipe(new Object[][]{ - {ComponentTypes.GALGADORIAN_METAL.getItemStack(), - ComponentTypes.GALGADORIAN_METAL.getItemStack(), - ComponentTypes.ENHANCED_GALGADORIAN_METAL.getItemStack()}, - {null, ComponentTypes.HUGE_DYNAMIC_PANE.getItemStack(), null}, - {ComponentTypes.ADVANCED_PCB.getItemStack(), ItemUtils.getItemStackOfAmountFromOreDict("blockNaquadah", 1), - ComponentTypes.GRAPHICAL_INTERFACE.getItemStack()}}); - farmerGroup.add(farmerExotic); - moduleListCustom.put((byte) ID_ExoticFarmer, farmerExotic); - } - } - - public static void load2() { - ModuleData y = getList().get((byte) ID_ExoticFarmer); - if (y != null) { - y.addModel("Farmer", (ModelCartbase) new ModelFarmer(ResourceHelper.getResource("/models/farmerModelGalgadorian.png"))).setModelMult(0.45f); - Logger.REFLECTION("Added Model Data for Exotic Farm Module."); - } - else { - Logger.REFLECTION("Failed getting ModuleData from Local Cache."); - } - - } -} diff --git a/src/resources/assets/stevescarts/textures/items/exotic_farmer_icon.png b/src/resources/assets/stevescarts/textures/items/crop_exotic_seeds_icon.png Binary files differindex 63e0593119..63e0593119 100644 --- a/src/resources/assets/stevescarts/textures/items/exotic_farmer_icon.png +++ b/src/resources/assets/stevescarts/textures/items/crop_exotic_seeds_icon.png |