diff --git a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java index 485f0dcab..45db8ad30 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/ClickHandler.java @@ -21,7 +21,6 @@ import com.atsuishio.superbwarfare.tools.TraceTool; import com.mojang.blaze3d.platform.InputConstants; import net.minecraft.ChatFormatting; import net.minecraft.client.Minecraft; -import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; @@ -477,7 +476,7 @@ public class ClickHandler { private static void handleLaunchPress(Player player) { ItemStack item = player.getMainHandItem(); - if (item.is(ModItems.EXPLOSIVE_MINE.get())) { + if (item.is(ModItems.C4_BOMB.get())) { item.use(player.level(),player,player.getUsedItemHand()); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ExplosiveModel.java b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/C4Model.java similarity index 52% rename from src/main/java/com/atsuishio/superbwarfare/client/model/entity/ExplosiveModel.java rename to src/main/java/com/atsuishio/superbwarfare/client/model/entity/C4Model.java index c621f23bd..443965a4f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/model/entity/ExplosiveModel.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/model/entity/C4Model.java @@ -1,30 +1,30 @@ package com.atsuishio.superbwarfare.client.model.entity; import com.atsuishio.superbwarfare.ModUtils; -import com.atsuishio.superbwarfare.entity.ExplosiveEntity; +import com.atsuishio.superbwarfare.entity.C4Entity; import net.minecraft.resources.ResourceLocation; import software.bernie.geckolib.model.GeoModel; import java.util.UUID; -public class ExplosiveModel extends GeoModel { +public class C4Model extends GeoModel { @Override - public ResourceLocation getAnimationResource(ExplosiveEntity entity) { + public ResourceLocation getAnimationResource(C4Entity entity) { return ModUtils.loc("animations/c4.animation.json"); } @Override - public ResourceLocation getModelResource(ExplosiveEntity entity) { + public ResourceLocation getModelResource(C4Entity entity) { return ModUtils.loc("geo/c4.geo.json"); } @Override - public ResourceLocation getTextureResource(ExplosiveEntity entity) { + public ResourceLocation getTextureResource(C4Entity entity) { UUID uuid = entity.getUUID(); if (uuid.getLeastSignificantBits() % 114 == 0) { - return ModUtils.loc("textures/entity/c4_alter.png"); + return ModUtils.loc("textures/item/c4_alter.png"); } - return ModUtils.loc("textures/entity/c4.png"); + return ModUtils.loc("textures/item/c4.png"); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/ExplosiveRenderer.java b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/C4Renderer.java similarity index 57% rename from src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/ExplosiveRenderer.java rename to src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/C4Renderer.java index 9099768a6..c2dcfa8d7 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/ExplosiveRenderer.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/renderer/entity/C4Renderer.java @@ -1,7 +1,7 @@ package com.atsuishio.superbwarfare.client.renderer.entity; -import com.atsuishio.superbwarfare.client.model.entity.ExplosiveModel; -import com.atsuishio.superbwarfare.entity.ExplosiveEntity; +import com.atsuishio.superbwarfare.client.model.entity.C4Model; +import com.atsuishio.superbwarfare.entity.C4Entity; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.math.Axis; @@ -13,20 +13,20 @@ import net.minecraft.util.Mth; import software.bernie.geckolib.cache.object.BakedGeoModel; import software.bernie.geckolib.renderer.GeoEntityRenderer; -public class ExplosiveRenderer extends GeoEntityRenderer { +public class C4Renderer extends GeoEntityRenderer { - public ExplosiveRenderer(EntityRendererProvider.Context renderManager) { - super(renderManager, new ExplosiveModel()); + public C4Renderer(EntityRendererProvider.Context renderManager) { + super(renderManager, new C4Model()); this.shadowRadius = 0f; } @Override - public RenderType getRenderType(ExplosiveEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) { + public RenderType getRenderType(C4Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) { return RenderType.entityTranslucent(getTextureLocation(animatable)); } @Override - public void preRender(PoseStack poseStack, ExplosiveEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, + public void preRender(PoseStack poseStack, C4Entity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) { float scale = 0.5f; this.scaleHeight = scale; @@ -35,7 +35,7 @@ public class ExplosiveRenderer extends GeoEntityRenderer { } @Override - public void render(ExplosiveEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) { + public void render(C4Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) { poseStack.pushPose(); poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()))); super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn); @@ -43,12 +43,12 @@ public class ExplosiveRenderer extends GeoEntityRenderer { } @Override - protected float getDeathMaxRotation(ExplosiveEntity entityLivingBaseIn) { + protected float getDeathMaxRotation(C4Entity entityLivingBaseIn) { return 0.0F; } @Override - public boolean shouldShowName(ExplosiveEntity animatable) { + public boolean shouldShowName(C4Entity animatable) { return false; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/ExplosiveEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java similarity index 88% rename from src/main/java/com/atsuishio/superbwarfare/entity/ExplosiveEntity.java rename to src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java index fb00a3aab..9840abf23 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/ExplosiveEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/C4Entity.java @@ -10,29 +10,19 @@ import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import com.atsuishio.superbwarfare.tools.ParticleTool; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.syncher.EntityDataAccessor; -import net.minecraft.network.syncher.EntityDataSerializer; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.players.OldUsersConverter; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.*; import net.minecraft.world.entity.item.ItemEntity; -import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.items.ItemHandlerHelper; -import org.joml.Vector3f; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache; import software.bernie.geckolib.core.animation.AnimatableManager; @@ -43,24 +33,24 @@ import java.util.Comparator; import java.util.Optional; import java.util.UUID; -public class ExplosiveEntity extends Entity implements GeoEntity, AnimatedEntity, OwnableEntity { +public class C4Entity extends Entity implements GeoEntity, AnimatedEntity, OwnableEntity { - protected static final EntityDataAccessor> OWNER_UUID = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.OPTIONAL_UUID); - protected static final EntityDataAccessor LAST_ATTACKER_UUID = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.STRING); - protected static final EntityDataAccessor> TARGET_UUID = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.OPTIONAL_UUID); - protected static final EntityDataAccessor REL_X = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.FLOAT); - protected static final EntityDataAccessor REL_Y = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.FLOAT); - protected static final EntityDataAccessor REL_Z = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.FLOAT); - public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(ExplosiveEntity.class, EntityDataSerializers.FLOAT); + protected static final EntityDataAccessor> OWNER_UUID = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.OPTIONAL_UUID); + protected static final EntityDataAccessor LAST_ATTACKER_UUID = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.STRING); + protected static final EntityDataAccessor> TARGET_UUID = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.OPTIONAL_UUID); + protected static final EntityDataAccessor REL_X = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.FLOAT); + protected static final EntityDataAccessor REL_Y = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.FLOAT); + protected static final EntityDataAccessor REL_Z = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.FLOAT); + public static final EntityDataAccessor HEALTH = SynchedEntityData.defineId(C4Entity.class, EntityDataSerializers.FLOAT); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); - public ExplosiveEntity(EntityType type, Level world) { + public C4Entity(EntityType type, Level world) { super(type, world); this.noCulling = true; } - public ExplosiveEntity(LivingEntity owner, Level level) { - super(ModEntities.EXPLOSIVE.get(), level); + public C4Entity(LivingEntity owner, Level level) { + super(ModEntities.C_4.get(), level); this.setOwnerUUID(owner.getUUID()); ModUtils.queueServerWork(1, () -> { if (this.level().isClientSide()) return; @@ -272,7 +262,7 @@ public class ExplosiveEntity extends Entity implements GeoEntity, AnimatedEntity public void destroy() { if (this.level() instanceof ServerLevel && this.tickCount < ExplosionConfig.C4_EXPLOSION_COUNTDOWN.get()) { - ItemEntity c4 = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), new ItemStack(ModItems.EXPLOSIVE_MINE.get())); + ItemEntity c4 = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), new ItemStack(ModItems.C4_BOMB.get())); c4.setPickUpDelay(10); this.level().addFreshEntity(c4); this.discard(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java index d67496a6d..617370a12 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/DroneEntity.java @@ -328,7 +328,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { if (this.entityData.get(KAMIKAZE_MODE) == 1) { ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.MORTAR_SHELLS.get())); } else if (this.entityData.get(KAMIKAZE_MODE) == 2) { - ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.EXPLOSIVE_MINE.get())); + ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.C4_BOMB.get())); } player.getInventory().items.stream().filter(stack_ -> stack_.getItem() == ModItems.MONITOR.get()) @@ -359,7 +359,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity { if (player instanceof ServerPlayer serverPlayer) { serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1); } - } else if (stack.getItem() == ModItems.EXPLOSIVE_MINE.get() && this.entityData.get(AMMO) == 0 && this.entityData.get(KAMIKAZE_MODE) == 0) { + } else if (stack.getItem() == ModItems.C4_BOMB.get() && this.entityData.get(AMMO) == 0 && this.entityData.get(KAMIKAZE_MODE) == 0) { // C4神风 if (!player.isCreative()) { stack.shrink(1); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index de98ce44a..91711876f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -223,10 +223,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa float eyeHeight = entity.getEyeHeight(); float bodyHeight = entity.getBbHeight(); if ((eyeHeight - 0.35) < hitBoxPos.y && hitBoxPos.y < (eyeHeight + 0.4) && - !(entity instanceof ExplosiveEntity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) { + !(entity instanceof C4Entity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) { headshot = true; } - if (hitBoxPos.y < (0.33 * bodyHeight) && !(entity instanceof ExplosiveEntity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || + if (hitBoxPos.y < (0.33 * bodyHeight) && !(entity instanceof C4Entity || entity instanceof ClaymoreEntity || entity instanceof MortarEntity || entity instanceof IArmedVehicleEntity || entity instanceof DroneEntity)) { legShot = true; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java index 125e61412..308c1b1bb 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/ContainerMobileEntity.java @@ -67,7 +67,7 @@ public class ContainerMobileEntity extends MobileVehicleEntity implements HasCus if (player.getVehicle() == this) return InteractionResult.PASS; ItemStack stack = player.getMainHandItem(); - if (stack.is(ModItems.EXPLOSIVE_MINE.get())) { + if (stack.is(ModItems.C4_BOMB.get())) { stack.use(player.level(), player, hand); return InteractionResult.SUCCESS; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java index 5df45481d..7f7c6544f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/VehicleEntity.java @@ -1,8 +1,8 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.entity.C4Entity; import com.atsuishio.superbwarfare.entity.DroneEntity; -import com.atsuishio.superbwarfare.entity.ExplosiveEntity; import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModParticleTypes; @@ -225,7 +225,7 @@ public class VehicleEntity extends Entity { @Override protected boolean canAddPassenger(Entity pPassenger) { ModUtils.LOGGER.info(pPassenger.getClass().toString()); - return this.getPassengers().size() < this.getMaxPassengers() || pPassenger instanceof ExplosiveEntity; + return this.getPassengers().size() < this.getMaxPassengers() || pPassenger instanceof C4Entity; } public int getMaxPassengers() { diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java index c1b1e9212..8f5a7556b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntities.java @@ -31,8 +31,8 @@ public class ModEntities { .sized(0.6f, 2f)); public static final RegistryObject> CLAYMORE = register("claymore", EntityType.Builder.of(ClaymoreEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).sized(0.5f, 0.5f)); - public static final RegistryObject> EXPLOSIVE = register("c4", - EntityType.Builder.of(ExplosiveEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).sized(0.5f, 0.5f)); + public static final RegistryObject> C_4 = register("c4", + EntityType.Builder.of(C4Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(1).sized(0.5f, 0.5f)); public static final RegistryObject> MK_42 = register("mk_42", EntityType.Builder.of(Mk42Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Mk42Entity::new).fireImmune().sized(3.4f, 3.5f)); public static final RegistryObject> MLE_1934 = register("mle_1934", diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java index af2dbf88e..d0b2e4ad1 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModEntityRenderers.java @@ -14,7 +14,7 @@ public class ModEntityRenderers { event.registerEntityRenderer(ModEntities.MORTAR.get(), MortarRenderer::new); event.registerEntityRenderer(ModEntities.SENPAI.get(), SenpaiRenderer::new); event.registerEntityRenderer(ModEntities.CLAYMORE.get(), ClaymoreRenderer::new); - event.registerEntityRenderer(ModEntities.EXPLOSIVE.get(), ExplosiveRenderer::new); + event.registerEntityRenderer(ModEntities.C_4.get(), C4Renderer::new); event.registerEntityRenderer(ModEntities.TASER_BULLET_PROJECTILE.get(), TaserBulletProjectileRenderer::new); event.registerEntityRenderer(ModEntities.GUN_GRENADE.get(), GunGrenadeRenderer::new); event.registerEntityRenderer(ModEntities.TARGET.get(), TargetRenderer::new); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java index 9603ca588..aa273daa9 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModItems.java @@ -106,7 +106,7 @@ public class ModItems { public static final RegistryObject HAND_GRENADE = AMMO.register("hand_grenade", HandGrenade::new); public static final RegistryObject RGO_GRENADE = AMMO.register("rgo_grenade", RgoGrenade::new); public static final RegistryObject CLAYMORE_MINE = AMMO.register("claymore_mine", ClaymoreMine::new); - public static final RegistryObject EXPLOSIVE_MINE = AMMO.register("explosive_mine", ExplosiveMine::new); + public static final RegistryObject C4_BOMB = AMMO.register("c4_bomb", C4Bomb::new); public static final RegistryObject HEAVY_AMMO = AMMO.register("heavy_ammo", () -> new Item(new Item.Properties())); public static final RegistryObject ROCKET_70 = AMMO.register("rocket_70", () -> new Item(new Item.Properties())); public static final RegistryObject SMALL_SHELL = AMMO.register("small_shell", () -> new Item(new Item.Properties())); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java b/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java index f90f911a1..a92446e11 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModVillagers.java @@ -153,7 +153,7 @@ public class ModVillagers { trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), 16, 5, 0.05f)); trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), - new ItemStack(ModItems.EXPLOSIVE_MINE.get(), 1), 16, 5, 0.05f)); + new ItemStack(ModItems.C4_BOMB.get(), 1), 16, 5, 0.05f)); trades.get(4).add(new BasicItemListing(new ItemStack(Items.EMERALD, 4), new ItemStack(ModItems.ROCKET.get(), 1), 16, 5, 0.05f)); @@ -167,7 +167,7 @@ public class ModVillagers { new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.CLAYMORE_MINE.get(), 1), new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); - trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.EXPLOSIVE_MINE.get(), 1), + trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.C4_BOMB.get(), 1), new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); trades.get(4).add(new BasicItemListing(new ItemStack(ModItems.ROCKET.get(), 1), new ItemStack(Items.EMERALD, 2), 32, 5, 0.05f)); diff --git a/src/main/java/com/atsuishio/superbwarfare/item/ExplosiveMine.java b/src/main/java/com/atsuishio/superbwarfare/item/C4Bomb.java similarity index 86% rename from src/main/java/com/atsuishio/superbwarfare/item/ExplosiveMine.java rename to src/main/java/com/atsuishio/superbwarfare/item/C4Bomb.java index 7a570a4ac..0d71da182 100644 --- a/src/main/java/com/atsuishio/superbwarfare/item/ExplosiveMine.java +++ b/src/main/java/com/atsuishio/superbwarfare/item/C4Bomb.java @@ -1,17 +1,16 @@ package com.atsuishio.superbwarfare.item; -import com.atsuishio.superbwarfare.entity.ExplosiveEntity; +import com.atsuishio.superbwarfare.entity.C4Entity; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; -import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; -public class ExplosiveMine extends Item { - public ExplosiveMine() { +public class C4Bomb extends Item { + public C4Bomb() { super(new Item.Properties()); } @@ -25,7 +24,7 @@ public class ExplosiveMine extends Item { } } if (!level.isClientSide) { - ExplosiveEntity entity = new ExplosiveEntity(player, level); + C4Entity entity = new C4Entity(player, level); entity.moveTo(player.getX(), player.getY() + 1.1, player.getZ(), player.getYRot(), 0); entity.setYBodyRot(player.getYRot()); entity.setYHeadRot(player.getYRot()); diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java index 6277ad117..854ccc868 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/SeekTool.java @@ -1,7 +1,7 @@ package com.atsuishio.superbwarfare.tools; +import com.atsuishio.superbwarfare.entity.C4Entity; import com.atsuishio.superbwarfare.entity.ClaymoreEntity; -import com.atsuishio.superbwarfare.entity.ExplosiveEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.vehicle.MobileVehicleEntity; import net.minecraft.core.BlockPos; @@ -40,7 +40,7 @@ public class SeekTool { && e.isAlive() && e.getVehicle() == null && !(e instanceof Player player && (player.isSpectator())) - && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof ExplosiveEntity || e instanceof AreaEffectCloud) + && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof C4Entity || e instanceof AreaEffectCloud) ) { return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK; @@ -55,7 +55,7 @@ public class SeekTool { if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle && e != entity && e.isAlive() - && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof ExplosiveEntity || e instanceof AreaEffectCloud) + && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof C4Entity || e instanceof AreaEffectCloud) && e.getVehicle() == null && !(e instanceof Player player && (player.isSpectator())) && (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) { @@ -72,7 +72,7 @@ public class SeekTool { if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle && e != entity && e.isAlive() - && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof ExplosiveEntity || e instanceof AreaEffectCloud) + && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof C4Entity || e instanceof AreaEffectCloud) && e.getVehicle() == null && !(e instanceof Player player && (player.isSpectator())) && (!e.isAlliedTo(entity) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))) { @@ -87,7 +87,7 @@ public class SeekTool { return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false) .filter(e -> e.distanceToSqr(pos.getX(), pos.getY(), pos.getZ()) <= range * range && e.isAlive() - && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof ExplosiveEntity || e instanceof AreaEffectCloud) + && !(e instanceof ItemEntity || e instanceof ExperienceOrb || e instanceof HangingEntity || e instanceof ProjectileEntity || e instanceof Projectile || e instanceof ArmorStand || e instanceof ClaymoreEntity || e instanceof C4Entity || e instanceof AreaEffectCloud) && !(e instanceof Player player && player.isSpectator())) .toList(); } diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 753ea7078..63147fd4d 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -174,7 +174,7 @@ "item.superbwarfare.mortar_barrel": "Mortar Barrel", "item.superbwarfare.mortar_deployer": "Mortar", "item.superbwarfare.claymore_mine": "Claymore", - "item.superbwarfare.explosive_mine": "C4", + "item.superbwarfare.c4_bomb": "C4", "item.superbwarfare.seeker": "Seeker", "item.superbwarfare.missile_engine": "Missile Engine", "item.superbwarfare.fusee": "Fusee", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 4a8303c6e..887baa386 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -174,7 +174,7 @@ "item.superbwarfare.mortar_barrel": "迫击炮管", "item.superbwarfare.mortar_deployer": "迫击炮", "item.superbwarfare.claymore_mine": "阔剑地雷", - "item.superbwarfare.explosive_mine": "C4炸药", + "item.superbwarfare.c4_bomb": "C4炸药", "item.superbwarfare.seeker": "导引头", "item.superbwarfare.missile_engine": "导弹发动机", "item.superbwarfare.fusee": "引信", diff --git a/src/main/resources/assets/superbwarfare/models/custom/c4.json b/src/main/resources/assets/superbwarfare/models/custom/c4.json index d8a2ad7be..4202f0b57 100644 --- a/src/main/resources/assets/superbwarfare/models/custom/c4.json +++ b/src/main/resources/assets/superbwarfare/models/custom/c4.json @@ -2,6 +2,7 @@ "credit": "Made with Blockbench", "texture_size": [32, 32], "textures": { + "0": "superbwarfare:entity/c4", "particle": "superbwarfare:entity/c4" }, "elements": [ @@ -11,12 +12,12 @@ "to": [15, 3, 14], "rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 3]}, "faces": { - "north": {"uv": [7, 7, 14, 8.5], "texture": "#1"}, - "east": {"uv": [7, 10, 12.5, 11.5], "texture": "#1"}, - "south": {"uv": [7, 8.5, 14, 10], "texture": "#1"}, - "west": {"uv": [10.5, 0, 16, 1.5], "texture": "#1"}, - "up": {"uv": [7, 5.5, 0, 0], "texture": "#1"}, - "down": {"uv": [7, 5.5, 0, 11], "texture": "#1"} + "north": {"uv": [7, 7, 14, 8.5], "texture": "#0"}, + "east": {"uv": [7, 10, 12.5, 11.5], "texture": "#0"}, + "south": {"uv": [7, 8.5, 14, 10], "texture": "#0"}, + "west": {"uv": [10.5, 0, 16, 1.5], "texture": "#0"}, + "up": {"uv": [7, 5.5, 0, 0], "texture": "#0"}, + "down": {"uv": [7, 5.5, 0, 11], "texture": "#0"} } }, { @@ -25,12 +26,12 @@ "to": [14, 4, 13], "rotation": {"angle": 0, "axis": "y", "origin": [14, 3, 4]}, "faces": { - "north": {"uv": [5.5, 11.5, 6.5, 12], "texture": "#1"}, - "east": {"uv": [10.5, 6, 15, 6.5], "texture": "#1"}, - "south": {"uv": [11.5, 5.5, 12.5, 6], "texture": "#1"}, - "west": {"uv": [10.5, 6.5, 15, 7], "texture": "#1"}, - "up": {"uv": [11.5, 6, 10.5, 1.5], "texture": "#1"}, - "down": {"uv": [1, 11, 0, 15.5], "texture": "#1"} + "north": {"uv": [5.5, 11.5, 6.5, 12], "texture": "#0"}, + "east": {"uv": [10.5, 6, 15, 6.5], "texture": "#0"}, + "south": {"uv": [11.5, 5.5, 12.5, 6], "texture": "#0"}, + "west": {"uv": [10.5, 6.5, 15, 7], "texture": "#0"}, + "up": {"uv": [11.5, 6, 10.5, 1.5], "texture": "#0"}, + "down": {"uv": [1, 11, 0, 15.5], "texture": "#0"} } }, { @@ -39,12 +40,12 @@ "to": [10, 4, 12], "rotation": {"angle": 0, "axis": "y", "origin": [10, 3, 5]}, "faces": { - "north": {"uv": [1, 11, 4.5, 11.5], "texture": "#1"}, - "east": {"uv": [1, 11.5, 4.5, 12], "texture": "#1"}, - "south": {"uv": [11.5, 1.5, 15, 2], "texture": "#1"}, - "west": {"uv": [11.5, 2, 15, 2.5], "texture": "#1"}, - "up": {"uv": [10.5, 3.5, 7, 0], "texture": "#1"}, - "down": {"uv": [10.5, 3.5, 7, 7], "texture": "#1"} + "north": {"uv": [1, 11, 4.5, 11.5], "texture": "#0"}, + "east": {"uv": [1, 11.5, 4.5, 12], "texture": "#0"}, + "south": {"uv": [11.5, 1.5, 15, 2], "texture": "#0"}, + "west": {"uv": [11.5, 2, 15, 2.5], "texture": "#0"}, + "up": {"uv": [10.5, 3.5, 7, 0], "texture": "#0"}, + "down": {"uv": [10.5, 3.5, 7, 7], "texture": "#0"} } }, { @@ -53,12 +54,12 @@ "to": [10, 2, 3], "rotation": {"angle": 0, "axis": "y", "origin": [10, 1, 2]}, "faces": { - "north": {"uv": [4.5, 11, 7, 11.5], "texture": "#1"}, - "east": {"uv": [7.5, 11.5, 8, 12], "texture": "#1"}, - "south": {"uv": [11.5, 2.5, 14, 3], "texture": "#1"}, - "west": {"uv": [8, 11.5, 8.5, 12], "texture": "#1"}, - "up": {"uv": [14, 3.5, 11.5, 3], "texture": "#1"}, - "down": {"uv": [14, 3.5, 11.5, 4], "texture": "#1"} + "north": {"uv": [4.5, 11, 7, 11.5], "texture": "#0"}, + "east": {"uv": [7.5, 11.5, 8, 12], "texture": "#0"}, + "south": {"uv": [11.5, 2.5, 14, 3], "texture": "#0"}, + "west": {"uv": [8, 11.5, 8.5, 12], "texture": "#0"}, + "up": {"uv": [14, 3.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [14, 3.5, 11.5, 4], "texture": "#0"} } }, { @@ -67,12 +68,12 @@ "to": [14, 2, 3], "rotation": {"angle": 0, "axis": "y", "origin": [14, 1, 2]}, "faces": { - "north": {"uv": [11.5, 4, 12.5, 4.5], "texture": "#1"}, - "east": {"uv": [6.5, 11.5, 7, 12], "texture": "#1"}, - "south": {"uv": [4.5, 11.5, 5.5, 12], "texture": "#1"}, - "west": {"uv": [7, 11.5, 7.5, 12], "texture": "#1"}, - "up": {"uv": [12.5, 5, 11.5, 4.5], "texture": "#1"}, - "down": {"uv": [12.5, 5, 11.5, 5.5], "texture": "#1"} + "north": {"uv": [11.5, 4, 12.5, 4.5], "texture": "#0"}, + "east": {"uv": [6.5, 11.5, 7, 12], "texture": "#0"}, + "south": {"uv": [4.5, 11.5, 5.5, 12], "texture": "#0"}, + "west": {"uv": [7, 11.5, 7.5, 12], "texture": "#0"}, + "up": {"uv": [12.5, 5, 11.5, 4.5], "texture": "#0"}, + "down": {"uv": [12.5, 5, 11.5, 5.5], "texture": "#0"} } } ], diff --git a/src/main/resources/assets/superbwarfare/models/item/c4_bomb.json b/src/main/resources/assets/superbwarfare/models/item/c4_bomb.json new file mode 100644 index 000000000..18f9e679e --- /dev/null +++ b/src/main/resources/assets/superbwarfare/models/item/c4_bomb.json @@ -0,0 +1,143 @@ +{ + "credit": "Made with Blockbench", + "texture_size": [32, 32], + "textures": { + "0": "superbwarfare:item/c4", + "particle": "superbwarfare:item/c4" + }, + "elements": [ + { + "name": "body", + "from": [0, 0, 3], + "to": [15, 3, 14], + "rotation": {"angle": 0, "axis": "y", "origin": [15, 0, 3]}, + "faces": { + "north": {"uv": [7, 7, 14, 8.5], "texture": "#0"}, + "east": {"uv": [7, 10, 12.5, 11.5], "texture": "#0"}, + "south": {"uv": [7, 8.5, 14, 10], "texture": "#0"}, + "west": {"uv": [10.5, 0, 16, 1.5], "texture": "#0"}, + "up": {"uv": [7, 5.5, 0, 0], "texture": "#0"}, + "down": {"uv": [7, 5.5, 0, 11], "texture": "#0"} + } + }, + { + "name": "screen", + "from": [12, 3, 4], + "to": [14, 4, 13], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 3, 4]}, + "faces": { + "north": {"uv": [5.5, 11.5, 6.5, 12], "texture": "#0"}, + "east": {"uv": [10.5, 6, 15, 6.5], "texture": "#0"}, + "south": {"uv": [11.5, 5.5, 12.5, 6], "texture": "#0"}, + "west": {"uv": [10.5, 6.5, 15, 7], "texture": "#0"}, + "up": {"uv": [11.5, 6, 10.5, 1.5], "texture": "#0"}, + "down": {"uv": [1, 11, 0, 15.5], "texture": "#0"} + } + }, + { + "name": "panel", + "from": [3, 3, 5], + "to": [10, 4, 12], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 3, 5]}, + "faces": { + "north": {"uv": [1, 11, 4.5, 11.5], "texture": "#0"}, + "east": {"uv": [1, 11.5, 4.5, 12], "texture": "#0"}, + "south": {"uv": [11.5, 1.5, 15, 2], "texture": "#0"}, + "west": {"uv": [11.5, 2, 15, 2.5], "texture": "#0"}, + "up": {"uv": [10.5, 3.5, 7, 0], "texture": "#0"}, + "down": {"uv": [10.5, 3.5, 7, 7], "texture": "#0"} + } + }, + { + "name": "black", + "from": [5, 1, 2], + "to": [10, 2, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [10, 1, 2]}, + "faces": { + "north": {"uv": [4.5, 11, 7, 11.5], "texture": "#0"}, + "east": {"uv": [7.5, 11.5, 8, 12], "texture": "#0"}, + "south": {"uv": [11.5, 2.5, 14, 3], "texture": "#0"}, + "west": {"uv": [8, 11.5, 8.5, 12], "texture": "#0"}, + "up": {"uv": [14, 3.5, 11.5, 3], "texture": "#0"}, + "down": {"uv": [14, 3.5, 11.5, 4], "texture": "#0"} + } + }, + { + "name": "swtich", + "from": [12, 1, 2], + "to": [14, 2, 3], + "rotation": {"angle": 0, "axis": "y", "origin": [14, 1, 2]}, + "faces": { + "north": {"uv": [11.5, 4, 12.5, 4.5], "texture": "#0"}, + "east": {"uv": [6.5, 11.5, 7, 12], "texture": "#0"}, + "south": {"uv": [4.5, 11.5, 5.5, 12], "texture": "#0"}, + "west": {"uv": [7, 11.5, 7.5, 12], "texture": "#0"}, + "up": {"uv": [12.5, 5, 11.5, 4.5], "texture": "#0"}, + "down": {"uv": [12.5, 5, 11.5, 5.5], "texture": "#0"} + } + } + ], + "gui_light": "front", + "display": { + "thirdperson_righthand": { + "rotation": [45, 50, 85], + "translation": [-2, 0, 1.5], + "scale": [0.3, 0.3, 0.3] + }, + "thirdperson_lefthand": { + "rotation": [45, 50, 85], + "translation": [-2, 0, 1.5], + "scale": [0.3, 0.3, 0.3] + }, + "firstperson_righthand": { + "rotation": [0, 50, 85], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "firstperson_lefthand": { + "rotation": [0, -130, -85], + "translation": [0, 1.5, 0], + "scale": [0.5, 0.5, 0.5] + }, + "ground": { + "translation": [0, 2, 0], + "scale": [0.5, 0.5, 0.5] + }, + "gui": { + "rotation": [90, 90, 0], + "scale": [0.8, 0.8, 0.8] + }, + "head": { + "rotation": [90, 90, 0], + "translation": [0, -12, 4.75], + "scale": [0.2, 0.2, 0.2] + }, + "fixed": { + "rotation": [-90, -90, 0], + "translation": [0, 0, -7] + } + }, + "groups": [ + { + "name": "c4", + "origin": [8, 0, 8], + "color": 0, + "children": [ + 0, + 1, + { + "name": "button_group", + "origin": [10, 3, 5], + "color": 0, + "children": [2] + }, + { + "name": "triggers", + "origin": [8, 0, 8], + "color": 0, + "children": [3, 4] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/textures/entity/c4.png b/src/main/resources/assets/superbwarfare/textures/entity/c4.png deleted file mode 100644 index 5739bf11e..000000000 Binary files a/src/main/resources/assets/superbwarfare/textures/entity/c4.png and /dev/null differ diff --git a/src/main/resources/assets/superbwarfare/textures/entity/c4_alter.png b/src/main/resources/assets/superbwarfare/textures/item/c4_alter.png similarity index 100% rename from src/main/resources/assets/superbwarfare/textures/entity/c4_alter.png rename to src/main/resources/assets/superbwarfare/textures/item/c4_alter.png