Fix diving helmet check

- Update Flywheel
- Update buildscipt and Gradle
- Bump version
This commit is contained in:
PepperCode1 2023-06-30 14:12:48 -07:00
parent b047db0ecf
commit a947a06263
14 changed files with 74 additions and 55 deletions

View file

@ -7,7 +7,7 @@ buildscript {
maven { url = 'https://maven.parchmentmc.org' } maven { url = 'https://maven.parchmentmc.org' }
} }
dependencies { 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.spongepowered:mixingradle:${mixingradle_version}"
classpath "org.parchmentmc:librarian:${librarian_version}" classpath "org.parchmentmc:librarian:${librarian_version}"
} }
@ -37,9 +37,15 @@ version = mod_version + (dev && buildNumber != null ? "-${buildNumber}" : '')
java.toolchain.languageVersion = JavaLanguageVersion.of(17) 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 { 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') accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs { runs {
@ -165,7 +171,7 @@ dependencies {
jarJar.ranged(it, '[MC1.18.2-1.1.3,)') jarJar.ranged(it, '[MC1.18.2-1.1.3,)')
} }
jarJar("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") { 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}") implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
@ -199,7 +205,7 @@ dependencies {
// https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497 // https://discord.com/channels/313125603924639766/725850371834118214/910619168821354497
// Prevent Mixin annotation processor from getting into IntelliJ's annotation processor settings // 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 // 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" annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
} }
} }

View file

@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false org.gradle.daemon = false
# mod version info # mod version info
mod_version = 0.5.1.b mod_version = 0.5.1.c
artifact_minecraft_version = 1.18.2 artifact_minecraft_version = 1.18.2
minecraft_version = 1.18.2 minecraft_version = 1.18.2
@ -18,10 +18,12 @@ librarian_version = 1.+
cursegradle_version = 1.4.0 cursegradle_version = 1.4.0
parchment_version = 2022.11.06 parchment_version = 2022.11.06
use_parchment = true
# dependency versions # dependency versions
registrate_version = MC1.18.2-1.1.3 registrate_version = MC1.18.2-1.1.3
flywheel_minecraft_version = 1.18.2 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_minecraft_version = 1.18.2
jei_version = 9.7.0.209 jei_version = 9.7.0.209
curios_minecraft_version = 1.18.2 curios_minecraft_version = 1.18.2

Binary file not shown.

View file

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

18
gradlew vendored
View file

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (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. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,10 +80,10 @@ do
esac esac
done done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit # This is normally unused
# shellcheck disable=SC2034
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/} 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. # 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"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) 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 ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | 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" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -205,6 +209,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ 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. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View file

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%" == "" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=. if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute if %ERRORLEVEL% equ 0 goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 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 :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd if %ERRORLEVEL% equ 0 goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 set EXIT_CODE=%ERRORLEVEL%
exit /b 1 if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View file

@ -69,7 +69,7 @@ public class Create {
public static final String ID = "create"; public static final String ID = "create";
public static final String NAME = "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(); public static final Logger LOGGER = LogUtils.getLogger();

View file

@ -35,21 +35,21 @@ public class ComputerBehaviour extends AbstractComputerBehaviour {
this.peripheralSupplier = getPeripheralFor(te); this.peripheralSupplier = getPeripheralFor(te);
} }
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) { public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity be) {
if (te instanceof SpeedControllerBlockEntity scbe) if (be instanceof SpeedControllerBlockEntity scbe)
return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed); return () -> new SpeedControllerPeripheral(scbe, scbe.targetSpeed);
if (te instanceof DisplayLinkBlockEntity dlbe) if (be instanceof DisplayLinkBlockEntity dlbe)
return () -> new DisplayLinkPeripheral(dlbe); return () -> new DisplayLinkPeripheral(dlbe);
if (te instanceof SequencedGearshiftBlockEntity sgbe) if (be instanceof SequencedGearshiftBlockEntity sgbe)
return () -> new SequencedGearshiftPeripheral(sgbe); return () -> new SequencedGearshiftPeripheral(sgbe);
if (te instanceof SpeedGaugeBlockEntity sgbe) if (be instanceof SpeedGaugeBlockEntity sgbe)
return () -> new SpeedGaugePeripheral(sgbe); return () -> new SpeedGaugePeripheral(sgbe);
if (te instanceof StressGaugeBlockEntity sgbe) if (be instanceof StressGaugeBlockEntity sgbe)
return () -> new StressGaugePeripheral(sgbe); return () -> new StressGaugePeripheral(sgbe);
if (te instanceof StationBlockEntity sbe) if (be instanceof StationBlockEntity sbe)
return () -> new StationPeripheral(sbe); return () -> new StationPeripheral(sbe);
throw new IllegalArgumentException("No peripheral available for " + te.getType() throw new IllegalArgumentException("No peripheral available for " + be.getType()
.getRegistryName()); .getRegistryName());
} }

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.equipment.armor; package com.simibubi.create.content.equipment.armor;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTHelper;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -27,19 +25,18 @@ public class DivingBootsItem extends BaseArmorItem {
} }
public static boolean isWornBy(Entity entity) { public static boolean isWornBy(Entity entity) {
ItemStack stack = getWornItem(entity); return !getWornItem(entity).isEmpty();
if (stack == null) {
return false;
}
return stack.getItem() instanceof DivingBootsItem;
} }
@Nullable
public static ItemStack getWornItem(Entity entity) { public static ItemStack getWornItem(Entity entity) {
if (!(entity instanceof LivingEntity livingEntity)) { 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 @SubscribeEvent

View file

@ -1,7 +1,5 @@
package com.simibubi.create.content.equipment.armor; package com.simibubi.create.content.equipment.armor;
import org.jetbrains.annotations.Nullable;
import com.simibubi.create.foundation.advancement.AllAdvancements; import com.simibubi.create.foundation.advancement.AllAdvancements;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
@ -38,22 +36,19 @@ public class DivingHelmetItem extends BaseArmorItem {
return super.canApplyAtEnchantingTable(stack, enchantment); return super.canApplyAtEnchantingTable(stack, enchantment);
} }
public static boolean isWornBy(Entity entity, boolean fireproof) { public static boolean isWornBy(Entity entity) {
ItemStack stack = getWornItem(entity); return !getWornItem(entity).isEmpty();
if (stack == null)
return false;
if (!stack.getItem()
.isFireResistant() && fireproof)
return false;
return stack.getItem() instanceof DivingHelmetItem;
} }
@Nullable
public static ItemStack getWornItem(Entity entity) { public static ItemStack getWornItem(Entity entity) {
if (!(entity instanceof LivingEntity livingEntity)) { 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 @SubscribeEvent
@ -67,8 +62,13 @@ public class DivingHelmetItem extends BaseArmorItem {
entity.getPersistentData() entity.getPersistentData()
.remove("VisualBacktankAir"); .remove("VisualBacktankAir");
ItemStack helmet = getWornItem(entity);
if (helmet.isEmpty())
return;
boolean lavaDiving = entity.isInLava(); boolean lavaDiving = entity.isInLava();
if (!isWornBy(entity, lavaDiving)) if (!helmet.getItem()
.isFireResistant() && lavaDiving)
return; return;
if (!entity.isEyeInFluid(FluidTags.WATER) && !lavaDiving) if (!entity.isEyeInFluid(FluidTags.WATER) && !lavaDiving)
return; return;

View file

@ -311,7 +311,7 @@ public class ClientEvents {
return; return;
ItemStack divingHelmet = DivingHelmetItem.getWornItem(entity); ItemStack divingHelmet = DivingHelmetItem.getWornItem(entity);
if (divingHelmet != null) { if (!divingHelmet.isEmpty()) {
if (FluidHelper.isWater(fluid)) { if (FluidHelper.isWater(fluid)) {
event.scaleFarPlaneDistance(6.25f); event.scaleFarPlaneDistance(6.25f);
event.setCanceled(true); event.setCanceled(true);

View file

@ -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)) @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) { private void create$onLavaTravel(Vec3 travelVector, CallbackInfo ci) {
ItemStack bootsStack = DivingBootsItem.getWornItem(this); 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))); setDeltaMovement(getDeltaMovement().multiply(DivingBootsItem.getMovementMultiplier((LivingEntity) (Object) this)));
} }
} }

View file

@ -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.model.AgeableListModel f_102012_ # bodyYOffset
public net.minecraft.client.gui.components.CommandSuggestions f_93866_ # suggestions public net.minecraft.client.gui.components.CommandSuggestions f_93866_ # suggestions
public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList <init>(Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V # <init> public net.minecraft.client.gui.components.CommandSuggestions$SuggestionsList <init>(Lnet/minecraft/client/gui/components/CommandSuggestions;IIILjava/util/List;Z)V # <init>

View file

@ -33,6 +33,6 @@ Technology that empowers the player.'''
[[dependencies.create]] [[dependencies.create]]
modId="flywheel" modId="flywheel"
mandatory=true mandatory=true
versionRange="[0.6.8,0.6.9)" versionRange="[0.6.9,0.6.10)"
ordering="AFTER" ordering="AFTER"
side="CLIENT" side="CLIENT"