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.fabricmc.fabric.api.attachment.v1.AttachmentTarget,net.minecraft.commands.CommandSource,net.minecraft.network.syncher.SyncedDataHolder,net.minecraft.world.entity.TraceableEntity,net.minecraft.world.level.entity.EntityAccess,net.minecraft.world.Nameable,net.minecraft.world.scores.ScoreHolder
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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected net.minecraft.world.phys.Vec3protected booleanprotected booleanfinal net.minecraft.world.entity.AnimationStateprotected intprotected intFields inherited from class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
accelerationPower, DEFLECTION_SCALE, INITAL_ACCELERATION_POWERFields inherited from class net.minecraft.world.entity.Entity
BASE_SAFE_FALL_DISTANCE, BASE_TICKS_REQUIRED_TO_FREEZE, blocksBuilding, BOARDING_COOLDOWN, boardingCooldown, CONTENTS_SLOT_INDEX, 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, entityData, fallDistance, firstTick, FLAG_FALL_FLYING, FLAG_GLOWING, FLAG_ONFIRE, fluidHeight, flyDist, FREEZE_HURT_FREQUENCY, hasImpulse, horizontalCollision, hurtMarked, ID_TAG, invulnerableTime, isInPowderSnow, mainSupportingBlockPos, MAX_ENTITY_TAG_COUNT, minorHorizontalCollision, moveDist, noCulling, noPhysics, PASSENGERS_TAG, portalProcess, 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, zOldFields inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget
NBT_ATTACHMENT_KEYFields inherited from interface net.minecraft.commands.CommandSource
NULLFields inherited from interface net.minecraft.world.scores.ScoreHolder
WILDCARD, WILDCARD_NAME -
Constructor Summary
ConstructorsConstructorDescriptionMeteorProjectileEntity(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.projectile.AbstractHurtingProjectile> entityType, net.minecraft.world.level.Level world) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt) voidprotected booleancanHitEntity(net.minecraft.world.entity.Entity target) copy(MeteorProjectileEntity newMeteor) This method can be used by other mods to add their own custom meteors and spawn their version of the meteorsprotected voiddefineSynchedData(net.minecraft.network.syncher.SynchedEntityData.Builder builder) voidThis will detonate the meteor with an explosion likedetonateSimple()but will also spawn other meteors based on the size of this meteor.voidMakes this entity explode without creating any structures on impact and then discards this entityvoiddetonateSimple(int extraPower) voidLikedetonateSimple()but will also spawn the structure of the meteorvoidLikedetonateWithStructure()but will only replace air blocksvoidActually makes the meteor explode and disappear, and spawn stuff if it needs to.final @NotNull net.minecraft.world.entity.EntityDimensionsgetDimensions(net.minecraft.world.entity.Pose pose) protected net.minecraft.core.BlockPosgetOffset(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.StructurePlacerAPIme.emafire003.dev.structureplacerapi.StructurePlacerAPIgetPlacer(MeteorSizeClass sizeClass) me.emafire003.dev.structureplacerapi.StructurePlacerAPIgetPlacer(MeteorSizeClass sizeClass, String filter) If the meteor is micro size (less than 2) will just spawn a block and return nullintgetSize()Returns the size class of this meteor, based on the values of the config filenet.minecraft.resources.ResourceLocationgetStructureToPlace(MeteorSizeClass sizeClass) net.minecraft.resources.ResourceLocationgetStructureToPlace(MeteorSizeClass sizeClass, String filter) Returns the ID of the structure that is going to be spawned based the size classvoidInitializes the meteor with a random size upon creation of the meteor object.booleanisHuge()Returns true if this meteor is classified as huge, as in bigger than the biggest "big" sizebooleanbooleanvoidGets called every tick and makes sure that when the meteor travels through a chunk it is loadedvoidprotected voidonHitBlock(net.minecraft.world.phys.BlockHitResult blockHitResult) protected voidonHitEntity(net.minecraft.world.phys.EntityHitResult entityHitResult) voidonSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> data) voidparticleAnimation(double d, double e, double f) Spawns the particle effects behind the meteorvoidreadAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt) voidvoidsetScatterMeteor(boolean scatterMeteor) voidsetSilenced(boolean silenced) voidsetSize(int size) voidbooleanshouldRender(double cameraX, double cameraY, double cameraZ) booleanshouldRenderAtSqrDistance(double distance) protected intThe sphere explosion is a little weaker than the vanilla one, so adjustment may be needed to have a niceer effectvoidtick()Methods inherited from class net.minecraft.world.entity.projectile.AbstractHurtingProjectile
getAddEntityPacket, getClipType, getInertia, getLightLevelDependentMagicValue, getLiquidInertia, getTrailParticle, hurt, onDeflection, recreateFromPacket, shouldBurnMethods inherited from class net.minecraft.world.entity.projectile.Projectile
calculateHorizontalHurtKnockbackDirection, deflect, getEffectSource, getMovementToShoot, getOwner, getPickRadius, hitTargetOrDeflectSelf, isPickable, lerpMotion, lerpRotation, mayBreak, mayInteract, onHit, ownedBy, restoreFrom, setOwner, shoot, shootFromRotation, updateRotationMethods inherited from class net.minecraft.world.entity.Entity
absMoveTo, absMoveTo, absRotateTo, acceptsFailure, acceptsSuccess, addDeltaMovement, addPassenger, addTag, adjustSpawnLocation, animateHurt, applyGravity, awardKillScore, baseTick, blockPosition, broadcastToPlayer, calculateUpVector, calculateViewVector, canAddPassenger, canBeCollidedWith, canBeHitByProjectile, canChangeDimensions, canCollideWith, canControlVehicle, canFreeze, canRide, canSpawnSprintParticle, canSprint, canUsePortal, causeFallDamage, changeDimension, checkBelowWorld, checkDespawn, checkFallDamage, checkInsideBlocks, checkSlowFallDistance, checkSupportingBlock, chunkPosition, clearFire, closerThan, closerThan, collideBoundingBox, copyPosition, couldAcceptPassenger, countPlayerPassengers, createCommandSourceStack, createHoverEvent, damageSources, dampensVibrations, deflection, discard, dismountsUnderwater, dismountTo, displayFireAnimation, distanceTo, distanceToSqr, distanceToSqr, distanceToSqr, doWaterSplashEffect, ejectPassengers, equals, extinguishFire, fillCrashReportCategory, fireImmune, fixupDimensions, fudgePositionAfterSizeChange, gameEvent, gameEvent, getAirSupply, getAttachments, getBbHeight, getBbWidth, getBlockExplosionResistance, getBlockJumpFactor, getBlockPosBelowThatAffectsMyMovement, getBlockSpeedFactor, getBlockStateOn, getBlockStateOnLegacy, getBlockX, getBlockY, getBlockZ, getBoundingBox, getBoundingBoxForCulling, getCollisionHorizontalEscapeVector, getCommandSenderWorld, getControlledVehicle, getControllingPassenger, getCustomName, getDefaultGravity, getDefaultPassengerAttachmentPoint, getDeltaMovement, getDimensionChangingDelay, getDirection, getDismountLocationForPassenger, getDisplayName, getEncodeId, getEntityData, getEyeHeight, getEyeHeight, getEyePosition, getEyePosition, getEyeY, getFireImmuneTicks, getFirstPassenger, getFluidHeight, getFluidJumpThreshold, getForward, getGravity, getHandHoldingItemAngle, getId, getInBlockState, getIndirectPassengers, getKnownMovement, getLeashOffset, getLeashOffset, getLightProbePosition, getLookAngle, getMaxAirSupply, getMaxFallDistance, getMotionDirection, getMovementEmission, getName, getNearestViewDirection, getOnPos, getOnPos, getOnPosLegacy, getPassengerAttachmentPoint, getPassengerRidingPosition, getPassengers, getPassengersAndSelf, getPercentFrozen, getPermissionLevel, getPickResult, getPistonPushReaction, getPortalCooldown, getPose, getPosition, getPositionCodec, getPreciseBodyRotation, getPrimaryStepSoundBlockPos, getRandom, 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, getVehicleAttachmentPoint, getViewScale, getViewVector, getViewXRot, getViewYRot, getVisualRotationYInDegrees, getWeaponItem, getX, getX, getXRot, getY, getY, getYHeadRot, getYRot, getZ, getZ, handleDamageEvent, handleEntityEvent, handlePortal, hasControllingPassenger, hasCustomName, hasExactlyOnePlayerPassenger, hasGlowingTag, hashCode, hasIndirectPassenger, hasPassenger, hasPassenger, hasPermissions, hasPose, igniteForSeconds, igniteForTicks, ignoreExplosion, interact, interactAt, is, isAlive, isAlliedTo, isAlliedTo, isAlwaysTicking, isAttackable, isColliding, isControlledByLocalInstance, isCrouching, isCurrentlyGlowing, isCustomNameVisible, isDescending, isDiscrete, isEffectiveAi, isEyeInFluid, isFlapping, isFree, isFreezing, isFullyFrozen, isHorizontalCollisionMinor, isIgnoringBlockTriggers, isInLava, isInLiquid, isInvisible, isInvisibleTo, isInvulnerable, isInvulnerableTo, isInWall, isInWater, isInWaterOrBubble, isInWaterOrRain, isInWaterRainOrBubble, isNoGravity, isOnFire, isOnPortalCooldown, isOnRails, isPassenger, isPassengerOfSameVehicle, isPushable, isPushedByFluid, isRemoved, isShiftKeyDown, isSilent, isSpectator, isSprinting, isSteppingCarefully, isSupportedBy, isSuppressingBounce, isSwimming, isUnderWater, isVehicle, isVisuallyCrawling, isVisuallySwimming, kill, killedEntity, lavaHurt, lerpHeadTo, lerpPositionAndRotationStep, lerpTargetX, lerpTargetXRot, lerpTargetY, lerpTargetYRot, lerpTargetZ, lerpTo, level, limitPistonMovement, load, lookAt, makeBoundingBox, makeStuckInBlock, markHurt, maxUpStep, maybeBackOffFromEdge, mirror, move, moveRelative, moveTo, moveTo, moveTo, moveTo, moveTo, moveTowardsClosestSpace, newDoubleList, newFloatList, nextStep, onAboveBubbleCol, onBelowWorld, onExplosionHit, onFlap, onGround, onInsideBlock, onInsideBubbleColumn, onlyOpCanSetNbt, onPassengerTurned, onSyncedDataUpdated, pick, placePortalTicket, playCombinationStepSounds, playEntityOnFireExtinguishedSound, playerTouch, playMuffledStepSound, playSound, playSound, playStepSound, playSwimSound, position, positionRider, positionRider, processFlappingMovement, processPortalCooldown, push, push, push, reapplyPosition, registryAccess, remove, removeAfterChangingDimensions, removePassenger, removeTag, removeVehicle, repositionEntityAfterLoad, resetFallDistance, rideTick, rotate, save, saveAsPassenger, saveWithoutId, sendSystemMessage, setAirSupply, setAsInsidePortal, setBoundingBox, setCustomName, setCustomNameVisible, setDeltaMovement, setDeltaMovement, setGlowingTag, setId, setInvisible, setInvulnerable, setIsInPowderSnow, setLevel, setLevelCallback, setNoGravity, setOldPosAndRot, setOnGround, setOnGroundWithMovement, setPortalCooldown, setPortalCooldown, setPos, setPos, setPose, setPosRaw, setRemainingFireTicks, setRemoved, setRot, 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, teleportRelative, teleportTo, teleportTo, thunderHit, toString, touchingUnloadedChunk, trackingPosition, tryCheckInsideBlocks, turn, unRide, unsetRemoved, updateDynamicGameEventListener, updateFluidHeightAndDoFluidPushing, updateInWaterStateAndDoFluidPushing, updateSwimming, waterSwimSoundMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.fabricmc.fabric.api.attachment.v1.AttachmentTarget
getAttached, getAttachedOrCreate, getAttachedOrCreate, getAttachedOrElse, getAttachedOrGet, getAttachedOrSet, getAttachedOrThrow, hasAttached, modifyAttached, removeAttached, setAttachedMethods inherited from interface net.minecraft.commands.CommandSource
alwaysAcceptsMethods inherited from interface net.minecraft.world.scores.ScoreHolder
getFeedbackDisplayName
-
Field Details
-
rotationState
public final net.minecraft.world.entity.AnimationState rotationState -
rotationStateTimeout
protected int rotationStateTimeout -
isScatterMeteor
protected boolean isScatterMeteor -
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(net.minecraft.network.syncher.SynchedEntityData.Builder builder) - Overrides:
defineSynchedDatain classnet.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:
addAdditionalSaveDatain classnet.minecraft.world.entity.projectile.AbstractHurtingProjectile
-
readAdditionalSaveData
public void readAdditionalSaveData(net.minecraft.nbt.CompoundTag nbt) - Overrides:
readAdditionalSaveDatain classnet.minecraft.world.entity.projectile.AbstractHurtingProjectile
-
refreshDimensions
public void refreshDimensions()- Overrides:
refreshDimensionsin classnet.minecraft.world.entity.Entity
-
onSyncedDataUpdated
public void onSyncedDataUpdated(net.minecraft.network.syncher.EntityDataAccessor<?> data) - Specified by:
onSyncedDataUpdatedin interfacenet.minecraft.network.syncher.SyncedDataHolder- Overrides:
onSyncedDataUpdatedin classnet.minecraft.world.entity.Entity
-
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:
getDimensionsin classnet.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:
tickin classnet.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()LikedetonateSimple()but will also spawn the structure of the meteor -
detonateWithStructureOnlyAir
public void detonateWithStructureOnlyAir()LikedetonateWithStructure()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
-
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 offsettobeplaced- 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
-
detonateScatter
public void detonateScatter()This will detonate the meteor with an explosion likedetonateSimple()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:
onHitBlockin classnet.minecraft.world.entity.projectile.Projectile
-
onHitEntity
protected void onHitEntity(net.minecraft.world.phys.EntityHitResult entityHitResult) - Overrides:
onHitEntityin classnet.minecraft.world.entity.projectile.Projectile
-
canHitEntity
protected boolean canHitEntity(net.minecraft.world.entity.Entity target) - Overrides:
canHitEntityin classnet.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:
onClientRemovalin classnet.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:
shouldRenderAtSqrDistancein classnet.minecraft.world.entity.projectile.AbstractHurtingProjectile
-
shouldRender
public boolean shouldRender(double cameraX, double cameraY, double cameraZ) - Overrides:
shouldRenderin classnet.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
Returns the size class of this meteor, based on the values of the config file
-