From 311ab89f93558233a40079f7cb16605b141b5346 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 12 Dec 2021 19:38:06 +0100 Subject: Move sources and resources --- src/main/java/gtPlusPlus/core/lib/CORE.java | 363 +++++++++++++++++++++ src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 348 ++++++++++++++++++++ .../java/gtPlusPlus/core/lib/VanillaColours.java | 28 ++ 3 files changed, 739 insertions(+) create mode 100644 src/main/java/gtPlusPlus/core/lib/CORE.java create mode 100644 src/main/java/gtPlusPlus/core/lib/LoadedMods.java create mode 100644 src/main/java/gtPlusPlus/core/lib/VanillaColours.java (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java new file mode 100644 index 0000000000..dfd536d21c --- /dev/null +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -0,0 +1,363 @@ +package gtPlusPlus.core.lib; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; + +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.FMLCommonHandler; +import gregtech.api.GregTech_API; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.Pair; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.preloader.CORE_Preloader; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.IGregtech_RecipeAdder; +import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractGenerator; +import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraft.world.WorldServer; +import net.minecraftforge.common.config.Configuration; +import net.minecraftforge.common.util.FakePlayerFactory; + +public class CORE { + + //import cpw.mods.fml.common.Optional; + + //Analytics handler + //public static SegmentAnalytics mHelper; + + public static Map PlayerCache; + + //Math Related + public static final float PI = (float) Math.PI; + public static volatile Random RANDOM = new XSTR(); + + //Env. Variables + public static Configuration Config; + + public static boolean DEVENV = false; + public static boolean NBT_PERSISTENCY_PATCH_APPLIED = false; + //Only can be set in Dev, no config or setting elsewhere. + public static final boolean LOAD_ALL_CONTENT = false;; + + //Mod Variables + + public static final String name = "GT++"; + public static final String MODID = "miscutils"; + public static final String VERSION = "1.7.15-GTNH"; + + //Tweakables + public static int EVERGLADES_ID = 227; + public static int EVERGLADESBIOME_ID = 238; + public static int AUSTRALIA_ID = 228; + public static int AUSTRALIA_BIOME_DESERT_1_ID = 239; + public static int AUSTRALIA_BIOME_DESERT_2_ID = 240; + public static int AUSTRALIA_BIOME_DESERT_3_ID = 241; + public static int AUSTRALIA_BIOME_PLAINS_ID = 242; + public static int AUSTRALIA_BIOME_OUTBACK_ID = 243; + public static int AUSTRALIA_BIOME_OCEAN_ID = 244; + public static int AUSTRALIA_BIOME_FOREST_ID = 245; + + //GT Vars; + public static final int GREG_FIRST_ID = 760; + public static final boolean MAIN_GREGTECH_5U_EXPERIMENTAL_FORK = Meta_GT_Proxy.areWeUsingGregtech5uExperimental(); + public static final int GREGTECH_API_VERSION = GregTech_API.VERSION; + public static int turbineCutoffBase = 75000; + + //GT++ Fake Player Profile + public static final GameProfile gameProfile = new GameProfile(UUID.nameUUIDFromBytes("gtplusplus.core".getBytes()), "[GT++]"); + public static final WeakHashMap fakePlayerCache = new WeakHashMap(); + //Tooltips; + public static final String GT_Tooltip = "Added by: " + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; + public static final String GT_Tooltip_Builder = "" + EnumChatFormatting.DARK_GREEN+"Alkalus "+EnumChatFormatting.GRAY+"- "+EnumChatFormatting.RED+"[GT++]"; + public static final String GT_Tooltip_Radioactive = EnumChatFormatting.GRAY+"Warning: "+EnumChatFormatting.GREEN+"Radioactive! "+EnumChatFormatting.GOLD+" Avoid direct handling without hazmat protection."; + public static final String noItem = ""; + + //Because I want to be lazy Gregtech New Horizons Var. + public static boolean GTNH = false; + //Because I want to be lazy. Beyond Reality Classic Var. + public static boolean BRC = false; + + public static final String SEPERATOR = "/"; + + + /** + * Lists/Maps + */ + + //Burnables List + public static List> burnables = new ArrayList>(); + + + //TesseractMapss + public static final Map> sTesseractGeneratorOwnershipMap = new HashMap>(); + public static final Map> sTesseractTerminalOwnershipMap = new HashMap>(); + + //BookMap + public static final Map sBookList = new ConcurrentHashMap(); + + + + + /** + * Some Gregtech Material and Recipe Variables + */ + + @Deprecated + public static IGregtech_RecipeAdder sRecipeAdder; + public static IGregtech_RecipeAdder RA; + + public static final GT_Materials[] sMU_GeneratedMaterials = new GT_Materials[1000]; + + /** + * File Paths and Resource Paths + */ + + public static final String + TEX_DIR = "textures/", + TEX_DIR_GUI = TEX_DIR + "gui/", + TEX_DIR_ITEM = TEX_DIR + "items/", + TEX_DIR_BLOCK = TEX_DIR + "blocks/", + TEX_DIR_ENTITY = TEX_DIR + "entity/", + TEX_DIR_ASPECTS = TEX_DIR + "aspects/", + TEX_DIR_FLUIDS = TEX_DIR_BLOCK + "fluids/", + RES_PATH = MODID + ":" + TEX_DIR, + RES_PATH_GUI = MODID + ":" + TEX_DIR_GUI, + RES_PATH_ITEM = MODID + ":" + TEX_DIR_ITEM, + RES_PATH_BLOCK = MODID + ":" + TEX_DIR_BLOCK, + RES_PATH_ENTITY = MODID + ":" + TEX_DIR_ENTITY, + RES_PATH_ASPECTS = MODID + ":" + TEX_DIR_ASPECTS, + RES_PATH_FLUIDS = MODID + ":" + TEX_DIR_FLUIDS; + + + + + /** Used to create a {@link EntityPlayer} instance from {@link FakePlayerFactory}. + * If this instance already exists in the cache, we will return that instead. + * These instances are held via weak reference, if the world object is unloaded, they too will be removed. + * This is the suggested way to handle them, as suggested by Forge. + * + * @param world - The {@link World} object for which you want to check for in the cache. + * This object is used as a weak reference in a {@link WeakHashMap}. + * @return - An {@link EntityPlayerMP} instance, returned either from cache or created and cached prior to return. + */ + public static EntityPlayerMP getFakePlayer(World world) { + if (fakePlayerCache.get(world) == null) { + fakePlayerCache.put(world, FakePlayerFactory.get((WorldServer) world, CORE.gameProfile)); + } + return fakePlayerCache.get(world); + } + + + + + + + + + + + + + + + + + + /* + * Config Switch Class + */ + + public static class ConfigSwitches { + //Debug + public static boolean disableEnderIOIntegration = false; + public static boolean disableEnderIOIngotTooltips = false; + public static boolean MACHINE_INFO = true; + public static boolean showHiddenNEIItems = false; + public static boolean dumpItemAndBlockData = false; + + //Tools + public static boolean enableSkookumChoochers = true; + public static boolean enableMultiSizeTools = true; + + //Block Drops + public static int chanceToDropDrainedShard = 196; + public static int chanceToDropFluoriteOre = 32; + + //Machine Related + public static boolean enableAlternativeBatteryAlloy = false; + public static boolean enableThaumcraftShardUnification = false; + public static boolean disableIC2Recipes = false; + public static boolean enableAlternativeDivisionSigilRecipe = false; + public static int boilerSteamPerSecond = 750; + public static final boolean requireControlCores = false; + + //Feature Related + public static boolean enableCustomCapes = false; + public static boolean enableCustomCircuits = true; + public static boolean enableOldGTcircuits = false; + public static boolean disableZombieReinforcement = false; + public static int enableWatchdogBGM = CORE_Preloader.enableWatchdogBGM; + + //GT Fixes + public static boolean enableNitroFix = false; + public static boolean enableSulfuricAcidFix = false; + public static boolean enableAnimatedTurbines = true; + public static boolean enableHarderRecipesForHighTierCasings = true; + + //Single Block Machines + public static boolean enableMachine_SolarGenerators = false; + public static boolean enableMachine_Safes = true; + public static boolean enableMachine_Dehydrators = true; + public static boolean enableMachine_SteamConverter = true; + public static boolean enableMachine_FluidTanks = true; + public static boolean enableMachine_RocketEngines = true; + public static boolean enableMachine_GeothermalEngines = true; + public static boolean enableMachine_WorldAccelerators = true; + public static boolean enableMachine_Tesseracts = true; + public static boolean enableMachine_SimpleWasher = true; + public static boolean enableMachine_Pollution = true; + public static boolean enableMachine_ComponentAssemblers = false; + public static boolean enableCustom_Pipes = true; + public static boolean enableCustom_Cables = true; + public static boolean enableMachine_RF_Convetor = false; + + //Multiblocks + public static boolean enableMultiblock_AlloyBlastSmelter = true; + public static boolean enableMultiblock_IndustrialCentrifuge = true; + public static boolean enableMultiblock_IndustrialCokeOven = true; + public static boolean enableMultiblock_IndustrialElectrolyzer = true; + public static boolean enableMultiblock_IndustrialMacerationStack = true; + public static boolean enableMultiblock_IndustrialPlatePress = true; + public static boolean enableMultiblock_IndustrialWireMill = true; + public static boolean enableMultiblock_IronBlastFurnace = true; + public static boolean enableMultiblock_MatterFabricator = true; + public static boolean enableMultiblock_MultiTank = true; + public static boolean enableMultiblock_PowerSubstation = true; + public static boolean enableMultiblock_LiquidFluorideThoriumReactor = true; + public static boolean enableMultiblock_NuclearFuelRefinery = true; + public static boolean enableMultiblock_TreeFarmer = true; + public static boolean enableMultiblock_IndustrialSifter = true; + public static boolean enableMultiblock_IndustrialThermalCentrifuge = true; + public static boolean enableMultiblock_IndustrialWashPlant = true; + public static boolean enableMultiblock_LargeAutoCrafter = true; + public static boolean enableMultiblock_ThermalBoiler = true; + public static boolean enableMultiblock_IndustrialCuttingMachine = true; + public static boolean enableMultiblock_IndustrialFishingPort = true; + public static boolean enableMultiblock_IndustrialExtrudingMachine = true; + public static boolean enableMultiblock_IndustrialMultiMachine = true; + public static boolean enableMultiblock_Cyclotron = true; + + //Visuals + public static boolean enableTreeFarmerParticles = true; + public static boolean useGregtechTextures = true; + + //Pollution + public static int pollutionPerSecondMultiPackager = 40; + public static int pollutionPerSecondMultiIndustrialAlloySmelter = 300; + public static int pollutionPerSecondMultiIndustrialArcFurnace = 2400; + public static int pollutionPerSecondMultiIndustrialCentrifuge = 300; + public static int pollutionPerSecondMultiIndustrialCokeOven = 80; + public static int pollutionPerSecondMultiIndustrialCuttingMachine = 160; + public static int pollutionPerSecondMultiIndustrialDehydrator = 500; + public static int pollutionPerSecondMultiIndustrialElectrolyzer = 300; + public static int pollutionPerSecondMultiIndustrialExtruder = 1000; + public static int pollutionPerSecondMultiIndustrialMacerator = 400; + public static int pollutionPerSecondMultiIndustrialMixer = 800; + public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeMetal = 400; + public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeFluid = 400; + public static int pollutionPerSecondMultiIndustrialMultiMachine_ModeMisc = 600; + public static int pollutionPerSecondMultiIndustrialPlatePress_ModeForming = 240; + public static int pollutionPerSecondMultiIndustrialPlatePress_ModeBending = 480; + public static int pollutionPerSecondMultiIndustrialSifter = 40; + public static int pollutionPerSecondMultiIndustrialThermalCentrifuge = 1000; + public static int pollutionPerSecondMultiIndustrialVacuumFreezer = 500; + public static int pollutionPerSecondMultiIndustrialWashPlant_ModeChemBath = 400; + public static int pollutionPerSecondMultiIndustrialWashPlant_ModeWasher = 100; + public static int pollutionPerSecondMultiIndustrialWireMill = 100; + public static int pollutionPerSecondMultiIsaMill = 1280; + public static int pollutionPerSecondMultiAdvDistillationTower_ModeDistillery = 240; + public static int pollutionPerSecondMultiAdvDistillationTower_ModeDT = 480; + public static int pollutionPerSecondMultiAdvEBF = 500; + public static int pollutionPerSecondMultiAdvImplosion = 5000; + public static int pollutionPerSecondMultiABS = 200; + public static int pollutionPerSecondMultiCyclotron = 200; + public static int pollutionPerSecondMultiIndustrialFishingPond = 20; + public static int pollutionPerSecondMultiLargeRocketEngine; + public static int pollutionPerSecondMultiLargeSemiFluidGenerator = 1280; + public static int pollutionPerSecondMultiMassFabricator = 40; + public static int pollutionPerSecondMultiRefinery = 4000; + public static int pollutionPerSecondMultiGeneratorArray; + public static int pollutionPerSecondMultiTreeFarm = 100; + public static int pollutionPerSecondMultiFrothFlotationCell = 0; + public static int pollutionPerSecondMultiAutoCrafter = 500; + public static int pollutionPerSecondMultiThermalBoiler = 700; + public static int pollutionPerSecondMultiAlgaePond = 0; + //pollution single blocks + public static int basePollutionPerSecondSemiFluidGenerator = 40; + public static double[] pollutionReleasedByTierSemiFluidGenerator = new double[]{0,2.0,4.0,8.0}; + public static int basePollutionPerSecondBoiler = 35; + public static double[] pollutionReleasedByTierBoiler = new double[]{0,1.0,1.43, 1.86}; + public static int baseMinPollutionPerSecondRocketFuelGenerator = 250; + public static int baseMaxPollutionPerSecondRocketFuelGenerator = 2000; + public static double[] pollutionReleasedByTierRocketFuelGenerator = new double[]{0,0,0,0,1,2,3}; + public static int basePollutionPerSecondGeothermalGenerator = 100; + public static double[] pollutionReleasedByTierGeothermalGenerator = new double[]{0,0,0,0,1,1,1}; + + } + + public static class Everglades{ + public static final String MODID = "ToxicEverglades"; + public static final String NAME = "GT++ Toxic Everglades"; + public static final String VERSION = "0.1"; + } + + public static class Australia{ + public static final String MODID = "Australia"; + public static final String NAME = "GT++ Australia"; + public static final String VERSION = "0.1"; + } + + + public static final void crash() { + crash("Generic Crash"); + } + + public static final void crash(String aReason) { + Logger.INFO("=========================================================="); + Logger.INFO("[GT++ CRASH]"); + Logger.INFO("=========================================================="); + Logger.INFO("Oooops..."); + Logger.INFO("This should only happy in a development environment or when something really bad happens."); + Logger.INFO("Reason: "+aReason); + Logger.INFO("=========================================================="); + Logger.INFO("Called from: "+ReflectionUtils.getMethodName(1)); + Logger.INFO(ReflectionUtils.getMethodName(2)); + Logger.INFO(ReflectionUtils.getMethodName(3)); + Logger.INFO(ReflectionUtils.getMethodName(4)); + Logger.INFO(ReflectionUtils.getMethodName(5)); + Logger.INFO(ReflectionUtils.getMethodName(6)); + Logger.INFO(ReflectionUtils.getMethodName(7)); + Logger.INFO(ReflectionUtils.getMethodName(8)); + Logger.INFO(ReflectionUtils.getMethodName(9)); + Logger.INFO(ReflectionUtils.getMethodName(10)); + Logger.INFO(ReflectionUtils.getMethodName(11)); + Logger.INFO(ReflectionUtils.getMethodName(12)); + Logger.INFO(ReflectionUtils.getMethodName(13)); + Logger.INFO(ReflectionUtils.getMethodName(14)); + Logger.INFO(ReflectionUtils.getMethodName(15)); + FMLCommonHandler.instance().exitJava(0, true); + } + + public static final void gc() { + System.gc(); + } + +} \ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java new file mode 100644 index 0000000000..1eb8351d65 --- /dev/null +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -0,0 +1,348 @@ +package gtPlusPlus.core.lib; + +import static gtPlusPlus.core.lib.CORE.*; + +import java.util.HashMap; + +import cpw.mods.fml.common.Loader; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE.ConfigSwitches; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechTextures; +import gtPlusPlus.xmod.gregtech.recipes.GregtechRecipeAdder; + +public class LoadedMods { + + //Initialize Variables + public static boolean Gregtech = false; + public static boolean PlayerAPI = false; + public static boolean BuildCraft = false; + public static boolean EnderIO = false; + public static boolean Big_Reactors = false; + public static boolean IndustrialCraft2 = false; + public static boolean IndustrialCraft2Classic = false; + public static boolean Simply_Jetpacks = false; + public static boolean RFTools = false; + public static boolean Thaumcraft = false; + public static boolean Baubles = false; + public static boolean Extra_Utils = false; + public static boolean PneumaticCraft = false; + public static boolean MorePlanets = false; + public static boolean ForbiddenMagic = false; + public static boolean CompactWindmills = false; + public static boolean Railcraft = false; + public static boolean ImmersiveEngineering = false; + public static boolean Growthcraft = false; + public static boolean CoFHCore = false; + public static boolean Forestry = false; + public static boolean MagicBees = false; + public static boolean ExtraBees = false; + public static boolean Psychedelicraft = false; + public static boolean MiscUtils = true; //Dummy For MetaData Lookups in MT Wrapper + public static boolean ThermalFoundation = false; + public static boolean IHL = false; + public static boolean OpenComputers = false; //OpenComputers + public static boolean OpenBlocks = false; + public static boolean Computronics = false; //computronics + public static boolean DreamCraft = false; //GT: New Horizons + public static boolean BeyondRealityCore = false; //Beyond Reality - Probably Classic + public static boolean BiomesOPlenty = false; + public static boolean PamsHarvestcraft = false; + public static boolean GalacticraftCore = false; + public static boolean Mekanism = false; + public static boolean RedTech = false; //RedMage's Mod + public static boolean TecTech = false; //Technus' Mod + public static boolean KekzTech = false; //KekzDealers' Mod + public static boolean TiCon = false; + public static boolean StevesCarts = false; + public static boolean Witchery = false; + public static boolean Waila = false; + public static boolean CropsPlusPlus = false; //Barts Crop Mod + public static boolean Reliquary = false; + public static boolean SpiceOfLife = false; + + + + private static int totalMods; + @SuppressWarnings("deprecation") + public static void checkLoaded(){ + Logger.INFO("Looking for optional mod prereqs."); + if (isModLoaded("gregtech") ){ + Gregtech = true; + Logger.INFO("Components enabled for: Gregtech"); + if (Gregtech){ + try { + CORE.sRecipeAdder = CORE.RA = new GregtechRecipeAdder(); + Logger.INFO("Created Gregtech recipe handler."); + GregtechTextures.BlockIcons.VOID.name(); + GregtechTextures.ItemIcons.VOID.name(); + Logger.INFO("Created Gregtech texture handler."); + } catch (final NullPointerException e){ + Logger.INFO("Could NOT create a Gregtech recipe handler."); + } + } + + totalMods++; + } + if (isModLoaded("dreamcraft")){ + DreamCraft = true; + GTNH = true; + Logger.INFO("Components enabled for: DreamCraft"); + Logger.INFO("Components enabled for: GT: New Horizons"); + totalMods++; + } + if (isModLoaded("beyondrealitycore")){ + BeyondRealityCore = true; + BRC = true; + Logger.INFO("Components enabled for: Beyond Reality"); + totalMods++; + } + if (isModLoaded("PlayerAPI")){ + PlayerAPI = true; + Logger.INFO("Components enabled for: PlayerAPI"); + totalMods++; + } + if (isModLoaded("berriespp")) { + CropsPlusPlus = true; + Logger.INFO("Components enabled for: Crops++"); + totalMods++; + } + if (isModLoaded("xreliquary")) { + Reliquary = true; + Logger.INFO("Components enabled for: Reliquary"); + totalMods++; + } + if (isModLoaded("TConstruct")){ + TiCon = true; + Logger.INFO("Components enabled for: Tinkers Construct"); + totalMods++; + } + if (isModLoaded("BuildCraft")){ + BuildCraft = true; + Logger.INFO("Components enabled for: BuildCraft"); + totalMods++; + } + if ((isModLoaded("EnderIO")) && !ConfigSwitches.disableEnderIOIntegration){ + EnderIO = true; + Logger.INFO("Components enabled for: EnderIO"); + totalMods++; + } + if (isModLoaded("BigReactors")){ + Big_Reactors = true; + Logger.INFO("Components enabled for: Big Reactors"); + totalMods++; + } + if (isModLoaded("IC2")){ + IndustrialCraft2 = true; + Logger.INFO("Components enabled for: IndustrialCraft2"); + totalMods++; + } + if (isModLoaded("IC2-Classic-Spmod")){ + IndustrialCraft2Classic = true; + Logger.INFO("Components enabled for: IndustrialCraft2-Classic"); + totalMods++; + } + if (isModLoaded("simplyjetpacks")){ + Simply_Jetpacks = true; + Logger.INFO("Components enabled for: Simply Jetpacks"); + totalMods++; + } + if (isModLoaded("rftools")){ + RFTools = true; + Logger.INFO("Components enabled for: RFTools"); + totalMods++; + } + if (isModLoaded("StevesCarts")){ + StevesCarts = true; + Logger.INFO("Components enabled for: StevesCarts"); + totalMods++; + } + if (isModLoaded("OpenBlocks")){ + OpenBlocks = true; + Logger.INFO("Components enabled for: OpenBlocks"); + totalMods++; + } + if (isModLoaded("Thaumcraft")){ + Thaumcraft = true; + Logger.INFO("Components enabled for: Thaumcraft"); + totalMods++; + } + if (isModLoaded("BiomesOPlenty")){ + BiomesOPlenty = true; + Logger.INFO("Components enabled for: BiomesOPlenty"); + totalMods++; + } + if (isModLoaded("ExtraUtilities")){ + Extra_Utils = true; + Logger.INFO("Components enabled for: Extra_Utils"); + totalMods++; + } + if (isModLoaded("harvestcraft")){ + PamsHarvestcraft = true; + Logger.INFO("Components enabled for: PamsHarvestcraft"); + totalMods++; + } + if (isModLoaded("PneumaticCraft")){ + PneumaticCraft = true; + Logger.INFO("Components enabled for: PneumaticCraft"); + totalMods++; + } + if (isModLoaded("MorePlanet")){ + MorePlanets = true; + Logger.INFO("Components enabled for: MorePlanets"); + totalMods++; + } + if (isModLoaded("ForbiddenMagic")){ + ForbiddenMagic = true; + Logger.INFO("Components enabled for: ForbiddenMagic"); + totalMods++; + } + if (isModLoaded("CompactWindmills")){ + CompactWindmills = true; + Logger.INFO("Components enabled for: CompactWindmills"); + totalMods++; + } + if (isModLoaded("Railcraft")){ + Railcraft = true; + Logger.INFO("Components enabled for: Railcraft"); + totalMods++; + } + if (isModLoaded("Waila")){ + Waila = true; + Logger.INFO("Components enabled for: WAILA"); + totalMods++; + } + if (isModLoaded("SpiceOfLife")){ + SpiceOfLife = true; + Logger.INFO("Components enabled for: Spice Of Life"); + totalMods++; + } + if (isModLoaded("Mekanism")){ + Mekanism = true; + Logger.INFO("Components enabled for: Mekanism - This feature is not configurable and balances Mekanism to suit GT."); + totalMods++; + } + if (isModLoaded("Growthcraft")){ + Logger.INFO("Growthcraft Version: "+getModVersion("Growthcraft")); + if (getModVersion("Growthcraft").equals("1.7.10-2.3.1")){ + //Load Growthcraft Compat + Growthcraft = true; + Logger.INFO("Components enabled for: Growthcraft"); + totalMods++; + } + else { + Growthcraft = false; + Logger.INFO("Growthcraft found, but the version was too new. I will update GC support eventually."); + } + } + if (isModLoaded("CoFHCore")){ + CoFHCore = true; + Logger.INFO("Components enabled for: CoFHCore"); + totalMods++; + } + if (isModLoaded("Forestry")){ + Forestry = true; + Logger.INFO("Components enabled for: Forestry"); + totalMods++; + } + if (isModLoaded("MagicBees")){ + MagicBees = true; + Logger.INFO("Components enabled for: MagicBees"); + totalMods++; + } + if (isModLoaded("psychedelicraft")){ + Psychedelicraft = true; + Logger.INFO("Components enabled for: Psychedelicraft"); + totalMods++; + } + if (isModLoaded("ImmersiveEngineering")){ + ImmersiveEngineering = true; + Logger.INFO("Components enabled for: ImmersiveEngineering"); + totalMods++; + } + if (isModLoaded("ExtraBees")){ + ExtraBees = true; + Logger.INFO("Components enabled for: ExtraBees"); + totalMods++; + } + if (isModLoaded("ThermalFoundation") == false){ + ThermalFoundation = false; + Logger.INFO("Components enabled for: ThermalFoundation - This feature will disable itself if you add TF."); + totalMods++; + } + else if (isModLoaded("ThermalFoundation")){ + ThermalFoundation = true; + Logger.INFO("Components disabled for: ThermalFoundation - This feature will enable itself if you remove TF."); + //totalMods++; + } + if (isModLoaded("ihl")){ + IHL = true; + Logger.INFO("Components enabled for: IHL"); + totalMods++; + } + if (isModLoaded("Baubles")){ + Baubles = true; + Logger.INFO("Components enabled for: Baubles"); + totalMods++; + } + if (isModLoaded("GalacticraftCore")){ + GalacticraftCore = true; + Logger.INFO("Components enabled for: Galacticraft Core"); + totalMods++; + } + if (isModLoaded("OpenComputers")){ + OpenComputers = true; + Logger.INFO("Components enabled for: OpenComputers"); + totalMods++; + } + if (isModLoaded("computronics")){ + Computronics = true; + Logger.INFO("Components disabled for: Computronics - This feature will enable itself if you remove Computronics."); + totalMods++; + } + else { + Logger.INFO("Components enabled for: Computronics - This feature will disable itself if you add Computronics."); + } + if (isModLoaded("GTRedtech")){ + RedTech = true; + Logger.INFO("Components enabled for: GTRedtech"); + totalMods++; + } + if (isModLoaded("tectech")){ + TecTech = true; + Logger.INFO("Components enabled for: TecTech"); + totalMods++; + } + if (isModLoaded("kekztech")){ + KekzTech = true; + Logger.INFO("Components enabled for: KekzTech"); + totalMods++; + } + if (isModLoaded("witchery")){ + Witchery = true; + Logger.INFO("Components enabled for: Witchery"); + totalMods++; + } + + Logger.INFO("Content found for "+totalMods+" mods"); + + } + + public static String getModVersion(final String modName){ + final String ver = cpw.mods.fml.common.FMLCommonHandler.instance().findContainerFor(modName).getVersion(); + return ver; + } + + private static final HashMap mLoadedModCache = new HashMap(); + + public static boolean isModLoaded(String aModName) { + Boolean aResult = mLoadedModCache.get(aModName); + if (aResult == null) { + boolean aTemp = Loader.isModLoaded(aModName); + mLoadedModCache.put(aModName, aTemp); + aResult = aTemp; + } + return aResult; + } + +} diff --git a/src/main/java/gtPlusPlus/core/lib/VanillaColours.java b/src/main/java/gtPlusPlus/core/lib/VanillaColours.java new file mode 100644 index 0000000000..9a7a82cb1f --- /dev/null +++ b/src/main/java/gtPlusPlus/core/lib/VanillaColours.java @@ -0,0 +1,28 @@ +package gtPlusPlus.core.lib; + +import gtPlusPlus.core.util.Utils; + +public enum VanillaColours { + + BONE_MEAL(249, 255, 254), INK_BLACK(29, 29, 33), COCOA_BEANS(131, 84, 50), LAPIS_LAZULI(60, 68, 170), + DYE_WHITE(249, 255, 254), DYE_BLACK(29, 29, 33), DYE_RED(176, 46, 38), DYE_GREEN(94, 124, 22), + DYE_CYAN(22, 156, 156), DYE_PINK(243, 139, 170), DYE_LIME(128, 199, 31), DYE_YELLOW(254, 216, 61), + DYE_ORANGE(249, 128, 29), DYE_BROWN(131, 84, 50), DYE_LIGHT_BLUE(58, 179, 218), DYE_LIGHT_PURPLE(199, 78, 189), + DYE_LIGHT_GRAY(157, 157, 151), DYE_DARK_BLUE(60, 68, 170), DYE_DARK_PURPLE(137, 50, 184), DYE_DARK_GRAY(71, 79, 82); + + private final int r, g, b; + + private VanillaColours(int aR, int aG, int aB) { + r = aR; + g = aG; + b = aB; + } + + public short[] getAsShort() { + return new short[] { (short) r, (short) g, (short) b }; + } + + public int getAsInt() { + return Utils.rgbtoHexValue(r, g, b); + } +} -- cgit From 20b5d2932ef44e1c96104d6ec0528012f5c83d21 Mon Sep 17 00:00:00 2001 From: Johann Bernhardt Date: Sun, 12 Dec 2021 19:42:07 +0100 Subject: Migrated to unified build script --- .circleci/config.yml | 65 --- .gitattributes | 17 - .github/scripts/test-no-crash-reports.sh | 9 + .github/workflows/build-and-test.yml | 45 ++ .github/workflows/release-tags.yml | 45 ++ .gitignore | 169 +----- .gradle/2.0/taskArtifacts/cache.properties | 1 - .gradle/2.0/taskArtifacts/cache.properties.lock | Bin 17 -> 0 bytes .gradle/2.0/taskArtifacts/fileHashes.bin | Bin 521607 -> 0 bytes .gradle/2.0/taskArtifacts/fileSnapshots.bin | Bin 4430057 -> 0 bytes .gradle/2.0/taskArtifacts/outputFileStates.bin | Bin 18872 -> 0 bytes .gradle/2.0/taskArtifacts/taskArtifacts.bin | Bin 29153 -> 0 bytes .project | 23 - Recommended.txt | 1 - SupporterList.txt | 2 - _config.yml | 1 - addon.gradle | 3 + bitbucket-pipelines.yml.disabled | 19 - build.gradle | 661 ++++++++++++++++++------ build.properties | 8 - changelog.mustache | 29 -- changelogcurse.mustache | 20 - changeloggeneral.mustache | 17 - dependencies.gradle | 51 ++ gradle.properties | 64 +++ gradle/wrapper/gradle-wrapper.jar | Bin 53324 -> 55616 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 98 ++-- gradlew.bat | 30 +- jitpack.yml | 2 + repositories.gradle | 26 + src/main/java/gtPlusPlus/core/lib/CORE.java | 2 +- version.properties | 1 - 33 files changed, 844 insertions(+), 568 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .gitattributes create mode 100644 .github/scripts/test-no-crash-reports.sh create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/release-tags.yml delete mode 100644 .gradle/2.0/taskArtifacts/cache.properties delete mode 100644 .gradle/2.0/taskArtifacts/cache.properties.lock delete mode 100644 .gradle/2.0/taskArtifacts/fileHashes.bin delete mode 100644 .gradle/2.0/taskArtifacts/fileSnapshots.bin delete mode 100644 .gradle/2.0/taskArtifacts/outputFileStates.bin delete mode 100644 .gradle/2.0/taskArtifacts/taskArtifacts.bin delete mode 100644 .project delete mode 100644 Recommended.txt delete mode 100644 SupporterList.txt delete mode 100644 _config.yml create mode 100644 addon.gradle delete mode 100644 bitbucket-pipelines.yml.disabled delete mode 100644 build.properties delete mode 100644 changelog.mustache delete mode 100644 changelogcurse.mustache delete mode 100644 changeloggeneral.mustache create mode 100644 dependencies.gradle create mode 100644 gradle.properties create mode 100644 jitpack.yml create mode 100644 repositories.gradle delete mode 100644 version.properties (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index a70e1368c2..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,65 +0,0 @@ -version: 2 -jobs: - build: - working_directory: ~/repo - - docker: - - image: circleci/openjdk:8-jdk - - - environment: - JVM_OPTS: -Xms2048m Xmx4000m - - - steps: - - add_ssh_keys: - fingerprints: - - "17:37:c7:07:d3:2b:a9:b8:b8:8f:e8:d5:23:fd:9a:4c" - - - checkout - - - run: - name: Set Terminal - command: export TERM=${TERM:-dumb} - # && ./gradlew clean build - - - run: sudo chmod +x gradlew - - # Build Forge and MCP - - run: - name: Download Resource Builder [MCP/Forge] - command: wget https://alkcorp.overminddl1.com/GTPP_BuildRepo.sh - - - restore_cache: - key: jars-{{ checksum "GTPP_BuildRepo.sh" }}-{{ checksum "GTPP_BuildRepo.sh" }} - - - run: - name: Run Resource Builder [MCP/Forge] - command: sh GTPP_BuildRepo.sh - - # Cache All Libs - - save_cache: - paths: - - ~/.gradle - - ~/home/circleci/repo - key: jars-{{ checksum "GTPP_BuildRepo.sh" }}-{{ checksum "GTPP_BuildRepo.sh" }} - - # Build Mod - - run: - name: Download Build Script - command: wget https://alkcorp.overminddl1.com/Build_1_Master.sh - - - run: - name: Run Master Script - command: sh Build_1_Master.sh ${CIRCLE_BUILD_NUM} "${CIRCLE_BRANCH}" "${CIRCLE_USERNAME}" "${CIRCLE_SHA1}" "${CIRCLE_PROJECT_REPONAME}" "${CIRCLE_PROJECT_USERNAME}" "https://bitbucket.org/draknyte1/gtpp-development/get/cb20041176eb.zip" - - - run: - name: Run Build Script - command: sh RunScript.sh "17:37:c7:07:d3:2b:a9:b8:b8:8f:e8:d5:23:fd:9a:4c" - - - store_artifacts: # for display in Artifacts: https://circleci.com/docs/2.0/artifacts/ - path: build/libs - #destination: builds - #- store_test_results: # for display in Test Summary: https://circleci.com/docs/2.0/collect-test-data/ - #path: build/libs - # See https://circleci.com/docs/2.0/deployment-integrations/ for deploy examples diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index bdb0cabc87..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,17 +0,0 @@ -# Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain diff --git a/.github/scripts/test-no-crash-reports.sh b/.github/scripts/test-no-crash-reports.sh new file mode 100644 index 0000000000..c67e342c06 --- /dev/null +++ b/.github/scripts/test-no-crash-reports.sh @@ -0,0 +1,9 @@ +directory="run/crash-reports" +if [ -d $directory ]; then + echo "Crash reports detected:" + cat $directory/* + exit 1 +else + echo "No crash reports detected" + exit 0 +fi diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..a60a2b6468 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Build and test + +on: + pull_request: + branches: [ master, main ] + push: + branches: [ master, main ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Run server for 1 minute + run: | + mkdir run + echo "eula=true" > run/eula.txt + timeout 60 ./gradlew runServer || true + + - name: Test no crashes happend + run: | + chmod +x .github/scripts/test-no-crash-reports.sh + .github/scripts/test-no-crash-reports.sh diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml new file mode 100644 index 0000000000..25c354b227 --- /dev/null +++ b/.github/workflows/release-tags.yml @@ -0,0 +1,45 @@ +# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle + +name: Release tagged build + +on: + push: + tags: + - '*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Set release version + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + cache: gradle + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Setup the workspace + run: ./gradlew setupCIWorkspace + + - name: Build the mod + run: ./gradlew build + + - name: Release under current tag + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "${{ env.RELEASE_VERSION }}" + files: build/libs/*.jar diff --git a/.gitignore b/.gitignore index 172ff53c26..558ad12d27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,149 +1,28 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.log -*.log.gz -*.msi -*.msm -*.msp -*.json -*.txt -*.zip - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# Created by https://www.gitignore.io/api/eclipse - -### Eclipse ### - -.metadata -tmp/ -*.tmp -*.bak -*.swp -*~.nib -local.properties -.settings/ -.loadpath - -# Eclipse Core -.project - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - -# JDT-specific (Eclipse Java Development Tools) +.gradle +.settings +/.idea/ +/run/ +/build/ +/eclipse/ .classpath - -# Java annotation processor (APT) -.factorypath - -# PDT-specific (PHP Development Tools) -.buildpath - -# sbteclipse plugin -.target - -# TeXlipse plugin -.texlipse - -# STS (Spring Tool Suite) -.springBeans - -# IDEA -.idea/ +.project +/bin/ +/config/ +/crash-reports/ +/logs/ +options.txt +/saves/ +usernamecache.json +banned-ips.json +banned-players.json +eula.txt +ops.json +server.properties +servers.dat +usercache.json +whitelist.json +/out/ *.iml *.ipr *.iws - -# Other -backups -bin -blueprints -build -config -crash-reports -gradle -local -logs -modpack -mods -resourcepacks -saves -screenshots -scripts -.circleci -.gradle -.okhttpcache -/src/Java/gtPlusPlus/preloader/asm/visitors/ob/sprinkler/Visitor_Field_Sprinkler.java -/src/Java/gtPlusPlus/preloader/asm/visitors/ob/sprinkler/Visitor_Method_Sprinkler_GetInventory.java -/src/Java/gtPlusPlus/preloader/asm/visitors/ob/sprinkler/Visitor_Method_Sprinkler_UpdateEntity.java -/src/Java/gtPlusPlus/xmod/galacticraft/asm/EntityAutoRocket_ASM.java -/src/Java/gtPlusPlus/xmod/galacticraft/asm/FluidUtil_ASM.java -/src/Java/gtPlusPlus/xmod/galacticraft/asm/TileEntityFuelLoader_ASM.java -/src/Java/gtPlusPlus/xmod/ob/TileEntitySprinkler_ASM.java -/src/Java/gtPlusPlus/xmod/thermalfoundation/asm/OreDictionaryArbiter_ASM.java -/GeneratedIcons -/unused libs -/world -/server.properties -/servers.dat -/GregTech.cfg -/GregTech.lang -/GTPP.dat -/PlayerCache.dat -wip -*.bat -GT++.ipr -GT++.iws - - -out +src/main/resources/mixins.*.json diff --git a/.gradle/2.0/taskArtifacts/cache.properties b/.gradle/2.0/taskArtifacts/cache.properties deleted file mode 100644 index 8882797c67..0000000000 --- a/.gradle/2.0/taskArtifacts/cache.properties +++ /dev/null @@ -1 +0,0 @@ -#Sun Apr 01 01:00:20 AEST 2018 diff --git a/.gradle/2.0/taskArtifacts/cache.properties.lock b/.gradle/2.0/taskArtifacts/cache.properties.lock deleted file mode 100644 index f33ec6d27f..0000000000 Binary files a/.gradle/2.0/taskArtifacts/cache.properties.lock and /dev/null differ diff --git a/.gradle/2.0/taskArtifacts/fileHashes.bin b/.gradle/2.0/taskArtifacts/fileHashes.bin deleted file mode 100644 index 6e8e8c8a9a..0000000000 Binary files a/.gradle/2.0/taskArtifacts/fileHashes.bin and /dev/null differ diff --git a/.gradle/2.0/taskArtifacts/fileSnapshots.bin b/.gradle/2.0/taskArtifacts/fileSnapshots.bin deleted file mode 100644 index c7cf0e52eb..0000000000 Binary files a/.gradle/2.0/taskArtifacts/fileSnapshots.bin and /dev/null differ diff --git a/.gradle/2.0/taskArtifacts/outputFileStates.bin b/.gradle/2.0/taskArtifacts/outputFileStates.bin deleted file mode 100644 index ef2b32791e..0000000000 Binary files a/.gradle/2.0/taskArtifacts/outputFileStates.bin and /dev/null differ diff --git a/.gradle/2.0/taskArtifacts/taskArtifacts.bin b/.gradle/2.0/taskArtifacts/taskArtifacts.bin deleted file mode 100644 index c2a3ca022f..0000000000 Binary files a/.gradle/2.0/taskArtifacts/taskArtifacts.bin and /dev/null differ diff --git a/.project b/.project deleted file mode 100644 index d5d349ad52..0000000000 --- a/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - GTplusplus - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/Recommended.txt b/Recommended.txt deleted file mode 100644 index af09ff06ff..0000000000 --- a/Recommended.txt +++ /dev/null @@ -1 +0,0 @@ -1.7.02.09 \ No newline at end of file diff --git a/SupporterList.txt b/SupporterList.txt deleted file mode 100644 index 39f89922c2..0000000000 --- a/SupporterList.txt +++ /dev/null @@ -1,2 +0,0 @@ -Draknyte1 -Fobius \ No newline at end of file diff --git a/_config.yml b/_config.yml deleted file mode 100644 index c4192631f2..0000000000 --- a/_config.yml +++ /dev/null @@ -1 +0,0 @@ -theme: jekyll-theme-cayman \ No newline at end of file diff --git a/addon.gradle b/addon.gradle new file mode 100644 index 0000000000..cc0f5d57e5 --- /dev/null +++ b/addon.gradle @@ -0,0 +1,3 @@ +compileJava { + options.encoding = "UTF-8" +} diff --git a/bitbucket-pipelines.yml.disabled b/bitbucket-pipelines.yml.disabled deleted file mode 100644 index 0009fd8ee4..0000000000 --- a/bitbucket-pipelines.yml.disabled +++ /dev/null @@ -1,19 +0,0 @@ -# This is a sample build configuration for Java (Gradle). -# Check our guides at https://confluence.atlassian.com/x/zd-5Mw for more examples. -# Only use spaces to indent your .yml configuration. -# ----- -# You can specify a custom docker image from Docker Hub as your build environment. -image: openjdk:8 - -pipelines: - default: - - step: - caches: - - gradle - script: # Modify the commands below to build your repository. - # You must commit the Gradle wrapper to your repository - # https://docs.gradle.org/current/userguide/gradle_wrapper.html - - bash ./gradlew build - artifacts: # defining the artifacts to be kept. - - build/libs/*.jar - - build/libs/proguard.map \ No newline at end of file diff --git a/build.gradle b/build.gradle index 54a5f62eeb..18fedd355e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,206 +1,529 @@ +//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428 +/* +DO NOT CHANGE THIS FILE! + +Also, you may replace this file at any time if there is an update available. +Please check https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/build.gradle for updates. + */ + + +import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar + +import java.util.concurrent.TimeUnit + buildscript { - repositories { - mavenLocal() - mavenCentral() - jcenter() - maven { - name = "forge" - url = "https://maven.minecraftforge.net" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - maven { - name = "jitpack" - url = "https://jitpack.io" - } - } - dependencies { - classpath "com.github.GTNewHorizons:ForgeGradle:1.2.4" - } -} - -// Because Forge is too stupid to fix Deprecation Issues, and we cannot fix it on our end! (until we fork Forge) -allprojects { - tasks.withType(Javadoc) { - //options.compilerArgs << "-Xlint:deprecation" - options.addStringOption('Xdoclint:none', '-quiet') - } -} - -apply plugin: 'eclipse' -eclipse { - classpath { - downloadJavadoc = true - downloadSources = true - } -} - -apply plugin: 'idea' -idea{ - module { - downloadJavadoc = true - downloadSources = true - } + repositories { + maven { + name = "forge" + url = "https://maven.minecraftforge.net" + } + maven { + name = "sonatype" + url = "https://oss.sonatype.org/content/repositories/snapshots/" + } + maven { + name = "Scala CI dependencies" + url = "https://repo1.maven.org/maven2/" + } + maven { + name = "jitpack" + url = "https://jitpack.io" + } + } + dependencies { + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4' + } +} + +plugins { + id 'idea' + id 'scala' + id("org.ajoberstar.grgit") version("3.1.1") + id("com.github.johnrengelman.shadow") version("4.0.4") + id("com.palantir.git-version") version("0.12.3") } apply plugin: 'forge' -file "build.properties" withReader { - def prop = new Properties() - prop.load(it) - ext.config = new ConfigSlurper().parse prop +def projectJavaVersion = JavaLanguageVersion.of(8) + +java { + toolchain { + languageVersion.set(projectJavaVersion) + } +} + +idea { + module { + inheritOutputDirs = true + downloadJavadoc = true + downloadSources = true + } } -file "version.properties" withReader { - def prop = new Properties() - prop.load(it) - ext.config2 = new ConfigSlurper().parse prop +if(JavaVersion.current() != JavaVersion.VERSION_1_8) { + throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) } -//apply plugin: 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' +checkPropertyExists("modName") +checkPropertyExists("modId") +checkPropertyExists("modGroup") +checkPropertyExists("autoUpdateBuildScript") +checkPropertyExists("minecraftVersion") +checkPropertyExists("forgeVersion") +checkPropertyExists("replaceGradleTokenInFile") +checkPropertyExists("gradleTokenModId") +checkPropertyExists("gradleTokenModName") +checkPropertyExists("gradleTokenVersion") +checkPropertyExists("gradleTokenGroupName") +checkPropertyExists("apiPackage") +checkPropertyExists("accessTransformersFile") +checkPropertyExists("usesMixins") +checkPropertyExists("mixinPlugin") +checkPropertyExists("mixinsPackage") +checkPropertyExists("coreModClass") +checkPropertyExists("containsMixinsAndOrCoreModOnly") +checkPropertyExists("usesShadowedDependencies") +checkPropertyExists("developmentEnvironmentUserName") + -version = "${config.gtpp.version}.${config2.mod.version}" -group= "gtPlusPlus" -archivesBaseName = "GT-PlusPlus" +String javaSourceDir = "src/main/java/" +String scalaSourceDir = "src/main/scala/" +String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") +String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") +if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +} + +if(apiPackage) { + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } +} -//Java Version -sourceCompatibility = 1.8 -targetCompatibility = 1.8 +if(accessTransformersFile) { + String targetFile = "src/main/resources/META-INF/" + accessTransformersFile + if(getFile(targetFile).exists() == false) { + throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) + } +} + +if(usesMixins.toBoolean()) { + if(mixinsPackage.isEmpty() || mixinPlugin.isEmpty()) { + throw new GradleException("\"mixinPlugin\" requires \"mixinsPackage\" and \"mixinPlugin\" to be set!") + } + + targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + } + + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +if(coreModClass) { + String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" + String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" + if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + } +} + +configurations.all { + resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) + + // Make sure GregTech build won't time out + System.setProperty("org.gradle.internal.http.connectionTimeout", 120000 as String) + System.setProperty("org.gradle.internal.http.socketTimeout", 120000 as String) +} + +// Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version +'git config core.fileMode false'.execute() +// Pulls version from git tag +try { + version = minecraftVersion + "-" + gitVersion() +} +catch (Exception e) { + throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!"); +} -//Compile against UTF-8 -compileTestJava.options.encoding = 'UTF-8' -javadoc.options.encoding = 'UTF-8' -compileJava.options.encoding = 'UTF-8' +group = modGroup +if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { + archivesBaseName = customArchiveBaseName +} +else { + archivesBaseName = modId +} minecraft { - version = "${config.minecraft.version}-${config.forge.version}" - runDir = "eclipse" - srgExtra "PK: org/dom4j gtpp/shaded/org/dom4j" - srgExtra "PK: org/javassist gtpp/shaded/org/javassist" - srgExtra "PK: org/reflections/reflections gtpp/shaded/org/reflections" + version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion + runDir = "run" + + if (replaceGradleTokenInFile) { + replaceIn replaceGradleTokenInFile + if(gradleTokenModId) { + replace gradleTokenModId, modId + } + if(gradleTokenModName) { + replace gradleTokenModName, modName + } + if(gradleTokenVersion) { + replace gradleTokenVersion, versionDetails().lastTag + } + if(gradleTokenGroupName) { + replace gradleTokenGroupName, modGroup + } + } } -idea { module { inheritOutputDirs = true } } +if(file("addon.gradle").exists()) { + apply from: "addon.gradle" +} + +apply from: 'repositories.gradle' configurations { - provided - embedded - shade - compile.extendsFrom provided, embedded, shade + implementation.extendsFrom(shadowImplementation) } repositories { - maven { - name = "gt" - url = "http://gregtech.overminddl1.com/" - } - maven { - name = "ic2" - url = "http://maven.ic2.player.to/" - } - ivy { - name = 'gtnh_download_source_stupid_underscore_typo' - artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]_[revision].[ext]") - } - ivy { - name = 'gtnh_download_source' - artifactPattern("http://downloads.gtnewhorizons.com/Mods_for_Jenkins/[module]-[revision].[ext]") - } - maven { - url = "https://jitpack.io" - } - maven { - url "https://cursemaven.com" - } -} - -sourceSets { - main { - java { srcDirs = ["$projectDir/src/Java"] } - resources { srcDirs = ["$projectDir/src/resources"] } - } + maven { + name = "Overmind forge repo mirror" + url = "https://gregtech.overminddl1.com/" + } + if(usesMixins.toBoolean()) { + maven { + name = "sponge" + url = "https://repo.spongepowered.org/repository/maven-public" + } + maven { + url = "https://jitpack.io" + } + } +} + +dependencies { + if(usesMixins.toBoolean()) { + annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") + annotationProcessor("com.google.guava:guava:24.1.1-jre") + annotationProcessor("com.google.code.gson:gson:2.8.6") + annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + // using 0.8 to workaround a issue in 0.7 which fails mixin application + compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { + // Mixin includes a lot of dependencies that are too up-to-date + exclude module: "launchwrapper" + exclude module: "guava" + exclude module: "gson" + exclude module: "commons-io" + exclude module: "log4j-core" + } + compile("com.github.GTNewHorizons:SpongeMixins:1.3.3:dev") + } +} + +apply from: 'dependencies.gradle' + +def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap +def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" + +task generateAssets { + if(usesMixins.toBoolean()) { + getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + "required": true, + "minVersion": "0.7.11", + "package": "${modGroup}.${mixinsPackage}", + "plugin": "${modGroup}.${mixinPlugin}", + "refmap": "${mixingConfigRefMap}", + "target": "@env(DEFAULT)", + "compatibilityLevel": "JAVA_8" +} + +""" + } +} + +task relocateShadowJar(type: ConfigureShadowRelocation) { + target = tasks.shadowJar + prefix = modGroup + ".shadow" +} + +shadowJar { + manifest { + attributes(getManifestAttributes()) + } + + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] + dependsOn(relocateShadowJar) +} + +jar { + manifest { + attributes(getManifestAttributes()) + } + + if(usesShadowedDependencies.toBoolean()) { + dependsOn(shadowJar) + enabled = false + } +} + +reobf { + if(usesMixins.toBoolean()) { + addExtraSrgFile mixinSrg + } +} + +afterEvaluate { + if(usesMixins.toBoolean()) { + tasks.compileJava { + options.compilerArgs += [ + "-AreobfSrgFile=${tasks.reobf.srg}", + "-AoutSrgFile=${mixinSrg}", + "-AoutRefMapFile=${refMap}", + // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code + "-XDenableSunApiLintControl", + "-XDignore.symbol.file" + ] + } + } +} + +runClient { + def arguments = [] + + if(usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + if(developmentEnvironmentUserName) { + arguments += [ + "--username", + developmentEnvironmentUserName + ] + } + + args(arguments) +} + +runServer { + def arguments = [] + + if (usesMixins.toBoolean()) { + arguments += [ + "--mods=../build/libs/$modId-${version}.jar", + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + } + + args(arguments) +} + +tasks.withType(JavaExec).configureEach { + javaLauncher.set( + javaToolchains.launcherFor { + languageVersion = projectJavaVersion + } + ) } processResources -{ - // this will ensure that this task is redone when the versions change. - inputs.property "version", project.version - inputs.property "mcversion", project.minecraft.version - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'version':project.version, 'mcversion':project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - exclude '**/Thumbs.db' + { + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + + // replace stuff in mcmod.info, nothing else + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + // replace version and mcversion + expand "minecraftVersion": project.minecraft.version, + "modVersion": versionDetails().lastTag, + "modId": modId, + "modName": modName + } + + if(usesMixins.toBoolean()) { + from refMap + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' + } + } + +def getManifestAttributes() { + def manifestAttributes = [:] + if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + manifestAttributes += ["FMLCorePluginContainsFMLMod": true] + } + + if(accessTransformersFile) { + manifestAttributes += ["FMLAT" : accessTransformersFile.toString()] + } + + if(coreModClass) { + manifestAttributes += ["FMLCorePlugin": modGroup + "." + coreModClass] + } + + if(usesMixins.toBoolean()) { + manifestAttributes += [ + "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", + "MixinConfigs" : "mixins." + modId + ".json", + "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + ] + } + return manifestAttributes } -dependencies { - compile "com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev" +task sourcesJar(type: Jar) { + from (sourceSets.main.allJava) + from (file("$projectDir/LICENSE")) + getArchiveClassifier().set('sources') +} - // Used for productive reflection without class loading. (0.9.12 has no reliance on Guava either) - //shade group: 'org.reflections', name: 'reflections', version: '0.9.12' - //shade group: 'org.dom4j', name: 'dom4j', version: '2.1.1' - //compile group: 'org.javassist', name: 'javassist', version: '3.26.0-GA' +task shadowDevJar(type: ShadowJar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") - implementation 'com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev' - compile "com.github.GTNewHorizons:StructureLib:master-SNAPSHOT:dev" + manifest { + attributes(getManifestAttributes()) + } - provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev" + minimize() // This will only allow shading for actually used classes + configurations = [project.configurations.shadowImplementation] +} + +task relocateShadowDevJar(type: ConfigureShadowRelocation) { + target = tasks.shadowDevJar + prefix = modGroup + ".shadow" +} - compile "com.github.GTNewHorizons:Waila:master-SNAPSHOT:dev" - compile "com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev" - compile "api.player:PlayerAPI:1.7.10-1.4" - - compile "minetweaker:MineTweaker3:1.7.10-3.0.10:dev-full" +task circularResolverJar(type: Jar) { + dependsOn(relocateShadowDevJar) + dependsOn(shadowDevJar) + enabled = false +} - compile "com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev" - - compile "curse.maven:cofh-core-69162:2388750" - compile "curse.maven:cofh-lib-220333:2388748" +task devJar(type: Jar) { + from sourceSets.main.output + getArchiveClassifier().set("dev") - implementation 'com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev' + manifest { + attributes(getManifestAttributes()) + } - compileOnly "com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:dev" - implementation 'com.github.GTNewHorizons:SC2:master-SNAPSHOT' - - compileOnly "openmods:OpenModsLib:1.7.10-0.10:deobf" - compileOnly "openblocks:OpenBlocks:1.7.10-1.6-1.7.10:deobf" - - //compileOnly "micdoodle8.mods:MicdoodleCore:1.7-3.0.12.504:Dev" - //compileOnly "micdoodle8.mods:GalacticraftCore:1.7-3.0.12.504:Dev" - //compileOnly "micdoodle8.mods:Galacticraft-Planets:1.7-3.0.12.504:Dev" - - compileOnly "thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev" - compile "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf" + if(usesShadowedDependencies.toBoolean()) { + dependsOn(circularResolverJar) + enabled = false + } } -jar { - archiveName = archivesBaseName + "-" + version + ".jar" - manifest { - attributes 'FMLCorePlugin': 'gtPlusPlus.preloader.asm.Preloader_FMLLoadingPlugin' - attributes 'FMLCorePluginContainsFMLMod': 'true' - } - configurations.shade.each { dep -> - from(project.zipTree(dep)){ - exclude 'META-INF', 'META-INF/**' - } - } -} - -task generateDictionaries(type: JavaExec) { - group = "Execution" - description = "Generates the dictionaries for Proguard" - classpath = sourceSets.main.runtimeClasspath - main = "gtPlusPlus.GenerateDictionaries" +task apiJar(type: Jar) { + from (sourceSets.main.allJava) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.output) { + include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' + } + + from (sourceSets.main.resources.srcDirs) { + include("LICENSE") + } + + getArchiveClassifier().set('api') +} + +artifacts { + archives sourcesJar + archives devJar + if(apiPackage) { + archives apiJar + } +} + +// Updating +task updateBuildScript { + doLast { + if (performBuildScriptUpdate(projectDir.toString())) return + + print("Build script already up-to-date!") + } +} + +if (isNewBuildScriptVersionAvailable(projectDir.toString())) { + if (autoUpdateBuildScript.toBoolean()) { + performBuildScriptUpdate(projectDir.toString()) + } else { + println("Build script update available! Run 'gradle updateBuildScript'") + } +} + +static URL availableBuildScriptUrl() { + new URL("https://raw.githubusercontent.com/SinTh0r4s/ExampleMod1.7.10/main/build.gradle") +} + +boolean performBuildScriptUpdate(String projectDir) { + if (isNewBuildScriptVersionAvailable(projectDir)) { + def buildscriptFile = getFile("build.gradle") + availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } + print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + return true + } + return false +} + +boolean isNewBuildScriptVersionAvailable(String projectDir) { + Map parameters = ["connectTimeout": 2000, "readTimeout": 2000] + + String currentBuildScript = getFile("build.gradle").getText() + String currentBuildScriptHash = getVersionHash(currentBuildScript) + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + String availableBuildScriptHash = getVersionHash(availableBuildScript) + + boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash + return !isUpToDate +} + +static String getVersionHash(String buildScriptContent) { + String versionLine = buildScriptContent.find("^//version: [a-z0-9]*") + if(versionLine != null) { + return versionLine.split(": ").last() + } + return "" +} + +configure(updateBuildScript) { + group = 'forgegradle' + description = 'Updates the build script to the latest version' +} + +// Helper methods + +def checkPropertyExists(String propertyName) { + if (project.hasProperty(propertyName) == false) { + throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties") + } +} + +def getFile(String relativePath) { + return new File(projectDir, relativePath) } diff --git a/build.properties b/build.properties deleted file mode 100644 index d8a31be99b..0000000000 --- a/build.properties +++ /dev/null @@ -1,8 +0,0 @@ -minecraft.version=1.7.10 -forge.version=10.13.4.1614-1.7.10 -ic2.version=2.2.828-experimental -gt.version=5.09.37 -ae2.version=rv3-beta-22 -gtpp.version=1.7.18 -commit.hash=aa9f04218e5298414f900b9fe61131f7ed26b8f1 -structurelib.version=1.0.6 diff --git a/changelog.mustache b/changelog.mustache deleted file mode 100644 index 8094f6ac9c..0000000000 --- a/changelog.mustache +++ /dev/null @@ -1,29 +0,0 @@ -# Generated via Git Changelog Gradle plugin - -{{#tags}} -## {{name}} - {{#issues}} - {{#hasIssue}} - {{#hasLink}} -### {{name}} [{{issue}}]({{link}}) {{title}} - {{/hasLink}} - {{^hasLink}} -### {{name}} {{issue}} {{title}} - {{/hasLink}} - {{/hasIssue}} - {{^hasIssue}} -### {{name}} - {{/hasIssue}} - - {{#commits}} -[{{hash}}] | {{authorName}} | {{commitTime}} -``` -{{{messageTitle}}} -{{#messageBodyItems}} -{{.}} -{{/messageBodyItems}} -``` - {{/commits}} - - {{/issues}} -{{/tags}} \ No newline at end of file diff --git a/changelogcurse.mustache b/changelogcurse.mustache deleted file mode 100644 index 9d6ebd8572..0000000000 --- a/changelogcurse.mustache +++ /dev/null @@ -1,20 +0,0 @@ -# Generated via Git Changelog Gradle plugin for Curse/CurseForge -
-
-{{#tags}} -
-{{#commits}} -
-

-[{{hash}}] | {{authorName}} | {{commitTime}} -
-{{{messageTitle}}} -
-{{#messageBodyItems}} -{{.}} -
-{{/messageBodyItems}} -

- {{/commits}} -
-{{/tags}} \ No newline at end of file diff --git a/changeloggeneral.mustache b/changeloggeneral.mustache deleted file mode 100644 index c014e557de..0000000000 --- a/changeloggeneral.mustache +++ /dev/null @@ -1,17 +0,0 @@ -# Generated via Git Changelog Gradle plugin - -# Legend -# (+) - Addition -# (-) - Removal -# (%) - Change -# ($) - Fix -# (^) - Update - -{{#commits}} - -[{{hash}}] | {{authorName}} | {{commitTime}} -{{{messageTitle}}} -{{#messageBodyItems}} -{{.}} -{{/messageBodyItems}} -{{/commits}} \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle new file mode 100644 index 0000000000..4bb879b076 --- /dev/null +++ b/dependencies.gradle @@ -0,0 +1,51 @@ +// Add your dependencies here + +dependencies { + compile("com.github.GTNewHorizons:GT5-Unofficial:master-SNAPSHOT:dev") + /*compileOnly("com.github.GTNewHorizons:StructureLib:master-SNAPSHOT:dev") { // Transitive from GT5-Unofficial + transitive = false + } + compileOnly("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev") { // Transitive from GT5-Unofficial + transitive = false + } + compileOnly("com.github.GTNewHorizons:CodeChickenLib:master-SNAPSHOT:dev") { // Transitive from GT5-Unofficial + transitive = false + } + compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") { // Transitive from GT5-Unofficial + transitive = false + }*/ + + compile("curse.maven:cofh-core-69162:2388751") + + compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:Baubles:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:ForestryMC:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:Railcraft:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:EnderIO:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:EnderCore:master-SNAPSHOT:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:SC2:master-SNAPSHOT:dev") { + transitive = false + } + + compileOnly("player-api:PlayerAPI:1.7.10:1.4") { + transitive = false + } + compileOnly("com.mod-buildcraft:buildcraft:7.1.23:dev") { + transitive = false + } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { + transitive = false + } +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..b59d9e5e45 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,64 @@ +modName = GT++ + +# This is a case-sensitive string to identify your mod. Convention is to use lower case. +modId = miscutils + +modGroup = gtPlusPlus + +# WHY is there no version field? +# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the +# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/ + +# Will update your build.gradle automatically whenever an update is available +autoUpdateBuildScript = false + +minecraftVersion = 1.7.10 +forgeVersion = 10.13.4.1614 + +# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you +# restart Minecraft in development. Choose this dependent on your mod: +# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name +# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty +developmentEnvironmentUserName = "Developer" + +# Define a source file of your project with: +# public static final String VERSION = "GRADLETOKEN_VERSION"; +# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's +# version in @Mod([...], version = VERSION, [...]) +# Leave these properties empty to skip individual token replacements +replaceGradleTokenInFile = CORE.java +gradleTokenModId = +gradleTokenModName = +gradleTokenVersion = GRADLETOKEN_VERSION +gradleTokenGroupName = + +# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise you can +# leave this property empty. +# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api +apiPackage = + +# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/ +# Example value: mymodid_at.cfg +accessTransformersFile = + +# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled! +usesMixins = false +# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. +mixinPlugin = +# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +mixinsPackage = +# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! +# This parameter is for legacy compatability only +# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin +coreModClass = preloader.asm.Preloader_FMLLoadingPlugin +# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class +# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false! +containsMixinsAndOrCoreModOnly = false + +# If enabled, you may use 'shadowImplementation' for dependencies. They will be integrated in your jar. It is your +# responsibility check the licence and request permission for distribution, if required. +usesShadowedDependencies = false + +# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older +# projects. New projects should not use this parameter. +customArchiveBaseName = GT-PlusPlus diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3baa851b28..5c2d1cf016 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 82b0d2f5d7..3ab0b725ef 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Sat Jan 04 01:52:14 CET 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip diff --git a/gradlew b/gradlew index 91a7e269e1..83f2acfdc3 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +75,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +105,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -110,10 +125,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +170,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 8a0b282aa6..9618d8d960 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,14 +24,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +62,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +75,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000000..09bbb514fc --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,2 @@ +before_install: + - ./gradlew setupCIWorkspace \ No newline at end of file diff --git a/repositories.gradle b/repositories.gradle new file mode 100644 index 0000000000..d88a8fcc74 --- /dev/null +++ b/repositories.gradle @@ -0,0 +1,26 @@ +// Add any additional repositories for your dependencies here + +repositories { + maven { + name = "ic2" + url = "http://maven.ic2.player.to/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + name "CurseForge Maven" + url "https://minecraft.curseforge.com/api/maven/" + metadataSources { + mavenPom() + artifact() + } + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } +} diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index dfd536d21c..1ef04aa154 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -51,7 +51,7 @@ public class CORE { public static final String name = "GT++"; public static final String MODID = "miscutils"; - public static final String VERSION = "1.7.15-GTNH"; + public static final String VERSION = "GRADLETOKEN_VERSION"; //Tweakables public static int EVERGLADES_ID = 227; diff --git a/version.properties b/version.properties deleted file mode 100644 index f4fd30f46b..0000000000 --- a/version.properties +++ /dev/null @@ -1 +0,0 @@ -mod.version=GTNH \ No newline at end of file -- cgit From 998c739e50ef56e3a4cf2c4cdd397a8cdfbeef6d Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:00:59 +0000 Subject: Added pollution config values for the new multis. Added recipes for the new blocks. Fix Rock Breaker handling of Redstone/Obsidian. --- .../java/gtPlusPlus/core/config/ConfigHandler.java | 2 + src/main/java/gtPlusPlus/core/lib/CORE.java | 2 + .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 76 +++++++++++++++++++++- .../common/blocks/GregtechMetaCasingBlocks5.java | 3 +- .../GregtechMetaTileEntity_IndustrialChisel.java | 2 +- ...egtechMetaTileEntity_IndustrialRockBreaker.java | 10 ++- 6 files changed, 86 insertions(+), 9 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java index 61610a03e9..382b63e2c3 100644 --- a/src/main/java/gtPlusPlus/core/config/ConfigHandler.java +++ b/src/main/java/gtPlusPlus/core/config/ConfigHandler.java @@ -225,6 +225,8 @@ public class ConfigHandler { pollutionPerSecondMultiMassFabricator = config.get("pollution", "pollutionPerSecondMultiMassFabricator", pollutionPerSecondMultiMassFabricator,"pollution rate in gibbl/s for the Matter fabrication CPU").getInt(pollutionPerSecondMultiMassFabricator); pollutionPerSecondMultiRefinery = config.get("pollution", "pollutionPerSecondMultiRefinery", pollutionPerSecondMultiRefinery,"pollution rate in gibbl/s for the Reactor fuel processing plant").getInt(pollutionPerSecondMultiRefinery); //pollutionPerSecondMultiGeneratorArray; + pollutionPerSecondMultiIndustrialRockBreaker = config.get("pollution", "pollutionPerSecondMultiIndustrialRockBreaker", pollutionPerSecondMultiIndustrialRockBreaker,"pollution rate in gibbl/s for the Industrial Rock Breaker").getInt(pollutionPerSecondMultiIndustrialRockBreaker); + pollutionPerSecondMultiIndustrialChisel = config.get("pollution", "pollutionPerSecondMultiIndustrialChisel", pollutionPerSecondMultiIndustrialChisel,"pollution rate in gibbl/s for the Industrial Chisel").getInt(pollutionPerSecondMultiIndustrialChisel); pollutionPerSecondMultiTreeFarm = config.get("pollution", "pollutionPerSecondMultiTreeFarm", pollutionPerSecondMultiTreeFarm,"pollution rate in gibbl/s for the Tree growth simulator").getInt(pollutionPerSecondMultiTreeFarm); pollutionPerSecondMultiFrothFlotationCell = config.get("pollution", "pollutionPerSecondMultiFrothFlotationCell", pollutionPerSecondMultiFrothFlotationCell,"pollution rate in gibbl/s for the Flotation cell regulator").getInt(pollutionPerSecondMultiFrothFlotationCell); pollutionPerSecondMultiAutoCrafter = config.get("pollution", "pollutionPerSecondMultiAutoCrafter", pollutionPerSecondMultiAutoCrafter,"pollution rate in gibbl/s for the Large-Scale auto assembler v1.01").getInt(pollutionPerSecondMultiAutoCrafter); diff --git a/src/main/java/gtPlusPlus/core/lib/CORE.java b/src/main/java/gtPlusPlus/core/lib/CORE.java index 1ef04aa154..7508b9fc8f 100644 --- a/src/main/java/gtPlusPlus/core/lib/CORE.java +++ b/src/main/java/gtPlusPlus/core/lib/CORE.java @@ -300,6 +300,8 @@ public class CORE { public static int pollutionPerSecondMultiAutoCrafter = 500; public static int pollutionPerSecondMultiThermalBoiler = 700; public static int pollutionPerSecondMultiAlgaePond = 0; + public static int pollutionPerSecondMultiIndustrialRockBreaker = 100; + public static int pollutionPerSecondMultiIndustrialChisel = 50; //pollution single blocks public static int basePollutionPerSecondSemiFluidGenerator = 40; public static double[] pollutionReleasedByTierSemiFluidGenerator = new double[]{0,2.0,4.0,8.0}; diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 14001d86bd..e190bc67fa 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -253,7 +253,9 @@ public class RECIPES_Machines { chemPlant(); zyngen(); milling(); - sparging(); + sparging(); + chisels(); + rockBreaker(); } @@ -2637,6 +2639,78 @@ public class RECIPES_Machines { 60 * 20 * 2, MaterialUtils.getVoltageForTier(5)); } + + private static void chisels() { + ItemStack[] aChisels = new ItemStack[] { + GregtechItemList.GT_Chisel_LV.get(1), + GregtechItemList.GT_Chisel_MV.get(1), + GregtechItemList.GT_Chisel_HV.get(1), + }; + for (int i=1;i<4;i++) { + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(10+i), + CI.getTieredMachineCasing(i), + CI.getPlate(i, 4), + CI.getElectricMotor(i, 2), + CI.getConveyor(i, 2), + CI.getRobotArm(i, 1) + }, + CI.getTieredFluid(i, 144 * 4), + aChisels[i-1], + 20 * 20, + MaterialUtils.getVoltageForTier(i)); + } + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + aChisels[2], + CI.getPlate(4, 8), + CI.getElectricMotor(4, 8), + CI.getConveyor(4, 8), + CI.getRobotArm(4, 4) + }, + CI.getTieredFluid(4, 144 * 8), + GregtechItemList.Controller_IndustrialAutoChisel.get(1), + 20 * 20, + MaterialUtils.getVoltageForTier(4)); + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedBioCircuit(14), + ItemList.Casing_SolidSteel.get(2), + CI.getPlate(4, 2), + CI.getTieredComponent(OrePrefixes.plate, 3, 4), + CI.getTieredComponent(OrePrefixes.ring, 3, 8), + CI.getTieredComponent(OrePrefixes.rod, 2, 4), + }, + CI.getTieredFluid(2, 144 * 2), + GregtechItemList.Casing_IndustrialAutoChisel.get(1), + 20 * 20, + MaterialUtils.getVoltageForTier(3)); + + + + } + + private static void rockBreaker() { + + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + CI.getNumberedAdvancedCircuit(12), + ItemList.Machine_EV_RockBreaker.get(1), + ALLOY.STAINLESS_STEEL.getPlate(8), + ALLOY.STAINLESS_STEEL.getRing(4), + CI.getTieredComponentOfMaterial(Materials.Aluminium, OrePrefixes.plateDouble, 8), + ALLOY.EGLIN_STEEL.getScrew(8), + }, + ELEMENT.getInstance().ALUMINIUM.getFluidStack(144 * 8), + GregtechItemList.Controller_IndustrialRockBreaker.get(1), + 60 * 20 * 2, + MaterialUtils.getVoltageForTier(4)); + + } private static void fakeMachineCasingCovers() { GregtechItemList[] mMachineCasingCovers = new GregtechItemList[] { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java index 4f84a3daca..3d15e5cf58 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks5.java @@ -18,7 +18,8 @@ import net.minecraft.world.IBlockAccess; public class GregtechMetaCasingBlocks5 extends GregtechMetaCasingBlocksAbstract { - //Free Indexes within TAE: 90, 91, 92, 94, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127 + // Free Indexes within TAE: 91, 92, 94, 100, 101, 102, 103, 104, 114, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127 + // 19 Free Indexes private static final TexturesGrinderMultiblock mGrinderOverlayHandler = new TexturesGrinderMultiblock(); public GregtechMetaCasingBlocks5() { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java index 51775791f4..77cc19d5d4 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java @@ -424,7 +424,7 @@ public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiB } public int getPollutionPerSecond(ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiAdvImplosion; + return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialChisel; } public int getDamageToComponent(ItemStack aStack) { diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java index 885aa05716..1b8835f289 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_IndustrialRockBreaker.java @@ -82,9 +82,7 @@ public class GregtechMetaTileEntity_IndustrialRockBreaker extends GregtechMeta_M GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType(getMachineType()) .addInfo("Controller Block for the Industrial Rock Breaker") - .addInfo("200% Faster than the single block version") - .addInfo("Only uses 80% of the eu/t normally required") - .addInfo("Processes 8 items per voltage tier") + .addInfo("Speed: 200% | Eu Usage: 75% | Parallel: Tier x 8") .addInfo("Circuit goes in the Input Bus or GUI slot") .addInfo("1 = cobble, 2 = stone, 3 = obsidian") .addInfo("Supply Water/Lava") @@ -394,8 +392,8 @@ public class GregtechMetaTileEntity_IndustrialRockBreaker extends GregtechMeta_M if (aItems.size() > 0 && aCircuit == 3) { // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) { - if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { - break; + if (!this.depleteInput(tRecipe.mInputs[1])) { + break; } log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); tTotalEUt += tRecipeEUt; @@ -532,7 +530,7 @@ public class GregtechMetaTileEntity_IndustrialRockBreaker extends GregtechMeta_M @Override public int getPollutionPerSecond(final ItemStack aStack) { - return CORE.ConfigSwitches.pollutionPerSecondMultiABS; + return CORE.ConfigSwitches.pollutionPerSecondMultiIndustrialRockBreaker; } @Override -- cgit From 849ae606a186ff5c1b7e9411bd2ed3589dcb06b5 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 20 Dec 2021 18:00:48 +0000 Subject: Add RemoteIO and EnderIO support to Reservoir Hatch. Changed Extreme Airtake from 5k/4t to 8k/4t. Clean up some reflection. Cleaned up GT_MetaTileEntity_Hatch_FluidGenerator.java. --- src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 6 +++ .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 10 ++-- .../core/util/minecraft/HazmatUtils.java | 4 +- .../core/util/reflect/ReflectionUtils.java | 6 +-- .../preloader/asm/Preloader_FMLLoadingPlugin.java | 4 +- .../ClassTransformer_TT_ThaumicRestorer.java | 2 +- .../preloader/keyboard/BetterKeyboard.java | 6 +-- .../gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java | 26 +++++----- .../GT_MetaTileEntity_Hatch_AirIntake_Extreme.java | 4 +- .../GT_MetaTileEntity_Hatch_FluidGenerator.java | 26 +++++----- .../GT_MetaTileEntity_Hatch_Reservoir.java | 58 ++++++++++++++++++++-- 11 files changed, 104 insertions(+), 48 deletions(-) (limited to 'src/main/java/gtPlusPlus/core/lib') diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 1eb8351d65..4f7a10be78 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -60,6 +60,7 @@ public class LoadedMods { public static boolean CropsPlusPlus = false; //Barts Crop Mod public static boolean Reliquary = false; public static boolean SpiceOfLife = false; + public static boolean RemoteIO = false; @@ -322,6 +323,11 @@ public class LoadedMods { Witchery = true; Logger.INFO("Components enabled for: Witchery"); totalMods++; + } + if (isModLoaded("RIO")){ + RemoteIO = true; + Logger.INFO("Components enabled for: RemoteIO"); + totalMods++; } Logger.INFO("Content found for "+totalMods+" mods"); diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 985e783430..f708a99af0 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2764,11 +2764,11 @@ public class RECIPES_Machines { return; } Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); - Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); - Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); - Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); - Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); - Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); + Block agon = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); + Block korp = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); + Block jelt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); + Block bitt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); + Block iszm = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); // "agon", "iszm", "korp", "jelt", "bitt" diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index b322036ef7..0e2fff3f35 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -254,7 +254,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsGravisuite, "graviChestPlate")); AutoMap aGravisuite = new AutoMap(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aGravisuite.add(ItemUtils.getSimpleStack(aItemObject)); } @@ -274,7 +274,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsEMT, "ultimateSolarHelmet")); AutoMap aASP = new AutoMap(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aASP.add(ItemUtils.getSimpleStack(aItemObject)); } diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 1ef925f793..92804d72ec 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1060,13 +1060,13 @@ public class ReflectionUtils { return false; } - public static Object getFieldValue(Field field) { + public static T getFieldValue(Field field) { return getFieldValue(field, null); } - public static Object getFieldValue(Field field, Object instance) { + public static T getFieldValue(Field field, Object instance) { try { - return field.get(instance); + return (T) field.get(instance); } catch (IllegalArgumentException | IllegalAccessException e) { } return null; diff --git a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index 22568e6de7..b52f4eb67e 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -76,8 +76,8 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); Locale aDefaultLocale = Locale.getDefault(); NumberFormat aFormat = NumberFormat.getInstance(); - Locale aDisplayLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); - Locale aFormatLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); + Locale aDisplayLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); + Locale aFormatLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); Preloader_Logger.INFO("Locale: "+aDefaultLocale+" | Test: "+aFormat.format(1000000000)+" | Display: "+aDisplayLocale+" | Format: "+aFormatLocale); } diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java index 05b8054ff8..86a22ce4b9 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java @@ -82,7 +82,7 @@ public class ClassTransformer_TT_ThaumicRestorer { mTookLastTick = ReflectionUtils.getField(mTileRepairerClass, "tookLastTick"); mDamageLastTick = ReflectionUtils.getField(mTileRepairerClass, "dmgLastTick"); mProxyTC = ReflectionUtils.getField(mThaumicTinkerer, "tcProxy"); - repairTConTools = (boolean) ReflectionUtils.getFieldValue(mRepairTiconTools); + repairTConTools = ReflectionUtils.getFieldValue(mRepairTiconTools); mInit = true; } if (mInit) { diff --git a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java index e25c06653c..532d20f1b2 100644 --- a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java +++ b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java @@ -68,7 +68,7 @@ public class BetterKeyboard { Field aKeyNameSize = ReflectionUtils.getField(Keyboard.class, "keyName"); Field aKeyMapSize = ReflectionUtils.getField(Keyboard.class, "keyMap"); Field aKeyDownBuffer = ReflectionUtils.getField(Keyboard.class, "keyDownBuffer"); - String[] aOldKeyNameArray = (String[]) ReflectionUtils.getFieldValue(aKeyNameSize); + String[] aOldKeyNameArray = ReflectionUtils.getFieldValue(aKeyNameSize); if (aOldKeyNameArray != null && aOldKeyNameArray.length < Short.MAX_VALUE) { String[] aNewKeyNameArray = new String[Short.MAX_VALUE]; for (int i=0;i aOldKeyMapArray = (Map) ReflectionUtils.getFieldValue(aKeyMapSize); + Map aOldKeyMapArray = ReflectionUtils.getFieldValue(aKeyMapSize); if (aOldKeyNameArray != null && aOldKeyMapArray.size() < Short.MAX_VALUE) { Map aNewKeyMapArray = new HashMap(Short.MAX_VALUE); aNewKeyMapArray.putAll(aOldKeyMapArray); @@ -94,7 +94,7 @@ public class BetterKeyboard { FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Failed Patching Field: "+aKeyDownBuffer.getName()); } } - ByteBuffer aOldByteBuffer = (ByteBuffer) ReflectionUtils.getFieldValue(aKeyDownBuffer); + ByteBuffer aOldByteBuffer = ReflectionUtils.getFieldValue(aKeyDownBuffer); if (aOldByteBuffer != null && aOldByteBuffer.capacity() == Keyboard.KEYBOARD_SIZE) { ByteBuffer aNewByteBuffer = BufferUtils.createByteBuffer(Short.MAX_VALUE); try { diff --git a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java index 95067300c8..52f498988c 100644 --- a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java @@ -91,7 +91,7 @@ public class HANDLER_BiomesOPlenty { Field aBopColouredSapling = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings"); if (aBopMiscItem != null) { - Item aMiscItem = (Item) ReflectionUtils.getFieldValue(aBopMiscItem); + Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem); if (aMiscItem != null) { mPineCone = aMiscItem; } @@ -99,25 +99,25 @@ public class HANDLER_BiomesOPlenty { if (aBopBlock1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock1); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1); if (aBlock != null) { logs1 = aBlock; } } if (aBopBlock2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock2); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2); if (aBlock != null) { logs2 = aBlock; } } if (aBopBlock3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock3); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3); if (aBlock != null) { logs3 = aBlock; } } if (aBopBlock4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock4); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4); if (aBlock != null) { logs4 = aBlock; } @@ -125,25 +125,25 @@ public class HANDLER_BiomesOPlenty { if (aBopLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1); if (aBlock != null) { leaves1 = aBlock; } } if (aBopLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2); if (aBlock != null) { leaves2 = aBlock; } } if (aBopLeaves3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves3); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3); if (aBlock != null) { leaves3 = aBlock; } } if (aBopLeaves4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves4); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4); if (aBlock != null) { leaves4 = aBlock; } @@ -151,13 +151,13 @@ public class HANDLER_BiomesOPlenty { if (aBopColouredLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1); if (aBlock != null) { colorizedLeaves1 = aBlock; } } if (aBopColouredLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2); if (aBlock != null) { colorizedLeaves2 = aBlock; } @@ -165,13 +165,13 @@ public class HANDLER_BiomesOPlenty { if (aBopSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopSapling); if (aBlock != null) { saplings = aBlock; } } if (aBopColouredSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling); if (aBlock != null) { colorizedSaplings = aBlock; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java index 5ebb2da8d4..d70afcb433 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity String[] aTooltip = new String[3]; aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; aTooltip[1] = "Draws in Air from the surrounding environment"; - aTooltip[2] = "Creates 5000L of Air every 4 ticks"; + aTooltip[2] = "Creates 8000L of Air every 4 ticks"; return aTooltip; } @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity @Override public int getAmountOfFluidToGenerate() { - return 5000; + return 8000; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java index 7579c8ec5a..d4b8b3a064 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -178,31 +178,29 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile return true; } - public boolean isAirInHatch() { - if (this.mFluid != null) { - if (getFluidToGenerate() == this.mFluid.getFluid()) { - return true; - } - } - return false; - } - public abstract boolean doesHatchMeetConditionsToGenerate(); public boolean addFluidToHatch(long aTick) { if (!doesHatchMeetConditionsToGenerate()) { return false; - } - boolean didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; - if (didFill) { - this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } + boolean didFill = false; + if (canTankBeFilled()) { + didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; + if (didFill) { + this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } } return didFill; } @Override public boolean canTankBeFilled() { - if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { + //Logger.INFO("Total Space: "+this.getCapacity()); + //Logger.INFO("Current capacity: "+this.getFluidAmount()); + //Logger.INFO("To add: "+this.getAmountOfFluidToGenerate()); + //Logger.INFO("Space Free: "+(this.getCapacity()-this.getFluidAmount())); + if (this.mFluid == null || (this.mFluid != null && (this.getCapacity() - this.getFluidAmount() >= this.getAmountOfFluidToGenerate()))) { return true; } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java index 5cd57e9e92..a2aa4d266c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -1,20 +1,32 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; +import java.lang.reflect.Field; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { + private static Class sClass_EIO; + private static Class sClass_RIO; + private static Field sField_EIO; + private static Field sField_RIO; + private static Block sBlock_EIO; + private static Block sBlock_RIO; + public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier); } @@ -56,11 +68,51 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F public int getCapacity() { return 128000; } + + private static void setCrossModData() { + if (LoadedMods.EnderIO && sClass_EIO == null) { + sClass_EIO = ReflectionUtils.getClass("crazypants.enderio.EnderIO"); + sField_EIO = ReflectionUtils.getField(sClass_EIO, "blockReservoir"); + sBlock_EIO = ReflectionUtils.getFieldValue(sField_EIO, null); + } + if (LoadedMods.RemoteIO && sClass_RIO == null) { + sClass_RIO = ReflectionUtils.getClass("remoteio.common.lib.ModBlocks"); + sField_RIO = ReflectionUtils.getField(sClass_RIO, "machine"); + sBlock_RIO = ReflectionUtils.getFieldValue(sField_RIO, null); + } + } + + public static boolean isTileValid(TileEntity aTile) { + if (aTile != null) { + if (aTile instanceof IFluidHandler) { + IFluidHandler aFluidHandler = (IFluidHandler) aTile; + return aFluidHandler.canDrain(ForgeDirection.UNKNOWN, FluidRegistry.WATER); + } + } + return false; + } @Override public boolean doesHatchMeetConditionsToGenerate() { Block aWater = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); - return aWater == Blocks.water || aWater == Blocks.flowing_water; + if (aWater != null && aWater != Blocks.air) { + if (!this.canTankBeFilled()) { + return false; + } + setCrossModData(); + if (LoadedMods.EnderIO) { + if (aWater == sBlock_EIO) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + if (LoadedMods.RemoteIO) { + if (aWater == sBlock_RIO && this.getBaseMetaTileEntity().getMetaIDAtSide(this.getBaseMetaTileEntity().getFrontFacing()) == 0) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + return aWater == Blocks.water || aWater == Blocks.flowing_water; + } + return false; } @Override -- cgit