Package noppes.npcs.api.block
Interface IBlock
- All Known Subinterfaces:
IBlockFluidContainer
,IBlockScripted
,IBlockScriptedDoor
public interface IBlock
-
Method Summary
Modifier and TypeMethodDescriptionvoid
blockEvent
(int type, int data) net.minecraft.world.level.block.Block
Expert users onlynet.minecraft.world.level.block.state.BlockState
Expert users onlynet.minecraft.world.level.block.entity.BlockEntity
Expert users onlygetName()
getPos()
String[]
getProperty
(String name) Stored data persists through world restart.Temp data stores anything but only untill it's reloaded.getWorld()
int
getX()
int
getY()
int
getZ()
boolean
void
interact
(int side) Simulates a player interacting with this block (can give weird results)boolean
isAir()
boolean
boolean
void
remove()
Removes this blockvoid
setProperty
(String name, Object val) void
setTileEntityNBT
(INbt nbt)
-
Method Details
-
getX
int getX() -
getY
int getY() -
getZ
int getZ() -
getPos
IPos getPos() -
getProperty
-
setProperty
-
getProperties
String[] getProperties() -
getName
String getName()- Returns:
- Returns this blocks name
-
remove
void remove()Removes this block -
isRemoved
boolean isRemoved()- Returns:
- Returns whether or not this block has been replaced by another
-
isAir
boolean isAir() -
setBlock
-
setBlock
- Parameters:
block
- Sets the block to replace this one- Returns:
- Returns the new block
-
hasTileEntity
boolean hasTileEntity() -
isContainer
boolean isContainer()- Returns:
- Returns whether it has items stored inside it (e.g. chests, droppers, hoppers, etc)
-
getContainer
IContainer getContainer() -
getTempdata
IData getTempdata()Temp data stores anything but only untill it's reloaded. (works only for customnpcs blocks) -
getStoreddata
IData getStoreddata()Stored data persists through world restart. Unlike tempdata only Strings and Numbers can be saved (works only for blocks with TileEntities) -
getWorld
IWorld getWorld() -
getBlockEntityNBT
INbt getBlockEntityNBT() -
setTileEntityNBT
-
getMCTileEntity
net.minecraft.world.level.block.entity.BlockEntity getMCTileEntity()Expert users only- Returns:
- Returns minecrafts tilentity
-
getMCBlock
net.minecraft.world.level.block.Block getMCBlock()Expert users only- Returns:
- Returns minecrafts block
-
blockEvent
void blockEvent(int type, int data) - Parameters:
type
- Event typedata
- Event data Example: Chests - type:1 data:1 opens the lid, type:1 data:0 closes the lid Note block - type:(0-9) data:(0-24) plays different notes
-
getDisplayName
String getDisplayName() -
getMCBlockState
net.minecraft.world.level.block.state.BlockState getMCBlockState()Expert users only- Returns:
- Returns minecrafts iblockstate
-
interact
void interact(int side) Simulates a player interacting with this block (can give weird results)- Parameters:
side
- The side of the block interacted with
-