Skip to content

Commit

Permalink
portal + backgroundfog
Browse files Browse the repository at this point in the history
  • Loading branch information
gemsb committed Aug 22, 2024
1 parent 417b9ac commit 18106a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

@Mixin(BackgroundRenderer.class)
public class BackgroundRendererMixin {
private static int spectatorMultiplier = 1;
@Inject(at = @At("TAIL"), method = "applyFog")
private static void afterSetupFog(Camera camera, BackgroundRenderer.FogType fogType, float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) {
CameraSubmersionType cameraSubmersionType = camera.getSubmersionType();
Expand All @@ -45,10 +46,10 @@ private static void afterSetupFog(Camera camera, BackgroundRenderer.FogType fogT
|| ((LivingEntity)entity).hasStatusEffect(StatusEffects.DARKNESS)
)
);

if(entity.isSpectator()){
return;
spectatorMultiplier = 2;
}

if(FabricLoader.getInstance().isModLoaded("distanthorizons")){ //dh compat
if(RenderSystem.getShaderFogStart() == 4.20694194E14F) return;
}
Expand Down Expand Up @@ -82,8 +83,8 @@ private static void afterSetupFog(Camera camera, BackgroundRenderer.FogType fogT
) / ((radius*2+1) * (radius*2+1));

if(y <= -200f) y = -200f;
float start = ((y+256) * (viewDistance/426) * ((float)1/10)) * mul;
float end = (start * 10f ) * mul;
float start = ((y+256) * (viewDistance/426) * ((float)1/10)) * mul * spectatorMultiplier;
float end = (start * 10f ) * mul * spectatorMultiplier;


overrideFog(viewDistance, start, end);
Expand All @@ -93,8 +94,8 @@ private static void afterSetupFog(Camera camera, BackgroundRenderer.FogType fogT

private static void overrideWaterToKryslum(float viewDistance, Entity entity) {
float fogStart, fogEnd;
fogStart = viewDistance * -20.0f * 0.01f;//waterstart
fogEnd = viewDistance * 40.0f * 0.01f;//waterend
fogStart = viewDistance * -20.0f * 0.01f * spectatorMultiplier;//waterstart
fogEnd = viewDistance * 40.0f * 0.01f * spectatorMultiplier;//waterend
if (entity instanceof ClientPlayerEntity) {
ClientPlayerEntity clientPlayerEntity = (ClientPlayerEntity) entity;
RegistryEntry<Biome> biomeHolder = clientPlayerEntity.getWorld().getBiome(clientPlayerEntity.getBlockPos());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/ugi/sculk_depths/portal/PortalFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static BlockPos[] cancelFrameStep(World world, BlockPos[] blockposses){
BlockPos[] newPosArr = new BlockPos[0];
for (BlockPos pos: blockposses) {
BlockPos[] newPos = new BlockPos[0];
if (world.getBlockState(pos).getBlock() != Blocks.REINFORCED_DEEPSLATE) {
if (world.getBlockState(pos).getBlock() == ModBlocks.ACTIVATED_AMALGAMITE) {
world.setBlockState(pos,Blocks.REINFORCED_DEEPSLATE.getDefaultState());
newPos = getNextpos(pos, world, ModBlocks.ACTIVATED_AMALGAMITE);
if (newPos.length == 0){
Expand Down

0 comments on commit 18106a2

Please sign in to comment.