Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config for diving helmet scaling render distance #7917

Open
wants to merge 2 commits into
base: mc1.20.1/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -322,17 +322,14 @@ public static void getFogDensity(ViewportEvent.RenderFog event) {

ItemStack divingHelmet = DivingHelmetItem.getWornItem(entity);
if (!divingHelmet.isEmpty()) {
if (FluidHelper.isWater(fluid)) {
if (FluidHelper.isWater(fluid) && AllConfigs.server().equipment.shouldScaleWaterFogDistance.get()) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this is a very elegant way of solving your issue, as the diving helmet’s increased visibility will now not work in normal ocean biomes if this config is set.

Why is this a server config?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose the config server, because the range of visibility is a gameplay element and an item property. I acted by analogy that if the subject had night vision, for example, I would take it to the config server.
If required, I will put it in the client config. But then in multiplayer, each player will have to turn off this property on their own.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No that’s correct reasoning; but it should just be a biome tag instead as TropheusJ indicated.

event.scaleFarPlaneDistance(6.25f);
event.setCanceled(true);
return;
} else if (FluidHelper.isLava(fluid) && NetheriteDivingHandler.isNetheriteDivingHelmet(divingHelmet)) {
event.setNearPlaneDistance(-4.0f);
event.setFarPlaneDistance(20.0f);
event.setCanceled(true);
return;
}
}
event.setCanceled(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The event.setCanceled call shouldn’t be moved out of the ifs, as that would cancel the event even if Create doesn’t do anything, which will break other mods. (Including Alex’s Caves’ own fog rendering for its fluids)

}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import net.createmod.catnip.config.ConfigBase;

public class CEquipment extends ConfigBase {

public final ConfigInt maxSymmetryWandRange = i(50, 10, "maxSymmetryWandRange", Comments.symmetryRange);
public final ConfigInt placementAssistRange = i(12, 3, "placementAssistRange", Comments.placementRange);
public final ConfigInt toolboxRange = i(10, 1, "toolboxRange", Comments.toolboxRange);
Expand All @@ -13,6 +12,7 @@ public class CEquipment extends ConfigBase {

public final ConfigInt maxExtendoGripActions = i(1000, 0, "maxExtendoGripActions", Comments.maxExtendoGripActions);
public final ConfigInt maxPotatoCannonShots = i(200, 0, "maxPotatoCannonShots", Comments.maxPotatoCannonShots);
public final ConfigBool shouldScaleWaterFogDistance = b(true, "shouldScaleWaterFogDistance", Comments.shouldScaleWaterFogDistance);

// public ConfigInt zapperUndoLogLength = i(10, 0, "zapperUndoLogLength", Comments.zapperUndoLogLength); NYI

Expand All @@ -35,6 +35,8 @@ private static class Comments {
"Amount of free Extendo Grip actions provided by one filled Copper Backtank. Set to 0 makes Extendo Grips unbreakable";
static String maxPotatoCannonShots =
"Amount of free Potato Cannon shots provided by one filled Copper Backtank. Set to 0 makes Potato Cannons unbreakable";
static String shouldScaleWaterFogDistance =
"Scale the underwater visibility range of the diving helmet";
// static String zapperUndoLogLength = "The maximum amount of operations a blockzapper can remember for undoing. (0 to disable undo)";
}

Expand Down