diff --git a/build.gradle b/build.gradle index 3930990..b74b980 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1685785062 +//version: 1696952014 /* DO NOT CHANGE THIS FILE! Also, you may replace this file at any time if there is an update available. @@ -69,7 +69,7 @@ plugins { id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version id 'com.modrinth.minotaur' version '2.+' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false - id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14' + id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24' } print("You might want to check out './gradlew :faq' if your build fails.\n") @@ -89,6 +89,23 @@ def out = services.get(StyledTextOutputFactory).create('an-output') def projectJavaVersion = JavaLanguageVersion.of(8) boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false +boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false + +final String CHECKSTYLE_CONFIG = """ + + + + + + + + + + + +""" checkPropertyExists("modName") checkPropertyExists("modId") @@ -115,6 +132,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins) propertyDefaultIfUnset("forceEnableMixins", false) propertyDefaultIfUnset("channel", "stable") propertyDefaultIfUnset("mappingsVersion", "12") +propertyDefaultIfUnset("usesMavenPublishing", true) +propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases") propertyDefaultIfUnset("modrinthProjectId", "") propertyDefaultIfUnset("modrinthRelations", "") propertyDefaultIfUnset("curseForgeProjectId", "") @@ -138,6 +157,17 @@ if (!disableSpotless) { apply from: Blowdryer.file('spotless.gradle') } +if (!disableCheckstyle) { + apply plugin: 'checkstyle' + tasks.named("checkstylePatchedMc") { enabled = false } + tasks.named("checkstyleMcLauncher") { enabled = false } + tasks.named("checkstyleIdeVirtualMain") { enabled = false } + tasks.named("checkstyleInjectedTags") { enabled = false } + checkstyle { + config = resources.text.fromString(CHECKSTYLE_CONFIG) + } +} + String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" String kotlinSourceDir = "src/main/kotlin/" @@ -357,7 +387,27 @@ catch (Exception ignored) { String identifiedVersion String versionOverride = System.getenv("VERSION") ?: null try { - identifiedVersion = versionOverride == null ? gitVersion() : versionOverride + // Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty + if (versionOverride == null) { + def gitDetails = versionDetails() + def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning + String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git') + if (branchName.startsWith('origin/')) { + branchName = branchName.minus('origin/') + } + branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver + identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}' + if (gitDetails.commitDistance > 0) { + identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}" + if (isDirty) { + identifiedVersion += "-dirty" + } + } else if (isDirty) { + identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty" + } + } else { + identifiedVersion = versionOverride + } } catch (Exception ignored) { out.style(Style.Failure).text( @@ -379,9 +429,13 @@ if (identifiedVersion == versionOverride) { group = "com.github.GTNewHorizons" if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { - archivesBaseName = customArchiveBaseName + base { + archivesName = customArchiveBaseName + } } else { - archivesBaseName = modId + base { + archivesName = modId + } } @@ -465,10 +519,19 @@ sourceSets { } } -if (file('addon.gradle').exists()) { +if (file('addon.gradle.kts').exists()) { + apply from: 'addon.gradle.kts' +} else if (file('addon.gradle').exists()) { apply from: 'addon.gradle' } +// File for local tweaks not commited to Git +if (file('addon.local.gradle.kts').exists()) { + apply from: 'addon.local.gradle.kts' +} else if (file('addon.local.gradle').exists()) { + apply from: 'addon.local.gradle' +} + // Allow unsafe repos but warn repositories.configureEach { repo -> if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) { @@ -479,7 +542,14 @@ repositories.configureEach { repo -> } } -apply from: 'repositories.gradle' +if (file('repositories.gradle.kts').exists()) { + apply from: 'repositories.gradle.kts' +} else if (file('repositories.gradle').exists()) { + apply from: 'repositories.gradle' +} else { + logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing repositories.gradle[.kts]") +} configurations { runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable) @@ -520,9 +590,6 @@ repositories { maven { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' - mavenContent { - excludeGroup("net.minecraftforge") // missing the `universal` artefact - } } maven { name = "GTNH Maven" @@ -537,24 +604,34 @@ repositories { } } if (includeWellKnownRepositories.toBoolean()) { - maven { - name "CurseMaven" - url "https://cursemaven.com" - content { + exclusiveContent { + forRepository { + maven { + name "CurseMaven" + url "https://cursemaven.com" + } + } + filter { includeGroup "curse.maven" } } - maven { - name = "ic2" - url = "https://maven.ic2.player.to/" - metadataSources { - mavenPom() - artifact() + exclusiveContent { + forRepository { + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + } + } + filter { + includeGroup "maven.modrinth" } } maven { - name = "ic2-mirror" - url = "https://maven2.ic2.player.to/" + name = "ic2" + url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/") + content { + includeGroup "net.industrial-craft" + } metadataSources { mavenPom() artifact() @@ -574,6 +651,8 @@ def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule} def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" ext.mixinProviderSpec = mixinProviderSpec +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' + dependencies { if (usesMixins.toBoolean()) { annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') @@ -585,7 +664,7 @@ dependencies { } } if (usesMixins.toBoolean()) { - implementation(mixinProviderSpec) + implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap)) } else if (forceEnableMixins.toBoolean()) { runtimeOnlyNonPublishable(mixinProviderSpec) } @@ -611,12 +690,32 @@ configurations.all { } } -apply from: 'dependencies.gradle' +dependencies { + constraints { + def minGtnhLibVersion = "0.0.13" + implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") { + because("fixes duplicate mod errors in java 17 configurations using old gtnhlib") + } + } +} -def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' -def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins' -def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap -def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg" +if (file('dependencies.gradle.kts').exists()) { + apply from: 'dependencies.gradle.kts' +} else if (file('dependencies.gradle').exists()) { + apply from: 'dependencies.gradle' +} else { + logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.") + throw new RuntimeException("Missing dependencies.gradle[.kts]") +} tasks.register('generateAssets') { group = "GTNH Buildscript" @@ -648,46 +747,17 @@ tasks.register('generateAssets') { } if (usesMixins.toBoolean()) { - tasks.named("reobfJar", ReobfuscatedJar).configure { - extraSrgFiles.from(mixinSrg) - } - tasks.named("processResources").configure { dependsOn("generateAssets") } tasks.named("compileJava", JavaCompile).configure { - doFirst { - new File(mixinTmpDir).mkdirs() - } options.compilerArgs += [ - "-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}", - "-AoutSrgFile=${mixinSrg}", - "-AoutRefMapFile=${refMap}", // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code "-XDenableSunApiLintControl", "-XDignore.symbol.file" ] } - - pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { - kapt { - correctErrorTypes = true - javacOptions { - option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}") - option("-AoutSrgFile=$mixinSrg") - option("-AoutRefMapFile=$refMap") - } - } - tasks.configureEach { task -> - if (task.name == "kaptKotlin") { - task.doFirst { - new File(mixinTmpDir).mkdirs() - } - } - } - } - } tasks.named("processResources", ProcessResources).configure { @@ -705,7 +775,6 @@ tasks.named("processResources", ProcessResources).configure { } if (usesMixins.toBoolean()) { - from refMap dependsOn("compileJava", "compileScala") } } @@ -724,23 +793,14 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies" } dependencies { - def lwjgl3ifyVersion = '1.3.5' - def asmVersion = '9.4' + def lwjgl3ifyVersion = '1.5.1' if (modId != 'lwjgl3ify') { java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") } if (modId != 'hodgepodge') { - java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13') + java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.7') } - 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") {transitive = false} } @@ -979,6 +1039,9 @@ idea { } } runConfigurations { + "0. Build and Test"(Gradle) { + taskNames = ["build"] + } "1. Run Client"(Gradle) { taskNames = ["runClient"] } @@ -1098,6 +1161,14 @@ tasks.named("processIdeaSettings").configure { dependsOn("injectTags") } +tasks.named("ideVirtualMainClasses").configure { + // Make IntelliJ "Build project" build the mod jars + dependsOn("jar", "reobfJar") + if (!disableSpotless) { + dependsOn("spotlessCheck") + } +} + // workaround variable hiding in pom processing def projectConfigs = project.configurations @@ -1118,12 +1189,14 @@ publishing { } repositories { - maven { - url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases" - allowInsecureProtocol = true - credentials { - username = System.getenv("MAVEN_USER") ?: "NONE" - password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + if (usesMavenPublishing.toBoolean()) { + maven { + url = mavenPublishUrl + allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven + credentials { + username = System.getenv("MAVEN_USER") ?: "NONE" + password = System.getenv("MAVEN_PASSWORD") ?: "NONE" + } } } } @@ -1238,7 +1311,7 @@ def addCurseForgeRelation(String type, String name) { // Updating -def buildscriptGradleVersion = "8.1.1" +def buildscriptGradleVersion = "8.2.1" tasks.named('wrapper', Wrapper).configure { gradleVersion = buildscriptGradleVersion @@ -1344,8 +1417,14 @@ boolean isNewBuildScriptVersionAvailable() { String currentBuildScript = getFile("build.gradle").getText() String currentBuildScriptHash = getVersionHash(currentBuildScript) - String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() - String availableBuildScriptHash = getVersionHash(availableBuildScript) + String availableBuildScriptHash + try { + String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText() + availableBuildScriptHash = getVersionHash(availableBuildScript) + } catch (IOException e) { + logger.warn("Could not check for buildscript update availability: {}", e.message) + return false + } boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash return !isUpToDate @@ -1510,3 +1589,36 @@ def getSecondaryArtifacts() { if (apiPackage) secondaryArtifacts += [apiJar] return secondaryArtifacts } + +def getURL(String main, String fallback) { + return pingURL(main, 10000) ? main : fallback +} + +// credit: https://stackoverflow.com/a/3584332 +def pingURL(String url, int timeout) { + url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates. + try { + HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection() + connection.setConnectTimeout(timeout) + connection.setReadTimeout(timeout) + connection.setRequestMethod("HEAD") + int responseCode = connection.getResponseCode() + return 200 <= responseCode && responseCode <= 399 + } catch (IOException ignored) { + return false + } +} + +// For easier scripting of things that require variables defined earlier in the buildscript +if (file('addon.late.gradle.kts').exists()) { + apply from: 'addon.late.gradle.kts' +} else if (file('addon.late.gradle').exists()) { + apply from: 'addon.late.gradle' +} + +// File for local tweaks not commited to Git +if (file('addon.late.local.gradle.kts').exists()) { + apply from: 'addon.late.local.gradle.kts' +} else if (file('addon.late.local.gradle').exists()) { + apply from: 'addon.late.local.gradle' +} diff --git a/gradle.properties b/gradle.properties index c5a7a7f..2575664 100644 --- a/gradle.properties +++ b/gradle.properties @@ -34,7 +34,7 @@ enableModernJavaSyntax = true # Enables injecting missing generics into the decompiled source code for a better coding experience # Turns most publically visible List, Map, etc. into proper List, Map types -enableGenericInjection = false +enableGenericInjection = true # Generate a class with String fields for the mod id, name, version and group name named with the fields below generateGradleTokenClass = com.gtnewhorizons.gravisuiteneo.Tags diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/GraviSuiteNeo.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/GraviSuiteNeo.java index 1bad26b..6116948 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/GraviSuiteNeo.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/GraviSuiteNeo.java @@ -23,7 +23,7 @@ @Mod( acceptedMinecraftVersions = "[1.7.10]", - dependencies = "required-after:GraviSuite@[1.7.10-2.0.3];required-after:IC2;required-after:gtnhmixins;after:gregtech", + dependencies = "required-after:GraviSuite@[1.7.10-2.0.3];required-after:IC2;after:gregtech", modid = GraviSuiteNeo.MODID, name = GraviSuiteNeo.MODNAME, version = GraviSuiteNeo.VERSION) diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/common/EntityPlasmaBallMKII.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/common/EntityPlasmaBallMKII.java index a0523ab..4d49c16 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/common/EntityPlasmaBallMKII.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/common/EntityPlasmaBallMKII.java @@ -125,7 +125,6 @@ public static double getImpactRadius(float plasmaEfficiency) { return 6.0 * plasmaEfficiency; } - @SuppressWarnings("unchecked") @Override protected void onImpact(MovingObjectPosition mop) { if (this.finalTicksForDestruction != -1) { diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemEpicLappack.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemEpicLappack.java index a01b0d9..cd26ba3 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemEpicLappack.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemEpicLappack.java @@ -47,7 +47,6 @@ public void registerIcons(IIconRegister iconRegister) { } @Override - @SideOnly(Side.CLIENT) public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return GraviSuiteNeo.MODID + ":textures/armor/armor_epic_lappack.png"; } @@ -75,7 +74,6 @@ public boolean onTick(EntityPlayer player, ItemStack itemstack) { } @Override - @SideOnly(Side.CLIENT) public EnumRarity getRarity(ItemStack var1) { return EnumRarity.epic; } diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaCell.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaCell.java index d99c5a4..9442025 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaCell.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaCell.java @@ -21,8 +21,6 @@ import com.gtnewhorizons.gravisuiteneo.common.Properties; import com.gtnewhorizons.gravisuiteneo.util.FluidHelper; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gravisuite.IItemTickListener; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; @@ -140,10 +138,8 @@ public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain) { * IFluidContainerItem end */ - @SuppressWarnings("unchecked") @Override - public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip, - boolean advancedTooltip) { + public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean advancedTooltip) { tooltip.addAll(getToolTipInfo(stack)); } @@ -184,7 +180,6 @@ public Item getEmptyItem(ItemStack itemStack) { } @Override - @SideOnly(Side.CLIENT) public EnumRarity getRarity(ItemStack p_77613_1_) { return EnumRarity.uncommon; } @@ -219,10 +214,8 @@ public Item getChargedItem(ItemStack itemStack) { return this; } - @SuppressWarnings("unchecked") @Override - @SideOnly(Side.CLIENT) - public void getSubItems(Item item, CreativeTabs creativeTab, @SuppressWarnings("rawtypes") List subItems) { + public void getSubItems(Item item, CreativeTabs creativeTab, List subItems) { final ItemStack stack = new ItemStack(this, 1); ElectricItem.manager.charge(stack, Integer.MAX_VALUE, Integer.MAX_VALUE, true, false); final ItemStack fullStack = new ItemStack(this, 1, this.getMaxDamage()); diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaLauncher.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaLauncher.java index d849c26..4376d0f 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaLauncher.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/items/ItemPlasmaLauncher.java @@ -19,8 +19,6 @@ import com.gtnewhorizons.gravisuiteneo.common.Properties; import com.gtnewhorizons.gravisuiteneo.inventory.InventoryItem; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gravisuite.EntityPlasmaBall; import gravisuite.GraviSuite; import gravisuite.ServerProxy; @@ -127,9 +125,8 @@ public boolean hasAmmunition(ItemStack itemStack) { return this.getAmmunition(itemStack) != null; } - @SuppressWarnings("unchecked") @Override - public void addInformation(ItemStack itemStack, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip, + public void addInformation(ItemStack itemStack, EntityPlayer player, List tooltip, boolean advancedTooltips) { if (this.hasAmmunition(itemStack)) { tooltip.addAll(ItemPlasmaCell.getToolTipInfo(this.getAmmunition(itemStack))); @@ -139,7 +136,6 @@ public void addInformation(ItemStack itemStack, EntityPlayer player, @SuppressWa } @Override - @SideOnly(Side.CLIENT) public EnumRarity getRarity(ItemStack p_77613_1_) { return EnumRarity.epic; } diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinGraviSuite.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinGraviSuite.java index 98f442b..33cda47 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinGraviSuite.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinGraviSuite.java @@ -22,9 +22,9 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -import com.gtnewhorizon.mixinextras.injector.WrapWithCondition; import com.gtnewhorizons.gravisuiteneo.common.EntityPlasmaBallMKII; import com.gtnewhorizons.gravisuiteneo.common.Properties; +import com.llamalad7.mixinextras.injector.WrapWithCondition; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import gravisuite.EntityPlasmaBall; diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvChainsaw.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvChainsaw.java index 94713d9..457234b 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvChainsaw.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvChainsaw.java @@ -41,9 +41,8 @@ public abstract class MixinItemAdvChainsaw extends ItemTool { @Shadow(remap = false) private int energyPerOperation; - @SuppressWarnings("rawtypes") @Shadow(remap = false) - public Set mineableBlocks; + public Set mineableBlocks; @Shadow(remap = false) public abstract void saveToolMode(ItemStack itemstack, Integer toolMode); @@ -52,7 +51,6 @@ public abstract class MixinItemAdvChainsaw extends ItemTool { * @author Namikon, glowredman * @reason Gravitation Suite Neo */ - @SuppressWarnings("unchecked") @Overwrite(remap = false) public void init() { for (String blockName : Properties.AdvTweaks.getAdvChainsawAdditionalMineableBlocks()) { @@ -166,12 +164,10 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer * @author Namikon, glowredman * @reason Gravitation Suite Neo */ - @SuppressWarnings("unchecked") @Overwrite @SideOnly(Side.CLIENT) - public void addInformation(ItemStack item, EntityPlayer player, @SuppressWarnings("rawtypes") List tooltip, - boolean advancedTooltips) { - final Integer toolMode = ItemAdvChainsaw.readToolMode(item); + public void addInformation(ItemStack item, EntityPlayer player, List tooltip, boolean advancedTooltips) { + final int toolMode = ItemAdvChainsaw.readToolMode(item); StringBuilder line = new StringBuilder(); line.append(EnumChatFormatting.GOLD); line.append(StatCollector.translateToLocal("message.text.mode")); @@ -292,8 +288,7 @@ private boolean detectTree(World world, int x, int y, int z, Block wood) { return numLeaves > 3; } - private MixinItemAdvChainsaw(float p_i45333_1_, ToolMaterial p_i45333_2_, - @SuppressWarnings("rawtypes") Set p_i45333_3_) { + private MixinItemAdvChainsaw(float p_i45333_1_, ToolMaterial p_i45333_2_, Set p_i45333_3_) { super(p_i45333_1_, p_i45333_2_, p_i45333_3_); } } diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvDDrill.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvDDrill.java index dfcdc1a..18799c3 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvDDrill.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemAdvDDrill.java @@ -218,7 +218,6 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPl return itemStackIn; } - @SuppressWarnings("unchecked") @Inject( at = @At( remap = false, @@ -226,8 +225,8 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPl value = "INVOKE"), method = "addInformation") @SideOnly(Side.CLIENT) - private void gravisuiteneo$addXPInformation(ItemStack itemstack, EntityPlayer player, - @SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltip, CallbackInfo ci) { + private void gravisuiteneo$addXPInformation(ItemStack itemstack, EntityPlayer player, List tooltip, + boolean advancedTooltip, CallbackInfo ci) { if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return; } @@ -256,11 +255,10 @@ public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPl } } - @SuppressWarnings("unchecked") @Inject(at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILEXCEPTION, method = "addInformation") @SideOnly(Side.CLIENT) - private void gravisuiteneo$addOtherModeInformation(ItemStack itemstack, EntityPlayer player, - @SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci, Integer toolMode) { + private void gravisuiteneo$addOtherModeInformation(ItemStack itemstack, EntityPlayer player, List tooltip, + boolean advancedTooltips, CallbackInfo ci, Integer toolMode) { if (toolMode == 4) { tooltip.add( EnumChatFormatting.GOLD + StatCollector.translateToLocal("message.text.mode") @@ -486,7 +484,7 @@ public void setLevel(ItemStack pItemStack, int pLevel) { LevelableToolHelper.saveToolXP(pItemStack, LevelableToolHelper.getXPForLevel(Math.min(2, pLevel))); } - private MixinItemAdvDDrill(float p_i45333_1_, ToolMaterial p_i45333_2_, Set p_i45333_3_) { + private MixinItemAdvDDrill(float p_i45333_1_, ToolMaterial p_i45333_2_, Set p_i45333_3_) { super(p_i45333_1_, p_i45333_2_, p_i45333_3_); } } diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemGraviChestPlate.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemGraviChestPlate.java index a15adba..0832fbe 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemGraviChestPlate.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemGraviChestPlate.java @@ -15,9 +15,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.gtnewhorizon.mixinextras.injector.ModifyExpressionValue; import com.gtnewhorizons.gravisuiteneo.common.Properties; import com.gtnewhorizons.gravisuiteneo.util.QuantumShieldHelper; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -82,11 +82,10 @@ public class MixinItemGraviChestPlate { QuantumShieldHelper.curePotions(itemStack, player, false); } - @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) @Inject(at = @At("TAIL"), method = "addInformation") - private void gravisuiteneo$addShieldInformation(ItemStack itemStack, EntityPlayer player, - @SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci) { + private void gravisuiteneo$addShieldInformation(ItemStack itemStack, EntityPlayer player, List tooltip, + boolean advancedTooltips, CallbackInfo ci) { String shieldStatus; if (QuantumShieldHelper.readShieldMode(itemStack)) { shieldStatus = EnumChatFormatting.GREEN + StatCollector.translateToLocal("message.text.on"); diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemSimpleItems.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemSimpleItems.java index 9f727a4..159c3b2 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemSimpleItems.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemSimpleItems.java @@ -9,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.gtnewhorizon.mixinextras.injector.ModifyReturnValue; import com.gtnewhorizons.gravisuiteneo.GraviSuiteNeo; +import com.llamalad7.mixinextras.injector.ModifyReturnValue; import gravisuite.ItemSimpleItems; diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemVajra.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemVajra.java index 556d23f..ece05a0 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemVajra.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/mixins/MixinItemVajra.java @@ -47,13 +47,12 @@ public int getHarvestLevel(ItemStack stack, String toolClass) { return 3; } - @SuppressWarnings("unchecked") @SideOnly(Side.CLIENT) @Inject( at = @At(remap = false, target = "Ljava/util/List;add(Ljava/lang/Object;)Z", value = "INVOKE"), method = "addInformation") - private void gravisuiteneo$addSilktouchInformation(ItemStack itemstack, EntityPlayer player, - @SuppressWarnings("rawtypes") List tooltip, boolean advancedTooltips, CallbackInfo ci) { + private void gravisuiteneo$addSilktouchInformation(ItemStack itemstack, EntityPlayer player, List tooltip, + boolean advancedTooltips, CallbackInfo ci) { tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("message.vajra.clickRightForSilk")); } diff --git a/src/main/java/com/gtnewhorizons/gravisuiteneo/util/QuantumShieldHelper.java b/src/main/java/com/gtnewhorizons/gravisuiteneo/util/QuantumShieldHelper.java index d0305ac..3cb8648 100644 --- a/src/main/java/com/gtnewhorizons/gravisuiteneo/util/QuantumShieldHelper.java +++ b/src/main/java/com/gtnewhorizons/gravisuiteneo/util/QuantumShieldHelper.java @@ -229,7 +229,6 @@ public static void curePotions(ItemStack itemstack, EntityPlayer player, boolean if (medkitCure) { // A generic approach to remove *ANY* negative potion effect that is declared as such - @SuppressWarnings("unchecked") Iterator iterator = player.getActivePotionEffects().iterator(); List toRemove = new ArrayList<>();