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.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registries) Loads aMultiPartfrom an NBT tag.static net.minecraft.core.Registry<MultipartType<?>> static net.minecraft.core.Registry<PartConverter> static MultiPartreadPart(codechicken.lib.data.MCDataInput data) Reads aMultiPartfrom a stream.static net.minecraft.nbt.CompoundTagsavePart(net.minecraft.nbt.CompoundTag nbt, MultiPart part, net.minecraft.core.HolderLookup.Provider registries) Saves 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) -
multipartTypes
-
partConverters
-
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
public static net.minecraft.nbt.CompoundTag savePart(net.minecraft.nbt.CompoundTag nbt, MultiPart part, net.minecraft.core.HolderLookup.Provider registries) Saves aMultiPartto an NBT tag. The part must have a validMultiPart.getType().First writes
MultipartType.getRegistryName()to the 'id' tag, then callsMultiPart.save(CompoundTag, HolderLookup.Provider).- Parameters:
nbt- The NBT tag to write to.part- TheMultiPartto write.- Returns:
- The same NBT tag provided.
-
loadPart
@Nullable public static @Nullable MultiPart loadPart(net.minecraft.nbt.CompoundTag nbt, net.minecraft.core.HolderLookup.Provider registries) Loads aMultiPartfrom an NBT tag. First looks up theMultipartTypefrom the 'id' tag, MissingMultipartTypes are currently ignored and destroyed, then callsMultipartType.createPartServer(CompoundTag)if the result is non null, then callsMultiPart.load(CompoundTag, HolderLookup.Provider).- Parameters:
nbt- 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
-