优化迫击炮角度代码,添加护甲防弹属性
This commit is contained in:
parent
4b5dc7ce64
commit
14bae3e12e
11 changed files with 83 additions and 114 deletions
|
@ -8,7 +8,7 @@ import software.bernie.geckolib.model.GeoModel;
|
||||||
public class LightSaberItemModel extends GeoModel<LightSaber> {
|
public class LightSaberItemModel extends GeoModel<LightSaber> {
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getAnimationResource(LightSaber animatable) {
|
public ResourceLocation getAnimationResource(LightSaber animatable) {
|
||||||
return new ResourceLocation(ModUtils.MODID, "animations/lightsaber.animation.json");
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.mcreator.superbwarfare.entity;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.ModUtils;
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.entity.projectile.MortarShellEntity;
|
import net.mcreator.superbwarfare.entity.projectile.MortarShellEntity;
|
||||||
import net.mcreator.superbwarfare.init.ModAttributes;
|
|
||||||
import net.mcreator.superbwarfare.init.ModEntities;
|
import net.mcreator.superbwarfare.init.ModEntities;
|
||||||
import net.mcreator.superbwarfare.init.ModItems;
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
import net.mcreator.superbwarfare.init.ModSounds;
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
|
@ -46,6 +45,7 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEntity {
|
public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEntity {
|
||||||
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(MortarEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(MortarEntity.class, EntityDataSerializers.STRING);
|
||||||
public static final EntityDataAccessor<Integer> FIRE_TIME = SynchedEntityData.defineId(MortarEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> FIRE_TIME = SynchedEntityData.defineId(MortarEntity.class, EntityDataSerializers.INT);
|
||||||
|
public static final EntityDataAccessor<Float> PITCH = SynchedEntityData.defineId(MortarEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
public String animationProcedure = "empty";
|
public String animationProcedure = "empty";
|
||||||
|
@ -67,6 +67,7 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
super.defineSynchedData();
|
super.defineSynchedData();
|
||||||
this.entityData.define(ANIMATION, "undefined");
|
this.entityData.define(ANIMATION, "undefined");
|
||||||
this.entityData.define(FIRE_TIME, 0);
|
this.entityData.define(FIRE_TIME, 0);
|
||||||
|
this.entityData.define(PITCH, 70f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -137,6 +138,7 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
public void addAdditionalSaveData(CompoundTag compound) {
|
public void addAdditionalSaveData(CompoundTag compound) {
|
||||||
super.addAdditionalSaveData(compound);
|
super.addAdditionalSaveData(compound);
|
||||||
compound.putInt("FireTime", this.entityData.get(FIRE_TIME));
|
compound.putInt("FireTime", this.entityData.get(FIRE_TIME));
|
||||||
|
compound.putFloat("Pitch", this.entityData.get(PITCH));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -145,6 +147,9 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
if (compound.contains("FireTime")) {
|
if (compound.contains("FireTime")) {
|
||||||
this.entityData.set(FIRE_TIME, compound.getInt("FireTime"));
|
this.entityData.set(FIRE_TIME, compound.getInt("FireTime"));
|
||||||
}
|
}
|
||||||
|
if (compound.contains("Pitch")) {
|
||||||
|
this.entityData.set(PITCH, compound.getFloat("Pitch"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -201,7 +206,7 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 dir) {
|
public void travel(Vec3 dir) {
|
||||||
this.setXRot(-Mth.clamp((float) this.getAttribute(ModAttributes.MORTAR_PITCH.get()).getBaseValue(), 20, 89));
|
this.setXRot(-Mth.clamp((float) entityData.get(PITCH), 20, 89));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -251,19 +256,6 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
return PlayState.STOP;
|
return PlayState.STOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState procedurePredicate(AnimationState<MortarEntity> 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
|
@Override
|
||||||
protected void tickDeath() {
|
protected void tickDeath() {
|
||||||
++this.deathTime;
|
++this.deathTime;
|
||||||
|
@ -303,7 +295,6 @@ public class MortarEntity extends LivingEntity implements GeoEntity, AnimatedEnt
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
|
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
|
||||||
data.add(new AnimationController<>(this, "procedure", 0, this::procedurePredicate));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,6 +16,7 @@ import net.minecraft.network.protocol.game.ClientboundStopSoundPacket;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraft.sounds.SoundSource;
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.damagesource.DamageType;
|
import net.minecraft.world.damagesource.DamageType;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
|
@ -62,6 +63,7 @@ public class LivingEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
double damage = amount;
|
double damage = amount;
|
||||||
|
|
||||||
ItemStack stack = sourceentity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
ItemStack stack = sourceentity instanceof LivingEntity living ? living.getMainHandItem() : ItemStack.EMPTY;
|
||||||
|
|
||||||
if ((damageSource.is(ModDamageTypes.PROJECTILE_BOOM)
|
if ((damageSource.is(ModDamageTypes.PROJECTILE_BOOM)
|
||||||
|
@ -86,10 +88,23 @@ public class LivingEventHandler {
|
||||||
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) || stack.getItem() == ModItems.BOCEK.get()) {
|
} else if (stack.is(ModTags.Items.USE_RIFLE_AMMO) || stack.getItem() == ModItems.BOCEK.get()) {
|
||||||
damage = reduceDamageByDistance(amount, distance, 0.0025, 150);
|
damage = reduceDamageByDistance(amount, distance, 0.0025, 150);
|
||||||
}
|
}
|
||||||
event.setAmount((float) damage);
|
|
||||||
stack.getOrCreateTag().putDouble("damagetotal", stack.getOrCreateTag().getDouble("damagetotal") + damage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO 添加TACZ枪械非穿甲伤害的适配
|
||||||
|
|
||||||
|
if (damageSource.is(ModDamageTypes.GUN_FIRE)
|
||||||
|
|| damageSource.is(ModDamageTypes.GUN_FIRE_HEADSHOT)
|
||||||
|
|| damageSource.is(DamageTypes.ARROW)
|
||||||
|
|| damageSource.is(DamageTypes.TRIDENT)
|
||||||
|
|| damageSource.is(DamageTypes.THROWN)
|
||||||
|
) {
|
||||||
|
damage = damage * (1 - Mth.clamp(entity.getAttributeValue(ModAttributes.BULLET_RESISTANCE.get()), 0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setAmount((float) damage);
|
||||||
|
|
||||||
|
stack.getOrCreateTag().putDouble("damagetotal", stack.getOrCreateTag().getDouble("damagetotal") + damage);
|
||||||
|
|
||||||
if (entity instanceof TargetEntity && sourceentity instanceof Player player) {
|
if (entity instanceof TargetEntity && sourceentity instanceof Player player) {
|
||||||
player.displayClientMessage(Component.literal("Damage:" + new java.text.DecimalFormat("##.#").format(damage) + " Distance:" + new java.text.DecimalFormat("##.#").format((entity.position()).distanceTo((sourceentity.position()))) + "M"), false);
|
player.displayClientMessage(Component.literal("Damage:" + new java.text.DecimalFormat("##.#").format(damage) + " Distance:" + new java.text.DecimalFormat("##.#").format((entity.position()).distanceTo((sourceentity.position()))) + "M"), false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package net.mcreator.superbwarfare.init;
|
package net.mcreator.superbwarfare.init;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.ModUtils;
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
|
import net.minecraft.world.entity.ai.attributes.RangedAttribute;
|
||||||
import net.minecraftforge.event.entity.EntityAttributeModificationEvent;
|
import net.minecraftforge.event.entity.EntityAttributeModificationEvent;
|
||||||
|
@ -12,11 +15,13 @@ import net.minecraftforge.registries.DeferredRegister;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.RegistryObject;
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||||
public class ModAttributes {
|
public class ModAttributes {
|
||||||
public static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(ForgeRegistries.ATTRIBUTES, ModUtils.MODID);
|
public static final DeferredRegister<Attribute> ATTRIBUTES = DeferredRegister.create(ForgeRegistries.ATTRIBUTES, ModUtils.MODID);
|
||||||
|
|
||||||
public static final RegistryObject<Attribute> MORTAR_PITCH = ATTRIBUTES.register("mortar_pitch", () -> (new RangedAttribute("attribute." + ModUtils.MODID + ".mortar_pitch", 70, 20, 89)).setSyncable(true));
|
public static final RegistryObject<Attribute> BULLET_RESISTANCE = ATTRIBUTES.register("bullet_resistance", () -> (new RangedAttribute("attribute." + ModUtils.MODID + ".bullet_resistance", 0, 0, 1)).setSyncable(true));
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void register(FMLConstructModEvent event) {
|
public static void register(FMLConstructModEvent event) {
|
||||||
|
@ -25,6 +30,13 @@ public class ModAttributes {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void addAttributes(EntityAttributeModificationEvent event) {
|
public static void addAttributes(EntityAttributeModificationEvent event) {
|
||||||
event.add(ModEntities.MORTAR.get(), MORTAR_PITCH.get());
|
List<EntityType<? extends LivingEntity>> entityTypes = event.getTypes();
|
||||||
|
entityTypes.forEach((e) -> {
|
||||||
|
Class<? extends Entity> baseClass = e.getBaseClass();
|
||||||
|
if (baseClass.isAssignableFrom(LivingEntity.class)) {
|
||||||
|
event.add(e, BULLET_RESISTANCE.get());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,6 @@ import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
import software.bernie.geckolib.animatable.GeoItem;
|
import software.bernie.geckolib.animatable.GeoItem;
|
||||||
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;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -55,37 +51,9 @@ public class LightSaber extends SwordItem implements GeoItem, AnimatedItem {
|
||||||
transformType = type;
|
transformType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayState idlePredicate(AnimationState<LightSaber> event) {
|
|
||||||
if (transformType != null && transformType.firstPerson()) {
|
|
||||||
if (this.animationProcedure.equals("empty")) {
|
|
||||||
event.getController().setAnimation(RawAnimation.begin().thenLoop("animation.lightsaber.idle"));
|
|
||||||
return PlayState.CONTINUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PlayState.STOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlayState procedurePredicate(AnimationState<LightSaber> event) {
|
|
||||||
if (transformType != null && transformType.firstPerson()) {
|
|
||||||
if (!this.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 (this.animationProcedure.equals("empty")) {
|
|
||||||
return PlayState.STOP;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return PlayState.CONTINUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
var procedureController = new AnimationController<>(this, "procedureController", 0, this::procedurePredicate);
|
|
||||||
data.add(procedureController);
|
|
||||||
var idleController = new AnimationController<>(this, "idleController", 0, this::idlePredicate);
|
|
||||||
data.add(idleController);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
package net.mcreator.superbwarfare.item.armor;
|
package net.mcreator.superbwarfare.item.armor;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.client.renderer.armor.RuChest6b43ArmorRenderer;
|
import net.mcreator.superbwarfare.client.renderer.armor.RuChest6b43ArmorRenderer;
|
||||||
|
import net.mcreator.superbwarfare.init.ModAttributes;
|
||||||
import net.mcreator.superbwarfare.tiers.ModArmorMaterial;
|
import net.mcreator.superbwarfare.tiers.ModArmorMaterial;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.item.ArmorItem;
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -14,6 +20,7 @@ import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class RuChest6b43 extends ArmorItem implements GeoItem {
|
public class RuChest6b43 extends ArmorItem implements GeoItem {
|
||||||
|
@ -37,6 +44,18 @@ public class RuChest6b43 extends ArmorItem implements GeoItem {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot equipmentSlot) {
|
||||||
|
Multimap<Attribute, AttributeModifier> map = super.getDefaultAttributeModifiers(equipmentSlot);
|
||||||
|
UUID uuid = new UUID(equipmentSlot.toString().hashCode(), 0);
|
||||||
|
if (equipmentSlot == EquipmentSlot.CHEST) {
|
||||||
|
map = HashMultimap.create(map);
|
||||||
|
map.put(ModAttributes.BULLET_RESISTANCE.get(), new AttributeModifier(uuid, ModUtils.ATTRIBUTE_MODIFIER, 0.5f, AttributeModifier.Operation.ADDITION));
|
||||||
|
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,16 @@
|
||||||
package net.mcreator.superbwarfare.item.armor;
|
package net.mcreator.superbwarfare.item.armor;
|
||||||
|
|
||||||
|
import com.google.common.collect.HashMultimap;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.client.renderer.armor.RuHelmet6b47ArmorRenderer;
|
import net.mcreator.superbwarfare.client.renderer.armor.RuHelmet6b47ArmorRenderer;
|
||||||
|
import net.mcreator.superbwarfare.init.ModAttributes;
|
||||||
import net.mcreator.superbwarfare.tiers.ModArmorMaterial;
|
import net.mcreator.superbwarfare.tiers.ModArmorMaterial;
|
||||||
import net.minecraft.client.model.HumanoidModel;
|
import net.minecraft.client.model.HumanoidModel;
|
||||||
import net.minecraft.world.entity.EquipmentSlot;
|
import net.minecraft.world.entity.EquipmentSlot;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.world.item.ArmorItem;
|
import net.minecraft.world.item.ArmorItem;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
import net.minecraftforge.client.extensions.common.IClientItemExtensions;
|
||||||
|
@ -14,6 +20,7 @@ import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
import software.bernie.geckolib.renderer.GeoArmorRenderer;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class RuHelmet6b47 extends ArmorItem implements GeoItem {
|
public class RuHelmet6b47 extends ArmorItem implements GeoItem {
|
||||||
|
@ -37,6 +44,18 @@ public class RuHelmet6b47 extends ArmorItem implements GeoItem {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Multimap<Attribute, AttributeModifier> getDefaultAttributeModifiers(EquipmentSlot equipmentSlot) {
|
||||||
|
Multimap<Attribute, AttributeModifier> map = super.getDefaultAttributeModifiers(equipmentSlot);
|
||||||
|
UUID uuid = new UUID(equipmentSlot.toString().hashCode(), 0);
|
||||||
|
if (equipmentSlot == EquipmentSlot.HEAD) {
|
||||||
|
map = HashMultimap.create(map);
|
||||||
|
map.put(ModAttributes.BULLET_RESISTANCE.get(), new AttributeModifier(uuid, ModUtils.ATTRIBUTE_MODIFIER, 0.2f, AttributeModifier.Operation.ADDITION));
|
||||||
|
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.mcreator.superbwarfare.network.message;
|
package net.mcreator.superbwarfare.network.message;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.client.gui.RangeHelper;
|
import net.mcreator.superbwarfare.client.gui.RangeHelper;
|
||||||
import net.mcreator.superbwarfare.init.ModAttributes;
|
|
||||||
import net.mcreator.superbwarfare.init.ModSounds;
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
import net.mcreator.superbwarfare.tools.SoundTool;
|
import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
import net.mcreator.superbwarfare.tools.TraceTool;
|
import net.mcreator.superbwarfare.tools.TraceTool;
|
||||||
|
@ -15,6 +14,8 @@ import net.minecraftforge.network.NetworkEvent;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import static net.mcreator.superbwarfare.entity.MortarEntity.PITCH;
|
||||||
|
|
||||||
public class AdjustMortarAngleMessage {
|
public class AdjustMortarAngleMessage {
|
||||||
private final double scroll;
|
private final double scroll;
|
||||||
|
|
||||||
|
@ -43,8 +44,8 @@ public class AdjustMortarAngleMessage {
|
||||||
double angle = 0;
|
double angle = 0;
|
||||||
|
|
||||||
if (looking instanceof LivingEntity living){
|
if (looking instanceof LivingEntity living){
|
||||||
living.getAttribute(ModAttributes.MORTAR_PITCH.get()).setBaseValue(Mth.clamp(living.getAttribute(ModAttributes.MORTAR_PITCH.get()).getBaseValue() + 0.5 * message.scroll,20,89));
|
living.getEntityData().set(PITCH, (float)Mth.clamp(living.getEntityData().get(PITCH) + 0.5 * message.scroll,20,89));
|
||||||
angle = living.getAttribute(ModAttributes.MORTAR_PITCH.get()).getBaseValue();
|
angle = living.getEntityData().get(PITCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
player.displayClientMessage(Component.literal("Angle:" + new java.text.DecimalFormat("##.##").format(angle) + " Range:" + new java.text.DecimalFormat("##.#").format((int) RangeHelper.getRange(angle)) + "M"), true);
|
player.displayClientMessage(Component.literal("Angle:" + new java.text.DecimalFormat("##.##").format(angle) + " Range:" + new java.text.DecimalFormat("##.#").format((int) RangeHelper.getRange(angle)) + "M"), true);
|
||||||
|
|
|
@ -1,56 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.8.0",
|
|
||||||
"animations": {
|
|
||||||
"animation.lightsaber.idle": {
|
|
||||||
"loop": true,
|
|
||||||
"animation_length": 4,
|
|
||||||
"bones": {
|
|
||||||
"group2": {
|
|
||||||
"position": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"light": {
|
|
||||||
"rotation": {
|
|
||||||
"0.0": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
},
|
|
||||||
"4.0": {
|
|
||||||
"vector": [0, -360, 0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"position": {
|
|
||||||
"0.0": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
},
|
|
||||||
"4.0": {
|
|
||||||
"vector": [0, 0, 0]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"scale": {
|
|
||||||
"0.0": {
|
|
||||||
"vector": [1, 1, 1]
|
|
||||||
},
|
|
||||||
"1.0": {
|
|
||||||
"vector": [1, 1, 0.95],
|
|
||||||
"easing": "easeInSine"
|
|
||||||
},
|
|
||||||
"2.0": {
|
|
||||||
"vector": [1, 1, 1],
|
|
||||||
"easing": "easeOutSine"
|
|
||||||
},
|
|
||||||
"3.0": {
|
|
||||||
"vector": [0.95, 1, 1],
|
|
||||||
"easing": "easeInSine"
|
|
||||||
},
|
|
||||||
"4.0": {
|
|
||||||
"vector": [1, 1, 1],
|
|
||||||
"easing": "easeOutSine"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"geckolib_format_version": 2
|
|
||||||
}
|
|
|
@ -165,7 +165,7 @@
|
||||||
"des.superbwarfare.transcript.distance": "Distance: ",
|
"des.superbwarfare.transcript.distance": "Distance: ",
|
||||||
"des.superbwarfare.transcript.total": "Total: ",
|
"des.superbwarfare.transcript.total": "Total: ",
|
||||||
|
|
||||||
"attribute.superbwarfare.spread": "Spread",
|
"attribute.superbwarfare.bullet_resistance": "Bullet Resistance",
|
||||||
|
|
||||||
"block.superbwarfare.jump_pad": "Jump Pad",
|
"block.superbwarfare.jump_pad": "Jump Pad",
|
||||||
"block.superbwarfare.sandbag": "Sandbag",
|
"block.superbwarfare.sandbag": "Sandbag",
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
"des.superbwarfare.transcript.distance": "距离:",
|
"des.superbwarfare.transcript.distance": "距离:",
|
||||||
"des.superbwarfare.transcript.total": "总环数:",
|
"des.superbwarfare.transcript.total": "总环数:",
|
||||||
|
|
||||||
"attribute.superbwarfare.spread": "散布",
|
"attribute.superbwarfare.bullet_resistance": "子弹防护",
|
||||||
|
|
||||||
"block.superbwarfare.jump_pad": "弹射台",
|
"block.superbwarfare.jump_pad": "弹射台",
|
||||||
"block.superbwarfare.sandbag": "沙袋",
|
"block.superbwarfare.sandbag": "沙袋",
|
||||||
|
|
Loading…
Add table
Reference in a new issue