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' }
}
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"
}
}

View File

@ -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

Binary file not shown.

View File

@ -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

18
gradlew vendored
View File

@ -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.

15
gradlew.bat vendored
View File

@ -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

View File

@ -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();

View File

@ -35,21 +35,21 @@ public class ComputerBehaviour extends AbstractComputerBehaviour {
this.peripheralSupplier = getPeripheralFor(te);
}
public static NonNullSupplier<IPeripheral> getPeripheralFor(SmartBlockEntity te) {
if (te instanceof SpeedControllerBlockEntity scbe)
public static NonNullSupplier<IPeripheral> 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());
}

View File

@ -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

View File

@ -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;

View File

@ -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);

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))
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)));
}
}

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.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]]
modId="flywheel"
mandatory=true
versionRange="[0.6.8,0.6.9)"
versionRange="[0.6.9,0.6.10)"
ordering="AFTER"
side="CLIENT"