削弱先辈,调整先辈动画,修复哨兵可同时充能和换弹的bug

This commit is contained in:
Atsuihsio 2024-06-27 15:27:51 +08:00
parent 7a11f4dad6
commit e3f42bff6c
12 changed files with 220 additions and 90 deletions

View file

@ -1,6 +1,7 @@
package net.mcreator.target.entity;
import net.mcreator.target.TargetMod;
import net.mcreator.target.block.BarbedWireBlock;
import net.mcreator.target.init.*;
import net.mcreator.target.network.message.ClientIndicatorMessage;
import net.mcreator.target.network.message.PlayerGunKillMessage;
@ -28,7 +29,7 @@ import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.material.FluidState;
@ -50,7 +51,13 @@ import java.util.function.Predicate;
public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnData {
private static final Predicate<Entity> PROJECTILE_TARGETS = input -> input != null && input.isPickable() && !input.isSpectator() && input.isAlive();
private static final Predicate<BlockState> IGNORE_LEAVES = input -> input != null && input.getBlock() instanceof LeavesBlock;
private static final Predicate<BlockState> IGNORE_LEAVES = input -> input != null && (input.getBlock() instanceof LeavesBlock
|| input.getBlock() instanceof FenceBlock
|| input.getBlock() instanceof IronBarsBlock
|| input.getBlock() instanceof StainedGlassPaneBlock
|| input.getBlock() instanceof DoorBlock
|| input.getBlock() instanceof TrapDoorBlock
|| input.getBlock() instanceof BarbedWireBlock);
protected LivingEntity shooter;
protected int shooterId;
private float damage = 1f;

View file

@ -61,7 +61,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
public SenpaiEntity(EntityType<SenpaiEntity> type, Level world) {
super(type, world);
xpReward = 20;
xpReward = 40;
setNoAi(false);
}
@ -85,7 +85,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
@Override
protected void registerGoals() {
super.registerGoals();
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.6, false) {
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.4, false) {
@Override
protected double getAttackReachSqr(LivingEntity entity) {
return this.mob.getBbWidth() * this.mob.getBbWidth() + entity.getBbWidth();
@ -105,7 +105,13 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
protected void dropCustomDeathLoot(DamageSource source, int looting, boolean recentlyHitIn) {
super.dropCustomDeathLoot(source, looting, recentlyHitIn);
this.spawnAtLocation(new ItemStack(Items.GOLDEN_APPLE));
if (Math.random() < 0.01) {
this.spawnAtLocation(new ItemStack(Items.ENCHANTED_GOLDEN_APPLE));
} else if (0.01 <= Math.random() && Math.random() < 0.2) {
this.spawnAtLocation(new ItemStack(Items.GOLDEN_APPLE));
} else if (Math.random() >= 0.2) {
this.spawnAtLocation(new ItemStack(Items.APPLE));
}
}
@Override
@ -115,7 +121,7 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
@Override
public void playStepSound(BlockPos pos, BlockState blockIn) {
this.playSound(TargetModSounds.STEP.get(), 0.15f, 1);
this.playSound(TargetModSounds.STEP.get(), 0.25f, 1);
}
@Override
@ -141,20 +147,6 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
@Override
public void baseTick() {
super.baseTick();
this.getPersistentData().putInt("find_target", this.getPersistentData().getInt("find_target") + 1);
double target = this.getPersistentData().getInt("find_target");
if (target == 1) {
final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ());
this.level().getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(256 / 2d), e -> true)
.stream()
.sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center)))
.filter(e -> e instanceof Player player && !player.isCreative())
.forEach(e -> this.setTarget((LivingEntity) e));
} else if (target >= 100) {
this.getPersistentData().putInt("find_target", 0);
}
this.refreshDimensions();
}
@ -177,11 +169,11 @@ public class SenpaiEntity extends Spider implements GeoEntity, AnimatedEntity {
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MOVEMENT_SPEED, 0.25)
.add(Attributes.MAX_HEALTH, 51)
.add(Attributes.MOVEMENT_SPEED, 0.23)
.add(Attributes.MAX_HEALTH, 24)
.add(Attributes.ARMOR, 0)
.add(Attributes.ATTACK_DAMAGE, 5)
.add(Attributes.FOLLOW_RANGE, 1024)
.add(Attributes.FOLLOW_RANGE, 64)
.add(Attributes.KNOCKBACK_RESISTANCE, 0.5);
}

View file

@ -25,14 +25,5 @@ public class SenpaiModel extends GeoModel<SenpaiEntity> {
return new ResourceLocation("target", "textures/entity/senpai.png");
}
@Override
public void setCustomAnimations(SenpaiEntity animatable, long instanceId, AnimationState animationState) {
CoreGeoBone head = getAnimationProcessor().getBone("head");
if (head != null) {
EntityModelData entityData = (EntityModelData) animationState.getData(DataTickets.ENTITY_MODEL_DATA);
head.setRotX(entityData.headPitch() * Mth.DEG_TO_RAD);
head.setRotY(entityData.netHeadYaw() * Mth.DEG_TO_RAD);
}
}
}

View file

@ -59,6 +59,7 @@ public class GunEventHandler {
if ((player.getPersistentData().getBoolean("firing") || stack.getOrCreateTag().getInt("burst_fire") > 0)
&& !stack.getOrCreateTag().getBoolean("reloading")
&& !stack.getOrCreateTag().getBoolean("charging")
&& stack.getOrCreateTag().getInt("ammo") > 0
&& !player.getCooldowns().isOnCooldown(stack.getItem())
&& stack.getOrCreateTag().getDouble("need_bolt_action") == 0) {

View file

@ -171,7 +171,7 @@ public class PlayerEventHandler {
private static void handlePrepareZoom(Player player) {
ItemStack stack = player.getMainHandItem();
if (stack.is(TargetModTags.Items.GUN) && !stack.getOrCreateTag().getBoolean("reloading") && !player.isSpectator()) {
if (stack.is(TargetModTags.Items.GUN) && !stack.getOrCreateTag().getBoolean("reloading") && !player.isSpectator() && !stack.getOrCreateTag().getBoolean("charging")) {
if (player.getMainHandItem().getItem() != TargetModItems.MINIGUN.get()) {
if ((player.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zoom) {
player.setSprinting(false);

View file

@ -121,11 +121,11 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.reload2"));
}
if (stack.getOrCreateTag().getDouble("charging_time") > 127 && stack.getOrCreateTag().getDouble("charging") == 1) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.chargep"));
}
// if (stack.getOrCreateTag().getDouble("charging_time") > 127 && stack.getOrCreateTag().getBoolean("charging")) {
// return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.chargep"));
// }
if (stack.getOrCreateTag().getDouble("charging_time") < 127 && stack.getOrCreateTag().getDouble("charging_time") > 0 && stack.getOrCreateTag().getDouble("charging") == 1) {
if (stack.getOrCreateTag().getDouble("charging_time") < 127 && stack.getOrCreateTag().getDouble("charging_time") > 0 && stack.getOrCreateTag().getBoolean("charging")) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.sentinel.charge"));
}
@ -233,10 +233,10 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
cid = tag.getDouble("cid");
if (player.getMainHandItem().getOrCreateTag().getDouble("cid") != tag.getDouble("cid")) {
tag.putDouble("charging", 0);
tag.putBoolean("charging", false);
tag.putDouble("charging_time", 0);
}
if (tag.getDouble("charging") == 1) {
if (tag.getBoolean("charging")) {
if (tag.getDouble("charging_time") == 127) {
entity.getPersistentData().putDouble("cid", cid);
if (entity instanceof ServerPlayer serverPlayer) {
@ -249,18 +249,18 @@ public class SentinelItem extends GunItem implements GeoItem, AnimatedItem {
tag.putDouble("charging_time", tag.getDouble("charging_time") - 1);
}
} else {
tag.putDouble("charging", 0);
tag.putBoolean("charging", false);
tag.putDouble("charging_time", 0);
}
if (tag.getDouble("charging_time") == 16 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
tag.putDouble("power", 100);
}
if (tag.getDouble("charging_time") == 1 && player.getMainHandItem().getOrCreateTag().getDouble("cid") == cid) {
tag.putDouble("charging", 0);
tag.putBoolean("charging", false);
}
}
if (tag.getDouble("power") > 0) {
tag.putDouble("add_damage", 10);
tag.putDouble("add_damage", 0.2857142857142857 * tag.getDouble("damage") * tag.getDouble("damageadd"));
tag.putDouble("power", tag.getDouble("power") - 0.025);
} else {
tag.putDouble("add_damage", 0);

View file

@ -103,19 +103,8 @@ public class FireModeMessage {
}
}
// if (item == TargetModItems.AK_47.get()
// || item == TargetModItems.M_4.get()
// || item == TargetModItems.AA_12.get()
// || item == TargetModItems.HK_416.get()
// || item == TargetModItems.RPK.get()
// || item == TargetModItems.MK_14.get()) {
// setFireMode(player, tag, fireMode == 0 ? 2 : 0);
// }
// if (item == TargetModItems.VECTOR.get()) {
// setFireMode(player, tag, (fireMode + 1) % 3);
// }
if (item == TargetModItems.SENTINEL.get() && !(player.getCooldowns().isOnCooldown(item)) && tag.getDouble("charging") == 0) {
tag.putDouble("charging", 1);
if (item == TargetModItems.SENTINEL.get() && !(player.getCooldowns().isOnCooldown(item)) && !tag.getBoolean("charging") && !tag.getBoolean("reloading")) {
tag.putBoolean("charging", true);
tag.putDouble("cid", (Mth.nextDouble(RandomSource.create(), 1, 1919810)));
tag.putDouble("charging_time", 128);
}

View file

@ -258,6 +258,7 @@ public class PlayerReloadProcedure {
if (player.getMainHandItem().getItem() == TargetModItems.SENTINEL.get()
&& !(player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem()))
&& !tag.getBoolean("reloading")
&& !tag.getBoolean("charging")
&& tag.getInt("ammo") < 6
&& (entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).sniperAmmo > 0) {
if (tag.getInt("ammo") > 0) {

View file

@ -145,13 +145,32 @@
"loop": true,
"animation_length": 1,
"bones": {
"0": {
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"0.25": {
"vector": [0, 4, -2]
},
"0.5": {
"vector": [0, 0, 2]
},
"0.75": {
"vector": [0, 4, -2]
},
"1.0": {
"vector": [0, 0, 0]
}
}
},
"upper": {
"rotation": {
"0.0": {
"vector": [32.5, 0, 0]
},
"0.25": {
"vector": [-30, 0, 0],
"vector": [-29.97638, 1.2497, 2.16541],
"easing": "easeInOutQuad"
},
"0.5": {
@ -159,7 +178,7 @@
"easing": "easeInOutQuad"
},
"0.75": {
"vector": [-30, 0, 0],
"vector": [-29.9055, -2.49762, -4.33287],
"easing": "easeInOutQuad"
},
"1.0": {
@ -192,42 +211,76 @@
"right_arm": {
"rotation": {
"0.0": {
"vector": [-87.5, 0, 0]
"vector": [-77.46148, 9.99038, 0.44067]
},
"0.25": {
"vector": [40, 0, 0],
"easing": "easeInOutQuad"
},
"0.5": {
"vector": [-87.5, 0, 0]
"vector": [-107.46148, 9.99038, 0.44067]
},
"0.75": {
"vector": [40, 0, 0],
"easing": "easeInOutQuad"
},
"1.0": {
"vector": [-87.5, 0, 0]
"vector": [-79.3701, 12.00365, -9.53884]
}
},
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"0.25": {
"vector": [0, -1, 1]
},
"0.5": {
"vector": [0, 0, 0]
},
"0.75": {
"vector": [0, -1, 1]
},
"1.0": {
"vector": [0, 0, 0]
}
}
},
"left_arm": {
"rotation": {
"0.0": {
"vector": [-87.5, 0, 0]
"vector": [-99.08072, -8.54808, 9.58631]
},
"0.25": {
"vector": [40, 0, 0],
"easing": "easeInOutQuad"
},
"0.5": {
"vector": [-87.5, 0, 0]
"vector": [-79.3701, -12.00365, 9.53884]
},
"0.75": {
"vector": [40, 0, 0],
"easing": "easeInOutQuad"
},
"1.0": {
"vector": [-87.5, 0, 0]
"vector": [-99.08072, -8.54808, 9.58631]
}
},
"position": {
"0.0": {
"vector": [0, 0, 0]
},
"0.25": {
"vector": [0, -1, 1]
},
"0.5": {
"vector": [0, 0, 0]
},
"0.75": {
"vector": [0, -1, 1]
},
"1.0": {
"vector": [0, 0, 0]
}
}
},
@ -281,14 +334,41 @@
"vector": [0, 0, 0]
},
"0.25": {
"vector": [7.5, 0, 0]
"vector": [30, 0, 0],
"easing": "easeInOutSine"
},
"0.5": {
"vector": [-2.5, 0, 0],
"easing": "easeInOutSine"
},
"0.75": {
"vector": [-7.5, 0, 0]
"vector": [15, 0, 0],
"easing": "easeInOutSine"
},
"1.0": {
"vector": [0, 0, 0],
"easing": "easeInOutQuad"
"easing": "easeInOutSine"
}
},
"position": {
"0.0": {
"vector": [0, 1, 0]
},
"0.25": {
"vector": [0, 0, 0],
"easing": "easeInOutSine"
},
"0.5": {
"vector": [0, 1, 0],
"easing": "easeInOutSine"
},
"0.75": {
"vector": [0, 0, 0],
"easing": "easeInOutSine"
},
"1.0": {
"vector": [0, 1, 0],
"easing": "easeInOutSine"
}
}
},
@ -298,14 +378,41 @@
"vector": [0, 0, 0]
},
"0.25": {
"vector": [-7.5, 0, 0]
"vector": [15, 0, 0],
"easing": "easeInOutSine"
},
"0.5": {
"vector": [-5, 0, 0],
"easing": "easeInOutSine"
},
"0.75": {
"vector": [7.5, 0, 0]
"vector": [30, 0, 0],
"easing": "easeInOutSine"
},
"1.0": {
"vector": [0, 0, 0],
"easing": "easeInOutQuad"
"easing": "easeInOutSine"
}
},
"position": {
"0.0": {
"vector": [0, 1, 0]
},
"0.25": {
"vector": [0, 0, 0],
"easing": "easeInOutSine"
},
"0.5": {
"vector": [0, 1, 0],
"easing": "easeInOutSine"
},
"0.75": {
"vector": [0, 0, 0],
"easing": "easeInOutSine"
},
"1.0": {
"vector": [0, 1, 0],
"easing": "easeInOutSine"
}
}
},
@ -315,7 +422,7 @@
"vector": [-25, 0, 0]
},
"0.25": {
"vector": [23.75, 0, 0],
"vector": [22.26378, 13.08896, -10.30577],
"easing": "easeInOutQuad"
},
"0.5": {
@ -323,7 +430,7 @@
"easing": "easeInOutQuad"
},
"0.75": {
"vector": [23.75, 0, 0],
"vector": [22.26378, -13.08896, 10.30577],
"easing": "easeInOutQuad"
},
"1.0": {
@ -331,21 +438,57 @@
"easing": "easeInOutQuad"
}
},
"scale": {
"position": {
"0.0": {
"vector": [1, 0.9, 1]
"vector": [-1, -1, -2]
},
"0.25": {
"vector": [1, 1.2, 1]
"vector": [0, 2, 2]
},
"0.5": {
"vector": [1, 0.9, 1]
"vector": [1, -1, -2]
},
"0.75": {
"vector": [1, 1.2, 1]
"vector": [0, 2, 2]
},
"1.0": {
"vector": [1, 0.9, 1]
"vector": [-1, -1, -2]
}
},
"scale": {
"0.0": {
"vector": [1, 0.8, 1]
},
"0.25": {
"vector": [1, 1.5, 1]
},
"0.5": {
"vector": [1, 0.8, 1]
},
"0.75": {
"vector": [1, 1.5, 1]
},
"1.0": {
"vector": [1, 0.8, 1]
}
}
},
"body": {
"scale": {
"0.0": {
"vector": [1, 1, 1]
},
"0.25": {
"vector": [1, 1, 1.3]
},
"0.5": {
"vector": [1, 1, 1]
},
"0.75": {
"vector": [1, 1, 1.3]
},
"1.0": {
"vector": [1, 1, 1]
}
}
}
@ -365,13 +508,13 @@
"vector": [20, 0, 0]
},
"0.3333": {
"vector": [-5, 0, 0]
"vector": [-12.5, 0, 0]
},
"0.5": {
"vector": [0, 0, 0]
},
"0.625": {
"vector": [0, 0, 0]
"vector": [-4, 0, 0]
},
"0.9167": {
"vector": [-90, 0, 0]
@ -412,10 +555,10 @@
"0.0": {
"vector": [0, 0, 0]
},
"0.0417": {
"vector": [14.68, 0, 0]
"0.125": {
"vector": [24.18, 0, 0]
},
"0.25": {
"0.375": {
"vector": [-24.08, 0, 0]
},
"0.5833": {
@ -468,16 +611,19 @@
"vector": [0, 0, 0]
},
"0.125": {
"vector": [-43.53258, 7.38792, 6.20286]
"vector": [-71.03258, 7.38792, 6.20286]
},
"0.3333": {
"vector": [3.50376, 3.04724, 4.61734]
},
"0.4583": {
"vector": [14.03, -0.88, 8.87]
},
"0.5833": {
"vector": [-1.44928, -4.8074, 13.12453]
},
"0.75": {
"vector": [32.62545, -2.1376, 7.69704]
"vector": [-17.37455, -2.1376, 7.69704]
},
"1.0": {
"vector": [-12.58296, -3.26661, 9.89396]
@ -563,16 +709,19 @@
"vector": [0, 0, 0]
},
"0.125": {
"vector": [-49.75742, -5.73853, -9.00377]
"vector": [-77.25742, -5.73853, -9.00377]
},
"0.3333": {
"vector": [0, 0, -7.5]
},
"0.4583": {
"vector": [15, 0, -7.5]
},
"0.5833": {
"vector": [2, 0, -7.5]
},
"0.75": {
"vector": [32.5, 0, -7.5]
"vector": [-47.5, 0, -7.5]
},
"1.0": {
"vector": [-11.65587, -0.50539, -9.94842]

View file

@ -5,7 +5,7 @@
"recoil_x": 0.0025,
"recoil_y": 0.012,
"damage": 8.5,
"headshot": 1.75,
"headshot": 2,
"velocity": 35,
"mag": 30,
"projectile_amount": 1,

View file

@ -4,8 +4,8 @@
"dev": 5,
"recoil_x": 0.004,
"recoil_y": 0.015,
"damage": 11,
"headshot": 1.75,
"damage": 9.5,
"headshot": 2,
"velocity": 36.5,
"mag": 20,
"projectile_amount": 1,

View file

@ -7,7 +7,7 @@
"item": "target:special_material_pack"
},
"addition": {
"item": "target:soul_steel_ingot"
"item": "minecraft:bow"
},
"result": {
"item": "target:bocek"