Class AbstractSemiblockEntity

java.lang.Object
net.minecraftforge.common.capabilities.CapabilityProvider<net.minecraft.world.entity.Entity>
net.minecraft.world.entity.Entity
me.desht.pneumaticcraft.common.entity.semiblock.AbstractSemiblockEntity
All Implemented Interfaces:
ISemiBlock, IGUIButtonSensitive, net.minecraft.commands.CommandSource, net.minecraft.world.level.entity.EntityAccess, net.minecraft.world.Nameable, net.minecraftforge.common.capabilities.ICapabilityProvider, net.minecraftforge.common.capabilities.ICapabilityProviderImpl<net.minecraft.world.entity.Entity>, net.minecraftforge.common.capabilities.ICapabilitySerializable<net.minecraft.nbt.CompoundTag>, net.minecraftforge.common.extensions.IForgeEntity, net.minecraftforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
Direct Known Subclasses:
AbstractLogisticsFrameEntity, CropSupportEntity, HeatFrameEntity, SpawnerAgitatorEntity, TransferGadgetEntity

public abstract class AbstractSemiblockEntity extends net.minecraft.world.entity.Entity implements ISemiBlock, IGUIButtonSensitive
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.entity.Entity

    net.minecraft.world.entity.Entity.MoveFunction, net.minecraft.world.entity.Entity.MovementEmission, net.minecraft.world.entity.Entity.RemovalReason

    Nested classes/interfaces inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    net.minecraftforge.common.capabilities.CapabilityProvider.AsField<B extends net.minecraftforge.common.capabilities.ICapabilityProviderImpl<B>>
  • Field Summary

    Fields inherited from class net.minecraft.world.entity.Entity

    BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, BREATHING_DISTANCE_BELOW_EYES, DATA_POSE, DATA_SHARED_FLAGS_ID, DEFAULT_BB_HEIGHT, DEFAULT_BB_WIDTH, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_2, DELTA_AFFECTED_BY_BLOCKS_BELOW_0_5, DELTA_AFFECTED_BY_BLOCKS_BELOW_1_0, ENTITY_COUNTER, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, forgeFluidTypeHeight, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, isInsidePortal, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, maxUpStep, minorHorizontalCollision, moveDist, noCulling, noPhysics, PASSENGERS_TAG, portalEntrancePos, portalTime, random, stringUUID, stuckSpeedMultiplier, tickCount, TOTAL_AIR_SUPPLY, uuid, UUID_TAG, verticalCollision, verticalCollisionBelow, walkDist, walkDistO, wasEyeInWater, wasInPowderSnow, wasOnFire, wasTouchingWater, xo, xOld, xRotO, yo, yOld, yRotO, zo, zOld

    Fields inherited from interface net.minecraft.commands.CommandSource

    NULL
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    addAdditionalSaveData(net.minecraft.nbt.CompoundTag compound)
     
    protected net.minecraft.world.phys.AABB
    Get the bounding box for this entity, which by default is the bounding box of the block we're on.
    boolean
    canCoexist(ISemiBlock otherSemiblock)
    Check if this semiblock can coexist with the other semiblock, in the same block pos.
    boolean
    Check if this semiblock can remain here.
    protected void
     
    protected void
    doExtraCleanupTasks(boolean removingSemiblock)
    Called by onRemovedFromWorld() to finalize semiblock removal.
    net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener>
     
    final net.minecraft.world.phys.AABB
    Get the bounding box for this entity.
    net.minecraft.core.BlockPos
    Get the block position this entity occupies.
    net.minecraft.world.level.block.state.BlockState
    Get the blockstate at the semiblock's position
    net.minecraft.world.level.block.entity.BlockEntity
    Get the block entity at the semiblock's position.
    float
     
    protected net.minecraft.world.item.Item
    Get the semiblock item which will be dropped when this semiblock is removed.
    net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>
    Add any dropped items from this semiblock to the given list.
    net.minecraft.network.chat.Component
    Get the displayed name for this semiblock.
    net.minecraft.resources.ResourceLocation
    Get a unique ID for this semiblock, which should match the corresponding item's registry name.
    int
     
    int
    Get the tracking for this semiblock; this should only be used for network sync purposes, and is subject to change on a world reload.
    net.minecraft.world.level.Level
    Get the world this semiblock is in.
    void
    handleGUIButtonPress(String tag, boolean shiftHeld, net.minecraft.server.level.ServerPlayer player)
     
    boolean
    hurt(net.minecraft.world.damagesource.DamageSource source, float amount)
     
    net.minecraft.world.InteractionResult
    interactAt(net.minecraft.world.entity.player.Player player, net.minecraft.world.phys.Vec3 hitVec, net.minecraft.world.InteractionHand hand)
     
    boolean
     
    boolean
     
    boolean
     
    boolean
    Check if this semiblock is still valid, i.e.
    void
    killedByEntity(net.minecraft.world.entity.Entity entity)
    Called when an entity has caused this semiblock to be removed; usually, but necessarily, a player wrenching or hitting it.
    void
     
    void
     
    protected void
    readAdditionalSaveData(net.minecraft.nbt.CompoundTag compound)
     
    void
    readFromBuf(net.minecraft.network.FriendlyByteBuf payload)
    Read this semiblock from network buffer for network sync purposes.
    net.minecraft.nbt.CompoundTag
    serializeNBT(net.minecraft.nbt.CompoundTag tag)
    Written to the dropped item (under the "EntityTag" subtag) when the semiblock is broken, to persisted entity data by Entity#writeAdditional(), and displayed by info mods such as TOP or Waila.
    void
    setPos(double x, double y, double z)
     
    void
    Implement tick logic here.
    void
    writeToBuf(net.minecraft.network.FriendlyByteBuf payload)
    Write this semiblock to network buffer for network sync purposes.

    Methods inherited from class net.minecraft.world.entity.Entity

    absMoveTo, absMoveTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addPassenger, addTag, animateHurt, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canChangeDimensions, canCollideWith, canEnterPose, canFreeze, canRide, canSpawnSprintParticle, canSprint, canTrample, canUpdate, canUpdate, captureDrops, captureDrops, causeFallDamage, changeDimension, changeDimension, checkBelowWorld, checkDespawn, checkFallDamage, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, copyPosition, couldAcceptPassenger, createCommandSourceStack, createHoverEvent, damageSources, dampensVibrations, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doEnchantDamageEffects, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, findDimensionEntryPoint, fireImmune, fixupDimensions, gameEvent, gameEvent, getAirSupply, getAllSlots, getArmorSlots, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getBoundingBoxForCulling, getBoundingBoxForPose, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getControllingPassenger, getCustomName, getDeltaMovement, getDimensionChangingDelay, getDimensions, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getExitPortal, getEyeHeight, getEyeHeight, getEyeHeight, getEyeHeightAccess, getEyeInFluidType, getEyePosition, getEyePosition, getEyeY, getFeetBlockState, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getFluidTypeHeight, getForward, getHandHoldingItemAngle, getHandSlots, getId, getIndirectPassengers, getLeashOffset, getLeashOffset, getLightLevelDependentMagicValue, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxFallDistance, getMaxHeightFluidType, getMotionDirection, getMovementEmission, getMyRidingOffset, getName, getNameTagOffsetY, getOnPos, getOnPos, getOnPosLegacy, getPassengers, getPassengersAndSelf, getPassengersRidingOffset, getPercentFrozen, getPermissionLevel, getPersistentData, getPickRadius, getPickResult, getPistonPushReaction, getPortalCooldown, getPortalWaitTime, getPose, getPosition, getPositionCodec, getPrimaryStepSoundBlockPos, getRandomX, getRandomY, getRandomZ, getRelativePortalPosition, getRemainingFireTicks, getRemovalReason, getRootVehicle, getRopeHoldPosition, getRotationVector, getScoreboardName, getSelfAndPassengers, getServer, getSharedFlag, getSlot, getSoundSource, getStringUUID, getSwimHighSpeedSplashSound, getSwimSound, getSwimSplashSound, getTags, getTeam, getTeamColor, getTicksFrozen, getTicksRequiredToFreeze, getType, getTypeName, getUpVector, getUUID, getVehicle, getViewScale, getViewVector, getViewXRot, getViewYRot, getVisualRotationYInDegrees, getX, getX, getXRot, getY, getY, getYHeadRot, getYRot, getZ, getZ, handleDamageEvent, handleEntityEvent, handleInsidePortal, handleNetherPortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, ignoreExplosion, interact, is, isAddedToWorld, isAlive, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCurrentlyGlowing, isCustomNameVisible, isDescending, isDiscrete, isEffectiveAi, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInFluidType, isInFluidType, isInLava, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isInWall, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushable, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killedEntity, lavaHurt, lerpHeadTo, lerpMotion, lerpTo, level, limitPistonMovement, load, lookAt, makeBoundingBox, makeStuckInBlock, markHurt, maxUpStep, maybeBackOffFromEdge, mayInteract, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onBelowWorld, onClientRemoval, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onSyncedDataUpdated, onSyncedDataUpdated, pick, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, push, push, reapplyPosition, recreateFromPacket, refreshDimensions, remove, removeAfterChangingDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, revive, rideTick, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setBoundingBox, setCustomName, setCustomNameVisible, setDeltaMovement, setDeltaMovement, setFluidTypeHeight, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setItemSlot, setLevel, setLevelCallback, setMaxUpStep, setNoGravity, setOldPosAndRot, setOnGround, setOnGroundWithKnownMovement, setPortalCooldown, setPortalCooldown, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSecondsOnFire, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSprinting, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYBodyRot, setYHeadRot, setYRot, shouldBeSaved, shouldBlockExplode, shouldInformAdmins, shouldRender, shouldRenderAtSqrDistance, shouldShowName, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, syncPacketPositionCodec, teleportRelative, teleportTo, teleportTo, teleportToWithTicket, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSound

    Methods inherited from class net.minecraftforge.common.capabilities.CapabilityProvider

    areCapsCompatible, areCapsCompatible, deserializeCaps, gatherCapabilities, gatherCapabilities, gatherCapabilities, getCapabilities, getCapability, invalidateCaps, reviveCaps, serializeCaps

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.commands.CommandSource

    alwaysAccepts

    Methods inherited from interface net.minecraftforge.common.capabilities.ICapabilityProvider

    getCapability, getCapability

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeEntity

    canBeRiddenUnderFluidType, canFluidExtinguish, canHydrateInFluidType, canRiderInteract, canStartSwimming, canSwimInFluidType, deserializeNBT, getClassification, getFluidFallDistanceModifier, getFluidMotionScale, getParts, getPickedResult, getSoundFromFluidType, getStepHeight, hasCustomOutlineRendering, isEyeInFluidType, isInFluidType, isInFluidType, isInFluidType, isMultipartEntity, isPushedByFluid, serializeNBT, shouldRiderSit

    Methods inherited from interface me.desht.pneumaticcraft.api.semiblock.ISemiBlock

    addTooltip, canPlace, getColor, onPlaced, onRightClickWithConfigurator
  • Method Details

    • getSemiblockDisplayName

      public net.minecraft.network.chat.Component getSemiblockDisplayName()
      Description copied from interface: ISemiBlock
      Get the displayed name for this semiblock.
      Specified by:
      getSemiblockDisplayName in interface ISemiBlock
      Returns:
      the name
    • tick

      public void tick()
      Description copied from interface: ISemiBlock
      Implement tick logic here. Always be sure to call super.tick() in subclass overrides!
      Specified by:
      tick in interface ISemiBlock
      Overrides:
      tick in class net.minecraft.world.entity.Entity
    • interactAt

      public net.minecraft.world.InteractionResult interactAt(net.minecraft.world.entity.player.Player player, net.minecraft.world.phys.Vec3 hitVec, net.minecraft.world.InteractionHand hand)
      Overrides:
      interactAt in class net.minecraft.world.entity.Entity
    • defineSynchedData

      protected void defineSynchedData()
      Specified by:
      defineSynchedData in class net.minecraft.world.entity.Entity
    • getWorld

      public net.minecraft.world.level.Level getWorld()
      Description copied from interface: ISemiBlock
      Get the world this semiblock is in.
      Specified by:
      getWorld in interface ISemiBlock
      Returns:
      the world
    • getBlockPos

      public net.minecraft.core.BlockPos getBlockPos()
      Description copied from interface: ISemiBlock
      Get the block position this entity occupies.
      Specified by:
      getBlockPos in interface ISemiBlock
      Returns:
      the block pos
    • setPos

      public void setPos(double x, double y, double z)
      Overrides:
      setPos in class net.minecraft.world.entity.Entity
    • getBlockState

      public net.minecraft.world.level.block.state.BlockState getBlockState()
      Get the blockstate at the semiblock's position
      Returns:
      the blockstate
    • getCachedTileEntity

      public net.minecraft.world.level.block.entity.BlockEntity getCachedTileEntity()
      Description copied from interface: ISemiBlock
      Get the block entity at the semiblock's position. This is cached for performance.
      Specified by:
      getCachedTileEntity in interface ISemiBlock
      Returns:
      the block entity, or null if there is none
    • getDroppedItem

      protected net.minecraft.world.item.Item getDroppedItem()
      Get the semiblock item which will be dropped when this semiblock is removed. By default, that item has the same registry name as the corresponding entity; this could be overridden but probably shouldn't be, for the sake of clarity.
      Returns:
      the dropped item, or null if nothing should be dropped
    • getDrops

      public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> getDrops()
      Description copied from interface: ISemiBlock
      Add any dropped items from this semiblock to the given list. By default, just the semiblock item itself is added, but this can be overridden to drop extra items if needed.
      Specified by:
      getDrops in interface ISemiBlock
    • getBlockBounds

      public final net.minecraft.world.phys.AABB getBlockBounds()
      Get the bounding box for this entity. Override calculateBlockBounds() if you need a custom bounding box.
      Returns:
      a bounding box
    • calculateBlockBounds

      protected net.minecraft.world.phys.AABB calculateBlockBounds()
      Get the bounding box for this entity, which by default is the bounding box of the block we're on. This should be in a 0->1 coordinate space; it will be offset by the block's blockpos to get the actual entity bounding box as returned by Entity.getBoundingBox().
      Returns:
      a bounding box
    • canStay

      public boolean canStay()
      Check if this semiblock can remain here.
      Returns:
      true if the semiblock can stay, false if it should be dropped
    • getSemiblockId

      public net.minecraft.resources.ResourceLocation getSemiblockId()
      Description copied from interface: ISemiBlock
      Get a unique ID for this semiblock, which should match the corresponding item's registry name.
      Specified by:
      getSemiblockId in interface ISemiBlock
      Returns:
      a semiblock ID
    • getAddEntityPacket

      public net.minecraft.network.protocol.Packet<net.minecraft.network.protocol.game.ClientGamePacketListener> getAddEntityPacket()
      Overrides:
      getAddEntityPacket in class net.minecraft.world.entity.Entity
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(net.minecraft.nbt.CompoundTag tag)
      Description copied from interface: ISemiBlock
      Written to the dropped item (under the "EntityTag" subtag) when the semiblock is broken, to persisted entity data by Entity#writeAdditional(), and displayed by info mods such as TOP or Waila. Use this method rather than writeAdditional() for fields that either need to be serialized to the dropped item, or displayed on TOP/Waila.

      Specified by:
      serializeNBT in interface ISemiBlock
      Parameters:
      tag - NBT tag to write data to
    • readAdditionalSaveData

      protected void readAdditionalSaveData(net.minecraft.nbt.CompoundTag compound)
      Specified by:
      readAdditionalSaveData in class net.minecraft.world.entity.Entity
    • addAdditionalSaveData

      protected void addAdditionalSaveData(net.minecraft.nbt.CompoundTag compound)
      Specified by:
      addAdditionalSaveData in class net.minecraft.world.entity.Entity
    • isValid

      public boolean isValid()
      Description copied from interface: ISemiBlock
      Check if this semiblock is still valid, i.e. the underlying entity is still alive.
      Specified by:
      isValid in interface ISemiBlock
      Returns:
      true if this semiblock is valid, false otherwise
    • onAddedToWorld

      public void onAddedToWorld()
      Specified by:
      onAddedToWorld in interface net.minecraftforge.common.extensions.IForgeEntity
      Overrides:
      onAddedToWorld in class net.minecraft.world.entity.Entity
    • onRemovedFromWorld

      public void onRemovedFromWorld()
      Specified by:
      onRemovedFromWorld in interface net.minecraftforge.common.extensions.IForgeEntity
      Overrides:
      onRemovedFromWorld in class net.minecraft.world.entity.Entity
    • doExtraCleanupTasks

      protected void doExtraCleanupTasks(boolean removingSemiblock)
      Called by onRemovedFromWorld() to finalize semiblock removal. Override in subclasses.
      Parameters:
      removingSemiblock - true if this semiblock is actually being removed from world, false if removing to chunk unloading
    • isNoGravity

      public boolean isNoGravity()
      Overrides:
      isNoGravity in class net.minecraft.world.entity.Entity
    • isPickable

      public boolean isPickable()
      Overrides:
      isPickable in class net.minecraft.world.entity.Entity
    • getTrackingId

      public int getTrackingId()
      Description copied from interface: ISemiBlock
      Get the tracking for this semiblock; this should only be used for network sync purposes, and is subject to change on a world reload.
      Specified by:
      getTrackingId in interface ISemiBlock
      Returns:
      the underlying entity's ID, or -1 if the entity has not been added to the world
      See Also:
    • canCoexist

      public boolean canCoexist(ISemiBlock otherSemiblock)
      Description copied from interface: ISemiBlock
      Check if this semiblock can coexist with the other semiblock, in the same block pos. By default this is true if at least one of the semiblocks is a IDirectionalSemiblock and both semiblocks have a different side.
      Specified by:
      canCoexist in interface ISemiBlock
      Parameters:
      otherSemiblock - the other semiblock
      Returns:
      true if they can coexist, false otherwise
    • killedByEntity

      public void killedByEntity(net.minecraft.world.entity.Entity entity)
      Description copied from interface: ISemiBlock
      Called when an entity has caused this semiblock to be removed; usually, but necessarily, a player wrenching or hitting it.
      Specified by:
      killedByEntity in interface ISemiBlock
      Parameters:
      entity - the killer entity
    • hurt

      public boolean hurt(net.minecraft.world.damagesource.DamageSource source, float amount)
      Overrides:
      hurt in class net.minecraft.world.entity.Entity
    • getDamageTaken

      public float getDamageTaken()
    • getTimeSinceHit

      public int getTimeSinceHit()
    • isAir

      public boolean isAir()
    • handleGUIButtonPress

      public void handleGUIButtonPress(String tag, boolean shiftHeld, net.minecraft.server.level.ServerPlayer player)
      Specified by:
      handleGUIButtonPress in interface IGUIButtonSensitive
    • writeToBuf

      public void writeToBuf(net.minecraft.network.FriendlyByteBuf payload)
      Description copied from interface: ISemiBlock
      Write this semiblock to network buffer for network sync purposes.
      Specified by:
      writeToBuf in interface ISemiBlock
      Parameters:
      payload - the buffer
    • readFromBuf

      public void readFromBuf(net.minecraft.network.FriendlyByteBuf payload)
      Description copied from interface: ISemiBlock
      Read this semiblock from network buffer for network sync purposes.
      Specified by:
      readFromBuf in interface ISemiBlock
      Parameters:
      payload - the buffer