Class MeteorProjectileEntity

java.lang.Object
net.minecraft.world.entity.Entity
net.minecraft.world.entity.projectile.Projectile
net.minecraft.world.entity.projectile.AbstractHurtingProjectile
me.emafire003.dev.ohmymeteors.entities.MeteorProjectileEntity
All Implemented Interfaces:
net.minecraft.commands.CommandSource, net.minecraft.world.level.entity.EntityAccess, net.minecraft.world.Nameable

public class MeteorProjectileEntity extends net.minecraft.world.entity.projectile.AbstractHurtingProjectile
The projectile entity that gets spawned as a meteor. Upon hitting a block which is not air, it will execute the on-hit actions such as creating an explosion and spawning the structure of blocks of the meteor thing
  • 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
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
     
    protected boolean
     
    protected net.minecraft.world.phys.Vec3
     
    protected boolean
     
    protected boolean
     
    final net.minecraft.world.entity.AnimationState
     
    protected int
     
    protected int
     

    Fields inherited from class net.minecraft.world.entity.projectile.AbstractHurtingProjectile

    xPower, yPower, zPower

    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, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, isInsidePortal, level, MAX_ENTITY_TAG_COUNT, maxUpStep, minorHorizontalCollision, moveDist, noCulling, noPhysics, onGround, 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
  • Constructor Summary

    Constructors
    Constructor
    Description
    MeteorProjectileEntity(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.projectile.AbstractHurtingProjectile> entityType, net.minecraft.world.level.Level world)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
     
    void
     
    protected boolean
    canHitEntity(net.minecraft.world.entity.Entity target)
     
    This method can be used by other mods to add their own custom meteors and spawn their version of the meteors
    protected void
     
    void
    This will detonate the meteor with an explosion like detonateSimple() but will also spawn other meteors based on the size of this meteor.
    void
    Makes this entity explode without creating any structures on impact and then discards this entity
    void
    detonateSimple(int extraPower)
     
    void
    Like detonateSimple() but will also spawn the structure of the meteor
    void
    Like detonateWithStructure() but will only replace air blocks
    void
    Actually makes the meteor explode and disappear, and spawn stuff if it needs to.
    final @NotNull net.minecraft.world.entity.EntityDimensions
    getDimensions(net.minecraft.world.entity.Pose pose)
     
    protected float
     
    protected net.minecraft.core.BlockPos
    getOffset(MeteorSizeClass sizeClass, net.minecraft.resources.ResourceLocation tobeplaced)
    Returns the offset of the meteor structure, aka how much it's going to be embedded in the terrain.
    me.emafire003.dev.structureplacerapi.StructurePlacerAPI
     
    me.emafire003.dev.structureplacerapi.StructurePlacerAPI
     
    me.emafire003.dev.structureplacerapi.StructurePlacerAPI
    getPlacer(MeteorSizeClass sizeClass, String filter)
    If the meteor is micro size (less than 2) will just spawn a block and return null
    int
     
    Returns the size class of this meteor, based on the values of the config file
    net.minecraft.resources.ResourceLocation
     
    net.minecraft.resources.ResourceLocation
    Returns the ID of the structure that is going to be spawned based the size class
    void
    Initializes the meteor with a random size upon creation of the meteor object.
    boolean
    Returns true if this meteor is classified as huge, as in bigger than the biggest "big" size
    boolean
     
    boolean
     
    void
    Gets called every tick and makes sure that when the meteor travels through a chunk it is loaded
    void
     
    protected void
    onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult)
     
    protected void
    onHitEntity(net.minecraft.world.phys.EntityHitResult entityHitResult)
     
    void
    onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> data)
     
    void
    particleAnimation(double d, double e, double f)
    Spawns the particle effects behind the meteor
    void
    readAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
     
    void
     
    void
    setScatterMeteor(boolean scatterMeteor)
     
    void
    setSilenced(boolean silenced)
     
    void
    setSize(int size)
     
    void
     
    boolean
    shouldRender(double cameraX, double cameraY, double cameraZ)
     
    boolean
    shouldRenderAtSqrDistance(double distance)
     
    protected int
    The sphere explosion is a little weaker than the vanilla one, so adjustment may be needed to have a niceer effect
    void
     

    Methods inherited from class net.minecraft.world.entity.projectile.AbstractHurtingProjectile

    getAddEntityPacket, getLightLevelDependentMagicValue, getPickRadius, getTrailParticle, hurt, isPickable, recreateFromPacket, shouldBurn

    Methods inherited from class net.minecraft.world.entity.projectile.Projectile

    getEffectSource, getOwner, lerpMotion, lerpRotation, mayInteract, onHit, ownedBy, setOwner, shoot, shootFromRotation, updateRotation

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

    absMoveTo, absMoveTo, acceptsFailure, acceptsSuccess, addPassenger, addTag, animateHurt, asChatSender, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canChangeDimensions, canCollideWith, canEnterPose, canFreeze, canRide, canSpawnSprintParticle, causeFallDamage, changeDimension, checkDespawn, checkFallDamage, checkInsideBlocks, checkOutOfWorld, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, copyPosition, createCommandSourceStack, createHoverEvent, dampensVibrations, discard, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doEnchantDamageEffects, doWaterSplashEffect, ejectPassengers, equals, fillCrashReportCategory, findDimensionEntryPoint, fireImmune, gameEvent, gameEvent, getAirSupply, getAllSlots, getArmorSlots, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getBoundingBoxForCulling, getBoundingBoxForPose, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControllingPassenger, getCustomName, getDeltaMovement, getDimensionChangingDelay, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getExitPortal, getEyeHeight, getEyeHeight, getEyeHeight, getEyePosition, getEyePosition, getEyeY, getFeetBlockState, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getForward, getHandHoldingItemAngle, getHandSlots, getId, getIndirectPassengers, getLeashOffset, getLevel, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxFallDistance, getMotionDirection, getMovementEmission, getMyRidingOffset, getName, getOnPos, getOnPosLegacy, getPassengers, getPassengersAndSelf, getPassengersRidingOffset, getPercentFrozen, getPermissionLevel, getPickResult, getPistonPushReaction, getPortalWaitTime, getPose, getPosition, getPositionCodec, 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, handleEntityEvent, handleInsidePortal, handleNetherPortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, ignoreExplosion, interact, interactAt, is, isAlive, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCurrentlyGlowing, isCustomNameVisible, isDescending, isDiscrete, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInLava, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isInWall, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnGround, isOnPortalCooldown, isPassenger, isPassengerOfSameVehicle, isPushable, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, lavaHurt, lerpHeadTo, lerpTo, limitPistonMovement, load, lookAt, makeBoundingBox, makeStuckInBlock, markHurt, maybeBackOffFromEdge, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onFlap, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, outOfWorld, pick, playEntityOnFireExtinguishedSound, playerTouch, playSound, playSound, playStepSound, playSwimSound, position, positionRider, processFlappingMovement, processPortalCooldown, push, push, reapplyPosition, remove, removeAfterChangingDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, restoreFrom, rideableUnderWater, rideTick, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setBoundingBox, setCustomName, setCustomNameVisible, setDeltaMovement, setDeltaMovement, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setItemSlot, setLevelCallback, setNoGravity, setOldPosAndRot, setOnGround, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, setSecondsOnFire, setSharedFlag, setSharedFlagOnFire, setShiftKeyDown, setSilent, setSprinting, setSwimming, setTicksFrozen, setUUID, setViewScale, setXRot, setYBodyRot, setYHeadRot, setYRot, shouldBeSaved, shouldBlockExplode, shouldInformAdmins, shouldShowName, showVehicleHealth, skipAttackInteraction, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnAtLocation, spawnSprintParticle, startRiding, startRiding, startSeenByPlayer, stopRiding, stopSeenByPlayer, syncPacketPositionCodec, teleportTo, teleportToWithTicket, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, wasKilled

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.minecraft.commands.CommandSource

    alwaysAccepts
  • Field Details

    • rotationState

      public final net.minecraft.world.entity.AnimationState rotationState
    • rotationStateTimeout

      protected int rotationStateTimeout
    • isScatterMeteor

      protected boolean isScatterMeteor
    • accelerationPower

      public double accelerationPower
    • isSilenced

      protected boolean isSilenced
    • exploded

      protected boolean exploded
    • travelledBlocks

      protected int travelledBlocks
    • explosionPos

      protected net.minecraft.world.phys.Vec3 explosionPos
  • Constructor Details

    • MeteorProjectileEntity

      public MeteorProjectileEntity(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.projectile.AbstractHurtingProjectile> entityType, net.minecraft.world.level.Level world)
  • Method Details

    • defineSynchedData

      protected void defineSynchedData()
      Overrides:
      defineSynchedData in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • setSize

      public void setSize(int size)
    • getSize

      public int getSize()
    • addAdditionalSaveData

      public void addAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
      Overrides:
      addAdditionalSaveData in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • readAdditionalSaveData

      public void readAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt)
      Overrides:
      readAdditionalSaveData in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • refreshDimensions

      public void refreshDimensions()
      Overrides:
      refreshDimensions in class net.minecraft.world.entity.Entity
    • onSyncedDataUpdated

      public void onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> data)
      Overrides:
      onSyncedDataUpdated in class net.minecraft.world.entity.Entity
    • getInertia

      protected float getInertia()
      Overrides:
      getInertia in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • initialize

      public void initialize()
      Initializes the meteor with a random size upon creation of the meteor object. Called along with the constructor method
    • getDimensions

      @NotNull public final @NotNull net.minecraft.world.entity.EntityDimensions getDimensions(net.minecraft.world.entity.Pose pose)
      Overrides:
      getDimensions in class net.minecraft.world.entity.Entity
    • loadChunk

      public void loadChunk()
      Gets called every tick and makes sure that when the meteor travels through a chunk it is loaded
    • tick

      public void tick()
      Overrides:
      tick in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • setupAnimationStates

      public void setupAnimationStates()
    • particleAnimation

      public void particleAnimation(double d, double e, double f)
      Spawns the particle effects behind the meteor
    • sphereExplosionAdjuster

      protected int sphereExplosionAdjuster()
      The sphere explosion is a little weaker than the vanilla one, so adjustment may be needed to have a niceer effect
    • detonateSimple

      public void detonateSimple()
      Makes this entity explode without creating any structures on impact and then discards this entity
    • detonateSimple

      public void detonateSimple(int extraPower)
    • announceSpawn

      public void announceSpawn()
    • detonateWithStructure

      public void detonateWithStructure()
      Like detonateSimple() but will also spawn the structure of the meteor
    • detonateWithStructureOnlyAir

      public void detonateWithStructureOnlyAir()
      Like detonateWithStructure() but will only replace air blocks
    • getPlacer

      public me.emafire003.dev.structureplacerapi.StructurePlacerAPI getPlacer(MeteorSizeClass sizeClass, String filter)
      If the meteor is micro size (less than 2) will just spawn a block and return null
    • getPlacer

      public me.emafire003.dev.structureplacerapi.StructurePlacerAPI getPlacer(MeteorSizeClass sizeClass)
    • getPlacer

      public me.emafire003.dev.structureplacerapi.StructurePlacerAPI getPlacer()
    • getOffset

      protected net.minecraft.core.BlockPos getOffset(MeteorSizeClass sizeClass, net.minecraft.resources.ResourceLocation tobeplaced)
      Returns the offset of the meteor structure, aka how much it's going to be embedded in the terrain. it's based on its size and the distance from the terrain that would be left from the imapct point, and the direction of the meteor
      Parameters:
      sizeClass - The staring sizeClass to determine the starting offset
      tobeplaced - the id of the meteor that is going to be placed
      Returns:
      the blockpos offset
    • getStructureToPlace

      public net.minecraft.resources.ResourceLocation getStructureToPlace(MeteorSizeClass sizeClass, String filter)
      Returns the ID of the structure that is going to be spawned based the size class
      Parameters:
      sizeClass - The size of the meteors that we want to spawn, can be "small" "medium" "big" "huge"
    • getStructureToPlace

      public net.minecraft.resources.ResourceLocation getStructureToPlace(MeteorSizeClass sizeClass)
    • detonateScatter

      public void detonateScatter()
      This will detonate the meteor with an explosion like detonateSimple() but will also spawn other meteors based on the size of this meteor.

      Meteors will be smaller and be oriented randomly from that point on, but will still go down.

    • onHitBlock

      protected void onHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult)
      Overrides:
      onHitBlock in class net.minecraft.world.entity.projectile.Projectile
    • onHitEntity

      protected void onHitEntity(net.minecraft.world.phys.EntityHitResult entityHitResult)
      Overrides:
      onHitEntity in class net.minecraft.world.entity.projectile.Projectile
    • canHitEntity

      protected boolean canHitEntity(net.minecraft.world.entity.Entity target)
      Overrides:
      canHitEntity in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • explodeMeteor

      public void explodeMeteor()
      Actually makes the meteor explode and disappear, and spawn stuff if it needs to. It's used when hitting a block or an entity
    • onClientRemoval

      public void onClientRemoval()
      Overrides:
      onClientRemoval in class net.minecraft.world.entity.Entity
    • isHuge

      public boolean isHuge()
      Returns true if this meteor is classified as huge, as in bigger than the biggest "big" size
    • isScatterMeteor

      public boolean isScatterMeteor()
    • setScatterMeteor

      public void setScatterMeteor(boolean scatterMeteor)
    • shouldRenderAtSqrDistance

      public boolean shouldRenderAtSqrDistance(double distance)
      Overrides:
      shouldRenderAtSqrDistance in class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
    • shouldRender

      public boolean shouldRender(double cameraX, double cameraY, double cameraZ)
      Overrides:
      shouldRender in class net.minecraft.world.entity.Entity
    • isSilenced

      public boolean isSilenced()
    • setSilenced

      public void setSilenced(boolean silenced)
    • copy

      This method can be used by other mods to add their own custom meteors and spawn their version of the meteors
    • getSizeClass

      public MeteorSizeClass getSizeClass()
      Returns the size class of this meteor, based on the values of the config file