Package codechicken.multipart.init
Class MultiPartRegistries
java.lang.Object
codechicken.multipart.init.MultiPartRegistries
Created by covers1624 on 3/16/20.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<MultiPart> convertBlock(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) static @Nullable MultiPartconvertItem(MultipartPlaceContext context) static voidinit(net.neoforged.bus.api.IEventBus modBus) static @Nullable MultiPartloadPart(net.minecraft.world.level.storage.ValueInput input) Loads aMultiPartfrom an NBT tag.static MultiPartreadPart(codechicken.lib.data.MCDataInput data) Reads aMultiPartfrom a stream.static voidSaves aMultiPartto an NBT tag.static voidWrites aMultiPartto the providedMCDataOutputstream.
-
Constructor Details
-
MultiPartRegistries
public MultiPartRegistries()
-
-
Method Details
-
init
public static void init(net.neoforged.bus.api.IEventBus modBus) -
writePart
Writes aMultiPartto the providedMCDataOutputstream. The part must have a validMultiPart.getType().First looks up the ID for the parts
MultipartTypefromMultiPart.getType(), written to the packet asMCDataOutput.writeVarInt(int)followed byMultiPart.writeDesc(MCDataOutput).- Parameters:
data- The stream to write the data to.part- TheMultiPartto write to said stream.
-
readPart
Reads aMultiPartfrom a stream. First reads aMultipartTypeid usingMCDataInput.readVarInt()then callsMultipartType.createPartClient(MCDataInput), following that callsMultiPart.readDesc(MCDataInput).This method expects the part to be read without errors, errors will cause the entire part space to break.
- Parameters:
data- The stream to read from.- Returns:
- The TMultiPart.
-
savePart
Saves aMultiPartto an NBT tag. The part must have a validMultiPart.getType().First writes
MultipartType.getRegistryName()to the 'id' tag, then callsMultiPart.save(ValueOutput).- Parameters:
output- The NBT tag to write to.part- TheMultiPartto write.
-
loadPart
@Nullable public static @Nullable MultiPart loadPart(net.minecraft.world.level.storage.ValueInput input) Loads aMultiPartfrom an NBT tag. First looks up theMultipartTypefrom the 'id' tag, MissingMultipartTypes are currently ignored and destroyed, then callsMultipartType.createPartServer(ValueInput)if the result is non null, then callsMultiPart.load(ValueInput).- Parameters:
input- The NBT tag to read from.- Returns:
- The new
MultiPartinstance, or null.
-
convertBlock
public static Collection<MultiPart> convertBlock(net.minecraft.world.level.LevelAccessor level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state) -
convertItem
-