public abstract class AbstractMultiBlockConverter extends AbstractConverter
These typically will only want to actually store one of the two positions (the "primary" on, bottom part of double plants e.g.), and also only require the block item as a material once for both parts.
| Constructor and Description |
|---|
AbstractMultiBlockConverter(java.util.UUID uuid) |
| Modifier and Type | Method and Description |
|---|---|
void |
deserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTBase data)
Deserialize the specified serialized block data into the world at the
specified world position.
|
java.lang.Iterable<net.minecraft.item.ItemStack> |
getItemCosts(net.minecraft.nbt.NBTBase data)
Get a list of materials required to deserialize the block described by
the specified data.
|
protected abstract net.minecraft.util.math.BlockPos |
getSecondaryPos(net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state)
Get the world position of the secondary part.
|
protected abstract net.minecraft.block.state.IBlockState |
getSecondaryState(net.minecraft.block.state.IBlockState state)
Get the block state representing the secondary part from the primary one.
|
protected abstract boolean |
isSecondaryState(net.minecraft.block.state.IBlockState state)
Check whether the specified block state is the secondary part.
|
protected void |
postDeserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state,
net.minecraft.nbt.NBTTagCompound data)
Allows hooking into the deserialization process, applying further changes
to the deserialized block.
|
boolean |
preDeserialize(MaterialSource materialSource,
net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.util.Rotation rotation,
net.minecraft.nbt.NBTBase data)
Called when a job for deserialization should be created.
|
cancelDeserialization, canSerialize, canSerialize, getBlockState, getFluidCosts, getFluidStack, getItemStack, getItemStack, getSortIndex, getUUID, postSerialize, serializepublic AbstractMultiBlockConverter(java.util.UUID uuid)
protected abstract boolean isSecondaryState(net.minecraft.block.state.IBlockState state)
state - the state to check.true if the state represents the secondary part;
false otherwise.protected abstract net.minecraft.block.state.IBlockState getSecondaryState(net.minecraft.block.state.IBlockState state)
state - the primary block state.protected abstract net.minecraft.util.math.BlockPos getSecondaryPos(net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state)
pos - the position of the primary part.state - the state of the primary part.public java.lang.Iterable<net.minecraft.item.ItemStack> getItemCosts(net.minecraft.nbt.NBTBase data)
Converter
The data passed along is guaranteed to be a value that was previously
produced by this converter's Converter.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 ConvertergetItemCosts in class AbstractConverterdata - the data to get the costs for.public boolean preDeserialize(MaterialSource materialSource, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.util.Rotation rotation, net.minecraft.nbt.NBTBase data)
Converter
The passed NBTBase passed along is guaranteed to be a value that
was previously produced by this converter's Converter.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 ConverterpreDeserialize in class AbstractConvertermaterialSource - 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.NBTBase data)
Converter
The passed NBTBase passed along is guaranteed to be a value that
was previously produced by this converter's Converter.serialize(net.minecraft.world.World, net.minecraft.util.math.BlockPos) method.
deserialize in interface Converterdeserialize in class AbstractConverterworld - 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.protected void postDeserialize(net.minecraft.world.World world,
net.minecraft.util.math.BlockPos pos,
net.minecraft.block.state.IBlockState state,
net.minecraft.nbt.NBTTagCompound data)
AbstractConverterpostDeserialize in class AbstractConverterworld - the world the block is being deserialized into.pos - the position the block is being deserialized at.state - the block state of the deserialized block.data - the serialized representation of the block to