Skip to content

Commit

Permalink
Fix diving helmet check
Browse files Browse the repository at this point in the history
- Update Flywheel
- Update buildscipt and Gradle
- Bump version
  • Loading branch information
PepperCode1 committed Jun 30, 2023
1 parent b047db0 commit a947a06
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 55 deletions.
16 changes: 11 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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}")
Expand Down Expand Up @@ -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"
}
}
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -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/.
Expand All @@ -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"'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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%

Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/simibubi/create/Create.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,21 @@ public ComputerBehaviour(SmartBlockEntity te) {
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());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -27,19 +25,18 @@ public DivingBootsItem(ArmorMaterial material, Properties properties, ResourceLo
}

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;
}
ItemStack stack = livingEntity.getItemBySlot(SLOT);
if (!(stack.getItem() instanceof DivingBootsItem)) {
return ItemStack.EMPTY;
}
return livingEntity.getItemBySlot(SLOT);
return stack;
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -38,22 +36,19 @@ public boolean canApplyAtEnchantingTable(ItemStack stack, Enchantment enchantmen
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
Expand All @@ -67,8 +62,13 @@ public static void breatheUnderwater(LivingUpdateEvent event) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ public static void getFogDensity(EntityViewRenderEvent.RenderFogEvent event) {
return;

ItemStack divingHelmet = DivingHelmetItem.getWornItem(entity);
if (divingHelmet != null) {
if (!divingHelmet.isEmpty()) {
if (FluidHelper.isWater(fluid)) {
event.scaleFarPlaneDistance(6.25f);
event.setCanceled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ private LavaSwimmingMixin(EntityType<?> type, Level level) {
@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)));
}
}
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/accesstransformer.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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>
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit a947a06

Please sign in to comment.