Class ColouredFluidVolume
java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidVolume
alexiil.mc.lib.attributes.fluid.volume.ColouredFluidVolume
- Direct Known Subclasses:
BiomeSourcedFluidVolume
A fluid volume that stores it's colours as 4 floats: red, green, blue, and alpha. (Alpha bounds for blending can be
configured in the fluid key).
-
Field Summary
Fields inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidVolume
BASE_UNIT, BOTTLE, BUCKET, DESERIALIZER, fluidKey
-
Constructor Summary
ConstructorDescriptionColouredFluidVolume
(ColouredFluidKey key, int amount) Deprecated.ColouredFluidVolume
(ColouredFluidKey key, FluidAmount amount) ColouredFluidVolume
(ColouredFluidKey key, com.google.gson.JsonObject json) ColouredFluidVolume
(ColouredFluidKey key, net.minecraft.nbt.NbtCompound tag) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addTooltipExtras
(FluidTooltipContext context, List<net.minecraft.text.Text> tooltip) Adds any additional data that thisFluidVolume
has.final int
asArgb()
protected ColouredFluidVolume
copy0()
protected void
fromMcBufferInternal
(net.minecraft.network.PacketByteBuf buffer) float
getAlpha()
float
getBlue()
float
getGreen()
net.minecraft.text.Text
getName()
net.minecraft.text.Text
float
getRed()
int
protected void
mergeInternal
(FluidVolume other, FluidAmount.FluidMergeResult mergedAmounts) Actually merges twoFluidVolume
's together.void
setAbgr
(int abgr) void
setArgb
(int argb) void
setRgb
(float red, float green, float blue) Changes the red, green, and blue colours, leaving alpha unchanged.void
setRgba
(float red, float green, float blue, float alpha) protected FluidVolume
split0
(FluidAmount toTake, RoundingMode rounding) com.google.gson.JsonObject
toJson()
protected void
toMcBufferInternal
(net.minecraft.network.PacketByteBuf buffer) net.minecraft.nbt.NbtCompound
toTag
(net.minecraft.nbt.NbtCompound nbt) Methods inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidVolume
addFullTooltip, addFullTooltip, addFullTooltip, addTooltipNameAmount, addTooltipProperties, addTooltipTemperature, amount, areEqualExceptAmounts, areFullyEqual, canMerge, copy, create, create, create, equals, fromJson, fromMcBuffer, fromTag, getAmount, getAmount_F, getFlowingSprite, getFullTooltip, getFullTooltip, getFullTooltip, getProperty, getRawAmount, getRawAmount_F, getRawFluid, getRenderer, getSprite, getStillSprite, getTooltipText, hashCode, isEmpty, localizeAmount, localizeAmount, localizeInTank, localizeInTank, merge, merge, merge, merge, merge0, mergeInto, mergeInto, mergeInto, multiplyAmount, parseAmount, render, renderGuiRect, setAmount, setAmount, setProperty, split, split, split, toMcBuffer, toString, toTag, withAmount
-
Constructor Details
-
ColouredFluidVolume
-
ColouredFluidVolume
Deprecated. -
ColouredFluidVolume
-
ColouredFluidVolume
public ColouredFluidVolume(ColouredFluidKey key, com.google.gson.JsonObject json) throws com.google.gson.JsonSyntaxException - Throws:
com.google.gson.JsonSyntaxException
-
-
Method Details
-
toTag
public net.minecraft.nbt.NbtCompound toTag(net.minecraft.nbt.NbtCompound nbt) - Overrides:
toTag
in classFluidVolume
-
toJson
public com.google.gson.JsonObject toJson()- Overrides:
toJson
in classFluidVolume
-
fromMcBufferInternal
protected void fromMcBufferInternal(net.minecraft.network.PacketByteBuf buffer) - Overrides:
fromMcBufferInternal
in classFluidVolume
-
toMcBufferInternal
protected void toMcBufferInternal(net.minecraft.network.PacketByteBuf buffer) - Overrides:
toMcBufferInternal
in classFluidVolume
-
getFluidKey
- Overrides:
getFluidKey
in classFluidVolume
- Returns:
- The
FluidKey
for this volume. Subclasses may override this to use a return type for their key class.
-
getName
public net.minecraft.text.Text getName()- Overrides:
getName
in classFluidVolume
-
getNoncolouredName
public net.minecraft.text.Text getNoncolouredName() -
getRed
public float getRed() -
getGreen
public float getGreen() -
getBlue
public float getBlue() -
getAlpha
public float getAlpha() -
getRenderColor
public int getRenderColor()- Overrides:
getRenderColor
in classFluidVolume
- Returns:
- The colour tint to use when rendering this fluid volume in gui's or in-world. Note that this MUST be in
0xAA_RR_GG_BB format:
(r << 16) | (g << 8) | (b)
. Alpha may be omitted however - which should default it to 0xFF.
-
asArgb
public final int asArgb() -
setArgb
public void setArgb(int argb) -
setAbgr
public void setAbgr(int abgr) -
setRgb
public void setRgb(float red, float green, float blue) Changes the red, green, and blue colours, leaving alpha unchanged. -
setRgba
public void setRgba(float red, float green, float blue, float alpha) -
copy0
- Overrides:
copy0
in classFluidVolume
-
split0
- Overrides:
split0
in classFluidVolume
- Parameters:
toTake
- A valid subtractable amount.- Returns:
- A new
FluidVolume
with the given amount that has been removed from this.
-
mergeInternal
Description copied from class:FluidVolume
Actually merges twoFluidVolume
's together. OnlyFluidVolume.merge(FluidVolume, FluidMergeRounding, Simulation)
should call this. (Except for subclasses that override this method).- Overrides:
mergeInternal
in classFluidVolume
- Parameters:
other
- The other fluid volume. This will always be the same class as this. This should change the amount of the other fluid toFluidAmount.FluidMergeResult.excess
.
-
addTooltipExtras
Description copied from class:FluidVolume
Adds any additional data that thisFluidVolume
has.- Overrides:
addTooltipExtras
in classFluidVolume
-