Skip to content

Commit

Permalink
paradise void kill gamerule
Browse files Browse the repository at this point in the history
  • Loading branch information
MBatt1 committed Nov 12, 2024
1 parent d9052a6 commit 6711f20
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ val cardinalComponentsVersion: String by properties
val crowdinTranslateVersion: String by properties
val modmenuVersion: String by properties
val satinVersion: String by properties
val clothConfigVersion: String by properties

plugins {
id("fabric-loom") version "1.7-SNAPSHOT"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import static net.id.paradiselost.world.ParadiseLostGameRules.PARADISE_VOID_KILLS;

@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin extends LivingEntity implements ParadiseLostEntityExtensions {

Expand All @@ -48,7 +50,7 @@ public PlayerEntityMixin(EntityType<? extends LivingEntity> type, World world) {
cancellable = true
)
public void damage(DamageSource source, float amount, CallbackInfoReturnable<Boolean> cir) {
if (source == getWorld().getDamageSources().outOfWorld() && getY() < getWorld().getBottomY() - 1 && getWorld().getRegistryKey() == ParadiseLostDimension.PARADISE_LOST_WORLD_KEY) {
if (source == getWorld().getDamageSources().outOfWorld() && getY() < getWorld().getBottomY() - 1 && getWorld().getRegistryKey() == ParadiseLostDimension.PARADISE_LOST_WORLD_KEY && !getWorld().getGameRules().getBoolean(PARADISE_VOID_KILLS)) {
if (!getWorld().isClient()) {
setParadiseLostFallen(true);
ServerWorld overworld = getServer().getWorld(World.OVERWORLD);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
package net.id.paradiselost.world;

import net.fabricmc.fabric.api.gamerule.v1.GameRuleFactory;
import net.fabricmc.fabric.api.gamerule.v1.GameRuleRegistry;
import net.minecraft.world.GameRules;

public class ParadiseLostGameRules {

public static void init() {
// N/A
}

public static final GameRules.Key<GameRules.BooleanRule> PARADISE_VOID_KILLS = GameRuleRegistry.register("paradiseVoidKills", GameRules.Category.PLAYER, GameRuleFactory.createBooleanRule(false));


}
3 changes: 3 additions & 0 deletions src/main/resources/assets/paradise_lost/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,9 @@
"subtitles.paradise_lost.item.armor.equip.surtrum": "Surtrum armor clunks",

"subtitles.paradise_lost.item.bloodstone.prick": "Bloodstone pricks",


"gamerule.paradiseVoidKills": "Paradise Lost's void kills players",


"tag.item.paradise_lost.aurel_logs": "Aurel Logs",
Expand Down

0 comments on commit 6711f20

Please sign in to comment.