diff --git a/build.gradle b/build.gradle index ac45dd65c..5671c4535 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { maven { url = 'https://maven.parchmentmc.org' } } dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forgegradle_version}", changing: false + classpath "net.minecraftforge.gradle:ForgeGradle:${forgegradle_version}" classpath "org.spongepowered:mixingradle:${mixingradle_version}" classpath "org.parchmentmc:librarian:${librarian_version}" } @@ -37,9 +37,15 @@ version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '') java.toolchain.languageVersion = JavaLanguageVersion.of(17) -println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) +println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + ' (' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) + minecraft { - mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + if (Boolean.parseBoolean(project.use_parchment)) { + mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}" + } else { + mappings channel: 'official', version: "${minecraft_version}" + } + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') runs { @@ -165,7 +171,7 @@ dependencies { jarJar.ranged(it, '[MC1.18.2-1.1.3,)') } jarJar("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") { - jarJar.ranged(it, '[0.6.8,0.6.9)') + jarJar.ranged(it, '[0.6.9,0.6.10)') } implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") @@ -199,7 +205,7 @@ dependencies { // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // This allows 'Settings > Build, Execution, and Deployment > Build Tools > Gradle > Build and run using' set to IntelliJ to work correctly - if (System.getProperty('idea.sync.active') != 'true') { + if (!Boolean.getBoolean('idea.sync.active')) { annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" } } diff --git a/gradle.properties b/gradle.properties index 96fed69b3..4fbade479 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G org.gradle.daemon = false # mod version info -mod_version = 0.5.1.b +mod_version = 0.5.1.c artifact_minecraft_version = 1.18.2 minecraft_version = 1.18.2 @@ -18,10 +18,12 @@ librarian_version = 1.+ cursegradle_version = 1.4.0 parchment_version = 2022.11.06 +use_parchment = true + # dependency versions registrate_version = MC1.18.2-1.1.3 flywheel_minecraft_version = 1.18.2 -flywheel_version = 0.6.8.a-99 +flywheel_version = 0.6.9-100 jei_minecraft_version = 1.18.2 jei_version = 9.7.0.209 curios_minecraft_version = 1.18.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a4..943f0cbfa 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 aa991fcea..508322917 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c78733..65dcd68d6 100755 --- a/gradlew +++ b/gradlew @@ -55,7 +55,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -80,10 +80,10 @@ do esac done -APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit - -APP_NAME="Gradle" +# This is normally unused +# shellcheck disable=SC2034 APP_BASE_NAME=${0##*/} +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' @@ -143,12 +143,16 @@ fi if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac case $MAX_FD in #( '' | soft) :;; #( *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -205,6 +209,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32c..93e3f59f1 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,8 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 7a26283fd..7dcb3da68 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -69,7 +69,7 @@ public class Create { public static final String ID = "create"; public static final String NAME = "Create"; - public static final String VERSION = "0.5.1b"; + public static final String VERSION = "0.5.1c"; public static final Logger LOGGER = LogUtils.getLogger(); diff --git a/src/main/java/com/simibubi/create/compat/computercraft/implementation/ComputerBehaviour.java b/src/main/java/com/simibubi/create/compat/computercraft/implementation/ComputerBehaviour.java index 769de33ae..e33cc4a9d 100644 --- a/src/main/java/com/simibubi/create/compat/computercraft/implementation/ComputerBehaviour.java +++ b/src/main/java/com/simibubi/create/compat/computercraft/implementation/ComputerBehaviour.java @@ -35,21 +35,21 @@ public class ComputerBehaviour extends AbstractComputerBehaviour { this.peripheralSupplier = getPeripheralFor(te); } - public static NonNullSupplier getPeripheralFor(SmartBlockEntity te) { - if (te instanceof SpeedControllerBlockEntity scbe) + public static NonNullSupplier getPeripheralFor(SmartBlockEntity be) { + if (be instanceof SpeedControllerBlockEntity scbe) return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed); - if (te instanceof DisplayLinkBlockEntity dlbe) + if (be instanceof DisplayLinkBlockEntity dlbe) return () -> new DisplayLinkPeripheral(dlbe); - if (te instanceof SequencedGearshiftBlockEntity sgbe) + if (be instanceof SequencedGearshiftBlockEntity sgbe) return () -> new SequencedGearshiftPeripheral(sgbe); - if (te instanceof SpeedGaugeBlockEntity sgbe) + if (be instanceof SpeedGaugeBlockEntity sgbe) return () -> new SpeedGaugePeripheral(sgbe); - if (te instanceof StressGaugeBlockEntity sgbe) + if (be instanceof StressGaugeBlockEntity sgbe) return () -> new StressGaugePeripheral(sgbe); - if (te instanceof StationBlockEntity sbe) + if (be instanceof StationBlockEntity sbe) return () -> new StationPeripheral(sbe); - throw new IllegalArgumentException("No peripheral available for " + te.getType() + throw new IllegalArgumentException("No peripheral available for " + be.getType() .getRegistryName()); } diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java index 3d62f6765..97f535c67 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingBootsItem.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.equipment.armor; -import org.jetbrains.annotations.Nullable; - import com.simibubi.create.foundation.utility.NBTHelper; import net.minecraft.resources.ResourceLocation; @@ -27,19 +25,18 @@ public class DivingBootsItem extends BaseArmorItem { } public static boolean isWornBy(Entity entity) { - ItemStack stack = getWornItem(entity); - if (stack == null) { - return false; - } - return stack.getItem() instanceof DivingBootsItem; + return !getWornItem(entity).isEmpty(); } - @Nullable public static ItemStack getWornItem(Entity entity) { if (!(entity instanceof LivingEntity livingEntity)) { - return null; + return ItemStack.EMPTY; } - return livingEntity.getItemBySlot(SLOT); + ItemStack stack = livingEntity.getItemBySlot(SLOT); + if (!(stack.getItem() instanceof DivingBootsItem)) { + return ItemStack.EMPTY; + } + return stack; } @SubscribeEvent diff --git a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java index 3f8f6e1c0..f51c0ec18 100644 --- a/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java +++ b/src/main/java/com/simibubi/create/content/equipment/armor/DivingHelmetItem.java @@ -1,7 +1,5 @@ package com.simibubi.create.content.equipment.armor; -import org.jetbrains.annotations.Nullable; - import com.simibubi.create.foundation.advancement.AllAdvancements; import net.minecraft.resources.ResourceLocation; @@ -38,22 +36,19 @@ public class DivingHelmetItem extends BaseArmorItem { return super.canApplyAtEnchantingTable(stack, enchantment); } - public static boolean isWornBy(Entity entity, boolean fireproof) { - ItemStack stack = getWornItem(entity); - if (stack == null) - return false; - if (!stack.getItem() - .isFireResistant() && fireproof) - return false; - return stack.getItem() instanceof DivingHelmetItem; + public static boolean isWornBy(Entity entity) { + return !getWornItem(entity).isEmpty(); } - @Nullable public static ItemStack getWornItem(Entity entity) { if (!(entity instanceof LivingEntity livingEntity)) { - return null; + return ItemStack.EMPTY; } - return livingEntity.getItemBySlot(SLOT); + ItemStack stack = livingEntity.getItemBySlot(SLOT); + if (!(stack.getItem() instanceof DivingHelmetItem)) { + return ItemStack.EMPTY; + } + return stack; } @SubscribeEvent @@ -67,8 +62,13 @@ public class DivingHelmetItem extends BaseArmorItem { entity.getPersistentData() .remove("VisualBacktankAir"); + ItemStack helmet = getWornItem(entity); + if (helmet.isEmpty()) + return; + boolean lavaDiving = entity.isInLava(); - if (!isWornBy(entity, lavaDiving)) + if (!helmet.getItem() + .isFireResistant() && lavaDiving) return; if (!entity.isEyeInFluid(FluidTags.WATER) && !lavaDiving) return; diff --git a/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java b/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java index 807325ce8..a7bbd6ac1 100644 --- a/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/foundation/events/ClientEvents.java @@ -311,7 +311,7 @@ public class ClientEvents { return; ItemStack divingHelmet = DivingHelmetItem.getWornItem(entity); - if (divingHelmet != null) { + if (!divingHelmet.isEmpty()) { if (FluidHelper.isWater(fluid)) { event.scaleFarPlaneDistance(6.25f); event.setCanceled(true); diff --git a/src/main/java/com/simibubi/create/foundation/mixin/LavaSwimmingMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/LavaSwimmingMixin.java index 6156c68b8..b09cb7273 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/LavaSwimmingMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/LavaSwimmingMixin.java @@ -26,7 +26,7 @@ public abstract class LavaSwimmingMixin extends Entity { @Inject(method = "travel(Lnet/minecraft/world/phys/Vec3;)V", slice = @Slice(from = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isInLava()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;move(Lnet/minecraft/world/entity/MoverType;Lnet/minecraft/world/phys/Vec3;)V", shift = Shift.AFTER, ordinal = 0)) private void create$onLavaTravel(Vec3 travelVector, CallbackInfo ci) { ItemStack bootsStack = DivingBootsItem.getWornItem(this); - if (bootsStack != null && AllItems.NETHERITE_DIVING_BOOTS.isIn(bootsStack)) + if (AllItems.NETHERITE_DIVING_BOOTS.isIn(bootsStack)) setDeltaMovement(getDeltaMovement().multiply(DivingBootsItem.getMovementMultiplier((LivingEntity) (Object) this))); } } diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg index 80e9c4ffb..a911f646d 100644 --- a/src/main/resources/META-INF/accesstransformer.cfg +++ b/src/main/resources/META-INF/accesstransformer.cfg @@ -41,4 +41,4 @@ public net.minecraft.client.model.AgeableListModel f_102011_ # babyBodyScale public net.minecraft.client.model.AgeableListModel f_102012_ # bodyYOffset public net.minecraft.client.gui.components.CommandSuggestions f_93866_ # suggestions -public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList (Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V # \ No newline at end of file +public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList (Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V # diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml index d920a5943..0cb21ffad 100644 --- a/src/main/resources/META-INF/mods.toml +++ b/src/main/resources/META-INF/mods.toml @@ -33,6 +33,6 @@ Technology that empowers the player.''' [[dependencies.create]] modId="flywheel" mandatory=true - versionRange="[0.6.8,0.6.9)" + versionRange="[0.6.9,0.6.10)" ordering="AFTER" side="CLIENT"