同步更新内容(光棱坦克,YX-100同轴机枪,提高地面通过性等)

This commit is contained in:
Light_Quanta 2025-04-02 17:35:17 +08:00
parent d532057dc8
commit 52d6e23494
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
41 changed files with 12419 additions and 150 deletions

View file

@ -0,0 +1,28 @@
package com.atsuishio.superbwarfare.client.layer.vehicle;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoRenderer;
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
public class PrismTankLaserLayer extends GeoRenderLayer<PrismTankEntity> {
private static final ResourceLocation LAYER = Mod.loc("textures/entity/prism_tank_laser.png");
public PrismTankLaserLayer(GeoRenderer<PrismTankEntity> entityRenderer) {
super(entityRenderer);
}
@Override
public void render(PoseStack poseStack, PrismTankEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
}
}

View file

@ -0,0 +1,28 @@
package com.atsuishio.superbwarfare.client.layer.vehicle;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.renderer.GeoRenderer;
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
public class PrismTankLightLayer extends GeoRenderLayer<PrismTankEntity> {
private static final ResourceLocation LAYER = Mod.loc("textures/entity/prism_tank_e.png");
public PrismTankLightLayer(GeoRenderer<PrismTankEntity> entityRenderer) {
super(entityRenderer);
}
@Override
public void render(PoseStack poseStack, PrismTankEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
RenderType glowRenderType = RenderType.eyes(LAYER);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
}
}

View file

@ -0,0 +1,37 @@
package com.atsuishio.superbwarfare.client.model.entity;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity;
import net.minecraft.resources.ResourceLocation;
import software.bernie.geckolib.model.GeoModel;
public class PrismTankModel extends GeoModel<PrismTankEntity> {
@Override
public ResourceLocation getAnimationResource(PrismTankEntity entity) {
return null;
}
@Override
public ResourceLocation getModelResource(PrismTankEntity entity) {
return Mod.loc("geo/prism_tank.geo.json");
// Player player = Minecraft.getInstance().player;
//
// int distance = 0;
//
// if (player != null) {
// distance = (int) player.position().distanceTo(entity.position());
// }
//
// if (distance < 32) {
// return ModUtils.loc("geo/PrismTank.geo.json");
// } else {
// return ModUtils.loc("geo/speedboat.lod1.geo.json");
// }
}
@Override
public ResourceLocation getTextureResource(PrismTankEntity entity) {
return Mod.loc("textures/entity/prism_tank.png");
}
}

View file

@ -3,10 +3,7 @@ package com.atsuishio.superbwarfare.client.overlay;
import com.atsuishio.superbwarfare.Mod; import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.client.RenderHelper; import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.config.client.DisplayConfig; import com.atsuishio.superbwarfare.config.client.DisplayConfig;
import com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity; import com.atsuishio.superbwarfare.entity.vehicle.*;
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity;
import com.atsuishio.superbwarfare.entity.vehicle.base.*; import com.atsuishio.superbwarfare.entity.vehicle.base.*;
import com.atsuishio.superbwarfare.entity.vehicle.weapon.HeliRocketWeapon; import com.atsuishio.superbwarfare.entity.vehicle.weapon.HeliRocketWeapon;
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon; import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
@ -156,6 +153,8 @@ public class VehicleHudOverlay {
&& !(player.getVehicle() instanceof SpeedboatEntity)) { && !(player.getVehicle() instanceof SpeedboatEntity)) {
poseStack.pushPose(); poseStack.pushPose();
poseStack.translate(0, 0 - 0.3 * ClientEventHandler.shakeTime + 3 * ClientEventHandler.cameraRoll, 0);
poseStack.rotateAround(Axis.ZP.rotationDegrees(-0.3f * ClientEventHandler.cameraRoll), w / 2f, h / 2f, 0);
poseStack.translate(0.2 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0 - 0.3 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0); poseStack.translate(0.2 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0 - 0.3 * ClientEventHandler.shakeTime + 5 * ClientEventHandler.cameraRoll, 0);
poseStack.rotateAround(Axis.ZP.rotationDegrees(-0.5f * ClientEventHandler.cameraRoll), w / 2f, h / 2f, 0); poseStack.rotateAround(Axis.ZP.rotationDegrees(-0.5f * ClientEventHandler.cameraRoll), w / 2f, h / 2f, 0);
RenderSystem.disableDepthTest(); RenderSystem.disableDepthTest();
@ -186,8 +185,12 @@ public class VehicleHudOverlay {
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/tank_cannon_cross_ap.png"), k, l, 0, 0.0F, i, j, i, j); preciseBlit(guiGraphics, Mod.loc("textures/screens/land/tank_cannon_cross_ap.png"), k, l, 0, 0.0F, i, j, i, j);
} else if (weaponVehicle.getWeaponIndex(0) == 1) { } else if (weaponVehicle.getWeaponIndex(0) == 1) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/tank_cannon_cross_he.png"), k, l, 0, 0.0F, i, j, i, j); preciseBlit(guiGraphics, Mod.loc("textures/screens/land/tank_cannon_cross_he.png"), k, l, 0, 0.0F, i, j, i, j);
} else if (weaponVehicle.getWeaponIndex(0) == 2) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/lav_gun_cross.png"), k, l, 0, 0.0F, i, j, i, j);
} }
} else if (weaponVehicle instanceof PrismTankEntity) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/lav_missile_cross.png"), k, l, 0, 0.0F, i, j, i, j);
} else { } else {
if (weaponVehicle.getWeaponIndex(0) == 0) { if (weaponVehicle.getWeaponIndex(0) == 0) {
preciseBlit(guiGraphics, Mod.loc("textures/screens/land/lav_cannon_cross.png"), k, l, 0, 0.0F, i, j, i, j); preciseBlit(guiGraphics, Mod.loc("textures/screens/land/lav_cannon_cross.png"), k, l, 0, 0.0F, i, j, i, j);

View file

@ -0,0 +1,238 @@
package com.atsuishio.superbwarfare.client.renderer.entity;
import com.atsuishio.superbwarfare.client.layer.vehicle.PrismTankLaserLayer;
import com.atsuishio.superbwarfare.client.layer.vehicle.PrismTankLightLayer;
import com.atsuishio.superbwarfare.client.model.entity.PrismTankModel;
import com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity;
import com.atsuishio.superbwarfare.event.ClientEventHandler;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Player;
import software.bernie.geckolib.cache.object.BakedGeoModel;
import software.bernie.geckolib.cache.object.GeoBone;
import software.bernie.geckolib.renderer.GeoEntityRenderer;
import static com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity.*;
public class PrismTankRenderer extends GeoEntityRenderer<PrismTankEntity> {
public PrismTankRenderer(EntityRendererProvider.Context renderManager) {
super(renderManager, new PrismTankModel());
this.addRenderLayer(new PrismTankLaserLayer(this));
this.addRenderLayer(new PrismTankLightLayer(this));
}
@Override
public RenderType getRenderType(PrismTankEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
return RenderType.entityTranslucent(getTextureLocation(animatable));
}
@Override
public void preRender(PoseStack poseStack, PrismTankEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
float scale = 1f;
this.scaleHeight = scale;
this.scaleWidth = scale;
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
}
@Override
public void render(PrismTankEntity 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())));
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())));
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
poseStack.popPose();
}
@Override
public void renderRecursively(PoseStack poseStack, PrismTankEntity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
String name = bone.getName();
for (int i = 0; i < 8; i++) {
if (name.equals("wheelL" + i)) {
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
}
if (name.equals("wheelR" + i)) {
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
}
}
if (name.equals("cannon")) {
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
}
if (name.equals("head")) {
Player player = Minecraft.getInstance().player;
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
}
if (name.equals("laser")) {
bone.setScaleZ(10 * animatable.getEntityData().get(LASER_LENGTH));
float scale = Math.min(Mth.lerp(partialTick, animatable.getEntityData().get(LASER_SCALE_O), animatable.getEntityData().get(LASER_SCALE)), 1.2f);
bone.setScaleX(scale);
bone.setScaleY(scale);
}
if (name.equals("L3") && animatable.getEnergy() > 0) {
bone.setRotY((System.currentTimeMillis() % 36000000) / 75f);
}
if (name.equals("R3") && animatable.getEnergy() > 0) {
bone.setRotY((System.currentTimeMillis() % 36000000) / 75f);
}
if (name.equals("barrel")) {
float a = animatable.getTurretYaw(partialTick);
float r = (Mth.abs(a) - 90f) / 90f;
float r2;
if (Mth.abs(a) <= 90f) {
r2 = a / 90f;
} else {
if (a < 0) {
r2 = -(180f + a) / 90f;
} else {
r2 = (180f - a) / 90f;
}
}
bone.setRotX(
-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD
);
}
if (name.equals("flare")) {
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
}
if (name.equals("flare2")) {
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
}
for (int i = 0; i < 51; i++) {
float tO = animatable.leftTrackO + 2 * i;
float t = animatable.getLeftTrack() + 2 * i;
while (t >= 100) {
t -= 100;
}
while (t <= 0) {
t += 100;
}
while (tO >= 100) {
tO -= 100;
}
while (tO <= 0) {
tO += 100;
}
float tO2 = animatable.rightTrackO + 2 * i;
float t2 = animatable.getRightTrack() + 2 * i;
while (t2 >= 100) {
t2 -= 100;
}
while (t2 <= 0) {
t2 += 100;
}
while (tO2 >= 100) {
tO2 -= 100;
}
while (tO2 <= 0) {
tO2 += 100;
}
if (name.equals("trackL" + i)) {
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO), getBoneMoveY(t)));
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO), getBoneMoveZ(t)));
}
if (name.equals("trackR" + i)) {
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO2), getBoneMoveY(t2)));
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO2), getBoneMoveZ(t2)));
}
if (name.equals("trackLRot" + i)) {
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO), getBoneRotX(t)) * Mth.DEG_TO_RAD);
}
if (name.equals("trackRRot" + i)) {
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO2), getBoneRotX(t2)) * Mth.DEG_TO_RAD);
}
}
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
}
public float getBoneRotX(float t) {
if (t <= 37.6667) return 0F;
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 0F, -45F);
if (t <= 39.75) return -45F;
if (t <= 40.6667) return Mth.lerp((t - 39.75F) / (40.6667F - 39.75F), -45F, -90F);
if (t <= 41.6667) return -90F;
if (t <= 42.5) return -90F;
if (t <= 43.5) return Mth.lerp(t - 42.5F, -90F, -135F);
if (t <= 44.5833) return -135F;
if (t <= 45.0833) return Mth.lerp((t - 44.5833F) / (45.0833F - 44.5833F), -135F, -150F);
if (t <= 52.25) return -150F;
if (t <= 52.75) return Mth.lerp((t - 52.25F) / (52.75F - 52.25F), -150F, -180F);
if (t <= 84.3333) return -180F;
if (t <= 84.9167) return Mth.lerp((t - 84.3333F) / (84.9167F - 84.3333F), -180F, -210F);
if (t <= 92.5833) return -210F;
if (t <= 93.4167) return Mth.lerp((t - 92.5833F) / (93.4167F - 92.5833F), -210F, -220F);
if (t <= 94.25) return -220F;
if (t <= 94.9167) return Mth.lerp((t - 94.25F) / (94.9167F - 94.25F), -220F, -243.33F);
if (t <= 95.75) return Mth.lerp((t - 94.9167F) / (95.75F - 94.9167F), -243.33F, -270F);
if (t <= 96.8333) return -270F;
if (t <= 97.5833) return Mth.lerp((t - 96.8333F) / (97.5833F - 96.8333F), -270F, -315F);
if (t <= 98.8333) return -315F;
if (t <= 99.5833) return Mth.lerp((t - 98.8333F) / (99.5833F - 98.8333F), -315F, -360F);
return 0F;
}
public float getBoneMoveY(float t) {
if (t <= 37.6667) return 0F;
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 0F, -1.8F);
if (t <= 40.3333) return Mth.lerp((t - 38.5833F) / (40.3333F - 38.5833F), -1.8F, -4.1F);
if (t <= 42.9167) return Mth.lerp((t - 40.3333F) / (42.9167F - 40.3333F), -4.1F, -10.3F);
if (t <= 44.25) return Mth.lerp((t - 42.9167F) / (44.25F - 42.9167F), -10.3F, -12.9F);
if (t <= 52.4167) return Mth.lerp((t - 44.25F) / (52.4167F - 44.25F), -12.9F, -23.96F);
if (t <= 84.5833) return -23.96F;
if (t <= 93) return Mth.lerp((t - 84.5833F) / (93F - 84.5833F), -23.96F, -12.93F);
if (t <= 95.25) return Mth.lerp((t - 93F) / (95.25F - 93F), -12.93F, -10.085F);
if (t <= 97.5) return Mth.lerp((t - 95.25F) / (97.5F - 95.25F), -10.085F, -4.585F);
if (t <= 98.8333) return Mth.lerp((t - 97.5F) / (98.8333F - 97.5F), -4.585F, -1.165F);
if (t <= 99.25) return Mth.lerp((t - 98.8333F) / (99.25F - 98.8333F), -1.165F, -0.25F);
return Mth.lerp((t - 99.25F) / (100F - 99.25F), -0.25F, 0F);
}
public float getBoneMoveZ(float t) {
if (t <= 37.6667) return Mth.lerp(t / (37.6667F - 0F), 0F, 111.6F);
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 111.6F, 113.25F);
if (t <= 40.3333) return Mth.lerp((t - 38.5833F) / (40.3333F - 38.5833F), 113.25F, 116F);
if (t <= 42.9167) return 116F;
if (t <= 44.25) return Mth.lerp((t - 42.9167F) / (44.25F - 42.9167F), 116F, 113.5F);
if (t <= 52.4167) return Mth.lerp((t - 44.25F) / (52.4167F - 44.25F), 113.5F, 96.25F);
if (t <= 84.5833) return Mth.lerp((t - 52.4167F) / (84.5833F - 52.4167F), 96.25F, 14.095F);
if (t <= 93) return Mth.lerp((t - 84.5833F) / (93F - 84.5833F), 14.095F, -3.565F);
if (t <= 95.25) return Mth.lerp((t - 93F) / (95.25F - 93F), -3.565F, -6.35F);
if (t <= 97.5) return Mth.lerp((t - 95.25F) / (97.5F - 95.25F), -6.35F, -6.39F);
if (t <= 98.8333) return Mth.lerp((t - 97.5F) / (98.8333F - 97.5F), -6.39F, -3.03F);
if (t <= 99.25) return Mth.lerp((t - 98.8333F) / (99.25F - 98.8333F), -3.03F, -1.95F);
return Mth.lerp((t - 99.25F) / (100F - 99.25F), -1.95F, 0F);
}
}

View file

@ -94,6 +94,16 @@ public class VehicleConfig {
public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE; public static ModConfigSpec.IntValue YX_100_HE_CANNON_EXPLOSION_DAMAGE;
public static ModConfigSpec.DoubleValue YX_100_HE_CANNON_EXPLOSION_RADIUS; public static ModConfigSpec.DoubleValue YX_100_HE_CANNON_EXPLOSION_RADIUS;
public static ModConfigSpec.IntValue PRISM_TANK_HP;
public static ModConfigSpec.IntValue PRISM_TANK_MAX_ENERGY;
public static ModConfigSpec.IntValue PRISM_TANK_ENERGY_COST;
public static ModConfigSpec.IntValue PRISM_TANK_DAMAGE_MODE_1;
public static ModConfigSpec.IntValue PRISM_TANK_SHOOT_COST_MODE_1;
public static ModConfigSpec.IntValue PRISM_TANK_AOE_DAMAGE;
public static ModConfigSpec.IntValue PRISM_TANK_AOE_RADIUS;
public static ModConfigSpec.IntValue PRISM_TANK_DAMAGE_MODE_2;
public static ModConfigSpec.IntValue PRISM_TANK_SHOOT_COST_MODE_2;
public static void init(ModConfigSpec.Builder builder) { public static void init(ModConfigSpec.Builder builder) {
builder.push("vehicle"); builder.push("vehicle");
@ -362,6 +372,38 @@ public class VehicleConfig {
builder.comment("The cannon explosion radius of Yx_100"); builder.comment("The cannon explosion radius of Yx_100");
YX_100_HE_CANNON_EXPLOSION_RADIUS = builder.defineInRange("yx_100_he_cannon_explosion_radius", 10d, 1d, 10000000d); YX_100_HE_CANNON_EXPLOSION_RADIUS = builder.defineInRange("yx_100_he_cannon_explosion_radius", 10d, 1d, 10000000d);
builder.pop();
builder.push("prism_tank");
builder.comment("The health of PrismTank");
PRISM_TANK_HP = builder.defineInRange("prism_tank_hp", 400, 1, 10000000);
builder.comment("The max energy storage of PrismTank");
PRISM_TANK_MAX_ENERGY = builder.defineInRange("prism_tank_energy", 20000000, 0, 2147483647);
builder.comment("The energy cost of PrismTank per tick");
PRISM_TANK_ENERGY_COST = builder.defineInRange("prism_tank_energy_cost", 96, 0, 2147483647);
builder.comment("The Laser Damage of PrismTank Mode 1");
PRISM_TANK_DAMAGE_MODE_1 = builder.defineInRange("prism_tank_damage_mode_1", 350, 0, 2147483647);
builder.comment("The energy cost of PrismTank Mode 1");
PRISM_TANK_SHOOT_COST_MODE_1 = builder.defineInRange("prism_tank_shoot_cost_mode_1", 100000, 1, 10000000);
builder.comment("The laser AOE damage of PrismTank");
PRISM_TANK_AOE_DAMAGE = builder.defineInRange("prism_tank_aoe_damage", 72, 1, 10000000);
builder.comment("The laser AOE radius of PrismTank");
PRISM_TANK_AOE_RADIUS = builder.defineInRange("prism_tank_aoe_radius", 12, 1, 10000000);
builder.comment("The Laser Damage of PrismTank Mode 2 per tick");
PRISM_TANK_DAMAGE_MODE_2 = builder.defineInRange("prism_tank_damage_mode_2", 15, 1, 10000000);
builder.comment("The energy cost of PrismTank Mode 2 per tick");
PRISM_TANK_SHOOT_COST_MODE_2 = builder.defineInRange("prism_tank_shoot_cost_mode_2", 5000, 1, 10000000);
builder.pop(); builder.pop();
builder.pop(); builder.pop();

View file

@ -121,7 +121,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
super.defineSynchedData(builder); super.defineSynchedData(builder);
builder.define(LOADED_ROCKET, 0) builder.define(LOADED_ROCKET, 0)
.define(PROPELLER_ROT, 0f) .define(PROPELLER_ROT, 0f)
.define(DECOY_COUNT, 6); .define(DECOY_COUNT, 3);
} }
@Override @Override
@ -258,14 +258,14 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
this.level().addFreshEntity(flareDecoyEntity); this.level().addFreshEntity(flareDecoyEntity);
} }
this.level().playSound(null, this, ModSounds.DECOY_FIRE.get(), this.getSoundSource(), 1, 1); this.level().playSound(null, this, ModSounds.DECOY_FIRE.get(), this.getSoundSource(), 1, 1);
if (this.getEntityData().get(DECOY_COUNT) == 6) { if (this.getEntityData().get(DECOY_COUNT) == 3) {
decoyReloadCoolDown = 300; decoyReloadCoolDown = 300;
} }
this.getEntityData().set(DECOY_COUNT, this.getEntityData().get(DECOY_COUNT) - 1); this.getEntityData().set(DECOY_COUNT, this.getEntityData().get(DECOY_COUNT) - 1);
} }
decoyInputDown = false; decoyInputDown = false;
} }
if (this.entityData.get(DECOY_COUNT) < 6 && decoyReloadCoolDown == 0 && this.level() instanceof ServerLevel) { if (this.entityData.get(DECOY_COUNT) < 3 && decoyReloadCoolDown == 0 && this.level() instanceof ServerLevel) {
this.entityData.set(DECOY_COUNT, this.entityData.get(DECOY_COUNT) + 1); this.entityData.set(DECOY_COUNT, this.entityData.get(DECOY_COUNT) + 1);
this.level().playSound(null, this, ModSounds.DECOY_RELOAD.get(), this.getSoundSource(), 1, 1); this.level().playSound(null, this, ModSounds.DECOY_RELOAD.get(), this.getSoundSource(), 1, 1);
decoyReloadCoolDown = 300; decoyReloadCoolDown = 300;

View file

@ -245,7 +245,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
} }
@Override @Override
public Vec3 getDeltaMovement() { public @NotNull Vec3 getDeltaMovement() {
return new Vec3(0, Math.min(super.getDeltaMovement().y, 0), 0); return new Vec3(0, Math.min(super.getDeltaMovement().y, 0), 0);
} }
@ -349,7 +349,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
private float laserLength(Vec3 pos, Entity cannon) { private float laserLength(Vec3 pos, Entity cannon) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
BlockHitResult result = cannon.level().clip(new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)), BlockHitResult result = cannon.level().clip(new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)),
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon)); ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, cannon));
Vec3 looking = Vec3.atLowerCornerOf(result.getBlockPos()); Vec3 looking = Vec3.atLowerCornerOf(result.getBlockPos());
Vec3 hitPos = result.getLocation(); Vec3 hitPos = result.getLocation();
@ -376,7 +376,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
return (float) pos.distanceTo((Vec3.atLowerCornerOf(cannon.level().clip( return (float) pos.distanceTo((Vec3.atLowerCornerOf(cannon.level().clip(
new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)), new ClipContext(pos, pos.add(cannon.getViewVector(1).scale(512)),
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, cannon)).getBlockPos()))); ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, cannon)).getBlockPos())));
} }
private float laserLengthEntity(Vec3 pos, Entity cannon) { private float laserLengthEntity(Vec3 pos, Entity cannon) {

View file

@ -41,7 +41,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MoverType;
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.Explosion; import net.minecraft.world.level.Explosion;
@ -214,20 +213,18 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
this.handleAmmo(); this.handleAmmo();
} }
double fluidFloat;
fluidFloat = 0.052 * getSubmergedHeight(this);
this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0));
if (this.onGround()) { if (this.onGround()) {
float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance()))); this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0)); this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0));
} else if (this.isInWater()) { } else {
float f1 = 0.61f + 0.08f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.95, 0.98));
}
if (this.isInWater()) {
float f1 = (float) (0.7f - (0.04f * Math.min(getSubmergedHeight(this), this.getBbHeight())) + 0.08f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90);
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance()))); this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1)); this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1));
} else {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.95, 0.99));
} }
if (this.level() instanceof ServerLevel serverLevel && this.isInWater() && this.getDeltaMovement().length() > 0.1) { if (this.level() instanceof ServerLevel serverLevel && this.isInWater() && this.getDeltaMovement().length() > 0.1) {
@ -240,7 +237,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
collideHardBlock(); collideHardBlock();
} }
turretAngle(15, 10); turretAngle(25, 25);
this.terrainCompat(4f, 5f); this.terrainCompat(4f, 5f);
inertiaRotate(1); inertiaRotate(1);
@ -280,14 +277,6 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
this.entityData.set(MISSILE_COUNT, countItem(ModItems.WIRE_GUIDE_MISSILE.get())); this.entityData.set(MISSILE_COUNT, countItem(ModItems.WIRE_GUIDE_MISSILE.get()));
} }
@Override
public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) {
super.move(movementType, movement);
if (this.isInWater() && horizontalCollision) {
setDeltaMovement(this.getDeltaMovement().add(0, 0.07, 0));
}
}
@Override @Override
public void vehicleShoot(Player player, int type) { public void vehicleShoot(Player player, int type) {
boolean hasCreativeAmmo = false; boolean hasCreativeAmmo = false;
@ -421,11 +410,11 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
} }
if (forwardInputDown) { if (forwardInputDown) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (this.entityData.get(POWER) < 0 ? 0.016f : 0.0024f), 0.21f)); this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (this.entityData.get(POWER) < 0 ? 0.004f : 0.0024f), 0.21f));
} }
if (backInputDown) { if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.016f : 0.0024f), -0.16f)); this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.004f : 0.0024f), -0.16f));
if (rightInputDown) { if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.1f); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.1f);
} else if (this.leftInputDown) { } else if (this.leftInputDown) {
@ -607,7 +596,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
} }
@Override @Override
public void onPassengerTurned(Entity entity) { public void onPassengerTurned(@NotNull Entity entity) {
this.clampRotation(entity); this.clampRotation(entity);
} }

View file

@ -37,7 +37,6 @@ import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MoverType;
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.Explosion; import net.minecraft.world.level.Explosion;
@ -218,14 +217,6 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
} }
} }
@Override
public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) {
super.move(movementType, movement);
if (this.isInWater() && horizontalCollision) {
setDeltaMovement(this.getDeltaMovement().add(0, 0.07, 0));
}
}
@Override @Override
public Vec3 getBarrelVector(float pPartialTicks) { public Vec3 getBarrelVector(float pPartialTicks) {
Matrix4f transform = getBarrelTransform(pPartialTicks); Matrix4f transform = getBarrelTransform(pPartialTicks);
@ -522,7 +513,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
} }
@Override @Override
public void onPassengerTurned(Entity entity) { public void onPassengerTurned(@NotNull Entity entity) {
this.clampRotation(entity); this.clampRotation(entity);
} }

View file

@ -0,0 +1,736 @@
package com.atsuishio.superbwarfare.entity.vehicle;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.ContainerMobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.LandArmorEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.ThirdPersonCameraPosition;
import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
import com.atsuishio.superbwarfare.entity.vehicle.weapon.LaserWeapon;
import com.atsuishio.superbwarfare.entity.vehicle.weapon.VehicleWeapon;
import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.init.ModTags;
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
import com.atsuishio.superbwarfare.network.message.receive.ShakeClientMessage;
import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.mojang.math.Axis;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.Holder;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.protocol.game.ClientboundSoundPacket;
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.ServerPlayer;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundSource;
import net.minecraft.util.Mth;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MoverType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.ProjectileUtil;
import net.minecraft.world.level.ClipContext;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.*;
import net.neoforged.neoforge.capabilities.Capabilities;
import net.neoforged.neoforge.event.EventHooks;
import net.neoforged.neoforge.network.PacketDistributor;
import org.jetbrains.annotations.NotNull;
import org.joml.Math;
import org.joml.Matrix4f;
import org.joml.Vector4f;
import software.bernie.geckolib.animatable.GeoEntity;
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
import software.bernie.geckolib.animation.AnimatableManager;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.Comparator;
import java.util.List;
import java.util.stream.StreamSupport;
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
import static com.atsuishio.superbwarfare.tools.SeekTool.baseFilter;
public class PrismTankEntity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
public static final EntityDataAccessor<Integer> CANNON_FIRE_TIME = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Float> LASER_LENGTH = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Float> LASER_SCALE = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.FLOAT);
public static final EntityDataAccessor<Float> LASER_SCALE_O = SynchedEntityData.defineId(PrismTankEntity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public PrismTankEntity(EntityType<PrismTankEntity> type, Level world) {
super(type, world);
this.noCulling = true;
}
@Override
public float maxUpStep() {
return 2.25f;
}
@Override
public VehicleWeapon[][] initWeapons() {
return new VehicleWeapon[][]{
new VehicleWeapon[]{
new LaserWeapon()
.sound(ModSounds.INTO_MISSILE.get()),
new LaserWeapon()
.sound(ModSounds.INTO_CANNON.get())
}
};
}
@Override
public ThirdPersonCameraPosition getThirdPersonCameraPosition(int index) {
return new ThirdPersonCameraPosition(4, 1, 1);
}
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
builder.define(CANNON_FIRE_TIME, 0)
.define(LASER_LENGTH, 0f)
.define(LASER_SCALE, 0f)
.define(LASER_SCALE_O, 0f);
}
@Override
public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound);
}
@Override
public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound);
}
@Override
public DamageModifier getDamageModifier() {
return super.getDamageModifier()
.multiply(0.2f)
.multiply(1.5f, DamageTypes.ARROW)
.multiply(1.5f, DamageTypes.TRIDENT)
.multiply(2.5f, DamageTypes.MOB_ATTACK)
.multiply(2f, DamageTypes.MOB_ATTACK_NO_AGGRO)
.multiply(1.5f, DamageTypes.MOB_PROJECTILE)
.multiply(12.5f, DamageTypes.LAVA)
.multiply(6f, DamageTypes.EXPLOSION)
.multiply(6f, DamageTypes.PLAYER_EXPLOSION)
.multiply(2f, ModDamageTypes.CUSTOM_EXPLOSION)
.multiply(2f, ModDamageTypes.PROJECTILE_BOOM)
.multiply(0.7f, ModDamageTypes.MINE)
.multiply(0.9f, ModDamageTypes.LUNGE_MINE)
.multiply(1.5f, ModDamageTypes.CANNON_FIRE)
.multiply(0.1f, ModTags.DamageTypes.PROJECTILE)
.multiply(0.7f, ModTags.DamageTypes.PROJECTILE_ABSOLUTE)
.multiply(4.5f, ModDamageTypes.VEHICLE_STRIKE)
.custom((source, damage) -> getSourceAngle(source, 0.4f) * damage)
.custom((source, damage) -> {
if (source.getDirectEntity() instanceof MelonBombEntity) {
return 2f * damage;
}
if (source.getDirectEntity() instanceof MortarShellEntity) {
return 3f * damage;
}
return damage;
})
.reduce(9);
}
@Override
protected void playStepSound(@NotNull BlockPos pPos, @NotNull BlockState pState) {
this.playSound(ModSounds.BMP_STEP.get(), Mth.abs(this.entityData.get(POWER)) * 8, random.nextFloat() * 0.15f + 1f);
}
@Override
public double getSubmergedHeight(Entity entity) {
return super.getSubmergedHeight(entity);
}
@Override
public void baseTick() {
this.entityData.set(LASER_SCALE_O, this.entityData.get(LASER_SCALE));
super.baseTick();
if (getLeftTrack() < 0) {
setLeftTrack(100);
}
if (getLeftTrack() > 100) {
setLeftTrack(0);
}
if (getRightTrack() < 0) {
setRightTrack(100);
}
if (getRightTrack() > 100) {
setRightTrack(0);
}
if (this.entityData.get(LASER_SCALE) > 0) {
this.entityData.set(LASER_SCALE, Math.max(this.entityData.get(LASER_SCALE) - 0.1f, 0));
this.entityData.set(LASER_SCALE, this.entityData.get(LASER_SCALE) * 0.9f);
}
if (this.entityData.get(LASER_SCALE) == 0) {
this.entityData.set(LASER_LENGTH, 0f);
}
if (this.onGround()) {
float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0));
} else if (this.isInWater()) {
float f1 = 0.61f + 0.08f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance())));
this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1));
} else {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.95, 0.99));
}
if (this.level() instanceof ServerLevel serverLevel && this.isInWater() && this.getDeltaMovement().length() > 0.1) {
sendParticle(serverLevel, ParticleTypes.CLOUD, this.getX() + 0.5 * this.getDeltaMovement().x, this.getY() + getSubmergedHeight(this) - 0.2, this.getZ() + 0.5 * this.getDeltaMovement().z, (int) (2 + 4 * this.getDeltaMovement().length()), 0.65, 0, 0.65, 0, true);
sendParticle(serverLevel, ParticleTypes.BUBBLE_COLUMN_UP, this.getX() + 0.5 * this.getDeltaMovement().x, this.getY() + getSubmergedHeight(this) - 0.2, this.getZ() + 0.5 * this.getDeltaMovement().z, (int) (2 + 10 * this.getDeltaMovement().length()), 0.65, 0, 0.65, 0, true);
}
collideBlock();
if (this.getDeltaMovement().length() > 0.1) {
collideHardBlock();
}
turretAngle(15, 10);
this.terrainCompat(4.6375f, 5.171875f);
inertiaRotate(1);
lowHealthWarning();
this.refreshDimensions();
}
@Override
public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) {
super.move(movementType, movement);
if (this.isInWater() && horizontalCollision) {
setDeltaMovement(this.getDeltaMovement().add(0, 0.07, 0));
}
}
@Override
public void vehicleShoot(Player player, int type) {
Matrix4f transform = getBarrelTransform(1);
Vector4f worldPosition = transformPosition(transform, 0, 0.5f, 0);
Vec3 root = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
if (getWeaponIndex(0) == 0) {
if (this.cannotFire) return;
if (!this.canConsume(VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_1.get())) {
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
return;
}
Level level = player.level();
if (level instanceof ServerLevel) {
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.playSound(ModSounds.PRISM_FIRE_3P.get(), 5, 1);
}
}
this.entityData.set(HEAT, entityData.get(HEAT) + 55);
this.consumeEnergy(VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_1.get());
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(5), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
if (target instanceof ServerPlayer serverPlayer) {
PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(8, 4, 7, this.getX(), this.getEyeY(), this.getZ()));
}
}
}
float dis = laserLengthEntity(root);
if (dis < laserLength(root)) {
this.entityData.set(LASER_LENGTH, dis);
} else {
this.entityData.set(LASER_LENGTH, laserLength(root));
hitBlock(root);
}
this.entityData.set(LASER_SCALE, 3f);
} else if (getWeaponIndex(0) == 1) {
if (this.cannotFire) return;
if (!this.canConsume(VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_2.get())) {
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
return;
}
Level level = player.level();
if (level instanceof ServerLevel) {
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.playSound(ModSounds.PRISM_FIRE_3P_2.get(), 4, 1);
}
}
this.entityData.set(HEAT, entityData.get(HEAT) + 2);
this.consumeEnergy(VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_2.get());
}
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(2), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
if (target instanceof ServerPlayer serverPlayer) {
PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(5, 3, 3, this.getX(), this.getEyeY(), this.getZ()));
}
}
float dis = laserLengthEntity(root);
if (dis < laserLength(root)) {
this.entityData.set(LASER_LENGTH, dis);
} else {
this.entityData.set(LASER_LENGTH, laserLength(root));
hitBlock(root);
}
this.entityData.set(LASER_SCALE, 1f);
}
}
private void hitBlock(Vec3 pos) {
if (this.level() instanceof ServerLevel) {
BlockHitResult result = this.level().clip(new ClipContext(pos, pos.add(this.getBarrelVector(1).scale(512)),
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this));
Vec3 hitPos = result.getLocation();
if (this.getFirstPassenger() != null && level() instanceof ServerLevel serverLevel) {
if (getWeaponIndex(0) == 0) {
findNearEntity(hitPos);
sendParticle(serverLevel, ParticleTypes.END_ROD, hitPos.x, hitPos.y, hitPos.z, 24, 0, 0, 0, 0.2, true);
sendParticle(serverLevel, ParticleTypes.LAVA, hitPos.x, hitPos.y, hitPos.z, 8, 0, 0, 0, 0.4, true);
} else {
sendParticle(serverLevel, ParticleTypes.END_ROD, hitPos.x, hitPos.y, hitPos.z, 4, 0, 0, 0, 0.05, true);
sendParticle(serverLevel, ParticleTypes.LAVA, hitPos.x, hitPos.y, hitPos.z, 2, 0, 0, 0, 0.15, true);
}
}
}
}
private float laserLength(Vec3 pos) {
return (float) pos.distanceTo((Vec3.atLowerCornerOf(level().clip(
new ClipContext(pos, pos.add(this.getBarrelVector(1).scale(512)),
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, this)).getBlockPos())));
}
private float laserLengthEntity(Vec3 pos) {
if (this.level() instanceof ServerLevel) {
double distance = 512 * 512;
HitResult hitResult = pickNew(pos, 512);
if (hitResult.getType() != HitResult.Type.MISS) {
distance = hitResult.getLocation().distanceToSqr(pos);
double blockReach = 5;
if (distance > blockReach * blockReach) {
Vec3 posB = hitResult.getLocation();
hitResult = BlockHitResult.miss(posB, Direction.getNearest(pos.x, pos.y, pos.z), BlockPos.containing(posB));
}
}
Vec3 viewVec = getBarrelVector(1);
Vec3 toVec = pos.add(viewVec.x * 512, viewVec.y * 512, viewVec.z * 512);
AABB aabb = getBoundingBox().expandTowards(viewVec.scale(512)).inflate(1.0D, 1.0D, 1.0D);
EntityHitResult entityhitresult = ProjectileUtil.getEntityHitResult(this, pos, toVec, aabb, p -> !p.isSpectator() && p.isAlive(), distance);
if (entityhitresult != null) {
Vec3 targetPos = entityhitresult.getLocation();
double distanceToTarget = pos.distanceToSqr(targetPos);
if (distanceToTarget > distance || distanceToTarget > 512 * 512) {
hitResult = BlockHitResult.miss(targetPos, Direction.getNearest(viewVec.x, viewVec.y, viewVec.z), BlockPos.containing(targetPos));
} else if (distanceToTarget < distance) {
hitResult = entityhitresult;
}
if (hitResult.getType() == HitResult.Type.ENTITY) {
Entity passenger = this.getFirstPassenger();
Entity target = ((EntityHitResult) hitResult).getEntity();
if (passenger != null) {
if (level() instanceof ServerLevel serverLevel) {
target.hurt(ModDamageTypes.causeLaserDamage(this.level().registryAccess(), this, passenger), getWeaponIndex(0) == 0 ? VehicleConfig.PRISM_TANK_DAMAGE_MODE_1.get() : VehicleConfig.PRISM_TANK_DAMAGE_MODE_2.get());
Vec3 vec = pos.scale(pos.distanceTo(target.position()));
if (getWeaponIndex(0) == 0) {
findNearEntity(target.getEyePosition());
sendParticle(serverLevel, ParticleTypes.END_ROD, vec.x, vec.y, vec.z, 24, 0, 0, 0, 0.2, true);
sendParticle(serverLevel, ParticleTypes.LAVA, vec.x, vec.y, vec.z, 8, 0, 0, 0, 0.4, true);
} else {
sendParticle(serverLevel, ParticleTypes.END_ROD, vec.x, vec.y, vec.z, 4, 0, 0, 0, 0.05, true);
sendParticle(serverLevel, ParticleTypes.LAVA, vec.x, vec.y, vec.z, 2, 0, 0, 0, 0.15, true);
}
if (getFirstPassenger() != null && !getFirstPassenger().level().isClientSide() && getFirstPassenger() instanceof ServerPlayer player) {
var holder = Holder.direct(ModSounds.INDICATION.get());
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
}
}
}
target.invulnerableTime = 1;
return (float) pos.distanceTo(target.position());
}
}
}
return 512;
}
public void findNearEntity(Vec3 vec) {
int aoeDamage = VehicleConfig.PRISM_TANK_AOE_DAMAGE.get();
int range = VehicleConfig.PRISM_TANK_AOE_RADIUS.get();
if (level() instanceof ServerLevel serverLevel) {
List<Entity> entities = seekNearEntities(vec, level(), range);
for (var e : entities) {
double dis = vec.distanceTo(e.getEyePosition());
for (float i = 0; i < dis; i += 0.2f) {
Vec3 toVec = vec.vectorTo(e.getEyePosition()).normalize();
Vec3 pos = vec.add(toVec.scale(i));
sendParticle(serverLevel, ParticleTypes.END_ROD, pos.x, pos.y, pos.z, 1, 0, 0, 0, 0, true);
}
sendParticle(serverLevel, ParticleTypes.LAVA, e.getX(), e.getEyeY(), e.getZ(), 4, 0, 0, 0, 0.15, true);
e.hurt(ModDamageTypes.causeLaserDamage(this.level().registryAccess(), this, this.getFirstPassenger()), (float) (aoeDamage - Mth.clamp(dis / range, 0, 0.75) * aoeDamage));
if (getFirstPassenger() != null && !getFirstPassenger().level().isClientSide() && getFirstPassenger() instanceof ServerPlayer player) {
var holder = Holder.direct(ModSounds.INDICATION.get());
player.connection.send(new ClientboundSoundPacket(holder, SoundSource.PLAYERS, player.getX(), player.getY(), player.getZ(), 1f, 1f, player.level().random.nextLong()));
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
}
}
}
}
public List<Entity> seekNearEntities(Vec3 vec3, Level level, double seekRange) {
return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false)
.filter(e -> e.position().distanceTo(vec3) <= seekRange
&& e != this
&& e.getVehicle() != this
&& baseFilter(e)
&& e.getVehicle() == null
&& (!e.isAlliedTo(this) || e.getTeam() == null || e.getTeam().getName().equals("TDM"))).toList();
}
public HitResult pickNew(Vec3 pos, double pHitDistance) {
Vec3 vec31 = this.getBarrelVector(1);
Vec3 vec32 = pos.add(vec31.x * pHitDistance, vec31.y * pHitDistance, vec31.z * pHitDistance);
return this.level().clip(new ClipContext(pos, vec32, ClipContext.Block.COLLIDER, ClipContext.Fluid.ANY, this));
}
@Override
public void travel() {
Entity passenger0 = this.getFirstPassenger();
if (this.getEnergy() <= 0) return;
if (passenger0 == null) {
this.leftInputDown = false;
this.rightInputDown = false;
this.forwardInputDown = false;
this.backInputDown = false;
this.entityData.set(POWER, 0f);
}
if (forwardInputDown) {
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (this.entityData.get(POWER) < 0 ? 0.004f : 0.0024f), 0.24f));
}
if (backInputDown) {
this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.004f : 0.0024f), -0.16f));
if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.1f);
} else if (this.leftInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.1f);
}
} else {
if (rightInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) - 0.1f);
} else if (this.leftInputDown) {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) + 0.1f);
}
}
if (this.forwardInputDown || this.backInputDown) {
this.consumeEnergy(VehicleConfig.PRISM_TANK_ENERGY_COST.get());
}
this.entityData.set(POWER, this.entityData.get(POWER) * (upInputDown ? 0.5f : (rightInputDown || leftInputDown) ? 0.947f : 0.96f));
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float) Math.max(0.76f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3));
float angle = (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1));
double s0;
if (Mth.abs(angle) < 90) {
s0 = this.getDeltaMovement().horizontalDistance();
} else {
s0 = -this.getDeltaMovement().horizontalDistance();
}
this.setLeftWheelRot((float) ((this.getLeftWheelRot() - 1.25 * s0) + Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
this.setRightWheelRot((float) ((this.getRightWheelRot() - 1.25 * s0) - Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
if (this.isInWater() || onGround()) {
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale((!isInWater() && !onGround() ? 0.13f : (isInWater() && !onGround() ? 2 : 2.4f)) * this.entityData.get(POWER))));
}
}
@Override
public SoundEvent getEngineSound() {
return ModSounds.BMP_ENGINE.get();
}
@Override
public void positionRider(@NotNull Entity passenger, @NotNull MoveFunction callback) {
// From Immersive_Aircraft
if (!this.hasPassenger(passenger)) {
return;
}
Matrix4f transform = getTurretTransform(1);
Matrix4f transformV = getVehicleTransform(1);
int i = this.getSeatIndex(passenger);
Vector4f worldPosition;
if (i == 0) {
worldPosition = transformPosition(transform, 0, -0.6f, 0);
} else {
worldPosition = transformPosition(transformV, -0.59375f, 1f, 3.0625f);
}
passenger.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
callback.accept(passenger, worldPosition.x, worldPosition.y, worldPosition.z);
copyEntityData(passenger);
}
public void copyEntityData(Entity entity) {
if (entity == getNthEntity(0)) {
entity.setYBodyRot(getBarrelYRot(1));
}
if (entity == getNthEntity(1)) {
entity.setYBodyRot(getYRot());
}
}
public int getMaxPassengers() {
return 2;
}
public Vec3 driverPos(float ticks) {
Matrix4f transform = getBarrelTransform(ticks);
Vector4f worldPosition = transformPosition(transform, 0.5f, 1.2f, -0.1f);
return new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
}
public Vec3 driverZoomPos(float ticks) {
Matrix4f transform = getBarrelTransform(ticks);
Vector4f worldPosition = transformPosition(transform, 0, 0.95f, 0f);
return new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
}
@Override
public Vec3 getBarrelVector(float pPartialTicks) {
Matrix4f transform = getBarrelTransform(pPartialTicks);
Vector4f rootPosition = transformPosition(transform, 0, 0, 0);
Vector4f targetPosition = transformPosition(transform, 0, 0, 1);
return new Vec3(rootPosition.x, rootPosition.y, rootPosition.z).vectorTo(new Vec3(targetPosition.x, targetPosition.y, targetPosition.z));
}
public Matrix4f getBarrelTransform(float ticks) {
Matrix4f transformT = getTurretTransform(ticks);
Matrix4f transform = new Matrix4f();
Vector4f worldPosition = transformPosition(transform, 0, 1.484375f, -0.2375f);
transformT.translate(worldPosition.x, worldPosition.y, worldPosition.z);
float a = getTurretYaw(ticks);
float r = (Mth.abs(a) - 90f) / 90f;
float r2;
if (Mth.abs(a) <= 90f) {
r2 = a / 90f;
} else {
if (a < 0) {
r2 = -(180f + a) / 90f;
} else {
r2 = (180f - a) / 90f;
}
}
float x = Mth.lerp(ticks, turretXRotO, getTurretXRot());
float xV = Mth.lerp(ticks, xRotO, getXRot());
float z = Mth.lerp(ticks, prevRoll, getRoll());
transformT.rotate(Axis.XP.rotationDegrees(x + r * xV + r2 * z));
return transformT;
}
public Matrix4f getTurretTransform(float ticks) {
Matrix4f transformV = getVehicleTransform(ticks);
Matrix4f transform = new Matrix4f();
Vector4f worldPosition = transformPosition(transform, 0, 2.14375f, 0.7375f);
transformV.translate(worldPosition.x, worldPosition.y, worldPosition.z);
transformV.rotate(Axis.YP.rotationDegrees(Mth.lerp(ticks, turretYRotO, getTurretYRot())));
return transformV;
}
@Override
public void destroy() {
if (level() instanceof ServerLevel) {
CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 80f,
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
explosion.explode();
EventHooks.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false);
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
}
explodePassengers();
this.discard();
}
protected void clampRotation(Entity entity) {
if (entity == getNthEntity(0)) {
float a = getTurretYaw(1);
float r = (Mth.abs(a) - 90f) / 90f;
float r2;
if (Mth.abs(a) <= 90f) {
r2 = a / 90f;
} else {
if (a < 0) {
r2 = -(180f + a) / 90f;
} else {
r2 = (180f - a) / 90f;
}
}
float min = -32.5f - r * getXRot() - r2 * getRoll();
float max = 15f - r * getXRot() - r2 * getRoll();
float f = Mth.wrapDegrees(entity.getXRot());
float f1 = Mth.clamp(f, min, max);
entity.xRotO += f1 - f;
entity.setXRot(entity.getXRot() + f1 - f);
entity.setYBodyRot(getBarrelYRot(1));
}
if (entity == getNthEntity(1)) {
float f = Mth.wrapDegrees(entity.getXRot());
float f1 = Mth.clamp(f, -80.0F, 10F);
entity.xRotO += f1 - f;
entity.setXRot(entity.getXRot() + f1 - f);
float f2 = Mth.wrapDegrees(entity.getYRot() - this.getYRot());
float f3 = Mth.clamp(f2, -100.0F, 100.0F);
entity.yRotO += f3 - f2;
entity.setYRot(entity.getYRot() + f3 - f2);
entity.setYBodyRot(this.getYRot());
}
}
@Override
public void onPassengerTurned(@NotNull Entity entity) {
this.clampRotation(entity);
}
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
}
@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.cache;
}
@Override
public int getMaxEnergy() {
return VehicleConfig.PRISM_TANK_MAX_ENERGY.get();
}
@Override
public float getMaxHealth() {
return VehicleConfig.PRISM_TANK_HP.get();
}
@Override
public int mainGunRpm(Player player) {
if (getWeaponIndex(0) == 0) {
return 30;
} else if (getWeaponIndex(0) == 1) {
return 1200;
}
return 20;
}
@Override
public boolean canShoot(Player player) {
if (getWeaponIndex(0) == 0) {
return getEnergy() > VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_1.get() && !cannotFire;
} else if (getWeaponIndex(0) == 1) {
return getEnergy() > VehicleConfig.PRISM_TANK_SHOOT_COST_MODE_2.get() && !cannotFire;
}
return false;
}
@Override
public int getAmmoCount(Player player) {
var cap = this.getCapability(Capabilities.EnergyStorage.ENTITY, null);
if (cap == null) return 0;
return (int) (cap.getEnergyStored() / 100f / this.getMaxEnergy());
}
@Override
public boolean banHand(Player player) {
return player == getFirstPassenger();
}
@Override
public boolean hidePassenger(Entity entity) {
return entity == getFirstPassenger();
}
@Override
public int zoomFov() {
return 3;
}
@Override
public ResourceLocation getVehicleIcon() {
return Mod.loc("textures/vehicle_icon/prism_tank_icon.png");
}
}

View file

@ -69,7 +69,9 @@ import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity { public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEntity, LandArmorEntity, WeaponVehicleEntity {
public static final EntityDataAccessor<Integer> MG_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> MG_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> LOADED_AMMO = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> LOADED_AP = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> LOADED_HE = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> LOADED_AMMO_TYPE = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> GUN_FIRE_TIME = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> GUN_FIRE_TIME = SynchedEntityData.defineId(Yx100Entity.class, EntityDataSerializers.INT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -111,6 +113,15 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
.sound(ModSounds.INTO_CANNON.get()) .sound(ModSounds.INTO_CANNON.get())
.ammo(ModItems.HE_5_INCHES.get()) .ammo(ModItems.HE_5_INCHES.get())
.icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png")), .icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png")),
// 同轴重机枪
new ProjectileWeapon()
.damage(VehicleConfig.HEAVY_MACHINE_GUN_DAMAGE.get())
.headShot(2)
.zoom(false)
.bypassArmorRate(0.4f)
.ammo(ModItems.HEAVY_AMMO.get())
.sound(ModSounds.INTO_CANNON.get())
.icon(Mod.loc("textures/screens/vehicle_weapon/gun_12_7mm.png")),
}, },
new VehicleWeapon[]{ new VehicleWeapon[]{
// 机枪 // 机枪
@ -138,14 +149,18 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
protected void defineSynchedData(SynchedEntityData.Builder builder) { protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder); super.defineSynchedData(builder);
builder.define(MG_AMMO, 0) builder.define(MG_AMMO, 0)
.define(LOADED_AMMO, 0) .define(LOADED_AP, 0)
.define(LOADED_HE, 0)
.define(LOADED_AMMO_TYPE, 0)
.define(GUN_FIRE_TIME, 0); .define(GUN_FIRE_TIME, 0);
} }
@Override @Override
public void addAdditionalSaveData(CompoundTag compound) { public void addAdditionalSaveData(CompoundTag compound) {
super.addAdditionalSaveData(compound); super.addAdditionalSaveData(compound);
compound.putInt("LoadedAmmo", this.entityData.get(LOADED_AMMO)); compound.putInt("LoadedAP", this.entityData.get(LOADED_AP));
compound.putInt("LoadedHE", this.entityData.get(LOADED_HE));
compound.putInt("LoadedAmmoType", this.entityData.get(LOADED_AMMO_TYPE));
compound.putInt("WeaponType", getWeaponIndex(0)); compound.putInt("WeaponType", getWeaponIndex(0));
compound.putInt("PassengerWeaponType", getWeaponIndex(1)); compound.putInt("PassengerWeaponType", getWeaponIndex(1));
} }
@ -153,7 +168,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
@Override @Override
public void readAdditionalSaveData(CompoundTag compound) { public void readAdditionalSaveData(CompoundTag compound) {
super.readAdditionalSaveData(compound); super.readAdditionalSaveData(compound);
this.entityData.set(LOADED_AMMO, compound.getInt("LoadedAmmo")); this.entityData.set(LOADED_AP, compound.getInt("LoadedAP"));
this.entityData.set(LOADED_HE, compound.getInt("LoadedHE"));
this.entityData.set(LOADED_AMMO_TYPE, compound.getInt("LoadedAmmoType"));
setWeaponIndex(0, compound.getInt("WeaponType")); setWeaponIndex(0, compound.getInt("WeaponType"));
setWeaponIndex(1, compound.getInt("PassengerWeaponType")); setWeaponIndex(1, compound.getInt("PassengerWeaponType"));
} }
@ -282,6 +299,10 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
private void handleAmmo() { private void handleAmmo() {
if (getWeaponIndex(0) == 0 || getWeaponIndex(0) == 1) {
entityData.set(LOADED_AMMO_TYPE, getWeaponIndex(0));
}
boolean hasCreativeAmmo = false; boolean hasCreativeAmmo = false;
if (this.getFirstPassenger() instanceof Player player) { if (this.getFirstPassenger() instanceof Player player) {
@ -296,11 +317,17 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
this.entityData.set(MG_AMMO, countItem(getWeapon(1).ammo)); this.entityData.set(MG_AMMO, countItem(getWeapon(1).ammo));
} }
if (this.getEntityData().get(LOADED_AMMO) == 0 if ((this.getEntityData().get(LOADED_AP) == 0 || this.getEntityData().get(LOADED_HE) == 0)
&& reloadCoolDown <= 0 && reloadCoolDown <= 0
&& (hasCreativeAmmo || hasItem(getWeapon(0).ammo)) && (hasCreativeAmmo || hasItem(getWeapon(0).ammo))
) { ) {
this.entityData.set(LOADED_AMMO, 1);
if (entityData.get(LOADED_AMMO_TYPE) == 0) {
this.entityData.set(LOADED_AP, 1);
} else if (entityData.get(LOADED_AMMO_TYPE) == 1) {
this.entityData.set(LOADED_HE, 1);
}
if (!hasCreativeAmmo) { if (!hasCreativeAmmo) {
consumeItem(getWeapon(0).ammo, 1); consumeItem(getWeapon(0).ammo, 1);
} }
@ -323,89 +350,139 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
hasCreativeAmmo = true; hasCreativeAmmo = true;
} }
} }
if (reloadCoolDown == 0 && type == 0) { if (type == 0) {
if (reloadCoolDown == 0 && (getWeaponIndex(0) == 0 || getWeaponIndex(0) == 1)) {
if (!this.canConsume(VehicleConfig.YX_100_SHOOT_COST.get())) { if (!this.canConsume(VehicleConfig.YX_100_SHOOT_COST.get())) {
player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true); player.displayClientMessage(Component.translatable("tips.superbwarfare.annihilator.energy_not_enough").withStyle(ChatFormatting.RED), true);
return; return;
}
Matrix4f transform = getBarrelTransform(1);
Vector4f worldPosition = transformPosition(transform, 0, 0, 0);
var cannonShell = (CannonShellWeapon) getWeapon(0);
var entityToSpawn = cannonShell.create(player);
entityToSpawn.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
entityToSpawn.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, cannonShell.velocity, 0.02f);
level().addFreshEntity(entityToSpawn);
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.playSound(ModSounds.YX_100_FIRE_3P.get(), 8, 1);
serverPlayer.playSound(ModSounds.YX_100_FAR.get(), 16, 1);
serverPlayer.playSound(ModSounds.YX_100_VERYFAR.get(), 32, 1);
} }
}
this.entityData.set(CANNON_RECOIL_TIME, 40); Matrix4f transform = getBarrelTransform(1);
this.entityData.set(LOADED_AMMO, 0); Vector4f worldPosition = transformPosition(transform, 0, 0, 0);
this.consumeEnergy(10000);
this.entityData.set(YAW, getTurretYRot());
reloadCoolDown = 80; var cannonShell = (CannonShellWeapon) getWeapon(0);
var entityToSpawn = cannonShell.create(player);
if (this.level() instanceof ServerLevel server) { entityToSpawn.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, entityToSpawn.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, cannonShell.velocity, 0.02f);
this.getX() + 5 * getBarrelVector(1).x, level().addFreshEntity(entityToSpawn);
this.getY() + 0.1,
this.getZ() + 5 * getBarrelVector(1).z,
300, 6, 0.02, 6, 0.005);
double x = worldPosition.x + 9 * getBarrelVector(1).x; if (!player.level().isClientSide) {
double y = worldPosition.y + 9 * getBarrelVector(1).y; if (player instanceof ServerPlayer serverPlayer) {
double z = worldPosition.z + 9 * getBarrelVector(1).z; serverPlayer.playSound(ModSounds.YX_100_FIRE_3P.get(), 8, 1);
serverPlayer.playSound(ModSounds.YX_100_FAR.get(), 16, 1);
serverPlayer.playSound(ModSounds.YX_100_VERYFAR.get(), 32, 1);
}
}
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075); this.entityData.set(CANNON_RECOIL_TIME, 40);
server.sendParticles(ParticleTypes.CLOUD, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
int count = 6; if (getWeaponIndex(0) == 0) {
this.entityData.set(LOADED_AP, 0);
} else if (getWeaponIndex(0) == 1) {
this.entityData.set(LOADED_HE, 0);
}
for (float i = 9.5f; i < 23; i += .5f) { this.consumeEnergy(10000);
this.entityData.set(YAW, getTurretYRot());
reloadCoolDown = 80;
if (this.level() instanceof ServerLevel server) {
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
worldPosition.x + i * getBarrelVector(1).x, this.getX() + 5 * getBarrelVector(1).x,
worldPosition.y + i * getBarrelVector(1).y, this.getY() + 0.1,
worldPosition.z + i * getBarrelVector(1).z, this.getZ() + 5 * getBarrelVector(1).z,
Mth.clamp(count--, 1, 5), 0.15, 0.15, 0.15, 0.0025); 300, 6, 0.02, 6, 0.005);
double x = worldPosition.x + 9 * getBarrelVector(1).x;
double y = worldPosition.y + 9 * getBarrelVector(1).y;
double z = worldPosition.z + 9 * getBarrelVector(1).z;
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
server.sendParticles(ParticleTypes.CLOUD, x, y, z, 10, 0.4, 0.4, 0.4, 0.0075);
int count = 6;
for (float i = 9.5f; i < 23; i += .5f) {
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
worldPosition.x + i * getBarrelVector(1).x,
worldPosition.y + i * getBarrelVector(1).y,
worldPosition.z + i * getBarrelVector(1).z,
Mth.clamp(count--, 1, 5), 0.15, 0.15, 0.15, 0.0025);
}
Vector4f worldPositionL = transformPosition(transform, -0.35f, 0, 0);
Vector4f worldPositionR = transformPosition(transform, 0.35f, 0, 0);
for (float i = 3f; i < 6; i += .5f) {
server.sendParticles(ParticleTypes.CLOUD,
worldPositionL.x + i * getBarrelVector(1).x,
worldPositionL.y + i * getBarrelVector(1).y,
worldPositionL.z + i * getBarrelVector(1).z,
1, 0.025, 0.025, 0.025, 0.0015);
server.sendParticles(ParticleTypes.CLOUD,
worldPositionR.x + i * getBarrelVector(1).x,
worldPositionR.y + i * getBarrelVector(1).y,
worldPositionR.z + i * getBarrelVector(1).z,
1, 0.025, 0.025, 0.025, 0.0015);
}
} }
Vector4f worldPositionL = transformPosition(transform, -0.35f, 0, 0);
Vector4f worldPositionR = transformPosition(transform, 0.35f, 0, 0);
for (float i = 3f; i < 6; i += .5f) { Level level = player.level();
server.sendParticles(ParticleTypes.CLOUD, final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
worldPositionL.x + i * getBarrelVector(1).x,
worldPositionL.y + i * getBarrelVector(1).y,
worldPositionL.z + i * getBarrelVector(1).z,
1, 0.025, 0.025, 0.025, 0.0015);
server.sendParticles(ParticleTypes.CLOUD, for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(8), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
worldPositionR.x + i * getBarrelVector(1).x, if (target instanceof ServerPlayer serverPlayer) {
worldPositionR.y + i * getBarrelVector(1).y, PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(10, 8, 60, this.getX(), this.getEyeY(), this.getZ()));
worldPositionR.z + i * getBarrelVector(1).z, }
1, 0.025, 0.025, 0.025, 0.0015); }
} else if (getWeaponIndex(0) == 2) {
if (this.cannotFireCoax) return;
Matrix4f transform = getBarrelTransform(1);
Vector4f worldPosition = transformPosition(transform, -0.12f, 0.15f, 2f);
if (this.entityData.get(MG_AMMO) > 0 || hasCreativeAmmo) {
var projectileRight = ((ProjectileWeapon) getWeapon(0)).create(player);
projectileRight.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
projectileRight.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 36,
0.25f);
this.level().addFreshEntity(projectileRight);
if (!hasCreativeAmmo) {
ItemStack ammoBox = this.getItemStacks().stream().filter(stack -> {
if (stack.is(ModItems.AMMO_BOX.get())) {
return AmmoType.HEAVY.get(stack) > 0;
}
return false;
}).findFirst().orElse(ItemStack.EMPTY);
if (!ammoBox.isEmpty()) {
AmmoType.HEAVY.add(ammoBox, -1);
} else {
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
}
}
}
this.entityData.set(COAX_HEAT, this.entityData.get(COAX_HEAT) + 4);
this.entityData.set(FIRE_ANIM, 2);
float pitch = this.entityData.get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - this.entityData.get(COAX_HEAT)));
if (!player.level().isClientSide) {
if (player instanceof ServerPlayer serverPlayer) {
serverPlayer.playSound(ModSounds.M_2_FIRE_3P.get(), 4, pitch);
serverPlayer.playSound(ModSounds.M_2_FAR.get(), 12, pitch);
serverPlayer.playSound(ModSounds.M_2_VERYFAR.get(), 24, pitch);
}
} }
} }
Level level = player.level();
final Vec3 center = new Vec3(this.getX(), this.getEyeY(), this.getZ());
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(8), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
if (target instanceof ServerPlayer serverPlayer) {
PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(10, 8, 60, this.getX(), this.getEyeY(), this.getZ()));
}
}
} }
if (type == 1) { if (type == 1) {
@ -417,7 +494,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
var projectileEntity = projectile.create(player); var projectileEntity = projectile.create(player);
projectileEntity.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z); projectileEntity.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
projectileEntity.shoot(getGunnerVector(1).x, getGunnerVector(1).y, getGunnerVector(1).z, 20, 0.3f); projectileEntity.shoot(getGunnerVector(1).x, getGunnerVector(1).y + 0.005f, getGunnerVector(1).z, 20, 0.3f);
this.level().addFreshEntity(projectileEntity); this.level().addFreshEntity(projectileEntity);
@ -786,6 +863,14 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.yx100.idle")); return event.setAndContinue(RawAnimation.begin().thenLoop("animation.yx100.idle"));
} }
private PlayState coaxShootPredicate(AnimationState<Yx100Entity> event) {
if (this.entityData.get(FIRE_ANIM) > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.yx100.fire_coax"));
}
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.yx100.idle_coax"));
}
private PlayState gunShootPredicate(AnimationState<Yx100Entity> event) { private PlayState gunShootPredicate(AnimationState<Yx100Entity> event) {
if (this.entityData.get(GUN_FIRE_TIME) > 0) { if (this.entityData.get(GUN_FIRE_TIME) > 0) {
return event.setAndContinue(RawAnimation.begin().thenPlay("animation.yx100.fire2")); return event.setAndContinue(RawAnimation.begin().thenPlay("animation.yx100.fire2"));
@ -796,6 +881,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
@Override @Override
public void registerControllers(AnimatableManager.ControllerRegistrar data) { public void registerControllers(AnimatableManager.ControllerRegistrar data) {
data.add(new AnimationController<>(this, "cannon", 0, this::cannonShootPredicate)); data.add(new AnimationController<>(this, "cannon", 0, this::cannonShootPredicate));
data.add(new AnimationController<>(this, "coax", 0, this::coaxShootPredicate));
data.add(new AnimationController<>(this, "gun", 0, this::gunShootPredicate)); data.add(new AnimationController<>(this, "gun", 0, this::gunShootPredicate));
} }
@ -817,7 +903,11 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
@Override @Override
public int mainGunRpm(Player player) { public int mainGunRpm(Player player) {
if (player == getNthEntity(0)) { if (player == getNthEntity(0)) {
return 15; if (getWeaponIndex(0) == 0 || getWeaponIndex(0) == 1) {
return 15;
} else if (getWeaponIndex(0) == 2) {
return 500;
}
} }
if (player == getNthEntity(1)) { if (player == getNthEntity(1)) {
@ -828,18 +918,34 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
@Override @Override
public boolean canShoot(Player player) { public boolean canShoot(Player player) {
return switch (getSeatIndex(player)) { if (player == getNthEntity(0)) {
case 0 -> this.entityData.get(LOADED_AMMO) > 0 && getEnergy() > VehicleConfig.YX_100_SHOOT_COST.get(); if (getWeaponIndex(0) == 0) {
case 1 -> (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire; return this.entityData.get(LOADED_AP) > 0 && getEnergy() > VehicleConfig.YX_100_SHOOT_COST.get();
default -> false; } else if (getWeaponIndex(0) == 1) {
}; return this.entityData.get(LOADED_HE) > 0 && getEnergy() > VehicleConfig.YX_100_SHOOT_COST.get();
} else if (getWeaponIndex(0) == 2) {
return (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFireCoax;
}
}
if (player == getNthEntity(1)) {
return (this.entityData.get(MG_AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire;
}
return false;
} }
@Override @Override
public int getAmmoCount(Player player) { public int getAmmoCount(Player player) {
if (player == getNthEntity(0)) { if (player == getNthEntity(0)) {
return this.entityData.get(LOADED_AMMO); if (getWeaponIndex(0) == 0) {
return this.entityData.get(LOADED_AP);
} else if (getWeaponIndex(0) == 1) {
return this.entityData.get(LOADED_HE);
} else if (getWeaponIndex(0) == 2) {
return this.entityData.get(MG_AMMO);
}
} }
if (player == getNthEntity(1)) { if (player == getNthEntity(1)) {
return this.entityData.get(MG_AMMO); return this.entityData.get(MG_AMMO);
} }
@ -865,18 +971,35 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
public void changeWeapon(int index, int value, boolean isScroll) { public void changeWeapon(int index, int value, boolean isScroll) {
if (index != 0) return; if (index != 0) return;
if (entityData.get(LOADED_AMMO) > 0) { var weapons = getAvailableWeapons(index);
if (this.getFirstPassenger() instanceof Player player && !InventoryTool.hasCreativeAmmoBox(player)) { if (weapons.isEmpty()) return;
this.insertItem(getWeapon(0).ammo, 1); var count = weapons.size();
var typeIndex = isScroll ? (value + getWeaponIndex(index) + count) % count : value;
if (typeIndex != 2) {
if (entityData.get(LOADED_AP) > 0 && typeIndex == 1) {
if (this.getFirstPassenger() instanceof Player player && !InventoryTool.hasCreativeAmmoBox(player)) {
this.insertItem(getWeapon(0).ammo, 1);
}
entityData.set(LOADED_AP, 0);
} }
entityData.set(LOADED_AMMO, 0);
}
this.reloadCoolDown = 80; if (entityData.get(LOADED_HE) > 0 && typeIndex == 0) {
if (this.getFirstPassenger() instanceof Player player && !InventoryTool.hasCreativeAmmoBox(player)) {
this.insertItem(getWeapon(0).ammo, 1);
}
entityData.set(LOADED_HE, 0);
}
if (this.getFirstPassenger() instanceof ServerPlayer player) { if (typeIndex != entityData.get(LOADED_AMMO_TYPE)) {
var clientboundstopsoundpacket = new ClientboundStopSoundPacket(ModSounds.YX_100_RELOAD.get().getLocation(), SoundSource.PLAYERS); this.reloadCoolDown = 80;
player.connection.send(clientboundstopsoundpacket); }
if (this.getFirstPassenger() instanceof ServerPlayer player) {
var clientboundstopsoundpacket = new ClientboundStopSoundPacket(ModSounds.YX_100_RELOAD.get().getLocation(), SoundSource.PLAYERS);
player.connection.send(clientboundstopsoundpacket);
}
} }
WeaponVehicleEntity.super.changeWeapon(index, value, isScroll); WeaponVehicleEntity.super.changeWeapon(index, value, isScroll);

View file

@ -53,6 +53,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.INT);
public static boolean IGNORE_ENTITY_GROUND_CHECK_STEPPING = false;
public boolean leftInputDown; public boolean leftInputDown;
public boolean rightInputDown; public boolean rightInputDown;
public boolean forwardInputDown; public boolean forwardInputDown;
@ -192,7 +193,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
cannotFireCoax = false; cannotFireCoax = false;
} }
if (this.entityData.get(HEAT) > 100) { if (this.entityData.get(HEAT) > 100 && !cannotFire) {
cannotFire = true; cannotFire = true;
this.level().playSound(null, this.getOnPos(), ModSounds.MINIGUN_OVERHEAT.get(), SoundSource.PLAYERS, 1, 1); this.level().playSound(null, this.getOnPos(), ModSounds.MINIGUN_OVERHEAT.get(), SoundSource.PLAYERS, 1, 1);
} }
@ -378,6 +379,9 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
@Override @Override
public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) { public void move(@NotNull MoverType movementType, @NotNull Vec3 movement) {
if (!this.level().isClientSide()) {
MobileVehicleEntity.IGNORE_ENTITY_GROUND_CHECK_STEPPING = true;
}
super.move(movementType, movement); super.move(movementType, movement);
if (level() instanceof ServerLevel) { if (level() instanceof ServerLevel) {
if (lastTickSpeed < 0.3 || collisionCoolDown > 0 || this instanceof DroneEntity) return; if (lastTickSpeed < 0.3 || collisionCoolDown > 0 || this instanceof DroneEntity) return;
@ -414,10 +418,10 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
collideHardBlock(); collideHardBlock();
switch (direction.getAxis()) { switch (direction.getAxis()) {
case X: case X:
this.setDeltaMovement(this.getDeltaMovement().multiply(-0.4, 0.99, 0.99)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 0.99, 0.99));
break; break;
case Z: case Z:
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, -0.4)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, 0.8));
break; break;
} }
} }
@ -490,8 +494,8 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
for (var entity : entities) { for (var entity : entities) {
double entitySize = entity.getBbWidth() * entity.getBbHeight(); double entitySize = entity.getBbWidth() * entity.getBbHeight();
double thisSize = this.getBbWidth() * this.getBbHeight(); double thisSize = this.getBbWidth() * this.getBbHeight();
double f = Math.min(entitySize / thisSize, 2); double f = Math.min(entitySize / thisSize, 2) * 0.5;
double f1 = Math.min(thisSize / entitySize, 4); double f1 = Math.min(thisSize / entitySize, 4) * 2;
if (velocity.length() > 0.3 && getBoundingBox().distanceToSqr(entity.getBoundingBox().getCenter()) < 1) { if (velocity.length() > 0.3 && getBoundingBox().distanceToSqr(entity.getBoundingBox().getCenter()) < 1) {
if (!this.level().isClientSide) { if (!this.level().isClientSide) {

View file

@ -791,7 +791,21 @@ public class ClientEventHandler {
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch); player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1); player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
} else { } else {
player.playSound(ModSounds.YX_100_FIRE_1P.get(), 1f, 1); if (yx100.getWeaponIndex(0) == 0 || yx100.getWeaponIndex(0) == 1) {
player.playSound(ModSounds.YX_100_FIRE_1P.get(), 1f, 1);
} else if (yx100.getWeaponIndex(0) == 2) {
float pitch = yx100.getEntityData().get(COAX_HEAT) <= 60 ? 1 : (float) (1 - 0.011 * Math.abs(60 - yx100.getEntityData().get(COAX_HEAT)));
player.playSound(ModSounds.M_2_FIRE_1P.get(), 1f, pitch);
player.playSound(ModSounds.SHELL_CASING_50CAL.get(), 0.3f, 1);
}
}
}
if (iVehicle instanceof PrismTankEntity prismTank) {
if (prismTank.getWeaponIndex(0) == 0) {
player.playSound(ModSounds.PRISM_FIRE_1P.get(), 1f, 1);
} else if (prismTank.getWeaponIndex(0) == 1) {
float pitch = prismTank.getEntityData().get(HEAT) <= 60 ? 1.1f : (float) (1.1f - 0.011 * Math.abs(60 - prismTank.getEntityData().get(HEAT)));
player.playSound(ModSounds.PRISM_FIRE_1P_2.get(), 1f, pitch);
} }
} }
} }

View file

@ -145,6 +145,10 @@ public class ClientMouseHandler {
} }
} }
if (player.getVehicle() instanceof PrismTankEntity) {
return ClientEventHandler.zoomVehicle ? 0.26 : 0.33;
}
if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) { if (player.getVehicle() instanceof Ah6Entity ah6Entity && !ah6Entity.onGround() && ah6Entity.getFirstPassenger() == player) {
return 0.33; return 0.33;
} }

View file

@ -78,7 +78,15 @@ public class ClientSoundHandler {
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false); player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
} }
} }
if (e instanceof DroneEntity drone) { if (e instanceof PrismTankEntity prismTank) {
distanceReduce = (float) Math.max((1 - distance / 64), 0);
if (player.getVehicle() == prismTank) {
player.playSound(ModSounds.BMP_ENGINE_1P.get(), 1 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f), (float) ((2 * Math.random() - 1) * 0.1f + 0.95f));
} else {
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (Mth.abs(mobileVehicle.getEntityData().get(POWER)) + Mth.abs(0.08f * mobileVehicle.getEntityData().get(DELTA_ROT)) - 0.004f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
}
}
if (e instanceof DroneEntity) {
distanceReduce = (float) Math.max((1 - distance / 64), 0); distanceReduce = (float) Math.max((1 - distance / 64), 0);
ItemStack stack = player.getMainHandItem(); ItemStack stack = player.getMainHandItem();
final var tag = NBTTool.getTag(stack); final var tag = NBTTool.getTag(stack);

View file

@ -26,7 +26,7 @@ public class ModEntities {
public static final DeferredHolder<EntityType<?>, EntityType<TargetEntity>> TARGET = register("target", public static final DeferredHolder<EntityType<?>, EntityType<TargetEntity>> TARGET = register("target",
EntityType.Builder.of(TargetEntity::new, MobCategory.CREATURE).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(0.875f, 2f)); EntityType.Builder.of(TargetEntity::new, MobCategory.CREATURE).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(0.875f, 2f));
public static final DeferredHolder<EntityType<?>, EntityType<SenpaiEntity>> SENPAI = register("senpai", public static final DeferredHolder<EntityType<?>, EntityType<SenpaiEntity>> SENPAI = register("senpai",
EntityType.Builder.<SenpaiEntity>of(SenpaiEntity::new, MobCategory.MONSTER).setTrackingRange(64).setUpdateInterval(3) EntityType.Builder.of(SenpaiEntity::new, MobCategory.MONSTER).setTrackingRange(64).setUpdateInterval(3)
.sized(0.6f, 2f)); .sized(0.6f, 2f));
// // Misc Entities // // Misc Entities
@ -102,6 +102,8 @@ public class ModEntities {
EntityType.Builder.<DroneEntity>of(DroneEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).sized(0.6f, 0.2f)); EntityType.Builder.<DroneEntity>of(DroneEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).sized(0.6f, 0.2f));
public static final DeferredHolder<EntityType<?>, EntityType<LaserTowerEntity>> LASER_TOWER = register("laser_tower", public static final DeferredHolder<EntityType<?>, EntityType<LaserTowerEntity>> LASER_TOWER = register("laser_tower",
EntityType.Builder.<LaserTowerEntity>of(LaserTowerEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(0.9f, 1.65f)); EntityType.Builder.<LaserTowerEntity>of(LaserTowerEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(0.9f, 1.65f));
public static final DeferredHolder<EntityType<?>, EntityType<PrismTankEntity>> PRISM_TANK = register("prism_tank",
EntityType.Builder.of(PrismTankEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(5f, 2.4f));
private static <T extends Entity> DeferredHolder<EntityType<?>, EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) { private static <T extends Entity> DeferredHolder<EntityType<?>, EntityType<T>> register(String name, EntityType.Builder<T> entityTypeBuilder) {
return REGISTRY.register(name, () -> entityTypeBuilder.build(name)); return REGISTRY.register(name, () -> entityTypeBuilder.build(name));

View file

@ -45,5 +45,6 @@ public class ModEntityRenderers {
event.registerEntityRenderer(ModEntities.LASER_TOWER.get(), LaserTowerRenderer::new); event.registerEntityRenderer(ModEntities.LASER_TOWER.get(), LaserTowerRenderer::new);
event.registerEntityRenderer(ModEntities.YX_100.get(), Yx100Renderer::new); event.registerEntityRenderer(ModEntities.YX_100.get(), Yx100Renderer::new);
event.registerEntityRenderer(ModEntities.WATER_MASK.get(), WaterMaskEntityRenderer::new); event.registerEntityRenderer(ModEntities.WATER_MASK.get(), WaterMaskEntityRenderer::new);
event.registerEntityRenderer(ModEntities.PRISM_TANK.get(), PrismTankRenderer::new);
} }
} }

View file

@ -427,5 +427,9 @@ public class ModSounds {
public static final DeferredHolder<SoundEvent, SoundEvent> C4_FINAL = REGISTRY.register("c4_final", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_final"))); public static final DeferredHolder<SoundEvent, SoundEvent> C4_FINAL = REGISTRY.register("c4_final", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_final")));
public static final DeferredHolder<SoundEvent, SoundEvent> C4_THROW = REGISTRY.register("c4_throw", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_throw"))); public static final DeferredHolder<SoundEvent, SoundEvent> C4_THROW = REGISTRY.register("c4_throw", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_throw")));
public static final DeferredHolder<SoundEvent, SoundEvent> C4_DETONATOR_CLICK = REGISTRY.register("c4_detonator_click", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_detonator_click"))); public static final DeferredHolder<SoundEvent, SoundEvent> C4_DETONATOR_CLICK = REGISTRY.register("c4_detonator_click", () -> SoundEvent.createVariableRangeEvent(Mod.loc("c4_detonator_click")));
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_1P = REGISTRY.register("prism_fire_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_1p")));
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_3P = REGISTRY.register("prism_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_3p")));
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_1P_2 = REGISTRY.register("prism_fire_1p_2", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_1p_2")));
public static final DeferredHolder<SoundEvent, SoundEvent> PRISM_FIRE_3P_2 = REGISTRY.register("prism_fire_3p_2", () -> SoundEvent.createVariableRangeEvent(Mod.loc("prism_fire_3p_2")));
} }

View file

@ -55,6 +55,7 @@ public class ContainerBlockItem extends BlockItem implements GeoItem {
() -> ContainerBlockItem.createInstance(ModEntities.AH_6.get()), () -> ContainerBlockItem.createInstance(ModEntities.AH_6.get()),
() -> ContainerBlockItem.createInstance(ModEntities.LAV_150.get(), true), () -> ContainerBlockItem.createInstance(ModEntities.LAV_150.get(), true),
() -> ContainerBlockItem.createInstance(ModEntities.BMP_2.get(), true), () -> ContainerBlockItem.createInstance(ModEntities.BMP_2.get(), true),
() -> ContainerBlockItem.createInstance(ModEntities.PRISM_TANK.get(), true),
() -> ContainerBlockItem.createInstance(ModEntities.YX_100.get()), () -> ContainerBlockItem.createInstance(ModEntities.YX_100.get()),
() -> ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()), () -> ContainerBlockItem.createInstance(ModEntities.WHEEL_CHAIR.get()),
() -> ContainerBlockItem.createInstance(ModEntities.TOM_6.get()) () -> ContainerBlockItem.createInstance(ModEntities.TOM_6.get())

View file

@ -127,6 +127,19 @@ public abstract class CameraMixin {
return; return;
} }
if (player.getVehicle() instanceof PrismTankEntity prismTank && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle)) {
if (prismTank.getFirstPassenger() == player) {
setRotation((float) -VehicleEntity.getYRotFromVector(prismTank.getBarrelVec(partialTicks)), (float) -VehicleEntity.getXRotFromVector(prismTank.getBarrelVec(partialTicks)));
if (ClientEventHandler.zoomVehicle) {
setPosition(prismTank.driverZoomPos(partialTicks).x, prismTank.driverZoomPos(partialTicks).y, prismTank.driverZoomPos(partialTicks).z);
} else {
setPosition(prismTank.driverPos(partialTicks).x, prismTank.driverPos(partialTicks).y, prismTank.driverPos(partialTicks).z);
}
info.cancel();
}
return;
}
if (player.getVehicle() instanceof CannonEntity && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle)) { if (player.getVehicle() instanceof CannonEntity && (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || ClientEventHandler.zoomVehicle)) {
setRotation(Mth.lerp(partialTicks, player.yRotO, player.getYRot()), Mth.lerp(partialTicks, player.xRotO, player.getXRot())); setRotation(Mth.lerp(partialTicks, player.yRotO, player.getYRot()), Mth.lerp(partialTicks, player.xRotO, player.getXRot()));
setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ())); setPosition(Mth.lerp(partialTicks, player.xo, player.getX()), Mth.lerp(partialTicks, player.yo + player.getEyeHeight(), player.getEyeY()), Mth.lerp(partialTicks, player.zo, player.getZ()));

View file

@ -0,0 +1,62 @@
//@Mixin(Entity.class)
//public class EntityMixin {
// TODO 优化后续逻辑
// @Redirect(method = "turn(DD)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;setXRot(F)V", ordinal = 1))
// public void turn(Entity instance, float pXRot) {
// if (instance instanceof Player player) {
// player.setXRot(player.getXRot());
// while (player.getXRot() > 180F) {
// player.setXRot(player.getXRot() - 360F);
// }
// while (player.getYRot() <= -180F) {
// player.setXRot(player.getXRot() + 360F);
// }
// } else {
// instance.setXRot(Mth.clamp(instance.getXRot(), -90.0F, 90.0F));
// }
// }
//}
package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.phys.Vec3;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class)
public class EntityMixin {
/**
* From Automobility
*/
@Unique
private boolean sbw$cacheOnGround;
@Shadow
private boolean onGround;
@Inject(method = "collide", at = @At("HEAD"))
private void sbw$spoofGroundStart(Vec3 movement, CallbackInfoReturnable<Vec3> cir) {
if (MobileVehicleEntity.IGNORE_ENTITY_GROUND_CHECK_STEPPING) {
this.sbw$cacheOnGround = this.onGround;
this.onGround = true;
}
}
@Inject(method = "collide", at = @At("TAIL"))
private void sbw$spoofGroundEnd(Vec3 movement, CallbackInfoReturnable<Vec3> cir) {
if (MobileVehicleEntity.IGNORE_ENTITY_GROUND_CHECK_STEPPING) {
this.onGround = this.sbw$cacheOnGround;
MobileVehicleEntity.IGNORE_ENTITY_GROUND_CHECK_STEPPING = false;
}
}
}

View file

@ -1,6 +1,8 @@
package com.atsuishio.superbwarfare.mixins; package com.atsuishio.superbwarfare.mixins;
import com.atsuishio.superbwarfare.entity.vehicle.PrismTankEntity;
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity; import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.CannonEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
import com.atsuishio.superbwarfare.init.ModTags; import com.atsuishio.superbwarfare.init.ModTags;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
@ -43,7 +45,7 @@ public class GameRendererMixin {
private Camera mainCamera; private Camera mainCamera;
@SuppressWarnings("ConstantValue") @SuppressWarnings("ConstantValue")
@Inject(method = "bobHurt(Lcom/mojang/blaze3d/vertex/PoseStack;F)V", at = @At("HEAD"), cancellable = false) @Inject(method = "bobHurt(Lcom/mojang/blaze3d/vertex/PoseStack;F)V", at = @At("HEAD"))
public void superbWarfare$renderWorld(PoseStack poseStack, float partialTicks, CallbackInfo ci) { public void superbWarfare$renderWorld(PoseStack poseStack, float partialTicks, CallbackInfo ci) {
Entity entity = mainCamera.getEntity(); Entity entity = mainCamera.getEntity();
if (entity != null && !mainCamera.isDetached() && entity.getRootVehicle() instanceof VehicleEntity vehicle) { if (entity != null && !mainCamera.isDetached() && entity.getRootVehicle() instanceof VehicleEntity vehicle) {
@ -66,7 +68,11 @@ public class GameRendererMixin {
poseStack.mulPose(Axis.ZP.rotationDegrees(-r * vehicle.getRoll(partialTicks) + r2 * vehicle.getViewXRot(partialTicks))); poseStack.mulPose(Axis.ZP.rotationDegrees(-r * vehicle.getRoll(partialTicks) + r2 * vehicle.getViewXRot(partialTicks)));
if (!(vehicle instanceof SpeedboatEntity)) { if (
!(vehicle instanceof SpeedboatEntity speedboat && entity == speedboat.getFirstPassenger()) &&
!(vehicle instanceof PrismTankEntity prismTank && entity == prismTank.getFirstPassenger()) &&
!(vehicle instanceof CannonEntity)
) {
// fetch eye offset // fetch eye offset
float eye = entity.getEyeHeight(); float eye = entity.getEyeHeight();

View file

@ -74,7 +74,7 @@ public class CustomExplosion extends Explosion {
final Vec3 center = new Vec3(pToBlowX, pToBlowY, pToBlowZ); final Vec3 center = new Vec3(pToBlowX, pToBlowY, pToBlowZ);
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4 * radius), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) { for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(4 * radius), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
if (target instanceof ServerPlayer serverPlayer) { if (target instanceof ServerPlayer serverPlayer) {
PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(10 + 0.02 * damage, 0.75 * pRadius, 4 + 0.02 * damage, pToBlowX, pToBlowY, pToBlowZ)); PacketDistributor.sendToPlayer(serverPlayer, new ShakeClientMessage(5 + 0.02 * damage, 0.75 * pRadius, 4 + 0.02 * damage, pToBlowX, pToBlowY, pToBlowZ));
} }
} }
} }

View file

@ -67,14 +67,6 @@ public class TraceTool {
double distance = entityReach * entityReach; double distance = entityReach * entityReach;
Vec3 eyePos = player.getEyePosition(1.0f); Vec3 eyePos = player.getEyePosition(1.0f);
HitResult hitResult = player.pick(entityReach, 1.0f, false); HitResult hitResult = player.pick(entityReach, 1.0f, false);
// if (hitResult.getType() != HitResult.Type.MISS) {
// distance = hitResult.getLocation().distanceToSqr(eyePos);
// double blockReach = 5;
// if (distance > blockReach * blockReach) {
// Vec3 pos = hitResult.getLocation();
// hitResult = BlockHitResult.miss(pos, Direction.getNearest(eyePos.x, eyePos.y, eyePos.z), BlockPos.containing(pos));
// }
// }
Vec3 viewVec = player.getViewVector(1.0F); Vec3 viewVec = player.getViewVector(1.0F);
Vec3 toVec = eyePos.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach); Vec3 toVec = eyePos.add(viewVec.x * entityReach, viewVec.y * entityReach, viewVec.z * entityReach);

View file

@ -169,6 +169,31 @@
} }
} }
} }
},
"animation.yx100.fire_coax": {
"loop": "hold_on_last_frame",
"animation_length": 0.5,
"bones": {
"flare2": {
"scale": {
"0.0": [0, 0, 0],
"0.0083": [8, 8, 8],
"0.05": [11, 11, 11],
"0.075": [1, 1, 1],
"0.0917": [0, 0, 0],
"0.15": [0, 0, 0]
}
}
}
},
"animation.yx100.idle_coax": {
"loop": true,
"animation_length": 0.5,
"bones": {
"flare2": {
"scale": 0
}
}
} }
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -3824,6 +3824,21 @@
"parent": "bb_main", "parent": "bb_main",
"pivot": [2.71683, 39.92506, -38.30861], "pivot": [2.71683, 39.92506, -38.30861],
"cubes": [ "cubes": [
{
"origin": [-6.08186, 40.47188, -50.55937],
"size": [2.275, 9.74375, 2.275],
"inflate": -0.2,
"pivot": [-5.69436, 46.21875, -48.67187],
"rotation": [90, 0, 45],
"uv": {
"north": {"uv": [563, 350], "uv_size": [4, 6]},
"east": {"uv": [563, 350], "uv_size": [4, 6]},
"south": {"uv": [563, 350], "uv_size": [4, 6]},
"west": {"uv": [563, 350], "uv_size": [4, 6]},
"up": {"uv": [646, 314], "uv_size": [-6, 6]},
"down": {"uv": [575, 352], "uv_size": [-4, 4]}
}
},
{ {
"origin": [-2.57951, 38.84974, -120.15625], "origin": [-2.57951, 38.84974, -120.15625],
"size": [4.6875, 0.9375, 83.4375], "size": [4.6875, 0.9375, 83.4375],
@ -4233,6 +4248,51 @@
} }
] ]
}, },
{
"name": "flare2",
"parent": "bone4",
"pivot": [-5.7, 45.15982, -55.27799],
"cubes": [
{
"origin": [-6.42751, 44.43232, -55.33986],
"size": [1.455, 1.455, 0],
"uv": {
"north": {"uv": [900, 548], "uv_size": [114, 114]},
"south": {"uv": [1014, 548], "uv_size": [-114, 114]}
}
},
{
"origin": [-7.53001, 44.55231, -56.12738],
"size": [3.66, 1.215, 0],
"pivot": [-5.70001, 45.15982, -56.12736],
"rotation": [0, -90, 0],
"uv": {
"north": {"uv": [1014, 548], "uv_size": [-106.125, 114]},
"south": {"uv": [907.875, 548], "uv_size": [106.125, 114]}
}
},
{
"origin": [-7.53001, 44.55231, -56.12738],
"size": [3.66, 1.215, 0],
"pivot": [-5.70001, 45.15982, -56.12736],
"rotation": [0, -90, 60],
"uv": {
"north": {"uv": [1014, 548], "uv_size": [-106.125, 114]},
"south": {"uv": [907.875, 548], "uv_size": [106.125, 114]}
}
},
{
"origin": [-7.53001, 44.55231, -56.12738],
"size": [3.66, 1.215, 0],
"pivot": [-5.70001, 45.15982, -56.12736],
"rotation": [0, -90, 120],
"uv": {
"north": {"uv": [1014, 548], "uv_size": [-106.125, 114]},
"south": {"uv": [907.875, 548], "uv_size": [106.125, 114]}
}
}
]
},
{ {
"name": "AQGDP4", "name": "AQGDP4",
"parent": "bb_main", "parent": "bb_main",

View file

@ -437,6 +437,7 @@
"entity.superbwarfare.yx_100": "YX-100 MBT", "entity.superbwarfare.yx_100": "YX-100 MBT",
"entity.superbwarfare.wg_missile": "Wire Guide Missile", "entity.superbwarfare.wg_missile": "Wire Guide Missile",
"entity.superbwarfare.laser_tower": "Laser Defense Tower", "entity.superbwarfare.laser_tower": "Laser Defense Tower",
"entity.superbwarfare.prism_tank": "Prism Tank",
"key.categories.superbwarfare": "Superb Warfare", "key.categories.superbwarfare": "Superb Warfare",
"key.superbwarfare.hold_zoom": "Zoom (Hold)", "key.superbwarfare.hold_zoom": "Zoom (Hold)",

View file

@ -435,6 +435,7 @@
"entity.superbwarfare.yx_100": "YX-100 主战坦克", "entity.superbwarfare.yx_100": "YX-100 主战坦克",
"entity.superbwarfare.wg_missile": "线控导弹", "entity.superbwarfare.wg_missile": "线控导弹",
"entity.superbwarfare.laser_tower": "激光防御塔", "entity.superbwarfare.laser_tower": "激光防御塔",
"entity.superbwarfare.prism_tank": "光棱坦克",
"key.categories.superbwarfare": "卓越前线", "key.categories.superbwarfare": "卓越前线",
"key.superbwarfare.hold_zoom": "瞄准(按住)", "key.superbwarfare.hold_zoom": "瞄准(按住)",

View file

@ -2947,5 +2947,77 @@
"stream": false "stream": false
} }
] ]
},
"prism_fire_1p": {
"sounds": [
{
"name": "superbwarfare:prism/prism_fire_1p",
"stream": false
}
]
},
"prism_fire_3p": {
"sounds": [
{
"name": "superbwarfare:prism/prism_fire_3p",
"stream": false
}
]
},
"prism_fire_1p_2": {
"sounds": [
{
"name": "superbwarfare:prism/prism_fire_1p_2",
"stream": false
}
]
},
"prism_fire_3p_2": {
"sounds": [
{
"name": "superbwarfare:prism/prism_fire_3p_2",
"stream": false
}
]
},
"insidious_fire_1p": {
"sounds": [
{
"name": "superbwarfare:insidious/insidious_fire_1p",
"stream": false
}
]
},
"insidious_fire_3p": {
"sounds": [
{
"name": "superbwarfare:insidious/insidious_fire_3p",
"stream": false
}
]
},
"insidious_far": {
"sounds": [
{
"name": "superbwarfare:insidious/insidious_far",
"stream": false
}
]
},
"insidious_veryfar": {
"sounds": [
{
"name": "superbwarfare:insidious/insidious_veryfar",
"stream": false
}
]
},
"insidious_reload_empty": {
"sounds": [
{
"name": "superbwarfare:insidious/insidious_reload",
"stream": false
}
]
} }
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 167 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View file

@ -0,0 +1,37 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"dbf",
"eee",
"hgh"
],
"key": {
"b": {
"item": "superbwarfare:medium_armament_module"
},
"d": {
"item": "superbwarfare:large_battery_pack"
},
"e": {
"item": "superbwarfare:steel_block"
},
"f": {
"item": "minecraft:beacon"
},
"g": {
"item": "superbwarfare:large_motor"
},
"h": {
"item": "superbwarfare:track"
}
},
"result": {
"item": "superbwarfare:container",
"nbt": {
"BlockEntityTag": {
"EntityType": "superbwarfare:prism_tank"
}
}
}
}

View file

@ -5,6 +5,7 @@
"refmap": "mixins.superbwarfare.refmap.json", "refmap": "mixins.superbwarfare.refmap.json",
"mixins": [ "mixins": [
"ClientboundSetPassengersPacketMixin", "ClientboundSetPassengersPacketMixin",
"EntityMixin",
"LivingEntityMixin", "LivingEntityMixin",
"PlayerMixin" "PlayerMixin"
], ],