Skip to content

Commit

Permalink
Fix Clouds being visible in the Spatial Storage Dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte committed Jan 7, 2024
1 parent 93a562f commit db8f155
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 103 deletions.
10 changes: 10 additions & 0 deletions src/main/java/appeng/core/AppEngClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
import net.minecraftforge.client.event.RegisterClientTooltipComponentFactoriesEvent;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.client.event.RegisterDimensionSpecialEffectsEvent;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
import net.minecraftforge.common.MinecraftForge;
Expand Down Expand Up @@ -94,6 +95,8 @@
import appeng.init.client.InitStackRenderHandlers;
import appeng.items.storage.StorageCellTooltipComponent;
import appeng.siteexport.SiteExporter;
import appeng.spatial.SpatialStorageDimensionIds;
import appeng.spatial.SpatialStorageSkyProperties;
import appeng.util.InteractionUtil;
import appeng.util.Platform;

Expand Down Expand Up @@ -129,6 +132,7 @@ public AppEngClient() {
modEventBus.addListener(this::registerEntityRenderers);
modEventBus.addListener(this::registerEntityLayerDefinitions);
modEventBus.addListener(this::registerHotkeys);
modEventBus.addListener(this::registerDimensionSpecialEffects);

BlockAttackHook.install();
RenderBlockOutlineHook.install();
Expand Down Expand Up @@ -158,6 +162,12 @@ public AppEngClient() {
});
}

private void registerDimensionSpecialEffects(RegisterDimensionSpecialEffectsEvent event) {
event.register(
SpatialStorageDimensionIds.DIMENSION_TYPE_ID.location(),
SpatialStorageSkyProperties.INSTANCE);
}

private void registerClientCommands() {
MinecraftForge.EVENT_BUS.addListener((RegisterClientCommandsEvent evt) -> {
var dispatcher = evt.getDispatcher();
Expand Down
46 changes: 0 additions & 46 deletions src/main/java/appeng/mixins/spatial/SkyPropertiesMixin.java

This file was deleted.

52 changes: 0 additions & 52 deletions src/main/java/appeng/mixins/spatial/SkyRenderMixin.java

This file was deleted.

26 changes: 23 additions & 3 deletions src/main/java/appeng/spatial/SpatialStorageSkyProperties.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@

package appeng.spatial;

import com.mojang.blaze3d.vertex.PoseStack;

import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;

import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.DimensionSpecialEffects;
import net.minecraft.client.renderer.DimensionSpecialEffects.SkyType;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import appeng.client.render.SpatialSkyRender;

/**
* Defines properties for how the sky in the spatial storage level is rendered.
*/
Expand All @@ -38,20 +45,33 @@ public class SpatialStorageSkyProperties {
SkyType.NONE /* we use a custom render mixin */, true, false) {

@Override
public Vec3 getBrightnessDependentFogColor(Vec3 p_230494_1_, float p_230494_2_) {
public Vec3 getBrightnessDependentFogColor(Vec3 fogColor, float brightness) {
return Vec3.ZERO;
}

@Override
public boolean isFoggyAt(int p_230493_1_, int p_230493_2_) {
public boolean isFoggyAt(int x, int y) {
return false;
}

@Nullable
@Override
public float[] getSunriseColor(float p_230492_1_, float p_230492_2_) {
public float[] getSunriseColor(float timeOfDay, float partialTicks) {
return null;
}

@Override
public boolean renderSky(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, Camera camera,
Matrix4f projectionMatrix, boolean isFoggy, Runnable setupFog) {
SpatialSkyRender.getInstance().render(poseStack, projectionMatrix);
return true;
}

@Override
public boolean renderClouds(ClientLevel level, int ticks, float partialTick, PoseStack poseStack, double camX,
double camY, double camZ, Matrix4f projectionMatrix) {
return true; // Disables clouds
}
};

}
2 changes: 0 additions & 2 deletions src/main/resources/ae2.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"UnbreakingMixin"
],
"client": [
"spatial.SkyRenderMixin",
"spatial.SkyPropertiesMixin",
"unlitquad.ModelManagerMixin",
"unlitquad.BlockModelMixin",
"unlitquad.BlockPartFaceDeserializerMixin",
Expand Down

0 comments on commit db8f155

Please sign in to comment.