Skip to content

Commit

Permalink
Add voidDamageAboveWorld config option
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaider10 committed Oct 23, 2021
1 parent 47eb303 commit 1bb3c6b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ public class GravityChangerConfig implements ConfigData {
count = 2
)
public boolean resetGravityOnRespawn = true;

@ConfigEntry.Gui.Tooltip(
count = 2
)
public boolean voidDamageAboveWorld = true;
}
13 changes: 13 additions & 0 deletions src/main/java/me/andrew/gravitychanger/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.andrew.gravitychanger.mixin;

import me.andrew.gravitychanger.GravityChangerMod;
import me.andrew.gravitychanger.accessor.EntityAccessor;
import me.andrew.gravitychanger.accessor.RotatableEntityAccessor;
import me.andrew.gravitychanger.util.RotationUtil;
Expand Down Expand Up @@ -171,6 +172,8 @@ public abstract class EntityMixin implements EntityAccessor {

@Shadow public abstract void addVelocity(double deltaX, double deltaY, double deltaZ);

@Shadow protected abstract void tickInVoid();

@Override
public Direction gravitychanger$getAppliedGravityDirection() {
return Direction.DOWN;
Expand Down Expand Up @@ -722,4 +725,14 @@ private void inject_pushAwayFrom(Entity entity, CallbackInfo ci) {
}
}
}

@Inject(
method = "attemptTickInVoid",
at = @At("HEAD")
)
private void inject_attemptTickInVoid(CallbackInfo ci) {
if (GravityChangerMod.config.voidDamageAboveWorld && this.getY() > (double)(this.world.getTopY() + 256)) {
this.tickInVoid();
}
}
}
5 changes: 4 additions & 1 deletion src/main/resources/assets/gravitychanger/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@
"text.autoconfig.gravitychanger.option.resetGravityOnDimensionChange.@Tooltip[1]": "to DOWN every time you change dimension",
"text.autoconfig.gravitychanger.option.resetGravityOnRespawn": "Reset Gravity On Respawn",
"text.autoconfig.gravitychanger.option.resetGravityOnRespawn.@Tooltip[0]": "Makes it so that your gravity is reset",
"text.autoconfig.gravitychanger.option.resetGravityOnRespawn.@Tooltip[1]": "to DOWN every time you respawn"
"text.autoconfig.gravitychanger.option.resetGravityOnRespawn.@Tooltip[1]": "to DOWN every time you respawn",
"text.autoconfig.gravitychanger.option.voidDamageAboveWorld": "Void Damage Above World",
"text.autoconfig.gravitychanger.option.voidDamageAboveWorld.@Tooltip[0]": "Makes it so that you start taking void damage",
"text.autoconfig.gravitychanger.option.voidDamageAboveWorld.@Tooltip[1]": "if you are above y = max_world_height + 256"
}

0 comments on commit 1bb3c6b

Please sign in to comment.