优化ak动画和子弹实体

This commit is contained in:
Atsuihsio 2025-02-04 17:16:03 +08:00
parent f3091dc76b
commit 22f4f9481c
3 changed files with 29 additions and 38 deletions

View file

@ -37,6 +37,7 @@ import net.minecraft.world.entity.MobType;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Projectile;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
@ -63,7 +64,7 @@ import java.util.function.Function;
import java.util.function.Predicate;
@SuppressWarnings({"unused", "UnusedReturnValue", "SuspiciousNameCombination"})
public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnData, GeoEntity, AnimatedEntity {
public class ProjectileEntity extends Projectile implements IEntityAdditionalSpawnData, GeoEntity {
public static final EntityDataAccessor<Float> COLOR_R = SynchedEntityData.defineId(ProjectileEntity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Float> COLOR_G = SynchedEntityData.defineId(ProjectileEntity.class, EntityDataSerializers.FLOAT);
@ -329,7 +330,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
tag.putBoolean("ForceKnockback", this.forceKnockback);
}
private void onHit(HitResult result) {
@Override
protected void onHit(HitResult result) {
if (result instanceof BlockHitResult blockHitResult) {
if (blockHitResult.getType() == HitResult.Type.MISS) {
return;
@ -779,17 +781,6 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
}
}
public String getSyncedAnimation() {
return null;
}
public void setAnimation(String animation) {
}
@Override
public void setAnimationProcedure(String procedure) {
}
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
}

View file

@ -55,7 +55,7 @@ public class ModEntities {
public static final RegistryObject<EntityType<MortarShellEntity>> MORTAR_SHELL = register("projectile_mortar_shell",
EntityType.Builder.<MortarShellEntity>of(MortarShellEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(MortarShellEntity::new).sized(0.5f, 0.5f));
public static final RegistryObject<EntityType<ProjectileEntity>> PROJECTILE = register("projectile",
EntityType.Builder.<ProjectileEntity>of(ProjectileEntity::new, MobCategory.MISC).setCustomClientFactory(ProjectileEntity::new).setTrackingRange(64).sized(0.5f, 0.5f));
EntityType.Builder.<ProjectileEntity>of(ProjectileEntity::new, MobCategory.MISC).setCustomClientFactory(ProjectileEntity::new).setTrackingRange(64).noSave().noSummon().sized(0.25f, 0.25f));
public static final RegistryObject<EntityType<CannonShellEntity>> CANNON_SHELL = register("projectile_cannon_shell",
EntityType.Builder.<CannonShellEntity>of(CannonShellEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).setCustomClientFactory(CannonShellEntity::new).sized(0.5f, 0.5f));
public static final RegistryObject<EntityType<HandGrenadeEntity>> HAND_GRENADE_ENTITY = register("projectile_hand_grenade_entity",

View file

@ -347,7 +347,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -364,8 +364,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -640,7 +640,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -657,8 +657,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -987,7 +987,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -1004,8 +1004,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -1366,7 +1366,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -1383,8 +1383,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -1718,7 +1718,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -1735,8 +1735,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -2029,7 +2029,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -2046,8 +2046,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -2411,7 +2411,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -2428,8 +2428,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],
@ -2790,7 +2790,7 @@
"0.55": [-24.75, 0, 0],
"0.7667": [59.73664, 1.67294, -32.59404],
"0.8167": [54.9, 0, 0],
"1.1833": [-10.64, -0.22, -0.76],
"1.1833": [-10.24842, 2.88379, 15.96086],
"1.25": [-11.53843, -0.2156, -0.76216],
"1.3333": [-1.89, -0.22, -0.76],
"1.35": [-1.88843, -0.2156, -0.76216],
@ -2807,8 +2807,8 @@
"0.55": [0, 0.12188, -0.93672],
"0.6167": [1.69, -2.94, 0.1],
"0.8333": [7.2, -12.25391, 6.7875],
"0.9167": [7.2, -12.25391, 6.7875],
"1.1833": [-0.13, -0.30828, -0.43563],
"0.9167": [0.63531, -6.7952, 11.71738],
"1.1833": [-1.23578, -0.31557, -0.38868],
"1.25": [-0.12957, -0.31603, -0.4701],
"1.3333": [-0.13, -0.30828, -0.43563],
"1.35": [-0.12957, 0.18006, -0.46385],