Class WeightedFluidVolume<T>
java.lang.Object
alexiil.mc.lib.attributes.fluid.volume.FluidVolume
alexiil.mc.lib.attributes.fluid.volume.WeightedFluidVolume<T>
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic interfacestatic interface
- 
Field SummaryFields inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidVolumeBASE_UNIT, BOTTLE, BUCKET, DESERIALIZER, fluidKey
- 
Constructor SummaryConstructorsConstructorDescriptionWeightedFluidVolume(WeightedFluidKey<T> key, com.google.gson.JsonObject json, WeightedFluidVolume.WeightedJsonGetter<T> keyGetter)Json deserialiser that assumes the values are complicated, and so need a more complex json element than just a string to deserialise.WeightedFluidVolume(WeightedFluidKey<T> key, com.google.gson.JsonObject json, WeightedFluidVolume.WeightedStringGetter<T> keyGetter)Json deserialiser that assumes the values are simple and require just a string to deserialise.WeightedFluidVolume(WeightedFluidKey<T> key, net.minecraft.nbt.NbtCompound tag)WeightedFluidVolume(WeightedFluidKey<T> key, T value, int amount)Deprecated, for removal: This API element is subject to removal in a future version.WeightedFluidVolume(WeightedFluidKey<T> key, T value, FluidAmount amount)
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddAmount(T value, FluidAmount amount)voidaddAmount(T value, FluidAmount amount, FluidAmount.FluidMergeRounding rounding)voidaddAmounts(Map<T,FluidAmount> sources)protected abstract booleanprotected WeightedFluidVolume<T>copy0()protected Tprotected voidfromMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)protected net.minecraft.text.TextgetTextFor(T value)List<net.minecraft.text.Text>getTooltipText(net.minecraft.client.item.TooltipContext ctx)Map<T,FluidAmount>protected voidmergeInternal(FluidVolume vol, FluidAmount.FluidMergeResult result)Actually merges twoFluidVolume's together.protected voidprotected abstract TreadValue(net.minecraft.nbt.NbtCompound holder)Inverse ofwriteValue(NbtCompound, Object).protected TreadValueFromMcBuffer(net.minecraft.network.PacketByteBuf buffer)protected voidreadValuesFromMcBuffer(net.minecraft.network.PacketByteBuf buffer, Map<T,FluidAmount> map)protected abstract StringsaveName()protected WeightedFluidVolume<T>split0(FluidAmount toTake, RoundingMode rounding)com.google.gson.JsonObjecttoJson()protected abstract com.google.gson.JsonElementprotected voidtoMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)net.minecraft.nbt.NbtCompoundtoTag(net.minecraft.nbt.NbtCompound tag)protected abstract voidwriteValue(net.minecraft.nbt.NbtCompound holder, T value)protected voidwriteValuesToMcBuffer(net.minecraft.network.PacketByteBuf buffer, Map<T,FluidAmount> map)protected voidwriteValueToMcBuffer(net.minecraft.network.PacketByteBuf buffer, T value)Methods inherited from class alexiil.mc.lib.attributes.fluid.volume.FluidVolumeaddFullTooltip, addFullTooltip, addFullTooltip, addTooltipExtras, addTooltipNameAmount, addTooltipProperties, addTooltipTemperature, amount, areEqualExceptAmounts, areFullyEqual, canMerge, copy, create, create, create, equals, fromJson, fromMcBuffer, fromTag, getAmount, getAmount_F, getFlowingSprite, getFullTooltip, getFullTooltip, getFullTooltip, getName, getProperty, getRawAmount, getRawAmount_F, getRawFluid, getRenderColor, getRenderer, getSprite, getStillSprite, 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- 
WeightedFluidVolume
- 
WeightedFluidVolume@Deprecated(since="0.6.4", forRemoval=true) public WeightedFluidVolume(WeightedFluidKey<T> key, T value, int amount)Deprecated, for removal: This API element is subject to removal in a future version.
- 
WeightedFluidVolume
- 
WeightedFluidVolumepublic WeightedFluidVolume(WeightedFluidKey<T> key, com.google.gson.JsonObject json, WeightedFluidVolume.WeightedStringGetter<T> keyGetter) throws com.google.gson.JsonSyntaxExceptionJson deserialiser that assumes the values are simple and require just a string to deserialise. It is only ever necessary for subclasses to call one of these constructors.- Throws:
- com.google.gson.JsonSyntaxException
- See Also:
- WeightedFluidVolume(WeightedFluidKey, JsonObject, WeightedJsonGetter)
 
- 
WeightedFluidVolumepublic WeightedFluidVolume(WeightedFluidKey<T> key, com.google.gson.JsonObject json, WeightedFluidVolume.WeightedJsonGetter<T> keyGetter) throws com.google.gson.JsonSyntaxExceptionJson deserialiser that assumes the values are complicated, and so need a more complex json element than just a string to deserialise. It is only ever necessary for subclasses to call one of these constructors.- Throws:
- com.google.gson.JsonSyntaxException
- See Also:
- WeightedFluidVolume(WeightedFluidKey, JsonObject, WeightedStringGetter)
 
 
- 
- 
Method Details- 
toJsonpublic com.google.gson.JsonObject toJson()- Overrides:
- toJsonin class- FluidVolume
 
- 
toMcBufferInternalprotected void toMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)- Overrides:
- toMcBufferInternalin class- FluidVolume
 
- 
fromMcBufferInternalprotected void fromMcBufferInternal(net.minecraft.network.PacketByteBuf buffer)- Overrides:
- fromMcBufferInternalin class- FluidVolume
 
- 
normalizeprotected final void normalize()
- 
toTagpublic net.minecraft.nbt.NbtCompound toTag(net.minecraft.nbt.NbtCompound tag)- Overrides:
- toTagin class- FluidVolume
 
- 
saveName- Returns:
- The name to use when saving/loading the valuesmap to/from disk. This is only used intoTag(NbtCompound),WeightedFluidVolume(WeightedFluidKey, NbtCompound),toJson(),WeightedFluidVolume(WeightedFluidKey, JsonObject, WeightedStringGetter), andWeightedFluidVolume(WeightedFluidKey, JsonObject, WeightedJsonGetter), so you can move things around before these are called.
 
- 
defaultValue- Returns:
- The default value to use if none is present.
 
- 
readValueInverse ofwriteValue(NbtCompound, Object).
- 
writeValue- Parameters:
- holder- The- NbtCompoundto store the key in. Either "Amount" or "AmountF" might be overwritten by this class. (If in doubt it is better to use an embedded compound to store all of the data, using a key like "Name" or "Value").
 
- 
areJsonValuesCompactprotected abstract boolean areJsonValuesCompact()- Returns:
- True if the weights should be serialised to json in "compact" form (where the value is serialised into a
         single string, and read back with WeightedFluidVolume.WeightedStringGetter), or "full" form (and read back withWeightedFluidVolume.WeightedJsonGetter).
 
- 
toJson- Returns:
- The value, turned into a JsonElement. If the subclass callsWeightedFluidVolume(WeightedFluidKey, JsonObject, WeightedStringGetter)(and thus returns true fromareJsonValuesCompact()) then this must be aJsonPrimitivewith a string, that can read back with theWeightedFluidVolume.WeightedStringGetter. Otherwise there are no limits on what this can return, other than that theWeightedFluidVolume.WeightedJsonGettershould be able to read back the given value from the returned json.
 
- 
writeValuesToMcBufferprotected void writeValuesToMcBuffer(net.minecraft.network.PacketByteBuf buffer, Map<T,FluidAmount> map)
- 
readValuesFromMcBufferprotected void readValuesFromMcBuffer(net.minecraft.network.PacketByteBuf buffer, Map<T,FluidAmount> map)
- 
readValueFromMcBuffer
- 
writeValueToMcBuffer
- 
getTextFor
- 
getFluidKey- Overrides:
- getFluidKeyin class- FluidVolume
- Returns:
- The FluidKeyfor this volume. Subclasses may override this to use a return type for their key class.
 
- 
getValues- Returns:
- An unmodifiable view of the values map.
 
- 
copy0- Overrides:
- copy0in class- FluidVolume
 
- 
split0- Overrides:
- split0in class- FluidVolume
- Parameters:
- toTake- A valid subtractable amount.
- Returns:
- A new FluidVolumewith the given amount that has been removed from this.
 
- 
mergeInternalDescription copied from class:FluidVolumeActually merges twoFluidVolume's together. OnlyFluidVolume.merge(FluidVolume, FluidMergeRounding, Simulation)should call this. (Except for subclasses that override this method).- Overrides:
- mergeInternalin class- FluidVolume
- Parameters:
- vol- The other fluid volume. This will always be the same class as this. This should change the amount of the other fluid to- FluidAmount.FluidMergeResult.excess.
 
- 
addAmount
- 
addAmount
- 
addAmounts
- 
getTooltipText- Overrides:
- getTooltipTextin class- FluidVolume
 
 
-