mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-23 21:49:46 +00:00
Some (sadly breaking) improvements to the Fluid API (#6110)
* Some (sadly breaking) improvements to the API, after feedback and concerns provided by users: - Moved calculation of the translation key to the FluidAttributes constructor, so that builders can be shared between still & flowing sub-fluids. - Moved biome-based coloring to a dedicated FluidAttributes.Water variant, which is not used by default. - Added logic to automatically gather fluid textures into the list of textures to bake. - Patched BucketItem and FlowingFluidBlock to avoid eager access to the fluid objects. - Added a ForgeFlowingFluid class, as a more user-friendly way to construct a new FlowingFluid.
This commit is contained in:
1 parent
281ef5a152
commit
b0c9d7cce9
17 files changed
+537
-277
No files matched your search
@@ -146,6 +146,7 @@ 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;
|
||||
|
||||
public class ForgeHooksClient
|
||||
{
|
||||
@@ -380,9 +381,9 @@ public class ForgeHooksClient
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Matrix4f getMatrix(net.minecraft.client.renderer.model.ItemTransformVec3f transform)
|
||||
public static Matrix4f getMatrix(ItemTransformVec3f transform)
|
||||
{
|
||||
javax.vecmath.Matrix4f m = new javax.vecmath.Matrix4f(), t = new javax.vecmath.Matrix4f();
|
||||
Matrix4f m = new Matrix4f(), t = new Matrix4f();
|
||||
m.setIdentity();
|
||||
m.setTranslation(TRSRTransformation.toVecmath(transform.translation));
|
||||
t.setIdentity();
|
||||
@@ -569,6 +570,13 @@ public class ForgeHooksClient
|
||||
};
|
||||
}
|
||||
|
||||
public static void gatherFluidTextures(Set<ResourceLocation> textures)
|
||||
{
|
||||
ForgeRegistries.FLUIDS.getValues().stream()
|
||||
.flatMap(f -> f.getAttributes().getTextures())
|
||||
.forEach(textures::add);
|
||||
}
|
||||
|
||||
private static class LightGatheringTransformer extends QuadGatheringTransformer {
|
||||
|
||||
private static final VertexFormat FORMAT = new VertexFormat().addElement(DefaultVertexFormats.TEX_2F).addElement(DefaultVertexFormats.TEX_2S);
|
||||
@@ -702,7 +710,7 @@ public class ForgeHooksClient
|
||||
private static void drawSegment(ItemRenderer ri, int baseColor, ItemStack stack, List<BakedQuad> segment, int bl, int sl, boolean shade, boolean updateLighting, boolean updateShading)
|
||||
{
|
||||
BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer();
|
||||
bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
|
||||
bufferbuilder.begin(GL_QUADS, DefaultVertexFormats.ITEM);
|
||||
|
||||
float lastBl = GLX.lastBrightnessX;
|
||||
float lastSl = GLX.lastBrightnessY;
|
||||
|
||||
@@ -442,7 +442,7 @@ public final class ModelDynBucket implements IUnbakedModel
|
||||
BakedDynBucket model = (BakedDynBucket)originalModel;
|
||||
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
String name = fluid.getAttributes().getName();
|
||||
String name = fluid.getRegistryName().toString();
|
||||
|
||||
if (!model.cache.containsKey(name))
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user