Minor fixes to the fluids (#6150)
* Fixed vanilla rendering of fluids to take into account the alpha bits of the color, and fix usages accordingly. * Fixed missing texture derp.
This commit is contained in:
parent
b0c9d7cce9
commit
58335d7bc0
5 changed files with 104 additions and 55 deletions
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/client/renderer/FluidBlockRenderer.java
|
||||
+++ b/net/minecraft/client/renderer/FluidBlockRenderer.java
|
||||
@@ -58,8 +58,8 @@
|
||||
@@ -58,8 +58,9 @@
|
||||
|
||||
public boolean func_217638_a(IEnviromentBlockReader p_217638_1_, BlockPos p_217638_2_, BufferBuilder p_217638_3_, IFluidState p_217638_4_) {
|
||||
boolean flag = p_217638_4_.func_206884_a(FluidTags.field_206960_b);
|
||||
|
@ -8,6 +8,70 @@
|
|||
- int i = flag ? 16777215 : BiomeColors.func_217612_c(p_217638_1_, p_217638_2_);
|
||||
+ TextureAtlasSprite[] atextureatlassprite = net.minecraftforge.client.ForgeHooksClient.getFluidSprites(p_217638_1_, p_217638_2_, p_217638_4_);
|
||||
+ int i = p_217638_4_.func_206886_c().getAttributes().getColor(p_217638_1_, p_217638_2_);
|
||||
+ float alpha = (float)(i >> 24 & 255) / 255.0F;
|
||||
float f = (float)(i >> 16 & 255) / 255.0F;
|
||||
float f1 = (float)(i >> 8 & 255) / 255.0F;
|
||||
float f2 = (float)(i & 255) / 255.0F;
|
||||
@@ -145,15 +146,15 @@
|
||||
float f24 = 1.0F * f;
|
||||
float f25 = 1.0F * f1;
|
||||
float f26 = 1.0F * f2;
|
||||
- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d();
|
||||
if (p_217638_4_.func_205586_a(p_217638_1_, p_217638_2_.func_177984_a())) {
|
||||
- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, 1.0F).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f7, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f12, (double)f16).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f10, d2 + 0.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f15, (double)f19).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1 + (double)f9, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f14, (double)f18).func_187314_a(k, l).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 0.0D, d1 + (double)f8, d2 + 1.0D).func_181666_a(f24, f25, f26, alpha).func_187315_a((double)f13, (double)f17).func_187314_a(k, l).func_181675_d();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,10 +169,10 @@
|
||||
float f37 = 0.5F * f;
|
||||
float f38 = 0.5F * f1;
|
||||
float f40 = 0.5F * f2;
|
||||
- p_217638_3_.func_181662_b(d0, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f31, (double)f36).func_187314_a(j2, k2).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0, d1, d2).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f31, (double)f34).func_187314_a(j2, k2).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f32, (double)f34).func_187314_a(j2, k2).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, 1.0F).func_187315_a((double)f32, (double)f36).func_187314_a(j2, k2).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f31, (double)f36).func_187314_a(j2, k2).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0, d1, d2).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f31, (double)f34).func_187314_a(j2, k2).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f32, (double)f34).func_187314_a(j2, k2).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d0 + 1.0D, d1, d2 + 1.0D).func_181666_a(f37, f38, f40, alpha).func_187315_a((double)f32, (double)f36).func_187314_a(j2, k2).func_181675_d();
|
||||
flag7 = true;
|
||||
}
|
||||
|
||||
@@ -245,15 +246,15 @@
|
||||
float f28 = 1.0F * f27 * f;
|
||||
float f29 = 1.0F * f27 * f1;
|
||||
float f30 = 1.0F * f27 * f2;
|
||||
- p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
if (textureatlassprite2 != this.field_187501_d) {
|
||||
- p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d();
|
||||
- p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, 1.0F).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d3, d1 + 0.0D, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d5, d1 + 0.0D, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f49).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d5, d1 + (double)f35, d6).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f46, (double)f48).func_187314_a(j1, k1).func_181675_d();
|
||||
+ p_217638_3_.func_181662_b(d3, d1 + (double)f33, d4).func_181666_a(f28, f29, f30, alpha).func_187315_a((double)f45, (double)f47).func_187314_a(j1, k1).func_181675_d();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,49 +19,13 @@
|
|||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO;
|
||||
import static net.minecraftforge.fml.VersionChecker.Status.BETA;
|
||||
import static net.minecraftforge.fml.VersionChecker.Status.BETA_OUTDATED;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix3f;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
|
||||
import net.minecraft.client.MouseHelper;
|
||||
import net.minecraftforge.client.event.RecipesUpdatedEvent;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy;
|
||||
import org.apache.logging.log4j.core.impl.ReusableLogEventFactory;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.mojang.blaze3d.platform.GLX;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.GameSettings;
|
||||
import net.minecraft.client.MainWindow;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.MouseHelper;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundEngine;
|
||||
import net.minecraft.client.gui.ClientBossInfo;
|
||||
|
@ -70,27 +34,25 @@ import net.minecraft.client.gui.screen.MainMenuScreen;
|
|||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.BlockFaceUV;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemTransformVec3f;
|
||||
import net.minecraft.client.renderer.model.ModelManager;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.model.ModelRotation;
|
||||
import net.minecraft.client.renderer.model.SimpleBakedModel;
|
||||
import net.minecraft.client.renderer.color.BlockColors;
|
||||
import net.minecraft.client.renderer.color.ItemColors;
|
||||
import net.minecraft.client.renderer.entity.model.BipedModel;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.texture.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
|
@ -112,7 +74,6 @@ import net.minecraft.util.math.MathHelper;
|
|||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.client.event.ColorHandlerEvent;
|
||||
|
@ -120,8 +81,10 @@ import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
|||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.client.event.FOVUpdateEvent;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
import net.minecraftforge.client.event.InputUpdateEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.RecipesUpdatedEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderSpecificHandEvent;
|
||||
|
@ -133,20 +96,43 @@ import net.minecraftforge.client.model.ModelDynBucket;
|
|||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.model.animation.Animation;
|
||||
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
|
||||
import net.minecraftforge.client.event.InputEvent;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.model.IModelPart;
|
||||
import net.minecraftforge.common.model.ITransformation;
|
||||
import net.minecraftforge.common.model.TRSRTransformation;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.ModLoader;
|
||||
import net.minecraftforge.fml.VersionChecker;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.resource.ReloadRequirements;
|
||||
import net.minecraftforge.resource.SelectiveReloadStateHandler;
|
||||
import net.minecraftforge.resource.VanillaResourceType;
|
||||
import net.minecraftforge.versions.forge.ForgeVersion;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.async.ThreadNameCachingStrategy;
|
||||
import org.apache.logging.log4j.core.impl.ReusableLogEventFactory;
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix3f;
|
||||
import javax.vecmath.Matrix4f;
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Field;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.*;
|
||||
|
||||
import static net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType.BOSSINFO;
|
||||
import static net.minecraftforge.fml.VersionChecker.Status.BETA;
|
||||
import static net.minecraftforge.fml.VersionChecker.Status.BETA_OUTDATED;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL20.*;
|
||||
|
||||
public class ForgeHooksClient
|
||||
{
|
||||
|
@ -574,6 +560,7 @@ public class ForgeHooksClient
|
|||
{
|
||||
ForgeRegistries.FLUIDS.getValues().stream()
|
||||
.flatMap(f -> f.getAttributes().getTextures())
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(textures::add);
|
||||
}
|
||||
|
||||
|
|
|
@ -834,9 +834,7 @@ public class ForgeHooks
|
|||
public static FluidAttributes createVanillaFluidAttributes(Fluid fluid)
|
||||
{
|
||||
if (fluid instanceof EmptyFluid)
|
||||
return net.minecraftforge.fluids.FluidAttributes.builder(
|
||||
new net.minecraft.util.ResourceLocation("white"),
|
||||
new net.minecraft.util.ResourceLocation("white"))
|
||||
return net.minecraftforge.fluids.FluidAttributes.builder(null, null)
|
||||
.translationKey("block.minecraft.air")
|
||||
.color(0).density(0).temperature(0).luminosity(0).viscosity(0).build(fluid);
|
||||
if (fluid instanceof WaterFluid)
|
||||
|
@ -845,7 +843,7 @@ public class ForgeHooks
|
|||
new net.minecraft.util.ResourceLocation("block/water_flow"))
|
||||
.overlay(new net.minecraft.util.ResourceLocation("block/water_overlay"))
|
||||
.translationKey("block.minecraft.water")
|
||||
.color(0x3F76E4).build(fluid);
|
||||
.color(0xFF3F76E4).build(fluid);
|
||||
if (fluid instanceof LavaFluid)
|
||||
return net.minecraftforge.fluids.FluidAttributes.builder(
|
||||
new net.minecraft.util.ResourceLocation("block/lava_still"),
|
||||
|
|
|
@ -445,7 +445,7 @@ public class FluidAttributes
|
|||
@Override
|
||||
public int getColor(IEnviromentBlockReader world, BlockPos pos)
|
||||
{
|
||||
return BiomeColors.getWaterColor(world, pos);
|
||||
return BiomeColors.getWaterColor(world, pos) | 0xFF000000;
|
||||
}
|
||||
|
||||
public static Builder builder(ResourceLocation stillTexture, ResourceLocation flowingTexture) {
|
||||
|
|
|
@ -68,7 +68,7 @@ public class NewFluidTest
|
|||
);
|
||||
|
||||
public static final ForgeFlowingFluid.Properties test_fluid_properties =
|
||||
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).color(0x1080FF))
|
||||
new ForgeFlowingFluid.Properties(test_fluid, test_fluid_flowing, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING).color(0x3F1080FF))
|
||||
.bucket(test_fluid_bucket).block(test_fluid_block);
|
||||
|
||||
public NewFluidTest()
|
||||
|
|
Loading…
Reference in a new issue