Class PixelBlockSnapshot

java.lang.Object
com.pixelmonmod.pixelmon.api.util.PixelBlockSnapshot

public class PixelBlockSnapshot extends Object
Created by clienthax on 15/3/2015. Massively modified by MrM.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final net.minecraft.resources.ResourceLocation
    The mod ID of the block.
    static final String
    The NBT tag for a block's name
    final net.minecraft.core.BlockPos
    The position of the block snapshot.
    net.minecraft.world.level.block.state.BlockState
    The block represented by the snapshot.
    net.minecraft.world.level.Level
    The world that the block snapshot is in.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PixelBlockSnapshot(net.minecraft.core.BlockPos pos, String modid, String blockName, net.minecraft.nbt.CompoundTag nbt)
    Raw constructor designed for serialization usages.
    PixelBlockSnapshot(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag nbt)
    Raw constructor designed for serialization usages.
    PixelBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
    Initializes a block snapshot.
    PixelBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag nbt)
    Initializes a block snapshot.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    getBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
    Creates a block snapshot for a position.
    net.minecraft.world.level.block.state.BlockState
    Gets the block in the snapshot's position.
    int
     
    readFromNBT(net.minecraft.nbt.CompoundTag tag)
    Reads a block snapshot from NBT data.
    readFromNBT(net.minecraft.world.level.Level newWorld, net.minecraft.nbt.CompoundTag tag)
    Reads a block snapshot from NBT data.
    void
    writeToNBT(net.minecraft.nbt.CompoundTag compound)
    Writes the block snapshot to NBT.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • PIXEL_SNAPSHOT_BLOCK_NAME

      public static final String PIXEL_SNAPSHOT_BLOCK_NAME
      The NBT tag for a block's name
      See Also:
    • pos

      public final net.minecraft.core.BlockPos pos
      The position of the block snapshot.
    • replacedBlock

      public transient net.minecraft.world.level.block.state.BlockState replacedBlock
      The block represented by the snapshot.
    • world

      public transient net.minecraft.world.level.Level world
      The world that the block snapshot is in.
    • blockIdentifier

      public final net.minecraft.resources.ResourceLocation blockIdentifier
      The mod ID of the block.
  • Constructor Details

    • PixelBlockSnapshot

      public PixelBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)
      Initializes a block snapshot.
      Parameters:
      world - The world the block snapshot is in.
      pos - The position of the block snapshot.
      state - The block.
    • PixelBlockSnapshot

      public PixelBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag nbt)
      Initializes a block snapshot.
      Parameters:
      world - The world the block snapshot is in.
      pos - The position of the block snapshot.
      state - The block.
      nbt - The NBT data for the block.
    • PixelBlockSnapshot

      public PixelBlockSnapshot(net.minecraft.core.BlockPos pos, String modid, String blockName, net.minecraft.nbt.CompoundTag nbt)
      Raw constructor designed for serialization usages.
      Parameters:
      pos - The position of the block snapshot.
      modid - The mod ID of the block.
      blockName - The name of the block.
      nbt - The NBT data for the block.
    • PixelBlockSnapshot

      public PixelBlockSnapshot(net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, net.minecraft.nbt.CompoundTag nbt)
      Raw constructor designed for serialization usages.
      Parameters:
      pos - The position of the block snapshot.
      state - The block state.
      nbt - The NBT data for the block.
  • Method Details

    • readFromNBT

      public static PixelBlockSnapshot readFromNBT(net.minecraft.world.level.Level newWorld, net.minecraft.nbt.CompoundTag tag)
      Reads a block snapshot from NBT data.
      Parameters:
      newWorld - The world the block snapshot is to be loaded in.
      tag - The block snapshot's NBT data.
      Returns:
      The block snapshot loaded from NBT data.
    • getBlockSnapshot

      public static PixelBlockSnapshot getBlockSnapshot(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos)
      Creates a block snapshot for a position.
      Parameters:
      world - The world to create a block snapshot for.
      pos - The position to create a block snapshot for.
      Returns:
      A block snapshot of the specified position.
    • readFromNBT

      public static PixelBlockSnapshot readFromNBT(net.minecraft.nbt.CompoundTag tag)
      Reads a block snapshot from NBT data.
      Parameters:
      tag - The block snapshot's NBT data.
      Returns:
      The block snapshot loaded from NBT data.
    • getCurrentBlock

      public net.minecraft.world.level.block.state.BlockState getCurrentBlock()
      Gets the block in the snapshot's position.
      Returns:
      The block in the snapshot's position.
    • writeToNBT

      public void writeToNBT(net.minecraft.nbt.CompoundTag compound)
      Writes the block snapshot to NBT.
      Parameters:
      compound - The NBT tag to write to.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object