diff --git a/build.gradle b/build.gradle index a5bcd05..8243add 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id "com.modrinth.minotaur" version "2.+" - id 'fabric-loom' version '1.2-SNAPSHOT' + id 'fabric-loom' version '1.5-SNAPSHOT' id 'maven-publish' } @@ -21,6 +21,10 @@ repositories { name = 'Ladysnake Mods' url = 'https://ladysnake.jfrog.io/artifactory/mods' } + maven { + name = "Ladysnake Mods" + url = 'https://maven.ladysnake.org/releases' + } maven { url = "https://api.modrinth.com/maven" } @@ -50,32 +54,12 @@ dependencies { // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" - // Dependency of Immersive Portals Core: - modImplementation("com.github.iPortalTeam.ImmersivePortalsMod:imm_ptl_core:${project.immersive_portals_version}") { - exclude(group: "net.fabricmc.fabric-api") - exclude(group: "net.fabricmc.fabric-loader") - transitive(false) - } + modImplementation ("com.github.iPortalTeam:ImmersivePortalsMod:${project.immersive_portals_version}") - // Dependency of the Miscellaneous Utility Library from qouteall - modImplementation("com.github.iPortalTeam.ImmersivePortalsMod:q_misc_util:${project.immersive_portals_version}") { - exclude(group: "net.fabricmc.fabric-api") - exclude(group: "net.fabricmc.fabric-loader") - transitive(false) - } + include(modApi("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}")) - include(modApi("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}")) { - exclude(group: "net.fabricmc.fabric-loader") - transitive(false) - } // Replace modImplementation with modApi if you expose components in your own API - include(modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-level:${project.cardinal_components_version}")) { - exclude(group: "net.fabricmc.fabric-loader") - transitive(false) - } - - api("com.github.LlamaLad7:MixinExtras:0.2.0-beta.4") - annotationProcessor("com.github.LlamaLad7:MixinExtras:0.2.0-beta.4") + include(modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-level:${project.cardinal_components_version}")) include(modApi(platform("de.siphalor.tweed4:tweed4-bom-$project.minecraft_version_major:$project.tweed_version"))) // Pick any modules you want to use, e.g.: @@ -87,11 +71,13 @@ dependencies { include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_version_major")) - modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version") { - exclude(group: "net.fabricmc.fabric-api") - } + modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version") - modCompileOnly "maven.modrinth:sodium:mc${project.minecraft_version_major}-${project.sodium_version}" + modCompileOnly("maven.modrinth:sodium:${project.sodium_version}") +} + +loom { + accessWidenerPath = file("src/main/resources/colourful_portals.accesswidener") } configurations.include.transitive = true diff --git a/gradle.properties b/gradle.properties index bc9d4a0..992c60d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,21 +4,21 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.8 -loader_version=0.14.21 +minecraft_version=1.20.4 minecraft_version_major=1.20 +yarn_mappings=1.20.4+build.3 +loader_version=0.15.7 # Mod Properties -mod_version=0.9.3 +mod_version=0.9.3.1 maven_group=quimufu.colourful-portals archives_base_name=colourful-portals # Dependencies -fabric_version=0.84.0+1.20.1 -cardinal_components_version=5.2.1 -immersive_portals_version_short=3.1.0 -immersive_portals_version=v3.1.0-mc1.20.1 -tweed_version=1.3.0+mc1.20-pre1 -sodium_version=0.4.10 -cloth_config_version=11.0.99 \ No newline at end of file +fabric_version=0.96.11+1.20.4 +cardinal_components_version=5.4.0 +immersive_portals_version_short=5.1.7 +immersive_portals_version=v5.1.7-mc1.20.4 +tweed_version=1.3.0+mc1.20.2 +sodium_version=mc1.20.4-0.5.8 +cloth_config_version=13.0.121 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d..20db9ad 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java b/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java index 45890c1..1ec8d4c 100644 --- a/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java +++ b/src/main/java/quimufu/colourful_portals/ColourfulPortalsMod.java @@ -36,7 +36,7 @@ public class ColourfulPortalsMod implements ModInitializer { public static final Item BLOB_DARK = new Item(new FabricItemSettings()); public static final Item BLOB_BRIGHT = new Item(new FabricItemSettings()); public static final PortalFluid PORTAL_FLUID = new PortalFluid(); - public static final PortalFluidBlock PORTAL_FLUID_BLOCk = new PortalFluidBlock(PORTAL_FLUID, FabricBlockSettings.create().sounds(BlockSoundGroup.field_44608).luminance(15).noCollision().strength(100.0f).dropsNothing()); + public static final PortalFluidBlock PORTAL_FLUID_BLOCk = new PortalFluidBlock(PORTAL_FLUID, FabricBlockSettings.create().sounds(BlockSoundGroup.INTENTIONALLY_EMPTY).luminance(15).noCollision().strength(100.0f).dropsNothing()); public static final BucketItem PORTAL_FLUID_BUCKET_ITEM = new PortalFluidBucketItem(PORTAL_FLUID, new FabricItemSettings().recipeRemainder(Items.BUCKET).maxCount(1).rarity(Rarity.RARE)); private static boolean never(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityType entityType) { diff --git a/src/main/java/quimufu/colourful_portals/PortalBlock.java b/src/main/java/quimufu/colourful_portals/PortalBlock.java index 36e21c6..58eba4b 100644 --- a/src/main/java/quimufu/colourful_portals/PortalBlock.java +++ b/src/main/java/quimufu/colourful_portals/PortalBlock.java @@ -4,6 +4,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.FluidFillable; import net.minecraft.block.ShapeContext; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemPlacementContext; @@ -21,6 +22,7 @@ import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; +import org.jetbrains.annotations.Nullable; import quimufu.colourful_portals.portal.PortalManager; @@ -119,7 +121,7 @@ public class PortalBlock extends Block implements FluidFillable { } @Override - public boolean canFillWithFluid(BlockView world, BlockPos pos, BlockState state, Fluid fluid) { + public boolean canFillWithFluid(@Nullable PlayerEntity player, BlockView world, BlockPos pos, BlockState state, Fluid fluid) { if (((World) world).isClient() && fluid == ColourfulPortalsMod.PORTAL_FLUID) { return true; } @@ -128,6 +130,7 @@ public class PortalBlock extends Block implements FluidFillable { && PortalManager.canExtend((ServerWorld) world, pos); } + @Override public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { if (world.isClient() && fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)) { diff --git a/src/main/java/quimufu/colourful_portals/client/AlphaBlendingAnimator.java b/src/main/java/quimufu/colourful_portals/client/AlphaBlendingAnimator.java new file mode 100644 index 0000000..bc3fb0f --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/client/AlphaBlendingAnimator.java @@ -0,0 +1,112 @@ +package quimufu.colourful_portals.client; + +import com.mojang.blaze3d.systems.RenderSystem; +import net.minecraft.client.texture.Animator; +import net.minecraft.client.texture.NativeImage; +import net.minecraft.client.texture.SpriteContents; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +/** + * This code is mostly copies from minecraft source. it is owned by mojang. + */ +public class AlphaBlendingAnimator implements Animator { + int frame; + int currentTime; + + final SpriteContents spriteContents; + final SpriteContents.Animation animation; + @Nullable + private final AlphaBlendingInterpolation interpolation; + + public AlphaBlendingAnimator(SpriteContents spriteContents, SpriteContents.Animation animation) { + this.spriteContents = spriteContents; + this.animation = animation; + this.interpolation = new AlphaBlendingInterpolation(); + } + + @Override + public void tick(int x, int y) { + ++this.currentTime; + SpriteContents.AnimationFrame animationFrame = this.animation.frames.get(this.frame); + if (this.currentTime >= animationFrame.time) { + int i = animationFrame.index; + this.frame = (this.frame + 1) % this.animation.frames.size(); + this.currentTime = 0; + int j = this.animation.frames.get((int)this.frame).index; + if (i != j) { + this.animation.upload(x, y, j); + } + } else if (this.interpolation != null) { + if (!RenderSystem.isOnRenderThread()) { + RenderSystem.recordRenderCall(() -> this.interpolation.apply(x, y, this)); + } else { + this.interpolation.apply(x, y, this); + } + } + } + + @Override + public void close() { + if (this.interpolation != null) { + this.interpolation.close(); + } + } + + public class AlphaBlendingInterpolation + implements AutoCloseable { + private final NativeImage[] images; + + AlphaBlendingInterpolation() { + this.images = new NativeImage[spriteContents.mipmapLevelsImages.length]; + for (int i = 0; i < this.images.length; ++i) { + int j = spriteContents.getWidth() >> i; + int k = spriteContents.getHeight() >> i; + this.images[i] = new NativeImage(j, k, false); + } + } + + void apply(int x, int y, AlphaBlendingAnimator animator) { + SpriteContents.Animation animation = animator.animation; + List list = animation.frames; + SpriteContents.AnimationFrame animationFrame = list.get(animator.frame); + double d = 1.0 - (double)animator.currentTime / (double)animationFrame.time; + int i = animationFrame.index; + int j = list.get((animator.frame + 1) % list.size()).index; + if (i != j) { + for (int k = 0; k < this.images.length; ++k) { + int l = spriteContents.getWidth() >> k; + int m = spriteContents.getHeight() >> k; + for (int n = 0; n < m; ++n) { + for (int o = 0; o < l; ++o) { + int p = this.getPixelColor(animation, i, k, o, n); + int q = this.getPixelColor(animation, j, k, o, n); + int a = this.lerp(d, p >> 24 & 0xFF, q >> 24 & 0xFF); + int r = this.lerp(d, p >> 16 & 0xFF, q >> 16 & 0xFF); + int s = this.lerp(d, p >> 8 & 0xFF, q >> 8 & 0xFF); + int t = this.lerp(d, p & 0xFF, q & 0xFF); + this.images[k].setColor(o, n, a << 24 | r << 16 | s << 8 | t); + } + } + } + spriteContents.upload(x, y, 0, 0, this.images); + } + } + + private int getPixelColor(SpriteContents.Animation animation, int frameIndex, int layer, int x, int y) { + return spriteContents.mipmapLevelsImages[layer].getColor(x + (animation.getFrameX(frameIndex) * spriteContents.getWidth() >> layer), y + (animation.getFrameY(frameIndex) * spriteContents.getHeight() >> layer)); + } + + private int lerp(double delta, int to, int from) { + return (int)(delta * (double)to + (1.0 - delta) * (double)from); + } + + @Override + public void close() { + for (NativeImage nativeImage : this.images) { + nativeImage.close(); + } + } + } +} diff --git a/src/main/java/quimufu/colourful_portals/client/AlphaInterpolationHolder.java b/src/main/java/quimufu/colourful_portals/client/AlphaInterpolationHolder.java new file mode 100644 index 0000000..089e2fd --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/client/AlphaInterpolationHolder.java @@ -0,0 +1,8 @@ +package quimufu.colourful_portals.client; + +public interface AlphaInterpolationHolder { + + public void colourful_portals$setInterpolateAlpha(boolean interpolateAlpha); + public boolean colourful_portals$isInterpolateAlpha(); + +} diff --git a/src/main/java/quimufu/colourful_portals/client/CommonPortalFluidRenderer.java b/src/main/java/quimufu/colourful_portals/client/CommonPortalFluidRenderer.java index 5c01513..fda9323 100644 --- a/src/main/java/quimufu/colourful_portals/client/CommonPortalFluidRenderer.java +++ b/src/main/java/quimufu/colourful_portals/client/CommonPortalFluidRenderer.java @@ -81,10 +81,10 @@ public class CommonPortalFluidRenderer { } calcSquishedUVs(axis, 1.f - offsetInSquishedDir, offsetInSquishedDir, direction, (amount & 1) == 1); } else { - uIu2IvIv2[0] = sprite.getFrameU(0.); - uIu2IvIv2[1] = sprite.getFrameU(16.); - uIu2IvIv2[2] = sprite.getFrameV(0.); - uIu2IvIv2[3] = sprite.getFrameV(16.); + uIu2IvIv2[0] = sprite.getFrameU(0.F); + uIu2IvIv2[1] = sprite.getFrameU(1.F); + uIu2IvIv2[2] = sprite.getFrameV(0.F); + uIu2IvIv2[3] = sprite.getFrameV(1.F); } drawSide(vertexEater, x, y, z, x2, y2, z2, direction, uIu2IvIv2[0], uIu2IvIv2[2], uIu2IvIv2[1], uIu2IvIv2[3], offset); @@ -98,53 +98,53 @@ public class CommonPortalFluidRenderer { switch (axis) { case X -> { if (odd) { - uIu2IvIv2[0] = sprite.getFrameU(0.5 + squishedBottom * 16D); - uIu2IvIv2[1] = sprite.getFrameU(0.5 + squishedTop * 16D); + uIu2IvIv2[0] = sprite.getFrameU(0.5F + squishedBottom); + uIu2IvIv2[1] = sprite.getFrameU(0.5F + squishedTop); } else { - uIu2IvIv2[0] = sprite.getFrameU(0. + squishedBottom * 16D); - uIu2IvIv2[1] = sprite.getFrameU(squishedTop * 16D); + uIu2IvIv2[0] = sprite.getFrameU(0.F + squishedBottom); + uIu2IvIv2[1] = sprite.getFrameU(squishedTop); } - uIu2IvIv2[2] = sprite.getFrameV(0.); - uIu2IvIv2[3] = sprite.getFrameV(16.); + uIu2IvIv2[2] = sprite.getFrameV(0.F); + uIu2IvIv2[3] = sprite.getFrameV(16.F); } case Z -> { if (direction.getAxis() == Direction.Axis.Y) { if (odd) { - uIu2IvIv2[2] = sprite.getFrameV(0.5 + squishedBottom * 16D); - uIu2IvIv2[3] = sprite.getFrameV(0.5 + squishedTop * 16D); + uIu2IvIv2[2] = sprite.getFrameV(0.5F + squishedBottom); + uIu2IvIv2[3] = sprite.getFrameV(0.5F + squishedTop); } else { - uIu2IvIv2[2] = sprite.getFrameV(squishedBottom * 16D); - uIu2IvIv2[3] = sprite.getFrameV(squishedTop * 16D); + uIu2IvIv2[2] = sprite.getFrameV(squishedBottom); + uIu2IvIv2[3] = sprite.getFrameV(squishedTop); } - uIu2IvIv2[0] = sprite.getFrameU(0.); - uIu2IvIv2[1] = sprite.getFrameU(16.); + uIu2IvIv2[0] = sprite.getFrameU(0.F); + uIu2IvIv2[1] = sprite.getFrameU(1.F); } else { if (odd) { - uIu2IvIv2[0] = sprite.getFrameU(0.5 + squishedBottom * 16D); - uIu2IvIv2[1] = sprite.getFrameU(0.5 + squishedTop * 16D); + uIu2IvIv2[0] = sprite.getFrameU(0.5F + squishedBottom); + uIu2IvIv2[1] = sprite.getFrameU(0.5F + squishedTop); } else { - uIu2IvIv2[0] = sprite.getFrameU(squishedBottom * 16D); - uIu2IvIv2[1] = sprite.getFrameU(squishedTop * 16D); + uIu2IvIv2[0] = sprite.getFrameU(squishedBottom); + uIu2IvIv2[1] = sprite.getFrameU(squishedTop); } - uIu2IvIv2[2] = sprite.getFrameV(0.); - uIu2IvIv2[3] = sprite.getFrameV(16.); + uIu2IvIv2[2] = sprite.getFrameV(0.F); + uIu2IvIv2[3] = sprite.getFrameV(1.F); } } case Y -> { if (odd) { - uIu2IvIv2[2] = sprite.getFrameV(0.5 + squishedBottom * 16D); - uIu2IvIv2[3] = sprite.getFrameV(0.5 + squishedTop * 16D); + uIu2IvIv2[2] = sprite.getFrameV(0.5F + squishedBottom); + uIu2IvIv2[3] = sprite.getFrameV(0.5F + squishedTop); } else { - uIu2IvIv2[2] = sprite.getFrameV(squishedBottom * 16D); - uIu2IvIv2[3] = sprite.getFrameV(squishedTop * 16D); + uIu2IvIv2[2] = sprite.getFrameV(squishedBottom); + uIu2IvIv2[3] = sprite.getFrameV(squishedTop); } - uIu2IvIv2[0] = sprite.getFrameU(0.); - uIu2IvIv2[1] = sprite.getFrameU(16.); + uIu2IvIv2[0] = sprite.getFrameU(0.F); + uIu2IvIv2[1] = sprite.getFrameU(1.F); } default -> throw new IllegalStateException("Unexpected value: " + axis); } diff --git a/src/main/java/quimufu/colourful_portals/client/SodiumPortalFluidRenderHandler.java b/src/main/java/quimufu/colourful_portals/client/SodiumPortalFluidRenderHandler.java index b88ba96..ab15e5c 100644 --- a/src/main/java/quimufu/colourful_portals/client/SodiumPortalFluidRenderHandler.java +++ b/src/main/java/quimufu/colourful_portals/client/SodiumPortalFluidRenderHandler.java @@ -5,8 +5,11 @@ import me.jellysquid.mods.sodium.client.model.quad.ModelQuadView; import me.jellysquid.mods.sodium.client.model.quad.ModelQuadViewMutable; import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing; import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadWinding; +import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; import me.jellysquid.mods.sodium.client.render.chunk.compile.buffers.ChunkModelBuilder; -import me.jellysquid.mods.sodium.client.render.vertex.type.ChunkVertexEncoder; +import me.jellysquid.mods.sodium.client.render.chunk.terrain.material.DefaultMaterials; +import me.jellysquid.mods.sodium.client.render.chunk.terrain.material.Material; +import me.jellysquid.mods.sodium.client.render.chunk.vertex.format.ChunkVertexEncoder; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.client.texture.Sprite; @@ -25,12 +28,14 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer private final ChunkVertexEncoder.Vertex[] vertices = ChunkVertexEncoder.Vertex.uninitializedQuad(); private int i; private ChunkModelBuilder chunkModelBuilder; + private Material material; public SodiumPortalFluidRenderHandler() { } - public boolean render(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkModelBuilder buffers) { - this.chunkModelBuilder = buffers; + public boolean render(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkBuildBuffers buffers) { + material = DefaultMaterials.forFluidState(fluidState); + this.chunkModelBuilder = buffers.get(material); return commonPortalFluidRenderer.render(world,fluidState,pos,offset,this); } @@ -53,15 +58,14 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer @Override public void drawQuad(BlockPos offset, Direction direction) { - writeQuad(chunkModelBuilder, offset, quad, ModelQuadFacing.fromDirection(direction), ModelQuadWinding.CLOCKWISE); + writeQuad(chunkModelBuilder, material, offset, quad, ModelQuadFacing.fromDirection(direction), false); } - private void writeQuad(ChunkModelBuilder builder, BlockPos offset, ModelQuadView quad, ModelQuadFacing facing, ModelQuadWinding winding) { - var vertexBuffer = builder.getVertexBuffer(); + private void writeQuad(ChunkModelBuilder builder, Material material, BlockPos offset, ModelQuadView quad, ModelQuadFacing facing, boolean flip) { var vertices = this.vertices; for (int i = 0; i < 4; i++) { - var out = vertices[i]; + var out = vertices[flip ? 3 - i : i]; out.x = offset.getX() + quad.getX(i); out.y = offset.getY() + quad.getY(i); out.z = offset.getZ() + quad.getZ(i); @@ -77,8 +81,8 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer builder.addSprite(sprite); } - builder.getIndexBuffer(facing) - .add(vertexBuffer.push(vertices), winding); + var vertexBuffer = builder.getVertexBuffer(facing); + vertexBuffer.push(vertices, material); } diff --git a/src/main/java/quimufu/colourful_portals/mixin/AnimationMixin.java b/src/main/java/quimufu/colourful_portals/mixin/AnimationMixin.java new file mode 100644 index 0000000..3991e81 --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/mixin/AnimationMixin.java @@ -0,0 +1,50 @@ +package quimufu.colourful_portals.mixin; + +import net.minecraft.client.texture.Animator; +import net.minecraft.client.texture.SpriteContents; +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.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import quimufu.colourful_portals.client.AlphaBlendingAnimator; +import quimufu.colourful_portals.client.AlphaInterpolationHolder; + +import java.util.List; + +@Mixin(targets = "net.minecraft.client.texture.SpriteContents$Animation") +public class AnimationMixin implements AlphaInterpolationHolder { + @Shadow + @Final + private boolean interpolation; + + @Unique + private SpriteContents parent; + + @Unique + private boolean interpolateAlpha = false; + + @Inject(method = "", at = @At("RETURN")) + public void assignParent(SpriteContents parent, List frames, int frameCount, boolean interpolation, CallbackInfo ci) { + this.parent = parent; + } + + public void colourful_portals$setInterpolateAlpha(boolean interpolateAlpha) { + this.interpolateAlpha = interpolateAlpha; + } + + public boolean colourful_portals$isInterpolateAlpha() { + return interpolateAlpha; + } + + @Inject(at = @At("RETURN"), method = "createAnimator()Lnet/minecraft/client/texture/Animator;", cancellable = true) + public void createAnimator(CallbackInfoReturnable cir) { + if (this.interpolateAlpha && this.interpolation) { + cir.setReturnValue(new AlphaBlendingAnimator(parent, (SpriteContents.Animation) (Object) this)); + cir.cancel(); + } + } +} diff --git a/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataMixin.java b/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataMixin.java new file mode 100644 index 0000000..9b68d37 --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataMixin.java @@ -0,0 +1,20 @@ +package quimufu.colourful_portals.mixin; + +import net.minecraft.client.resource.metadata.AnimationResourceMetadata; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import quimufu.colourful_portals.client.AlphaInterpolationHolder; + +@Mixin(AnimationResourceMetadata.class) +public class AnimationResourceMetadataMixin implements AlphaInterpolationHolder { + + @Unique + private boolean interpolateAlpha = false; + public void colourful_portals$setInterpolateAlpha(boolean interpolateAlpha) { + this.interpolateAlpha = interpolateAlpha; + } + public boolean colourful_portals$isInterpolateAlpha() { + return interpolateAlpha; + } + +} diff --git a/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataReaderMixin.java b/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataReaderMixin.java new file mode 100644 index 0000000..feabc1e --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/mixin/AnimationResourceMetadataReaderMixin.java @@ -0,0 +1,24 @@ +package quimufu.colourful_portals.mixin; + +import com.google.gson.JsonObject; +import net.minecraft.client.resource.metadata.AnimationResourceMetadata; +import net.minecraft.client.resource.metadata.AnimationResourceMetadataReader; +import net.minecraft.util.JsonHelper; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import quimufu.colourful_portals.client.AlphaInterpolationHolder; + +@Mixin(AnimationResourceMetadataReader.class) +public class AnimationResourceMetadataReaderMixin { + + @Inject(at = @At("RETURN"), method = "fromJson(Lcom/google/gson/JsonObject;)Lnet/minecraft/client/resource/metadata/AnimationResourceMetadata;", cancellable = true) + void extractInterpolateAlpha(JsonObject jsonObject, CallbackInfoReturnable cir) { + boolean interpolateAlpha = JsonHelper.getBoolean(jsonObject, "interpolateAlpha", false); + AnimationResourceMetadata returnValue = cir.getReturnValue(); + ((AlphaInterpolationHolder)returnValue).colourful_portals$setInterpolateAlpha(interpolateAlpha); + cir.setReturnValue(returnValue); + cir.cancel(); + } +} diff --git a/src/main/java/quimufu/colourful_portals/mixin/InterpolationMixin.java b/src/main/java/quimufu/colourful_portals/mixin/InterpolationMixin.java deleted file mode 100644 index 5675ca7..0000000 --- a/src/main/java/quimufu/colourful_portals/mixin/InterpolationMixin.java +++ /dev/null @@ -1,37 +0,0 @@ -package quimufu.colourful_portals.mixin; - -import net.minecraft.client.texture.NativeImage; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.ModifyVariable; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(targets = "net/minecraft/client/texture/SpriteContents$Interpolation") -public abstract class InterpolationMixin { - - @Shadow - protected abstract int lerp(double delta, int to, int from); - - ThreadLocal colourBefore = new ThreadLocal<>(); - ThreadLocal delta = new ThreadLocal<>(); - - @Redirect(method = "apply", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/NativeImage;setColor(III)V")) - private void injected(NativeImage instance, int x, int y, int color) { - int alpha = lerp(delta.get(), (color >> 24) & 0xFF, (colourBefore.get() >> 24) & 0xFF); - - instance.setColor(x, y, (alpha << 24) | (color & 0xFFFFFF)); - } - - @ModifyVariable(method = "apply", at = @At("STORE"), ordinal = 10) - private int injected(int x) { - colourBefore.set(x); - return x; - } - - @ModifyVariable(method = "apply", at = @At("STORE"), ordinal = 0) - private double injected(double deltaV) { - delta.set(deltaV); - return deltaV; - } -} diff --git a/src/main/java/quimufu/colourful_portals/mixin/SodiumFluidRendererMixin.java b/src/main/java/quimufu/colourful_portals/mixin/SodiumFluidRendererMixin.java index 2e1c52b..5a8c071 100644 --- a/src/main/java/quimufu/colourful_portals/mixin/SodiumFluidRendererMixin.java +++ b/src/main/java/quimufu/colourful_portals/mixin/SodiumFluidRendererMixin.java @@ -1,13 +1,16 @@ package quimufu.colourful_portals.mixin; +import me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers; import me.jellysquid.mods.sodium.client.render.chunk.compile.buffers.ChunkModelBuilder; import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer; +import me.jellysquid.mods.sodium.client.world.WorldSlice; import net.minecraft.fluid.FluidState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.BlockRenderView; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import quimufu.colourful_portals.client.SodiumPortalFluidRenderHandler; @@ -19,10 +22,10 @@ public class SodiumFluidRendererMixin { private final SodiumPortalFluidRenderHandler sodiumPortalFluidRenderHandler = new SodiumPortalFluidRenderHandler(); @Inject(at = @At("HEAD"), method = "render", cancellable = true, remap = false) - private void init(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkModelBuilder buffers, CallbackInfoReturnable cir) { + private void init(WorldSlice world, FluidState fluidState, BlockPos blockPos, BlockPos offset, ChunkBuildBuffers buffers, CallbackInfo ci) { if (fluidState.isOf(PORTAL_FLUID)) { - cir.setReturnValue(sodiumPortalFluidRenderHandler.render(world, fluidState, pos, offset, buffers)); - cir.cancel(); + sodiumPortalFluidRenderHandler.render(world, fluidState, blockPos, offset, buffers); + ci.cancel(); } } } diff --git a/src/main/java/quimufu/colourful_portals/mixin/SpriteContentsMixin.java b/src/main/java/quimufu/colourful_portals/mixin/SpriteContentsMixin.java new file mode 100644 index 0000000..c504742 --- /dev/null +++ b/src/main/java/quimufu/colourful_portals/mixin/SpriteContentsMixin.java @@ -0,0 +1,51 @@ +package quimufu.colourful_portals.mixin; + +import net.minecraft.client.resource.metadata.AnimationResourceMetadata; +import net.minecraft.client.texture.SpriteContents; +import net.minecraft.client.texture.SpriteDimensions; +import net.minecraft.resource.metadata.ResourceMetadata; +import org.jetbrains.annotations.Nullable; +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.callback.CallbackInfoReturnable; +import quimufu.colourful_portals.client.AlphaInterpolationHolder; + +@Mixin(SpriteContents.class) +public abstract class SpriteContentsMixin { + + @Unique + private final ThreadLocal redirect = ThreadLocal.withInitial(() -> true); + + @Shadow + @Final + @Nullable + private SpriteContents.@Nullable Animation animation; + + @Shadow + public abstract boolean isPixelTransparent(int frame, int x, int y); + + @Inject(at = @At("RETURN"), method = "createAnimation(Lnet/minecraft/client/texture/SpriteDimensions;IILnet/minecraft/client/resource/metadata/AnimationResourceMetadata;)Lnet/minecraft/client/texture/SpriteContents$Animation;", cancellable = true) + void passInterpolateAlpha(SpriteDimensions dimensions, int imageWidth, int imageHeight, AnimationResourceMetadata metadata, CallbackInfoReturnable cir) { + AlphaInterpolationHolder returnValue = cir.getReturnValue(); + if (returnValue != null) { + returnValue.colourful_portals$setInterpolateAlpha(((AlphaInterpolationHolder) metadata).colourful_portals$isInterpolateAlpha()); + cir.setReturnValue(returnValue); + cir.cancel(); + } + } + + @Inject(at = @At("RETURN"), method = "isPixelTransparent(III)Z", cancellable = true) + void correctIsPixelTransparent(int frame, int x, int y, CallbackInfoReturnable cir) { + if (redirect.get() && animation != null && ((AlphaInterpolationHolder) animation).colourful_portals$isInterpolateAlpha()) { + redirect.set(false); + cir.setReturnValue(this.isPixelTransparent(frame, x, y) || this.isPixelTransparent(frame + 1, x, y)); + redirect.set(true); + cir.cancel(); + } + } + +} diff --git a/src/main/java/quimufu/colourful_portals/portal/PortalManager.java b/src/main/java/quimufu/colourful_portals/portal/PortalManager.java index ec5d95e..698b906 100644 --- a/src/main/java/quimufu/colourful_portals/portal/PortalManager.java +++ b/src/main/java/quimufu/colourful_portals/portal/PortalManager.java @@ -202,7 +202,7 @@ public class PortalManager { } } if (outgoingPortals.isEmpty()) { - Portal portal = Portal.entityType.create(fromPortalWorld); + Portal portal = Portal.ENTITY_TYPE.create(fromPortalWorld); if (portal == null) { LOGGER.error("could not create Portal entity for {}", fromPortal); return; diff --git a/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBlock.java b/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBlock.java index fd6586e..ad4997f 100644 --- a/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBlock.java +++ b/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBlock.java @@ -2,6 +2,7 @@ package quimufu.colourful_portals.portal_fluid; import net.minecraft.block.*; import net.minecraft.entity.ai.pathing.NavigationType; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; @@ -18,6 +19,7 @@ import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; import net.minecraft.world.World; import net.minecraft.world.WorldAccess; +import org.jetbrains.annotations.Nullable; import java.util.Collections; import java.util.List; @@ -116,7 +118,7 @@ public class PortalFluidBlock } @Override - public ItemStack tryDrainFluid(WorldAccess world, BlockPos pos, BlockState state) { + public ItemStack tryDrainFluid(PlayerEntity player, WorldAccess world, BlockPos pos, BlockState state) { if (state.getFluidState().get(PortalFluid.AMOUNT) == 16) { world.setBlockState(pos, Blocks.AIR.getDefaultState(), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD); return new ItemStack(this.fluid.getBucketItem()); @@ -126,6 +128,7 @@ public class PortalFluidBlock return ItemStack.EMPTY; } + @Override public Optional getBucketFillSound() { return fluid.getBucketFillSound(); diff --git a/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBucketItem.java b/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBucketItem.java index a655df0..f5936b3 100644 --- a/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBucketItem.java +++ b/src/main/java/quimufu/colourful_portals/portal_fluid/PortalFluidBucketItem.java @@ -35,7 +35,7 @@ public class PortalFluidBucketItem extends BucketItem { BlockPos pos = blockHitResult.getBlockPos(); BlockState blockState = world.getBlockState(pos); Block block = blockState.getBlock(); - if (block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(world, pos, blockState, fluid)) { + if (block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(user, world, pos, blockState, fluid)) { if (placeFluid(user, world, pos, blockHitResult)) { return TypedActionResult.success(BucketItem.getEmptiedStack(itemStack, user), world.isClient()); } @@ -63,7 +63,7 @@ public class PortalFluidBucketItem extends BucketItem { Block block = blockState.getBlock(); boolean shouldTryPlace = blockState.isAir() || blockState.canBucketPlace(this.fluid) - || block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(world, pos, blockState, this.fluid); + || block instanceof FluidFillable && ((FluidFillable) block).canFillWithFluid(player, world, pos, blockState, this.fluid); if (!shouldTryPlace) { return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null); } diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_black.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_black.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_black.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_black.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_blue.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_blue.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_blue.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_blue.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_brown.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_brown.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_brown.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_brown.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_cyan.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_cyan.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_cyan.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_cyan.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_gray.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_gray.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_gray.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_gray.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_green.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_green.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_green.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_green.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_blue.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_blue.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_blue.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_blue.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_gray.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_gray.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_gray.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_light_gray.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_lime.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_lime.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_lime.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_lime.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_magenta.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_magenta.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_magenta.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_magenta.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_orange.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_orange.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_orange.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_orange.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_pink.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_pink.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_pink.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_pink.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_purple.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_purple.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_purple.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_purple.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_red.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_red.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_red.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_red.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_white.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_white.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_white.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_white.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_block_yellow.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_block_yellow.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_block_yellow.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_block_yellow.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/assets/colourful_portals/textures/block/portal_still.png.mcmeta b/src/main/resources/assets/colourful_portals/textures/block/portal_still.png.mcmeta index ef624e7..ccba41e 100644 --- a/src/main/resources/assets/colourful_portals/textures/block/portal_still.png.mcmeta +++ b/src/main/resources/assets/colourful_portals/textures/block/portal_still.png.mcmeta @@ -1,6 +1,7 @@ { "animation": { "interpolate": true, - "frametime": 12 + "frametime": 12, + "interpolateAlpha": true } } \ No newline at end of file diff --git a/src/main/resources/colourful_portals.accesswidener b/src/main/resources/colourful_portals.accesswidener new file mode 100644 index 0000000..03d303e --- /dev/null +++ b/src/main/resources/colourful_portals.accesswidener @@ -0,0 +1,14 @@ +accessWidener v2 named +extendable class net/minecraft/client/texture/SpriteContents$Animation +accessible class net/minecraft/client/texture/SpriteContents$AnimationFrame +extendable class net/minecraft/client/texture/SpriteContents$Interpolation +accessible field net/minecraft/client/texture/SpriteContents$AnimationFrame time I +accessible field net/minecraft/client/texture/SpriteContents$Animation frames Ljava/util/List; +accessible field net/minecraft/client/texture/SpriteContents$AnimationFrame index I +accessible method net/minecraft/client/texture/SpriteContents$Animation upload (III)V +accessible method net/minecraft/client/texture/SpriteContents$Interpolation apply (IILnet/minecraft/client/texture/SpriteContents$AnimatorImpl;)V +accessible class net/minecraft/client/texture/SpriteContents$AnimatorImpl +accessible field net/minecraft/client/texture/SpriteContents mipmapLevelsImages [Lnet/minecraft/client/texture/NativeImage; +accessible method net/minecraft/client/texture/SpriteContents upload (IIII[Lnet/minecraft/client/texture/NativeImage;)V +accessible method net/minecraft/client/texture/SpriteContents$Animation getFrameX (I)I +accessible method net/minecraft/client/texture/SpriteContents$Animation getFrameY (I)I diff --git a/src/main/resources/colourful_portals.mixins.json b/src/main/resources/colourful_portals.mixins.json index ea48216..29fa1d8 100644 --- a/src/main/resources/colourful_portals.mixins.json +++ b/src/main/resources/colourful_portals.mixins.json @@ -10,7 +10,10 @@ }, "plugin": "quimufu.colourful_portals.MixinConfig", "client": [ - "InterpolationMixin", + "AnimationResourceMetadataReaderMixin", + "AnimationMixin", + "AnimationResourceMetadataMixin", + "SpriteContentsMixin", "SodiumFluidRendererMixin" ] } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 909e935..73d1ba0 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,16 +34,15 @@ "colourful_portals:portal_candidate_list" ], "sodium:options": { - "mixin.features.texture_updates": false } }, + "accessWidener" : "colourful_portals.accesswidener", "mixins": [ "colourful_portals.mixins.json" ], "depends": { "fabricloader": ">=${loader_version}", - "imm_ptl_core": ">=${immersive_portals_version_short}", - "q_misc_util": ">=${immersive_portals_version_short}", + "immersive_portals": ">=${immersive_portals_version_short}", "minecraft": "~${minecraft_version}", "java": ">=17", "fabric-api": "*"