public final class ConverterAPIImpl extends java.lang.Object implements ConverterAPI
| Constructor and Description |
|---|
ConverterAPIImpl() |
| 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.
|
static boolean |
isValidPosition(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos) |
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.
|
public void addConverter(Converter converter)
ConverterAPIaddConverter in interface ConverterAPIconverter - the converter to register.public net.minecraft.block.state.IBlockState mapToBlock(net.minecraft.block.state.IBlockState state)
ConverterAPIlit_furnace to
furnace.mapToBlock in interface ConverterAPIstate - the block state to resolve the mapping for.public net.minecraft.item.Item mapToItem(net.minecraft.block.Block block)
ConverterAPIItem.getItemFromBlock(Block).mapToItem in interface ConverterAPIblock - the block to get the item for.public java.lang.Iterable<net.minecraft.item.ItemStack> getItemCosts(net.minecraft.nbt.NBTTagCompound data)
ConverterAPI
The data passed along is guaranteed to be a value that was previously
produced by this converter's ConverterAPI.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.
getItemCosts in interface ConverterAPIdata - the data to get the costs for.public java.lang.Iterable<net.minecraftforge.fluids.FluidStack> getFluidCosts(net.minecraft.nbt.NBTTagCompound data)
ConverterAPI
The data passed along is guaranteed to be a value that was previously
produced by this converter's ConverterAPI.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.
getFluidCosts in interface ConverterAPIdata - the data to get the costs for.public int getSortIndex(net.minecraft.nbt.NBTTagCompound data)
ConverterAPIBlocks 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).
getSortIndex in interface ConverterAPIdata - the serialized representation of the block in question.SortIndexpublic boolean canSerialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
ConverterAPIcanSerialize in interface ConverterAPIworld - 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
public net.minecraft.nbt.NBTTagCompound serialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)
ConverterAPIserialize in interface ConverterAPIworld - the world containing the block to serialize.pos - the position of the block to serialize.public 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)
ConverterAPI
The data passed along is guaranteed to be a value that was previously
produced by this converter's ConverterAPI.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.
preDeserialize in interface ConverterAPImaterialSource - 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.public void deserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTTagCompound data)
ConverterAPI
The passed NBTBase passed along is guaranteed to be a value that
was previously produced by this converter's ConverterAPI.serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
deserialize in interface ConverterAPIworld - 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.public static boolean isValidPosition(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos)