|
21 | 21 | import dev.engine_room.flywheel.lib.visual.util.SmartRecycler;
|
22 | 22 | import net.createmod.catnip.animation.LerpedFloat;
|
23 | 23 | import net.createmod.catnip.data.Iterate;
|
24 |
| -import net.minecraft.client.Minecraft; |
25 | 24 | import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
26 | 25 | import net.minecraft.core.Direction;
|
27 | 26 | import net.minecraft.util.Mth;
|
28 |
| -import net.minecraft.world.inventory.InventoryMenu; |
29 |
| -import net.minecraft.world.level.material.Fluid; |
| 27 | + |
| 28 | +import net.fabricmc.fabric.api.transfer.v1.client.fluid.FluidVariantRendering; |
| 29 | +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariant; |
| 30 | +import net.fabricmc.fabric.api.transfer.v1.fluid.FluidVariantAttributes; |
30 | 31 |
|
31 | 32 | import io.github.fabricators_of_create.porting_lib.fluids.FluidStack;
|
32 |
| -import io.github.fabricators_of_create.porting_lib.fluids.FluidType; |
33 | 33 |
|
34 | 34 | public class GlassPipeVisual extends AbstractBlockEntityVisual<StraightPipeBlockEntity> implements SimpleDynamicVisual {
|
35 | 35 |
|
@@ -90,16 +90,19 @@ public void beginFrame(Context ctx) {
|
90 | 90 | }
|
91 | 91 | }
|
92 | 92 |
|
93 |
| - Fluid fluid = fluidStack.getFluid(); |
94 |
| - IClientFluidTypeExtensions clientFluid = IClientFluidTypeExtensions.of(fluid); |
95 |
| - FluidType fluidAttributes = fluid.getFluidType(); |
96 |
| - var atlas = Minecraft.getInstance() |
97 |
| - .getTextureAtlas(InventoryMenu.BLOCK_ATLAS); |
98 |
| - TextureAtlasSprite flowTexture = atlas.apply(clientFluid.getFlowingTexture(fluidStack)); |
| 93 | + FluidVariant variant = fluidStack.getType(); |
| 94 | + @Nullable TextureAtlasSprite[] sprites = FluidVariantRendering.getSprites(variant); |
| 95 | + if (sprites == null) { |
| 96 | + stream.discardExtra(); |
| 97 | + surface.discardExtra(); |
| 98 | + return; |
| 99 | + } |
| 100 | + |
| 101 | + TextureAtlasSprite flowTexture = sprites[1]; |
99 | 102 |
|
100 |
| - int color = clientFluid.getTintColor(fluidStack); |
| 103 | + int color = FluidVariantRendering.getColor(fluidStack.getType()); |
101 | 104 | int blockLightIn = (light >> 4) & 0xF;
|
102 |
| - int luminosity = Math.max(blockLightIn, fluidAttributes.getLightLevel(fluidStack)); |
| 105 | + int luminosity = Math.max(blockLightIn, FluidVariantAttributes.getLuminance(variant)); |
103 | 106 | int light = (this.light & 0xF00000) | luminosity << 4;
|
104 | 107 |
|
105 | 108 | if (inbound)
|
@@ -127,7 +130,7 @@ public void beginFrame(Context ctx) {
|
127 | 130 | fluidInstance.setChanged();
|
128 | 131 |
|
129 | 132 | if (progress != 1) {
|
130 |
| - TextureAtlasSprite stillTexture = atlas.apply(clientFluid.getStillTexture(fluidStack)); |
| 133 | + TextureAtlasSprite stillTexture = sprites[1]; |
131 | 134 | surface.get(stillTexture)
|
132 | 135 | .setIdentityTransform()
|
133 | 136 | .translate(getVisualPosition())
|
|
0 commit comments