优化
This commit is contained in:
parent
b0a80221b2
commit
045745cc0f
11 changed files with 112 additions and 171 deletions
|
@ -3,7 +3,6 @@ package net.mcreator.superbwarfare.entity;
|
||||||
import net.mcreator.superbwarfare.entity.projectile.CannonShellEntity;
|
import net.mcreator.superbwarfare.entity.projectile.CannonShellEntity;
|
||||||
import net.mcreator.superbwarfare.init.*;
|
import net.mcreator.superbwarfare.init.*;
|
||||||
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
|
||||||
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
||||||
import net.mcreator.superbwarfare.tools.ParticleTool;
|
import net.mcreator.superbwarfare.tools.ParticleTool;
|
||||||
import net.mcreator.superbwarfare.tools.SoundTool;
|
import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
|
@ -354,23 +353,15 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity, ICannonEntit
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState movementPredicate(AnimationState<Mk42Entity> event) {
|
private PlayState movementPredicate(AnimationState<Mk42Entity> event) {
|
||||||
if (this.animationprocedure.equals("empty")) {
|
if (this.entityData.get(COOL_DOWN) > 0) {
|
||||||
|
if (this.entityData.get(TYPE) == 1) {
|
||||||
if (this.getFirstPassenger() != null) {
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire"));
|
||||||
Entity gunner = this.getFirstPassenger();
|
} else {
|
||||||
var capability = gunner.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null);
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire2"));
|
||||||
if (this.entityData.get(COOL_DOWN) > 0) {
|
|
||||||
if (this.entityData.get(TYPE) == 1) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire"));
|
|
||||||
} else {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire2"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mk42.idle"));
|
|
||||||
}
|
}
|
||||||
return PlayState.STOP;
|
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mk42.idle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,7 +4,6 @@ import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.entity.projectile.CannonShellEntity;
|
import net.mcreator.superbwarfare.entity.projectile.CannonShellEntity;
|
||||||
import net.mcreator.superbwarfare.init.*;
|
import net.mcreator.superbwarfare.init.*;
|
||||||
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
|
||||||
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
||||||
import net.mcreator.superbwarfare.tools.ParticleTool;
|
import net.mcreator.superbwarfare.tools.ParticleTool;
|
||||||
import net.mcreator.superbwarfare.tools.SoundTool;
|
import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
|
@ -430,23 +429,14 @@ public class Mle1934Entity extends PathfinderMob implements GeoEntity, ICannonEn
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState movementPredicate(AnimationState<Mle1934Entity> event) {
|
private PlayState movementPredicate(AnimationState<Mle1934Entity> event) {
|
||||||
if (this.animationprocedure.equals("empty")) {
|
if (this.entityData.get(COOL_DOWN) > 64) {
|
||||||
|
if (this.entityData.get(TYPE) == 1) {
|
||||||
if (this.getFirstPassenger() != null) {
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mle1934.salvo_fire"));
|
||||||
Entity gunner = this.getFirstPassenger();
|
} else {
|
||||||
var capability = gunner.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null);
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mle1934.fire"));
|
||||||
if (this.entityData.get(COOL_DOWN) > 64) {
|
|
||||||
if (this.entityData.get(TYPE) == 1) {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mle1934.salvo_fire"));
|
|
||||||
} else {
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mle1934.fire"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mle1934.idle"));
|
|
||||||
}
|
}
|
||||||
return PlayState.STOP;
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mle1934.idle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,13 +8,11 @@ import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
import net.minecraft.commands.arguments.EntityAnchorArgument;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
import net.minecraft.network.syncher.SynchedEntityData;
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
|
@ -34,11 +32,14 @@ import net.minecraftforge.network.PlayMessages;
|
||||||
import software.bernie.geckolib.animatable.GeoEntity;
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
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 software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber
|
@Mod.EventBusSubscriber
|
||||||
public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEntity {
|
public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEntity {
|
||||||
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(TargetEntity.class, EntityDataSerializers.STRING);
|
|
||||||
public static final EntityDataAccessor<Integer> DOWN_TIME = SynchedEntityData.defineId(TargetEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> DOWN_TIME = SynchedEntityData.defineId(TargetEntity.class, EntityDataSerializers.INT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
@ -55,7 +56,6 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
@Override
|
@Override
|
||||||
protected void defineSynchedData() {
|
protected void defineSynchedData() {
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
this.entityData.define(ANIMATION, "undefined");
|
|
||||||
this.entityData.define(DOWN_TIME, 0);
|
this.entityData.define(DOWN_TIME, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,27 +107,13 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.level().isClientSide()) {
|
if (!this.level().isClientSide()) {
|
||||||
this.level().playSound(null, BlockPos.containing(this.getX(), this.getY(), this.getZ()), ModSounds.HIT.get(), SoundSource.BLOCKS, 8, 1);
|
this.level().playSound(null, BlockPos.containing(this.getX(), this.getY(), this.getZ()), ModSounds.HIT.get(), SoundSource.BLOCKS, 3, 1);
|
||||||
} else {
|
} else {
|
||||||
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), ModSounds.HIT.get(), SoundSource.BLOCKS, 8, 1, false);
|
this.level().playLocalSound(this.getX(), this.getY(), this.getZ(), ModSounds.HIT.get(), SoundSource.BLOCKS, 3, 1, false);
|
||||||
}
|
}
|
||||||
return super.hurt(source, amount);
|
return super.hurt(source, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
@SubscribeEvent
|
||||||
public static void onTargetDown(LivingDeathEvent event) {
|
public static void onTargetDown(LivingDeathEvent event) {
|
||||||
var entity = event.getEntity();
|
var entity = event.getEntity();
|
||||||
|
@ -143,8 +129,8 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
|
|
||||||
if (sourceEntity instanceof Player player) {
|
if (sourceEntity instanceof Player player) {
|
||||||
player.displayClientMessage(Component.literal(("Target Down " + new java.text.DecimalFormat("##.#").format((entity.position()).distanceTo((sourceEntity.position()))) + "M")), true);
|
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);
|
SoundTool.playLocalSound(player, ModSounds.TARGET_DOWN.get(), 1, 1);
|
||||||
targetEntity.entityData.set(DOWN_TIME, 91);
|
targetEntity.entityData.set(DOWN_TIME, 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,14 +153,8 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
} else {
|
} else {
|
||||||
if (!(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
if (!(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
||||||
this.lookAt(EntityAnchorArgument.Anchor.EYES, new Vec3((player.getX()), this.getY(), (player.getZ())));
|
this.lookAt(EntityAnchorArgument.Anchor.EYES, new Vec3((player.getX()), this.getY(), (player.getZ())));
|
||||||
|
|
||||||
this.setYRot(this.getYRot());
|
|
||||||
this.setXRot(0);
|
this.setXRot(0);
|
||||||
this.setYBodyRot(this.getYRot());
|
|
||||||
this.setYHeadRot(this.getYRot());
|
|
||||||
this.yRotO = this.getYRot();
|
|
||||||
this.xRotO = this.getXRot();
|
this.xRotO = this.getXRot();
|
||||||
|
|
||||||
this.entityData.set(DOWN_TIME, 0);
|
this.entityData.set(DOWN_TIME, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -190,11 +170,6 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void travel(Vec3 dir) {
|
|
||||||
this.setXRot(-Mth.clamp(this.entityData.get(DOWN_TIME), 0, 90));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getDeltaMovement() {
|
public Vec3 getDeltaMovement() {
|
||||||
return new Vec3(0, 0, 0);
|
return new Vec3(0, 0, 0);
|
||||||
|
@ -251,20 +226,26 @@ public class TargetEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSyncedAnimation() {
|
public String getSyncedAnimation() {
|
||||||
return this.entityData.get(ANIMATION);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnimation(String animation) {
|
public void setAnimation(String animation) {
|
||||||
this.entityData.set(ANIMATION, animation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setAnimationProcedure(String procedure) {
|
public void setAnimationProcedure(String procedure) {
|
||||||
this.animationProcedure = procedure;
|
}
|
||||||
|
|
||||||
|
private PlayState movementPredicate(AnimationState<TargetEntity> event) {
|
||||||
|
if (this.entityData.get(DOWN_TIME) > 0) {
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.target.down"));
|
||||||
|
}
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.target.idle"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
|
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,12 +3,7 @@ package net.mcreator.superbwarfare.entity.model;
|
||||||
import net.mcreator.superbwarfare.ModUtils;
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.entity.TargetEntity;
|
import net.mcreator.superbwarfare.entity.TargetEntity;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
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.GeoModel;
|
||||||
import software.bernie.geckolib.model.data.EntityModelData;
|
|
||||||
|
|
||||||
public class TargetModel extends GeoModel<TargetEntity> {
|
public class TargetModel extends GeoModel<TargetEntity> {
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,15 +20,4 @@ public class TargetModel extends GeoModel<TargetEntity> {
|
||||||
public ResourceLocation getTextureResource(TargetEntity entity) {
|
public ResourceLocation getTextureResource(TargetEntity entity) {
|
||||||
return new ResourceLocation(ModUtils.MODID, "textures/entity/target.png");
|
return new ResourceLocation(ModUtils.MODID, "textures/entity/target.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCustomAnimations(TargetEntity animatable, long instanceId, AnimationState animationState) {
|
|
||||||
CoreGeoBone head = getAnimationProcessor().getBone("ba");
|
|
||||||
EntityModelData entityData = (EntityModelData) animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
|
||||||
if (entityData.headPitch() > 10) {
|
|
||||||
head.setRotX(Mth.clamp(Mth.clamp(90 - entityData.headPitch(),0,4) * 22.5f * Mth.DEG_TO_RAD,0,90));
|
|
||||||
} else {
|
|
||||||
head.setRotX(Mth.clamp(9f * entityData.headPitch() * Mth.DEG_TO_RAD,0,90));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
||||||
if (!this.beast) {
|
if (!this.beast) {
|
||||||
this.bypassArmorRate -= 0.2F;
|
this.bypassArmorRate -= 0.2F;
|
||||||
if (this.bypassArmorRate < 0.8F) {
|
if (this.bypassArmorRate < 0.8F) {
|
||||||
break;
|
if (result != null && !(((EntityHitResult) result).getEntity() instanceof TargetEntity target && target.getEntityData().get(DOWN_TIME) > 0)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -282,7 +282,7 @@ public class ClientEventHandler {
|
||||||
if (level != null && entity instanceof LivingEntity living && living.getMainHandItem().is(ModTags.Items.GUN)) {
|
if (level != null && entity instanceof LivingEntity living && living.getMainHandItem().is(ModTags.Items.GUN)) {
|
||||||
handleWeaponSway(living);
|
handleWeaponSway(living);
|
||||||
handleWeaponMove(living);
|
handleWeaponMove(living);
|
||||||
handleWeaponZoom();
|
handleWeaponZoom(living);
|
||||||
handlePlayerBreath(living);
|
handlePlayerBreath(living);
|
||||||
handleWeaponFire(event, living);
|
handleWeaponFire(event, living);
|
||||||
handleGunRecoil();
|
handleGunRecoil();
|
||||||
|
@ -453,9 +453,10 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleWeaponZoom() {
|
private static void handleWeaponZoom(LivingEntity entity) {
|
||||||
|
if (!(entity instanceof Player player)) return;
|
||||||
float times = 5 * Minecraft.getInstance().getDeltaFrameTime();
|
float times = 5 * Minecraft.getInstance().getDeltaFrameTime();
|
||||||
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS && !notInGame()) {
|
if (GLFW.glfwGetMouseButton(Minecraft.getInstance().getWindow().getWindow(), GLFW.GLFW_MOUSE_BUTTON_RIGHT) == GLFW.GLFW_PRESS && !notInGame() && !player.getCooldowns().isOnCooldown(player.getMainHandItem().getItem())) {
|
||||||
zoomTime = Mth.clamp(zoomTime + 0.03 * times, 0, 1);
|
zoomTime = Mth.clamp(zoomTime + 0.03 * times, 0, 1);
|
||||||
} else {
|
} else {
|
||||||
zoomTime = Mth.clamp(zoomTime - 0.04 * times, 0, 1);
|
zoomTime = Mth.clamp(zoomTime - 0.04 * times, 0, 1);
|
||||||
|
|
|
@ -286,17 +286,22 @@ public class LivingEventHandler {
|
||||||
oldTags.putBoolean("is_empty_reloading", false);
|
oldTags.putBoolean("is_empty_reloading", false);
|
||||||
oldTags.putInt("gun_reloading_time", 0);
|
oldTags.putInt("gun_reloading_time", 0);
|
||||||
|
|
||||||
oldTags.putBoolean("force_stop", false);
|
if (oldTags.getDouble("iterative_time") != 0) {
|
||||||
oldTags.putBoolean("stop", false);
|
oldTags.putBoolean("force_stop", false);
|
||||||
oldTags.putInt("reload_stage", 0);
|
oldTags.putBoolean("stop", false);
|
||||||
oldTags.putBoolean("reloading", false);
|
oldTags.putInt("reload_stage", 0);
|
||||||
oldTags.putDouble("prepare", 0);
|
oldTags.putBoolean("reloading", false);
|
||||||
oldTags.putDouble("prepare_load", 0);
|
oldTags.putDouble("prepare", 0);
|
||||||
oldTags.putDouble("iterative", 0);
|
oldTags.putDouble("prepare_load", 0);
|
||||||
oldTags.putDouble("finish", 0);
|
oldTags.putDouble("iterative", 0);
|
||||||
|
oldTags.putDouble("finish", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldStack.is(ModItems.SENTINEL.get())) {
|
||||||
|
oldTags.putBoolean("sentinel_is_charging", false);
|
||||||
|
oldTags.putInt("sentinel_charge_time", 0);
|
||||||
|
}
|
||||||
|
|
||||||
oldTags.putBoolean("sentinel_is_charging", false);
|
|
||||||
oldTags.putInt("sentinel_charge_time", 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newStack.getItem() instanceof GunItem) {
|
if (newStack.getItem() instanceof GunItem) {
|
||||||
|
@ -308,17 +313,21 @@ public class LivingEventHandler {
|
||||||
newStack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
newStack.getOrCreateTag().putBoolean("is_empty_reloading", false);
|
||||||
newStack.getOrCreateTag().putInt("gun_reloading_time", 0);
|
newStack.getOrCreateTag().putInt("gun_reloading_time", 0);
|
||||||
|
|
||||||
newStack.getOrCreateTag().putBoolean("force_stop", false);
|
if (newStack.getOrCreateTag().getDouble("iterative_time") != 0) {
|
||||||
newStack.getOrCreateTag().putBoolean("stop", false);
|
newStack.getOrCreateTag().putBoolean("force_stop", false);
|
||||||
newStack.getOrCreateTag().putInt("reload_stage", 0);
|
newStack.getOrCreateTag().putBoolean("stop", false);
|
||||||
newStack.getOrCreateTag().putBoolean("reloading", false);
|
newStack.getOrCreateTag().putInt("reload_stage", 0);
|
||||||
newStack.getOrCreateTag().putDouble("prepare", 0);
|
newStack.getOrCreateTag().putBoolean("reloading", false);
|
||||||
newStack.getOrCreateTag().putDouble("prepare_load", 0);
|
newStack.getOrCreateTag().putDouble("prepare", 0);
|
||||||
newStack.getOrCreateTag().putDouble("iterative", 0);
|
newStack.getOrCreateTag().putDouble("prepare_load", 0);
|
||||||
newStack.getOrCreateTag().putDouble("finish", 0);
|
newStack.getOrCreateTag().putDouble("iterative", 0);
|
||||||
|
newStack.getOrCreateTag().putDouble("finish", 0);
|
||||||
|
}
|
||||||
|
|
||||||
newStack.getOrCreateTag().putBoolean("sentinel_is_charging", false);
|
if (newStack.is(ModItems.SENTINEL.get())) {
|
||||||
newStack.getOrCreateTag().putInt("sentinel_charge_time", 0);
|
newStack.getOrCreateTag().putBoolean("sentinel_is_charging", false);
|
||||||
|
newStack.getOrCreateTag().putInt("sentinel_charge_time", 0);
|
||||||
|
}
|
||||||
|
|
||||||
int level = PerkHelper.getItemPerkLevel(ModPerks.KILLING_TALLY.get(), newStack);
|
int level = PerkHelper.getItemPerkLevel(ModPerks.KILLING_TALLY.get(), newStack);
|
||||||
if (level != 0) {
|
if (level != 0) {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
import net.mcreator.superbwarfare.init.ModTags;
|
import net.mcreator.superbwarfare.init.ModTags;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
import net.mcreator.superbwarfare.network.message.SimulationDistanceMessage;
|
import net.mcreator.superbwarfare.network.message.SimulationDistanceMessage;
|
||||||
import net.mcreator.superbwarfare.tools.ItemNBTTool;
|
|
||||||
import net.mcreator.superbwarfare.tools.SoundTool;
|
import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -16,13 +15,11 @@ import net.minecraft.sounds.SoundSource;
|
||||||
import net.minecraft.util.Mth;
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.effect.MobEffectInstance;
|
import net.minecraft.world.effect.MobEffectInstance;
|
||||||
import net.minecraft.world.effect.MobEffects;
|
import net.minecraft.world.effect.MobEffects;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.event.AnvilUpdateEvent;
|
import net.minecraftforge.event.AnvilUpdateEvent;
|
||||||
import net.minecraftforge.event.TickEvent;
|
import net.minecraftforge.event.TickEvent;
|
||||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
@ -66,14 +63,6 @@ public class PlayerEventHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public static void onPickup(EntityItemPickupEvent event) {
|
|
||||||
ItemEntity stack = event.getItem();
|
|
||||||
if (stack.getItem().is(ModTags.Items.GUN)) {
|
|
||||||
ItemNBTTool.setBoolean(stack.getItem(), "init", false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
public static void onPlayerTick(TickEvent.PlayerTickEvent event) {
|
||||||
Player player = event.player;
|
Player player = event.player;
|
||||||
|
|
|
@ -90,7 +90,7 @@ public abstract class GunItem extends Item {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEntitySwing(ItemStack stack, LivingEntity entity) {
|
public boolean onEntitySwing(ItemStack stack, LivingEntity entity) {
|
||||||
return super.onEntitySwing(stack, entity);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -124,6 +124,7 @@ public abstract class GunItem extends Item {
|
||||||
public static void onPickup(EntityItemPickupEvent event) {
|
public static void onPickup(EntityItemPickupEvent event) {
|
||||||
if (event.getItem().getItem().is(ModTags.Items.GUN)) {
|
if (event.getItem().getItem().is(ModTags.Items.GUN)) {
|
||||||
event.getItem().getItem().getOrCreateTag().putBoolean("draw", true);
|
event.getItem().getItem().getOrCreateTag().putBoolean("draw", true);
|
||||||
|
event.getItem().getItem().getOrCreateTag().putBoolean("init", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,50 @@
|
||||||
{
|
{
|
||||||
"format_version": "1.8.0",
|
"format_version": "1.8.0",
|
||||||
"animations": {
|
"animations": {
|
||||||
"animation.superbwarfare.idle": {
|
"animation.target.idle": {
|
||||||
"loop": true,
|
"loop": true,
|
||||||
"animation_length": 0.04167
|
"animation_length": 0.0417
|
||||||
|
},
|
||||||
|
"animation.target.down": {
|
||||||
|
"loop": "hold_on_last_frame",
|
||||||
|
"animation_length": 2,
|
||||||
|
"bones": {
|
||||||
|
"ba": {
|
||||||
|
"rotation": {
|
||||||
|
"0.0": {
|
||||||
|
"vector": [0, 0, 0]
|
||||||
|
},
|
||||||
|
"0.125": {
|
||||||
|
"vector": [-90, 0, 0],
|
||||||
|
"easing": "easeOutCubic"
|
||||||
|
},
|
||||||
|
"0.25": {
|
||||||
|
"vector": [-80, 0, 0],
|
||||||
|
"easing": "easeOutSine"
|
||||||
|
},
|
||||||
|
"0.375": {
|
||||||
|
"vector": [-90, 0, 0],
|
||||||
|
"easing": "easeInCubic"
|
||||||
|
},
|
||||||
|
"0.5": {
|
||||||
|
"vector": [-88, 0, 0],
|
||||||
|
"easing": "easeOutSine"
|
||||||
|
},
|
||||||
|
"0.625": {
|
||||||
|
"vector": [-90, 0, 0],
|
||||||
|
"easing": "easeInCubic"
|
||||||
|
},
|
||||||
|
"1.5": {
|
||||||
|
"vector": [-90, 0, 0],
|
||||||
|
"easing": "linear"
|
||||||
|
},
|
||||||
|
"2.0": {
|
||||||
|
"vector": [0, 0, 0],
|
||||||
|
"easing": "easeInOutSine"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"geckolib_format_version": 2
|
"geckolib_format_version": 2
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.8.0",
|
|
||||||
"animations": {
|
|
||||||
"animation.target2.idle": {
|
|
||||||
"loop": true,
|
|
||||||
"bones": {
|
|
||||||
"ba": {
|
|
||||||
"rotation": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"animation.target2.down": {
|
|
||||||
"loop": "hold_on_last_frame",
|
|
||||||
"animation_length": 0.625,
|
|
||||||
"bones": {
|
|
||||||
"ba": {
|
|
||||||
"rotation": {
|
|
||||||
"0.0": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
},
|
|
||||||
"0.125": {
|
|
||||||
"vector": [-90, 0, 0],
|
|
||||||
"easing": "easeOutCubic"
|
|
||||||
},
|
|
||||||
"0.25": {
|
|
||||||
"vector": [-80, 0, 0],
|
|
||||||
"easing": "easeOutSine"
|
|
||||||
},
|
|
||||||
"0.375": {
|
|
||||||
"vector": [-90, 0, 0],
|
|
||||||
"easing": "easeInCubic"
|
|
||||||
},
|
|
||||||
"0.5": {
|
|
||||||
"vector": [-88, 0, 0],
|
|
||||||
"easing": "easeOutSine"
|
|
||||||
},
|
|
||||||
"0.625": {
|
|
||||||
"vector": [-90, 0, 0],
|
|
||||||
"easing": "easeInCubic"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"geckolib_format_version": 2
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue