update dependencies, more sane alpha interpolation implementation
This commit is contained in:
		
							parent
							
								
									265d71ae67
								
							
						
					
					
						commit
						ec041f9269
					
				
							
								
								
									
										42
									
								
								build.gradle
									
									
									
									
									
								
							
							
						
						
									
										42
									
								
								build.gradle
									
									
									
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| plugins { | plugins { | ||||||
|     id "com.modrinth.minotaur" version "2.+" |     id "com.modrinth.minotaur" version "2.+" | ||||||
|     id 'fabric-loom' version '1.2-SNAPSHOT' |     id 'fabric-loom' version '1.5-SNAPSHOT' | ||||||
|     id 'maven-publish' |     id 'maven-publish' | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -21,6 +21,10 @@ repositories { | |||||||
|         name = 'Ladysnake Mods' |         name = 'Ladysnake Mods' | ||||||
|         url = 'https://ladysnake.jfrog.io/artifactory/mods' |         url = 'https://ladysnake.jfrog.io/artifactory/mods' | ||||||
|     } |     } | ||||||
|  |     maven { | ||||||
|  |         name = "Ladysnake Mods" | ||||||
|  |         url = 'https://maven.ladysnake.org/releases' | ||||||
|  |     } | ||||||
|     maven { |     maven { | ||||||
|         url = "https://api.modrinth.com/maven" |         url = "https://api.modrinth.com/maven" | ||||||
|     } |     } | ||||||
| @ -50,32 +54,12 @@ dependencies { | |||||||
| 
 | 
 | ||||||
|     // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" |     // modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}" | ||||||
| 
 | 
 | ||||||
|     // Dependency of Immersive Portals Core: |     modImplementation ("com.github.iPortalTeam:ImmersivePortalsMod:${project.immersive_portals_version}") | ||||||
|     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) |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     // Dependency of the Miscellaneous Utility Library from qouteall |     include(modApi("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cardinal_components_version}")) | ||||||
|     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}")) { |  | ||||||
|         exclude(group: "net.fabricmc.fabric-loader") |  | ||||||
|         transitive(false) |  | ||||||
|     } |  | ||||||
|     // Replace modImplementation with modApi if you expose components in your own API |     // 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}")) { |     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(modApi(platform("de.siphalor.tweed4:tweed4-bom-$project.minecraft_version_major:$project.tweed_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.: |     // 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")) |     include(modApi("de.siphalor.tweed4:tweed4-tailor-screen-$project.minecraft_version_major")) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|     modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version") { |     modImplementation("me.shedaniel.cloth:cloth-config-fabric:$project.cloth_config_version")  | ||||||
|         exclude(group: "net.fabricmc.fabric-api") |  | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     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 | configurations.include.transitive = true | ||||||
|  | |||||||
| @ -4,21 +4,21 @@ org.gradle.parallel=true | |||||||
| 
 | 
 | ||||||
| # Fabric Properties | # Fabric Properties | ||||||
| # check these on https://fabricmc.net/develop | # check these on https://fabricmc.net/develop | ||||||
| minecraft_version=1.20.1 | minecraft_version=1.20.4 | ||||||
| yarn_mappings=1.20.1+build.8 |  | ||||||
| loader_version=0.14.21 |  | ||||||
| minecraft_version_major=1.20 | minecraft_version_major=1.20 | ||||||
|  | yarn_mappings=1.20.4+build.3 | ||||||
|  | loader_version=0.15.7 | ||||||
| 
 | 
 | ||||||
| # Mod Properties | # Mod Properties | ||||||
| mod_version=0.9.3 | mod_version=0.9.3.1 | ||||||
| maven_group=quimufu.colourful-portals | maven_group=quimufu.colourful-portals | ||||||
| archives_base_name=colourful-portals | archives_base_name=colourful-portals | ||||||
| 
 | 
 | ||||||
| # Dependencies | # Dependencies | ||||||
| fabric_version=0.84.0+1.20.1 | fabric_version=0.96.11+1.20.4 | ||||||
| cardinal_components_version=5.2.1 | cardinal_components_version=5.4.0 | ||||||
| immersive_portals_version_short=3.1.0 | immersive_portals_version_short=5.1.7 | ||||||
| immersive_portals_version=v3.1.0-mc1.20.1 | immersive_portals_version=v5.1.7-mc1.20.4 | ||||||
| tweed_version=1.3.0+mc1.20-pre1 | tweed_version=1.3.0+mc1.20.2 | ||||||
| sodium_version=0.4.10 | sodium_version=mc1.20.4-0.5.8 | ||||||
| cloth_config_version=11.0.99 | cloth_config_version=13.0.121 | ||||||
							
								
								
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								gradle/wrapper/gradle-wrapper.properties
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,6 @@ | |||||||
| distributionBase=GRADLE_USER_HOME | distributionBase=GRADLE_USER_HOME | ||||||
| distributionPath=wrapper/dists | 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 | networkTimeout=10000 | ||||||
| zipStoreBase=GRADLE_USER_HOME | zipStoreBase=GRADLE_USER_HOME | ||||||
| zipStorePath=wrapper/dists | zipStorePath=wrapper/dists | ||||||
|  | |||||||
| @ -36,7 +36,7 @@ public class ColourfulPortalsMod implements ModInitializer { | |||||||
|     public static final Item BLOB_DARK = new Item(new FabricItemSettings()); |     public static final Item BLOB_DARK = new Item(new FabricItemSettings()); | ||||||
|     public static final Item BLOB_BRIGHT = 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 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)); |     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) { |     private static boolean never(BlockState blockState, BlockView blockView, BlockPos blockPos, EntityType<?> entityType) { | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ import net.minecraft.block.Block; | |||||||
| import net.minecraft.block.BlockState; | import net.minecraft.block.BlockState; | ||||||
| import net.minecraft.block.FluidFillable; | import net.minecraft.block.FluidFillable; | ||||||
| import net.minecraft.block.ShapeContext; | import net.minecraft.block.ShapeContext; | ||||||
|  | import net.minecraft.entity.player.PlayerEntity; | ||||||
| import net.minecraft.fluid.Fluid; | import net.minecraft.fluid.Fluid; | ||||||
| import net.minecraft.fluid.FluidState; | import net.minecraft.fluid.FluidState; | ||||||
| import net.minecraft.item.ItemPlacementContext; | import net.minecraft.item.ItemPlacementContext; | ||||||
| @ -21,6 +22,7 @@ import net.minecraft.util.shape.VoxelShapes; | |||||||
| import net.minecraft.world.BlockView; | import net.minecraft.world.BlockView; | ||||||
| import net.minecraft.world.World; | import net.minecraft.world.World; | ||||||
| import net.minecraft.world.WorldAccess; | import net.minecraft.world.WorldAccess; | ||||||
|  | import org.jetbrains.annotations.Nullable; | ||||||
| import quimufu.colourful_portals.portal.PortalManager; | import quimufu.colourful_portals.portal.PortalManager; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| @ -119,7 +121,7 @@ public class PortalBlock extends Block implements FluidFillable { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @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) { |         if (((World) world).isClient() && fluid == ColourfulPortalsMod.PORTAL_FLUID) { | ||||||
|             return true; |             return true; | ||||||
|         } |         } | ||||||
| @ -128,6 +130,7 @@ public class PortalBlock extends Block implements FluidFillable { | |||||||
|                 && PortalManager.canExtend((ServerWorld) world, pos); |                 && PortalManager.canExtend((ServerWorld) world, pos); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { |     public boolean tryFillWithFluid(WorldAccess world, BlockPos pos, BlockState state, FluidState fluidState) { | ||||||
|         if (world.isClient() && fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)) { |         if (world.isClient() && fluidState.isOf(ColourfulPortalsMod.PORTAL_FLUID)) { | ||||||
|  | |||||||
| @ -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<SpriteContents.AnimationFrame> 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(); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,8 @@ | |||||||
|  | package quimufu.colourful_portals.client; | ||||||
|  | 
 | ||||||
|  | public interface AlphaInterpolationHolder { | ||||||
|  | 
 | ||||||
|  |     public void colourful_portals$setInterpolateAlpha(boolean interpolateAlpha); | ||||||
|  |     public boolean colourful_portals$isInterpolateAlpha(); | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -81,10 +81,10 @@ public class CommonPortalFluidRenderer { | |||||||
|                 } |                 } | ||||||
|                 calcSquishedUVs(axis, 1.f - offsetInSquishedDir, offsetInSquishedDir, direction, (amount & 1) == 1); |                 calcSquishedUVs(axis, 1.f - offsetInSquishedDir, offsetInSquishedDir, direction, (amount & 1) == 1); | ||||||
|             } else { |             } else { | ||||||
|                 uIu2IvIv2[0] = sprite.getFrameU(0.); |                 uIu2IvIv2[0] = sprite.getFrameU(0.F); | ||||||
|                 uIu2IvIv2[1] = sprite.getFrameU(16.); |                 uIu2IvIv2[1] = sprite.getFrameU(1.F); | ||||||
|                 uIu2IvIv2[2] = sprite.getFrameV(0.); |                 uIu2IvIv2[2] = sprite.getFrameV(0.F); | ||||||
|                 uIu2IvIv2[3] = sprite.getFrameV(16.); |                 uIu2IvIv2[3] = sprite.getFrameV(1.F); | ||||||
| 
 | 
 | ||||||
|             } |             } | ||||||
|             drawSide(vertexEater, x, y, z, x2, y2, z2, direction, uIu2IvIv2[0], uIu2IvIv2[2], uIu2IvIv2[1], uIu2IvIv2[3], offset); |             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) { |         switch (axis) { | ||||||
|             case X -> { |             case X -> { | ||||||
|                 if (odd) { |                 if (odd) { | ||||||
|                     uIu2IvIv2[0] = sprite.getFrameU(0.5 + squishedBottom * 16D); |                     uIu2IvIv2[0] = sprite.getFrameU(0.5F + squishedBottom); | ||||||
|                     uIu2IvIv2[1] = sprite.getFrameU(0.5 + squishedTop * 16D); |                     uIu2IvIv2[1] = sprite.getFrameU(0.5F + squishedTop); | ||||||
| 
 | 
 | ||||||
|                 } else { |                 } else { | ||||||
|                     uIu2IvIv2[0] = sprite.getFrameU(0. + squishedBottom * 16D); |                     uIu2IvIv2[0] = sprite.getFrameU(0.F + squishedBottom); | ||||||
|                     uIu2IvIv2[1] = sprite.getFrameU(squishedTop * 16D); |                     uIu2IvIv2[1] = sprite.getFrameU(squishedTop); | ||||||
|                 } |                 } | ||||||
|                 uIu2IvIv2[2] = sprite.getFrameV(0.); |                 uIu2IvIv2[2] = sprite.getFrameV(0.F); | ||||||
|                 uIu2IvIv2[3] = sprite.getFrameV(16.); |                 uIu2IvIv2[3] = sprite.getFrameV(16.F); | ||||||
|             } |             } | ||||||
|             case Z -> { |             case Z -> { | ||||||
|                 if (direction.getAxis() == Direction.Axis.Y) { |                 if (direction.getAxis() == Direction.Axis.Y) { | ||||||
|                     if (odd) { |                     if (odd) { | ||||||
|                         uIu2IvIv2[2] = sprite.getFrameV(0.5 + squishedBottom * 16D); |                         uIu2IvIv2[2] = sprite.getFrameV(0.5F + squishedBottom); | ||||||
|                         uIu2IvIv2[3] = sprite.getFrameV(0.5 + squishedTop * 16D); |                         uIu2IvIv2[3] = sprite.getFrameV(0.5F + squishedTop); | ||||||
| 
 | 
 | ||||||
|                     } else { |                     } else { | ||||||
|                         uIu2IvIv2[2] = sprite.getFrameV(squishedBottom * 16D); |                         uIu2IvIv2[2] = sprite.getFrameV(squishedBottom); | ||||||
|                         uIu2IvIv2[3] = sprite.getFrameV(squishedTop * 16D); |                         uIu2IvIv2[3] = sprite.getFrameV(squishedTop); | ||||||
|                     } |                     } | ||||||
|                     uIu2IvIv2[0] = sprite.getFrameU(0.); |                     uIu2IvIv2[0] = sprite.getFrameU(0.F); | ||||||
|                     uIu2IvIv2[1] = sprite.getFrameU(16.); |                     uIu2IvIv2[1] = sprite.getFrameU(1.F); | ||||||
|                 } else { |                 } else { | ||||||
|                     if (odd) { |                     if (odd) { | ||||||
|                         uIu2IvIv2[0] = sprite.getFrameU(0.5 + squishedBottom * 16D); |                         uIu2IvIv2[0] = sprite.getFrameU(0.5F + squishedBottom); | ||||||
|                         uIu2IvIv2[1] = sprite.getFrameU(0.5 + squishedTop * 16D); |                         uIu2IvIv2[1] = sprite.getFrameU(0.5F + squishedTop); | ||||||
| 
 | 
 | ||||||
|                     } else { |                     } else { | ||||||
|                         uIu2IvIv2[0] = sprite.getFrameU(squishedBottom * 16D); |                         uIu2IvIv2[0] = sprite.getFrameU(squishedBottom); | ||||||
|                         uIu2IvIv2[1] = sprite.getFrameU(squishedTop * 16D); |                         uIu2IvIv2[1] = sprite.getFrameU(squishedTop); | ||||||
|                     } |                     } | ||||||
|                     uIu2IvIv2[2] = sprite.getFrameV(0.); |                     uIu2IvIv2[2] = sprite.getFrameV(0.F); | ||||||
|                     uIu2IvIv2[3] = sprite.getFrameV(16.); |                     uIu2IvIv2[3] = sprite.getFrameV(1.F); | ||||||
| 
 | 
 | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             case Y -> { |             case Y -> { | ||||||
|                 if (odd) { |                 if (odd) { | ||||||
|                     uIu2IvIv2[2] = sprite.getFrameV(0.5 + squishedBottom * 16D); |                     uIu2IvIv2[2] = sprite.getFrameV(0.5F + squishedBottom); | ||||||
|                     uIu2IvIv2[3] = sprite.getFrameV(0.5 + squishedTop * 16D); |                     uIu2IvIv2[3] = sprite.getFrameV(0.5F + squishedTop); | ||||||
| 
 | 
 | ||||||
|                 } else { |                 } else { | ||||||
|                     uIu2IvIv2[2] = sprite.getFrameV(squishedBottom * 16D); |                     uIu2IvIv2[2] = sprite.getFrameV(squishedBottom); | ||||||
|                     uIu2IvIv2[3] = sprite.getFrameV(squishedTop * 16D); |                     uIu2IvIv2[3] = sprite.getFrameV(squishedTop); | ||||||
|                 } |                 } | ||||||
|                 uIu2IvIv2[0] = sprite.getFrameU(0.); |                 uIu2IvIv2[0] = sprite.getFrameU(0.F); | ||||||
|                 uIu2IvIv2[1] = sprite.getFrameU(16.); |                 uIu2IvIv2[1] = sprite.getFrameU(1.F); | ||||||
|             } |             } | ||||||
|             default -> throw new IllegalStateException("Unexpected value: " + axis); |             default -> throw new IllegalStateException("Unexpected value: " + axis); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -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.ModelQuadViewMutable; | ||||||
| import me.jellysquid.mods.sodium.client.model.quad.properties.ModelQuadFacing; | 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.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.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.EnvType; | ||||||
| import net.fabricmc.api.Environment; | import net.fabricmc.api.Environment; | ||||||
| import net.minecraft.client.texture.Sprite; | import net.minecraft.client.texture.Sprite; | ||||||
| @ -25,12 +28,14 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer | |||||||
|     private final ChunkVertexEncoder.Vertex[] vertices = ChunkVertexEncoder.Vertex.uninitializedQuad(); |     private final ChunkVertexEncoder.Vertex[] vertices = ChunkVertexEncoder.Vertex.uninitializedQuad(); | ||||||
|     private int i; |     private int i; | ||||||
|     private ChunkModelBuilder chunkModelBuilder; |     private ChunkModelBuilder chunkModelBuilder; | ||||||
|  |     private Material material; | ||||||
| 
 | 
 | ||||||
|     public SodiumPortalFluidRenderHandler() { |     public SodiumPortalFluidRenderHandler() { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public boolean render(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkModelBuilder buffers) { |     public boolean render(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkBuildBuffers buffers) { | ||||||
|         this.chunkModelBuilder = buffers; |         material = DefaultMaterials.forFluidState(fluidState); | ||||||
|  |         this.chunkModelBuilder = buffers.get(material); | ||||||
|         return commonPortalFluidRenderer.render(world,fluidState,pos,offset,this); |         return commonPortalFluidRenderer.render(world,fluidState,pos,offset,this); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| @ -53,15 +58,14 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer | |||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|     public void drawQuad(BlockPos offset, Direction direction) { |     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) { |     private void writeQuad(ChunkModelBuilder builder, Material material, BlockPos offset, ModelQuadView quad, ModelQuadFacing facing, boolean flip) { | ||||||
|         var vertexBuffer = builder.getVertexBuffer(); |  | ||||||
|         var vertices = this.vertices; |         var vertices = this.vertices; | ||||||
| 
 | 
 | ||||||
|         for (int i = 0; i < 4; i++) { |         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.x = offset.getX() + quad.getX(i); | ||||||
|             out.y = offset.getY() + quad.getY(i); |             out.y = offset.getY() + quad.getY(i); | ||||||
|             out.z = offset.getZ() + quad.getZ(i); |             out.z = offset.getZ() + quad.getZ(i); | ||||||
| @ -77,8 +81,8 @@ public class SodiumPortalFluidRenderHandler implements CommonPortalFluidRenderer | |||||||
|             builder.addSprite(sprite); |             builder.addSprite(sprite); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         builder.getIndexBuffer(facing) |         var vertexBuffer = builder.getVertexBuffer(facing); | ||||||
|                 .add(vertexBuffer.push(vertices), winding); |         vertexBuffer.push(vertices, material); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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 = "<init>", 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<Animator> cir) { | ||||||
|  |         if (this.interpolateAlpha && this.interpolation) { | ||||||
|  |             cir.setReturnValue(new AlphaBlendingAnimator(parent, (SpriteContents.Animation) (Object) this)); | ||||||
|  |             cir.cancel(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -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; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -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<AnimationResourceMetadata> cir) { | ||||||
|  |         boolean interpolateAlpha = JsonHelper.getBoolean(jsonObject, "interpolateAlpha", false); | ||||||
|  |         AnimationResourceMetadata returnValue = cir.getReturnValue(); | ||||||
|  |         ((AlphaInterpolationHolder)returnValue).colourful_portals$setInterpolateAlpha(interpolateAlpha); | ||||||
|  |         cir.setReturnValue(returnValue); | ||||||
|  |         cir.cancel(); | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -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<Integer> colourBefore = new ThreadLocal<>(); |  | ||||||
|     ThreadLocal<Double> 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; |  | ||||||
|     } |  | ||||||
| } |  | ||||||
| @ -1,13 +1,16 @@ | |||||||
| package quimufu.colourful_portals.mixin; | 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.buffers.ChunkModelBuilder; | ||||||
| import me.jellysquid.mods.sodium.client.render.chunk.compile.pipeline.FluidRenderer; | 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.fluid.FluidState; | ||||||
| import net.minecraft.util.math.BlockPos; | import net.minecraft.util.math.BlockPos; | ||||||
| import net.minecraft.world.BlockRenderView; | import net.minecraft.world.BlockRenderView; | ||||||
| import org.spongepowered.asm.mixin.Mixin; | import org.spongepowered.asm.mixin.Mixin; | ||||||
| import org.spongepowered.asm.mixin.injection.At; | import org.spongepowered.asm.mixin.injection.At; | ||||||
| import org.spongepowered.asm.mixin.injection.Inject; | import org.spongepowered.asm.mixin.injection.Inject; | ||||||
|  | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||||||
| import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||||||
| import quimufu.colourful_portals.client.SodiumPortalFluidRenderHandler; | import quimufu.colourful_portals.client.SodiumPortalFluidRenderHandler; | ||||||
| 
 | 
 | ||||||
| @ -19,10 +22,10 @@ public class SodiumFluidRendererMixin { | |||||||
|     private final SodiumPortalFluidRenderHandler sodiumPortalFluidRenderHandler = new SodiumPortalFluidRenderHandler(); |     private final SodiumPortalFluidRenderHandler sodiumPortalFluidRenderHandler = new SodiumPortalFluidRenderHandler(); | ||||||
| 
 | 
 | ||||||
|     @Inject(at = @At("HEAD"), method = "render", cancellable = true, remap = false) |     @Inject(at = @At("HEAD"), method = "render", cancellable = true, remap = false) | ||||||
|     private void init(BlockRenderView world, FluidState fluidState, BlockPos pos, BlockPos offset, ChunkModelBuilder buffers, CallbackInfoReturnable<Boolean> cir) { |     private void init(WorldSlice world, FluidState fluidState, BlockPos blockPos, BlockPos offset, ChunkBuildBuffers buffers, CallbackInfo ci) { | ||||||
|         if (fluidState.isOf(PORTAL_FLUID)) { |         if (fluidState.isOf(PORTAL_FLUID)) { | ||||||
|             cir.setReturnValue(sodiumPortalFluidRenderHandler.render(world, fluidState, pos, offset, buffers)); |             sodiumPortalFluidRenderHandler.render(world, fluidState, blockPos, offset, buffers); | ||||||
|             cir.cancel(); |             ci.cancel(); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | |||||||
| @ -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<Boolean> 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<AlphaInterpolationHolder> 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<Boolean> 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(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -202,7 +202,7 @@ public class PortalManager { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (outgoingPortals.isEmpty()) { |         if (outgoingPortals.isEmpty()) { | ||||||
|             Portal portal = Portal.entityType.create(fromPortalWorld); |             Portal portal = Portal.ENTITY_TYPE.create(fromPortalWorld); | ||||||
|             if (portal == null) { |             if (portal == null) { | ||||||
|                 LOGGER.error("could not create Portal entity for  {}", fromPortal); |                 LOGGER.error("could not create Portal entity for  {}", fromPortal); | ||||||
|                 return; |                 return; | ||||||
|  | |||||||
| @ -2,6 +2,7 @@ package quimufu.colourful_portals.portal_fluid; | |||||||
| 
 | 
 | ||||||
| import net.minecraft.block.*; | import net.minecraft.block.*; | ||||||
| import net.minecraft.entity.ai.pathing.NavigationType; | import net.minecraft.entity.ai.pathing.NavigationType; | ||||||
|  | import net.minecraft.entity.player.PlayerEntity; | ||||||
| import net.minecraft.fluid.FluidState; | import net.minecraft.fluid.FluidState; | ||||||
| import net.minecraft.item.ItemStack; | import net.minecraft.item.ItemStack; | ||||||
| import net.minecraft.item.Items; | import net.minecraft.item.Items; | ||||||
| @ -18,6 +19,7 @@ import net.minecraft.util.shape.VoxelShapes; | |||||||
| import net.minecraft.world.BlockView; | import net.minecraft.world.BlockView; | ||||||
| import net.minecraft.world.World; | import net.minecraft.world.World; | ||||||
| import net.minecraft.world.WorldAccess; | import net.minecraft.world.WorldAccess; | ||||||
|  | import org.jetbrains.annotations.Nullable; | ||||||
| 
 | 
 | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @ -116,7 +118,7 @@ public class PortalFluidBlock | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @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) { |         if (state.getFluidState().get(PortalFluid.AMOUNT) == 16) { | ||||||
|             world.setBlockState(pos, Blocks.AIR.getDefaultState(), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD); |             world.setBlockState(pos, Blocks.AIR.getDefaultState(), Block.NOTIFY_ALL | Block.REDRAW_ON_MAIN_THREAD); | ||||||
|             return new ItemStack(this.fluid.getBucketItem()); |             return new ItemStack(this.fluid.getBucketItem()); | ||||||
| @ -126,6 +128,7 @@ public class PortalFluidBlock | |||||||
|         return ItemStack.EMPTY; |         return ItemStack.EMPTY; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|     @Override |     @Override | ||||||
|     public Optional<SoundEvent> getBucketFillSound() { |     public Optional<SoundEvent> getBucketFillSound() { | ||||||
|         return fluid.getBucketFillSound(); |         return fluid.getBucketFillSound(); | ||||||
|  | |||||||
| @ -35,7 +35,7 @@ public class PortalFluidBucketItem extends BucketItem { | |||||||
|             BlockPos pos = blockHitResult.getBlockPos(); |             BlockPos pos = blockHitResult.getBlockPos(); | ||||||
|             BlockState blockState = world.getBlockState(pos); |             BlockState blockState = world.getBlockState(pos); | ||||||
|             Block block = blockState.getBlock(); |             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)) { |                 if (placeFluid(user, world, pos, blockHitResult)) { | ||||||
|                     return TypedActionResult.success(BucketItem.getEmptiedStack(itemStack, user), world.isClient()); |                     return TypedActionResult.success(BucketItem.getEmptiedStack(itemStack, user), world.isClient()); | ||||||
|                 } |                 } | ||||||
| @ -63,7 +63,7 @@ public class PortalFluidBucketItem extends BucketItem { | |||||||
|         Block block = blockState.getBlock(); |         Block block = blockState.getBlock(); | ||||||
|         boolean shouldTryPlace = blockState.isAir() |         boolean shouldTryPlace = blockState.isAir() | ||||||
|                 || blockState.canBucketPlace(this.fluid) |                 || 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) { |         if (!shouldTryPlace) { | ||||||
|             return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null); |             return hitResult != null && this.placeFluid(player, world, hitResult.getBlockPos().offset(hitResult.getSide()), null); | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,6 +1,7 @@ | |||||||
| { | { | ||||||
|   "animation": { |   "animation": { | ||||||
|     "interpolate": true, |     "interpolate": true, | ||||||
|     "frametime": 12 |     "frametime": 12, | ||||||
|  |     "interpolateAlpha": true | ||||||
|   } |   } | ||||||
| } | } | ||||||
							
								
								
									
										14
									
								
								src/main/resources/colourful_portals.accesswidener
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/main/resources/colourful_portals.accesswidener
									
									
									
									
									
										Normal file
									
								
							| @ -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 | ||||||
| @ -10,7 +10,10 @@ | |||||||
|   }, |   }, | ||||||
|   "plugin": "quimufu.colourful_portals.MixinConfig", |   "plugin": "quimufu.colourful_portals.MixinConfig", | ||||||
|   "client": [ |   "client": [ | ||||||
|     "InterpolationMixin", |     "AnimationResourceMetadataReaderMixin", | ||||||
|  |     "AnimationMixin", | ||||||
|  |     "AnimationResourceMetadataMixin", | ||||||
|  |     "SpriteContentsMixin", | ||||||
|     "SodiumFluidRendererMixin" |     "SodiumFluidRendererMixin" | ||||||
|   ] |   ] | ||||||
| } | } | ||||||
| @ -34,16 +34,15 @@ | |||||||
|       "colourful_portals:portal_candidate_list" |       "colourful_portals:portal_candidate_list" | ||||||
|     ], |     ], | ||||||
|     "sodium:options": { |     "sodium:options": { | ||||||
|       "mixin.features.texture_updates": false |  | ||||||
|     } |     } | ||||||
|   }, |   }, | ||||||
|  |   "accessWidener" : "colourful_portals.accesswidener", | ||||||
|   "mixins": [ |   "mixins": [ | ||||||
|     "colourful_portals.mixins.json" |     "colourful_portals.mixins.json" | ||||||
|   ], |   ], | ||||||
|   "depends": { |   "depends": { | ||||||
|     "fabricloader": ">=${loader_version}", |     "fabricloader": ">=${loader_version}", | ||||||
|     "imm_ptl_core": ">=${immersive_portals_version_short}", |     "immersive_portals": ">=${immersive_portals_version_short}", | ||||||
|     "q_misc_util": ">=${immersive_portals_version_short}", |  | ||||||
|     "minecraft": "~${minecraft_version}", |     "minecraft": "~${minecraft_version}", | ||||||
|     "java": ">=17", |     "java": ">=17", | ||||||
|     "fabric-api": "*" |     "fabric-api": "*" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user