From 12920cdf8d701a453cb2ed7db00fdd0342ca8161 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 25 Mar 2020 11:23:09 -0400 Subject: [PATCH] 1.0.9 Disable Instant Nether Portal In Creative --- CHANGELOG.md | 3 +++ README.md | 1 + build.gradle | 9 +++++---- gradle.properties | 2 +- .../com/thebrokenrail/slightlyvanilla/ModConfig.java | 1 + .../slightlyvanilla/mixin/MixinPlayerEntity.java | 12 ++++++++++++ .../resources/assets/slightlyvanilla/lang/en_us.json | 1 + 7 files changed, 24 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0aacf1..f8c1aa3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**1.0.9** +* Disable Instant Nether Portal In Creative + **1.0.8** * Play Throw Sound diff --git a/README.md b/README.md index 628549a..9947adb 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Suggest more tweaks in the issue tracker! * Open Loot Chests In Spectator Mode * Crying Obsidian Nether Portal * Allow Leashing Villagers +* Disable Instant Nether Portal In Creative ## Changelog [View Changelog](CHANGELOG.md) diff --git a/build.gradle b/build.gradle index f100ff0..f0de6fd 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,8 @@ compileJava { } archivesBaseName = project.archives_base_name -version = project.mod_version as Object +def mod_version = project.mod_version as Object +version = "${mod_version}+${project.minecraft_version}" group = project.maven_group as Object minecraft { @@ -36,12 +37,12 @@ dependencies { } processResources { - inputs.property 'version', version + inputs.property 'version', mod_version inputs.property 'name', rootProject.name from(sourceSets.main.resources.srcDirs) { include 'fabric.mod.json' - expand 'version': version, 'name': rootProject.name + expand 'version': mod_version, 'name': rootProject.name } from(sourceSets.main.resources.srcDirs) { @@ -88,7 +89,7 @@ if (project.hasProperty('curseforge.api_key')) { addGameVersion project.simple_minecraft_version addGameVersion 'Fabric' mainArtifact(remapJar) { - displayName = "SlightlyVanilla v${version} for ${project.minecraft_version}" + displayName = "SlightlyVanilla v${mod_version} for ${project.minecraft_version}" } afterEvaluate { uploadTask.dependsOn('remapJar') diff --git a/gradle.properties b/gradle.properties index 0119ba8..6da063e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.7.8+build.189 # Mod Properties - mod_version = 1.0.8 + mod_version = 1.0.9 maven_group = com.thebrokenrail archives_base_name = slightlyvanilla diff --git a/src/main/java/com/thebrokenrail/slightlyvanilla/ModConfig.java b/src/main/java/com/thebrokenrail/slightlyvanilla/ModConfig.java index fd4f00c..7d0a815 100644 --- a/src/main/java/com/thebrokenrail/slightlyvanilla/ModConfig.java +++ b/src/main/java/com/thebrokenrail/slightlyvanilla/ModConfig.java @@ -15,6 +15,7 @@ public class ModConfig implements ConfigData { public boolean openLootChestsInSpectatorMode = true; public boolean cryingObsidianNetherPortal = true; public boolean allowLeashingVillagers = true; + public boolean disableInstantNetherPortalInCreative = true; public static class ThrowableOption { public boolean player; diff --git a/src/main/java/com/thebrokenrail/slightlyvanilla/mixin/MixinPlayerEntity.java b/src/main/java/com/thebrokenrail/slightlyvanilla/mixin/MixinPlayerEntity.java index 139e182..584f18e 100644 --- a/src/main/java/com/thebrokenrail/slightlyvanilla/mixin/MixinPlayerEntity.java +++ b/src/main/java/com/thebrokenrail/slightlyvanilla/mixin/MixinPlayerEntity.java @@ -2,10 +2,13 @@ package com.thebrokenrail.slightlyvanilla.mixin; import com.thebrokenrail.slightlyvanilla.SlightlyVanilla; import net.minecraft.entity.damage.DamageSource; +import net.minecraft.entity.player.PlayerAbilities; import net.minecraft.entity.player.PlayerEntity; +import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.Redirect; @SuppressWarnings("unused") @Mixin(PlayerEntity.class) @@ -19,4 +22,13 @@ public class MixinPlayerEntity { return amount; } } + + @Redirect(at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/player/PlayerAbilities;invulnerable:Z"), method = "getMaxNetherPortalTime") + public boolean adjustMaxNetherPortalTime(PlayerAbilities playerAbilities) { + if (SlightlyVanilla.getConfig().disableInstantNetherPortalInCreative) { + return false; + } else { + return playerAbilities.invulnerable; + } + } } diff --git a/src/main/resources/assets/slightlyvanilla/lang/en_us.json b/src/main/resources/assets/slightlyvanilla/lang/en_us.json index cbc6302..8bc83dc 100644 --- a/src/main/resources/assets/slightlyvanilla/lang/en_us.json +++ b/src/main/resources/assets/slightlyvanilla/lang/en_us.json @@ -11,6 +11,7 @@ "text.autoconfig.slightlyvanilla.option.openLootChestsInSpectatorMode": "Open Loot Chests In Spectator Mode", "text.autoconfig.slightlyvanilla.option.cryingObsidianNetherPortal": "Crying Obsidian Nether Portal", "text.autoconfig.slightlyvanilla.option.allowLeashingVillagers": "Allow Leashing Villagers", + "text.autoconfig.slightlyvanilla.option.disableInstantNetherPortalInCreative": "Disable Instant Nether Portal In Creative", "entity.slightlyvanilla.slimeball": "Slimeball", "entity.slightlyvanilla.spawn_egg": "Spawn Egg" } \ No newline at end of file