public interface ConverterAPI
Converters.
When trying to serialize a block in the world, all registered converters will
be queried, until one returns true from canSerialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos).
| Modifier and Type | Method and Description |
|---|---|
void |
addConverter(Converter converter)
Register the specified converter.
|
boolean |
canSerialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
Checks if the block at the specified world position can be serialized.
|
void |
deserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTTagCompound data)
Deserialize the specified serialized block data into the world at the
specified world position.
|
java.lang.Iterable<net.minecraftforge.fluids.FluidStack> |
getFluidCosts(net.minecraft.nbt.NBTTagCompound data)
Get a list of materials required to deserialize the block described by
the specified data.
|
java.lang.Iterable<net.minecraft.item.ItemStack> |
getItemCosts(net.minecraft.nbt.NBTTagCompound data)
Get a list of materials required to deserialize the block described by
the specified data.
|
int |
getSortIndex(net.minecraft.nbt.NBTTagCompound data)
A sort index used to control in which order blocks are deserialized.
|
net.minecraft.block.state.IBlockState |
mapToBlock(net.minecraft.block.state.IBlockState state)
Map a block to a potential replacement, based on current mapping
configuration.
|
net.minecraft.item.Item |
mapToItem(net.minecraft.block.Block block)
Get the item associated with the specified block.
|
boolean |
preDeserialize(MaterialSource materialSource,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTTagCompound data)
Called when a job for deserialization should be created.
|
net.minecraft.nbt.NBTTagCompound |
serialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
Creates a serialized representation of the block at the specified world
position.
|
void addConverter(Converter converter)
converter - the converter to register.net.minecraft.block.state.IBlockState mapToBlock(net.minecraft.block.state.IBlockState state)
lit_furnace to
furnace.state - the block state to resolve the mapping for.net.minecraft.item.Item mapToItem(net.minecraft.block.Block block)
Item.getItemFromBlock(Block).block - the block to get the item for.java.lang.Iterable<net.minecraft.item.ItemStack> getItemCosts(net.minecraft.nbt.NBTTagCompound data)
The data passed along is guaranteed to be a value that was previously
produced by this converter's serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
This will typically return a singleton list or an empty list, but for more complex converters, e.g. ones handling multi-part blocks this returns an iterable.
This is not used for logic, purely for user feedback, e.g. in tooltips.
data - the data to get the costs for.java.lang.Iterable<net.minecraftforge.fluids.FluidStack> getFluidCosts(net.minecraft.nbt.NBTTagCompound data)
The data passed along is guaranteed to be a value that was previously
produced by this converter's serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
This will typically return a singleton list or an empty list, but for more complex converters, e.g. ones handling multi-part blocks this returns an iterable.
This is not used for logic, purely for user feedback, e.g. in tooltips.
data - the data to get the costs for.int getSortIndex(net.minecraft.nbt.NBTTagCompound data)
Blocks being deserialized using converters that provide lower numbers here will be processed first.
This allows deserialization of solid blocks (e.g. cobble) before non- solid blocks (e.g. levers, water).
data - the serialized representation of the block in question.SortIndexboolean canSerialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
world - the world containing the block to serialize.pos - the position of the block to serialize.true if the block can be serialized;
false otherwise.@Nullable
net.minecraft.nbt.NBTTagCompound serialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
world - the world containing the block to serialize.pos - the position of the block to serialize.boolean preDeserialize(MaterialSource materialSource, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.util.Rotation rotation, net.minecraft.nbt.NBTTagCompound data)
The data passed along is guaranteed to be a value that was previously
produced by this converter's serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
This serves as a filter for which blocks in a blueprint actually can be
deserialized, in particular with respect to available materials which
are consumed from the specified IItemHandler.
materialSource - access to building materials available for
deserialization.world - the world into which to deserialize the block.pos - the position at which to deserialize the block.rotation - the rotation to deserialize with.data - the serialized representation of the block to
deserialize.true if the data can be deserialized;
false otherwise.void deserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTTagCompound data)
The passed NBTBase passed along is guaranteed to be a value that
was previously produced by this converter's serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
world - the world to deserialize the block into.pos - the position to deserialize the block at.rotation - the rotation to deserialize with.data - the serialized representation of the block to
deserialize.