diff --git a/build.gradle b/build.gradle deleted file mode 100644 index e57a16f9..00000000 --- a/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -//version: 1707058017 - -plugins { - id 'com.gtnewhorizons.gtnhconvention' -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..4439e48d --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,3 @@ +plugins { + id("com.gtnewhorizons.gtnhconvention") +} diff --git a/dependencies.gradle b/dependencies.gradle index e784e42b..eb0a8b37 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -23,6 +23,9 @@ dependencies { compileOnly('curse.maven:computercraft-67504:2269339') compileOnly('curse.maven:cofh-core-69162:2388751') + // For testing purposes + //runtimeOnlyNonPublishable("com.github.GTNewHorizons:Electro-Magic-Tools:1.7.6:dev") + runtimeOnly('com.github.GTNewHorizons:TCNEIAdditions:1.5.4:dev') { exclude module: 'Baubles' } diff --git a/gradle.properties b/gradle.properties index 5a63cc68..55e0701c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -43,9 +43,13 @@ developmentEnvironmentUserName = Developer # See https://github.com/bsideup/jabel for details on how this works. enableModernJavaSyntax = true +# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues, +# and should *not* be used in most situations. -1 disables this. +# forceToolchainVersion = -1 + # Enables injecting missing generics into the decompiled source code for a better coding experience. # Turns most publicly visible List, Map, etc. into proper List, Map types. -enableGenericInjection = false +enableGenericInjection = true # Generate a class with a String field for the mod version named as defined below. # If generateGradleTokenClass is empty or not missing, no such class will be generated. @@ -96,7 +100,9 @@ usesMixinDebug = true # Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise. mixinPlugin = -# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail! +# Specify the package that contains all of your Mixins. The package must exist or +# the build will fail. If you have a package property defined in your mixins..json, +# it must match with this or the build will fail. mixinsPackage = mixins # Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin! @@ -172,6 +178,12 @@ curseForgeRelations = # projects. New projects should not use this parameter. # customArchiveBaseName = +# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory. +# runClientWorkingDirectory = run/client + +# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory. +# runServerWorkingDirectory = run/server + # Optional parameter to have the build automatically fail if an illegal version is used. # This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'. # The check is ONLY performed if the version is a git tag. diff --git a/gradle/gradle-daemon-jvm.properties b/gradle/gradle-daemon-jvm.properties new file mode 100644 index 00000000..b612cc98 --- /dev/null +++ b/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,12 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/e1118b4c7c2858d28154d086dbff010e/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/59a9771cad43219260d9aac9a8ec4d6a/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c5ee947fbfb70bc347d8d531e3a578c4/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/5ee463876563a46fff651cce1bc53a4c/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/832229f0f6f0be60ed817c5a5e5848eb/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/b96cb7670c095245220e7d01d5927b58/redirect +toolchainVersion=25 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 9bbc975c..f8e1ee31 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37f853b1..23449a2b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index faf93008..adff685a 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,8 +210,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ - org.gradle.wrapper.GradleWrapperMain \ + -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" # Stop when "xargs" is not available. diff --git a/gradlew.bat b/gradlew.bat index 9d21a218..c4bdd3ab 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -70,11 +70,10 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* :end @rem End local scope for the variables with windows NT shell diff --git a/settings.gradle b/settings.gradle.kts similarity index 66% rename from settings.gradle rename to settings.gradle.kts index 9f80246c..97280c45 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -3,8 +3,8 @@ pluginManagement { repositories { maven { // RetroFuturaGradle - name "GTNH Maven" - url "https://nexus.gtnewhorizons.com/repository/public/" + name = "GTNH Maven" + url = uri("https://nexus.gtnewhorizons.com/repository/public/") mavenContent { includeGroup("com.gtnewhorizons") includeGroupByRegex("com\\.gtnewhorizons\\..+") @@ -17,7 +17,7 @@ pluginManagement { } plugins { - id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43' + id("com.gtnewhorizons.gtnhsettingsconvention") version "2.0.5" } diff --git a/src/main/java/thaumic/tinkerer/client/gui/GuiAnimationTablet.java b/src/main/java/thaumic/tinkerer/client/gui/GuiAnimationTablet.java index 905c4636..73b25e42 100644 --- a/src/main/java/thaumic/tinkerer/client/gui/GuiAnimationTablet.java +++ b/src/main/java/thaumic/tinkerer/client/gui/GuiAnimationTablet.java @@ -38,7 +38,6 @@ public class GuiAnimationTablet extends GuiContainer { int x, y; TileAnimationTablet tablet; - List buttonListAT = new ArrayList<>(); List radioButtons = new ArrayList<>(); public GuiAnimationTablet(TileAnimationTablet tablet, InventoryPlayer playerInv) { @@ -51,25 +50,26 @@ public class GuiAnimationTablet extends GuiContainer { super.initGui(); x = (width - xSize) / 2; y = (height - ySize) / 2; - buttonListAT.clear(); addButton(new GuiButtonAT(0, x + xSize / 2 - 7, y + 60, tablet.redstone)); addButton(new GuiButtonATRadio(1, x + 52, y + 15, tablet.leftClick, radioButtons)); addButton(new GuiButtonATRadio(2, x + 111, y + 15, !tablet.leftClick, radioButtons)); - buttonList = buttonListAT; } private void addButton(GuiButtonAT button) { - buttonListAT.add(button); + buttonList.add(button); if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button); } @Override protected void actionPerformed(GuiButton par1GuiButton) { + var button0 = (GuiButtonAT) buttonList.get(0); if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick(); - else buttonListAT.get(0).buttonEnabled = !buttonListAT.get(0).buttonEnabled; + else { + button0.buttonEnabled = !button0.buttonEnabled; + } - tablet.leftClick = buttonListAT.get(1).buttonEnabled; - tablet.redstone = buttonListAT.get(0).buttonEnabled; + tablet.leftClick = ((GuiButtonAT) buttonList.get(1)).buttonEnabled; + tablet.redstone = button0.buttonEnabled; ThaumicTinkerer.netHandler.sendToServer(new PacketTabletButton(tablet)); } diff --git a/src/main/java/thaumic/tinkerer/client/gui/GuiMobMagnet.java b/src/main/java/thaumic/tinkerer/client/gui/GuiMobMagnet.java index ad5dfc01..3779c4f7 100644 --- a/src/main/java/thaumic/tinkerer/client/gui/GuiMobMagnet.java +++ b/src/main/java/thaumic/tinkerer/client/gui/GuiMobMagnet.java @@ -42,7 +42,6 @@ public class GuiMobMagnet extends GuiContainer { ItemStack stack = null; TileMobMagnet mobMagnet; - List buttonListMM = new ArrayList<>(); List radioButtons = new ArrayList<>(); public GuiMobMagnet(TileMobMagnet tile, InventoryPlayer playerInv) { @@ -55,23 +54,21 @@ public class GuiMobMagnet extends GuiContainer { super.initGui(); x = (width - xSize) / 2; y = (height - ySize) / 2; - buttonListMM.clear(); addButton(new GuiButtonMMRadio(0, x + 100, y + 28, mobMagnet.adult, radioButtons)); addButton(new GuiButtonMMRadio(1, x + 100, y + 48, !mobMagnet.adult, radioButtons)); - buttonList = buttonListMM; } private void addButton(GuiButtonMM button) { - buttonListMM.add(button); + buttonList.add(button); if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button); } @Override protected void actionPerformed(GuiButton par1GuiButton) { if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick(); - else buttonListMM.get(0).enabled = !buttonListMM.get(0).enabled; + else buttonList.get(0).enabled = !buttonList.get(0).enabled; - mobMagnet.adult = buttonListMM.get(0).enabled; + mobMagnet.adult = buttonList.get(0).enabled; ThaumicTinkerer.netHandler.sendToServer(new PacketMobMagnetButton(mobMagnet)); } diff --git a/src/main/java/thaumic/tinkerer/client/gui/GuiRemotePlacer.java b/src/main/java/thaumic/tinkerer/client/gui/GuiRemotePlacer.java index 2647970e..70037271 100644 --- a/src/main/java/thaumic/tinkerer/client/gui/GuiRemotePlacer.java +++ b/src/main/java/thaumic/tinkerer/client/gui/GuiRemotePlacer.java @@ -29,7 +29,6 @@ public class GuiRemotePlacer extends GuiContainer { int x, y; List radioButtons = new ArrayList<>(); - List buttonListRP = new ArrayList<>(); TileRPlacer placer; Aspect aspectHovered = null; @@ -43,23 +42,24 @@ public class GuiRemotePlacer extends GuiContainer { super.initGui(); x = (width - xSize) / 2; y = (height - ySize) / 2; - buttonListRP.clear(); addButton(new GuiButtonRPRadio(0, x + 100, y + 0, placer.blocks == 1, radioButtons)); addButton(new GuiButtonRPRadio(1, x + 100, y + 13, placer.blocks == 2, radioButtons)); addButton(new GuiButtonRPRadio(2, x + 100, y + 26, placer.blocks == 3, radioButtons)); addButton(new GuiButtonRPRadio(3, x + 100, y + 39, placer.blocks == 4, radioButtons)); - buttonList = buttonListRP; } private void addButton(GuiButtonRP button) { - buttonListRP.add(button); + buttonList.add(button); if (button instanceof IRadioButton) radioButtons.add((IRadioButton) button); } @Override protected void actionPerformed(GuiButton par1GuiButton) { - if (par1GuiButton instanceof IRadioButton) ((IRadioButton) par1GuiButton).enableFromClick(); - else buttonListRP.get(0).buttonEnabled = !buttonListRP.get(0).buttonEnabled; + if (par1GuiButton instanceof IRadioButton iRadioButton) iRadioButton.enableFromClick(); + else { + var button0 = (GuiButtonRP) buttonList.get(0); + button0.buttonEnabled = !button0.buttonEnabled; + } placer.blocks = par1GuiButton.id + 1; diff --git a/src/main/java/thaumic/tinkerer/common/compat/EMTCompat.java b/src/main/java/thaumic/tinkerer/common/compat/EMTCompat.java new file mode 100644 index 00000000..3070fe02 --- /dev/null +++ b/src/main/java/thaumic/tinkerer/common/compat/EMTCompat.java @@ -0,0 +1,16 @@ +package thaumic.tinkerer.common.compat; + +import net.minecraft.item.Item; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.registry.GameRegistry; + +public class EMTCompat { + + public static final boolean EMTLoaded = Loader.isModLoaded("EMT"); + public static Item electricHoe; + + public static void init() { + electricHoe = GameRegistry.findItem("EMT", "ElectricHoeGrowth"); + } +} diff --git a/src/main/java/thaumic/tinkerer/common/core/helper/BonemealEventHandler.java b/src/main/java/thaumic/tinkerer/common/core/helper/BonemealEventHandler.java index 56bbae4c..9bddc4f4 100644 --- a/src/main/java/thaumic/tinkerer/common/core/helper/BonemealEventHandler.java +++ b/src/main/java/thaumic/tinkerer/common/core/helper/BonemealEventHandler.java @@ -1,6 +1,8 @@ package thaumic.tinkerer.common.core.helper; -import net.minecraft.block.IGrowable; +import static thaumic.tinkerer.common.compat.EMTCompat.EMTLoaded; + +import net.minecraft.item.ItemStack; import net.minecraftforge.event.entity.player.BonemealEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -8,6 +10,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent; import thaumcraft.common.Thaumcraft; import thaumcraft.common.config.ConfigItems; import thaumic.tinkerer.common.block.BlockInfusedGrain; +import thaumic.tinkerer.common.compat.EMTCompat; import thaumic.tinkerer.common.core.handler.ConfigHandler; /** @@ -26,26 +29,31 @@ public class BonemealEventHandler { } } + public static boolean isMagicHoe(ItemStack stack) { + if (stack == null) return false; + var item = stack.getItem(); + return item == ConfigItems.itemHoeElemental || (EMTLoaded && item == EMTCompat.electricHoe); + } + @SubscribeEvent public void onPlayerInteract(PlayerInteractEvent event) { - if (!event.world.isRemote) { - if (event.world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain) { - if (event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null) { - if (event.entityPlayer.getCurrentEquippedItem().getItem() == ConfigItems.itemHoeElemental) { - IGrowable igrowable = (IGrowable) event.world.getBlock(event.x, event.y, event.z); + var world = event.world; + if (world.isRemote) return; + if (!(world.getBlock(event.x, event.y, event.z) instanceof BlockInfusedGrain igrowable)) return; - if (igrowable.func_149851_a(event.world, event.x, event.y, event.z, event.world.isRemote)) { - if (!event.world.isRemote) { - if (igrowable.func_149852_a(event.world, event.world.rand, event.x, event.y, event.z)) { - igrowable.func_149853_b(event.world, event.world.rand, event.x, event.y, event.z); - } - } - } - event.entityPlayer.getCurrentEquippedItem().damageItem(25, event.entityPlayer); - Thaumcraft.proxy.blockSparkle(event.world, event.x, event.y, event.z, 0, 2); - } - } + var player = event.entityPlayer; + if (player == null) return; + + var hoeOfGrowth = player.getCurrentEquippedItem(); + if (!isMagicHoe(hoeOfGrowth)) return; + + if (igrowable.func_149851_a(world, event.x, event.y, event.z, false)) { + if (igrowable.func_149852_a(world, world.rand, event.x, event.y, event.z)) { + igrowable.func_149853_b(world, world.rand, event.x, event.y, event.z); } } + + hoeOfGrowth.damageItem(25, player); + Thaumcraft.proxy.blockSparkle(world, event.x, event.y, event.z, 0, 2); } } diff --git a/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java b/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java index 76e44929..c973cb00 100644 --- a/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java +++ b/src/main/java/thaumic/tinkerer/common/core/proxy/TTCommonProxy.java @@ -51,6 +51,7 @@ import thaumic.tinkerer.common.ThaumicTinkerer; import thaumic.tinkerer.common.block.tile.TileFunnel; import thaumic.tinkerer.common.block.tile.TileRepairer; import thaumic.tinkerer.common.block.tile.transvector.TileTransvectorInterface; +import thaumic.tinkerer.common.compat.EMTCompat; import thaumic.tinkerer.common.compat.EnderIO; import thaumic.tinkerer.common.compat.FumeTool; import thaumic.tinkerer.common.core.handler.ConfigHandler; @@ -158,6 +159,8 @@ public class TTCommonProxy { } else { ThaumicTinkerer.log.info("Skipping TC Multipart integration"); } + + EMTCompat.init(); } protected void registerPackets() { diff --git a/src/main/java/thaumic/tinkerer/common/item/foci/ItemFocusDeflect.java b/src/main/java/thaumic/tinkerer/common/item/foci/ItemFocusDeflect.java index 0c185d61..5179cde7 100644 --- a/src/main/java/thaumic/tinkerer/common/item/foci/ItemFocusDeflect.java +++ b/src/main/java/thaumic/tinkerer/common/item/foci/ItemFocusDeflect.java @@ -64,7 +64,7 @@ public class ItemFocusDeflect extends ItemModFocus { range = wand.getFocusEnlarge(stack); } - List projectiles = p.worldObj.getEntitiesWithinAABB( + var projectiles = p.worldObj.getEntitiesWithinAABB( IProjectile.class, AxisAlignedBB.getBoundingBox( p.posX - (4 + range), @@ -74,7 +74,9 @@ public class ItemFocusDeflect extends ItemModFocus { p.posY + (3 + range), p.posZ + (3 + range))); - for (Entity e : projectiles) { + for (var projectile : projectiles) { + if (!(projectile instanceof Entity e)) continue; + if (CheckBlackList(e) || ProjectileHelper.getOwner(e) == p) continue; Vector3 motionVec = new Vector3(e.motionX, e.motionY, e.motionZ).normalize().multiply( Math.sqrt( @@ -102,19 +104,11 @@ public class ItemFocusDeflect extends ItemModFocus { @Override public FocusUpgradeType[] getPossibleUpgradesByRank(ItemStack itemstack, int rank) { - switch (rank) { - case 1: - return new FocusUpgradeType[] { FocusUpgradeType.frugal }; - case 2: - return new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge }; - case 3: - return new FocusUpgradeType[] { FocusUpgradeType.frugal }; - case 4: - return new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge }; - case 5: - return new FocusUpgradeType[] { FocusUpgradeType.frugal }; - } - return null; + return switch (rank) { + case 1, 3, 5 -> new FocusUpgradeType[] { FocusUpgradeType.frugal }; + case 2, 4 -> new FocusUpgradeType[] { FocusUpgradeType.frugal, FocusUpgradeType.enlarge }; + default -> null; + }; } private static boolean CheckBlackList(Entity entity) { diff --git a/src/main/java/thaumic/tinkerer/common/item/kami/tool/ItemIchorSwordAdv.java b/src/main/java/thaumic/tinkerer/common/item/kami/tool/ItemIchorSwordAdv.java index 431070ad..b634c781 100644 --- a/src/main/java/thaumic/tinkerer/common/item/kami/tool/ItemIchorSwordAdv.java +++ b/src/main/java/thaumic/tinkerer/common/item/kami/tool/ItemIchorSwordAdv.java @@ -81,7 +81,7 @@ public class ItemIchorSwordAdv extends ItemIchorSword implements IAdvancedTool { break; case 1: { int range = 3; - List entities = player.worldObj.getEntitiesWithinAABB( + var entities = player.worldObj.getEntitiesWithinAABB( entity.getClass(), AxisAlignedBB.getBoundingBox( entity.posX - range,