Void Ward issue & suggested feature fix.
Jayjayx5x1 opened this issue ยท 2 comments
Versions
- Silent Gear: 4.0.19 (haven't tested with 4.0.20)
- Silent's Gems: N/A
- Silent Lib: 10.4.0
- Forge: 21.1.145
- Modpack: FTB Evolution
- Optifine Installed: No
Expected Behavior
Void Ward to activate when in Void.
Actual Behavior
Void Ward activates at Ylvl -64 regardless of actual world boundaries.
This is because of infinity caves which extends the Y-level in overworld to -128 (the code fix I have uses -134)
It's not as simple as changing the Y level tho since it's only the overworld DIM that is -128, the end is still -64, so I had a friend modify the code so that it checks for the DIM the player is in, and if overworld it sets it to -134.
I just like the number -134, even though it's actually -128 that's the new build limit, don't know where the void damage limit is though.
Links/Images
Steps to Reproduce the Problem
- Use infinity caves or other mod that extends the Y-level
- Have Void Ward trait.
- Attempt to go below Ylvl -64.
Code used to fix the problem
Since the issue is because of how void ward is set to check for Y-level, I had my friend modify the code in GearEvents.class to this for me:
Here's text version if it's helpful:
@SubscribeEvent
public static void onPlayerTick(PlayerTickEvent.Pre event) {
Player player = event.getEntity();
if (!player.level().isClientSide) {
if (!player.isEyeInFluidType((FluidType)NeoForgeMod.WATER_TYPE.value()) && TraitHelper.hasTrait(player.getItemBySlot(EquipmentSlot.HEAD), Traits.TURTLE)) {
player.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 210, 0, false, false, true));
}
Holder<DimensionType> dim = player.level().dimensionTypeRegistration();
boolean isOW = dim.is(BuiltinDimensionTypes.OVERWORLD) || dim.is(BuiltinDimensionTypes.OVERWORLD_CAVES);
int yTrg = isOW ? -134 : -64;
if (player.getY() < (double)yTrg && TraitHelper.hasTraitArmor(player, Traits.VOID_WARD)) {
player.push((double)0.0F, (double)10.0F, (double)0.0F);
player.addEffect(new MobEffectInstance(MobEffects.SLOW_FALLING, 400, 3, true, false));
player.addEffect(new MobEffectInstance(MobEffects.LEVITATION, 200, 9, true, false));
}
}
}
Possible Fix via config file.
Since this would be an issue when used with any mod that changes Y-lvl, my suggestion would be a config file where you can change the Y-lvl limit for different dimensions.
Allowing for others to add their own dimensions. (with the default being -64)
That way a problem like this in a modpack, would be as simple as going to the config file and change the OW Y-lvl valule for voidward to -128.
If possible, it could be changed to check for void damage instead of Y-level, but I personally don't think that's the better option. And could be very impractical to code.
Basically just a way for void ward to work with modpacks that have different Y-level limit for the Void.
Me throwing in an edit of why I think it's important
Would be helpful for this modpack and others that have the same issue, since to my knowledge, editing the .jar would violate T&Cs of distribution, so their hands are a bit tied at the moment.
Where as I can just drop in my edited .class file and play. Since I'm using it personally, not for distribution.
Feel free to correct me if I'm wrong on that though. I'm very ignorant when it comes to these things to be honest.
Spent a whole night just trying to open silent gear in IntelliJ, only to have my friend go "Did you look at the readme?"... yeah.... I was that guy.
Duplicate of #787, but thank you for the detailed suggestions. Simply adding a config option might be the easiest fix.



