修改音效文件命名

This commit is contained in:
17146 2024-07-17 19:58:24 +08:00
parent 2c4bcef205
commit b706383ac1
18 changed files with 63 additions and 92 deletions

View file

@ -1,56 +1,51 @@
package net.mcreator.target.entity; package net.mcreator.target.entity;
import net.mcreator.target.init.*; import net.mcreator.target.init.TargetModDamageTypes;
import net.mcreator.target.init.TargetModEntities;
import net.mcreator.target.init.TargetModItems;
import net.mcreator.target.init.TargetModSounds;
import net.mcreator.target.item.common.ammo.CannonShellItem; import net.mcreator.target.item.common.ammo.CannonShellItem;
import net.mcreator.target.item.common.ammo.He5Inches;
import net.mcreator.target.network.TargetModVariables; import net.mcreator.target.network.TargetModVariables;
import net.mcreator.target.tools.CustomExplosion; import net.mcreator.target.tools.CustomExplosion;
import net.mcreator.target.tools.ParticleTool; import net.mcreator.target.tools.ParticleTool;
import net.mcreator.target.tools.SoundTool; import net.mcreator.target.tools.SoundTool;
import net.minecraft.client.Minecraft;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import net.minecraft.network.syncher.SynchedEntityData;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource; import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth; 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.entity.*;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import software.bernie.geckolib.util.GeckoLibUtil;
import software.bernie.geckolib.core.object.PlayState;
import software.bernie.geckolib.core.animation.RawAnimation;
import software.bernie.geckolib.core.animation.AnimationState;
import software.bernie.geckolib.core.animation.AnimationController;
import software.bernie.geckolib.core.animation.AnimatableManager;
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animatable.GeoEntity;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.network.NetworkHooks;
import net.minecraft.world.level.Level;
import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.sounds.SoundEvent; import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.*;
import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.world.entity.player.Player;
import net.minecraft.network.protocol.game.ClientGamePacketListener; import net.minecraft.world.entity.projectile.ThrownPotion;
import net.minecraft.network.protocol.Packet; import net.minecraft.world.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PlayMessages;
import net.minecraftforge.registries.ForgeRegistries;
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;
public class Mk42Entity extends PathfinderMob implements GeoEntity { public class Mk42Entity extends PathfinderMob implements GeoEntity {
public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.BOOLEAN); public static final EntityDataAccessor<Boolean> SHOOT = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.BOOLEAN);
@ -80,6 +75,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
this.entityData.define(ANIMATION, "undefined"); this.entityData.define(ANIMATION, "undefined");
this.entityData.define(TEXTURE, "sherman"); this.entityData.define(TEXTURE, "sherman");
} }
@Override @Override
protected float getStandingEyeHeight(Pose poseIn, EntityDimensions sizeIn) { protected float getStandingEyeHeight(Pose poseIn, EntityDimensions sizeIn) {
return 2.16F; return 2.16F;
@ -110,7 +106,7 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
@Override @Override
public MobType getMobType() { public MobType getMobType() {
return MobType.UNDEFINED; return super.getMobType();
} }
@Override @Override
@ -155,17 +151,16 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
return false; return false;
if (source.is(DamageTypes.WITHER_SKULL)) if (source.is(DamageTypes.WITHER_SKULL))
return false; return false;
if (source.getDirectEntity() instanceof Player player && this.getFirstPassenger() != null && player == this.getFirstPassenger()){ if (source.getDirectEntity() instanceof Player player && this.getFirstPassenger() != null && player == this.getFirstPassenger()) {
return false; return false;
} }
if (source.getDirectEntity() instanceof Player player && this.getFirstPassenger() != null && player == this.getFirstPassenger()){ if (source.getDirectEntity() instanceof Player player && this.getFirstPassenger() != null && player == this.getFirstPassenger()) {
return false; return false;
} }
return super.hurt(source, amount); return super.hurt(source, amount);
} }
@Override @Override
public InteractionResult mobInteract(Player sourceentity, InteractionHand hand) { public InteractionResult mobInteract(Player sourceentity, InteractionHand hand) {
InteractionResult retval = InteractionResult.sidedSuccess(this.level().isClientSide()); InteractionResult retval = InteractionResult.sidedSuccess(this.level().isClientSide());
@ -182,12 +177,12 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
super.die(source); super.die(source);
if (level() instanceof ServerLevel) { if (level() instanceof ServerLevel) {
destoryExplode(); destroyExplode();
this.discard(); this.discard();
} }
} }
private void destoryExplode() { private void destroyExplode() {
CustomExplosion explosion = new CustomExplosion(this.level(), this, CustomExplosion explosion = new CustomExplosion(this.level(), this,
TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this), 30f, TargetModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this), 30f,
this.getX(), this.getY(), this.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1); this.getX(), this.getY(), this.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
@ -255,12 +250,13 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
} }
public void cannonShoot(Player player) { public void cannonShoot(Player player) {
Level level = player.level(); Level level = player.level();
if (level instanceof ServerLevel server) { if (level instanceof ServerLevel server) {
ItemStack stack = player.getMainHandItem();
if (!(player.getMainHandItem().getItem() instanceof CannonShellItem)) if (!(stack.getItem() instanceof CannonShellItem)) {
return; return;
}
float hitDamage = 0; float hitDamage = 0;
float explosionRadius = 0; float explosionRadius = 0;
@ -269,16 +265,15 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
int fireTime = 0; int fireTime = 0;
int durability = 0; int durability = 0;
if (player.getMainHandItem().is(TargetModItems.HE_5_INCHES.get())) { if (stack.is(TargetModItems.HE_5_INCHES.get())) {
hitDamage = 100; hitDamage = 100;
explosionRadius = 10; explosionRadius = 10;
explosionDamage = 200; explosionDamage = 200;
fireProbability = 0.18F; fireProbability = 0.18F;
fireTime = 100; fireTime = 100;
durability = 0;
} }
if (player.getMainHandItem().is(TargetModItems.AP_5_INCHES.get())) { if (stack.is(TargetModItems.AP_5_INCHES.get())) {
hitDamage = 150; hitDamage = 150;
explosionRadius = 3; explosionRadius = 3;
explosionDamage = 250; explosionDamage = 250;
@ -288,10 +283,11 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
} }
if (!player.isCreative()) { if (!player.isCreative()) {
player.getMainHandItem().shrink(1); stack.shrink(1);
} }
CannonShellEntity entityToSpawn = new CannonShellEntity(TargetModEntities.CANNON_SHELL.get(), player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime).durability(durability); CannonShellEntity entityToSpawn = new CannonShellEntity(TargetModEntities.CANNON_SHELL.get(),
player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime).durability(durability);
entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ()); entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ());
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.1f); entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.1f);

View file

@ -23,7 +23,6 @@
} }
] ]
}, },
"trachelium_fire_1p": { "trachelium_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -64,7 +63,6 @@
} }
] ]
}, },
"hunting_rifle_fire_1p": { "hunting_rifle_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -105,7 +103,6 @@
} }
] ]
}, },
"m_79_fire_1p": { "m_79_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -146,7 +143,6 @@
} }
] ]
}, },
"sks_fire_1p": { "sks_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -195,7 +191,6 @@
} }
] ]
}, },
"abekiri_fire_1p": { "abekiri_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -244,7 +239,6 @@
} }
] ]
}, },
"ak_47_fire_1p": { "ak_47_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -293,7 +287,6 @@
} }
] ]
}, },
"devotion_fire_1p": { "devotion_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -342,7 +335,6 @@
} }
] ]
}, },
"rpg_fire_1p": { "rpg_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -383,7 +375,6 @@
} }
] ]
}, },
"m_4_fire_1p": { "m_4_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -432,7 +423,6 @@
} }
] ]
}, },
"aa_12_fire_1p": { "aa_12_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -481,7 +471,6 @@
} }
] ]
}, },
"bocek_zoom_fire_1p": { "bocek_zoom_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -530,7 +519,6 @@
} }
] ]
}, },
"hk_416_fire_1p": { "hk_416_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -579,7 +567,6 @@
} }
] ]
}, },
"rpk_fire_1p": { "rpk_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -628,7 +615,6 @@
} }
] ]
}, },
"ntw_20_fire_1p": { "ntw_20_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -685,7 +671,6 @@
} }
] ]
}, },
"vector_fire_1p": { "vector_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -734,7 +719,6 @@
} }
] ]
}, },
"minigun_fire_1p": { "minigun_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -783,7 +767,6 @@
} }
] ]
}, },
"mk_14_fire_1p": { "mk_14_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -832,7 +815,6 @@
} }
] ]
}, },
"sentinel_fire_1p": { "sentinel_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -929,7 +911,6 @@
} }
] ]
}, },
"m_60_fire_1p": { "m_60_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -978,7 +959,6 @@
} }
] ]
}, },
"svd_fire_1p": { "svd_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -1027,7 +1007,6 @@
} }
] ]
}, },
"m_98b_fire_1p": { "m_98b_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -1084,7 +1063,6 @@
} }
] ]
}, },
"marlin_fire_1p": { "marlin_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -1141,7 +1119,6 @@
} }
] ]
}, },
"m_870_fire_1p": { "m_870_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -1190,7 +1167,6 @@
} }
] ]
}, },
"mk_42_fire_1p": { "mk_42_fire_1p": {
"sounds": [ "sounds": [
{ {
@ -1235,7 +1211,6 @@
} }
] ]
}, },
"lightsaber": { "lightsaber": {
"sounds": [ "sounds": [
{ {
@ -1455,67 +1430,67 @@
"land": { "land": {
"sounds": [ "sounds": [
{ {
"name": "target:bullet/1", "name": "target:bullet/bullet1",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/2", "name": "target:bullet/bullet2",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/3", "name": "target:bullet/bullet3",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/4", "name": "target:bullet/bullet4",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/5", "name": "target:bullet/bullet5",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/6", "name": "target:bullet/bullet6",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/7", "name": "target:bullet/bullet7",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/8", "name": "target:bullet/bullet8",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/9", "name": "target:bullet/bullet9",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/10", "name": "target:bullet/bullet10",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/11", "name": "target:bullet/bullet11",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/12", "name": "target:bullet/bullet12",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/13", "name": "target:bullet/bullet13",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/14", "name": "target:bullet/bullet14",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/15", "name": "target:bullet/bullet15",
"stream": false "stream": false
}, },
{ {
"name": "target:bullet/16", "name": "target:bullet/bullet16",
"stream": false "stream": false
} }
] ]