移除失败的激光实体
This commit is contained in:
parent
f50f4c052a
commit
cc05066a51
13 changed files with 2 additions and 459 deletions
|
@ -1,57 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.layer.BeamLayer;
|
|
||||||
import com.atsuishio.superbwarfare.entity.model.BeamModel;
|
|
||||||
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 BeamRenderer extends GeoEntityRenderer<BeamEntity> {
|
|
||||||
|
|
||||||
public BeamRenderer(EntityRendererProvider.Context renderManager) {
|
|
||||||
super(renderManager, new BeamModel());
|
|
||||||
this.addRenderLayer(new BeamLayer(this));
|
|
||||||
this.shadowRadius = 0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public RenderType getRenderType(BeamEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
|
||||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preRender(PoseStack poseStack, BeamEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, float red, float green,
|
|
||||||
float blue, float alpha) {
|
|
||||||
float scale = 0.5f;
|
|
||||||
this.scaleHeight = scale;
|
|
||||||
this.scaleWidth = scale;
|
|
||||||
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(BeamEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
|
||||||
poseStack.pushPose();
|
|
||||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
|
||||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
|
||||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
|
||||||
poseStack.popPose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected float getDeathMaxRotation(BeamEntity entityLivingBaseIn) {
|
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldShowName(BeamEntity animatable) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,221 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModItems;
|
|
||||||
import com.atsuishio.superbwarfare.tools.TraceTool;
|
|
||||||
import net.minecraft.core.BlockPos;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
|
||||||
import net.minecraft.network.syncher.EntityDataAccessor;
|
|
||||||
import net.minecraft.network.syncher.EntityDataSerializers;
|
|
||||||
import net.minecraft.network.syncher.SynchedEntityData;
|
|
||||||
import net.minecraft.server.players.OldUsersConverter;
|
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
|
||||||
import net.minecraft.world.entity.EntityType;
|
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.OwnableEntity;
|
|
||||||
import net.minecraft.world.level.ClipContext;
|
|
||||||
import net.minecraft.world.level.Level;
|
|
||||||
import net.minecraft.world.level.block.GlassBlock;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
|
||||||
import net.minecraft.world.phys.Vec3;
|
|
||||||
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.util.GeckoLibUtil;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class BeamEntity extends Entity implements GeoEntity, AnimatedEntity, OwnableEntity {
|
|
||||||
protected static final EntityDataAccessor<Optional<UUID>> OWNER_UUID = SynchedEntityData.defineId(BeamEntity.class, EntityDataSerializers.OPTIONAL_UUID);
|
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> LENGTH = SynchedEntityData.defineId(BeamEntity.class, EntityDataSerializers.FLOAT);
|
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
|
||||||
protected int interpolationSteps;
|
|
||||||
protected double serverYRot;
|
|
||||||
protected double serverXRot;
|
|
||||||
protected double x;
|
|
||||||
protected double y;
|
|
||||||
protected double z;
|
|
||||||
|
|
||||||
public BeamEntity(EntityType<BeamEntity> type, Level world) {
|
|
||||||
super(type, world);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BeamEntity(LivingEntity owner, Level level) {
|
|
||||||
super(ModEntities.BEAM.get(), level);
|
|
||||||
this.setOwnerUUID(owner.getUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void defineSynchedData() {
|
|
||||||
this.entityData.define(OWNER_UUID, Optional.empty());
|
|
||||||
this.entityData.define(LENGTH, 0f);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPickable() {
|
|
||||||
return !this.isRemoved();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hurt(DamageSource source, float amount) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOwnerUUID(@Nullable UUID pUuid) {
|
|
||||||
this.entityData.set(OWNER_UUID, Optional.ofNullable(pUuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public UUID getOwnerUUID() {
|
|
||||||
return this.entityData.get(OWNER_UUID).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean shouldRenderAtSqrDistance(double pDistance) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addAdditionalSaveData(CompoundTag compound) {
|
|
||||||
if (this.getOwnerUUID() != null) {
|
|
||||||
compound.putUUID("Owner", this.getOwnerUUID());
|
|
||||||
}
|
|
||||||
compound.putFloat("Length", this.entityData.get(LENGTH));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readAdditionalSaveData(CompoundTag compound) {
|
|
||||||
UUID uuid;
|
|
||||||
if (compound.hasUUID("Owner")) {
|
|
||||||
uuid = compound.getUUID("Owner");
|
|
||||||
} else {
|
|
||||||
String s = compound.getString("Owner");
|
|
||||||
|
|
||||||
assert this.getServer() != null;
|
|
||||||
uuid = OldUsersConverter.convertMobOwnerIfNecessary(this.getServer(), s);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (uuid != null) {
|
|
||||||
try {
|
|
||||||
this.setOwnerUUID(uuid);
|
|
||||||
} catch (Throwable ignored) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (compound.contains("Length")) {
|
|
||||||
this.entityData.set(LENGTH, compound.getFloat("Length"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick() {
|
|
||||||
super.tick();
|
|
||||||
|
|
||||||
if (this.getOwner() == null) {
|
|
||||||
this.discard();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!this.getOwner().getMainHandItem().is(ModItems.BEAM_TEST.get()) || (this.getOwner().getMainHandItem().is(ModItems.BEAM_TEST.get()) && !this.getOwner().getMainHandItem().getOrCreateTag().getBoolean("Using"))) {
|
|
||||||
this.discard();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updatePositionAndRotation();
|
|
||||||
|
|
||||||
boolean lookAtEntity = false;
|
|
||||||
double block_range = this.position().distanceTo((Vec3.atLowerCornerOf(this.level().clip(
|
|
||||||
new ClipContext(this.getEyePosition(), this.getEyePosition().add(this.getViewVector(1f).scale(512)),
|
|
||||||
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this)).getBlockPos())));
|
|
||||||
|
|
||||||
BlockHitResult blockResult = this.level().clip(
|
|
||||||
new ClipContext(this.getEyePosition(), this.getEyePosition().add(this.getViewVector(1f).scale(512)),
|
|
||||||
ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, this));
|
|
||||||
|
|
||||||
BlockPos resultPos = blockResult.getBlockPos();
|
|
||||||
BlockState state = this.level().getBlockState(resultPos);
|
|
||||||
|
|
||||||
double entity_range = 0;
|
|
||||||
|
|
||||||
Entity lookingEntity = TraceTool.findLookingEntity(this, 512);
|
|
||||||
|
|
||||||
if (lookingEntity != null) {
|
|
||||||
lookAtEntity = true;
|
|
||||||
entity_range = this.distanceTo(lookingEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lookAtEntity && lookingEntity != this.getOwner()) {
|
|
||||||
entityData.set(LENGTH, (float)entity_range);
|
|
||||||
} else if (!(state.getBlock() instanceof GlassBlock)){
|
|
||||||
entityData.set(LENGTH, (float)block_range);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.refreshDimensions();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isPushable() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getSyncedAnimation() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAnimation(String animation) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNoGravity() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updatePositionAndRotation() {
|
|
||||||
LivingEntity owner = this.getOwner();
|
|
||||||
if (owner != null) {
|
|
||||||
this.setPos(this.getOwner().getX() + 0.5 * this.getOwner().getLookAngle().x,
|
|
||||||
this.getOwner().getEyeY() - 0.3 + 0.5 * this.getOwner().getLookAngle().y,
|
|
||||||
this.getOwner().getZ() + 0.5 * this.getOwner().getLookAngle().z);
|
|
||||||
|
|
||||||
this.setYRot(boundDegrees(owner.getYRot()));
|
|
||||||
this.setXRot(boundDegrees(owner.getXRot()));
|
|
||||||
this.yRotO = boundDegrees(owner.yRotO);
|
|
||||||
this.xRotO = boundDegrees(owner.xRotO);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private float boundDegrees(float v) {
|
|
||||||
return (v % 360 + 360) % 360;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void lerpTo(double x, double y, double z, float yaw, float pitch, int interpolationSteps, boolean interpolate) {
|
|
||||||
this.x = x;
|
|
||||||
this.y = y;
|
|
||||||
this.z = z;
|
|
||||||
serverYRot = yaw;
|
|
||||||
serverXRot = pitch;
|
|
||||||
this.interpolationSteps = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAnimationProcedure(String procedure) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
|
||||||
return this.cache;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -256,7 +256,7 @@ public class DroneEntity extends LivingEntity implements GeoEntity {
|
||||||
var level = this.level();
|
var level = this.level();
|
||||||
final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ());
|
final Vec3 center = new Vec3(this.getX(), this.getY(), this.getZ());
|
||||||
for (Entity target : level.getEntitiesOfClass(Entity.class, aabb, e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
for (Entity target : level.getEntitiesOfClass(Entity.class, aabb, e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
||||||
if (this != target && target != null) {
|
if (this != target && target instanceof LivingEntity) {
|
||||||
target.hurt(ModDamageTypes.causeDroneHitDamage(this.level().registryAccess(), this, controller), 1);
|
target.hurt(ModDamageTypes.causeDroneHitDamage(this.level().registryAccess(), this, controller), 1);
|
||||||
target.invulnerableTime = 0;
|
target.invulnerableTime = 0;
|
||||||
if (target instanceof Mob mobEntity) {
|
if (target instanceof Mob mobEntity) {
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.layer;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
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 BeamLayer extends GeoRenderLayer<BeamEntity> {
|
|
||||||
|
|
||||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/laser_beam_e.png");
|
|
||||||
|
|
||||||
public BeamLayer(GeoRenderer<BeamEntity> entityRenderer) {
|
|
||||||
super(entityRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack poseStack, BeamEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
|
||||||
RenderType glowRenderType = RenderType.energySwirl(LAYER,1,1);
|
|
||||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.entity.model;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import software.bernie.geckolib.core.animatable.model.CoreGeoBone;
|
|
||||||
import software.bernie.geckolib.core.animation.AnimationState;
|
|
||||||
import software.bernie.geckolib.model.GeoModel;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.entity.BeamEntity.LENGTH;
|
|
||||||
|
|
||||||
public class BeamModel extends GeoModel<BeamEntity> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getAnimationResource(BeamEntity entity) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getModelResource(BeamEntity entity) {
|
|
||||||
return ModUtils.loc("geo/laser_beam.geo.json");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation getTextureResource(BeamEntity entity) {
|
|
||||||
return ModUtils.loc("textures/entity/laser_beam.png");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setCustomAnimations(BeamEntity animatable, long instanceId, AnimationState animationState) {
|
|
||||||
CoreGeoBone bone = getAnimationProcessor().getBone("bone");
|
|
||||||
bone.setScaleX(3);
|
|
||||||
bone.setScaleY(3);
|
|
||||||
bone.setScaleZ(2 * (float)(Mth.clamp(animatable.getEntityData().get(LENGTH), 0.1, 512)));
|
|
||||||
// bone.setHidden(Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON && animatable.getOwner() == Minecraft.getInstance().player);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -3,7 +3,6 @@ package com.atsuishio.superbwarfare.event;
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
import com.atsuishio.superbwarfare.ModUtils;
|
||||||
import com.atsuishio.superbwarfare.client.ClickHandler;
|
import com.atsuishio.superbwarfare.client.ClickHandler;
|
||||||
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
import com.atsuishio.superbwarfare.config.client.DisplayConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
import com.atsuishio.superbwarfare.entity.DroneEntity;
|
import com.atsuishio.superbwarfare.entity.DroneEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.ICannonEntity;
|
import com.atsuishio.superbwarfare.entity.ICannonEntity;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
|
@ -360,10 +359,6 @@ public class ClientEventHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookingEntity instanceof BeamEntity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean canAttack = lookingEntity != player && !(lookingEntity instanceof Player player_ && (player_.isCreative() || player_.isSpectator()))
|
boolean canAttack = lookingEntity != player && !(lookingEntity instanceof Player player_ && (player_.isCreative() || player_.isSpectator()))
|
||||||
&& (!player.isAlliedTo(lookingEntity) || lookingEntity.getTeam() == null || lookingEntity.getTeam().getName().equals("TDM"));
|
&& (!player.isAlliedTo(lookingEntity) || lookingEntity.getTeam() == null || lookingEntity.getTeam().getName().equals("TDM"));
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,6 @@ public class ModEntities {
|
||||||
.sized(0.6f, 2f));
|
.sized(0.6f, 2f));
|
||||||
public static final RegistryObject<EntityType<ClaymoreEntity>> CLAYMORE = register("claymore",
|
public static final RegistryObject<EntityType<ClaymoreEntity>> CLAYMORE = register("claymore",
|
||||||
EntityType.Builder.<ClaymoreEntity>of(ClaymoreEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(512).setUpdateInterval(1).sized(0.5f, 0.5f));
|
EntityType.Builder.<ClaymoreEntity>of(ClaymoreEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(512).setUpdateInterval(1).sized(0.5f, 0.5f));
|
||||||
public static final RegistryObject<EntityType<BeamEntity>> BEAM = register("beam",
|
|
||||||
EntityType.Builder.<BeamEntity>of(BeamEntity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(512).setUpdateInterval(1).sized(0.1f, 0.1f));
|
|
||||||
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.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(5124).setUpdateInterval(3).setCustomClientFactory(Mk42Entity::new).fireImmune().sized(3.4f, 3.5f));
|
EntityType.Builder.<Mk42Entity>of(Mk42Entity::new, MobCategory.MISC).setShouldReceiveVelocityUpdates(true).setTrackingRange(5124).setUpdateInterval(3).setCustomClientFactory(Mk42Entity::new).fireImmune().sized(3.4f, 3.5f));
|
||||||
public static final RegistryObject<EntityType<Mle1934Entity>> MLE_1934 = register("mle_1934",
|
public static final RegistryObject<EntityType<Mle1934Entity>> MLE_1934 = register("mle_1934",
|
||||||
|
|
|
@ -14,7 +14,6 @@ public class ModEntityRenderers {
|
||||||
event.registerEntityRenderer(ModEntities.MORTAR.get(), MortarRenderer::new);
|
event.registerEntityRenderer(ModEntities.MORTAR.get(), MortarRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.SENPAI.get(), SenpaiRenderer::new);
|
event.registerEntityRenderer(ModEntities.SENPAI.get(), SenpaiRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.CLAYMORE.get(), ClaymoreRenderer::new);
|
event.registerEntityRenderer(ModEntities.CLAYMORE.get(), ClaymoreRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.BEAM.get(), BeamRenderer::new);
|
|
||||||
event.registerEntityRenderer(ModEntities.TASER_BULLET_PROJECTILE.get(), TaserBulletProjectileRenderer::new);
|
event.registerEntityRenderer(ModEntities.TASER_BULLET_PROJECTILE.get(), TaserBulletProjectileRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.GUN_GRENADE.get(), GunGrenadeRenderer::new);
|
event.registerEntityRenderer(ModEntities.GUN_GRENADE.get(), GunGrenadeRenderer::new);
|
||||||
event.registerEntityRenderer(ModEntities.TARGET.get(), TargetRenderer::new);
|
event.registerEntityRenderer(ModEntities.TARGET.get(), TargetRenderer::new);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.item;
|
package com.atsuishio.superbwarfare.item;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResultHolder;
|
import net.minecraft.world.InteractionResultHolder;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
|
@ -19,10 +18,6 @@ public class BeamTest extends Item {
|
||||||
ItemStack stack = player.getItemInHand(hand);
|
ItemStack stack = player.getItemInHand(hand);
|
||||||
|
|
||||||
if (!stack.getOrCreateTag().getBoolean("Using")) {
|
if (!stack.getOrCreateTag().getBoolean("Using")) {
|
||||||
if (!level.isClientSide) {
|
|
||||||
BeamEntity entity = getBeamEntity(level, player);
|
|
||||||
level.addFreshEntity(entity);
|
|
||||||
}
|
|
||||||
stack.getOrCreateTag().putBoolean("Using", true);
|
stack.getOrCreateTag().putBoolean("Using", true);
|
||||||
player.getCooldowns().addCooldown(this, 10);
|
player.getCooldowns().addCooldown(this, 10);
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,16 +27,6 @@ public class BeamTest extends Item {
|
||||||
return InteractionResultHolder.consume(stack);
|
return InteractionResultHolder.consume(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BeamEntity getBeamEntity(Level level, Player player) {
|
|
||||||
BeamEntity entity = new BeamEntity(player, level);
|
|
||||||
entity.moveTo(player.getX() + 0.5 * player.getLookAngle().x,
|
|
||||||
player.getEyeY() - 0.3 + 0.5 * player.getLookAngle().y,
|
|
||||||
player.getZ() + 0.5 * player.getLookAngle().z, player.getYRot(), 0);
|
|
||||||
entity.setYBodyRot(player.getYRot());
|
|
||||||
entity.setYHeadRot(player.getYRot());
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
public void inventoryTick(ItemStack itemstack, Level world, Entity entity, int slot, boolean selected) {
|
||||||
super.inventoryTick(itemstack, world, entity, slot, selected);
|
super.inventoryTick(itemstack, world, entity, slot, selected);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.tools;
|
package com.atsuishio.superbwarfare.tools;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.entity.BeamEntity;
|
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.level.ClipContext;
|
import net.minecraft.world.level.ClipContext;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
|
@ -15,7 +14,7 @@ public class SeekTool {
|
||||||
public static Entity seekEntity(Entity entity, Level level, double seekRange, double seekAngle) {
|
public static Entity seekEntity(Entity entity, Level level, double seekRange, double seekAngle) {
|
||||||
return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false)
|
return StreamSupport.stream(EntityFindUtil.getEntities(level).getAll().spliterator(), false)
|
||||||
.filter(e -> {
|
.filter(e -> {
|
||||||
if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle && e != entity && !(e instanceof BeamEntity) && e.isAlive()) {
|
if (e.distanceTo(entity) <= seekRange && calculateAngle(e, entity) < seekAngle && e != entity && e.isAlive()) {
|
||||||
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
return level.clip(new ClipContext(entity.getEyePosition(), e.getEyePosition(),
|
||||||
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
|
ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() != HitResult.Type.BLOCK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,89 +0,0 @@
|
||||||
{
|
|
||||||
"format_version": "1.12.0",
|
|
||||||
"minecraft:geometry": [
|
|
||||||
{
|
|
||||||
"description": {
|
|
||||||
"identifier": "geometry.laser_beam",
|
|
||||||
"texture_width": 16,
|
|
||||||
"texture_height": 16,
|
|
||||||
"visible_bounds_width": 2,
|
|
||||||
"visible_bounds_height": 1.5,
|
|
||||||
"visible_bounds_offset": [0, 0.25, 0]
|
|
||||||
},
|
|
||||||
"bones": [
|
|
||||||
{
|
|
||||||
"name": "bone",
|
|
||||||
"pivot": [0, 0, 0],
|
|
||||||
"cubes": [
|
|
||||||
{
|
|
||||||
"origin": [-0.5, -0.5, -16],
|
|
||||||
"size": [1, 1, 16],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [0, 0], "uv_size": [8, 8]},
|
|
||||||
"east": {"uv": [0, 0], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [0, 0], "uv_size": [8, 8]},
|
|
||||||
"west": {"uv": [0, 0], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [8, 8], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [8, 8], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"origin": [-0.75, -0.75, -16],
|
|
||||||
"size": [1.5, 0, 16],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"east": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"west": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [16, 8], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [16, 8], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"origin": [-1.5005, -0.7495, -16],
|
|
||||||
"size": [1.5, 0, 16],
|
|
||||||
"pivot": [-0.375, -0.3745, -8],
|
|
||||||
"rotation": [0, 0, 90],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"east": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"west": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [16, 8], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [16, 8], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"origin": [0, 0, -16],
|
|
||||||
"size": [1.5, 0, 16],
|
|
||||||
"pivot": [0.375, 0.3755, -8],
|
|
||||||
"rotation": [0, 0, -180],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"east": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"west": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [16, 8], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [16, 8], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"origin": [-0.7505, 0.0005, -16],
|
|
||||||
"size": [1.5, 0, 16],
|
|
||||||
"pivot": [0.375, 0.3755, -8],
|
|
||||||
"rotation": [0, 0, -90],
|
|
||||||
"uv": {
|
|
||||||
"north": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"east": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"south": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"west": {"uv": [8, 0], "uv_size": [8, 8]},
|
|
||||||
"up": {"uv": [16, 8], "uv_size": [-8, -8]},
|
|
||||||
"down": {"uv": [16, 8], "uv_size": [-8, -8]}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 81 B |
Binary file not shown.
Before Width: | Height: | Size: 98 B |
Loading…
Add table
Reference in a new issue