diff --git a/changelog.md b/changelog.md index 3db0de71c..38fa9c41c 100644 --- a/changelog.md +++ b/changelog.md @@ -1,151 +1 @@ -This update brings a lot of internal changes from the rework into the release version of Ad Astra. -It is initially marked as a alpha as there are a lot of internal changes, so it may break addons and -may be unstable. - -## Changes -- Fixed lava turning into ice in space -- Fixed Ad Astra fluids in water tag -- Fixed rocket sound being stereo and not mono. This allows the audio to be directional. -- Machines no longer light up when active. This is to improve lighting performance. -- Large performance improvement to all machines -- Removed extinguished torches and lanterns. Torches and lanterns will simply break in space. -- Oxygen sensor block can now be inverted with a wrench. -- Oxygen sensor block can now detect normal gravity and safe temperature by shift-right clicking with a wrench. -- Oxygen, gravity and temperature are now saved in the world nbt. This should fix any issues where you don't have - oxygen when you first open a world because it hasn't been calculated yet. -- Added public APIs for planets, oxygen, gravity, and temperature. Please use those instead of the internal ones - when creating addons. -- Added events for oxygen, gravity, zero-g, and temperature, acid rain, and environment ticking. Please use those instead of mixing into the internal -tick methods. -- Improved many tooltips. They now have more info and colored elements. -- Machines now display energy/fluid in/out per tick. -- Energy and fluid numbers now have suffixes (K, M, G). Shifting will show the full number. -- Fluid tanks can now be cleared by shift-right clicking -- Updated the plate and rod textures -- Added gas tanks. these replace oxygen tanks and can hold any fluid. Using them will distribute the - stored fluid into any container in your inventory, with armor being the first priority. -- Added the etrionic capacitor. This is an item that can hold a large amount of energy and can be discharged -into energy items in your inventory. -- Added the zip gun. When filled with oxygen, it propels you forward. Holding two at the same time will propel you - further. -- Separated the config into a common config and client config. -- Added redstone control to machines. These have 4 options: `ALWAYS_ON`, `ON_WHEN_POWERED`, - `ON_WHEN_NOT_POWERED`, and `NEVER_ON`. -- Added a slot in energy machines for powering them with items. -- Added side configuration to all machines. This allows you to control what each element -- Cables and fluid pipes are now much more performant and should now be smarter i.e. automatically - figure out the sources and consumers without having to explicitly configure them. -of the machine does to all sides. For example, you can configure a machine to pull items on -one side, extract energy from another side, and push fluid to another side. -- Added experimental orbit physics. This enables zero gravity movement while in orbit. -- Added an experimental "Air Vortex." This spawns when you break or otherwise open a space in -a sealed oxygenated structure in orbit or any planet with no oxygen. It violently sucks -everything out of the structure and launches it, undergoing rapid depressurization. -Now you can eject the impostor :) -- All blocks and items are now properly datagened. this should fix any sort of weird discrepancies -with some models as they are no longer manually created. -- Removed meteors. They'll be re-added in the future but for now they don't need to exist and are more annoying, if anything. -- Added a button in the oxygen distributor to highlight all blocks that it's distributing to. -This replaces the original oxygen bubble particle indicator. This is also now entirely -client-side and saved to the client config. -- Rewrote JEI and REI integration, with improved screens and tooltips. -- Flags now render the second skin layer. -- Fixed space suit arm glowing in first person with shaders -- Set max flag URL length from 32 to 64 characters. -- Fixed boots, pants, and helmet part of the space suit being able to hold energy and fluid. -- Changed package name from `earth.terrarium.ad_astra` to `earth.terrarium.adastra`. The mod id has not changed. -- Sliding doors can now be locked by right-clicking with a wrench. Locked sliding doors -can only be opened with redstone, similar to iron doors. -- Increased max oxygen distributor size from 3,000 blocks to 6,000 blocks. -- Fixed being able to interact with the rocket while inside of it. -- Each rocket now has its own fuel tag. This allows packmakers to require different fuels for different rockets. -- Coal generator will no longer continue consuming fuel if it's full on energy. -- Updated the rover driving mechanics to be more fluid and easier to control. -- The rover can now run over mobs. -- Fix water pump collision shape. -- Add resourcefullib highlight support to flags. This makes their interaction shape look correct. -- Improved and added many new descriptions to blocks and items. -- Added oxygen intake and outtake sounds when entering and exiting oxygenated areas. -- Fluid ducts now have the same internal mechanics as pipes, so they can now be used exactly like them. -- Added the radio. This is a real radio that'll play actual select radio stations. It's available as a -screen in the rover. You can open in by pressing `R` while in the rover or clicking on the screen on the rover. -- Added the radio block. It'll play real radio stations to everyone in the area like a jukebox. -- The chest on the back of the rover is now clickable. -- Opening your inventory while in the rover now opens the rover inventory. -- Rockets and rovers can no longer carry items. Breaking them will cause the items to drop. -- The Rocket sound is now looped. This allows it to play for as long as the rocket is flying. -- Fixed rocket sound not playing when leaving the world and rejoining while in a flying rocket. -- Fixed rocket particles not visible above world height with Embeddium/Sodium installed. -- Filled energy and fluid items are now in the creative tab. -- Fixed rocket particles lagging behind the rocket on servers. -- Fixed DFU running on all Ad Astra structures due to them being saved on an older version -- Added a keybind `V` to enable and disable the Jetsuit. -- Removed the hammer. Use the compressor to obtain plates instead. -- Each orbit can now have its owned recipe defined via datapack, instead of all of them using the same recipe. -- Reduced oil well spawn rates. -- Removed the `ad_astra_platform` tags. forge and fabric specific tags are now part of the "ad_astra" namespace as optional tags. -- Launchpads can now launch rockets when powered with redstone. -- Lander boosters now have a sound when used. -- The compressor can now compress storage blocks into 9 plates at once. -- The owner and location of space stations are now saved in the world nbt. This allows -you to land at your space station from anywhere and also prevents accidentally spawning -a new space station on an existing one. -- Updated the planets screen with a cleaner UI. You should be able to navigate the menu easier. And it -should now be clear when you want to land on the planet, land on the space station or build a new space station. -- Add support for multiple owned space stations. There is now a list of owned space stations in the planets screen, -and you can choose which one to land on. -- You can no longer teleport to orbit directly in the planets menu. -You must build a space station and land on that space station first. -- Added industrial lamps and small industrial lamps. These are available in all 16 colors. -- Updated star colors to be more vibrant and have some colors be more rare than others. -- Improved planet skyboxes. -- Added [Shimmer](https://modrinth.com/mod/shimmer!) compat. This adds bloom to the rocket particles and adds colored lighting to the new industrial lamps. -- Added Factory blocks. These are decorative blocks that support connected textures if you have [Athena](https://modrinth.com/mod/athena-ctm) installed. -These are available for all metals. -- Added Encased Plateblocks, and Panel blocks. These are available for all metals. -- Redid many of the recipes. -- Added higher blast resistance for higher tier metals. -- Water will not longer instantly freeze, and it can now be placed on Venus and Mercury. It will now -simply freeze or evaporate over time. -- Plants now break over time when placed in non-oxygenated planets. -- Fixed sleeping on planets not advancing the night. -- Added the Etrionic Blast furnace. This is a better version of the blast furnace that uses energy, has 4 slots, and is now used -to smelt steel. The blast furnace steel recipe have been removed. -- Added the gravity normalizer. This allows you to control the gravity of a local area, similar -to the oxygen distributor. It's especially important in orbit due to the zero gravity environment. -- Added the Ti-69. It's a device that displays the local oxygen, temperature, and gravity. -- Copper no longer oxidizes in environments with no oxygen. -- Updated the oxygen distributor model. It now spins and can be placed on any block face. -- You now need to hold shift for two seconds before you can dismount moving vehicles. -- Landers now prevent the player from dismounting when falling without explicitly dismounting. This should fix -incompatibilities with mods like Transit Railway. -- Only allow mobs that can survive in space to spawn in ad astra dimensions. This should fix -the issue where mods like Alex's Mobs would spawn flies that kept dying. -- The warning to hold space when landing is now displayed boldly on screen instead of a chat message. -- The lander will now display the distance to the ground when landing. -Hopefully this will prevent people from missing it and crashing. -- The NASA workbench can now automatically craft rockets when powered with redstone. -- Added Cadmus compat to space stations. It'll automatically claim the chunks around your space station -and prevent players from spawning a new space station at any claimed chunks. -- Added Argonauts compat to space stations. Players on the same guild will be -able to share space stations. -- Sliding doors can now be redstone powered from any of its blocks, instead of just the bottom middle one. -- Machines now work with comparators. -- Updated astrodux guide book. -- The astrodux is now a patchouli book that's only available when patchouli is installed, instead -of a standalone item. -- Cleaned up the config. Moved all machine-related options to one category. -- Redid the advancements. - -## Breaking Changes -- Removed Glacian signs, and aeronos and strophar chests. -- The JSON format for Ad Astra planets has changed a bit. You'll need -to update your existing planet file for it to work. Check the GitHub wiki (when it's updated). -- Some recipe IDs have been updated. It won't break anything in-game, but -if you're using these recipes in modpacks, you'll need to change them. This includes - - "ad_astra:space_station_recipe" -> "ad_astra:space_station" - - "ad_astra:cryo_fuel_conversion" -> "ad_astra:cryo_freezing" - - "ad_astra:fuel_conversion" -> "ad_astra:refining" - - "ad_astra:oxygen_conversion" -> "ad_astra:oxygen_loading" -- Removed the sky renderer JSON API. Sky renderers should now be done in code. -- Removed the JSON APIs for adding planets, galaxies and info in the planets screen. +- Fix sodium/embeddium crash \ No newline at end of file diff --git a/common/src/main/java/earth/terrarium/adastra/mixins/client/LevelRendererMixin.java b/common/src/main/java/earth/terrarium/adastra/mixins/client/LevelRendererMixin.java index 4598fef0f..bd49e8b5d 100644 --- a/common/src/main/java/earth/terrarium/adastra/mixins/client/LevelRendererMixin.java +++ b/common/src/main/java/earth/terrarium/adastra/mixins/client/LevelRendererMixin.java @@ -1,26 +1,67 @@ package earth.terrarium.adastra.mixins.client; +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.PoseStack; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexBuffer; import earth.terrarium.adastra.client.utils.DimensionRenderingUtils; import earth.terrarium.adastra.common.registry.ModParticleTypes; import earth.terrarium.adastra.common.tags.ModBiomeTags; +import net.minecraft.client.CloudStatus; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.LevelRenderer; -import net.minecraft.client.renderer.RenderBuffers; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.*; import net.minecraft.core.particles.ParticleOptions; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.phys.Vec3; +import org.joml.Matrix4f; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -@Mixin(LevelRenderer.class) +@Mixin(value = LevelRenderer.class, priority = 2000) public abstract class LevelRendererMixin { + @Shadow + private ClientLevel level; + + @Shadow + private int ticks; + + @Shadow + private int prevCloudX; + + @Shadow + private int prevCloudY; + + @Shadow + private int prevCloudZ; + @Shadow @Final - private RenderBuffers renderBuffers; + private Minecraft minecraft; + + @Shadow + private Vec3 prevCloudColor; + + @Shadow + private CloudStatus prevCloudsType; + + @Shadow + private boolean generateClouds; + + @Shadow + private VertexBuffer cloudBuffer; + + @Shadow + protected abstract BufferBuilder.RenderedBuffer buildClouds(BufferBuilder builder, double x, double y, double z, Vec3 cloudColor); @ModifyArg(method = "tickRain", at = @At( value = "INVOKE", @@ -30,20 +71,111 @@ public abstract class LevelRendererMixin { return adastra$hasAcidRain() ? ModParticleTypes.ACID_RAIN.get() : original; } - @ModifyArg(method = "renderSnowAndRain", at = @At( + @Inject(method = "renderSnowAndRain", at = @At( value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/resources/ResourceLocation;)V", - ordinal = 0), index = 1) - private ResourceLocation adastra$renderSnowAndRain(ResourceLocation original) { - return adastra$hasAcidRain() ? DimensionRenderingUtils.ACID_RAIN : original; + shift = At.Shift.AFTER + )) + private void adastra$renderSnowAndRain(LightTexture lightTexture, float partialTick, double camX, double camY, double camZ, CallbackInfo ci) { + if (adastra$hasAcidRain()) { + RenderSystem.setShaderTexture(0, DimensionRenderingUtils.ACID_RAIN); + } } - @ModifyArg(method = "renderClouds", at = @At( - value = "INVOKE", - target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderTexture(ILnet/minecraft/resources/ResourceLocation;)V", - ordinal = 0), index = 1) - private ResourceLocation adastra$renderClouds(ResourceLocation original) { - return adastra$hasAcidRain() ? DimensionRenderingUtils.VENUS_CLOUDS : original; + // A copy of vanilla's cloud renderer that uses the venus cloud texture. I have to copy the entire + // thing because sodium is stupid and overwrites the entire method. + @Inject( + method = "renderClouds", + at = @At( + value = "HEAD" + ), + cancellable = true) + private void adastra$renderClouds(PoseStack poseStack, Matrix4f projectionMatrix, float partialTick, double camX, double camY, double camZ, CallbackInfo ci) { + if (adastra$hasAcidRain()) { + ci.cancel(); + float f = this.level.effects().getCloudHeight(); + if (!Float.isNaN(f)) { + RenderSystem.disableCull(); + RenderSystem.enableBlend(); + RenderSystem.enableDepthTest(); + RenderSystem.blendFuncSeparate( + GlStateManager.SourceFactor.SRC_ALPHA, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, + GlStateManager.SourceFactor.ONE, + GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA + ); + RenderSystem.depthMask(true); + double d1 = ((float) this.ticks + partialTick) * 0.03F; + double d2 = (camX + d1) / 12.0; + double d3 = f - (float) camY + 0.33F; + double d4 = camZ / 12.0 + 0.33F; + d2 -= Mth.floor(d2 / 2048.0) * 2048; + d4 -= Mth.floor(d4 / 2048.0) * 2048; + float f3 = (float) (d2 - (double) Mth.floor(d2)); + float f4 = (float) (d3 / 4.0 - (double) Mth.floor(d3 / 4.0)) * 4.0F; + float f5 = (float) (d4 - (double) Mth.floor(d4)); + Vec3 vec3 = this.level.getCloudColor(partialTick); + int i = (int) Math.floor(d2); + int j = (int) Math.floor(d3 / 4.0); + int k = (int) Math.floor(d4); + if (i != this.prevCloudX + || j != this.prevCloudY + || k != this.prevCloudZ + || this.minecraft.options.getCloudsType() != this.prevCloudsType + || this.prevCloudColor.distanceToSqr(vec3) > 2.0E-4) { + this.prevCloudX = i; + this.prevCloudY = j; + this.prevCloudZ = k; + this.prevCloudColor = vec3; + this.prevCloudsType = this.minecraft.options.getCloudsType(); + this.generateClouds = true; + } + + if (this.generateClouds) { + this.generateClouds = false; + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + if (this.cloudBuffer != null) { + this.cloudBuffer.close(); + } + + this.cloudBuffer = new VertexBuffer(VertexBuffer.Usage.STATIC); + BufferBuilder.RenderedBuffer bufferbuilder$renderedbuffer = this.buildClouds(bufferbuilder, d2, d3, d4, vec3); + this.cloudBuffer.bind(); + this.cloudBuffer.upload(bufferbuilder$renderedbuffer); + VertexBuffer.unbind(); + } + + RenderSystem.setShader(GameRenderer::getPositionTexColorNormalShader); + RenderSystem.setShaderTexture(0, DimensionRenderingUtils.VENUS_CLOUDS); + FogRenderer.levelFogColor(); + poseStack.pushPose(); + poseStack.scale(12.0F, 1.0F, 12.0F); + poseStack.translate(-f3, f4, -f5); + if (this.cloudBuffer != null) { + this.cloudBuffer.bind(); + int l = this.prevCloudsType == CloudStatus.FANCY ? 0 : 1; + + for (int i1 = l; i1 < 2; ++i1) { + if (i1 == 0) { + RenderSystem.colorMask(false, false, false, false); + } else { + RenderSystem.colorMask(true, true, true, true); + } + + ShaderInstance shaderinstance = RenderSystem.getShader(); + assert shaderinstance != null; + this.cloudBuffer.drawWithShader(poseStack.last().pose(), projectionMatrix, shaderinstance); + } + + VertexBuffer.unbind(); + } + + poseStack.popPose(); + RenderSystem.enableCull(); + RenderSystem.disableBlend(); + RenderSystem.defaultBlendFunc(); + } + } } @Unique diff --git a/gradle.properties b/gradle.properties index 51239a8f9..3e31d1206 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2G enabledPlatforms=fabric,forge -version=1.15.7 +version=1.15.8 group=earth.terrarium.adastra minecraftVersion=1.20.1