Package appeng.api.parts
Interface IPartHost
- All Superinterfaces:
ICustomCableConnection
Implemented on AE's block entities.
Do Not Implement
-
Method Summary
Modifier and TypeMethodDescription<T extends IPart>
TaddPart
(IPartItem<T> partItem, @Nullable net.minecraft.core.Direction side, @Nullable net.minecraft.world.entity.player.Player owner) Add a new part to the specified side, returns false if it failed to be added.boolean
canAddPart
(net.minecraft.world.item.ItemStack part, @Nullable net.minecraft.core.Direction side) Test if you can add a part to the specified side of the Part Host.void
cleanup()
remove host from level...void
destroys the part container, for internal use.net.minecraft.world.level.block.entity.BlockEntity
net.minecraft.world.phys.shapes.VoxelShape
getCollisionShape
(net.minecraft.world.phys.shapes.CollisionContext context) Gets the collision shape of the part host.getColor()
@Nullable IPart
getPart
(@Nullable net.minecraft.core.Direction side) Get a part attached to the host based on the location it's attached to.boolean
Check if the part host currently has redstone power greater than 0.boolean
isBlocked
(net.minecraft.core.Direction side) Used to test for FMP microblock blocking internally.boolean
isEmpty()
returns false if this block contains any parts or facades, true other wise.boolean
true if the block entity is in the world, other wise false.void
can be used by parts to trigger the block entity or part to save.void
something changed, might want to send a packet to clients to update state.void
notifyNeighborNow
(net.minecraft.core.Direction side) notify neighbors uf updated status on the given side of the host.void
notify neighbors uf updated status.void
boolean
removePart
(IPart part) Removes a specific part from this host and returns if the part was actually present and removed.void
removePartFromSide
(@Nullable net.minecraft.core.Direction side) Removes the part on the side, this doesn't drop it or anything, if you don't do something with it, its just "gone" and its never coming back; think about it.<T extends IPart>
TreplacePart
(IPartItem<T> partItem, @Nullable net.minecraft.core.Direction side, @Nullable net.minecraft.world.entity.player.Player owner, @Nullable net.minecraft.world.InteractionHand hand) Replace an existing part on the specific side with a new one.selectPartLocal
(net.minecraft.world.phys.Vec3 pos) Finds the part located at the position in block-local coordinates (0,0,0 is located at the block pos).default SelectedPart
selectPartWorld
(net.minecraft.world.phys.Vec3 pos) Same asselectPartLocal(Vec3)
, but with world instead of local coordinates.Methods inherited from interface appeng.api.parts.ICustomCableConnection
getCableConnectionLength
-
Method Details
-
getFacadeContainer
IFacadeContainer getFacadeContainer()- Returns:
- the facade container
-
getPart
Get a part attached to the host based on the location it's attached to.- Parameters:
side
- side of host or null for center.- Returns:
- the part located on the specified side, or null if there is no part.
-
canAddPart
boolean canAddPart(net.minecraft.world.item.ItemStack part, @Nullable @Nullable net.minecraft.core.Direction side) Test if you can add a part to the specified side of the Part Host. A null side represents the center of the part host, where a cable would normally be.- Parameters:
part
- to be added partside
- onto side or null for center of host.- Returns:
- returns false if the part cannot be added.
-
addPart
@Nullable <T extends IPart> T addPart(IPartItem<T> partItem, @Nullable @Nullable net.minecraft.core.Direction side, @Nullable @Nullable net.minecraft.world.entity.player.Player owner) Add a new part to the specified side, returns false if it failed to be added.- Parameters:
partItem
- new part itemside
- onto side or null for center of host.owner
- with owning player- Returns:
- The part if the part could be placed, or null.
-
replacePart
@Nullable <T extends IPart> T replacePart(IPartItem<T> partItem, @Nullable @Nullable net.minecraft.core.Direction side, @Nullable @Nullable net.minecraft.world.entity.player.Player owner, @Nullable @Nullable net.minecraft.world.InteractionHand hand) Replace an existing part on the specific side with a new one. Returns null if it failed to be replaced.- Parameters:
partItem
- the part item to create the part fromside
- onto side or null for center of host.owner
- with owning player- Returns:
- If the part could be replaced, or null.
-
removePartFromSide
void removePartFromSide(@Nullable @Nullable net.minecraft.core.Direction side) Removes the part on the side, this doesn't drop it or anything, if you don't do something with it, its just "gone" and its never coming back; think about it.if you want to drop the part you must request it prior to removing it.
- Parameters:
side
- onto side or null for center of host
-
markForUpdate
void markForUpdate()something changed, might want to send a packet to clients to update state. -
getLocation
DimensionalBlockPos getLocation()- Returns:
- the physical location of the part host in the universe.
-
getBlockEntity
net.minecraft.world.level.block.entity.BlockEntity getBlockEntity()- Returns:
- the block entity for the host, this can either be an FMP block entity, or a AE block entity
-
getColor
AEColor getColor()- Returns:
- the color of the host type ( this is determined by the middle cable. ) if no cable is present, it returns
AEColor
.Transparent other wise it returns the color of the cable in the center.
-
clearContainer
void clearContainer()destroys the part container, for internal use. -
isBlocked
boolean isBlocked(net.minecraft.core.Direction side) Used to test for FMP microblock blocking internally.- Returns:
- returns if microblocks are blocking this cable path.
-
selectPartLocal
Finds the part located at the position in block-local coordinates (0,0,0 is located at the block pos).- Parameters:
pos
- part position- Returns:
- a new SelectedPart, this is never null.
-
getCollisionShape
net.minecraft.world.phys.shapes.VoxelShape getCollisionShape(net.minecraft.world.phys.shapes.CollisionContext context) Gets the collision shape of the part host. Used to reject placing parts if the resulting collision shape would be obstructed in the level.- Returns:
- The collision shape of this part host including all attached parts.
-
removePart
Removes a specific part from this host and returns if the part was actually present and removed. -
selectPartWorld
Same asselectPartLocal(Vec3)
, but with world instead of local coordinates. Provided for easier interoperability withHitResult.getLocation()
. -
markForSave
void markForSave()can be used by parts to trigger the block entity or part to save. -
partChanged
void partChanged() -
hasRedstone
boolean hasRedstone()Check if the part host currently has redstone power greater than 0. This value is cached internally.- Returns:
- true of the part host is receiving redstone from an external source.
-
isEmpty
boolean isEmpty()returns false if this block contains any parts or facades, true other wise. -
cleanup
void cleanup()remove host from level... -
notifyNeighbors
void notifyNeighbors()notify neighbors uf updated status. -
notifyNeighborNow
void notifyNeighborNow(net.minecraft.core.Direction side) notify neighbors uf updated status on the given side of the host. issue the notification immediately and synchronously. -
isInWorld
boolean isInWorld()true if the block entity is in the world, other wise false.- Returns:
- true if block entity is in world
-