Fluidlogged API

Fluidlogged API

356k Downloads

[suggestion] Ocean light level increase

xemnes opened this issue ยท 9 comments

commented

ive always found 1.12 oceans extremely dark, no fog decrease mod will ever fix this problem. id love oceans and rivers to be less dark since theyre pitch black. since this mod has already tinkered with the water already, it seems to make sense to suggest it here.
id like to have water more like 1.13 where the light level isnt so harsh underwater (not the fog).
someone suggested it here and did a better job explaining how it should behave vs how it already does in 1.12 https://www.reddit.com/r/mcmodfinder/comments/exyea4/112_mod_to_make_water_lighting_like_113/

commented

ahhh ok lol, no worries. and yeah, that is a rather long time lol. however that code, looks like its the fog and not the light level of the water?

commented

all blocks have a mutable lightOpacity field, which can be changed after the block is registered via the public method Block::setLightOpacity.

Blocks.WATER.setLightOpacity(2)
Blocks.FLOWING_WATER.setLightOpacity(2)

Using 2 here, since that's what the light opacity is for water in 1.13+ (in 1.12 it's 3).

commented

ah ok, where do i put that?
im fairly new to java, i know how to unregister stuff and vaguely know that stuff like that must be put into methods or constructors.

commented

any method that gets called after the vanilla block registration, this is fairly easy with events. The event you'd probably want to use is FMLInitializationEvent.

commented

hmm ok, currently trying to figure out which mod i should embed this into, as ive never actually setup a mod from scratch and looks a little daunting, i guess i could just build fluidlogged and put it inside that.

commented

regarding njarm, when you plan on updating it to be compatible with fluidlogged, will the source code also be available? i plan on removing a lot of the unnecessary duplicate stuff already added by other mods in my modpack.

commented

I would definitely add the water fog to this mod, but it doesn't really fit. This mod tries to only add fluidlogging and do as little as possible outside that. The next update for njarm is planned to be an actual release, and thus will have its source code public! Also, there will be a lot more configuration options, though enabling/disabling every item/block in the mod isn't planned rn. The update won't be out in a few months (probably), college is hard ;-;

edit: here's the code njarm uses to add the water fog, probably easier to add this to a mod than to wait for me to update njarm, then remove duplicate items :)

//under water fog color
@SubscribeEvent(receiveCanceled = true)
public void onRender(FogColors event) {
	if(event.getState().getMaterial() == Material.WATER) {
		final IBlockState state = event.getState();
		final World world = event.getEntity().world;
		final BlockPos pos = new BlockPos(event.getEntity());
		final Vec3d original = new Vec3d(event.getRed(), event.getGreen(), event.getBlue());
		final Vec3d water = Blocks.WATER.getFogColor(world, pos, state, event.getEntity(), original, (float)event.getRenderPartialTicks());
			
		//checks the player's head is under water
		if(original != water) {
			final String id = world.getBiomeForCoordsBody(pos).getRegistryName().toString();
			final Color oldColor = new Color(ColorInit.BlockColor.WATER.colorMultiplier(state, world, pos, 0));
			final Color newColor;

			if(WATER_MAP.containsKey(id)) newColor = new Color(WATER_MAP.get(id));
			else newColor = new Color(BiomeColorHelper.getWaterColorAtPos(world, pos));

			final float[] oldComp = oldColor.getColorComponents(new float[3]);
			final float[] newComp = newColor.getColorComponents(new float[3]);
				
			final float blendR = oldComp[0] * 0.5f + newComp[0] * 0.5f;
			final float blendG = oldComp[1] * 0.5f + newComp[1] * 0.5f;
			final float blendB = oldComp[2] * 0.5f + newComp[2] * 0.5f;
				
			event.setRed(blendR);
			event.setGreen(blendG);
			event.setBlue(blendB);
		}
	}
}
commented

oh ok, i didnt know that existed lol
in what way will it have fluidlogged api support? like... compatibility wise due to crashes?

edit: that is a lot of additions! how much of that can be disabled? specifically the ruby and trees, since i already have 4 other mods in my modpack generating ruby already and i have dynamic trees which it doesnt seem to be compatible with. aswell as the coloured water since i use optifine for that.

commented

My NJARM mod already does this, so I won't add it to this mod. The next version of that mod will have fluidlogged api support (and a whole bunch of other fixes), but that won't be out for a while.