添加三种中口径火箭弹
This commit is contained in:
parent
6ff0e587d1
commit
ca2bdc884e
23 changed files with 3133 additions and 3 deletions
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/medium_rocket_ap"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/medium_rocket_cm"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/medium_rocket_he"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
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 MediumRocketLayer extends GeoRenderLayer<MediumRocketEntity> {
|
||||
private static final ResourceLocation LAYER = Mod.loc("textures/entity/rpg_rocket_e.png");
|
||||
|
||||
public MediumRocketLayer(GeoRenderer<MediumRocketEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, MediumRocketEntity 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);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class MediumRocketModel extends GeoModel<MediumRocketEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(MediumRocketEntity entity) {
|
||||
return Mod.loc("animations/rpg_rocket.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(MediumRocketEntity entity) {
|
||||
return Mod.loc("geo/medium_rocket.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(MediumRocketEntity entity) {
|
||||
return Mod.loc("textures/entity/type_63.png");
|
||||
}
|
||||
}
|
|
@ -14,11 +14,11 @@ public class SmallRocketModel extends GeoModel<SmallRocketEntity> {
|
|||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(SmallRocketEntity entity) {
|
||||
return Mod.loc("geo/small_rocket.geo.json");
|
||||
return Mod.loc("geo/medium_rocket.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(SmallRocketEntity entity) {
|
||||
return Mod.loc("textures/entity/small_rocket.png");
|
||||
return Mod.loc("textures/entity/medium_rocket.png");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.MediumRocketLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.MediumRocketModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
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 software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
public class MediumRocketRenderer extends GeoEntityRenderer<MediumRocketEntity> {
|
||||
public MediumRocketRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new MediumRocketModel());
|
||||
this.addRenderLayer(new MediumRocketLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(MediumRocketEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, MediumRocketEntity 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(MediumRocketEntity 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()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(MediumRocketEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -127,6 +127,9 @@ public class ModItemModelProvider extends ItemModelProvider {
|
|||
simpleItem(ModItems.SHOTGUN_AMMO);
|
||||
simpleItem(ModItems.HEAVY_AMMO);
|
||||
simpleItem(ModItems.SMALL_ROCKET);
|
||||
simpleItem(ModItems.MEDIUM_ROCKET_AP);
|
||||
simpleItem(ModItems.MEDIUM_ROCKET_HE);
|
||||
simpleItem(ModItems.MEDIUM_ROCKET_CM);
|
||||
simpleItem(ModItems.WIRE_GUIDE_MISSILE);
|
||||
simpleItem(ModItems.AGM);
|
||||
simpleItem(ModItems.SMALL_SHELL);
|
||||
|
|
|
@ -0,0 +1,384 @@
|
|||
package com.atsuishio.superbwarfare.entity.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.network.message.receive.ClientIndicatorMessage;
|
||||
import com.atsuishio.superbwarfare.network.message.receive.ClientMotionSyncMessage;
|
||||
import com.atsuishio.superbwarfare.tools.ChunkLoadTool;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.ProjectileCalculator;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
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.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
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.BlockHitResult;
|
||||
import net.minecraft.world.phys.EntityHitResult;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.EventHooks;
|
||||
import net.neoforged.neoforge.network.PacketDistributor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import software.bernie.geckolib.animatable.GeoEntity;
|
||||
import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.animation.*;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class MediumRocketEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
private boolean ap = true;
|
||||
private boolean he = false;
|
||||
private boolean cm = false;
|
||||
private float damage = 0;
|
||||
private float radius = 0;
|
||||
private float explosionDamage = 0;
|
||||
private float fireProbability = 0;
|
||||
private int fireTime = 0;
|
||||
public Set<Long> loadedChunks = new HashSet<>();
|
||||
private float gravity = 0.05f;
|
||||
|
||||
private boolean active;
|
||||
private int sparedTime;
|
||||
private int sparedAmount = 50;
|
||||
|
||||
public MediumRocketEntity(EntityType<? extends MediumRocketEntity> type, Level world) {
|
||||
super(type, world);
|
||||
this.noCulling = true;
|
||||
}
|
||||
|
||||
public MediumRocketEntity(EntityType<? extends ThrowableItemProjectile> pEntityType, double pX, double pY, double pZ, Level pLevel, float damage, float radius, float explosionDamage, float fireProbability, int fireTime, boolean ap, boolean he, boolean cm, int sparedAmount) {
|
||||
super(pEntityType, pX, pY, pZ, pLevel);
|
||||
this.noCulling = true;
|
||||
this.damage = damage;
|
||||
this.radius = radius;
|
||||
this.explosionDamage = explosionDamage;
|
||||
this.fireProbability = fireProbability;
|
||||
this.fireTime = fireTime;
|
||||
this.ap = ap;
|
||||
this.he = he;
|
||||
this.cm = cm;
|
||||
this.sparedAmount = sparedAmount;
|
||||
}
|
||||
|
||||
public MediumRocketEntity(LivingEntity entity, Level world, float damage, float radius, float explosionDamage, float fireProbability, int fireTime, boolean ap, boolean he, boolean cm, int sparedAmount) {
|
||||
super(ModEntities.MEDIUM_ROCKET.get(), entity, world);
|
||||
this.noCulling = true;
|
||||
this.damage = damage;
|
||||
this.radius = radius;
|
||||
this.explosionDamage = explosionDamage;
|
||||
this.fireProbability = fireProbability;
|
||||
this.fireTime = fireTime;
|
||||
this.ap = ap;
|
||||
this.he = he;
|
||||
this.cm = cm;
|
||||
this.sparedAmount = sparedAmount;
|
||||
}
|
||||
|
||||
public MediumRocketEntity durability(int durability) {
|
||||
this.durability = durability;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public boolean isColliding(BlockPos pPos, BlockState pState) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.addAdditionalSaveData(pCompound);
|
||||
|
||||
pCompound.putFloat("Damage", this.damage);
|
||||
pCompound.putFloat("ExplosionDamage", this.explosionDamage);
|
||||
pCompound.putFloat("Radius", this.radius);
|
||||
pCompound.putFloat("FireProbability", this.fireProbability);
|
||||
pCompound.putInt("FireTime", this.fireTime);
|
||||
pCompound.putInt("Durability", this.durability);
|
||||
|
||||
ListTag listTag = new ListTag();
|
||||
for (long chunkPos : this.loadedChunks) {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
tag.putLong("Pos", chunkPos);
|
||||
listTag.add(tag);
|
||||
}
|
||||
pCompound.put("Chunks", listTag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(@NotNull CompoundTag pCompound) {
|
||||
super.readAdditionalSaveData(pCompound);
|
||||
|
||||
if (pCompound.contains("Damage")) {
|
||||
this.damage = pCompound.getFloat("Damage");
|
||||
}
|
||||
|
||||
if (pCompound.contains("ExplosionDamage")) {
|
||||
this.explosionDamage = pCompound.getFloat("ExplosionDamage");
|
||||
}
|
||||
|
||||
if (pCompound.contains("Radius")) {
|
||||
this.radius = pCompound.getFloat("Radius");
|
||||
}
|
||||
|
||||
if (pCompound.contains("FireProbability")) {
|
||||
this.fireProbability = pCompound.getFloat("FireProbability");
|
||||
}
|
||||
|
||||
if (pCompound.contains("FireTime")) {
|
||||
this.fireTime = pCompound.getInt("FireTime");
|
||||
}
|
||||
|
||||
if (pCompound.contains("Durability")) {
|
||||
this.durability = pCompound.getInt("Durability");
|
||||
}
|
||||
|
||||
if (pCompound.contains("Chunks")) {
|
||||
ListTag listTag = pCompound.getList("Chunks", 10);
|
||||
for (int i = 0; i < listTag.size(); i++) {
|
||||
CompoundTag tag = listTag.getCompound(i);
|
||||
this.loadedChunks.add(tag.getLong("Pos"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @NotNull Item getDefaultItem() {
|
||||
return ModItems.SMALL_ROCKET.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderAtSqrDistance(double pDistance) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
if (he || cm) {
|
||||
causeExplode(blockHitResult.getLocation());
|
||||
this.discard();
|
||||
return;
|
||||
}
|
||||
BlockPos resultPos = blockHitResult.getBlockPos();
|
||||
float hardness = this.level().getBlockState(resultPos).getBlock().defaultDestroyTime();
|
||||
if (hardness != -1) {
|
||||
if (ExplosionConfig.EXPLOSION_DESTROY.get()) {
|
||||
if (firstHit) {
|
||||
causeExplode(blockHitResult.getLocation());
|
||||
firstHit = false;
|
||||
Mod.queueServerWork(3, this::discard);
|
||||
}
|
||||
this.level().destroyBlock(resultPos, true);
|
||||
}
|
||||
} else {
|
||||
causeExplode(blockHitResult.getLocation());
|
||||
this.discard();
|
||||
}
|
||||
if (!ExplosionConfig.EXPLOSION_DESTROY.get()) {
|
||||
causeExplode(blockHitResult.getLocation());
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHitEntity(@NotNull EntityHitResult entityHitResult) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
Entity entity = entityHitResult.getEntity();
|
||||
if (this.getOwner() != null && entity == this.getOwner().getVehicle())
|
||||
return;
|
||||
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
entity.invulnerableTime = 0;
|
||||
}
|
||||
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
||||
|
||||
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
||||
}
|
||||
}
|
||||
|
||||
ParticleTool.cannonHitParticles(this.level(), this.position(), this);
|
||||
causeExplode(entityHitResult.getLocation());
|
||||
if (entity instanceof VehicleEntity) {
|
||||
this.discard();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.level() instanceof ServerLevel serverLevel && tickCount > 1) {
|
||||
double l = getDeltaMovement().length();
|
||||
for (double i = 0; i < l; i++) {
|
||||
Vec3 startPos = new Vec3(this.xo, this.yo, this.zo);
|
||||
Vec3 pos = startPos.add(getDeltaMovement().normalize().scale(-i));
|
||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, pos.x, pos.y, pos.z,
|
||||
1, 0, 0, 0, 0.001, true);
|
||||
}
|
||||
// 更新需要加载的区块
|
||||
ChunkLoadTool.updateLoadedChunks(serverLevel, this, this.loadedChunks);
|
||||
}
|
||||
|
||||
destroyBlock();
|
||||
|
||||
if (this.tickCount > 600 || this.isInWater()) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
causeExplode(position());
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
|
||||
if (cm && getDeltaMovement().y < 0.1 && !active) {
|
||||
if (position().y < level().getMinBuildHeight() || position().y > level().getMaxBuildHeight()) return;
|
||||
|
||||
BlockPos hitBlock = ProjectileCalculator.calculateImpactPosition(level(), position(), getDeltaMovement(), -0.05);
|
||||
Vec3 finalPos = hitBlock.getCenter();
|
||||
double vh = getDeltaMovement().horizontalDistance();
|
||||
double dh = position().vectorTo(finalPos).horizontalDistance();
|
||||
int t = (int) (dh / vh);
|
||||
|
||||
sparedTime = tickCount + t - 5;
|
||||
active = true;
|
||||
}
|
||||
|
||||
if (tickCount >= sparedTime && active) {
|
||||
releaseClusterMunitions((LivingEntity) getOwner());
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncMotion() {
|
||||
if (!this.level().isClientSide) {
|
||||
PacketDistributor.sendToAllPlayers(new ClientMotionSyncMessage(this));
|
||||
}
|
||||
}
|
||||
|
||||
private void causeExplode(Vec3 vec3) {
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||
this,
|
||||
this.getOwner()),
|
||||
explosionDamage,
|
||||
vec3.x,
|
||||
vec3.y,
|
||||
vec3.z,
|
||||
radius,
|
||||
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
|
||||
setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
EventHooks.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
if (radius > 9) {
|
||||
ParticleTool.spawnHugeExplosionParticles(this.level(), vec3);
|
||||
} else {
|
||||
ParticleTool.spawnMediumExplosionParticles(this.level(), vec3);
|
||||
}
|
||||
discard();
|
||||
}
|
||||
|
||||
private void releaseClusterMunitions(LivingEntity shooter) {
|
||||
if (level() instanceof ServerLevel serverLevel) {
|
||||
ParticleTool.spawnMediumExplosionParticles(serverLevel, position());
|
||||
for (int index0 = 0; index0 < sparedAmount; index0++) {
|
||||
GunGrenadeEntity gunGrenadeEntity = new GunGrenadeEntity(shooter, serverLevel,
|
||||
2 * damage / sparedAmount,
|
||||
5 * explosionDamage / sparedAmount,
|
||||
radius / 2
|
||||
);
|
||||
|
||||
gunGrenadeEntity.setPos(position().x, position().y, position().z);
|
||||
gunGrenadeEntity.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) (1.25f * getDeltaMovement().length()),
|
||||
30);
|
||||
serverLevel.addFreshEntity(gunGrenadeEntity);
|
||||
}
|
||||
discard();
|
||||
}
|
||||
}
|
||||
|
||||
private PlayState movementPredicate(AnimationState<MediumRocketEntity> event) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.idle"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getDefaultGravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemovedFromLevel() {
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
ChunkLoadTool.unloadAllChunks(serverLevel, this, this.loadedChunks);
|
||||
}
|
||||
super.onRemovedFromLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SoundEvent getCloseSound() {
|
||||
return ModSounds.ROCKET_ENGINE.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SoundEvent getSound() {
|
||||
return ModSounds.ROCKET_FLY.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getVolume() {
|
||||
return 0.7f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamage(float damage) {
|
||||
this.explosionDamage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
}
|
|
@ -133,7 +133,7 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
|||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == yawController) {
|
||||
interactEvent(new Vec3(yawController.center()));
|
||||
entityData.set(YAW, Mth.clamp(entityData.get(YAW) + (player.isShiftKeyDown() ? -0.01f : 0.01f) * (float) interactionTick, -15, 15));
|
||||
entityData.set(YAW, Mth.clamp(entityData.get(YAW) + (player.isShiftKeyDown() ? -0.02f : 0.02f) * (float) interactionTick, -15, 15));
|
||||
player.swing(InteractionHand.MAIN_HAND);
|
||||
}
|
||||
if (OBB.getLookingObb(player, player.entityInteractionRange()) == pitchController) {
|
||||
|
|
|
@ -84,6 +84,8 @@ public class ModEntities {
|
|||
EntityType.Builder.<Agm65Entity>of(Agm65Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(false).noSave().setTrackingRange(64).setUpdateInterval(1).sized(0.75f, 0.75f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<SmallRocketEntity>> SMALL_ROCKET = register("small_rocket",
|
||||
EntityType.Builder.<SmallRocketEntity>of(SmallRocketEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(false).noSave().setTrackingRange(64).setUpdateInterval(1).sized(0.5f, 0.5f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<MediumRocketEntity>> MEDIUM_ROCKET = register("medium_rocket",
|
||||
EntityType.Builder.<MediumRocketEntity>of(MediumRocketEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(false).noSave().setTrackingRange(64).setUpdateInterval(1).sized(0.5f, 0.5f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<WgMissileEntity>> WG_MISSILE = register("wg_missile",
|
||||
EntityType.Builder.<WgMissileEntity>of(WgMissileEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(false).noSave().setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(0.5f, 0.5f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<SwarmDroneEntity>> SWARM_DRONE = register("swarm_drone",
|
||||
|
|
|
@ -22,6 +22,7 @@ public class ModEntityRenderers {
|
|||
event.registerEntityRenderer(ModEntities.DPS_GENERATOR.get(), DPSGeneratorRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.RPG_ROCKET.get(), RpgRocketRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.SMALL_ROCKET.get(), SmallRocketRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.MEDIUM_ROCKET.get(), MediumRocketRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.MORTAR_SHELL.get(), MortarShellRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.CANNON_SHELL.get(), CannonShellRenderer::new);
|
||||
event.registerEntityRenderer(ModEntities.PROJECTILE.get(), ProjectileEntityRenderer::new);
|
||||
|
|
|
@ -120,6 +120,9 @@ public class ModItems {
|
|||
public static final DeferredHolder<Item, Blu43MineItem> BLU_43_MINE = AMMO.register("blu_43_mine", Blu43MineItem::new);
|
||||
public static final DeferredHolder<Item, Item> SMALL_SHELL = AMMO.register("small_shell", SmallShellItem::new);
|
||||
public static final DeferredHolder<Item, SmallRocketItem> SMALL_ROCKET = AMMO.register("small_rocket", SmallRocketItem::new);
|
||||
public static final DeferredHolder<Item, MediumRocketAPItem> MEDIUM_ROCKET_AP = AMMO.register("medium_rocket_ap", MediumRocketAPItem::new);
|
||||
public static final DeferredHolder<Item, MediumRocketHEItem> MEDIUM_ROCKET_HE = AMMO.register("medium_rocket_he", MediumRocketHEItem::new);
|
||||
public static final DeferredHolder<Item, MediumRocketCMItem> MEDIUM_ROCKET_CM = AMMO.register("medium_rocket_cm", MediumRocketCMItem::new);
|
||||
public static final DeferredHolder<Item, WireGuideMissileItem> WIRE_GUIDE_MISSILE = AMMO.register("wire_guide_missile", WireGuideMissileItem::new);
|
||||
public static final DeferredHolder<Item, AgmItem> AGM = AMMO.register("agm", AgmItem::new);
|
||||
public static final DeferredHolder<Item, SwarmDroneItem> SWARM_DRONE = AMMO.register("swarm_drone", SwarmDroneItem::new);
|
||||
|
@ -353,6 +356,9 @@ public class ModItems {
|
|||
DispenserBlock.registerBehavior(RGO_GRENADE.get(), new RgoGrenade.RgoGrenadeDispenserBehavior());
|
||||
DispenserBlock.registerBehavior(M18_SMOKE_GRENADE.get(), new M18SmokeGrenade.SmokeGrenadeDispenserBehavior());
|
||||
DispenserBlock.registerBehavior(TM_62.get(), new Tm62Item.Tm62DispenseBehavior());
|
||||
DispenserBlock.registerBehavior(MEDIUM_ROCKET_AP.get(), new MediumRocketAPItem.MediumRocketDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(MEDIUM_ROCKET_CM.get(), new MediumRocketCMItem.MediumRocketDispenseBehavior());
|
||||
DispenserBlock.registerBehavior(MEDIUM_ROCKET_HE.get(), new MediumRocketHEItem.MediumRocketDispenseBehavior());
|
||||
}
|
||||
|
||||
public static void register(IEventBus bus) {
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
package com.atsuishio.superbwarfare.item.common.ammo;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.core.dispenser.BlockSource;
|
||||
import net.minecraft.core.dispenser.ProjectileDispenseBehavior;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ProjectileItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public class MediumRocketAPItem extends Item implements ProjectileItem {
|
||||
|
||||
public MediumRocketAPItem() {
|
||||
super(new Properties());
|
||||
}
|
||||
|
||||
public static class MediumRocketDispenseBehavior extends ProjectileDispenseBehavior {
|
||||
public MediumRocketDispenseBehavior() {
|
||||
super(ModItems.MEDIUM_ROCKET_AP.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void playSound(BlockSource blockSource) {
|
||||
blockSource.level().playSound(null, blockSource.pos(), ModSounds.SMALL_ROCKET_FIRE_3P.get(), SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public @NotNull Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
|
||||
return new MediumRocketEntity(ModEntities.MEDIUM_ROCKET.get(), pos.x(), pos.y(), pos.z(), level, 500, 6, 100, 0, 0, true, false, false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull DispenseConfig createDispenseConfig() {
|
||||
return DispenseConfig.builder().power(6).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
package com.atsuishio.superbwarfare.item.common.ammo;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.core.dispenser.BlockSource;
|
||||
import net.minecraft.core.dispenser.ProjectileDispenseBehavior;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ProjectileItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public class MediumRocketCMItem extends Item implements ProjectileItem {
|
||||
|
||||
public MediumRocketCMItem() {
|
||||
super(new Properties());
|
||||
}
|
||||
|
||||
public static class MediumRocketDispenseBehavior extends ProjectileDispenseBehavior {
|
||||
public MediumRocketDispenseBehavior() {
|
||||
super(ModItems.MEDIUM_ROCKET_CM.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void playSound(BlockSource blockSource) {
|
||||
blockSource.level().playSound(null, blockSource.pos(), ModSounds.SMALL_ROCKET_FIRE_3P.get(), SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public @NotNull Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
|
||||
return new MediumRocketEntity(ModEntities.MEDIUM_ROCKET.get(), pos.x(), pos.y(), pos.z(), level, 300, 12, 300, 0, 0, false, false, true, 50);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ProjectileItem.DispenseConfig createDispenseConfig() {
|
||||
return ProjectileItem.DispenseConfig.builder().power(6).build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.atsuishio.superbwarfare.item.common.ammo;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MediumRocketEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Position;
|
||||
import net.minecraft.core.dispenser.ProjectileDispenseBehavior;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.ProjectileItem;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
public class MediumRocketHEItem extends Item implements ProjectileItem {
|
||||
|
||||
public MediumRocketHEItem() {
|
||||
super(new Properties());
|
||||
}
|
||||
|
||||
public static class MediumRocketDispenseBehavior extends ProjectileDispenseBehavior {
|
||||
public MediumRocketDispenseBehavior() {
|
||||
super(ModItems.MEDIUM_ROCKET_HE.get());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void playSound(net.minecraft.core.dispenser.BlockSource blockSource) {
|
||||
blockSource.level().playSound(null, blockSource.pos(), ModSounds.SMALL_ROCKET_FIRE_3P.get(), SoundSource.BLOCKS, 2.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ParametersAreNonnullByDefault
|
||||
public @NotNull Projectile asProjectile(Level level, Position pos, ItemStack stack, Direction direction) {
|
||||
return new MediumRocketEntity(ModEntities.MEDIUM_ROCKET.get(), pos.x(), pos.y(), pos.z(), level, 200, 12, 200, 0.2f, 40, false, true, false, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull DispenseConfig createDispenseConfig() {
|
||||
return DispenseConfig.builder().power(6).build();
|
||||
}
|
||||
}
|
2465
src/main/resources/assets/superbwarfare/geo/medium_rocket.geo.json
Normal file
2465
src/main/resources/assets/superbwarfare/geo/medium_rocket.geo.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -177,6 +177,9 @@
|
|||
"item.superbwarfare.blu_43_mine": "BLU-43B DragonTooth",
|
||||
"item.superbwarfare.tm_62": "TM-62 Anti-tank Mine",
|
||||
"item.superbwarfare.small_rocket": "Small Caliber Rocket",
|
||||
"item.superbwarfare.medium_rocket_ap": "Medium Caliber AP Rocket",
|
||||
"item.superbwarfare.medium_rocket_he": "Medium Caliber HE Rocket",
|
||||
"item.superbwarfare.medium_rocket_cm": "Medium Caliber HE Cluster Munitions Rocket",
|
||||
"item.superbwarfare.small_shell": "Small Caliber Shells",
|
||||
"des.superbwarfare.small_shell": "Suitable for 20mm ~ 40mm caliber weapons",
|
||||
"item.superbwarfare.wire_guide_missile": "Wire Guide Missile",
|
||||
|
@ -477,6 +480,7 @@
|
|||
"entity.superbwarfare.javelin_missile": "Javelin Missile",
|
||||
"entity.superbwarfare.small_cannon_shell": "Small Cannon Shell",
|
||||
"entity.superbwarfare.small_rocket": "Small Caliber Rocket",
|
||||
"entity.superbwarfare.medium_rocket": "Medium Caliber Rocket",
|
||||
"entity.superbwarfare.flare_decoy": "Flare Decoy",
|
||||
"entity.superbwarfare.mortar": "Mortar",
|
||||
"entity.superbwarfare.target": "Target",
|
||||
|
|
|
@ -177,6 +177,9 @@
|
|||
"item.superbwarfare.blu_43_mine": "BLU-43蝴蝶雷",
|
||||
"item.superbwarfare.tm_62": "TM-62反坦克地雷",
|
||||
"item.superbwarfare.small_rocket": "小口径火箭弹",
|
||||
"item.superbwarfare.medium_rocket_ap": "中口径穿甲火箭弹",
|
||||
"item.superbwarfare.medium_rocket_he": "中口径高爆火箭弹",
|
||||
"item.superbwarfare.medium_rocket_cm": "中口径集束火箭弹",
|
||||
"item.superbwarfare.small_shell": "小口径炮弹",
|
||||
"des.superbwarfare.small_shell": "适配20mm ~ 40mm口径武器",
|
||||
"item.superbwarfare.wire_guide_missile": "线控导弹",
|
||||
|
@ -477,6 +480,7 @@
|
|||
"entity.superbwarfare.javelin_missile": "标枪导弹",
|
||||
"entity.superbwarfare.small_cannon_shell": "小口径炮弹",
|
||||
"entity.superbwarfare.small_rocket": "小口径火箭弹",
|
||||
"entity.superbwarfare.medium_rocket": "中口径火箭弹",
|
||||
"entity.superbwarfare.flare_decoy": "热诱弹",
|
||||
"entity.superbwarfare.mortar": "迫击炮",
|
||||
"entity.superbwarfare.target": "标靶",
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 380 B |
Binary file not shown.
After Width: | Height: | Size: 421 B |
Binary file not shown.
After Width: | Height: | Size: 406 B |
Binary file not shown.
After Width: | Height: | Size: 428 B |
Loading…
Add table
Reference in a new issue