添加mle1934舰炮
This commit is contained in:
parent
fd31eae168
commit
d301c708dd
18 changed files with 9433 additions and 48 deletions
|
@ -1,6 +1,7 @@
|
||||||
package net.mcreator.superbwarfare.block;
|
package net.mcreator.superbwarfare.block;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.entity.Target1Entity;
|
import net.mcreator.superbwarfare.entity.Target1Entity;
|
||||||
import net.mcreator.superbwarfare.init.ModSounds;
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
|
@ -78,7 +79,7 @@ public class JumpPadBlock extends Block {
|
||||||
super.entityInside(blockstate, level, pos, entity);
|
super.entityInside(blockstate, level, pos, entity);
|
||||||
|
|
||||||
// 禁止套娃
|
// 禁止套娃
|
||||||
if (entity instanceof Target1Entity || entity instanceof Mk42Entity) return;
|
if (entity instanceof Target1Entity || entity instanceof Mk42Entity || entity instanceof Mle1934Entity) return;
|
||||||
|
|
||||||
boolean zooming = entity.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
boolean zooming = entity.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client;
|
||||||
import com.mojang.blaze3d.platform.InputConstants;
|
import com.mojang.blaze3d.platform.InputConstants;
|
||||||
import net.mcreator.superbwarfare.ModUtils;
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.entity.MortarEntity;
|
import net.mcreator.superbwarfare.entity.MortarEntity;
|
||||||
import net.mcreator.superbwarfare.init.ModItems;
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
import net.mcreator.superbwarfare.init.ModMobEffects;
|
import net.mcreator.superbwarfare.init.ModMobEffects;
|
||||||
|
@ -73,7 +74,7 @@ public class ClickHandler {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new DroneFireMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new DroneFireMessage(0));
|
||||||
}
|
}
|
||||||
if (player.getVehicle() != null && player.getVehicle() instanceof Mk42Entity) {
|
if (player.getVehicle() != null && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new VehicleFireMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new VehicleFireMessage(0));
|
||||||
return;
|
return;
|
||||||
|
@ -88,7 +89,7 @@ public class ClickHandler {
|
||||||
if (Minecraft.getInstance().player.hasEffect(ModMobEffects.SHOCK.get())) {
|
if (Minecraft.getInstance().player.hasEffect(ModMobEffects.SHOCK.get())) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
if (player.getMainHandItem().is(ModTags.Items.GUN) || (player.isPassenger() && player.getVehicle() instanceof Mk42Entity)) {
|
if (player.getMainHandItem().is(ModTags.Items.GUN) || (player.isPassenger() && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity))) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(0));
|
ModUtils.PACKET_HANDLER.sendToServer(new ZoomMessage(0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package net.mcreator.superbwarfare.client.renderer.entity;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.vertex.PoseStack;
|
||||||
|
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.model.Mle1934Model;
|
||||||
|
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 software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||||
|
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||||
|
|
||||||
|
public class Mle1934Renderer extends GeoEntityRenderer<Mle1934Entity> {
|
||||||
|
public Mle1934Renderer(EntityRendererProvider.Context renderManager) {
|
||||||
|
super(renderManager, new Mle1934Model());
|
||||||
|
this.shadowRadius = 3f;
|
||||||
|
// this.addRenderLayer(new Mk42Layer(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RenderType getRenderType(Mle1934Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||||
|
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void preRender(PoseStack poseStack, Mle1934Entity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green,
|
||||||
|
float blue, float alpha) {
|
||||||
|
float scale = 1f;
|
||||||
|
this.scaleHeight = scale;
|
||||||
|
this.scaleWidth = scale;
|
||||||
|
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getDeathMaxRotation(Mle1934Entity entityLivingBaseIn) {
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.screens;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.init.ModItems;
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
import net.minecraft.client.CameraType;
|
import net.minecraft.client.CameraType;
|
||||||
|
@ -43,7 +44,7 @@ public class M79UIOverlay {
|
||||||
if (player == null) return false;
|
if (player == null) return false;
|
||||||
return !player.isSpectator()
|
return !player.isSpectator()
|
||||||
&& player.getMainHandItem().getItem() == ModItems.M_79.get()
|
&& player.getMainHandItem().getItem() == ModItems.M_79.get()
|
||||||
&& (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || (player.isPassenger() && player.getVehicle() instanceof Mk42Entity))
|
&& (Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON || (player.isPassenger() && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity)))
|
||||||
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
&& !player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.zooming).orElse(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +52,6 @@ public class M79UIOverlay {
|
||||||
if (player == null) return false;
|
if (player == null) return false;
|
||||||
return !player.isSpectator()
|
return !player.isSpectator()
|
||||||
&& !(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom
|
&& !(player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom
|
||||||
&& player.isPassenger() && player.getVehicle() instanceof Mk42Entity;
|
&& player.isPassenger() && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.mcreator.superbwarfare.client.screens;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.item.gun.GunItem;
|
import net.mcreator.superbwarfare.item.gun.GunItem;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
import net.mcreator.superbwarfare.tools.RenderTool;
|
import net.mcreator.superbwarfare.tools.RenderTool;
|
||||||
|
@ -50,7 +51,7 @@ public class Mk42UIOverlay {
|
||||||
return !player.isSpectator()
|
return !player.isSpectator()
|
||||||
&& !(player.getMainHandItem().getItem() instanceof GunItem)
|
&& !(player.getMainHandItem().getItem() instanceof GunItem)
|
||||||
// && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON
|
// && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON
|
||||||
&& (player.getVehicle() != null && player.getVehicle() instanceof Mk42Entity)
|
&& (player.getVehicle() != null && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity))
|
||||||
&& (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom;
|
&& (player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package net.mcreator.superbwarfare.entity;
|
package net.mcreator.superbwarfare.entity;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.init.*;
|
import net.mcreator.superbwarfare.init.ModDamageTypes;
|
||||||
|
import net.mcreator.superbwarfare.init.ModEntities;
|
||||||
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
||||||
|
@ -51,8 +54,6 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
|
||||||
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.STRING);
|
||||||
public static final EntityDataAccessor<String> TEXTURE = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> TEXTURE = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.STRING);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
private float RotX = 0;
|
|
||||||
private float RotY = 0;
|
|
||||||
|
|
||||||
public String animationprocedure = "empty";
|
public String animationprocedure = "empty";
|
||||||
|
|
||||||
|
@ -225,21 +226,6 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
|
||||||
|
|
||||||
Entity gunner = this.getFirstPassenger();
|
Entity gunner = this.getFirstPassenger();
|
||||||
|
|
||||||
// float adjust_rateX = (float) Mth.clamp(Math.pow(gunner.getXRot() - this.getXRot(), 2),0,5f);
|
|
||||||
// float adjust_rateY = (float) Mth.clamp(Math.pow(gunner.getYRot() - this.getYRot(), 2),0,3f);
|
|
||||||
//
|
|
||||||
// if (RotY < gunner.getYRot()) {
|
|
||||||
// RotY = (float) Mth.clamp(this.yHeadRot + adjust_rateY,Double.NEGATIVE_INFINITY, gunner.getYRot());
|
|
||||||
// } else {
|
|
||||||
// RotY = (float) Mth.clamp(this.yHeadRot- adjust_rateY,gunner.getYRot(),Double.POSITIVE_INFINITY);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (RotX < gunner.getXRot()) {
|
|
||||||
// RotX = Mth.clamp((Mth.clamp(this.getXRot() + adjust_rateX,-85 ,15)),-85, gunner.getXRot());
|
|
||||||
// } else {
|
|
||||||
// RotX = Mth.clamp((Mth.clamp(this.getXRot() - adjust_rateX,-85 ,15)),gunner.getXRot(),15);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (this.getPersistentData().getInt("fire_cooldown") > 0) {
|
if (this.getPersistentData().getInt("fire_cooldown") > 0) {
|
||||||
this.getPersistentData().putInt("fire_cooldown", this.getPersistentData().getInt("fire_cooldown") - 1);
|
this.getPersistentData().putInt("fire_cooldown", this.getPersistentData().getInt("fire_cooldown") - 1);
|
||||||
}
|
}
|
||||||
|
@ -374,23 +360,9 @@ public class Mk42Entity extends PathfinderMob implements GeoEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void travel(Vec3 dir) {
|
|
||||||
// if (this.getFirstPassenger() == null) return;
|
|
||||||
// Entity gunner = this.getFirstPassenger();
|
|
||||||
// if (this.isVehicle()) {
|
|
||||||
// this.setYRot(gunner.getYRot());
|
|
||||||
// this.yRotO = this.getYRot();
|
|
||||||
// this.setXRot(Mth.clamp(gunner.getXRot() - 1.35f, -85, 15));
|
|
||||||
// this.setRot(this.getYRot(), this.getXRot());
|
|
||||||
// this.yBodyRot = gunner.getYRot();
|
|
||||||
// this.yHeadRot = gunner.getYRot();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void travel(Vec3 dir) {
|
public void travel(Vec3 dir) {
|
||||||
Entity entity = this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0);
|
Entity entity = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||||
if (this.isVehicle()) {
|
if (this.isVehicle()) {
|
||||||
this.setYRot(entity.getYRot());
|
this.setYRot(entity.getYRot());
|
||||||
this.yRotO = this.getYRot();
|
this.yRotO = this.getYRot();
|
||||||
|
|
|
@ -0,0 +1,482 @@
|
||||||
|
package net.mcreator.superbwarfare.entity;
|
||||||
|
|
||||||
|
import net.mcreator.superbwarfare.init.ModDamageTypes;
|
||||||
|
import net.mcreator.superbwarfare.init.ModEntities;
|
||||||
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
|
import net.mcreator.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
|
import net.mcreator.superbwarfare.tools.CustomExplosion;
|
||||||
|
import net.mcreator.superbwarfare.tools.ParticleTool;
|
||||||
|
import net.mcreator.superbwarfare.tools.SoundTool;
|
||||||
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
|
import net.minecraft.network.syncher.EntityDataAccessor;
|
||||||
|
import net.minecraft.network.syncher.EntityDataSerializers;
|
||||||
|
import net.minecraft.network.syncher.SynchedEntityData;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
|
import net.minecraft.sounds.SoundEvent;
|
||||||
|
import net.minecraft.sounds.SoundSource;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.InteractionHand;
|
||||||
|
import net.minecraft.world.InteractionResult;
|
||||||
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
|
import net.minecraft.world.entity.*;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||||
|
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
import net.minecraft.world.entity.projectile.ThrownPotion;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.Explosion;
|
||||||
|
import net.minecraft.world.level.Level;
|
||||||
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
import net.minecraftforge.network.PlayMessages;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
import software.bernie.geckolib.animatable.GeoEntity;
|
||||||
|
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||||
|
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
|
import software.bernie.geckolib.core.animation.AnimationController;
|
||||||
|
import software.bernie.geckolib.core.animation.AnimationState;
|
||||||
|
import software.bernie.geckolib.core.animation.RawAnimation;
|
||||||
|
import software.bernie.geckolib.core.object.PlayState;
|
||||||
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
|
public class Mle1934Entity extends PathfinderMob implements GeoEntity {
|
||||||
|
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.STRING);
|
||||||
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
|
public String animationprocedure = "empty";
|
||||||
|
|
||||||
|
public Mle1934Entity(PlayMessages.SpawnEntity packet, Level world) {
|
||||||
|
this(ModEntities.MLE_1934.get(), world);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mle1934Entity(EntityType<Mle1934Entity> type, Level world) {
|
||||||
|
super(type, world);
|
||||||
|
xpReward = 0;
|
||||||
|
setNoAi(true);
|
||||||
|
setPersistenceRequired();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void defineSynchedData() {
|
||||||
|
super.defineSynchedData();
|
||||||
|
this.entityData.define(ANIMATION, "undefined");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected float getStandingEyeHeight(Pose poseIn, EntityDimensions sizeIn) {
|
||||||
|
return 2.16F;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canCollideWith(Entity entity) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canBeCollidedWith() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Packet<ClientGamePacketListener> getAddEntityPacket() {
|
||||||
|
return NetworkHooks.getEntitySpawningPacket(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobType getMobType() {
|
||||||
|
return super.getMobType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeWhenFarAway(double distanceToClosestPlayer) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getPassengersRidingOffset() {
|
||||||
|
return super.getPassengersRidingOffset() - 0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SoundEvent getHurtSound(DamageSource ds) {
|
||||||
|
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("superbwarfare:hit"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SoundEvent getDeathSound() {
|
||||||
|
return ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("superbwarfare:hit"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hurt(DamageSource source, float amount) {
|
||||||
|
if (source.getDirectEntity() instanceof ThrownPotion
|
||||||
|
|| source.getDirectEntity() instanceof AreaEffectCloud
|
||||||
|
|| source.is(DamageTypes.IN_FIRE)
|
||||||
|
|| source.is(DamageTypes.ON_FIRE)
|
||||||
|
|| source.is(DamageTypes.FALL)
|
||||||
|
|| source.is(DamageTypes.CACTUS)
|
||||||
|
|| source.is(DamageTypes.DROWN)
|
||||||
|
|| source.is(DamageTypes.LIGHTNING_BOLT)
|
||||||
|
|| source.is(DamageTypes.FALLING_ANVIL)
|
||||||
|
|| source.is(DamageTypes.DRAGON_BREATH)
|
||||||
|
|| source.is(DamageTypes.WITHER)
|
||||||
|
|| source.is(DamageTypes.WITHER_SKULL)
|
||||||
|
|| source.is(DamageTypes.GENERIC)
|
||||||
|
|| source.is(DamageTypes.MAGIC)
|
||||||
|
|| source.is(DamageTypes.ARROW)
|
||||||
|
|| source.is(DamageTypes.IN_WALL)
|
||||||
|
|| source.is(DamageTypes.MOB_ATTACK)
|
||||||
|
|| source.is(DamageTypes.MOB_ATTACK_NO_AGGRO)
|
||||||
|
|| source.is(DamageTypes.PLAYER_ATTACK)
|
||||||
|
|| source.is(DamageTypes.THORNS)
|
||||||
|
|| source.is(DamageTypes.STING)
|
||||||
|
|| source.is(DamageTypes.SWEET_BERRY_BUSH)
|
||||||
|
|| source.is(DamageTypes.TRIDENT)
|
||||||
|
|| source.is(DamageTypes.THROWN)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source.is(ModDamageTypes.GUN_FIRE)
|
||||||
|
|| source.is(ModDamageTypes.GUN_FIRE_HEADSHOT)
|
||||||
|
|| source.is(ModDamageTypes.ARROW_IN_BRAIN)
|
||||||
|
|| source.is(ModDamageTypes.ARROW_IN_KNEE)) {
|
||||||
|
return super.hurt(source, 0.125f * amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (source.getDirectEntity() instanceof Player player && this.getFirstPassenger() != null && player == this.getFirstPassenger()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.hurt(source, amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InteractionResult mobInteract(Player sourceentity, InteractionHand hand) {
|
||||||
|
InteractionResult retval = InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||||
|
super.mobInteract(sourceentity, hand);
|
||||||
|
sourceentity.setXRot(this.getXRot());
|
||||||
|
sourceentity.setYRot(this.getYRot());
|
||||||
|
sourceentity.startRiding(this);
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void die(DamageSource source) {
|
||||||
|
super.die(source);
|
||||||
|
|
||||||
|
if (level() instanceof ServerLevel) {
|
||||||
|
destroyExplode();
|
||||||
|
this.discard();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void destroyExplode() {
|
||||||
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this), 30f,
|
||||||
|
this.getX(), this.getY(), this.getZ(), 7.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
|
explosion.explode();
|
||||||
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
explosion.finalizeExplosion(false);
|
||||||
|
|
||||||
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addAdditionalSaveData(CompoundTag compound) {
|
||||||
|
super.addAdditionalSaveData(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readAdditionalSaveData(CompoundTag compound) {
|
||||||
|
super.readAdditionalSaveData(compound);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void baseTick() {
|
||||||
|
super.baseTick();
|
||||||
|
|
||||||
|
if (this.getFirstPassenger() == null) return;
|
||||||
|
|
||||||
|
Entity gunner = this.getFirstPassenger();
|
||||||
|
|
||||||
|
if (this.getPersistentData().getInt("fire_cooldown") > 0) {
|
||||||
|
this.getPersistentData().putInt("fire_cooldown", this.getPersistentData().getInt("fire_cooldown") - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getPersistentData().getInt("fire_cooldown") > 28) {
|
||||||
|
gunner.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> {
|
||||||
|
|
||||||
|
if (Math.random() < 0.5) {
|
||||||
|
capability.recoilHorizon = -1;
|
||||||
|
} else {
|
||||||
|
capability.recoilHorizon = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
capability.cannonRecoil = 10;
|
||||||
|
capability.syncPlayerVariables(gunner);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.getPersistentData().getBoolean("firing") && gunner instanceof Player player && this.getPersistentData().getInt("fire_cooldown") == 0) {
|
||||||
|
cannonShoot(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.refreshDimensions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cannonShoot(Player player) {
|
||||||
|
Level level = player.level();
|
||||||
|
if (level instanceof ServerLevel server) {
|
||||||
|
ItemStack stack = player.getMainHandItem();
|
||||||
|
|
||||||
|
if (!(stack.getItem() instanceof CannonShellItem)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float hitDamage = 0;
|
||||||
|
float explosionRadius = 0;
|
||||||
|
float explosionDamage = 0;
|
||||||
|
float fireProbability = 0;
|
||||||
|
int fireTime = 0;
|
||||||
|
int durability = 0;
|
||||||
|
|
||||||
|
if (stack.is(ModItems.HE_5_INCHES.get())) {
|
||||||
|
hitDamage = 100;
|
||||||
|
explosionRadius = 10;
|
||||||
|
explosionDamage = 200;
|
||||||
|
fireProbability = 0.18F;
|
||||||
|
fireTime = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stack.is(ModItems.AP_5_INCHES.get())) {
|
||||||
|
hitDamage = 450;
|
||||||
|
explosionRadius = 3;
|
||||||
|
explosionDamage = 250;
|
||||||
|
fireProbability = 0;
|
||||||
|
fireTime = 0;
|
||||||
|
durability = 25;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!player.isCreative()) {
|
||||||
|
stack.shrink(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
CannonShellEntity entityToSpawn = new CannonShellEntity(ModEntities.CANNON_SHELL.get(),
|
||||||
|
player, level, hitDamage, explosionRadius, explosionDamage, fireProbability, fireTime).durability(durability);
|
||||||
|
|
||||||
|
entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ());
|
||||||
|
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 15, 0.1f);
|
||||||
|
level.addFreshEntity(entityToSpawn);
|
||||||
|
|
||||||
|
|
||||||
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
|
SoundTool.playLocalSound(serverPlayer, ModSounds.MK_42_FIRE_1P.get(), 2, 1);
|
||||||
|
SoundTool.playLocalSound(serverPlayer, ModSounds.MK_42_RELOAD.get(), 2, 1);
|
||||||
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.MK_42_FIRE_3P.get(), SoundSource.PLAYERS, 6, 1);
|
||||||
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.MK_42_FAR.get(), SoundSource.PLAYERS, 16, 1);
|
||||||
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.MK_42_VERYFAR.get(), SoundSource.PLAYERS, 32, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.getPersistentData().putInt("fire_cooldown", 30);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 5 * this.getLookAngle().x,
|
||||||
|
this.getY(),
|
||||||
|
this.getZ() + 5 * this.getLookAngle().z,
|
||||||
|
200, 5, 0.02, 5, 0.005);
|
||||||
|
|
||||||
|
double x = this.getX() + 9 * this.getLookAngle().x;
|
||||||
|
double y = this.getEyeY() + 9 * this.getLookAngle().y;
|
||||||
|
double z = this.getZ() + 9 * this.getLookAngle().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);
|
||||||
|
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 9.5 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 9.5 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 9.5 * this.getLookAngle().z,
|
||||||
|
5, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 10 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 10 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 10 * this.getLookAngle().z,
|
||||||
|
4, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 11.5 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 11.5 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 11.5 * this.getLookAngle().z,
|
||||||
|
3, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 12 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 12 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 12 * this.getLookAngle().z,
|
||||||
|
2, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 12.5 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 12.5 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 12.5 * this.getLookAngle().z,
|
||||||
|
2, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE,
|
||||||
|
this.getX() + 13 * this.getLookAngle().x,
|
||||||
|
this.getEyeY() + 13 * this.getLookAngle().y,
|
||||||
|
this.getZ() + 13 * this.getLookAngle().z,
|
||||||
|
1, 0.15, 0.15, 0.15, 0.0075);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void travel(Vec3 dir) {
|
||||||
|
Entity entity = this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||||
|
if (this.isVehicle()) {
|
||||||
|
this.setYRot(entity.getYRot());
|
||||||
|
this.yRotO = this.getYRot();
|
||||||
|
this.setXRot(Mth.clamp(entity.getXRot() - 1.35f, -30, 4));
|
||||||
|
this.setRot(this.getYRot(), this.getXRot());
|
||||||
|
this.yBodyRot = entity.getYRot();
|
||||||
|
this.yHeadRot = entity.getYRot();
|
||||||
|
this.setMaxUpStep(1.0F);
|
||||||
|
if (entity instanceof LivingEntity passenger) {
|
||||||
|
this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED));
|
||||||
|
float forward = passenger.zza;
|
||||||
|
float strafe = passenger.xxa;
|
||||||
|
super.travel(new Vec3(strafe, 0, forward));
|
||||||
|
}
|
||||||
|
double d1 = this.getX() - this.xo;
|
||||||
|
double d0 = this.getZ() - this.zo;
|
||||||
|
float f1 = (float) Math.sqrt(d1 * d1 + d0 * d0) * 4;
|
||||||
|
if (f1 > 1.0F)
|
||||||
|
f1 = 1.0F;
|
||||||
|
this.walkAnimation.setSpeed(this.walkAnimation.speed() + (f1 - this.walkAnimation.speed()) * 0.4F);
|
||||||
|
this.walkAnimation.position(this.walkAnimation.position() + this.walkAnimation.speed());
|
||||||
|
this.calculateEntityAnimation(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.setMaxUpStep(0.5F);
|
||||||
|
super.travel(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EntityDimensions getDimensions(Pose p_33597_) {
|
||||||
|
return super.getDimensions(p_33597_).scale((float) 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void aiStep() {
|
||||||
|
super.aiStep();
|
||||||
|
this.updateSwingTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AttributeSupplier.Builder createAttributes() {
|
||||||
|
return Mob.createMobAttributes()
|
||||||
|
.add(Attributes.MOVEMENT_SPEED, 0)
|
||||||
|
.add(Attributes.MAX_HEALTH, 800)
|
||||||
|
.add(Attributes.ARMOR, 30)
|
||||||
|
.add(Attributes.ATTACK_DAMAGE, 0)
|
||||||
|
.add(Attributes.FOLLOW_RANGE, 32)
|
||||||
|
.add(Attributes.KNOCKBACK_RESISTANCE, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlayState movementPredicate(AnimationState event) {
|
||||||
|
if (this.animationprocedure.equals("empty")) {
|
||||||
|
|
||||||
|
if (this.getFirstPassenger() != null) {
|
||||||
|
Entity gunner = this.getFirstPassenger();
|
||||||
|
var capability = gunner.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null);
|
||||||
|
if (capability.orElse(new ModVariables.PlayerVariables()).cannonRecoil > 0) {
|
||||||
|
// if (capability.orElse(new ModVariables.PlayerVariables()).recoilHorizon == 1) {
|
||||||
|
// return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire"));
|
||||||
|
// } else {
|
||||||
|
// return event.setAndContinue(RawAnimation.begin().thenPlay("animation.mk42.fire2"));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.mle1934.idle"));
|
||||||
|
}
|
||||||
|
return PlayState.STOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
private PlayState procedurePredicate(AnimationState event) {
|
||||||
|
if (!animationprocedure.equals("empty") && event.getController().getAnimationState() == AnimationController.State.STOPPED) {
|
||||||
|
event.getController().setAnimation(RawAnimation.begin().thenPlay(this.animationprocedure));
|
||||||
|
if (event.getController().getAnimationState() == AnimationController.State.STOPPED) {
|
||||||
|
this.animationprocedure = "empty";
|
||||||
|
event.getController().forceAnimationReset();
|
||||||
|
}
|
||||||
|
} else if (animationprocedure.equals("empty")) {
|
||||||
|
return PlayState.STOP;
|
||||||
|
}
|
||||||
|
return PlayState.CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void tickDeath() {
|
||||||
|
++this.deathTime;
|
||||||
|
if (this.deathTime == 1) {
|
||||||
|
this.remove(RemovalReason.KILLED);
|
||||||
|
this.dropExperience();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSyncedAnimation() {
|
||||||
|
return this.entityData.get(ANIMATION);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnimation(String animation) {
|
||||||
|
this.entityData.set(ANIMATION, animation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||||
|
data.add(new AnimationController<>(this, "movement", 0, this::movementPredicate));
|
||||||
|
data.add(new AnimationController<>(this, "procedure", 0, this::procedurePredicate));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||||
|
return this.cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onEntityAttacked(LivingHurtEvent event) {
|
||||||
|
var damagesource = event.getSource();
|
||||||
|
var entity = event.getEntity();
|
||||||
|
if (damagesource == null || entity == null) return;
|
||||||
|
|
||||||
|
var sourceentity = damagesource.getEntity();
|
||||||
|
if (sourceentity == null) return;
|
||||||
|
|
||||||
|
if (entity instanceof Mle1934Entity mle1934) {
|
||||||
|
if (mle1934.getFirstPassenger() == null) return;
|
||||||
|
Entity gunner = mle1934.getFirstPassenger();
|
||||||
|
if (event.getSource().getDirectEntity() == gunner){
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
package net.mcreator.superbwarfare.entity.model;
|
||||||
|
|
||||||
|
import net.mcreator.superbwarfare.ModUtils;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.util.Mth;
|
||||||
|
import net.minecraft.world.entity.Entity;
|
||||||
|
import software.bernie.geckolib.constant.DataTickets;
|
||||||
|
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
||||||
|
import software.bernie.geckolib.core.animation.AnimationState;
|
||||||
|
import software.bernie.geckolib.model.GeoModel;
|
||||||
|
import software.bernie.geckolib.model.data.EntityModelData;
|
||||||
|
|
||||||
|
public class Mle1934Model extends GeoModel<Mle1934Entity> {
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAnimationResource(Mle1934Entity entity) {
|
||||||
|
return new ResourceLocation(ModUtils.MODID, "animations/mle1934.animation.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getModelResource(Mle1934Entity entity) {
|
||||||
|
return new ResourceLocation(ModUtils.MODID, "geo/mle1934.geo.json");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getTextureResource(Mle1934Entity entity) {
|
||||||
|
return new ResourceLocation(ModUtils.MODID, "textures/entity/mle1934.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCustomAnimations(Mle1934Entity animatable, long instanceId, AnimationState animationState) {
|
||||||
|
CoreGeoBone barrle = getAnimationProcessor().getBone("barrel");
|
||||||
|
EntityModelData entityData = (EntityModelData) animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
||||||
|
barrle.setRotX((entityData.headPitch()) * Mth.DEG_TO_RAD);
|
||||||
|
|
||||||
|
CoreGeoBone camera = getAnimationProcessor().getBone("camera");
|
||||||
|
|
||||||
|
if (animatable.getFirstPassenger() == null) return;
|
||||||
|
Entity gunner = animatable.getFirstPassenger();
|
||||||
|
|
||||||
|
gunner.getPersistentData().putDouble("cannon_camera_rot_x", Mth.RAD_TO_DEG * camera.getRotX());
|
||||||
|
gunner.getPersistentData().putDouble("cannon_camera_rot_y", Mth.RAD_TO_DEG * camera.getRotY());
|
||||||
|
gunner.getPersistentData().putDouble("cannon_camera_rot_z", Mth.RAD_TO_DEG * camera.getRotZ());
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package net.mcreator.superbwarfare.event;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.entity.DroneEntity;
|
import net.mcreator.superbwarfare.entity.DroneEntity;
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.init.ModItems;
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
import net.mcreator.superbwarfare.init.ModMobEffects;
|
import net.mcreator.superbwarfare.init.ModMobEffects;
|
||||||
import net.mcreator.superbwarfare.init.ModTags;
|
import net.mcreator.superbwarfare.init.ModTags;
|
||||||
|
@ -470,7 +471,7 @@ public class ClientEventHandler {
|
||||||
player.getPersistentData().putDouble("fov", event.getFOV());
|
player.getPersistentData().putDouble("fov", event.getFOV());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.isPassenger() && player.getVehicle() instanceof Mk42Entity) {
|
if (player.isPassenger() && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity)) {
|
||||||
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
||||||
event.setFOV(event.getFOV() / 5);
|
event.setFOV(event.getFOV() / 5);
|
||||||
}
|
}
|
||||||
|
@ -492,7 +493,7 @@ public class ClientEventHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc.player.getMainHandItem().is(ModTags.Items.GUN) || (mc.player.getVehicle() != null && mc.player.getVehicle() instanceof Mk42Entity)) {
|
if (mc.player.getMainHandItem().is(ModTags.Items.GUN) || (mc.player.getVehicle() != null && (mc.player.getVehicle() instanceof Mk42Entity || mc.player.getVehicle() instanceof Mle1934Entity))) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@ public class ModEntities {
|
||||||
EntityType.Builder.<ClaymoreEntity>of(ClaymoreEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(ClaymoreEntity::new).fireImmune().sized(0.5f, 0.5f));
|
EntityType.Builder.<ClaymoreEntity>of(ClaymoreEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(ClaymoreEntity::new).fireImmune().sized(0.5f, 0.5f));
|
||||||
public static final RegistryObject<EntityType<Mk42Entity>> MK_42 = register("mk_42",
|
public static final RegistryObject<EntityType<Mk42Entity>> MK_42 = register("mk_42",
|
||||||
EntityType.Builder.<Mk42Entity>of(Mk42Entity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Mk42Entity::new).fireImmune().sized(5.4f, 3.5f));
|
EntityType.Builder.<Mk42Entity>of(Mk42Entity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Mk42Entity::new).fireImmune().sized(5.4f, 3.5f));
|
||||||
|
public static final RegistryObject<EntityType<Mle1934Entity>> MLE_1934 = register("mle_1934",
|
||||||
|
EntityType.Builder.<Mle1934Entity>of(Mle1934Entity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(Mle1934Entity::new).fireImmune().sized(5.4f, 3.5f));
|
||||||
|
|
||||||
public static final RegistryObject<EntityType<DroneEntity>> DRONE = register("drone",
|
public static final RegistryObject<EntityType<DroneEntity>> DRONE = register("drone",
|
||||||
EntityType.Builder.<DroneEntity>of(DroneEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(DroneEntity::new).sized(0.7f, 0.175f));
|
EntityType.Builder.<DroneEntity>of(DroneEntity::new, MobCategory.CREATURE).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(DroneEntity::new).sized(0.7f, 0.175f));
|
||||||
|
@ -76,5 +78,6 @@ public class ModEntities {
|
||||||
event.put(TARGET.get(), TargetEntity.createAttributes().build());
|
event.put(TARGET.get(), TargetEntity.createAttributes().build());
|
||||||
event.put(MK_42.get(), Mk42Entity.createAttributes().build());
|
event.put(MK_42.get(), Mk42Entity.createAttributes().build());
|
||||||
event.put(DRONE.get(), DroneEntity.createAttributes().build());
|
event.put(DRONE.get(), DroneEntity.createAttributes().build());
|
||||||
|
event.put(MLE_1934.get(), Mle1934Entity.createAttributes().build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,5 +27,6 @@ public class ModEntityRenderers {
|
||||||
event.registerEntityRenderer(ModEntities.DRONE.get(), DroneRenderer::new);
|
event.registerEntityRenderer(ModEntities.DRONE.get(), DroneRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.HAND_GRENADE_ENTITY.get(), HandGrenadeEntityRenderer::new);
|
event.registerEntityRenderer(ModEntities.HAND_GRENADE_ENTITY.get(), HandGrenadeEntityRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.RGO_GRENADE.get(), RgoGrenadeRenderer::new);
|
event.registerEntityRenderer(ModEntities.RGO_GRENADE.get(), RgoGrenadeRenderer::new);
|
||||||
|
event.registerEntityRenderer(ModEntities.MLE_1934.get(), Mle1934Renderer::new);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,6 +78,9 @@ public class ModItems {
|
||||||
*/
|
*/
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ModUtils.MODID);
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ModUtils.MODID);
|
||||||
|
|
||||||
|
public static final RegistryObject<Item> SENPAI_SPAWN_EGG = ITEMS.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.SENPAI, -11584987, -14014413, new Item.Properties()));
|
||||||
|
public static final RegistryObject<Item> MK_42_SPAWN_EGG = ITEMS.register("mk42_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.MK_42, -8348258, -2630437, new Item.Properties()));
|
||||||
|
public static final RegistryObject<Item> MLE_1934_SPAWN_EGG = ITEMS.register("mle1934_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.MLE_1934, -8348258, -2630437, new Item.Properties()));
|
||||||
public static final RegistryObject<Item> DRONE = ITEMS.register("drone", Drone::new);
|
public static final RegistryObject<Item> DRONE = ITEMS.register("drone", Drone::new);
|
||||||
|
|
||||||
public static final RegistryObject<Item> MONITOR = ITEMS.register("monitor", Monitor::new);
|
public static final RegistryObject<Item> MONITOR = ITEMS.register("monitor", Monitor::new);
|
||||||
|
@ -114,8 +117,6 @@ public class ModItems {
|
||||||
public static final RegistryObject<Item> SCHEELITE = ITEMS.register("scheelite", () -> new Item(new Item.Properties()));
|
public static final RegistryObject<Item> SCHEELITE = ITEMS.register("scheelite", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> DOG_TAG = ITEMS.register("dog_tag", DogTag::new);
|
public static final RegistryObject<Item> DOG_TAG = ITEMS.register("dog_tag", DogTag::new);
|
||||||
public static final RegistryObject<Item> SHIELD_CELL = ITEMS.register("shield_cell", () -> new Item(new Item.Properties().rarity(Rarity.RARE)));
|
public static final RegistryObject<Item> SHIELD_CELL = ITEMS.register("shield_cell", () -> new Item(new Item.Properties().rarity(Rarity.RARE)));
|
||||||
public static final RegistryObject<Item> SENPAI_SPAWN_EGG = ITEMS.register("senpai_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.SENPAI, -11584987, -14014413, new Item.Properties()));
|
|
||||||
public static final RegistryObject<Item> MK_42_SPAWN_EGG = ITEMS.register("mk42_spawn_egg", () -> new ForgeSpawnEggItem(ModEntities.MK_42, -8348258, -2630437, new Item.Properties()));
|
|
||||||
|
|
||||||
public static final RegistryObject<Item> IRON_BARREL = ITEMS.register("iron_barrel", () -> new Item(new Item.Properties()));
|
public static final RegistryObject<Item> IRON_BARREL = ITEMS.register("iron_barrel", () -> new Item(new Item.Properties()));
|
||||||
public static final RegistryObject<Item> IRON_ACTION = ITEMS.register("iron_action", () -> new Item(new Item.Properties()));
|
public static final RegistryObject<Item> IRON_ACTION = ITEMS.register("iron_action", () -> new Item(new Item.Properties()));
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.mcreator.superbwarfare.mixins;
|
package net.mcreator.superbwarfare.mixins;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.init.ModMobEffects;
|
import net.mcreator.superbwarfare.init.ModMobEffects;
|
||||||
import net.mcreator.superbwarfare.init.ModTags;
|
import net.mcreator.superbwarfare.init.ModTags;
|
||||||
import net.mcreator.superbwarfare.network.ModVariables;
|
import net.mcreator.superbwarfare.network.ModVariables;
|
||||||
|
@ -37,7 +38,7 @@ public class MouseHandlerMixin {
|
||||||
|
|
||||||
ItemStack stack = mc.player.getMainHandItem();
|
ItemStack stack = mc.player.getMainHandItem();
|
||||||
|
|
||||||
if (player.getVehicle() != null && player.getVehicle() instanceof Mk42Entity) {
|
if (player.getVehicle() != null && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity)) {
|
||||||
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
if ((player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new ModVariables.PlayerVariables())).zoom) {
|
||||||
return 0.12;
|
return 0.12;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.mcreator.superbwarfare.network.message;
|
package net.mcreator.superbwarfare.network.message;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.entity.*;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
|
@ -41,7 +42,7 @@ public class VehicleFireMessage {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getVehicle() != null && player.getVehicle() instanceof Mk42Entity) {
|
if (player.getVehicle() != null && (player.getVehicle() instanceof Mk42Entity || player.getVehicle() instanceof Mle1934Entity)) {
|
||||||
Entity cannon = player.getVehicle();
|
Entity cannon = player.getVehicle();
|
||||||
cannon.getPersistentData().putBoolean("firing",true);
|
cannon.getPersistentData().putBoolean("firing",true);
|
||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.mcreator.superbwarfare.network.message;
|
package net.mcreator.superbwarfare.network.message;
|
||||||
|
|
||||||
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
import net.mcreator.superbwarfare.entity.Mk42Entity;
|
||||||
|
import net.mcreator.superbwarfare.entity.Mle1934Entity;
|
||||||
import net.mcreator.superbwarfare.init.ModItems;
|
import net.mcreator.superbwarfare.init.ModItems;
|
||||||
import net.mcreator.superbwarfare.init.ModSounds;
|
import net.mcreator.superbwarfare.init.ModSounds;
|
||||||
import net.mcreator.superbwarfare.init.ModTags;
|
import net.mcreator.superbwarfare.init.ModTags;
|
||||||
|
@ -67,7 +68,7 @@ public class ZoomMessage {
|
||||||
zoom_spread = 0.00001;
|
zoom_spread = 0.00001;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.isPassenger() && entity.getVehicle() instanceof Mk42Entity) {
|
if (entity.isPassenger() && (entity.getVehicle() instanceof Mk42Entity || entity.getVehicle() instanceof Mle1934Entity)) {
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
SoundTool.playLocalSound(serverPlayer, ModSounds.CANNON_ZOOM_IN.get(), 2, 1);
|
SoundTool.playLocalSound(serverPlayer, ModSounds.CANNON_ZOOM_IN.get(), 2, 1);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +85,7 @@ public class ZoomMessage {
|
||||||
});
|
});
|
||||||
|
|
||||||
zoom_spread = 1;
|
zoom_spread = 1;
|
||||||
if (entity.isPassenger() && entity.getVehicle() instanceof Mk42Entity) {
|
if (entity.isPassenger() && (entity.getVehicle() instanceof Mk42Entity || entity.getVehicle() instanceof Mle1934Entity)) {
|
||||||
if (entity instanceof ServerPlayer serverPlayer) {
|
if (entity instanceof ServerPlayer serverPlayer) {
|
||||||
SoundTool.playLocalSound(serverPlayer, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1);
|
SoundTool.playLocalSound(serverPlayer, ModSounds.CANNON_ZOOM_OUT.get(), 2, 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"format_version": "1.8.0",
|
||||||
|
"animations": {
|
||||||
|
"animation.mle1934.idle": {
|
||||||
|
"loop": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"geckolib_format_version": 2
|
||||||
|
}
|
8825
src/main/resources/assets/superbwarfare/geo/mle1934.geo.json
Normal file
8825
src/main/resources/assets/superbwarfare/geo/mle1934.geo.json
Normal file
File diff suppressed because it is too large
Load diff
Binary file not shown.
After Width: | Height: | Size: 6.9 KiB |
Loading…
Add table
Reference in a new issue