调整qbz95第三人称模型,重写靶子起伏,调整靶子倒下后的碰撞箱大小,添加弹射物命中钟的事件

This commit is contained in:
Atsuihsio 2024-08-08 15:28:53 +08:00
parent d45064cd0a
commit d53b2ac137
17 changed files with 409 additions and 114 deletions

View file

@ -7,6 +7,7 @@ import net.mcreator.superbwarfare.init.ModDamageTypes;
import net.mcreator.superbwarfare.init.ModEntities;
import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.network.message.ClientIndicatorMessage;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerPlayer;
@ -20,6 +21,8 @@ import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
@ -86,6 +89,11 @@ public class BocekArrowEntity extends AbstractArrow implements ItemSupplier {
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
}
@Override

View file

@ -6,6 +6,7 @@ import net.mcreator.superbwarfare.init.ModEntities;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.network.message.ClientIndicatorMessage;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerPlayer;
@ -17,6 +18,8 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
@ -83,6 +86,11 @@ public class FragEntity extends ThrowableItemProjectile {
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
this.discard();
}

View file

@ -8,6 +8,7 @@ import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.network.message.ClientIndicatorMessage;
import net.mcreator.superbwarfare.tools.CustomExplosion;
import net.mcreator.superbwarfare.tools.ParticleTool;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
@ -22,6 +23,8 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraftforge.network.NetworkHooks;
@ -100,6 +103,11 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
if (this.tickCount > 0) {
if (this.level() instanceof ServerLevel) {
causeExplode();

View file

@ -24,6 +24,7 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
@ -80,6 +81,11 @@ public class HandGrenadeEntity extends ThrowableItemProjectile {
this.level().playSound(null, result.getLocation().x, result.getLocation().y, result.getLocation().z, event, SoundSource.AMBIENT, 1.0F, 1.0F);
}
this.bounce(blockResult.getDirection());
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockResult.getDirection());
}
break;
case ENTITY:

View file

@ -5,6 +5,7 @@ import net.mcreator.superbwarfare.init.ModEntities;
import net.mcreator.superbwarfare.init.ModItems;
import net.mcreator.superbwarfare.tools.CustomExplosion;
import net.mcreator.superbwarfare.tools.ParticleTool;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
@ -16,6 +17,8 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraftforge.network.NetworkHooks;
@ -75,6 +78,11 @@ public class MortarShellEntity extends ThrowableItemProjectile {
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
if (!this.level().isClientSide() && this.level() instanceof ServerLevel) {
causeExplode();
}

View file

@ -300,6 +300,11 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
SoundEvent event = state.getBlock().getSoundType(state, this.level(), resultPos, this).getBreakSound();
this.level().playSound(null, result.getLocation().x, result.getLocation().y, result.getLocation().z, event, SoundSource.AMBIENT, 1.0F, 1.0F);
Vec3 hitVec = result.getLocation();
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
this.onHitBlock(hitVec);
}

View file

@ -27,6 +27,7 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
@ -91,6 +92,10 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
this.level().playSound(null, result.getLocation().x, result.getLocation().y, result.getLocation().z, event, SoundSource.AMBIENT, 1.0F, 1.0F);
}
this.bounce(blockResult.getDirection());
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockResult.getDirection());
}
break;
case ENTITY:

View file

@ -8,6 +8,7 @@ import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.network.message.ClientIndicatorMessage;
import net.mcreator.superbwarfare.tools.CustomExplosion;
import net.mcreator.superbwarfare.tools.ParticleTool;
import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
@ -25,6 +26,8 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
@ -117,6 +120,11 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) {
causeExplode();

View file

@ -204,6 +204,12 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
return PlayState.CONTINUE;
}
@Override
public void die(DamageSource source) {
super.die(source);
this.setPose(Pose.SLEEPING);
}
@Override
protected void tickDeath() {
++this.deathTime;

View file

@ -15,7 +15,6 @@ import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.damagesource.DamageSource;
@ -23,14 +22,12 @@ import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.*;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.control.FlyingMoveControl;
import net.minecraft.world.entity.ai.navigation.FlyingPathNavigation;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
@ -41,19 +38,13 @@ import net.minecraftforge.network.PlayMessages;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.util.GeckoLibUtil;
import javax.annotation.Nullable;
// TODO 重置靶子
@Mod.EventBusSubscriber
public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(Target1Entity.class, EntityDataSerializers.BOOLEAN);
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(Target1Entity.class, EntityDataSerializers.STRING);
public static final EntityDataAccessor<Integer> DOWN_TIME = SynchedEntityData.defineId(Target1Entity.class, EntityDataSerializers.INT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public String animationProcedure = "empty";
@ -67,14 +58,13 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
xpReward = 0;
setNoAi(true);
setPersistenceRequired();
this.moveControl = new FlyingMoveControl(this, 10, true);
}
@Override
protected void defineSynchedData() {
super.defineSynchedData();
this.entityData.define(SHOOT, false);
this.entityData.define(ANIMATION, "undefined");
this.entityData.define(DOWN_TIME, 0);
}
@Override
@ -117,7 +107,7 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
|| source.is(DamageTypes.WITHER)
|| source.is(DamageTypes.WITHER_SKULL)
|| source.is(DamageTypes.MAGIC)
|| this.getPersistentData().getDouble("target_down") > 0) {
|| this.entityData.get(DOWN_TIME) > 0) {
return false;
}
@ -129,28 +119,31 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
return super.hurt(source, amount);
}
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData livingdata, @Nullable CompoundTag tag) {
SpawnGroupData data = super.finalizeSpawn(world, difficulty, reason, livingdata, tag);
this.setYRot(0);
this.setXRot(0);
this.setYBodyRot(this.getYRot());
this.setYHeadRot(this.getYRot());
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
return data;
}
// @Override
// public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, MobSpawnType reason, @Nullable SpawnGroupData livingdata, @Nullable CompoundTag tag) {
// SpawnGroupData data = super.finalizeSpawn(world, difficulty, reason, livingdata, tag);
//
// this.setYRot(0);
// this.setXRot(0);
// this.setYBodyRot(this.getYRot());
// this.setYHeadRot(this.getYRot());
// this.yRotO = this.getYRot();
// this.xRotO = this.getXRot();
//
// return data;
// }
@Override
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
compound.putInt("DownTime", this.entityData.get(DOWN_TIME));
}
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
if (compound.contains("DownTime"))
this.entityData.set(DOWN_TIME, compound.getInt("DownTime"));
}
@SubscribeEvent
@ -170,11 +163,18 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
if (sourceEntity instanceof Player player) {
player.displayClientMessage(Component.literal(("Target Down " + new java.text.DecimalFormat("##.#").format((entity.position()).distanceTo((sourceEntity.position()))) + "M")), true);
SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 100, 1);
entity.getPersistentData().putDouble("target_down", 100);
((Target1Entity) entity).entityData.set(DOWN_TIME,90);
entity.setPose(Pose.SLEEPING);
}
}
}
@Override
public void die(DamageSource source) {
super.die(source);
}
@Override
public InteractionResult mobInteract(Player player, InteractionHand hand) {
InteractionResult result = InteractionResult.sidedSuccess(this.level().isClientSide());
@ -197,7 +197,7 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
this.getPersistentData().putDouble("target_down", 0);
this.entityData.set(DOWN_TIME, 0);
}
}
@ -207,28 +207,10 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
@Override
public void baseTick() {
super.baseTick();
if (this.getPersistentData().getDouble("target_down") > 0) {
this.getPersistentData().putDouble("target_down", this.getPersistentData().getDouble("target_down") - 1);
}
if (this.getPersistentData().getDouble("target_down") >= 98) {
this.setYRot(this.getYRot());
this.setXRot((float) (100 - this.getPersistentData().getDouble("target_down")) * -45f);
this.setYBodyRot(this.getYRot());
this.setYHeadRot(this.getYRot());
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
this.yBodyRotO = this.getYRot();
this.yHeadRotO = this.getYRot();
}
if (this.getPersistentData().getDouble("target_down") <= 5 && this.getPersistentData().getDouble("target_down") > 0) {
this.setYRot(this.getYRot());
this.setXRot((float) (-90 + (5 - this.getPersistentData().getDouble("target_down")) * 18f * 1.25f));
this.setYBodyRot(this.getYRot());
this.setYHeadRot(this.getYRot());
this.yRotO = this.getYRot();
this.xRotO = this.getXRot();
this.yBodyRotO = this.getYRot();
this.yHeadRotO = this.getYRot();
if (this.entityData.get(DOWN_TIME) > 0) {
this.entityData.set(DOWN_TIME,this.entityData.get(DOWN_TIME) - 1);
} else {
this.setPose(Pose.STANDING);
}
}
@ -276,25 +258,6 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
.add(Attributes.FLYING_SPEED, 0);
}
private PlayState movementPredicate(AnimationState<Target1Entity> event) {
if (this.animationProcedure.equals("empty")) {
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.superbwarfare.idle"));
}
return PlayState.STOP;
}
private PlayState procedurePredicate(AnimationState<Target1Entity> event) {
if (!animationProcedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationProcedure));
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {
this.animationProcedure = "empty";
event.getController().forceAnimationReset();
}
} else if (animationProcedure.equals("empty")) {
return PlayState.STOP;
}
return PlayState.CONTINUE;
}
@Override
protected void tickDeath() {
@ -320,22 +283,10 @@ public class Target1Entity extends PathfinderMob implements GeoEntity, AnimatedE
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
data.add(new AnimationController<>(this, "procedure", 0, this::procedurePredicate));
}
@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.cache;
}
@Override
public EntityDimensions getDimensions(Pose p_33597_) {
Entity entity = this;
float num = 0;
if (entity.getPersistentData().getDouble("target_down") > 0) {
num = 0.1f;
}
return super.getDimensions(p_33597_).scale(0.1f);
}
}

View file

@ -2,31 +2,36 @@
package net.mcreator.superbwarfare.entity;
import net.mcreator.superbwarfare.ModUtils;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.player.Player;
import net.mcreator.superbwarfare.init.ModDamageTypes;
import net.mcreator.superbwarfare.init.ModEntities;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.item.ItemStack;
import net.minecraft.sounds.SoundSource;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.PacketDistributor;
import net.mcreator.superbwarfare.init.*;
import net.mcreator.superbwarfare.init.ModMobEffects;
import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.network.message.ClientIndicatorMessage;
import net.minecraft.core.BlockPos;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.AbstractArrow;
import net.minecraft.world.entity.projectile.ItemSupplier;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PacketDistributor;
import net.minecraftforge.network.PlayMessages;
@OnlyIn(value = Dist.CLIENT, _interface = ItemSupplier.class)
public class TaserBulletProjectileEntity extends AbstractArrow implements ItemSupplier {
@ -96,6 +101,16 @@ public class TaserBulletProjectileEntity extends AbstractArrow implements ItemSu
this.discard();
}
@Override
public void onHitBlock(BlockHitResult blockHitResult) {
super.onHitBlock(blockHitResult);
BlockPos resultPos = blockHitResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos);
if(state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
}
}
@Override
public void tick() {
super.tick();

View file

@ -4,11 +4,11 @@ import net.mcreator.superbwarfare.ModUtils;
import net.mcreator.superbwarfare.entity.Target1Entity;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import software.bernie.geckolib.constant.DataTickets;
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.model.GeoModel;
import software.bernie.geckolib.model.data.EntityModelData;
import static net.mcreator.superbwarfare.entity.Target1Entity.DOWN_TIME;
public class Target1Model extends GeoModel<Target1Entity> {
@Override
@ -29,7 +29,10 @@ public class Target1Model extends GeoModel<Target1Entity> {
@Override
public void setCustomAnimations(Target1Entity animatable, long instanceId, AnimationState animationState) {
CoreGeoBone head = getAnimationProcessor().getBone("ba");
EntityModelData entityData = (EntityModelData) animationState.getData(DataTickets.ENTITY_MODEL_DATA);
head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD);
if (animatable.getEntityData().get(DOWN_TIME) > 20) {
head.setRotX(Mth.clamp(90 - animatable.getEntityData().get(DOWN_TIME),0,3) * 30 * Mth.DEG_TO_RAD);
} else {
head.setRotX(4.5f * animatable.getEntityData().get(DOWN_TIME) * Mth.DEG_TO_RAD);
}
}
}

View file

@ -13,6 +13,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.NetworkEvent;
@ -57,7 +58,11 @@ public class InteractMessage {
Vec3 looking = Vec3.atLowerCornerOf(player.level().clip(new ClipContext(player.getEyePosition(), player.getEyePosition().add(player.getLookAngle().scale(block_range)), ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, player)).getBlockPos());
BlockPos blockPos = BlockPos.containing(looking.x(), looking.y(), looking.z());
player.level().getBlockState(blockPos).use(player.level(), player, InteractionHand.MAIN_HAND, BlockHitResult.miss(new Vec3(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Direction.UP, blockPos));
level.getBlockState(blockPos).use(player.level(), player, InteractionHand.MAIN_HAND, BlockHitResult.miss(new Vec3(blockPos.getX(), blockPos.getY(), blockPos.getZ()), Direction.UP, blockPos));
if ((level.getBlockState(BlockPos.containing(looking.x(), looking.y(), looking.z()))).getBlock() instanceof BellBlock bell) {
bell.attemptToRing(level, blockPos, player.getDirection().getOpposite());
}
Entity lookingEntity = TraceTool.findLookingEntity(player, entity_range);
if (lookingEntity == null)

View file

@ -0,0 +1,259 @@
{
"credit": "Made with Blockbench",
"texture_size": [32, 32],
"textures": {
"0": "superbwarfare:item/qbz95_3d",
"particle": "superbwarfare:item/qbz95_3d"
},
"elements": [
{
"from": [6.25, 1, 2],
"to": [7.75, 2.9, 18.5],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 3]},
"faces": {
"north": {"uv": [6.5, 7, 7.5, 8], "texture": "#0"},
"east": {"uv": [0, 0, 8.5, 1], "texture": "#0"},
"south": {"uv": [3, 7.5, 4, 8.5], "texture": "#0"},
"west": {"uv": [0, 1, 8.5, 2], "texture": "#0"},
"up": {"uv": [1, 10.5, 0, 2], "texture": "#0"},
"down": {"uv": [2, 2, 1, 10.5], "texture": "#0"}
}
},
{
"from": [6.5, 4.25, 7],
"to": [7.5, 4.65, 12.25],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 4.45, 10.125]},
"faces": {
"north": {"uv": [9.5, 5, 10, 5.5], "texture": "#0"},
"east": {"uv": [2, 6.5, 5, 7], "texture": "#0"},
"south": {"uv": [8.5, 9.5, 9, 10], "texture": "#0"},
"west": {"uv": [5, 6.5, 8, 7], "texture": "#0"},
"up": {"uv": [2.5, 10, 2, 7], "texture": "#0"},
"down": {"uv": [3, 7, 2.5, 10], "texture": "#0"}
}
},
{
"from": [6.5, 2.76134, 13.06111],
"to": [7.5, 4.81134, 13.46111],
"rotation": {"angle": -22.5, "axis": "x", "origin": [7, 1.68634, 13.26111]},
"faces": {
"north": {"uv": [8, 6, 8.5, 7], "texture": "#0"},
"east": {"uv": [8.5, 3, 9, 4], "texture": "#0"},
"south": {"uv": [3.5, 8.5, 4, 9.5], "texture": "#0"},
"west": {"uv": [4, 8.5, 4.5, 9.5], "texture": "#0"},
"up": {"uv": [9.5, 10, 9, 9.5], "texture": "#0"},
"down": {"uv": [10, 9, 9.5, 9.5], "texture": "#0"}
}
},
{
"from": [6.5, 2.44163, 7.39616],
"to": [7.5, 4.49163, 7.79616],
"rotation": {"angle": 22.5, "axis": "x", "origin": [7, 5.56663, 7.59616]},
"faces": {
"north": {"uv": [8.5, 4, 9, 5], "texture": "#0"},
"east": {"uv": [4.5, 8.5, 5, 9.5], "texture": "#0"},
"south": {"uv": [5, 8.5, 5.5, 9.5], "texture": "#0"},
"west": {"uv": [8.5, 5, 9, 6], "texture": "#0"},
"up": {"uv": [10, 10, 9.5, 9.5], "texture": "#0"},
"down": {"uv": [10.5, 0, 10, 0.5], "texture": "#0"}
}
},
{
"from": [6.75, 2.9, 2],
"to": [7.25, 3.9, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 2]},
"faces": {
"north": {"uv": [10, 0.5, 10.5, 1], "texture": "#0"},
"east": {"uv": [10, 1, 10.5, 1.5], "texture": "#0"},
"south": {"uv": [2, 10, 2.5, 10.5], "texture": "#0"},
"west": {"uv": [10, 2, 10.5, 2.5], "texture": "#0"},
"up": {"uv": [3, 10.5, 2.5, 10], "texture": "#0"},
"down": {"uv": [10.5, 2.5, 10, 3], "texture": "#0"}
}
},
{
"from": [6.25, -0.5, 18.5],
"to": [7.75, 3, 20],
"rotation": {"angle": 0, "axis": "y", "origin": [6, 2, 3]},
"faces": {
"north": {"uv": [4, 2, 5, 4], "texture": "#0"},
"east": {"uv": [4, 4, 5, 6], "texture": "#0"},
"south": {"uv": [5, 2, 6, 4], "texture": "#0"},
"west": {"uv": [5, 4, 6, 6], "texture": "#0"},
"up": {"uv": [8.5, 4, 7.5, 3], "texture": "#0"},
"down": {"uv": [5, 7.5, 4, 8.5], "texture": "#0"}
}
},
{
"from": [6.25, 1, 10.05],
"to": [7.75, 1.9, 11.05],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2, 8.75]},
"faces": {
"north": {"uv": [7, 6, 8, 6.5], "texture": "#0"},
"east": {"uv": [3, 10, 3.5, 10.5], "texture": "#0"},
"south": {"uv": [8.5, 1.5, 9.5, 2], "texture": "#0"},
"west": {"uv": [10, 3, 10.5, 3.5], "texture": "#0"},
"up": {"uv": [9.5, 6.5, 8.5, 6], "texture": "#0"},
"down": {"uv": [9.5, 6.5, 8.5, 7], "texture": "#0"}
}
},
{
"from": [6.25, 1.31418, 7.47054],
"to": [7.75, 2.21418, 8.77054],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2.31418, 6.47054]},
"faces": {
"north": {"uv": [8.5, 7, 9.5, 7.5], "texture": "#0"},
"east": {"uv": [3.5, 10, 4, 10.5], "texture": "#0"},
"south": {"uv": [8.5, 7.5, 9.5, 8], "texture": "#0"},
"west": {"uv": [10, 3.5, 10.5, 4], "texture": "#0"},
"up": {"uv": [9.5, 8.5, 8.5, 8], "texture": "#0"},
"down": {"uv": [9.5, 8.5, 8.5, 9], "texture": "#0"}
}
},
{
"from": [6.25, 0.51012, 8.21278],
"to": [7.75, 1.41012, 9.91278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.51012, 7.61278]},
"faces": {
"north": {"uv": [9, 0, 10, 0.5], "texture": "#0"},
"east": {"uv": [9, 0.5, 10, 1], "texture": "#0"},
"south": {"uv": [9, 1, 10, 1.5], "texture": "#0"},
"west": {"uv": [9, 3, 10, 3.5], "texture": "#0"},
"up": {"uv": [8.5, 5, 7.5, 4], "texture": "#0"},
"down": {"uv": [6, 7.5, 5, 8.5], "texture": "#0"}
}
},
{
"from": [6.75, -0.38988, 8.91278],
"to": [7.25, -0.28988, 11.11278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 0.11012, 8.81278]},
"faces": {
"north": {"uv": [4, 10, 4.5, 10.5], "texture": "#0"},
"east": {"uv": [9, 3.5, 10, 4], "texture": "#0"},
"south": {"uv": [10, 4, 10.5, 4.5], "texture": "#0"},
"west": {"uv": [9, 4, 10, 4.5], "texture": "#0"},
"up": {"uv": [6, 9.5, 5.5, 8.5], "texture": "#0"},
"down": {"uv": [9.5, 4.5, 9, 5.5], "texture": "#0"}
}
},
{
"from": [6.75, -0.28988, 8.91278],
"to": [7.25, 0.61012, 9.01278],
"rotation": {"angle": 0, "axis": "x", "origin": [6, -0.38988, 8.51278]},
"faces": {
"north": {"uv": [4.5, 10, 5, 10.5], "texture": "#0"},
"east": {"uv": [5, 10, 5.5, 10.5], "texture": "#0"},
"south": {"uv": [10, 5, 10.5, 5.5], "texture": "#0"},
"west": {"uv": [10, 5.5, 10.5, 6], "texture": "#0"},
"up": {"uv": [6.5, 10.5, 6, 10], "texture": "#0"},
"down": {"uv": [10.5, 6, 10, 6.5], "texture": "#0"}
}
},
{
"from": [6.25, 0.19595, 10.49224],
"to": [7.75, 1.09595, 18.49224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [9, 5.5, 10, 6], "texture": "#0"},
"east": {"uv": [2, 6, 6, 6.5], "texture": "#0"},
"south": {"uv": [8.5, 9, 9.5, 9.5], "texture": "#0"},
"west": {"uv": [6, 2, 10, 2.5], "texture": "#0"},
"up": {"uv": [3, 6, 2, 2], "texture": "#0"},
"down": {"uv": [4, 2, 3, 6], "texture": "#0"}
}
},
{
"from": [6.25, -0.30405, 17.09224],
"to": [7.75, 0.19595, 18.49224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [9.5, 1.5, 10.5, 2], "texture": "#0"},
"east": {"uv": [6.5, 10, 7, 10.5], "texture": "#0"},
"south": {"uv": [3.5, 9.5, 4.5, 10], "texture": "#0"},
"west": {"uv": [10, 6.5, 10.5, 7], "texture": "#0"},
"up": {"uv": [5.5, 10, 4.5, 9.5], "texture": "#0"},
"down": {"uv": [10.5, 4.5, 9.5, 5], "texture": "#0"}
}
},
{
"from": [6.6, -1.30405, 14.49224],
"to": [7.4, 0.19595, 16.74224],
"rotation": {"angle": 0, "axis": "x", "origin": [6, 1.19595, 10.49224]},
"faces": {
"north": {"uv": [5.5, 9.5, 6, 10.5], "texture": "#0"},
"east": {"uv": [7.5, 5, 8.5, 6], "texture": "#0"},
"south": {"uv": [9.5, 6, 10, 7], "texture": "#0"},
"west": {"uv": [7.5, 7, 8.5, 8], "texture": "#0"},
"up": {"uv": [10, 8, 9.5, 7], "texture": "#0"},
"down": {"uv": [8, 9.5, 7.5, 10.5], "texture": "#0"}
}
},
{
"from": [6.6, -2.4884, 15.35068],
"to": [7.4, 1.0116, 17.60068],
"rotation": {"angle": 22.5, "axis": "x", "origin": [6, 2.0116, 11.35068]},
"faces": {
"north": {"uv": [6.5, 8, 7, 10], "texture": "#0"},
"east": {"uv": [6, 2.5, 7, 4.5], "texture": "#0"},
"south": {"uv": [7, 8, 7.5, 10], "texture": "#0"},
"west": {"uv": [6, 4.5, 7, 6.5], "texture": "#0"},
"up": {"uv": [8.5, 10.5, 8, 9.5], "texture": "#0"},
"down": {"uv": [10, 8, 9.5, 9], "texture": "#0"}
}
},
{
"from": [6.45, -2.78778, 11.03665],
"to": [7.55, 0.11222, 12.33665],
"rotation": {"angle": -22.5, "axis": "x", "origin": [6.25, -0.71166, 10.65397]},
"faces": {
"north": {"uv": [7.5, 8, 8, 9.5], "texture": "#0"},
"east": {"uv": [8, 8, 8.5, 9.5], "texture": "#0"},
"south": {"uv": [8.5, 0, 9, 1.5], "texture": "#0"},
"west": {"uv": [3, 8.5, 3.5, 10], "texture": "#0"},
"up": {"uv": [7.5, 10.5, 7, 10], "texture": "#0"},
"down": {"uv": [10.5, 7, 10, 7.5], "texture": "#0"}
}
},
{
"from": [6.5, 1.25, -4],
"to": [7.5, 2.25, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [7, 1.75, 0.5]},
"faces": {
"north": {"uv": [10, 7.5, 10.5, 8], "texture": "#0"},
"east": {"uv": [7, 2.5, 10, 3], "texture": "#0"},
"south": {"uv": [10, 8, 10.5, 8.5], "texture": "#0"},
"west": {"uv": [3, 7, 6, 7.5], "texture": "#0"},
"up": {"uv": [7.5, 6, 7, 3], "texture": "#0"},
"down": {"uv": [6.5, 7, 6, 10], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"translation": [-0.5, 6.25, -1.75],
"scale": [0.8, 0.8, 0.8]
},
"thirdperson_lefthand": {
"translation": [-0.5, 6.25, -1.75],
"scale": [0.8, 0.8, 0.8]
},
"ground": {
"translation": [0, 8.75, 0]
},
"head": {
"translation": [0, 13.5, -0.5]
},
"fixed": {
"rotation": [90, 45, -90],
"translation": [4.25, 5.25, -1.25]
}
},
"groups": [
{
"name": "group",
"origin": [7, 1.75, -2.5],
"color": 0,
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
}
]
}

View file

@ -9,19 +9,19 @@
"parent": "superbwarfare:item/qbz_95_icon"
},
"thirdperson_righthand": {
"parent": "superbwarfare:item/m8703d"
"parent": "superbwarfare:item/qbz95_3d"
},
"thirdperson_lefthand": {
"parent": "superbwarfare:item/m8703d"
"parent": "superbwarfare:item/qbz95_3d"
},
"ground": {
"parent": "superbwarfare:item/m8703d"
"parent": "superbwarfare:item/qbz95_3d"
},
"fixed": {
"parent": "superbwarfare:item/m8703d"
"parent": "superbwarfare:item/qbz95_3d"
},
"head": {
"parent": "superbwarfare:item/m8703d"
"parent": "superbwarfare:item/qbz95_3d"
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B