diff --git a/build.gradle b/build.gradle index fe8a2e7be..b80893052 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1675110695 +//version: 1676031737 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -9,11 +9,15 @@ import com.diffplug.blowdryer.Blowdryer import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar +import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseRelation import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.VersionDependency +import cpw.mods.fml.relauncher.Side +import org.gradle.api.tasks.options.Option; import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutputFactory import org.jetbrains.gradle.ext.* @@ -23,6 +27,7 @@ import java.nio.file.Paths import java.util.concurrent.TimeUnit import java.util.zip.ZipEntry import java.util.zip.ZipOutputStream +import javax.inject.Inject buildscript { repositories { @@ -66,7 +71,7 @@ plugins { id 'com.diffplug.spotless' version '6.7.2' apply false id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.1.2' + id 'com.gtnewhorizons.retrofuturagradle' version '1.1.6' } boolean settingsupdated = verifySettingsGradle() settingsupdated = verifyGitAttributes() || settingsupdated @@ -186,11 +191,21 @@ configurations { } if (enableModernJavaSyntax.toBoolean()) { + repositories { + mavenCentral { + mavenContent { + includeGroup("me.eigenraven.java8unsupported") + } + } + } + dependencies { annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') { transitive = false // We only care about the 1 annotation class } + // Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937. + patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0') } tasks.withType(JavaCompile).configureEach { @@ -401,6 +416,16 @@ configurations.configureEach { } } } + def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE) + if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + // Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server + if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') { + details.useVersion '2388750' + details.because 'Pick obfuscated jar' + } + } + } } // Ensure tests have access to minecraft classes @@ -520,20 +545,20 @@ dependencies { 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('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.12:processor') if (usesMixinDebug.toBoolean()) { runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') } } if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { - implementation('com.gtnewhorizon:gtnhmixins:2.1.10') + implementation('com.gtnewhorizon:gtnhmixins:2.1.12') } } pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { if (usesMixins.toBoolean()) { dependencies { - kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') + kapt('com.gtnewhorizon:gtnhmixins:2.1.12:processor') } } } @@ -633,9 +658,142 @@ tasks.named("processResources", ProcessResources).configure { if (usesMixins.toBoolean()) { from refMap + dependsOn("compileJava", "compileScala") + } +} + +ext.java17Toolchain = (JavaToolchainSpec spec) -> { + spec.languageVersion.set(JavaLanguageVersion.of(17)) + spec.vendor.set(JvmVendorSpec.matching("jetbrains")) +} + +ext.java17DependenciesCfg = configurations.create("java17Dependencies") +ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") + +dependencies { + def lwjgl3ifyVersion = '1.1.21' + def asmVersion = '9.4' + if (modId != 'lwjgl3ify') { + java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") + } + if (modId != 'hodgepodge') { + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.0.31') + } + + java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false} + java17PatchDependencies("org.ow2.asm:asm:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}") + java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}") + java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1') + java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0") + java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") +} + +ext.java17JvmArgs = [ + // Java 9+ support + "--illegal-access=warn", + "-Dfile.encoding=UTF-8", + "-Djava.security.manager=allow", + "--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED", + "--add-opens", "java.base/java.net=ALL-UNNAMED", + "--add-opens", "java.base/java.nio=ALL-UNNAMED", + "--add-opens", "java.base/java.io=ALL-UNNAMED", + "--add-opens", "java.base/java.lang=ALL-UNNAMED", + "--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED", + "--add-opens", "java.base/java.text=ALL-UNNAMED", + "--add-opens", "java.base/java.util=ALL-UNNAMED", + "--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED", + "--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED", + "--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED", + "--add-modules", "jdk.dynalink", + "--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED", + "--add-modules", "java.sql.rowset", + "--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED" +] + +ext.hotswapJvmArgs = [ + // DCEVM advanced hot reload + "-XX:+AllowEnhancedClassRedefinition", + "-XX:HotswapAgent=fatjar" +] + +ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") { + group = "GTNH Buildscript" + description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory" + def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar' + def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")} + def targetFilename = "hotswap-agent.jar" + onlyIf { + !targetFolderProvider.get().file(targetFilename).asFile.exists() + } + doLast { + def targetFolder = targetFolderProvider.get() + targetFolder.asFile.mkdirs() + download.run { + src hsaUrl + dest targetFolder.file(targetFilename).asFile + overwrite false + tempAndMove true + } + } +} + +public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask { + // IntelliJ doesn't seem to allow commandline arguments so we also support an env variable + private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP")); + + @Input + public boolean getEnableHotswap() { return enableHotswap } + @Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger") + public boolean setEnableHotswap(boolean enable) { enableHotswap = enable } + + @Inject + public RunHotswappableMinecraftTask(Side side, String superTask) { + super(side) + + this.lwjglVersion = 3 + this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain) + this.extraJvmArgs.addAll(project.java17JvmArgs) + this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : [])) + + this.classpath(project.java17PatchDependenciesCfg) + if (side == Side.CLIENT) { + this.classpath(project.minecraftTasks.lwjgl3Configuration) + } + // Use a raw provider instead of map to not create a dependency on the task + this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath)) + this.classpath.filter { file -> + !file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2 + } + this.classpath(project.java17DependenciesCfg) + + if (!(project.usesMixins.toBoolean() || project.forceEnableMixins.toBoolean())) { + this.extraArgs.addAll("--tweakClass", "org.spongepowered.asm.launch.MixinTweaker") + } } } +def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Side.CLIENT, "runClient") +runClient17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStart" +} + +def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Side.SERVER, "runServer") +runServer17Task.configure { + setup(project) + group = "Modded Minecraft" + description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge" + dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar') + mainClass = "GradleStartServer" + extraArgs.add("nogui") +} + def getManifestAttributes() { def manifestAttributes = [:] if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { @@ -705,7 +863,7 @@ if (usesShadowedDependencies.toBoolean()) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } - for (runTask in ["runClient", "runServer"]) { + for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) { tasks.named(runTask).configure { dependsOn("shadowJar") } @@ -743,6 +901,7 @@ idea { module { downloadJavadoc = true downloadSources = true + inheritOutputDirs = true } project { settings { @@ -753,6 +912,20 @@ idea { "2. Run Server"(Gradle) { taskNames = ["runServer"] } + "1a. Run Client (Java 17)"(Gradle) { + taskNames = ["runClient17"] + } + "2a. Run Server (Java 17)"(Gradle) { + taskNames = ["runServer17"] + } + "1b. Run Client (Java 17, Hotswap)"(Gradle) { + taskNames = ["runClient17"] + envs = ["HOTSWAP": "true"] + } + "2b. Run Server (Java 17, Hotswap)"(Gradle) { + taskNames = ["runServer17"] + envs = ["HOTSWAP": "true"] + } "3. Run Obfuscated Client"(Gradle) { taskNames = ["runObfClient"] } diff --git a/dependencies.gradle b/dependencies.gradle index bdb0419fb..6e2108289 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -1,40 +1,43 @@ -// Add your dependencies here +/* + * Add your dependencies here. Supported configurations: + * - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod + * Available at runtime and compiletime for mods depending on this mod + * - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API + * Available at runtime but not compiletime for mods depending on this mod + * - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods + * Not available at all for mods depending on this mod, only visible at compiletime for this mod + * - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime + * Available at runtime for mods depending on this mod + * - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry + * - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main + * + * - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name + * Requires you to enable usesShadowedDependencies in gradle.properties + * + * - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient) + * + * You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed, + * but use this sparingly as it can break using your mod as another mod's dependency if you're not careful. + * + * For more details, see https://docs.gradle.org/7.6/userguide/java_library_plugin.html#sec:java_library_configurations_graph + */ dependencies { - - compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.41.242:dev") { - transitive = false - } + api("com.github.GTNewHorizons:waila:1.5.22:dev") + api("com.github.GTNewHorizons:CodeChickenLib:1.1.5.7:dev") + api("com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev") + + compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.41.242:dev") {transitive = false } - compileOnly("com.github.GTNewHorizons:Botania:1.9.14-GTNH:api") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:ForestryMC:4.5.6:api") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.1:dev") { - transitive = false - } - compile("com.github.GTNewHorizons:CodeChickenLib:1.1.5.7:dev") + compileOnly("com.github.GTNewHorizons:Botania:1.9.14-GTNH:api") {transitive = false } + compileOnly("com.github.GTNewHorizons:ForestryMC:4.5.6:api") {transitive = false } + compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.1:dev") {transitive = false } - compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.3.21-GTNH:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:Chisel:2.10.16-GTNH:api") { - transitive = false - } + compileOnly("com.github.GTNewHorizons:Chisel:2.10.16-GTNH:api") {transitive = false } - compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.9:dev") { - transitive = false - } + compileOnly("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH") {transitive = false } + compileOnly("com.github.GTNewHorizons:CraftTweaker:3.2.9:dev") {transitive = false } - compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { - transitive = false - } - compileOnly("curse.maven:guide-api-228832:2287185") { - transitive = false - } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") {transitive = false } + compileOnly("curse.maven:guide-api-228832:2287185") {transitive = false } } diff --git a/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java b/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java deleted file mode 100644 index a97a18bcf..000000000 --- a/src/api/java/pneumaticCraft/api/IHeatExchangerLogic.java +++ /dev/null @@ -1,84 +0,0 @@ -package pneumaticCraft.api; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * DO NOT IMPLEMENT THIS CLASS YOURSELF! Use PneumaticRegistry.getInstance().getHeatExchangerLogic() ! - * - * @author MineMaarten www.minemaarten.com - */ -public interface IHeatExchangerLogic { - - /** - * Call this to tick this logic, and make the heat disperse itself. - */ - public void update(); - - /** - * When called (preferably on tile entity load and neighbor block/tile entity change) this will add all - * IHeatExchanger neighbor TileEntities as connected heat exchangers. It will also take care of blocks like Lava. - * - * You don't _have_ to call this method, if this heat exchanger is not connected to the outside world (for example - * the heat of the liquid plastic in the Plastic Mixer). - * - * @param world - * @param x - * @param y - * @param z - * @param validSides Can be left out as vararg, meaning every side can be connected. When one or more sides are - * specified this will constrain this heat exchanger to only connect to other heat exchangers on - * these sides. - */ - public void initializeAsHull(World world, int x, int y, int z, ForgeDirection... validSides); - - /** - * When called, this will connect these two heat exchangers. You should only call this on one of the two heat - * exchangers. - * - * @param exchanger - */ - public void addConnectedExchanger(IHeatExchangerLogic exchanger); - - public void removeConnectedExchanger(IHeatExchangerLogic exchanger); - - /** - * A heat exchanger starts with 295 degrees Kelvin (20 degrees Celcius) by default. - * - * @param temperature in degrees Kelvin - */ - public void setTemperature(double temperature); - - public double getTemperature(); - - /** - * The higher the thermal resistance, the slower the heat disperses. - * - * @param thermalResistance By default it's 1. - */ - public void setThermalResistance(double thermalResistance); - - public double getThermalResistance(); - - /** - * The higher the capacity, the more heat can be 'stored'. This means that an object with a high capacity can heat - * up an object with a lower capacity without losing any significant amount of temperature. - * - * @param capacity - */ - public void setThermalCapacity(double capacity); - - public double getThermalCapacity(); - - public void writeToNBT(NBTTagCompound tag); - - public void readFromNBT(NBTTagCompound tag); - - /** - * Adds heat (= deltaT * Thermal Capacity) to this exchanger. negative values will remove heat. - * - * @param amount - */ - public void addHeat(double amount); -} diff --git a/src/api/java/pneumaticCraft/api/PneumaticRegistry.java b/src/api/java/pneumaticCraft/api/PneumaticRegistry.java deleted file mode 100644 index a140db9df..000000000 --- a/src/api/java/pneumaticCraft/api/PneumaticRegistry.java +++ /dev/null @@ -1,178 +0,0 @@ -package pneumaticCraft.api; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.fluids.Fluid; - -import pneumaticCraft.api.client.pneumaticHelmet.IBlockTrackEntry; -import pneumaticCraft.api.client.pneumaticHelmet.IEntityTrackEntry; -import pneumaticCraft.api.client.pneumaticHelmet.IHackableBlock; -import pneumaticCraft.api.client.pneumaticHelmet.IHackableEntity; -import pneumaticCraft.api.drone.ICustomBlockInteract; -import pneumaticCraft.api.drone.IPathfindHandler; -import pneumaticCraft.api.item.IInventoryItem; - -/** - * This class can be used to register and access various things to and from the mod. - */ -public class PneumaticRegistry { - - /** - * This field, which is initialized in PneumaticCraft's preInit, will give you access to various registration and - * access options. - * - * @deprecated This field isn't going to be removed, but it'll be marked private. use getInstance(). - */ - @Deprecated - public static IPneumaticCraftInterface instance; - - public static IPneumaticCraftInterface getInstance() { - return instance; - } - - public static void init(IPneumaticCraftInterface inter) { - if (instance == null) instance = inter; // only allow initialization once; by PneumaticCraft - } - - public static interface IPneumaticCraftInterface { - - /* - * ------------- Pneumatic Helmet -------------- - */ - - public void registerEntityTrackEntry(Class entry); - - public void registerBlockTrackEntry(IBlockTrackEntry entry); - - public void addHackable(Class entityClazz, Class iHackable); - - public void addHackable(Block block, Class iHackable); - - /** - * Returns a list of all current successful hacks of a given entity. This is used for example in Enderman - * hacking, so the user can only hack an enderman once (more times wouldn't have any effect). This is mostly - * used for display purposes. - * - * @param entity - * @return empty list if no hacks. - */ - public List getCurrentEntityHacks(Entity entity); - - /* - * ------------- Drones -------------- - */ - - /** - * Normally drones will pathfind through any block that doesn't have any collisions (Block#getBlocksMovement - * returns true). With this method you can register custom blocks to allow the drone to pathfind through them. - * If the block requires any special handling, like allow pathfinding on certain conditions, you can pass a - * IPathFindHandler with the registry. - * - * @param block - * @param handler can be null, to always allow pathfinding through this block. - */ - public void addPathfindableBlock(Block block, IPathfindHandler handler); - - /** - * This will add a puzzle piece that has only a Area white- and blacklist parameter (similar to a GoTo piece). - * It will do the specified behaviour. This can be used to create energy import/export widgets. - * - * @param interactor - */ - public void registerCustomBlockInteractor(ICustomBlockInteract interactor); - - /** - * Will spawn in a Drone a distance away from the given coordinate. The drone is programmed to travel to go to 5 - * blocks above the specified y level, and drop the deliveredStacks. When there isn't a clear path for the items - * to fall these 5 blocks the Drone will deliver at a y level above the specified y that _is_ clear. If no clear - * blocks can be found (when there are only solid blocks), the Drone will drop the items very high up in the air - * instead, and drop them there. - * - * When the Drone is tried to be catched by a player (by wrenching it), the drone will only the drop the items - * that it was delivering (or none if it dropped those items already). The Drone itself never will be dropped. - * - * @param x - * @param y - * @param z - * @param deliveredStacks stacks that are delivered by the drone. When no stacks, or more than 65 stacks are - * given, this will generate a IllegalArgumentException. - * @return the drone. You can use this to set a custom name for example (defaults to "Amazon Delivery Drone"). - */ - public EntityCreature deliverItemsAmazonStyle(World world, int x, int y, int z, ItemStack... deliveredStacks); - - /* - * --------------- Items ------------------- - */ - /** - * See {@link pneumaticCraft.api.item.IInventoryItem} - * - * @param handler - */ - public void registerInventoryItem(IInventoryItem handler); - - /* - * ----------------- Heat System -------------- - */ - public IHeatExchangerLogic getHeatExchangerLogic(); - - public void registerBlockExchanger(Block block, double temperature, double thermalResistance); - - /* - * ---------------- Power Generation ----------- - */ - - /** - * Adds a burnable liquid to the Liquid Compressor's available burnable fuels. - * - * @param fluid - * @param mLPerBucket the amount of mL generated for 1000mB of the fuel. As comparison, one piece of coal - * generates 16000mL in an Air Compressor. - */ - public void registerFuel(Fluid fluid, int mLPerBucket); - - /* - * --------------- Misc ------------------- - */ - - /** - * Returns the amount of Security Stations that disallow interaction with the given coordinate for the given - * player. Usually you'd disallow interaction when this returns > 0. - * - * @param world - * @param x - * @param y - * @param z - * @param player - * @param showRangeLines When true, any Security Station that prevents interaction will show the line grid - * (server --> client update is handled internally). - * @return The amount of Security Stations that disallow interaction for the given player. This method throws an - * IllegalArgumentException when tried to be called from the client side! - */ - public int getProtectingSecurityStations(World world, int x, int y, int z, EntityPlayer player, - boolean showRangeLines); - - /** - * Use this to register ISimpleBlockRenderHandler render id's of full blocks, those of which should be able to - * be used for the Pneumatic Door Base camouflage. - * - * @param id - */ - public void registerConcealableRenderId(int id); - - /** - * Used to register a liquid that represents liquid XP (like MFR mob essence, OpenBlocks liquid XP). This is - * used in the Aerial Interface to pump XP in/out of the player. - * - * @param fluid - * @param liquidToPointRatio The amount of liquid (in mB) used to get one XP point. In OpenBlocks this is 20 - * (mB/point). - */ - public void registerXPLiquid(Fluid fluid, int liquidToPointRatio); - } -} diff --git a/src/api/java/pneumaticCraft/api/actuator/IActuator.java b/src/api/java/pneumaticCraft/api/actuator/IActuator.java deleted file mode 100644 index edfdb8aae..000000000 --- a/src/api/java/pneumaticCraft/api/actuator/IActuator.java +++ /dev/null @@ -1,36 +0,0 @@ -package pneumaticCraft.api.actuator; - -import java.util.List; - -import net.minecraft.tileentity.TileEntity; - -public interface IActuator { - - /** - * Same as {@link pneumaticCraft.api.universalSensor.ISensorSetting#getSensorPath()} - * - * @return - */ - public String getSensorPath(); - - /** - * When returned true, the GUI will enable the textbox writing, otherwise not. - * - * @return - */ - public boolean needsTextBox(); - - /** - * Should return the description of this sensor displayed in the GUI stat. Information should at least include when - * this sensor emits redstone and how (analog (1 through 15), or digital). - * - * @return - */ - public List getDescription(); - - /** - * - * @param universalActuator - */ - public void actuate(TileEntity universalActuator); -} diff --git a/src/api/java/pneumaticCraft/api/block/BlockSupplier.java b/src/api/java/pneumaticCraft/api/block/BlockSupplier.java deleted file mode 100644 index 07489973d..000000000 --- a/src/api/java/pneumaticCraft/api/block/BlockSupplier.java +++ /dev/null @@ -1,34 +0,0 @@ -package pneumaticCraft.api.block; - -import net.minecraft.block.Block; - -import cpw.mods.fml.common.registry.GameRegistry; - -public class BlockSupplier { - // private static Class blockClass; - - /** - * @param blockName - * @return - */ - public static Block getBlock(String blockName) { - return GameRegistry.findBlock("PneumaticCraft", blockName); - /* - * try { if(blockClass == null) blockClass = Class.forName("pneumaticCraft.common.block.Blockss"); return - * (Block)blockClass.getField(blockName).get(null); } catch(Exception e) { - * System.err.println("[PneumaticCraft API] Block supply failed for block: " + blockName); return null; } - */ - } - - /* - * The following is a list of all the block names that can be passed as argument in getBlock(String) to get a - * PneumaticCraft block. pressureTube meta = tube type airCompressor airCannon pressureChamberWall meta < 6 ? wall : - * window pressureChamberValve pressureChamberInterface squidPlant fireFlower creeperPlant slimePlant rainPlant - * enderPlant lightningPlant adrenalinePlant burstPlant potionPlant repulsionPlant heliumPlant flyingFlower - * musicPlant propulsionPlant chopperPlant chargingStation elevatorBase elevatorFrame vacuumPump pneumaticDoorBase - * pneumaticDoor assemblyPlatform assemblyIOUnit assemblyDrill assemblyLaser assemblyController advancedPressureTube - * meta = tube type (like 'pressureTube') compressedIron uvLightBox etchingAcid securityStation universalSensor - * pneumaticGenerator electricCompressor pneumaticEngine kineticCompressor aerialInterface electrostaticCompressor - * aphorismTile omnidirectionalHopper - */ -} diff --git a/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java b/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java deleted file mode 100644 index 2d7793d96..000000000 --- a/src/api/java/pneumaticCraft/api/block/IPneumaticWrenchable.java +++ /dev/null @@ -1,14 +0,0 @@ -package pneumaticCraft.api.block; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -/** - * Should be implemented by any block that allows to be rotated by a Pneumatic Wrench. It uses almost the same rotate - * method as the Vanilla (Forge) method. However it uses energy to rotate (when rotateBlock() return true). - */ -public interface IPneumaticWrenchable { - - public boolean rotateBlock(World world, EntityPlayer player, int x, int y, int z, ForgeDirection side); -} diff --git a/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java b/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java deleted file mode 100644 index 9149d8011..000000000 --- a/src/api/java/pneumaticCraft/api/client/GuiAnimatedStatSupplier.java +++ /dev/null @@ -1,62 +0,0 @@ -package pneumaticCraft.api.client; - -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.item.ItemStack; - -/** - * With this class you can retrieve new instances of the PneumaticCraft's IGuiAnimatedStat implementation. You can use - * these in Gui's as well as anywhere you like. When you use these in Gui's you need to pass a valid GuiScreen instance, - * if you don't you can just pass null. - */ -public class GuiAnimatedStatSupplier { - - private static Class animatedStatClass; - - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, int backgroundColor) { - return getAnimatedStat(new Class[] { GuiScreen.class, int.class }, gui, backgroundColor); - } - - /** - * Returns a GuiAnimatedStat which uses an itemstack as static icon. - * - * @param gui - * @param iconStack - * @param backgroundColor - * @return - */ - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, ItemStack iconStack, int backgroundColor) { - return getAnimatedStat( - new Class[] { GuiScreen.class, int.class, ItemStack.class }, - gui, - backgroundColor, - iconStack); - } - - /** - * Returns a GuiAnimatedStat which uses a texture location as static icon. - * - * @param gui - * @param iconTexture / text - * @param backgroundColor - * @return - */ - public static IGuiAnimatedStat getAnimatedStat(GuiScreen gui, String iconTexture, int backgroundColor) { - return getAnimatedStat( - new Class[] { GuiScreen.class, int.class, String.class }, - gui, - backgroundColor, - iconTexture); - } - - private static IGuiAnimatedStat getAnimatedStat(Class[] constructorClasses, Object... constructorParameters) { - try { - if (animatedStatClass == null) - animatedStatClass = Class.forName("pneumaticCraft.client.gui.widget.GuiAnimatedStat"); - return (IGuiAnimatedStat) animatedStatClass.getConstructor(constructorClasses) - .newInstance(constructorParameters); - } catch (Exception e) { - System.err.println("Failed to retrieve an GuiAnimatedStat instance from PneumaticCraft."); - } - return null; - } -} diff --git a/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java b/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java deleted file mode 100644 index e288647d4..000000000 --- a/src/api/java/pneumaticCraft/api/client/GuiElementRenderer.java +++ /dev/null @@ -1,57 +0,0 @@ -package pneumaticCraft.api.client; - -import java.lang.reflect.Method; - -import net.minecraft.client.gui.FontRenderer; - -public class GuiElementRenderer { - - private static Method drawGaugeMethod; - - /** - * Draws a Pressure Gauge, the same which is also used in many PneumaticCraft applications. - * - * @param fontRenderer fontrenderer used to draw the numbers of the pressure gauge. - * @param minPressure The minimal pressure that needs to be displayed (this is -1 in most applications). - * @param maxPressure The maximal pressure that needs to be rendererd (this is 7 for tier one machines, and - * 25 for tier two). - * @param dangerPressure The transition pressure from green to red (this is 5 for tier one, and 29 for tier two - * machines). - * @param minWorkingPressure The transition pressure from yellow to green (variates per machine). - * @param currentPressure The pressure that the needle should point to. - * @param xPos x position of the gauge. - * @param yPos y position of the gauge. - * @param zLevel z position of the gauge (Gui#zLevel, -90, for in normal GUI's). - */ - public static void drawPressureGauge(FontRenderer fontRenderer, float minPressure, float maxPressure, - float dangerPressure, float minWorkingPressure, float currentPressure, int xPos, int yPos, float zLevel) { - try { - if (drawGaugeMethod == null) { - drawGaugeMethod = Class.forName("pneumaticCraft.client.gui.GuiUtils").getMethod( - "drawPressureGauge", - FontRenderer.class, - float.class, - float.class, - float.class, - float.class, - float.class, - int.class, - int.class, - float.class); - } - drawGaugeMethod.invoke( - null, - fontRenderer, - minPressure, - maxPressure, - dangerPressure, - minWorkingPressure, - currentPressure, - xPos, - yPos, - zLevel); - } catch (Exception e) { - System.err.println("Failed to render a Pressure Gauge from PneumaticCraft."); - } - } -} diff --git a/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java b/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java deleted file mode 100644 index 43ca6ba94..000000000 --- a/src/api/java/pneumaticCraft/api/client/IGuiAnimatedStat.java +++ /dev/null @@ -1,197 +0,0 @@ -package pneumaticCraft.api.client; - -import java.awt.Rectangle; -import java.util.List; - -/** - * This interface doesn't have to be implemented. In PneumaticCraft there already is one class which implements this - * interface which is used many times in PneumaticCraft (GUI stats, Pneumatic Helmet 2D and 3D stats). You can get an - * instance of this class as well. Information about this you can find in GuiAnimatedStatSupplier.java. Implementing - * your own version of animated stats can be implemented as well via this interface, and they will interact with the - * PneumaticCraft GuiAnimatedStats if you implement it correctly. - */ -public interface IGuiAnimatedStat { - - /** - * When you call this method with a set of coordinates representing the button location and dimensions, you'll get - * these parameters back scaled to the GuiAnimatedStat's scale. - * - * @param origX Button start X. - * @param origY Button start Y. - * @param width Button width. - * @param height Button height. - * @return rectangle containing the new location and dimensions. - */ - public Rectangle getButtonScaledRectangle(int origX, int origY, int width, int height); - - /** - * When passed 0.5F for example, the text of the stat will be half as big (so more text can fit into a certain - * area). - * - * @param scale - */ - public void scaleTextSize(float scale); - - /** - * Returns true if the statistic expands to the left. - * - * @return - */ - public boolean isLeftSided(); - - /** - * Returns true if the statistic is done with expanding (when text will be displayed). - * - * @return - */ - public boolean isDoneExpanding(); - - /** - * Pass true if the statistic should expand to the left, otherwise false. - * - * @param leftSided - */ - public void setLeftSided(boolean leftSided); - - /** - * Sets the main text of this stat. Every line should be stored in a seperate list element. Upon rendering, - * EnumChatFormattings will be respected. When you call this method, Too long lines will be divided into multiple - * shorter ones to fit in the GUI. - * - * @param text - * @return this, so you can chain calls. - */ - public IGuiAnimatedStat setText(List text); - - /** - * Sets the line to a single line. Upon rendering, EnumChatFormattings will be respected. When you call this method, - * Too long lines will be divided into multiple shorter ones to fit in the GUI. - * - * @param text - * @return this, so you can chain calls. - */ - public IGuiAnimatedStat setText(String text); - - /** - * Sets the main text of this stat. Every line should be stored in a seperate list element. Upon rendering, - * EnumChatFormattings will be respected. This version of the text setting doesn't handle too long lines. - * - * @param text - */ - public void setTextWithoutCuttingString(List text); - - /** - * Sets the title of this stat. It will automatically get the yellow color assigned. - * - * @param title - */ - public void setTitle(String title); - - /** - * Returns the title of this stat (obviously without color prefix). - * - * @return - */ - public String getTitle(); - - /** - * Defines what dimensions the stat should have when it is not expanded (default 17x17) and resets the stat to these - * dimensions. Used in PneumaticCraft by the block/entity tracker stats, they are 0x0 when not expanded so it looks - * like they expand (and appear) from nothing. - * - * @param minWidth - * @param minHeight - */ - public void setMinDimensionsAndReset(int minWidth, int minHeight); - - /** - * When this stat gets a parent stat assigned, the y of this stat will be the same as the parent's plus this stat's - * baseY. This will cause this stat to move up and down when the parent's stat expands/moves. - * - * @param stat - */ - public void setParentStat(IGuiAnimatedStat stat); - - /** - * Sets the x location of this stat. - * - * @param x - */ - public void setBaseX(int x); - - /** - * Sets the base Y of this stat. - * - * @param y - */ - public void setBaseY(int y); - - /** - * Returns the real Y of this stat. This is the same as getBaseY when there is no parent stat, but if there is this - * method returns the value described in setParentStat(IGuiAnimatedStat stat). - * - * @return - */ - public int getAffectedY(); - - public int getBaseX(); - - public int getBaseY(); - - /** - * Returns the Y size of this stat. - * - * @return - */ - public int getHeight(); - - /** - * Returns the X size of this stat. - * - * @return - */ - public int getWidth(); - - public Rectangle getBounds(); - - /** - * This method should be called every game tick to update the logic of the stat (expanding of the stat). - */ - public void update(); - - /** - * Should be called every render tick when and where you want to render the stat. - * - * @param mouseX - * @param mouseY - * @param partialTicks - */ - public void render(int mouseX, int mouseY, float partialTicks); - - /** - * This method will handle mouse clicks. This will handle open/closing of the stat when the mouse clicks it. - * - * @param x - * @param y - * @param button - * @return - */ - public void onMouseClicked(int x, int y, int button); - - /** - * Forces the stat to close. - */ - public void closeWindow(); - - /** - * Forces the stat to expand. - */ - public void openWindow(); - - /** - * Returns true if the stat is expanding. - * - * @return - */ - public boolean isClicked(); -} diff --git a/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java b/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java deleted file mode 100644 index f0d0f06f1..000000000 --- a/src/api/java/pneumaticCraft/api/client/assemblymachine/AssemblyRenderOverriding.java +++ /dev/null @@ -1,60 +0,0 @@ -package pneumaticCraft.api.client.assemblymachine; - -import java.util.HashMap; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class AssemblyRenderOverriding { - - public static final HashMap renderOverrides = new HashMap(); - - public static void addRenderOverride(Block block, IAssemblyRenderOverriding renderOverride) { - renderOverrides.put(Block.getIdFromBlock(block), renderOverride); - } - - public static void addRenderOverride(Item item, IAssemblyRenderOverriding renderOverride) { - renderOverrides.put(Item.getIdFromItem(item), renderOverride); - } - - public static interface IAssemblyRenderOverriding { - - /** - * This method will be called just before the IO Unit's held stack is being rendered. You can insert GL11 calls - * here to rotate the model for example. push and pop matrices are not needed, this is done for you. You can - * also choose to do the whole rendering yourself, you'll need to return false then to indicate that - * PneumaticCraft shouldn't render the item. - * - * @param renderedStack itemStack that is being rendered - * @return true if PneumaticCraft should render the item (after your changes), or false to cancel rendering. - */ - public boolean applyRenderChangeIOUnit(ItemStack renderedStack); - - /** - * Same deal as with the applyRenderChangeIOUnit(), but now for the Assembly Platform. - * - * @param renderedStack itemStack that is being rendered - * @return true if PneumaticCraft should render the item (after your changes), or false to cancel rendering. - */ - public boolean applyRenderChangePlatform(ItemStack renderedStack); - - /** - * Should return the distance the claw travels before it is gripped to the stack. By default it's 0.0875F for - * items and 0.00625F for blocks, 0.09375 when the claw is completely closed. - * - * @param renderedStack - * @return - */ - public float getIOUnitClawShift(ItemStack renderedStack); - - /** - * Should return the distance the claw travels before it is gripped to the stack. By default it's 0.0875F for - * items and 0.00625F for blocks, 0.09375 when the claw is completely closed. - * - * @param renderedStack - * @return - */ - public float getPlatformClawShift(ItemStack renderedStack); - } -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java deleted file mode 100644 index 4df4033f5..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IBlockTrackEntry.java +++ /dev/null @@ -1,66 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -public interface IBlockTrackEntry { - - /** - * This method should return true if the coordinate checked is one that should be tracked. Most entries will just - * return true when the blockID is the one that they track. - * - * @param world The world that is examined. - * @param x The x coordinate of the block examined. - * @param y The y coordinate of the block examined. - * @param z The z coordinate of the block examined. - * @param block The block of the current coordinate. This will save you a call to World.getBlock(). - * @param te The TileEntity at this x,y,z. - * @return true if the coordinate should be tracked by this BlockTrackEntry. - */ - public boolean shouldTrackWithThisEntry(IBlockAccess world, int x, int y, int z, Block block, TileEntity te); - - /** - * This method defines if the block should be updated by the server (each 5 seconds). This is specifically aimed at - * Tile Entities, as the server will send an NBT packet. This method returns true at for instance Chests and Mob - * Spawners, to get the inventory at the client side and the time to the next spawn respectively. - * - * @param te The TileEntity at the currently checked location. - * - * @return true if the Tile Entity should be updated, or false when it doesn't have to. - */ - public boolean shouldBeUpdatedFromServer(TileEntity te); - - /** - * The return of this method defines at how many tracked blocks of this type the HUD should stop displaying text at - * the tracked blocks of this type. - * - * @return amount of blocks the HUD should stop displaying the block info. - */ - public int spamThreshold(); - - /** - * This method is called each render tick to retrieve the blocks additional information. The method behaves the same - * as the addInformation method in the Item class. This method only will be called if shouldTrackWithThisEntry() - * returned true and the player hovers over the coordinate. - * - * @param world The world the block is in. - * @param x The x coordinate the block is at. - * @param y The y coordinate the block is at. - * @param z The z coordinate the block is at. - * @param te The TileEntity at the x,y,z. - * @param infoList The list of lines to display. - */ - public void addInformation(World world, int x, int y, int z, TileEntity te, List infoList); - - /** - * This method is called when displaying the currently tracked blocks. Will be tried to be mapped to the - * localization file first. - * - * @return the name of the group of this entry. - */ - public String getEntryName(); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java deleted file mode 100644 index 4369134af..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IEntityTrackEntry.java +++ /dev/null @@ -1,56 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -import net.minecraft.entity.Entity; - -/** - * Implement this class and register it by adding it to the entityTrackEntries class. There needs to be a parameterless - * constructor. For every entity that's applicable for this definition, an instance is created. - */ -public interface IEntityTrackEntry { - - /** - * Return true if you want to add a tooltip for the given entity. - * - * @param entity - * @return - */ - public boolean isApplicable(Entity entity); - - /** - * Add info to the tab. This is only called when isApplicable returned true. - * - * @param entity - * @param curInfo - */ - public void addInfo(Entity entity, List curInfo); - - /** - * Update is called every (client) tick, and can be used to update something like a timer (used for the Creeper - * countdown). - * - * @param entity - */ - public void update(Entity entity); - - /** - * Called every render tick, this method can be used to render additional info. Used for Drone AI visualisation. - * - * @param entity - * @param partialTicks TODO - */ - public void render(Entity entity, float partialTicks); - - /** - * Just a basic implementation class that can be used if an update and render method isn't needed. - */ - public abstract static class EntityTrackEntry implements IEntityTrackEntry { - - @Override - public void update(Entity entity) {} - - @Override - public void render(Entity entity, float partialTicks) {} - } -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java deleted file mode 100644 index 80c99576f..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IGuiScreen.java +++ /dev/null @@ -1,16 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; - -/** - * Just an interface to give access to GuiSreen#buttonList and GuiScreen#fontRenderer. An instance of this class can - * safely be casted to GuiSreen if needed. - */ -public interface IGuiScreen { - - public List getButtonList(); - - public FontRenderer getFontRenderer(); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java deleted file mode 100644 index e7578949c..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableBlock.java +++ /dev/null @@ -1,76 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -/** - * Use this interface to specify any hackable block. When it's your block, you can simply implement this interface in - * the block's class. If you don't have access to the class (vanilla blocks), you can implement this interface in a - * separate class and register it using PneumaticRegistry.registry.addHackable(blockClass, IHackableBlockClass). With - * the former way there will be one instance only per type. In the latter, there will be an IHackableBlock instance for - * every block. - */ -public interface IHackableBlock { - - /** - * Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime - * after a server restart. Null is a valid return: afterHackTick will not be triggered at all in that case. - * - * CURRENTLY THIS ISN'T IMPLEMENTED. - * - * @return - */ - public String getId(); - - /** - * Returning true will allow the player to hack this block. This can be used to only allow hacking on certain - * conditions. - */ - public boolean canHack(IBlockAccess world, int x, int y, int z, EntityPlayer player); - - /** - * Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. This method is - * only called when canHack(World, int, int, int) returned true. The added lines automatically will be tried to get - * localized. - */ - public void addInfo(World world, int x, int y, int z, List curInfo, EntityPlayer player); - - /** - * Add info that is being displayed after hacking, as long as 'afterHackTick' is returning true. Things like - * "Neutralized". The added lines automatically will be tried to get localized. - * - * @param entity - * @param curInfo - * @param player - */ - public void addPostHackInfo(World world, int x, int y, int z, List curInfo, EntityPlayer player); - - /** - * Return the time it takes to hack this block in ticks. For more powerful hacks, a longer required hacking time is - * adviced. - */ - public int getHackTime(IBlockAccess world, int x, int y, int z, EntityPlayer player); - - /** - * When the player hacked the block for getHackTime(World, int, int, int) ticks this will be called on both server - * and client side. - */ - public void onHackFinished(World world, int x, int y, int z, EntityPlayer player); - - /** - * Called every tick after the hacking finished (on both server and client side). Returning true will keep this - * going (for mob spawners, to keep them neutralized), or false to stop ticking (for door/lever hacking). - * - * CURRENTLY THIS METHOD WILL STOP GETTING INVOKED AFTER A SERVER RESTART! - * - * @param world - * @param x - * @param y - * @param z - * @return - */ - public boolean afterHackTick(World world, int x, int y, int z); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java deleted file mode 100644 index b2fee4458..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IHackableEntity.java +++ /dev/null @@ -1,63 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; - -/** - * Use this interface to specify any hackable entity. When it's your entity, you can simply implement this interface in - * the entity's class. If you don't have access to the class (vanilla entities), you can implement this interface in a - * separate class and register it using PneumaticRegistry.registry.addHackable(entityClass, IHackableEntityClass). In - * both ways there will be an IHackableEntity instance for every entity. - */ -public interface IHackableEntity { - - /** - * Should return a unique id to represent this hackable. Used in NBT saving to be able to trigger the afterHackTime - * after a server restart. Null is a valid return: afterHackTick will not be triggered at all in that case. - * - * @return - */ - public String getId(); - - /** - * Returning true will allow the player to hack this entity. This can be used to only allow hacking on certain - * conditions. - */ - public boolean canHack(Entity entity, EntityPlayer player); - - /** - * Add info that is displayed on the tracker tooltip here. Text like "Hack to explode" can be added. This method is - * only called when canHack(Entity) returned true. The added lines automatically will be tried to get localized. - */ - public void addInfo(Entity entity, List curInfo, EntityPlayer player); - - /** - * Add info that is being displayed after hacking, as long as 'afterHackTick' is returning true. Things like - * "Neutralized". The added lines automatically will be tried to get localized. - * - * @param entity - * @param curInfo - * @param player - */ - public void addPostHackInfo(Entity entity, List curInfo, EntityPlayer player); - - /** - * Return the time it takes to hack this entity in ticks. For more powerful hacks, a longer required hacking time is - * adviced. - */ - public int getHackTime(Entity entity, EntityPlayer player); - - /** - * When the player hacked the entity for getHackTime(Entity) ticks this will be called on both client and server - * side. - */ - public void onHackFinished(Entity entity, EntityPlayer player); - - /** - * Called every tick after the hacking finished. Returning true will keep this going (for mob spawners, to keep them - * neutralized), or false to stop ticking (for door/lever hacking). - */ - public boolean afterHackTick(Entity entity); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java deleted file mode 100644 index f49328116..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IOptionPage.java +++ /dev/null @@ -1,50 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; - -/** - * The Option Page is the page you see when you press 'F' (by default) with a Pneumatic Helmet equipped. You can - * register this class by returning a new instance of this class at {@link IUpgradeRenderHandler#getGuiOptionsPage()} - */ -public interface IOptionPage { - - /** - * This string is used in the text of the button of this page. - * - * @return - */ - public String getPageName(); - - /** - * Here you can initialize your buttons and stuff like with a GuiScreen. For buttons, don't use button id 100 and - * up, as they will be used as selection buttons for other option pages in the main GuiScreen. - * - * @param gui - */ - public void initGui(IGuiScreen gui); - - /** - * Same as GuiScreen#actionPerformed(GuiButton). - * - * @param button - */ - public void actionPerformed(GuiButton button); - - /** - * Same as {@link GuiScreen#drawScreen(int, int, float)} Here you can render additional things like text. - * - * @param x - * @param y - * @param partialTicks - */ - public void drawScreen(int x, int y, float partialTicks); - - /** - * Same as GuiScreen#keyTyped(char, int). - * - * @param ch - * @param key - */ - public void keyTyped(char ch, int key); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java deleted file mode 100644 index 4e0ea28f8..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/IUpgradeRenderHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.config.Configuration; - -import pneumaticCraft.api.client.IGuiAnimatedStat; - -/** - * To add upgrades for in the Pneumatic Helmet implement this interface. You can add members to this class, however - * these can only be client sided members as this class will be used as singleton. Therefore, only one of these - * instances exist at the server side so any member that is used server side will affect every player. - * - */ -public interface IUpgradeRenderHandler { - - /** - * Return here the name of the upgrade. This is displayed in the formatting [upgradeName] + " " + "found"/"not - * found" on initialization of the helmet. - * - * @return - */ - public String getUpgradeName(); - - /** - * Being called from PneumaticCraft's config handler, you can use this method to read settings like stat positions - * - * @param config PneumaticCraft's config file. - */ - public void initConfig(Configuration config); - - /** - * When called this should save the settings to the config file. Called when changed a setting. When you want to use - * PneumaticCraft's config file, save a reference of it somewhere in this class when the config gets passed in the - * initConfig() method (this always will be called first). - */ - public void saveToConfig(); - - /** - * This method will be called every client tick, and should be used to update logic like the tracking and velocities - * of stuff. - * - * @param player - * @param rangeUpgrades amount of range upgrades installed in the helmet. - */ - public void update(EntityPlayer player, int rangeUpgrades); - - /** - * Called in the 3D render stage (renderWorldLastEvent) - * - * @param partialTicks - */ - public void render3D(float partialTicks); - - /** - * Called in the 2D render stage (Render Tick Handler) - * - * @param partialTicks - * @param helmetEnabled is true when isEnabled() returned true earlier. Can be used to close AnimatedStats for - * instance. However this is already handled if you return an AnimatedStat in - * getAnimatedStat(). - */ - public void render2D(float partialTicks, boolean helmetEnabled); - - /** - * You can return a GuiAnimatedStat here, that the HUDHandler will pick up and render. It also automatically opens - * and closes the stat when needed. The GuiMoveStat uses this method to retrieve the to be moved stat. - * - * @return null if no stat used. - */ - public IGuiAnimatedStat getAnimatedStat(); - - /** - * Should return true if this upgrade handler is enabled for the given stacks placed in the helmet. - * - * @param upgradeStacks - * @return - */ - public boolean isEnabled(ItemStack[] upgradeStacks); - - /** - * Returns the usage in mL/tick when this upgrade handler is enabled. - * - * @param rangeUpgrades amount of range upgrades installed in the helmet. - * @param player - * @return usage in mL/tick - */ - public float getEnergyUsage(int rangeUpgrades, EntityPlayer player); - - /** - * Called when (re-)equipped the helmet this method should be used to clear information like current tracked - * entities. So clearing lists and other references as this handler should re-acquire when reinstalled. - */ - public void reset(); - - /** - * When you have some options for your upgrade handler you could return a new instance of an IOptionsPage. When you - * do so, it will automatically get picked up by the options handler, and it will be added to the options GUI when - * this upgrade returns true when calling isEnabled(). Returning null is valid. - * - * @return - */ - public IOptionPage getGuiOptionsPage(); -} diff --git a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java b/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java deleted file mode 100644 index c9b819d57..000000000 --- a/src/api/java/pneumaticCraft/api/client/pneumaticHelmet/RenderHandlerRegistry.java +++ /dev/null @@ -1,12 +0,0 @@ -package pneumaticCraft.api.client.pneumaticHelmet; - -import java.util.List; - -public class RenderHandlerRegistry { - - /** - * With this field you can register your render handlers. This field is initialized in the PreInit phase of - * PneumaticCraft's loading phase. - */ - public static List renderHandlers; -} diff --git a/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java b/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java deleted file mode 100644 index db0ec3055..000000000 --- a/src/api/java/pneumaticCraft/api/drone/DroneConstructingEvent.java +++ /dev/null @@ -1,12 +0,0 @@ -package pneumaticCraft.api.drone; - -import cpw.mods.fml.common.eventhandler.Event; - -public class DroneConstructingEvent extends Event { - - public IDrone drone; - - public DroneConstructingEvent(IDrone drone) { - this.drone = drone; - } -} diff --git a/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java b/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java deleted file mode 100644 index d27318304..000000000 --- a/src/api/java/pneumaticCraft/api/drone/IBlockInteractHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package pneumaticCraft.api.drone; - -/** - * DON'T IMPLEMENT, just use - */ -public interface IBlockInteractHandler { - - /** - * Returns a boolean[6] of all sides. when true, this side is accessible - * - * @return - */ - public boolean[] getSides(); - - public boolean useCount(); - - public void decreaseCount(int count); - - public int getRemainingCount(); - - /** - * When invoked, the drone will abort searching the area. Could be used to abort early when full of RF energy for - * example, when importing RF. (It's useless to search any further) - */ - public void abort(); -} diff --git a/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java b/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java deleted file mode 100644 index 38f819057..000000000 --- a/src/api/java/pneumaticCraft/api/drone/ICustomBlockInteract.java +++ /dev/null @@ -1,54 +0,0 @@ -package pneumaticCraft.api.drone; - -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.ChunkPosition; - -/** - * Implement this and register it to PneumaticRegistry.registerCustomBlockInteractor(). This will add a puzzle piece - * that has only a Area white- and blacklist parameter (similar to a GoTo piece). It will do the specified behaviour. - * This can be used to create energy import/export widgets. - */ -public interface ICustomBlockInteract { - - /** - * Should return a unique Id, used in NBT saving and localization. - */ - public String getName(); - - /** - * Should return the puzzle piece texture. Should be a multiple of 80x64 (width x height). I'd recommend starting - * out with copying the Go To widget texture. - * - * @return - */ - public ResourceLocation getTexture(); - - /** - * The actual interaction. - * - * For every position in the selected area the drone will visit every block (ordered from closest to furthest). It - * will call this method with 'simulate = true'. If this method returns true, the drone will navigate to this - * location, and call this method again with 'simulate = false' It will keep doing this until this method returns - * false. - * - * When interactHandler.useCount() returns true: In the interface of the puzzle piece users can specify a 'use - * count' and fill in the maximum count they want to use. When not simulating, you should only import/export up to - * interactHandler.getRemainingCount(), and you should notify the removed/added count by doing - * interactHandler.decreaseCount(int count). - * - * @param pos current visited location - * @param drone - * @param interactHandler object you can use to use to get accessible sides and give feedback about counts. - * @param simulate will be true when trying to figure out whether or not the drone should navigate to this - * block, false when next to this block. - * @return - */ - public boolean doInteract(ChunkPosition pos, IDrone drone, IBlockInteractHandler interactHandler, boolean simulate); - - /** - * Used for crafting, categorizes the puzzle piece. - * - * @return - */ - public int getCraftingColorIndex(); -} diff --git a/src/api/java/pneumaticCraft/api/drone/IDrone.java b/src/api/java/pneumaticCraft/api/drone/IDrone.java deleted file mode 100644 index 156833f38..000000000 --- a/src/api/java/pneumaticCraft/api/drone/IDrone.java +++ /dev/null @@ -1,63 +0,0 @@ -package pneumaticCraft.api.drone; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.ai.EntityAITasks; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; -import net.minecraftforge.common.IExtendedEntityProperties; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.IFluidTank; - -import pneumaticCraft.api.item.IPressurizable; - -public interface IDrone extends IPressurizable { - - /** - * - * @param upgradeIndex metadata value of the upgrade item - * @return amount of inserted upgrades in the drone - */ - public int getUpgrades(int upgradeIndex); - - public World getWorld(); - - public IFluidTank getTank(); - - public IInventory getInventory(); - - public Vec3 getPosition(); - - public IPathNavigator getPathNavigator(); - - public void sendWireframeToClient(int x, int y, int z); - - public EntityPlayerMP getFakePlayer(); - - public boolean isBlockValidPathfindBlock(int x, int y, int z); - - public void dropItem(ItemStack stack); - - public void setDugBlock(int x, int y, int z); - - public EntityAITasks getTargetAI(); - - public IExtendedEntityProperties getProperty(String key); - - public void setProperty(String key, IExtendedEntityProperties property); - - public void setEmittingRedstone(ForgeDirection orientation, int emittingRedstone); - - public void setName(String string); - - public void setCarryingEntity(Entity entity); - - public Entity getCarryingEntity(); - - public boolean isAIOverriden(); - - public void onItemPickupEvent(EntityItem curPickingUpEntity, int stackSize); -} diff --git a/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java b/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java deleted file mode 100644 index ecfa399ff..000000000 --- a/src/api/java/pneumaticCraft/api/drone/IPathNavigator.java +++ /dev/null @@ -1,12 +0,0 @@ -package pneumaticCraft.api.drone; - -import net.minecraft.entity.Entity; - -public interface IPathNavigator { - - public boolean moveToXYZ(double x, double y, double z); - - public boolean moveToEntity(Entity entity); - - public boolean hasNoPath(); -} diff --git a/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java b/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java deleted file mode 100644 index 032c7e62f..000000000 --- a/src/api/java/pneumaticCraft/api/drone/IPathfindHandler.java +++ /dev/null @@ -1,28 +0,0 @@ -package pneumaticCraft.api.drone; - -import net.minecraft.world.World; - -public interface IPathfindHandler { - - /** - * When returned true, the drone can pathfind through this block. When false it can't. - * - * @param world - * @param x - * @param y - * @param z - * @return - */ - public boolean canPathfindThrough(World world, int x, int y, int z); - - /** - * CURRENTLY NOT IMPLEMENTED! Will be called every tick as long as the drone is < 1 block away from the given - * coordinate. can be used to open a door for a drone for example. - * - * @param world - * @param x - * @param y - * @param z - */ - public void onPathingThrough(World world, int x, int y, int z); -} diff --git a/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java b/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java deleted file mode 100644 index befefebc6..000000000 --- a/src/api/java/pneumaticCraft/api/drone/SpecialVariableRetrievalEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -package pneumaticCraft.api.drone; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.ChunkPosition; - -import cpw.mods.fml.common.eventhandler.Event; - -/** - * Fired when a Drone is trying to get a special coordinate, by accessing a variable with '$' prefix. These event are - * posted on the MinecraftForge.EVENT_BUS. - */ -public abstract class SpecialVariableRetrievalEvent extends Event { - - /** - * The special variable name, with the '$' stripped away. - */ - public final String specialVarName; - - /** - * The returning coordinate - */ - public SpecialVariableRetrievalEvent(String specialVarName) { - - this.specialVarName = specialVarName; - } - - public abstract static class CoordinateVariable extends SpecialVariableRetrievalEvent { - - public ChunkPosition coordinate; - - public CoordinateVariable(String specialVarName) { - super(specialVarName); - } - - public static class Drone extends CoordinateVariable { - - public final IDrone drone; - - public Drone(IDrone drone, String specialVarName) { - super(specialVarName); - this.drone = drone; - } - } - } - - public abstract static class ItemVariable extends SpecialVariableRetrievalEvent { - - public ItemStack item; - - public ItemVariable(String specialVarName) { - super(specialVarName); - } - - public static class Drone extends ItemVariable { - - public final IDrone drone; - - public Drone(IDrone drone, String specialVarName) { - super(specialVarName); - this.drone = drone; - } - } - } -} diff --git a/src/api/java/pneumaticCraft/api/item/IInventoryItem.java b/src/api/java/pneumaticCraft/api/item/IInventoryItem.java deleted file mode 100644 index 6f70e1c29..000000000 --- a/src/api/java/pneumaticCraft/api/item/IInventoryItem.java +++ /dev/null @@ -1,21 +0,0 @@ -package pneumaticCraft.api.item; - -import java.util.List; - -import net.minecraft.item.ItemStack; - -/** - * Implement this interface for your items that have an inventory. When you don't have access to the item, just create - * any old class that implements this interface and register an instance of it in PneumaticRegistry. This will then will - * be used in the Pneumatic Helmet's item search. - * - */ -public interface IInventoryItem { - - /** - * @parm stack: Item that potentially has an inventory. - * @parm curStacks: List of all currently added stacks for this item. Add more stacks in here in your implementation - * when found the right item. - */ - public void getStacksInItem(ItemStack stack, List curStacks); -} diff --git a/src/api/java/pneumaticCraft/api/item/IPressurizable.java b/src/api/java/pneumaticCraft/api/item/IPressurizable.java deleted file mode 100644 index 9fe8301a9..000000000 --- a/src/api/java/pneumaticCraft/api/item/IPressurizable.java +++ /dev/null @@ -1,35 +0,0 @@ -package pneumaticCraft.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Any item implementing this interface will be able to (dis)charge in a Charging Station. - */ -public interface IPressurizable { - - /** - * This method should return the current pressure of the ItemStack given. - * - * @param iStack Stack the pressure is asked from. - * @return Pressure in bar. - */ - public float getPressure(ItemStack iStack); - - /** - * this method is used to charge or discharge a pneumatic item. when the value is negative the item should be - * discharging - * - * @param iStack the ItemStack which has to be (dis)charged. - * @param amount amount in mL that the item is (dis)charging. - */ - public void addAir(ItemStack iStack, int amount); - - /** - * This method should return the maximum pressure of a pneumatic item. If it has reached this maximum, it won't - * explode, but it wouldn't (try to) charge either. - * - * @param iStack the stack from which the maximum pressure is asked. - * @return maximum pressure in bar. - */ - public float maxPressure(ItemStack iStack); -} diff --git a/src/api/java/pneumaticCraft/api/item/IProgrammable.java b/src/api/java/pneumaticCraft/api/item/IProgrammable.java deleted file mode 100644 index 259a22e32..000000000 --- a/src/api/java/pneumaticCraft/api/item/IProgrammable.java +++ /dev/null @@ -1,37 +0,0 @@ -package pneumaticCraft.api.item; - -import net.minecraft.item.ItemStack; - -/** - * Implement this for items that can get programmed in a Programmer. For now the only thing you can do with this is make - * program storages, later more interaction with programming puzzles is planned. Puzzle pieces will be written onto the - * implementer's itemstack NBT, using the "progWidget" tag. - */ -public interface IProgrammable { - - /** - * When returned true, this stack is allowed to be programmed. Used to allow certain damage values to be programmed - * while others can't. - * - * @param stack - * @return - */ - public boolean canProgram(ItemStack stack); - - /** - * When returned true, Programming Puzzles are needed to program this item. When returned false, it's free to - * program. Drones and Network API's return true in PneumaticCraft, Network Storages return false. - * - * @param stack - * @return - */ - public boolean usesPieces(ItemStack stack); - - /** - * When returned true, the implementing item will get a tooltip added of the summary of puzzles used in the stored - * program. - * - * @return - */ - public boolean showProgramTooltip(); -} diff --git a/src/api/java/pneumaticCraft/api/item/ItemSupplier.java b/src/api/java/pneumaticCraft/api/item/ItemSupplier.java deleted file mode 100644 index e80931653..000000000 --- a/src/api/java/pneumaticCraft/api/item/ItemSupplier.java +++ /dev/null @@ -1,25 +0,0 @@ -package pneumaticCraft.api.item; - -import net.minecraft.item.Item; - -import cpw.mods.fml.common.registry.GameRegistry; - -public class ItemSupplier { - - public static Item getItem(String itemName) { - return GameRegistry.findItem("PneumaticCraft", itemName); - } - - /* - * The following is a list of all the item names that can be passed as argument in getItem(String) to get a - * PneumaticCraft item. GPSTool Currently tracked coordinated is stored in NBT, with 'x', 'y', 'z' being the tag - * names for the x,y and z positions respectively. machineUpgrade damage value = upgrade type. ingotIronCompressed - * pressureGauge stoneBase cannonBarrel turbineBlade plasticPlant damage value = plant type. Mapped the same as - * Vanilla dye in terms of color. plastic damage value = plastic type. Mapped the same as Vanilla dye in terms of - * color. airCanister implements IPressurizable vortexCannon implements IPressurizable pneumaticCylinder - * pneumaticHelmet implements IPressurizable manometer implements IPressurizable turbineRotor assemblyProgram damage - * value = program type. emptyPCB unassembledPCB PCBBlueprint bucketEtchingAcid transistor capacitor - * printedCircuitBoard failedPCB networkComponent damage value = network component type. stopWorm nukeVirus - * compressedIronGear pneumaticWrench implements IPressurizable - */ -} diff --git a/src/api/java/pneumaticCraft/api/package-info.java b/src/api/java/pneumaticCraft/api/package-info.java deleted file mode 100644 index c037fe267..000000000 --- a/src/api/java/pneumaticCraft/api/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -@API(apiVersion = "1.0", owner = "PneumaticCraft", provides = "PneumaticCraftApi") -package pneumaticCraft.api; - -import cpw.mods.fml.common.API; diff --git a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java deleted file mode 100644 index 66bcf228b..000000000 --- a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java +++ /dev/null @@ -1,49 +0,0 @@ -package pneumaticCraft.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; - -public class AssemblyRecipe { - - public static List drillRecipes = new ArrayList(); - public static List laserRecipes = new ArrayList(); - public static List drillLaserRecipes = new ArrayList(); - - private final ItemStack input; - private final ItemStack output; - - public AssemblyRecipe(ItemStack input, ItemStack output) { - this.input = input; - this.output = output; - } - - public ItemStack getInput() { - return input; - } - - public ItemStack getOutput() { - return output; - } - - public static void addDrillRecipe(Object input, Object output) { - drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); - } - - public static void addLaserRecipe(Object input, Object output) { - laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); - } - - private static ItemStack getStackFromObject(Object object) { - if (object instanceof Block) { - return new ItemStack((Block) object); - } else if (object instanceof Item) { - return new ItemStack((Item) object); - } else { - return (ItemStack) object; - } - } -} diff --git a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java deleted file mode 100644 index ee9dc2caa..000000000 --- a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java +++ /dev/null @@ -1,40 +0,0 @@ -package pneumaticCraft.api.recipe; - -import net.minecraft.item.ItemStack; - -public interface IPressureChamberRecipe { - - /** - * Returns the threshold which is minimal to craft the recipe. Negative pressures also work. - * - * @return threshold pressure - */ - public float getCraftingPressure(); - - /** - * This method should return the used items in the recipe when the right items are provided to craft this recipe. - * - * @param inputStacks - * @return usedStacks, return null when the inputStacks aren't valid for this recipe. - */ - public ItemStack[] isValidRecipe(ItemStack[] inputStacks); - - /** - * When returned true, only the exact same references of the stacks returned by isValidRecipe() will be removed. - * This is useful to remove stacks with a certain NBT value (like Enchanted Books). Return false for normal - * behaviour. - * - * @return true if exact stacks should be removed only. - */ - public boolean shouldRemoveExactStacks(); - - /** - * This method will be called when the recipe should output its items. the stacks the recipe output, may be - * dependent on the input stacks. - * - * @param removedStacks same reference to the stacks returned by isValidRecipe. - * @param inputStacks. These stacks can be modified (like adding/removing NBT data eg.) - * @return outputStacks. Stacks that will pop 'out of the chamber' - */ - public ItemStack[] craftRecipe(ItemStack[] inputStacks, ItemStack[] removedStacks); -} diff --git a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java deleted file mode 100644 index 12d447c4d..000000000 --- a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java +++ /dev/null @@ -1,24 +0,0 @@ -package pneumaticCraft.api.recipe; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class PressureChamberRecipe { - - public static List chamberRecipes = new ArrayList(); - public static List specialRecipes = new ArrayList(); - - public final ItemStack[] input; - public final ItemStack[] output; - public final float pressure; - public final boolean outputAsBlock; - - public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock) { - this.input = input; - this.output = output; - pressure = pressureRequired; - this.outputAsBlock = outputAsBlock; - } -} diff --git a/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java b/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java deleted file mode 100644 index 7c5f37f41..000000000 --- a/src/api/java/pneumaticCraft/api/tileentity/AirHandlerSupplier.java +++ /dev/null @@ -1,57 +0,0 @@ -package pneumaticCraft.api.tileentity; - -import java.lang.reflect.Constructor; - -public class AirHandlerSupplier { - - private static Constructor airHandlerConstructor; - - public static IAirHandler getTierOneAirHandler(int volume) { - return getAirHandler(5F, 7F, volume); - } - - public static IAirHandler getTierTwoAirHandler(int volume) { - return getAirHandler(20F, 25F, volume); - } - - /** - * Returns a new instance of an IAirHandler. This handler handles everything pressurized air related: Air - * dispersion, blowing up when the pressure gets too high, providing a method for releasing air into the - * atmosphere... PROVIDED THAT THE FOLLOWING METHODS ARE FORWARDED TO THIS INSTANCE: - * {@link net.minecraft.tileentity.TileEntity#updateEntity()}, - * {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} - * {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)} - * {@link net.minecraft.tileentity.TileEntity#validate()} - * - * @param dangerPressure minimal pressure on which this machine can explode (the yellow to red transition) - * @param criticalPressure the absolute maximum pressure the machine can take 7 bar in tier 1 machines. - * @param maxFlow maximum mL/tick that this machine can disperse. Tier one machines do 50mL/tick while Tier - * two have 200mL/tick. - * @param volume Volume of the machine's internal storage. These vary from 1000mL for small machines to - * 10,000mL for the big ones. The higher the volume the slower the machine will - * charge/discharge. - * @return - */ - public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, int volume) { - IAirHandler airHandler = null; - try { - if (airHandlerConstructor == null) - airHandlerConstructor = Class.forName("pneumaticCraft.common.tileentity.TileEntityPneumaticBase") - .getConstructor(float.class, float.class, int.class); - airHandler = (IAirHandler) airHandlerConstructor.newInstance(dangerPressure, criticalPressure, volume); - } catch (Exception e) { - System.err.println( - "[PneumaticCraft API] An error has occured whilst trying to get an AirHandler. Here's a stacktrace:"); - e.printStackTrace(); - } - return airHandler; - } - - /** - * Use the version with integer parameters - */ - @Deprecated - public static IAirHandler getAirHandler(float dangerPressure, float criticalPressure, float maxFlow, float volume) { - return getAirHandler(dangerPressure, criticalPressure, (int) volume); - } -} diff --git a/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java b/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java deleted file mode 100644 index 35c0a6ffc..000000000 --- a/src/api/java/pneumaticCraft/api/tileentity/IAirHandler.java +++ /dev/null @@ -1,123 +0,0 @@ -package pneumaticCraft.api.tileentity; - -import java.util.List; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -import org.apache.commons.lang3.tuple.Pair; - -/** - * A way for you to access about everything you need from a pneumatic machine. DO NOT IMPLEMENT THIS YOURSELF! Use - * AirHandlerSupplier to get an instance for your TileEntity, and implement IPneumaticMachine instead. - */ -public interface IAirHandler extends IManoMeasurable { - - /** - * -----------Needs to be forwarded by the implementing TileEntity's updateEntity() method. Updates the pneumatic - * machine's logic like air dispersion and checking if it needs to explode. - */ - public void updateEntityI(); - - /** - * -----------Needs to be forwarded by the implementing TileEntity. - * - * @param nbt - */ - public void readFromNBTI(NBTTagCompound nbt); - - /** - * -----------Needs to be forwarded by the implementing TileEntity. - * - * @param nbt - */ - public void writeToNBTI(NBTTagCompound nbt); - - /** - * -----------Needs to be forwarded by the implementing TileEntity with itself as parameter. - * - * @param parent TileEntity that is referencing this air handler. - */ - public void validateI(TileEntity parent); - - /** - * Method to release air in the air. It takes air from a specific side, plays a sound effect, and spawns smoke - * particles. It automatically detects if it needs to release air (when under pressure), suck air (when in vacuum) - * or do nothing. - * - * @param side - */ - public void airLeak(ForgeDirection side); - - /** - * Returns a list of all the connecting pneumatics. It takes sides in account. - */ - public List> getConnectedPneumatics(); - - /** - * Adds air to the tank of the given side of this TE. It also updates clients where needed (when they have a GUI - * opened). Deprecated: use the version with the integer parameter now. - * - * @param amount - * @param side - */ - @Deprecated - public void addAir(float amount, ForgeDirection side); - - public void addAir(int amount, ForgeDirection side); - - /** - * Sets the volume of this TE's air tank. When the volume decreases the pressure will remain the same, meaning air - * will be lost. When the volume increases, the air remains the same, meaning the pressure will drop. Used in the - * Volume Upgrade calculations. Deprecated: use the version with the integer parameter now. - * - * @param newVolume - */ - @Deprecated - public void setVolume(float newVolume); - - public void setVolume(int newVolume); - - public int getVolume(); - - /** - * Returns the pressure at which this TE will explode. - * - * @return - */ - public float getMaxPressure(); - - public float getPressure(ForgeDirection sideRequested); - - /** - * Returns the amount of air (that has a relation to the pressure: air = pressure * volume) - * - * @param sideRequested - * @return - */ - public int getCurrentAir(ForgeDirection sideRequested); - - /** - * When your TileEntity is implementing IInventory and has slots that accept PneumaticCraft upgrades, register these - * slots to the air handler by calling this method once on initialization of the TileEntity. Then they'll - * automatically be used to get Volume/Security upgrades. - * - * @param upgradeSlots all upgrade slots stored in an array. - */ - public void setUpgradeSlots(int... upgradeSlots); - - public int[] getUpgradeSlots(); - - public int getXCoord(); - - public int getYCoord(); - - public int getZCoord(); - - /** - * Needs to be forwarded from the implementing _Block_! Forward the Block's "onNeighborChange" method to this - * handler. - */ - public void onNeighborChange(); -} diff --git a/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java b/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java deleted file mode 100644 index 892c00556..000000000 --- a/src/api/java/pneumaticCraft/api/tileentity/IHeatExchanger.java +++ /dev/null @@ -1,25 +0,0 @@ -package pneumaticCraft.api.tileentity; - -import net.minecraftforge.common.util.ForgeDirection; - -import pneumaticCraft.api.IHeatExchangerLogic; - -/** - * Implemented by TileEntities or Blocks which transport heat. Keep in mind that when a Block is implementing it you - * only can give off a constant resistance/temperature (like Lava and Ice). - * - * @author MineMaarten www.minemaarten.com - */ -public interface IHeatExchanger { - - /** - * Get an instance of IHeatExchangerLogic from PneumaticRegistry.getInstance().getHeatExchangerLogic() and keep a - * global reference. Then return it in this method. You can return different exchanger logics for different sides. - * Keep in mind that when you change a returned logic, you need to create a neighbor block change to notify the - * differences. You can return null to indicate no heat can be exchanged on that side. - * - * @param side - * @return - */ - public IHeatExchangerLogic getHeatExchangerLogic(ForgeDirection side); -} diff --git a/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java b/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java deleted file mode 100644 index c89558fdd..000000000 --- a/src/api/java/pneumaticCraft/api/tileentity/IManoMeasurable.java +++ /dev/null @@ -1,17 +0,0 @@ -package pneumaticCraft.api.tileentity; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; - -public interface IManoMeasurable { - - /** - * This method is invoked by the Manometer when a player right-clicks a TE or Entity with this interface - * implemented. - * - * @param player that rightclicks the measurable TE, and therefore needs to get the message - * @param curInfo list you can append info to. If you don't append any info no air will be used. - */ - public void printManometerMessage(EntityPlayer player, List curInfo); -} diff --git a/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java b/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java deleted file mode 100644 index 061f48ec5..000000000 --- a/src/api/java/pneumaticCraft/api/tileentity/IPneumaticMachine.java +++ /dev/null @@ -1,33 +0,0 @@ -package pneumaticCraft.api.tileentity; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IPneumaticMachine { - - /** - * In your TileEntity class which is implementing this interface you should keep a reference of an IAirHandler. You - * can retrieve one by calling - * {@link AirHandlerSupplier#getAirHandler(net.minecraft.tileentity.TileEntity, float, float, float, float)}. Do - * this when your TileEntity is initialized, i.e. xCoord,yCoord,zCoord and worldObj have a value. In this method you - * need to return this reference. - * - * IMPORTANT: You need to forward the {@link net.minecraft.tileentity.TileEntity#updateEntity()}, - * {@link net.minecraft.tileentity.TileEntity#writeToNBT(net.minecraft.nbt.NBTTagCompound)} , - * {@link net.minecraft.tileentity.TileEntity#readFromNBT(net.minecraft.nbt.NBTTagCompound)} and - * {@link net.minecraft.tileentity.TileEntity#validate()} (with the implementing TileEntity as additional parameter) - * to the IAirHandler. Apart from that you'll need to forward - * {@link net.minecraft.block.Block#onNeighborChange(net.minecraft.world.IBlockAccess, int, int, int, int, int, int)} - * from the implementing block to the IAirHandler. - * - * @return - */ - public IAirHandler getAirHandler(); - - /** - * Returns true if the pneumatic logic is connected to the given side. - * - * @param side - * @return - */ - public boolean isConnectedTo(ForgeDirection side); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java deleted file mode 100644 index 55c405f80..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/EntityPollSensor.java +++ /dev/null @@ -1,36 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import java.util.List; - -import net.minecraft.entity.Entity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.world.World; - -public abstract class EntityPollSensor implements IPollSensorSetting { - - @Override - public String getSensorPath() { - return "entityTracker"; - } - - @Override - public int getPollFrequency() { - return 1; - } - - @Override - public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText) { - AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox( - x - sensorRange, - y - sensorRange, - z - sensorRange, - x + 1 + sensorRange, - y + 1 + sensorRange, - z + 1 + sensorRange); - return getRedstoneValue(world.getEntitiesWithinAABB(getEntityTracked(), aabb), textBoxText); - } - - public abstract Class getEntityTracked(); - - public abstract int getRedstoneValue(List entities, String textBoxText); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java deleted file mode 100644 index b051af5f0..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinateEventSensor.java +++ /dev/null @@ -1,67 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.tileentity.TileEntity; - -import org.lwjgl.util.Rectangle; - -import cpw.mods.fml.common.eventhandler.Event; - -public interface IBlockAndCoordinateEventSensor { - - /** - * See {@link ISensorSetting#getSensorPath()} - * - * @return - */ - public String getSensorPath(); - - /** - * Extended version of the normal emitRedstoneOnEvent. This method will only invoke with a valid GPS tool, and when - * the coordinate is within range. - * - * @param event - * @param sensor - * @param range - * @param toolX - * @param toolY - * @param toolZ - * @return - */ - public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, int toolX, int toolY, int toolZ); - - /** - * See {@link IEventSensorSetting#getRedstonePulseLength()} - * - * @return - */ - public int getRedstonePulseLength(); - - /** - * See {@link ISensorSetting#needsTextBox()} - * - * @return - */ - public boolean needsTextBox(); - - /** - * See {@link ISensorSetting#needsSlot()} - */ - public Rectangle needsSlot(); - - /** - * See {@link ISensorSetting#getDescription()} - * - * @return - */ - public List getDescription(); - - /** - * Called by GuiScreen#drawScreen this method can be used to render additional things like status/info text. - * - * @param fontRenderer - */ - public void drawAdditionalInfo(FontRenderer fontRenderer); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java deleted file mode 100644 index d3d9ea4e5..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/IBlockAndCoordinatePollSensor.java +++ /dev/null @@ -1,72 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.world.World; - -import org.lwjgl.util.Rectangle; - -public interface IBlockAndCoordinatePollSensor { - - /** - * See {@link ISensorSetting#getSensorPath()} - * - * @return - */ - public String getSensorPath(); - - /** - * See {@link ISensorSetting#needsTextBox()} - * - * @return - */ - public boolean needsTextBox(); - - /** - * See {@link ISensorSetting#needsSlot()} - * - * @return - */ - public Rectangle needsSlot(); - - /** - * See {@link ISensorSetting#getDescription()} - * - * @return - */ - public List getDescription(); - - /** - * See {@link IPollSensorSetting#getRedstoneValue(World, int, int, int, int, String)} , but this has the GPS tracked - * coordinates as extra parameters. This method will only be called when the coordinate is within the Universal - * Sensor's range. - * - * @param world - * @param x - * @param y - * @param z - * @param sensorRange - * @param textBoxText - * @param toolX - * @param toolY - * @param toolZ - * @return - */ - public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText, int toolX, - int toolY, int toolZ); - - /** - * See {@link IPollSensorSetting#getPollFrequency()} - * - * @return - */ - public int getPollFrequency(); - - /** - * Called by GuiScreen#drawScreen this method can be used to render additional things like status/info text. - * - * @param fontRenderer - */ - public void drawAdditionalInfo(FontRenderer fontRenderer); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java deleted file mode 100644 index 4bd39ddd6..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/IEventSensorSetting.java +++ /dev/null @@ -1,26 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import net.minecraft.tileentity.TileEntity; - -import cpw.mods.fml.common.eventhandler.Event; - -public interface IEventSensorSetting extends ISensorSetting { - - /** - * This method is only invoked when a subscribed event is triggered. - * - * @param event - * @param sensor - * @param range - * @param textboxText - * @return Redstone strength for the given event. - */ - public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText); - - /** - * Should return how long a pulse should hold in ticks. By default this is 5 ticks (1/4 second). - * - * @return - */ - public int getRedstonePulseLength(); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java deleted file mode 100644 index d34d312c7..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/IPollSensorSetting.java +++ /dev/null @@ -1,28 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import net.minecraft.world.World; - -public interface IPollSensorSetting extends ISensorSetting { - - /** - * The value returned here is the interval between every check in ticks (the interval of calling - * getRedstoneValue()). Consider increasing the interval when your sensor method is resource intensive. - * - * @return - */ - public int getPollFrequency(); - - /** - * The base method. This method should return the outputted redstone value 0-15 of this sensor. When this sensor is - * digital, just return 0 or 15. - * - * @param world - * @param x - * @param y - * @param z - * @param sensorRange Range of the sensor, based on the amount of Range Upgrades inserted in the Universal Sensor. - * @param textBoxText The text typed in the textbox of the Universal Sensor. - * @return - */ - public int getRedstoneValue(World world, int x, int y, int z, int sensorRange, String textBoxText); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java b/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java deleted file mode 100644 index 387cdeb40..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/ISensorSetting.java +++ /dev/null @@ -1,58 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import java.util.List; - -import net.minecraft.client.gui.FontRenderer; - -import org.lwjgl.util.Rectangle; - -public interface ISensorSetting { - - /** - * Should return the button path the player has to follow in which this setting is stored. For instance, when the - * sensor should be located in player and is called speed, you should return "entityTracker/player/speed". - * "entityTracker" indicates that this sensor needs an Entity Tracker upgrade to run. You can choose from the - * following upgrades: - * - * -entityTracker -blockTracker -gpsTool (so you can use a certain coordinate (within range) to measure on) -volume - * -dispenser -speed -itemLife -itemSearch -coordinateTracker -range -security - * - * You can allow only sensors to work by more than one upgrade, by seperating the upgrades with a '_'. For example, - * "entityTracker_speed" will only let the sensor be chosen when both an Entity Tracker and a Speed Upgrade are - * inserted. - * - * @return - */ - public String getSensorPath(); - - /** - * When returned true, the GUI will enable the textbox writing, otherwise not. - * - * @return - */ - public boolean needsTextBox(); - - /** - * Called by GuiScreen#drawScreen this method can be used to render additional things like status/info text. - * - * @param fontRenderer - */ - public void drawAdditionalInfo(FontRenderer fontRenderer); - - /** - * Should return the description of this sensor displayed in the GUI stat. Information should at least include when - * this sensor emits redstone and how (analog (1 through 15), or digital). - * - * @return - */ - public List getDescription(); - - /** - * Not being used at the moment, I recommend returning null for now. It is going to be used to allow sensors to - * decide their status on a item which can be inserted in a slot in the GUI if this method returns a rectangle with - * the coordinates of the slot. - * - * @return - */ - public Rectangle needsSlot(); -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java b/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java deleted file mode 100644 index 843017a56..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/PlayerEventSensor.java +++ /dev/null @@ -1,35 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.event.entity.player.PlayerEvent; - -import cpw.mods.fml.common.eventhandler.Event; - -public abstract class PlayerEventSensor implements IEventSensorSetting { - - @Override - public String getSensorPath() { - return "entityTracker/Player"; - } - - @Override - public int emitRedstoneOnEvent(Event event, TileEntity sensor, int range, String textboxText) { - if (event instanceof PlayerEvent) { - EntityPlayer player = ((PlayerEvent) event).entityPlayer; - if (Math.abs(player.posX - sensor.xCoord + 0.5D) < range + 0.5D - && Math.abs(player.posY - sensor.yCoord + 0.5D) < range + 0.5D - && Math.abs(player.posZ - sensor.zCoord + 0.5D) < range + 0.5D) { - return emitRedstoneOnEvent((PlayerEvent) event, sensor, range); - } - } - return 0; - } - - public abstract int emitRedstoneOnEvent(PlayerEvent event, TileEntity sensor, int range); - - @Override - public int getRedstonePulseLength() { - return 5; - } -} diff --git a/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java b/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java deleted file mode 100644 index 60aca526d..000000000 --- a/src/api/java/pneumaticCraft/api/universalSensor/SensorRegistrator.java +++ /dev/null @@ -1,39 +0,0 @@ -package pneumaticCraft.api.universalSensor; - -/** - * With this class you can register your own sensors. - */ -public class SensorRegistrator { - - /** - * This field will be initialized in the PreInit phase of PneumaticCraft's loading phase. With this field you can - * register every Universal Sensor sensor you want. Just pass a new instance to one of the registerSensor methods. - * Sensors are singletons. - */ - public static ISensorRegistrator sensorRegistrator; - - public static interface ISensorRegistrator { - - /** - * Registry for IPollSensorSetting, EntityPollSensor and IEventSensorSetting, and any other instance of - * ISensorSetting. - * - * @param sensor - */ - public void registerSensor(ISensorSetting sensor); - - /** - * Registry for IBlockAndCoordinateEventSensor - * - * @param sensor - */ - public void registerSensor(IBlockAndCoordinateEventSensor sensor); - - /** - * Registry for IBlockAndCoordinatePollSensor - * - * @param sensor - */ - public void registerSensor(IBlockAndCoordinatePollSensor sensor); - } -} diff --git a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java index 533278a4a..706cadafc 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/AlchemicalWizardry.java @@ -55,10 +55,21 @@ import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.sacrifice.PlayerSacrificeHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.ComplexNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.*; +import WayofTime.alchemicalWizardry.api.spell.SpellEffectRegistry; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmMelee; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmProjectile; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmSelf; +import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; import WayofTime.alchemicalWizardry.api.summoningRegistry.SummoningRegistry; import WayofTime.alchemicalWizardry.client.nei.IMCForNEI; -import WayofTime.alchemicalWizardry.common.*; +import WayofTime.alchemicalWizardry.common.AlchemicalWizardryEventHooks; +import WayofTime.alchemicalWizardry.common.AlchemicalWizardryFuelHandler; +import WayofTime.alchemicalWizardry.common.ClientToServerPacketHandler; +import WayofTime.alchemicalWizardry.common.CommonProxy; +import WayofTime.alchemicalWizardry.common.LifeBucketHandler; +import WayofTime.alchemicalWizardry.common.LifeEssence; +import WayofTime.alchemicalWizardry.common.ModLivingDropsEvent; +import WayofTime.alchemicalWizardry.common.NewPacketHandler; import WayofTime.alchemicalWizardry.common.achievements.ModAchievements; import WayofTime.alchemicalWizardry.common.alchemy.CombinedPotionRegistry; import WayofTime.alchemicalWizardry.common.block.ArmourForge; @@ -70,13 +81,39 @@ import WayofTime.alchemicalWizardry.common.compress.StorageBlockCraftingManager; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketMinorGrunt; import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketRegistry; -import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.*; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardian; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianEarth; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianFire; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianIce; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntGuardianWind; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce; +import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind; import WayofTime.alchemicalWizardry.common.demonVillage.loot.DemonVillageLootRegistry; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonChest; import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal; -import WayofTime.alchemicalWizardry.common.entity.mob.*; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityAirElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityFallenAngel; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityFireElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityHolyElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityLowerGuardian; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityShade; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityShadeElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntitySmallEarthGolem; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityWaterElemental; +import WayofTime.alchemicalWizardry.common.entity.mob.EntityWingedFireDemon; import WayofTime.alchemicalWizardry.common.guide.RecipeHolder; -import WayofTime.alchemicalWizardry.common.harvest.*; +import WayofTime.alchemicalWizardry.common.harvest.AgriCraftCropHarvestHandler; +import WayofTime.alchemicalWizardry.common.harvest.BloodMagicHarvestHandler; +import WayofTime.alchemicalWizardry.common.harvest.CactusReedHarvestHandler; +import WayofTime.alchemicalWizardry.common.harvest.GourdHarvestHandler; +import WayofTime.alchemicalWizardry.common.harvest.PamHarvestCompatRegistry; import WayofTime.alchemicalWizardry.common.items.ItemIncense; import WayofTime.alchemicalWizardry.common.items.ItemMailOrderCatalogue; import WayofTime.alchemicalWizardry.common.items.ItemRitualDiviner; @@ -84,24 +121,179 @@ import WayofTime.alchemicalWizardry.common.items.forestry.ItemBloodFrame; import WayofTime.alchemicalWizardry.common.items.sigil.holding.HoldingPacketHandler; import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour; -import WayofTime.alchemicalWizardry.common.omega.*; -import WayofTime.alchemicalWizardry.common.potion.*; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmEarth; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmFire; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmWater; +import WayofTime.alchemicalWizardry.common.omega.OmegaParadigmWind; +import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry; +import WayofTime.alchemicalWizardry.common.potion.PotionAmphibian; +import WayofTime.alchemicalWizardry.common.potion.PotionBoost; +import WayofTime.alchemicalWizardry.common.potion.PotionDeaf; +import WayofTime.alchemicalWizardry.common.potion.PotionDemonCloak; +import WayofTime.alchemicalWizardry.common.potion.PotionDrowning; +import WayofTime.alchemicalWizardry.common.potion.PotionFeatherFall; +import WayofTime.alchemicalWizardry.common.potion.PotionFireFuse; +import WayofTime.alchemicalWizardry.common.potion.PotionFlameCloak; +import WayofTime.alchemicalWizardry.common.potion.PotionFlight; +import WayofTime.alchemicalWizardry.common.potion.PotionHeavyHeart; +import WayofTime.alchemicalWizardry.common.potion.PotionIceCloak; +import WayofTime.alchemicalWizardry.common.potion.PotionInhibit; +import WayofTime.alchemicalWizardry.common.potion.PotionPlanarBinding; +import WayofTime.alchemicalWizardry.common.potion.PotionProjectileProtect; +import WayofTime.alchemicalWizardry.common.potion.PotionReciprocation; +import WayofTime.alchemicalWizardry.common.potion.PotionSoulFray; +import WayofTime.alchemicalWizardry.common.potion.PotionSoulHarden; import WayofTime.alchemicalWizardry.common.renderer.AlchemyCircleRenderer; -import WayofTime.alchemicalWizardry.common.rituals.*; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.*; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.*; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.*; -import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.*; -import WayofTime.alchemicalWizardry.common.spell.simple.*; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAnimalGrowth; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAutoAlchemy; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBinding; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBiomeChanger; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectContainment; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrafting; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrushing; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectDemonPortal; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEllipsoid; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEvaporation; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectExpulsion; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredEarth; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFeatheredKnife; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFlight; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectFullStomach; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectGrowth; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectHarvest; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectHealing; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectInterdiction; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectItemRouting; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectItemSuction; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectJumping; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLava; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLeap; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLifeConduit; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectMagnetic; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectOmegaStalling; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectOmegaTest; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSpawnWard; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSphereCreator; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSummonMeteor; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSupression; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectUnbinding; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectVeilOfEvil; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWater; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWellOfSuffering; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEMeleeDefaultEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEMeleeDefensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEMeleeEnvironmentalEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEMeleeOffensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEProjectileDefaultEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEProjectileDefensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEProjectileEnvironmentalEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEProjectileOffensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSESelfDefaultEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSESelfDefensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSESelfEnvironmentalEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSESelfOffensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEToolDefaultEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEToolDefensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEToolEnvironmentalEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.earth.CSEToolOffensiveEarth; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEMeleeDefaultFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEMeleeDefensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEMeleeEnvironmentalFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEMeleeOffensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEProjectileDefaultFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEProjectileDefensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEProjectileEnvironmentalFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEProjectileOffensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSESelfDefaultFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSESelfDefensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSESelfEnvironmentalFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSESelfOffensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEToolDefaultFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEToolDefensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEToolEnvironmentalFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.fire.CSEToolOffensiveFire; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEMeleeDefaultIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEMeleeDefensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEMeleeEnvironmentalIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEMeleeOffensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEProjectileDefaultIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEProjectileDefensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEProjectileEnvironmentalIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEProjectileOffensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSESelfDefaultIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSESelfDefensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSESelfEnvironmentalIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSESelfOffensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEToolDefaultIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEToolDefensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEToolEnvironmentalIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.ice.CSEToolOffensiveIce; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEMeleeDefaultWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEMeleeDefensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEMeleeEnvironmentalWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEMeleeOffensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEProjectileDefaultWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEProjectileDefensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEProjectileEnvironmentalWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEProjectileOffensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSESelfDefaultWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSESelfDefensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSESelfEnvironmentalWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSESelfOffensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEToolDefaultWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEToolDefensiveWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEToolEnvironmentalWind; +import WayofTime.alchemicalWizardry.common.spell.complex.effect.cse.wind.CSEToolOffensiveWind; +import WayofTime.alchemicalWizardry.common.spell.simple.HomSpellRegistry; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellEarthBender; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellExplosions; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellFireBurst; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellFrozenWater; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellHolyBlast; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellLightningBolt; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellTeleport; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellWateryGrave; +import WayofTime.alchemicalWizardry.common.spell.simple.SpellWindGust; import WayofTime.alchemicalWizardry.common.summoning.SummoningHelperAW; import WayofTime.alchemicalWizardry.common.summoning.meteor.Meteor; -import WayofTime.alchemicalWizardry.common.tileEntity.*; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAlchemicCalcinator; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEConduit; +import WayofTime.alchemicalWizardry.common.tileEntity.TECrucible; +import WayofTime.alchemicalWizardry.common.tileEntity.TEHomHeart; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMimicBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TEOrientable; +import WayofTime.alchemicalWizardry.common.tileEntity.TEPedestal; +import WayofTime.alchemicalWizardry.common.tileEntity.TEPlinth; +import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit; +import WayofTime.alchemicalWizardry.common.tileEntity.TESchematicSaver; +import WayofTime.alchemicalWizardry.common.tileEntity.TESocket; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpectralContainer; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEffectBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpellEnhancementBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpellModifierBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TESpellParadigmBlock; +import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer; +import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; import WayofTime.alchemicalWizardry.common.tileEntity.gui.GuiHandler; import WayofTime.alchemicalWizardry.common.tweaker.MineTweakerIntegration; -import cpw.mods.fml.common.*; +import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; -import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.ModContainer; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.SidedProxy; +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; @@ -527,6 +719,7 @@ public void load(FMLInitializationEvent event) { proxy.registerEntities(); proxy.registerEntityTrackers(); proxy.registerEvents(); + BloodMagicWailaPlugin.init(); // ItemStacks used for crafting go here ItemStack lapisStack = new ItemStack(Items.dye, 1, 4); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java index 40a786875..80580f24a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/entity/mob/MailOrderEntityItem.java @@ -6,11 +6,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import pneumaticCraft.api.PneumaticRegistry; -import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.common.book.BloodMagicGuide; import amerifrance.guideapi.api.GuideRegistry; -import cpw.mods.fml.common.Optional; public class MailOrderEntityItem extends EntityItem { @@ -48,32 +45,18 @@ public void onUpdate() { if (!worldObj.isRemote && this.ticksExisted > 100 && !this.isDead) { worldObj.addWeatherEffect(new EntityLightningBolt(worldObj, this.posX, this.posY, this.posZ)); - if (AlchemicalWizardry.isPneumaticCraftLoaded) { - this.deliverItemViaDrone(this.posX, this.posY, this.posZ); - } else { - EntityItem entity = new BookEntityItem( - worldObj, - this.posX, - this.posY, - this.posZ, - GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); - entity.lifespan = 6000; - entity.delayBeforeCanPickup = 20; - entity.motionY = 1; - worldObj.spawnEntityInWorld(entity); - } + EntityItem entity = new BookEntityItem( + worldObj, + this.posX, + this.posY, + this.posZ, + GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); + entity.lifespan = 6000; + entity.delayBeforeCanPickup = 20; + entity.motionY = 1; + worldObj.spawnEntityInWorld(entity); this.setDead(); } } - - @Optional.Method(modid = "PneumaticCraft") - public void deliverItemViaDrone(double x, double y, double z) { - PneumaticRegistry.getInstance().deliverItemsAmazonStyle( - worldObj, - (int) x, - (int) y, - (int) z, - GuideRegistry.getItemStackForBook(BloodMagicGuide.bloodMagicGuide)); - } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java index 7b49e13f1..1dc890dc9 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEAltar.java @@ -1,9 +1,14 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import java.text.NumberFormat; import java.util.List; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -14,6 +19,7 @@ import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidContainerRegistry; @@ -34,8 +40,10 @@ import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.AltarUpgradeComponent; import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; +import WayofTime.alchemicalWizardry.compat.IBloodMagicWailaProvider; -public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar { +public class TEAltar extends TEInventory implements IFluidTank, IFluidHandler, IBloodAltar, IBloodMagicWailaProvider { public static final int sizeInv = 1; @@ -941,4 +949,61 @@ public void requestPauseAfterCrafting(int amount) { this.cooldownAfterCrafting = amount; } } + + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!accessor.getNBTData().hasKey("altar") || !config.getConfig(BloodMagicWailaPlugin.WAILA_CONFIG_ALTAR)) + return; + + final NBTTagCompound altarData = accessor.getNBTData().getCompoundTag("altar"); + final NumberFormat numberFormat = NumberFormat.getIntegerInstance(); + + if (altarData.hasKey("stored")) { + currenttip.add( + StatCollector.translateToLocal("tooltip.waila.currentFluid") + + numberFormat.format(altarData.getInteger("stored"))); + } else { + currenttip.add(StatCollector.translateToLocal("tooltip.waila.noFluid")); + } + + currenttip.add( + StatCollector.translateToLocal("tooltip.waila.altarCapacity") + + numberFormat.format(altarData.getInteger("capacity"))); + currenttip.add(StatCollector.translateToLocal("tooltip.waila.tier") + altarData.getInteger("tier")); + + if (altarData.hasKey("progress")) { + currenttip.add( + StatCollector.translateToLocal("tooltip.waila.altarProgress") + altarData.getInteger("progress") + + "%"); + currenttip.add(StatCollector.translateToLocal("tooltip.waila.crafting") + altarData.getString("crafting")); + } + + } + + @Override + public void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, + final World world, int x, int y, int z) { + NBTTagCompound altarData = new NBTTagCompound(); + altarData.setInteger("tier", this.getTier()); + altarData.setInteger("capacity", this.getCapacity()); + final int blood = this.getCurrentBlood(); + if (blood > 0) altarData.setInteger("stored", blood); + + if (this.getStackInSlot(0) != null && progress > 0) { + altarData.setInteger( + "progress", + (int) (((double) this.getProgress() / (double) this.liquidRequired * 100) + / this.getStackInSlot(0).stackSize)); + + ItemStack result = AltarRecipeRegistry.getItemForItemAndTier(this.getStackInSlot(0), this.upgradeLevel); + if (result != null) { + altarData.setString("crafting", result.getDisplayName()); + } + + } + tag.setTag("altar", altarData); + + } + } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java index cbf38bf8a..31b223187 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEMasterStone.java @@ -1,10 +1,15 @@ package WayofTime.alchemicalWizardry.common.tileEntity; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Map.Entry; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; @@ -14,6 +19,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.ChatComponentTranslation; +import net.minecraft.util.StatCollector; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.Constants; @@ -32,9 +38,11 @@ import WayofTime.alchemicalWizardry.api.rituals.Rituals; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; +import WayofTime.alchemicalWizardry.compat.IBloodMagicWailaProvider; import cpw.mods.fml.common.eventhandler.Event; -public class TEMasterStone extends TileEntity implements IMasterRitualStone { +public class TEMasterStone extends TileEntity implements IMasterRitualStone, IBloodMagicWailaProvider { private String currentRitualString; private boolean isActive; @@ -638,4 +646,35 @@ public LocalRitualStorage getLocalStorage() { public void setLocalStorage(LocalRitualStorage storage) { this.storage = storage; } + + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig(BloodMagicWailaPlugin.WAILA_CONFIG_RITUAL)) return; + + final NBTTagCompound tag = accessor.getNBTData(); + if (tag.hasKey("owner")) { + currenttip.add(StatCollector.translateToLocal("tooltip.waila.owner") + tag.getString("owner")); + } + + currenttip.add( + StatCollector.translateToLocal("tooltip.waila." + (tag.getBoolean("active") ? "active" : "notActive"))); + if (tag.hasKey("currentRitual")) { + currenttip + .add(StatCollector.translateToLocal("tooltip.waila.ritualString") + tag.getString("currentRitual")); + } + + } + + @Override + public void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, + final World world, int x, int y, int z) { + if (!getOwner().isEmpty()) { + tag.setString("owner", getOwner()); + } + if (!getCurrentRitual().isEmpty()) { + tag.setString("currentRitual", Rituals.getNameOfRitual(getCurrentRitual())); + } + tag.setBoolean("active", isActive); + } } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java index 0f55ea430..290af2def 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TETeleposer.java @@ -3,11 +3,16 @@ import java.util.Iterator; import java.util.List; +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; @@ -17,8 +22,10 @@ import WayofTime.alchemicalWizardry.common.items.EnergyItems; import WayofTime.alchemicalWizardry.common.items.TelepositionFocus; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; +import WayofTime.alchemicalWizardry.compat.IBloodMagicWailaProvider; -public class TETeleposer extends TEInventory { +public class TETeleposer extends TEInventory implements IBloodMagicWailaProvider { public static final int sizeInv = 1; @@ -277,4 +284,18 @@ public int[] buildIntDataList() { public boolean isItemValidForSlot(int slot, ItemStack itemstack) { return itemstack.getItem() instanceof TelepositionFocus; } + + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig(BloodMagicWailaPlugin.WAILA_CONFIG_TELEPOSER)) return; + final ItemStack contained = getStackInSlot(0); + if (contained != null) { + currenttip.add(contained.getDisplayName()); + } + } + + @Override + public void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, + final World world, int x, int y, int z) {} } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java index af4a0d654..d1c4bbfa0 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/tileEntity/TEWritingTable.java @@ -1,10 +1,19 @@ package WayofTime.alchemicalWizardry.common.tileEntity; +import java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.oredict.OreDictionary; @@ -22,8 +31,10 @@ import WayofTime.alchemicalWizardry.common.alchemy.ICombinationalCatalyst; import WayofTime.alchemicalWizardry.common.items.potion.AlchemyFlask; import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper; +import WayofTime.alchemicalWizardry.compat.BloodMagicWailaPlugin; +import WayofTime.alchemicalWizardry.compat.IBloodMagicWailaProvider; -public class TEWritingTable extends TEInventory implements ISidedInventory { +public class TEWritingTable extends TEInventory implements ISidedInventory, IBloodMagicWailaProvider { public static final int sizeInv = 7; @@ -715,4 +726,30 @@ public boolean canInsertItem(int slot, ItemStack stack, int side) { public boolean canExtractItem(int slot, ItemStack stack, int side) { return slot == 6; } + + @Override + public void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + if (!config.getConfig(BloodMagicWailaPlugin.WAILA_CHEMISTRY_SET)) return; + final NBTTagCompound tag = accessor.getNBTData(); + final int curProgress = tag.getInteger("progress"); + if (curProgress > 0) { + currenttip.add(StatCollector.translateToLocal("tooltip.waila.altarProgress") + curProgress + "%"); + } + if (tag.hasKey("crafting")) { + currenttip.add(StatCollector.translateToLocal("tooltip.waila.crafting") + tag.getString("crafting")); + } + + } + + @Override + public void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, + final World world, int x, int y, int z) { + tag.setInteger("progress", progress); + final ItemStack result = getResultingItemStack(); + if (result != null) { + tag.setString("crafting", result.getDisplayName()); + } + } + } diff --git a/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaPlugin.java b/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaPlugin.java new file mode 100644 index 000000000..cda728015 --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaPlugin.java @@ -0,0 +1,42 @@ +package WayofTime.alchemicalWizardry.compat; + +import mcp.mobius.waila.api.IWailaDataProvider; +import mcp.mobius.waila.api.IWailaRegistrar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; +import WayofTime.alchemicalWizardry.common.tileEntity.TETeleposer; +import WayofTime.alchemicalWizardry.common.tileEntity.TEWritingTable; +import cpw.mods.fml.common.event.FMLInterModComms; + +public class BloodMagicWailaPlugin { + + public static final String WAILA_CONFIG_ALTAR = "bm.bloodAltar"; + public static final String WAILA_CONFIG_TELEPOSER = "bm.teleposer"; + public static final String WAILA_CONFIG_RITUAL = "bm.ritualController"; + public static final String WAILA_CHEMISTRY_SET = "bm.chemistrySet"; + + public static void callbackRegister(IWailaRegistrar register) { + final IWailaDataProvider wailaProvider = new BloodMagicWailaProvider(); + + register.registerBodyProvider(wailaProvider, TEAltar.class); + register.registerNBTProvider(wailaProvider, TEAltar.class); + register.addConfig("Blood Magic", WAILA_CONFIG_ALTAR, true); + + register.registerBodyProvider(wailaProvider, TETeleposer.class); + register.addConfig("Blood Magic", WAILA_CONFIG_TELEPOSER, true); + + register.registerBodyProvider(wailaProvider, TEMasterStone.class); + register.registerNBTProvider(wailaProvider, TEMasterStone.class); + register.addConfig("Blood Magic", WAILA_CONFIG_RITUAL, true); + + register.registerBodyProvider(wailaProvider, TEWritingTable.class); + register.registerNBTProvider(wailaProvider, TEWritingTable.class); + register.registerTailProvider(wailaProvider, TEWritingTable.class); + register.addConfig("Blood Magic", WAILA_CHEMISTRY_SET, true); + + } + + public static void init() { + FMLInterModComms.sendMessage("Waila", "register", BloodMagicWailaPlugin.class.getName() + ".callbackRegister"); + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaProvider.java b/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaProvider.java new file mode 100644 index 000000000..631778dfc --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/compat/BloodMagicWailaProvider.java @@ -0,0 +1,54 @@ +package WayofTime.alchemicalWizardry.compat; + +import java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; +import mcp.mobius.waila.api.IWailaDataProvider; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class BloodMagicWailaProvider implements IWailaDataProvider { + + @Override + public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { + return null; + } + + @Override + public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + return currenttip; + } + + @Override + public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + final TileEntity tile = accessor.getTileEntity(); + if (tile instanceof IBloodMagicWailaProvider) { + ((IBloodMagicWailaProvider) tile).getWailaBody(itemStack, currenttip, accessor, config); + } + + return currenttip; + } + + @Override + public List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) { + return currenttip; + } + + @Override + public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, + int y, int z) { + if (tile instanceof IBloodMagicWailaProvider) { + ((IBloodMagicWailaProvider) tile).getWailaNBTData(player, tile, tag, world, x, y, z); + } + + return tag; + } +} diff --git a/src/main/java/WayofTime/alchemicalWizardry/compat/IBloodMagicWailaProvider.java b/src/main/java/WayofTime/alchemicalWizardry/compat/IBloodMagicWailaProvider.java new file mode 100644 index 000000000..dd14fffcc --- /dev/null +++ b/src/main/java/WayofTime/alchemicalWizardry/compat/IBloodMagicWailaProvider.java @@ -0,0 +1,21 @@ +package WayofTime.alchemicalWizardry.compat; + +import java.util.List; + +import mcp.mobius.waila.api.IWailaConfigHandler; +import mcp.mobius.waila.api.IWailaDataAccessor; + +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public interface IBloodMagicWailaProvider { + + default void getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, + IWailaConfigHandler config) {} + + default void getWailaNBTData(final EntityPlayerMP player, final TileEntity tile, final NBTTagCompound tag, + final World world, int x, int y, int z) {} +} diff --git a/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang b/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang index cff16bff1..3818a2757 100644 --- a/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang +++ b/src/main/resources/assets/alchemicalwizardry/lang/en_US.lang @@ -607,3 +607,21 @@ bm.versioning.error=An error has occurred while downloading the mod! bm.versioning.downloadedAlready=You have the latest version already, reload your game to update! bm.versioning.downloadingAlready=It's downloading! Be patient! bm.versioning.disabled=This feature is disabled. + +# Waila localizations +tooltip.waila.currentFluid=Life Essence: +tooltip.waila.noFluid=There is no Life Essence in the altar +tooltip.waila.tier=Altar Tier: +tooltip.waila.altarProgress=Altar Progress: +tooltip.waila.crafting=Crafting: +tooltip.waila.altarCapacity=Altar Capacity: +tooltip.waila.chemistrySetProgress=Item Progress: +tooltip.waila.owner=Owner: +tooltip.waila.ritualString=Current Ritual: +tooltip.waila.active=Ritual Active +tooltip.waila.notActive=Ritual Not Active + +option.bm.bloodAltar=Blood Altar +option.bm.ritualController=Ritual Stones +option.bm.teleposer=Teleposer +option.bm.chemistrySet=Alchemical Chemistry Set \ No newline at end of file