添加63式火箭炮
This commit is contained in:
parent
343663db00
commit
ddf9bc1e2c
9 changed files with 30054 additions and 1 deletions
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Type63Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Type63Model extends GeoModel<Type63Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Type63Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Type63Entity entity) {
|
||||
return Mod.loc("geo/type_63.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Type63Entity entity) {
|
||||
return Mod.loc("textures/entity/type_63.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Type63Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Type63Entity;
|
||||
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 org.jetbrains.annotations.NotNull;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
|
||||
public class Type63Renderer extends GeoEntityRenderer<Type63Entity> {
|
||||
|
||||
public Type63Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Type63Model());
|
||||
this.shadowRadius = 0.8f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Type63Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Type63Entity 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(Type63Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, @NotNull MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Type63Entity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
String name = bone.getName();
|
||||
|
||||
if (name.equals("wheel1")) {
|
||||
bone.setRotX(Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel2")) {
|
||||
bone.setRotX(Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,207 @@
|
|||
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.Mod;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.OBBEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.item.SmallShellItem;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.OBB;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.neoforged.neoforge.event.EventHooks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.joml.Math;
|
||||
import org.joml.Matrix4f;
|
||||
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.List;
|
||||
|
||||
public class Type63Entity extends MobileVehicleEntity implements GeoEntity, OBBEntity, Container {
|
||||
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
public OBB barrel0;
|
||||
public OBB barrel1;
|
||||
public OBB barrel2;
|
||||
public OBB barrel3;
|
||||
public OBB barrel4;
|
||||
public OBB barrel5;
|
||||
public OBB barrel6;
|
||||
public OBB barrel7;
|
||||
public OBB barrel8;
|
||||
public OBB barrel9;
|
||||
public OBB barrel10;
|
||||
public OBB barrel11;
|
||||
public OBB pitchController;
|
||||
public OBB yawController;
|
||||
public OBB hoe1;
|
||||
public OBB hoe2;
|
||||
|
||||
public ItemStack stack = ItemStack.EMPTY;
|
||||
|
||||
public Type63Entity(EntityType<Type63Entity> type, Level world) {
|
||||
super(type, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void baseTick() {
|
||||
turretYRotO = this.getTurretYRot();
|
||||
turretXRotO = this.getTurretXRot();
|
||||
rudderRotO = this.getRudderRot();
|
||||
leftWheelRotO = this.getLeftWheelRot();
|
||||
rightWheelRotO = this.getRightWheelRot();
|
||||
|
||||
super.baseTick();
|
||||
updateOBB();
|
||||
|
||||
double fluidFloat = 0.052 * getSubmergedHeight(this);
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0));
|
||||
|
||||
if (this.onGround()) {
|
||||
float f0 = 0.35f + 0.5f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90;
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * getDeltaMovement().dot(getViewVector(1)))));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.99, f0));
|
||||
} else {
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, 0.99));
|
||||
}
|
||||
|
||||
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 * getDeltaMovement().dot(getViewVector(1)))));
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1));
|
||||
}
|
||||
this.refreshDimensions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (level() instanceof ServerLevel) {
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 20f,
|
||||
this.getX(), this.getY(), this.getZ(), 2f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
EventHooks.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
|
||||
explodePassengers();
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void travel() {
|
||||
float diffY = 0;
|
||||
|
||||
double s0 = getDeltaMovement().dot(this.getViewVector(1));
|
||||
|
||||
this.setLeftWheelRot((float) (this.getLeftWheelRot() - 1.75 * s0) - 0.015f * Mth.clamp(0.4f * diffY, -5f, 5f));
|
||||
this.setRightWheelRot((float) (this.getRightWheelRot() - 1.75 * s0) + 0.015f * Mth.clamp(0.4f * diffY, -5f, 5f));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResourceLocation getVehicleIcon() {
|
||||
return Mod.loc("textures/vehicle_icon/lav150_icon.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable ResourceLocation getVehicleItemIcon() {
|
||||
return Mod.loc("textures/gui/vehicle/type/defense.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getContainerSize() {
|
||||
return 12;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxStackSize() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return stack == ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemStack getItem(int slot) {
|
||||
return slot == 0 ? stack : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemStack removeItem(int slot, int amount) {
|
||||
if (slot != 0 || amount <= 0 || stack.isEmpty()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
stack.shrink(1);
|
||||
if (stack.isEmpty()) {
|
||||
stack = ItemStack.EMPTY;
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemStack removeItemNoUpdate(int slot) {
|
||||
return removeItem(0, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(int slot, @NotNull ItemStack stack) {
|
||||
if (slot != 0) return;
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stillValid(@NotNull Player player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearContent() {
|
||||
this.stack = ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceItem(int slot, @NotNull ItemStack stack) {
|
||||
if (slot != 0) return false;
|
||||
return stack.getItem() instanceof SmallShellItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OBB> getOBBs() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOBB() {
|
||||
Matrix4f transform = getVehicleTransform(1);
|
||||
}
|
||||
}
|
|
@ -116,6 +116,12 @@ public class ModCapabilities {
|
|||
(obj, ctx) -> new InvWrapper(obj)
|
||||
);
|
||||
|
||||
// Type63
|
||||
event.registerEntity(Capabilities.ItemHandler.ENTITY,
|
||||
ModEntities.TYPE_63.get(),
|
||||
(obj, ctx) -> new InvWrapper(obj)
|
||||
);
|
||||
|
||||
// Mk42
|
||||
event.registerEntity(Capabilities.ItemHandler.ENTITY,
|
||||
ModEntities.MK_42.get(),
|
||||
|
|
|
@ -92,12 +92,14 @@ public class ModEntities {
|
|||
EntityType.Builder.<Mk82Entity>of(Mk82Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(false).noSave().setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(0.8f, 0.8f));
|
||||
|
||||
// Vehicles
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<Type63Entity>> TYPE_63 = register("type_63",
|
||||
EntityType.Builder.of(Type63Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(1).fireImmune().sized(1f, 1.5f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<Mk42Entity>> MK_42 = register("mk_42",
|
||||
EntityType.Builder.of(Mk42Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(3.4f, 3.5f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<Hpj11Entity>> HPJ_11 = register("hpj_11",
|
||||
EntityType.Builder.of(Hpj11Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(2.8f, 2.4f));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<Mle1934Entity>> MLE_1934 = register("mle_1934",
|
||||
EntityType.Builder.of(Mle1934Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(4.5f, 2.8f));
|
||||
EntityType.Builder.of(Mle1934Entity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(4.5f, 2.8f).eyeHeight(2.16F));
|
||||
public static final DeferredHolder<EntityType<?>, EntityType<AnnihilatorEntity>> ANNIHILATOR = register("annihilator",
|
||||
EntityType.Builder.of(AnnihilatorEntity::new, MobCategory.MISC).setTrackingRange(64).setUpdateInterval(3).fireImmune().sized(13f, 4.2f));
|
||||
|
||||
|
|
|
@ -56,5 +56,6 @@ public class ModEntityRenderers {
|
|||
event.registerEntityRenderer(ModEntities.AGM_65.get(), Agm65Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.BLU_43.get(), Blu43Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.TM_62.get(), Tm62Renderer::new);
|
||||
event.registerEntityRenderer(ModEntities.TYPE_63.get(), Type63Renderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ public class ContainerBlockItem extends BlockItem implements GeoItem {
|
|||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void registerContainers(RegisterContainersEvent event) {
|
||||
event.add(ModEntities.WHEEL_CHAIR);
|
||||
event.add(ModEntities.TYPE_63);
|
||||
event.add(ModEntities.MK_42);
|
||||
event.add(ModEntities.MLE_1934);
|
||||
event.add(ModEntities.HPJ_11);
|
||||
|
|
29753
src/main/resources/assets/superbwarfare/geo/type_63.geo.json
Normal file
29753
src/main/resources/assets/superbwarfare/geo/type_63.geo.json
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Add table
Reference in a new issue