注册所有实体
This commit is contained in:
parent
111519ea3a
commit
89c9e52abf
159 changed files with 16206 additions and 229 deletions
|
@ -1,4 +1,4 @@
|
|||
// 1.21.1 2025-03-27T19:46:28.6502692 Item Models: superbwarfare
|
||||
// 1.21.1 2025-03-29T00:41:26.2074689 Item Models: superbwarfare
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/aa_12_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_12_blueprint.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/ak_47_blueprint.json
|
||||
|
@ -21,8 +21,10 @@ a52a7f9dc18d5af69903c2249239c15cb6d38c8e assets/superbwarfare/models/item/coal_p
|
|||
fc892b610a110980dbc6f8e2c080672b5dc06e99 assets/superbwarfare/models/item/copper_plate.json
|
||||
7e43d8e9c4b8589f7665c46d4b67de645949cc6b assets/superbwarfare/models/item/creative_charging_station.json
|
||||
b0296c3d68f3b5ae4945b46384fa20a1ff32cac5 assets/superbwarfare/models/item/crowbar.json
|
||||
d81b738e17048945459ff8b59f8f83e872171473 assets/superbwarfare/models/item/defuser.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/devotion_blueprint.json
|
||||
6f4a829dc159f1740f52265d01730ecb6a840d81 assets/superbwarfare/models/item/dog_tag.json
|
||||
dd455cf29eed0ef5eb5e90ef3d7140cb8de61efe assets/superbwarfare/models/item/drone.json
|
||||
831ce33c5a4c90b71a42515f42f16d4c1a946c50 assets/superbwarfare/models/item/empty_perk.json
|
||||
2419503d8b597c92684d1921895a12fca33fec69 assets/superbwarfare/models/item/epic_material_pack.json
|
||||
b6f96946b54f44fdd2d8b809945b8d1ae5e776e2 assets/superbwarfare/models/item/firing_parameters.json
|
||||
|
@ -65,6 +67,7 @@ a5cf666a970906ba6ac0af9a4d5d52dd0e093dec assets/superbwarfare/models/item/mle_19
|
|||
db96dbb75327701d7901c2de48a539bda9fe31c4 assets/superbwarfare/models/item/mortar_barrel.json
|
||||
3922427d3921d3de7195614780ee8f57dfc0ee6f assets/superbwarfare/models/item/mortar_base_plate.json
|
||||
ac9c6bc308bd741ada7f19d808d0c0722fceb976 assets/superbwarfare/models/item/mortar_bipod.json
|
||||
9baf936f4340d41a0b5581857313240627b00386 assets/superbwarfare/models/item/mortar_deployer.json
|
||||
41381cc65305bbfc1324a08b580125073d198e11 assets/superbwarfare/models/item/mortar_shell.json
|
||||
13ca8d5676888ff51f3308d88e4bf67691fa34f8 assets/superbwarfare/models/item/mosin_nagant_blueprint.json
|
||||
4de8d6e0cddd28963febd35e9b66334a41a25d4c assets/superbwarfare/models/item/motor.json
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/handheld",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/defuser"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/drone"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "minecraft:item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/mortar_deployer"
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ public class ModUtils {
|
|||
|
||||
// bus.addListener(this::onCommonSetup);
|
||||
// bus.addListener(this::onClientSetup);
|
||||
bus.addListener(ModItems::registerDispenserBehavior);
|
||||
|
||||
bus.addListener(NetworkRegistry::register);
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ public class RenderHelper {
|
|||
float blitOffset,
|
||||
float minU, float maxU,
|
||||
float minV, float maxV,
|
||||
float red, float green, float blue, float alpha
|
||||
int color
|
||||
) {
|
||||
RenderSystem.setShaderTexture(0, atlasLocation);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexColorShader);
|
||||
|
@ -226,16 +226,16 @@ public class RenderHelper {
|
|||
BufferBuilder bufferbuilder = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR);
|
||||
bufferbuilder.addVertex(matrix4f, x1, y1, blitOffset)
|
||||
.setUv(minU, minV)
|
||||
.setColor(red, green, blue, alpha);
|
||||
.setColor(color);
|
||||
bufferbuilder.addVertex(matrix4f, x1, y2, blitOffset)
|
||||
.setUv(minU, maxV)
|
||||
.setColor(red, green, blue, alpha);
|
||||
.setColor(color);
|
||||
bufferbuilder.addVertex(matrix4f, x2, y2, blitOffset)
|
||||
.setUv(maxU, maxV)
|
||||
.setColor(red, green, blue, alpha);
|
||||
.setColor(color);
|
||||
bufferbuilder.addVertex(matrix4f, x2, y1, blitOffset)
|
||||
.setUv(maxU, minV)
|
||||
.setColor(red, green, blue, alpha);
|
||||
.setColor(color);
|
||||
BufferUploader.drawWithShader(bufferbuilder.buildOrThrow());
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,149 @@
|
|||
package com.atsuishio.superbwarfare.client.gui;
|
||||
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class RangeHelper {
|
||||
|
||||
public static final int MAX_RANGE = 1145;
|
||||
|
||||
/**
|
||||
* 计算迫击炮理论水平射程
|
||||
*
|
||||
* @param thetaDegrees 发射角度(以度为单位),需要根据实际情况修改
|
||||
*/
|
||||
public static double getRange(double thetaDegrees) {
|
||||
double initialVelocity = 11.4; // 初始速度 11.4 m/s
|
||||
double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度
|
||||
double gravity = 0.146; // 重力加速度
|
||||
double velocityDecay = 0.99; // 速度衰减系数
|
||||
|
||||
// 计算射程
|
||||
return calculateRange(initialVelocity, thetaRadians, gravity, velocityDecay);
|
||||
}
|
||||
|
||||
public static double calculateRange(double initialVelocity, double theta, double gravity, double velocityDecay) {
|
||||
double vx = initialVelocity * Math.cos(theta); // 水平速度
|
||||
double vy = initialVelocity * Math.sin(theta); // 垂直速度
|
||||
|
||||
double x = 0.0; // 水平位置
|
||||
double y = 1.0; // 垂直位置
|
||||
|
||||
// 当炮弹还未触地时,继续计算飞行轨迹
|
||||
while (y >= 0) {
|
||||
// 更新位置
|
||||
x += vx;
|
||||
y += vy;
|
||||
|
||||
// 更新速度
|
||||
vx *= velocityDecay;
|
||||
vy = vy * velocityDecay - gravity;
|
||||
|
||||
// 如果炮弹触地,则跳出循环
|
||||
if (y < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 返回最终水平距离
|
||||
return x;
|
||||
}
|
||||
|
||||
public static double calculateRangeWithDeltaY(double initialVelocity, double theta, double gravity, double velocityDecay, double deltaY) {
|
||||
double vx = initialVelocity * Math.cos(theta); // 水平速度
|
||||
double vy = initialVelocity * Math.sin(theta); // 垂直速度
|
||||
|
||||
double range = 0.0; // 水平距离
|
||||
double y = 1.0; // 垂直位置
|
||||
|
||||
double commonRange = calculateRange(initialVelocity, theta, gravity, velocityDecay);
|
||||
|
||||
// 当炮弹还未触地时,继续计算飞行轨迹
|
||||
while (range < commonRange / 2 || (range >= commonRange / 2 && y >= deltaY)) {
|
||||
// 更新位置
|
||||
range += vx;
|
||||
y += vy;
|
||||
|
||||
// 更新速度
|
||||
vx *= velocityDecay;
|
||||
vy = vy * velocityDecay - gravity;
|
||||
|
||||
if (range >= commonRange / 2 && y < deltaY) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 返回最终水平距离
|
||||
return range;
|
||||
}
|
||||
|
||||
public static boolean canReachTarget(double initialVelocity, double gravity, double velocityDecay, Vec3 startPos, Vec3 targetPos, double[] angles) {
|
||||
if (startPos.equals(targetPos)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double startX = startPos.x;
|
||||
double startY = startPos.y;
|
||||
double startZ = startPos.z;
|
||||
|
||||
double targetX = targetPos.x;
|
||||
double targetY = targetPos.y;
|
||||
double targetZ = targetPos.z;
|
||||
|
||||
double distanceXZ = Math.sqrt(Math.pow(targetX - startX, 2) + Math.pow(targetZ - startZ, 2));
|
||||
if (distanceXZ > MAX_RANGE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double theta = calculateLaunchAngle(initialVelocity, gravity, velocityDecay, distanceXZ, targetY - startY);
|
||||
|
||||
if (theta < 20 || theta > 90) {
|
||||
return false;
|
||||
}
|
||||
|
||||
angles[0] = Math.atan2(targetZ, targetX); // 水平角度
|
||||
angles[1] = theta; // 炮口抬升角度
|
||||
return true;
|
||||
}
|
||||
|
||||
public static double calculateLaunchAngle(double initialVelocity, double gravity, double velocityDecay, double distanceXZ, double targetY) {
|
||||
double left = 20; // 最小角度
|
||||
double right = 30; // 最大角度
|
||||
double tolerance = 0.5; // 允许的误差范围
|
||||
|
||||
// 在 20 到 30 之间搜索
|
||||
while (right - left > tolerance) {
|
||||
double mid = (left + right) / 2;
|
||||
double radian = Math.toRadians(mid);
|
||||
double range = calculateRangeWithDeltaY(initialVelocity, radian, gravity, velocityDecay, targetY);
|
||||
|
||||
if (Math.abs(range - distanceXZ) < tolerance * 8) {
|
||||
return mid;
|
||||
} else if (range < distanceXZ) {
|
||||
left = mid;
|
||||
} else {
|
||||
right = mid;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果在 20 到 30 之间没有找到合适的角度,则在 30 到 90 之间搜索
|
||||
left = 30;
|
||||
right = 90;
|
||||
|
||||
while (right - left > tolerance) {
|
||||
double mid = (left + right) / 2;
|
||||
double radian = Math.toRadians(mid);
|
||||
double range = calculateRangeWithDeltaY(initialVelocity, radian, gravity, velocityDecay, targetY);
|
||||
|
||||
if (Math.abs(range - distanceXZ) < tolerance * 8) {
|
||||
return mid;
|
||||
} else if (range < distanceXZ) {
|
||||
right = mid;
|
||||
} else {
|
||||
left = mid;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果仍然没有找到合适的角度,则返回 -1
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
||||
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 CannonShellLayer extends GeoRenderLayer<CannonShellEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/cannon_shell_e.png");
|
||||
|
||||
public CannonShellLayer(GeoRenderer<CannonShellEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, CannonShellEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
|
||||
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 GunGrenadeLayer extends GeoRenderLayer<GunGrenadeEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/cannon_shell_e.png");
|
||||
|
||||
public GunGrenadeLayer(GeoRenderer<GunGrenadeEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, GunGrenadeEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||
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 HeliRocketLayer extends GeoRenderLayer<HeliRocketEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/rpg_rocket_e.png");
|
||||
|
||||
public HeliRocketLayer(GeoRenderer<HeliRocketEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, HeliRocketEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.JavelinMissileEntity;
|
||||
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 JavelinMissleLayer extends GeoRenderLayer<JavelinMissileEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/rpg_rocket_e.png");
|
||||
|
||||
public JavelinMissleLayer(GeoRenderer<JavelinMissileEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, JavelinMissileEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
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 net.minecraft.util.FastColor;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
public class ProjectileEntityInsideLayer extends GeoRenderLayer<ProjectileEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/projectile_entity_inside.png");
|
||||
|
||||
public ProjectileEntityInsideLayer(GeoRenderer<ProjectileEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, ProjectileEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType),
|
||||
partialTick, packedLight, OverlayTexture.NO_OVERLAY,
|
||||
FastColor.ARGB32.color((int) (0.2f * 255), 255, 255, 255));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
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 net.minecraft.util.FastColor;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
public class ProjectileEntityLayer extends GeoRenderLayer<ProjectileEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/projectile_entity.png");
|
||||
|
||||
public ProjectileEntityLayer(GeoRenderer<ProjectileEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, ProjectileEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
|
||||
float r = animatable.getEntityData().get(ProjectileEntity.COLOR_R);
|
||||
float g = animatable.getEntityData().get(ProjectileEntity.COLOR_G);
|
||||
float b = animatable.getEntityData().get(ProjectileEntity.COLOR_B);
|
||||
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType,
|
||||
bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY,
|
||||
FastColor.ARGB32.color((int) (0.8 * 255), (int) (r * 255), (int) (g * 255), (int) (b * 255)));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity;
|
||||
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 RpgRocketLayer extends GeoRenderLayer<RpgRocketEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/rpg_rocket_e.png");
|
||||
|
||||
public RpgRocketLayer(GeoRenderer<RpgRocketEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, RpgRocketEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
||||
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 SmallCannonShellLayer extends GeoRenderLayer<SmallCannonShellEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/cannon_shell_e.png");
|
||||
|
||||
public SmallCannonShellLayer(GeoRenderer<SmallCannonShellEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, SmallCannonShellEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
||||
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 WgMissileLayer extends GeoRenderLayer<WgMissileEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/rpg_rocket_e.png");
|
||||
|
||||
public WgMissileLayer(GeoRenderer<WgMissileEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, WgMissileEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.client.ModRenderTypes;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 AnnihilatorGlowLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_glow_e.png");
|
||||
|
||||
public AnnihilatorGlowLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = ModRenderTypes.LASER.apply(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 AnnihilatorLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_e.png");
|
||||
|
||||
public AnnihilatorLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 AnnihilatorLedLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_led.png");
|
||||
|
||||
public AnnihilatorLedLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 AnnihilatorLedLightLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_led.png");
|
||||
|
||||
public AnnihilatorLedLightLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 net.minecraft.util.FastColor;
|
||||
import net.minecraft.util.Mth;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
public class AnnihilatorPowerLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_power.png");
|
||||
|
||||
public AnnihilatorPowerLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
|
||||
float red = 1 - Mth.clamp(2.5f * animatable.getEnergy() / animatable.getMaxEnergy(), 0, 1);
|
||||
float green = Mth.clamp(2.5f * animatable.getEnergy() / animatable.getMaxEnergy(), 0, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY,
|
||||
FastColor.ARGB32.color(255, (int) (red * 255), (int) (green * 255), 0));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 net.minecraft.util.FastColor;
|
||||
import net.minecraft.util.Mth;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
public class AnnihilatorPowerLightLayer extends GeoRenderLayer<AnnihilatorEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/annihilator_power.png");
|
||||
|
||||
public AnnihilatorPowerLightLayer(GeoRenderer<AnnihilatorEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, AnnihilatorEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
float red = 1 - Mth.clamp(2.5f * animatable.getEnergy() / animatable.getMaxEnergy(), 0, 1);
|
||||
float green = Mth.clamp(2.5f * animatable.getEnergy() / animatable.getMaxEnergy(), 0, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY,
|
||||
FastColor.ARGB32.color(255, (int) (red * 255), (int) (green * 255), 0));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity;
|
||||
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 Bmp2Layer extends GeoRenderLayer<Bmp2Entity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/speedboat_e.png");
|
||||
|
||||
public Bmp2Layer(GeoRenderer<Bmp2Entity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, Bmp2Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity;
|
||||
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 LaserTowerLaserLayer extends GeoRenderLayer<LaserTowerEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/laser_tower_laser.png");
|
||||
|
||||
public LaserTowerLaserLayer(GeoRenderer<LaserTowerEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, LaserTowerEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity;
|
||||
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;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity.ACTIVE;
|
||||
|
||||
public class LaserTowerPowerLayer extends GeoRenderLayer<LaserTowerEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/laser_tower_e.png");
|
||||
|
||||
public LaserTowerPowerLayer(GeoRenderer<LaserTowerEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, LaserTowerEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
if (animatable.getEnergy() <= 0 || !animatable.getEntityData().get(ACTIVE)) return;
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
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 Lav150Layer extends GeoRenderLayer<Lav150Entity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/speedboat_e.png");
|
||||
|
||||
public Lav150Layer(GeoRenderer<Lav150Entity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, Lav150Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
||||
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 Mk42Layer extends GeoRenderLayer<Mk42Entity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/sherman_e.png");
|
||||
|
||||
public Mk42Layer(GeoRenderer<Mk42Entity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, Mk42Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
||||
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 Mle1934Layer extends GeoRenderLayer<Mle1934Entity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/sherman_e.png");
|
||||
|
||||
public Mle1934Layer(GeoRenderer<Mle1934Entity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, Mle1934Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||
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 MortarLayer extends GeoRenderLayer<MortarEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/mortar_e.png");
|
||||
|
||||
public MortarLayer(GeoRenderer<MortarEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, MortarEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||
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 net.minecraft.util.FastColor;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity.HEAT;
|
||||
|
||||
public class SpeedBoatHeatLayer extends GeoRenderLayer<SpeedboatEntity> {
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/speedboat_heat.png");
|
||||
|
||||
public SpeedBoatHeatLayer(GeoRenderer<SpeedboatEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, SpeedboatEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
float heat = animatable.getEntityData().get(HEAT) < 20 ? 0 : animatable.getEntityData().get(HEAT) - 20;
|
||||
int heatColor = (int) (heat / 80);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY,
|
||||
FastColor.ARGB32.color(255, heatColor, heatColor, heatColor)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||
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 SpeedBoatLayer extends GeoRenderLayer<SpeedboatEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/speedboat_e.png");
|
||||
|
||||
public SpeedBoatLayer(GeoRenderer<SpeedboatEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, SpeedboatEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = RenderType.energySwirl(LAYER, 1, 1);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||
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 SpeedBoatPowerLayer extends GeoRenderLayer<SpeedboatEntity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/speedboat_power.png");
|
||||
|
||||
public SpeedBoatPowerLayer(GeoRenderer<SpeedboatEntity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, SpeedboatEntity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
if (animatable.getEnergy() <= 0) return;
|
||||
RenderType glowRenderType = RenderType.eyes(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
package com.atsuishio.superbwarfare.client.layer.vehicle;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.client.ModRenderTypes;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity;
|
||||
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 Yx100GlowLayer extends GeoRenderLayer<Yx100Entity> {
|
||||
|
||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/yx_100_glow.png");
|
||||
|
||||
public Yx100GlowLayer(GeoRenderer<Yx100Entity> entityRenderer) {
|
||||
super(entityRenderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, Yx100Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
||||
RenderType glowRenderType = ModRenderTypes.LASER.apply(LAYER);
|
||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Ah6Model extends GeoModel<Ah6Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Ah6Entity entity) {
|
||||
return null;
|
||||
// return ModUtils.loc("animations/wheel_chair.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Ah6Entity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 32) {
|
||||
return ModUtils.loc("geo/ah_6.geo.json");
|
||||
} else if (distance < 64) {
|
||||
return ModUtils.loc("geo/ah_6.lod1.geo.json");
|
||||
} else if (distance < 96) {
|
||||
return ModUtils.loc("geo/ah_6.lod2.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/ah_6.lod3.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Ah6Entity entity) {
|
||||
return ModUtils.loc("textures/entity/ah_6.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
import software.bernie.geckolib.model.data.EntityModelData;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity.*;
|
||||
|
||||
public class AnnihilatorModel extends GeoModel<AnnihilatorEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(AnnihilatorEntity entity) {
|
||||
return ModUtils.loc("animations/annihilator.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(AnnihilatorEntity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 64) {
|
||||
return ModUtils.loc("geo/annihilator.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/annihilator.lod1.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(AnnihilatorEntity entity) {
|
||||
return ModUtils.loc("textures/entity/annihilator.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(AnnihilatorEntity animatable, long instanceId, AnimationState<AnnihilatorEntity> animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("PaoGuan");
|
||||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
||||
bone.setRotX((entityData.headPitch()) * Mth.DEG_TO_RAD);
|
||||
|
||||
GeoBone laserLeft = getAnimationProcessor().getBone("laser1");
|
||||
GeoBone laserMiddle = getAnimationProcessor().getBone("laser2");
|
||||
GeoBone laserRight = getAnimationProcessor().getBone("laser3");
|
||||
|
||||
laserLeft.setScaleZ(animatable.getEntityData().get(LASER_LEFT_LENGTH) + 0.5f);
|
||||
laserMiddle.setScaleZ(animatable.getEntityData().get(LASER_MIDDLE_LENGTH) + 0.5f);
|
||||
laserRight.setScaleZ(animatable.getEntityData().get(LASER_RIGHT_LENGTH) + 0.5f);
|
||||
|
||||
GeoBone ledGreen = getAnimationProcessor().getBone("ledgreen");
|
||||
GeoBone ledGreen2 = getAnimationProcessor().getBone("ledgreen2");
|
||||
GeoBone ledGreen3 = getAnimationProcessor().getBone("ledgreen3");
|
||||
GeoBone ledGreen4 = getAnimationProcessor().getBone("ledgreen4");
|
||||
GeoBone ledGreen5 = getAnimationProcessor().getBone("ledgreen5");
|
||||
|
||||
GeoBone ledRed = getAnimationProcessor().getBone("ledred");
|
||||
GeoBone ledRed2 = getAnimationProcessor().getBone("ledred2");
|
||||
GeoBone ledRed3 = getAnimationProcessor().getBone("ledred3");
|
||||
GeoBone ledRed4 = getAnimationProcessor().getBone("ledred4");
|
||||
GeoBone ledRed5 = getAnimationProcessor().getBone("ledred5");
|
||||
|
||||
float coolDown = animatable.getEntityData().get(COOL_DOWN);
|
||||
boolean cantShoot = animatable.getEnergy() < VehicleConfig.ANNIHILATOR_SHOOT_COST.get();
|
||||
|
||||
ledGreen.setHidden(coolDown > 80 || cantShoot);
|
||||
ledGreen2.setHidden(coolDown > 60 || cantShoot);
|
||||
ledGreen3.setHidden(coolDown > 40 || cantShoot);
|
||||
ledGreen4.setHidden(coolDown > 20 || cantShoot);
|
||||
ledGreen5.setHidden(coolDown > 0 || cantShoot);
|
||||
|
||||
ledRed.setHidden(!ledGreen.isHidden());
|
||||
ledRed2.setHidden(!ledGreen2.isHidden());
|
||||
ledRed3.setHidden(!ledGreen3.isHidden());
|
||||
ledRed4.setHidden(!ledGreen4.isHidden());
|
||||
ledRed5.setHidden(!ledGreen5.isHidden());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Bmp2Model extends GeoModel<Bmp2Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Bmp2Entity entity) {
|
||||
return ModUtils.loc("animations/lav.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Bmp2Entity entity) {
|
||||
return ModUtils.loc("geo/bmp2.geo.json");
|
||||
// Player player = Minecraft.getInstance().player;
|
||||
//
|
||||
// int distance = 0;
|
||||
//
|
||||
// if (player != null) {
|
||||
// distance = (int) player.position().distanceTo(entity.position());
|
||||
// }
|
||||
//
|
||||
// if (distance < 32) {
|
||||
// return ModUtils.loc("geo/Bmp2.geo.json");
|
||||
// } else {
|
||||
// return ModUtils.loc("geo/speedboat.lod1.geo.json");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Bmp2Entity entity) {
|
||||
return ModUtils.loc("textures/entity/bmp2.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class C4Model extends GeoModel<C4Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(C4Entity entity) {
|
||||
return ModUtils.loc("animations/c4.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(C4Entity entity) {
|
||||
return ModUtils.loc("geo/c4.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(C4Entity entity) {
|
||||
UUID uuid = entity.getUUID();
|
||||
if (uuid.getLeastSignificantBits() % 114 == 0) {
|
||||
return ModUtils.loc("textures/item/c4_alter.png");
|
||||
}
|
||||
return ModUtils.loc("textures/item/c4.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class CannonShellEntityModel extends GeoModel<CannonShellEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(CannonShellEntity entity) {
|
||||
return ModUtils.loc("animations/cannon_shell.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(CannonShellEntity entity) {
|
||||
return ModUtils.loc("geo/cannon_shell.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(CannonShellEntity entity) {
|
||||
return ModUtils.loc("textures/entity/cannon_shell.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(CannonShellEntity animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("bone");
|
||||
bone.setHidden(animatable.tickCount <= 1);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ClaymoreModel extends GeoModel<ClaymoreEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(ClaymoreEntity entity) {
|
||||
return ModUtils.loc("animations/claymore.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(ClaymoreEntity entity) {
|
||||
return ModUtils.loc("geo/claymore.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(ClaymoreEntity entity) {
|
||||
UUID uuid = entity.getUUID();
|
||||
if (uuid.getLeastSignificantBits() % 514 == 0) {
|
||||
return ModUtils.loc("textures/entity/claymore_alter.png");
|
||||
}
|
||||
return ModUtils.loc("textures/entity/claymore.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class DroneModel extends GeoModel<DroneEntity> {
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(DroneEntity entity) {
|
||||
return ModUtils.loc("animations/drone.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(DroneEntity entity) {
|
||||
return ModUtils.loc("geo/drone.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(DroneEntity entity) {
|
||||
return ModUtils.loc("textures/entity/drone.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class GunGrenadeModel extends GeoModel<GunGrenadeEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(GunGrenadeEntity entity) {
|
||||
return ModUtils.loc("animations/cannon_shell.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(GunGrenadeEntity entity) {
|
||||
return ModUtils.loc("geo/cannon_shell.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(GunGrenadeEntity entity) {
|
||||
return ModUtils.loc("textures/entity/cannon_shell.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(GunGrenadeEntity animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("bone");
|
||||
bone.setScaleX(0.2f);
|
||||
bone.setScaleY(0.2f);
|
||||
bone.setScaleZ(0.2f);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HandGrenadeEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class HandGrenadeEntityModel extends GeoModel<HandGrenadeEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(HandGrenadeEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(HandGrenadeEntity entity) {
|
||||
return ModUtils.loc("geo/hand_grenade.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(HandGrenadeEntity entity) {
|
||||
return ModUtils.loc("textures/entity/hand_grenade.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class HeliRocketModel extends GeoModel<HeliRocketEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(HeliRocketEntity entity) {
|
||||
return ModUtils.loc("animations/rpg_rocket.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(HeliRocketEntity entity) {
|
||||
return ModUtils.loc("geo/heli_rocket.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(HeliRocketEntity entity) {
|
||||
return ModUtils.loc("textures/entity/heli_rocket.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.JavelinMissileEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class JavelinMissileModel extends GeoModel<JavelinMissileEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(JavelinMissileEntity entity) {
|
||||
return ModUtils.loc("animations/javelin_missile.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(JavelinMissileEntity entity) {
|
||||
return ModUtils.loc("geo/javelin_missile.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(JavelinMissileEntity entity) {
|
||||
return ModUtils.loc("textures/entity/javelin_missile.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity.LASER_LENGTH;
|
||||
|
||||
public class LaserTowerModel extends GeoModel<LaserTowerEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(LaserTowerEntity entity) {
|
||||
return ModUtils.loc("animations/laser_tower.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(LaserTowerEntity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 24 || player.isScoping()) {
|
||||
return ModUtils.loc("geo/laser_tower.geo.json");
|
||||
} else if (distance < 48) {
|
||||
return ModUtils.loc("geo/laser_tower.lod1.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/laser_tower.lod2.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(LaserTowerEntity entity) {
|
||||
return ModUtils.loc("textures/entity/laser_tower.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(LaserTowerEntity animatable, long instanceId, AnimationState<LaserTowerEntity> animationState) {
|
||||
GeoBone laser = getAnimationProcessor().getBone("laser");
|
||||
laser.setScaleZ(10 * animatable.getEntityData().get(LASER_LENGTH));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Lav150Model extends GeoModel<Lav150Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Lav150Entity entity) {
|
||||
return ModUtils.loc("animations/lav.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Lav150Entity entity) {
|
||||
return ModUtils.loc("geo/lav150.geo.json");
|
||||
// Player player = Minecraft.getInstance().player;
|
||||
//
|
||||
// int distance = 0;
|
||||
//
|
||||
// if (player != null) {
|
||||
// distance = (int) player.position().distanceTo(entity.position());
|
||||
// }
|
||||
//
|
||||
// if (distance < 32) {
|
||||
// return ModUtils.loc("geo/lav150.geo.json");
|
||||
// } else {
|
||||
// return ModUtils.loc("geo/speedboat.lod1.geo.json");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Lav150Entity entity) {
|
||||
return ModUtils.loc("textures/entity/lav150.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
import software.bernie.geckolib.model.data.EntityModelData;
|
||||
|
||||
public class Mk42Model extends GeoModel<Mk42Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Mk42Entity entity) {
|
||||
return ModUtils.loc("animations/mk_42.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Mk42Entity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 32) {
|
||||
return ModUtils.loc("geo/sherman.geo.json");
|
||||
} else if (distance < 64) {
|
||||
return ModUtils.loc("geo/sherman_lod1.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/sherman_lod2.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Mk42Entity entity) {
|
||||
return ModUtils.loc("textures/entity/mk42.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(Mk42Entity animatable, long instanceId, AnimationState<Mk42Entity> animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("maingun");
|
||||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
||||
bone.setRotX((entityData.headPitch()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
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 ModUtils.loc("animations/mle1934.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Mle1934Entity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 32) {
|
||||
return ModUtils.loc("geo/mle1934.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/mle1934_lod1.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Mle1934Entity entity) {
|
||||
return ModUtils.loc("textures/entity/mle1934.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(Mle1934Entity animatable, long instanceId, AnimationState<Mle1934Entity> animationState) {
|
||||
GeoBone barrel = getAnimationProcessor().getBone("barrel");
|
||||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
||||
barrel.setRotX((entityData.headPitch()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.constant.DataTickets;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
import software.bernie.geckolib.model.data.EntityModelData;
|
||||
|
||||
public class MortarModel extends GeoModel<MortarEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(MortarEntity entity) {
|
||||
return ModUtils.loc("animations/mortar.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(MortarEntity entity) {
|
||||
return ModUtils.loc("geo/mortar.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(MortarEntity entity) {
|
||||
return ModUtils.loc("textures/entity/mortar.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(MortarEntity animatable, long instanceId, AnimationState<MortarEntity> animationState) {
|
||||
GeoBone head = getAnimationProcessor().getBone("paoguan");
|
||||
GeoBone jiaojia = getAnimationProcessor().getBone("jiaojia");
|
||||
if (head != null) {
|
||||
EntityModelData entityData = animationState.getData(DataTickets.ENTITY_MODEL_DATA);
|
||||
head.setRotX((entityData.headPitch()) * Mth.DEG_TO_RAD);
|
||||
jiaojia.setRotX(-2 * ((entityData.headPitch() - (10 - entityData.headPitch() * 0.1f)) * Mth.DEG_TO_RAD));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class MortarShellEntityModel extends GeoModel<MortarShellEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(MortarShellEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(MortarShellEntity entity) {
|
||||
return ModUtils.loc("geo/mortar_shell.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(MortarShellEntity entity) {
|
||||
return ModUtils.loc("textures/entity/mortar.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.ArmedVehicleEntity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class ProjectileEntityModel extends GeoModel<ProjectileEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(ProjectileEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(ProjectileEntity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
if (player == null) {
|
||||
return ModUtils.loc("geo/projectile_entity2.geo.json");
|
||||
}
|
||||
|
||||
if ((ClientEventHandler.zoom && !player.getMainHandItem().is(ModItems.MINIGUN.get()))
|
||||
|| player.getMainHandItem().is(ModItems.GLOCK_17.get())
|
||||
|| player.getMainHandItem().is(ModItems.GLOCK_18.get())
|
||||
|| player.getMainHandItem().is(ModItems.BOCEK.get())
|
||||
|| (player.getVehicle() instanceof ArmedVehicleEntity)) {
|
||||
return ModUtils.loc("geo/projectile_entity.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/projectile_entity2.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(ProjectileEntity entity) {
|
||||
return ModUtils.loc("textures/entity/empty.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(ProjectileEntity animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("bone");
|
||||
Player player = Minecraft.getInstance().player;
|
||||
if (player != null) {
|
||||
bone.setHidden(animatable.position().distanceTo(player.position()) < 3 || animatable.tickCount < 1);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class RgoGrenadeEntityModel extends GeoModel<RgoGrenadeEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(RgoGrenadeEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(RgoGrenadeEntity entity) {
|
||||
return ModUtils.loc("geo/rgo_grenade.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(RgoGrenadeEntity entity) {
|
||||
return ModUtils.loc("textures/item/rgo_grenade.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class RpgRocketModel extends GeoModel<RpgRocketEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(RpgRocketEntity entity) {
|
||||
return ModUtils.loc("animations/rpg_rocket.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(RpgRocketEntity entity) {
|
||||
return ModUtils.loc("geo/rpg_rocket.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(RpgRocketEntity entity) {
|
||||
return ModUtils.loc("textures/entity/rpg_rocket.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.SenpaiEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class SenpaiModel extends GeoModel<SenpaiEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(SenpaiEntity entity) {
|
||||
return ModUtils.loc("animations/senpai.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(SenpaiEntity entity) {
|
||||
return ModUtils.loc("geo/senpai.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(SenpaiEntity entity) {
|
||||
return ModUtils.loc("textures/entity/senpai.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class SmallCannonShellModel extends GeoModel<SmallCannonShellEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(SmallCannonShellEntity entity) {
|
||||
return ModUtils.loc("animations/cannon_shell.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(SmallCannonShellEntity entity) {
|
||||
return ModUtils.loc("geo/cannon_shell.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(SmallCannonShellEntity entity) {
|
||||
return ModUtils.loc("textures/entity/cannon_shell.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(SmallCannonShellEntity animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone bone = getAnimationProcessor().getBone("bone");
|
||||
bone.setScaleX(0.17f);
|
||||
bone.setScaleY(0.17f);
|
||||
bone.setScaleZ(0.17f);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class SpeedboatModel extends GeoModel<SpeedboatEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(SpeedboatEntity entity) {
|
||||
return ModUtils.loc("animations/speedboat.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(SpeedboatEntity entity) {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
int distance = 0;
|
||||
|
||||
if (player != null) {
|
||||
distance = (int) player.position().distanceTo(entity.position());
|
||||
}
|
||||
|
||||
if (distance < 32) {
|
||||
return ModUtils.loc("geo/speedboat.geo.json");
|
||||
} else {
|
||||
return ModUtils.loc("geo/speedboat.lod1.geo.json");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(SpeedboatEntity entity) {
|
||||
return ModUtils.loc("textures/entity/speedboat.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.TaserBulletEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class TaserBulletProjectileModel extends GeoModel<TaserBulletEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(TaserBulletEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(TaserBulletEntity entity) {
|
||||
return ModUtils.loc("geo/taser_rod.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(TaserBulletEntity entity) {
|
||||
return ModUtils.loc("textures/entity/taser_rod.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Tom6Model extends GeoModel<Tom6Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Tom6Entity entity) {
|
||||
return null;
|
||||
// return ModUtils.loc("animations/wheel_chair.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Tom6Entity entity) {
|
||||
return ModUtils.loc("geo/tom_6.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Tom6Entity entity) {
|
||||
return ModUtils.loc("textures/entity/tom_6.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class WgMissileModel extends GeoModel<WgMissileEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(WgMissileEntity entity) {
|
||||
return ModUtils.loc("animations/javelin_missile.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(WgMissileEntity entity) {
|
||||
return ModUtils.loc("geo/wg_missile.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(WgMissileEntity entity) {
|
||||
return ModUtils.loc("textures/entity/javelin_missile.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.WheelChairEntity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class WheelChairModel extends GeoModel<WheelChairEntity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(WheelChairEntity entity) {
|
||||
return null;
|
||||
// return ModUtils.loc("animations/wheel_chair.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(WheelChairEntity entity) {
|
||||
return ModUtils.loc("geo/wheel_chair.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(WheelChairEntity entity) {
|
||||
return ModUtils.loc("textures/entity/wheel_chair.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.atsuishio.superbwarfare.client.model.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class Yx100Model extends GeoModel<Yx100Entity> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(Yx100Entity entity) {
|
||||
return ModUtils.loc("animations/yx_100.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(Yx100Entity entity) {
|
||||
return ModUtils.loc("geo/yx_100.geo.json");
|
||||
// Player player = Minecraft.getInstance().player;
|
||||
//
|
||||
// int distance = 0;
|
||||
//
|
||||
// if (player != null) {
|
||||
// distance = (int) player.position().distanceTo(entity.position());
|
||||
// }
|
||||
//
|
||||
// if (distance < 32) {
|
||||
// return ModUtils.loc("geo/Yx100.geo.json");
|
||||
// } else {
|
||||
// return ModUtils.loc("geo/speedboat.lod1.geo.json");
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(Yx100Entity entity) {
|
||||
return ModUtils.loc("textures/entity/yx_100.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.atsuishio.superbwarfare.client.model.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.atsuishio.superbwarfare.item.LungeMine;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import software.bernie.geckolib.animation.AnimationState;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
public class LungeMineModel extends GeoModel<LungeMine> {
|
||||
|
||||
@Override
|
||||
public ResourceLocation getAnimationResource(LungeMine animatable) {
|
||||
return ModUtils.loc("animations/lunge_mine.animation.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getModelResource(LungeMine animatable) {
|
||||
return ModUtils.loc("geo/lunge_mine.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureResource(LungeMine animatable) {
|
||||
return ModUtils.loc("textures/item/lunge_mine.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomAnimations(LungeMine animatable, long instanceId, AnimationState animationState) {
|
||||
GeoBone camera = getAnimationProcessor().getBone("camera");
|
||||
ClientEventHandler.shake(Mth.RAD_TO_DEG * camera.getRotX(), Mth.RAD_TO_DEG * camera.getRotY(), Mth.RAD_TO_DEG * camera.getRotZ());
|
||||
}
|
||||
}
|
|
@ -156,6 +156,7 @@ public abstract class AbstractLaserEntityRenderer<T extends AbstractLaserEntity>
|
|||
}
|
||||
|
||||
protected void drawVertex(Matrix4f matrix, Matrix3f normals, VertexConsumer vertexBuilder, float offsetX, float offsetY, float offsetZ, float textureX, float textureY, int packedLightIn) {
|
||||
// TODO drawVertex
|
||||
// vertexBuilder.addVertex(matrix, offsetX, offsetY, offsetZ).setColor(1F, 1F, 1F, 1F).setUv(textureX, textureY).setOverlay(OverlayTexture.NO_OVERLAY).setLight(packedLightIn).setNormal(normals, 0.0F, 1.0F, 0.0F).endVertex();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Ah6Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Ah6Entity;
|
||||
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 net.minecraft.world.phys.Vec3;
|
||||
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 Ah6Renderer extends GeoEntityRenderer<Ah6Entity> {
|
||||
|
||||
public Ah6Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Ah6Model());
|
||||
this.shadowRadius = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Ah6Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Ah6Entity 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(Ah6Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, @NotNull MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
Vec3 root = new Vec3(0, 1.45, 0);
|
||||
poseStack.rotateAround(Axis.YP.rotationDegrees(-entityYaw), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())), (float) root.x, (float) root.y, (float) root.z);
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Ah6Entity 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("propeller")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.propellerRotO, animatable.getPropellerRot()));
|
||||
}
|
||||
if (name.equals("tailPropeller")) {
|
||||
bone.setRotX(-6 * Mth.lerp(partialTick, animatable.propellerRotO, animatable.getPropellerRot()));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.*;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.AnnihilatorModel;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.AnnihilatorEntity;
|
||||
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 AnnihilatorRenderer extends GeoEntityRenderer<AnnihilatorEntity> {
|
||||
|
||||
public AnnihilatorRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new AnnihilatorModel());
|
||||
this.addRenderLayer(new AnnihilatorLayer(this));
|
||||
this.addRenderLayer(new AnnihilatorGlowLayer(this));
|
||||
this.addRenderLayer(new AnnihilatorPowerLayer(this));
|
||||
this.addRenderLayer(new AnnihilatorPowerLightLayer(this));
|
||||
this.addRenderLayer(new AnnihilatorLedLayer(this));
|
||||
this.addRenderLayer(new AnnihilatorLedLightLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(AnnihilatorEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, AnnihilatorEntity 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(AnnihilatorEntity 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())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(AnnihilatorEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,246 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.Bmp2Layer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Bmp2Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Bmp2Entity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.YAW;
|
||||
|
||||
public class Bmp2Renderer extends GeoEntityRenderer<Bmp2Entity> {
|
||||
|
||||
public Bmp2Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Bmp2Model());
|
||||
this.addRenderLayer(new Bmp2Layer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Bmp2Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Bmp2Entity 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(Bmp2Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Bmp2Entity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
String name = bone.getName();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (name.equals("wheelL" + i)) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("wheelR" + i)) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equals("cannon")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
if (name.equals("barrel")) {
|
||||
|
||||
float a = animatable.getTurretYaw(partialTick);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setRotX(
|
||||
-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD
|
||||
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
|
||||
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD
|
||||
);
|
||||
}
|
||||
|
||||
if (name.equals("flare")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
if (name.equals("flare2")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
|
||||
if (name.equals("base")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
float a = animatable.getEntityData().get(YAW);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
bone.setPosZ(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.125f);
|
||||
bone.setRotX(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.06f);
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.125f);
|
||||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.2f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 51; i++) {
|
||||
float tO = animatable.leftTrackO + 2 * i;
|
||||
float t = animatable.getLeftTrack() + 2 * i;
|
||||
|
||||
while (t >= 100) {
|
||||
t -= 100;
|
||||
}
|
||||
while (t <= 0) {
|
||||
t += 100;
|
||||
}
|
||||
while (tO >= 100) {
|
||||
tO -= 100;
|
||||
}
|
||||
while (tO <= 0) {
|
||||
tO += 100;
|
||||
}
|
||||
|
||||
float tO2 = animatable.rightTrackO + 2 * i;
|
||||
float t2 = animatable.getRightTrack() + 2 * i;
|
||||
|
||||
while (t2 >= 100) {
|
||||
t2 -= 100;
|
||||
}
|
||||
while (t2 <= 0) {
|
||||
t2 += 100;
|
||||
}
|
||||
while (tO2 >= 100) {
|
||||
tO2 -= 100;
|
||||
}
|
||||
while (tO2 <= 0) {
|
||||
tO2 += 100;
|
||||
}
|
||||
|
||||
if (name.equals("trackL" + i)) {
|
||||
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO), getBoneMoveY(t)));
|
||||
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO), getBoneMoveZ(t)));
|
||||
}
|
||||
|
||||
if (name.equals("trackR" + i)) {
|
||||
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO2), getBoneMoveY(t2)));
|
||||
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO2), getBoneMoveZ(t2)));
|
||||
}
|
||||
|
||||
if (name.equals("trackLRot" + i)) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO), getBoneRotX(t)) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
if (name.equals("trackRRot" + i)) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO2), getBoneRotX(t2)) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
public float getBoneRotX(float t) {
|
||||
if (t <= 37.6667) return 0F;
|
||||
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 0F, -45F);
|
||||
if (t <= 39.75) return -45F;
|
||||
if (t <= 40.6667) return Mth.lerp((t - 39.75F) / (40.6667F - 39.75F), -45F, -90F);
|
||||
if (t <= 41.6667) return -90F;
|
||||
if (t <= 42.5) return -90F;
|
||||
if (t <= 43.5) return Mth.lerp(t - 42.5F, -90F, -135F);
|
||||
if (t <= 44.5833) return -135F;
|
||||
if (t <= 45.0833) return Mth.lerp((t - 44.5833F) / (45.0833F - 44.5833F), -135F, -150F);
|
||||
if (t <= 52.25) return -150F;
|
||||
if (t <= 52.75) return Mth.lerp((t - 52.25F) / (52.75F - 52.25F), -150F, -180F);
|
||||
if (t <= 84.3333) return -180F;
|
||||
if (t <= 84.9167) return Mth.lerp((t - 84.3333F) / (84.9167F - 84.3333F), -180F, -210F);
|
||||
if (t <= 92.5833) return -210F;
|
||||
if (t <= 93.4167) return Mth.lerp((t - 92.5833F) / (93.4167F - 92.5833F), -210F, -220F);
|
||||
if (t <= 94.25) return -220F;
|
||||
if (t <= 94.9167) return Mth.lerp((t - 94.25F) / (94.9167F - 94.25F), -220F, -243.33F);
|
||||
if (t <= 95.75) return Mth.lerp((t - 94.9167F) / (95.75F - 94.9167F), -243.33F, -270F);
|
||||
if (t <= 96.8333) return -270F;
|
||||
if (t <= 97.5833) return Mth.lerp((t - 96.8333F) / (97.5833F - 96.8333F), -270F, -315F);
|
||||
if (t <= 98.8333) return -315F;
|
||||
if (t <= 99.5833) return Mth.lerp((t - 98.8333F) / (99.5833F - 98.8333F), -315F, -360F);
|
||||
|
||||
return 0F;
|
||||
}
|
||||
|
||||
public float getBoneMoveY(float t) {
|
||||
if (t <= 37.6667) return 0F;
|
||||
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 0F, -1.8F);
|
||||
if (t <= 40.3333) return Mth.lerp((t - 38.5833F) / (40.3333F - 38.5833F), -1.8F, -4.1F);
|
||||
if (t <= 42.9167) return Mth.lerp((t - 40.3333F) / (42.9167F - 40.3333F), -4.1F, -10.3F);
|
||||
if (t <= 44.25) return Mth.lerp((t - 42.9167F) / (44.25F - 42.9167F), -10.3F, -12.9F);
|
||||
if (t <= 52.4167) return Mth.lerp((t - 44.25F) / (52.4167F - 44.25F), -12.9F, -23.96F);
|
||||
if (t <= 84.5833) return -23.96F;
|
||||
if (t <= 93) return Mth.lerp((t - 84.5833F) / (93F - 84.5833F), -23.96F, -12.93F);
|
||||
if (t <= 95.25) return Mth.lerp((t - 93F) / (95.25F - 93F), -12.93F, -10.085F);
|
||||
if (t <= 97.5) return Mth.lerp((t - 95.25F) / (97.5F - 95.25F), -10.085F, -4.585F);
|
||||
if (t <= 98.8333) return Mth.lerp((t - 97.5F) / (98.8333F - 97.5F), -4.585F, -1.165F);
|
||||
if (t <= 99.25) return Mth.lerp((t - 98.8333F) / (99.25F - 98.8333F), -1.165F, -0.25F);
|
||||
|
||||
return Mth.lerp((t - 99.25F) / (100F - 99.25F), -0.25F, 0F);
|
||||
}
|
||||
|
||||
public float getBoneMoveZ(float t) {
|
||||
if (t <= 37.6667) return Mth.lerp(t / (37.6667F - 0F), 0F, 111.6F);
|
||||
if (t <= 38.5833) return Mth.lerp((t - 37.6667F) / (38.5833F - 37.6667F), 111.6F, 113.25F);
|
||||
if (t <= 40.3333) return Mth.lerp((t - 38.5833F) / (40.3333F - 38.5833F), 113.25F, 116F);
|
||||
if (t <= 42.9167) return 116F;
|
||||
if (t <= 44.25) return Mth.lerp((t - 42.9167F) / (44.25F - 42.9167F), 116F, 113.5F);
|
||||
if (t <= 52.4167) return Mth.lerp((t - 44.25F) / (52.4167F - 44.25F), 113.5F, 96.25F);
|
||||
if (t <= 84.5833) return Mth.lerp((t - 52.4167F) / (84.5833F - 52.4167F), 96.25F, 14.095F);
|
||||
if (t <= 93) return Mth.lerp((t - 84.5833F) / (93F - 84.5833F), 14.095F, -3.565F);
|
||||
if (t <= 95.25) return Mth.lerp((t - 93F) / (95.25F - 93F), -3.565F, -6.35F);
|
||||
if (t <= 97.5) return Mth.lerp((t - 95.25F) / (97.5F - 95.25F), -6.35F, -6.39F);
|
||||
if (t <= 98.8333) return Mth.lerp((t - 97.5F) / (98.8333F - 97.5F), -6.39F, -3.03F);
|
||||
if (t <= 99.25) return Mth.lerp((t - 98.8333F) / (99.25F - 98.8333F), -3.03F, -1.95F);
|
||||
|
||||
return Mth.lerp((t - 99.25F) / (100F - 99.25F), -1.95F, 0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.C4Model;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
||||
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 C4Renderer extends GeoEntityRenderer<C4Entity> {
|
||||
|
||||
public C4Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new C4Model());
|
||||
this.shadowRadius = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(C4Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, C4Entity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
float scale = 0.5f;
|
||||
this.scaleHeight = scale;
|
||||
this.scaleWidth = scale;
|
||||
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, 15, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(C4Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-entityYaw));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot()) + 90));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.CannonShellLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.CannonShellEntityModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
|
||||
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 CannonShellRenderer extends GeoEntityRenderer<CannonShellEntity> {
|
||||
public CannonShellRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new CannonShellEntityModel());
|
||||
this.addRenderLayer(new CannonShellLayer(this));
|
||||
this.shadowRadius = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(CannonShellEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, CannonShellEntity 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(CannonShellEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(CannonShellEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.ClaymoreModel;
|
||||
import com.atsuishio.superbwarfare.entity.ClaymoreEntity;
|
||||
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 ClaymoreRenderer extends GeoEntityRenderer<ClaymoreEntity> {
|
||||
|
||||
public ClaymoreRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new ClaymoreModel());
|
||||
this.shadowRadius = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(ClaymoreEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, ClaymoreEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
float scale = 0.5f;
|
||||
this.scaleHeight = scale;
|
||||
this.scaleWidth = scale;
|
||||
super.preRender(poseStack, entity, model, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(ClaymoreEntity 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())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(ClaymoreEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowName(ClaymoreEntity animatable) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,156 @@
|
|||
|
||||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.DroneModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import com.atsuishio.superbwarfare.tools.NBTTool;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.DroneEntity.KAMIKAZE_MODE;
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.AMMO;
|
||||
|
||||
public class DroneRenderer extends GeoEntityRenderer<DroneEntity> {
|
||||
public DroneRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new DroneModel());
|
||||
this.shadowRadius = 0.2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(DroneEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, DroneEntity 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(DroneEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-entityIn.getYaw(partialTicks)));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(entityIn.getBodyPitch(partialTicks)));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(entityIn.getRoll(partialTicks)));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
if (player != null) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
var tag = NBTTool.getTag(stack);
|
||||
DroneEntity drone = EntityFindUtil.findDrone(player.level(), tag.getString("LinkedDrone"));
|
||||
|
||||
if (!(stack.is(ModItems.MONITOR.get()) && tag.getBoolean("Using") && tag.getBoolean("Linked") && drone != null && drone.getUUID() == entityIn.getUUID())) {
|
||||
if (entityIn.getEntityData().get(KAMIKAZE_MODE) == 1) {
|
||||
Entity entity = new MortarShellEntity(ModEntities.MORTAR_SHELL.get(), entityIn.level());
|
||||
entityRenderDispatcher.render(entity, 0, 0.03, 0.25, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
}
|
||||
|
||||
if (entityIn.getEntityData().get(KAMIKAZE_MODE) == 3) {
|
||||
Entity entity = new RpgRocketEntity(ModEntities.RPG_ROCKET.get(), entityIn.level());
|
||||
entityRenderDispatcher.render(entity, 0, -0.03, -1.8, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
}
|
||||
|
||||
for (int i = 0; i < entityIn.getEntityData().get(AMMO); i++) {
|
||||
double yOffset = 0;
|
||||
double xOffset = 0;
|
||||
|
||||
if (i == 0) {
|
||||
yOffset = 0.2;
|
||||
xOffset = 0.1;
|
||||
}
|
||||
if (i == 1) {
|
||||
yOffset = 0.2;
|
||||
xOffset = -0.1;
|
||||
}
|
||||
if (i == 2) {
|
||||
yOffset = -0.05;
|
||||
xOffset = 0.1;
|
||||
}
|
||||
if (i == 3) {
|
||||
yOffset = -0.05;
|
||||
xOffset = -0.1;
|
||||
}
|
||||
if (i == 4) {
|
||||
yOffset = -0.3;
|
||||
xOffset = 0.1;
|
||||
}
|
||||
if (i == 5) {
|
||||
yOffset = -0.3;
|
||||
xOffset = -0.1;
|
||||
}
|
||||
|
||||
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(90));
|
||||
poseStack.scale(0.35f, 0.35f, 0.35f);
|
||||
Entity entity = new RgoGrenadeEntity(ModEntities.RGO_GRENADE.get(), entityIn.level());
|
||||
entityRenderDispatcher.render(entity, xOffset, yOffset, 0, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, DroneEntity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
String name = bone.getName();
|
||||
if (!animatable.onGround()) {
|
||||
if (name.equals("wingFL")) {
|
||||
bone.setRotY((System.currentTimeMillis() % 36000000) / 12f);
|
||||
}
|
||||
if (name.equals("wingFR")) {
|
||||
bone.setRotY((System.currentTimeMillis() % 36000000) / 12f);
|
||||
}
|
||||
if (name.equals("wingBL")) {
|
||||
bone.setRotY((System.currentTimeMillis() % 36000000) / 12f);
|
||||
}
|
||||
if (name.equals("wingBR")) {
|
||||
bone.setRotY((System.currentTimeMillis() % 36000000) / 12f);
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equals("c4")) {
|
||||
bone.setHidden(animatable.getEntityData().get(KAMIKAZE_MODE) != 2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Player player = Minecraft.getInstance().player;
|
||||
// if (player != null && animatable.getEntityData().get(KAMIKAZE_MODE) == 2 && name.equals("c4")) {
|
||||
// ItemStack stack = player.getMainHandItem();
|
||||
// DroneEntity drone = EntityFindUtil.findDrone(player.level(), stack.getOrCreateTag().getString("LinkedDrone"));
|
||||
//
|
||||
// if (!(stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked") && drone != null && drone.getUUID() == animatable.getUUID())) {
|
||||
// bone.setHidden(true);
|
||||
// } else {
|
||||
// bone.setHidden(false);
|
||||
// }
|
||||
// }
|
||||
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.FlareDecoyEntity;
|
||||
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.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.joml.Matrix3f;
|
||||
import org.joml.Matrix4f;
|
||||
|
||||
public class FlareDecoyEntityRenderer extends EntityRenderer<FlareDecoyEntity> {
|
||||
public FlareDecoyEntityRenderer(EntityRendererProvider.Context pContext) {
|
||||
super(pContext);
|
||||
}
|
||||
|
||||
protected int getBlockLightLevel(@NotNull FlareDecoyEntity pEntity, @NotNull BlockPos pPos) {
|
||||
return 15;
|
||||
}
|
||||
|
||||
public void render(@NotNull FlareDecoyEntity pEntity, float pEntityYaw, float pPartialTicks, PoseStack pMatrixStack, MultiBufferSource pBuffer, int pPackedLight) {
|
||||
pMatrixStack.pushPose();
|
||||
pMatrixStack.scale(1.0F, 1.0F, 1.0F);
|
||||
pMatrixStack.mulPose(this.entityRenderDispatcher.cameraOrientation());
|
||||
pMatrixStack.mulPose(Axis.YP.rotationDegrees(180.0F));
|
||||
PoseStack.Pose $$6 = pMatrixStack.last();
|
||||
Matrix4f $$7 = $$6.pose();
|
||||
Matrix3f $$8 = $$6.normal();
|
||||
VertexConsumer $$9 = pBuffer.getBuffer(RenderType.entityCutoutNoCull(texture(pEntity)));
|
||||
vertex($$9, $$7, $$8, pPackedLight, 0.0F, 0, 0, 1);
|
||||
vertex($$9, $$7, $$8, pPackedLight, 1.0F, 0, 1, 1);
|
||||
vertex($$9, $$7, $$8, pPackedLight, 1.0F, 1, 1, 0);
|
||||
vertex($$9, $$7, $$8, pPackedLight, 0.0F, 1, 0, 0);
|
||||
pMatrixStack.popPose();
|
||||
super.render(pEntity, pEntityYaw, pPartialTicks, pMatrixStack, pBuffer, pPackedLight);
|
||||
}
|
||||
|
||||
private static void vertex(VertexConsumer pConsumer, Matrix4f pPose, Matrix3f pNormal, int pLightmapUV, float pX, float pY, int pU, int pV) {
|
||||
// TODO vertex
|
||||
// pConsumer.vertex(pPose, pX - 0.5F, pY - 0.25F, 0.0F).color(255, 255, 255, 255).uv((float)pU, (float)pV).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(pLightmapUV).normal(pNormal, 0.0F, 1.0F, 0.0F).endVertex();
|
||||
}
|
||||
|
||||
private static ResourceLocation texture(Entity entity) {
|
||||
return ModUtils.loc("textures/particle/fire_star_" + (entity.tickCount % 8 + 1) + ".png");
|
||||
}
|
||||
|
||||
public ResourceLocation getTextureLocation(FlareDecoyEntity pEntity) {
|
||||
return texture(pEntity);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.GunGrenadeLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.GunGrenadeModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.GunGrenadeEntity;
|
||||
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 GunGrenadeRenderer extends GeoEntityRenderer<GunGrenadeEntity> {
|
||||
public GunGrenadeRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new GunGrenadeModel());
|
||||
this.addRenderLayer(new GunGrenadeLayer(this));
|
||||
this.shadowRadius = 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(GunGrenadeEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, GunGrenadeEntity 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(GunGrenadeEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(GunGrenadeEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.HandGrenadeEntityModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HandGrenadeEntity;
|
||||
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 HandGrenadeRenderer extends GeoEntityRenderer<HandGrenadeEntity> {
|
||||
public HandGrenadeRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new HandGrenadeEntityModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(HandGrenadeEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, HandGrenadeEntity 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(HandGrenadeEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(HandGrenadeEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.HeliRocketLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.HeliRocketModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.HeliRocketEntity;
|
||||
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 HeliRocketRenderer extends GeoEntityRenderer<HeliRocketEntity> {
|
||||
public HeliRocketRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new HeliRocketModel());
|
||||
this.addRenderLayer(new HeliRocketLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(HeliRocketEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, HeliRocketEntity 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(HeliRocketEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(HeliRocketEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.JavelinMissleLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.JavelinMissileModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.JavelinMissileEntity;
|
||||
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 JavelinMissileRenderer extends GeoEntityRenderer<JavelinMissileEntity> {
|
||||
public JavelinMissileRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new JavelinMissileModel());
|
||||
this.addRenderLayer(new JavelinMissleLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(JavelinMissileEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, JavelinMissileEntity 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(JavelinMissileEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(JavelinMissileEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.LaserTowerLaserLayer;
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.LaserTowerPowerLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.LaserTowerModel;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.LaserTowerEntity;
|
||||
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.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 LaserTowerRenderer extends GeoEntityRenderer<LaserTowerEntity> {
|
||||
|
||||
public LaserTowerRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new LaserTowerModel());
|
||||
this.addRenderLayer(new LaserTowerPowerLayer(this));
|
||||
this.addRenderLayer(new LaserTowerLaserLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(LaserTowerEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, LaserTowerEntity 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(@NotNull LaserTowerEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, LaserTowerEntity 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("turret")) {
|
||||
bone.setRotY(-Mth.lerp(partialTick, animatable.yRotO, animatable.getYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
if (name.equals("barrel")) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, animatable.xRotO, animatable.getXRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.Lav150Layer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Lav150Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.YAW;
|
||||
|
||||
public class Lav150Renderer extends GeoEntityRenderer<Lav150Entity> {
|
||||
|
||||
public Lav150Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Lav150Model());
|
||||
this.addRenderLayer(new Lav150Layer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Lav150Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Lav150Entity 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(Lav150Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Lav150Entity 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.setRotY(Mth.lerp(partialTick, animatable.rudderRotO, animatable.getRudderRot()));
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel2")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.rudderRotO, animatable.getRudderRot()));
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel3")) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("wheel4")) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
|
||||
if (name.equals("base")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
float a = animatable.getEntityData().get(YAW);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
bone.setPosZ(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.2f);
|
||||
bone.setRotX(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.3f);
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.15f);
|
||||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.5f);
|
||||
}
|
||||
|
||||
if (name.equals("cannon")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
if (name.equals("barrel")) {
|
||||
|
||||
float a = animatable.getTurretYaw(partialTick);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setRotX(
|
||||
-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD
|
||||
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
|
||||
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD
|
||||
);
|
||||
}
|
||||
if (name.equals("flare")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
if (name.equals("flare2")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(Lav150Entity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MelonBombEntity;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.TntMinecartRenderer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MelonBombEntityRenderer extends EntityRenderer<MelonBombEntity> {
|
||||
|
||||
private final BlockRenderDispatcher blockRenderer;
|
||||
|
||||
public MelonBombEntityRenderer(EntityRendererProvider.Context context) {
|
||||
super(context);
|
||||
this.shadowRadius = 0.2f;
|
||||
this.blockRenderer = context.getBlockRenderDispatcher();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(@NotNull MelonBombEntity entity, float entityYaw, float partialTicks, PoseStack matrixStack, MultiBufferSource buffer, int packedLight) {
|
||||
matrixStack.pushPose();
|
||||
matrixStack.translate(0.0, 0.5, 0.0);
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(-90.0f));
|
||||
matrixStack.translate(-0.5, -0.5, 0.5);
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(90.0f));
|
||||
TntMinecartRenderer.renderWhiteSolidBlock(this.blockRenderer, Blocks.MELON.defaultBlockState(), matrixStack, buffer, packedLight, false);
|
||||
matrixStack.popPose();
|
||||
super.render(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ResourceLocation getTextureLocation(@NotNull MelonBombEntity entity) {
|
||||
return TextureAtlas.LOCATION_BLOCKS;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.Mk42Layer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Mk42Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
||||
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 Mk42Renderer extends GeoEntityRenderer<Mk42Entity> {
|
||||
|
||||
public Mk42Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Mk42Model());
|
||||
this.shadowRadius = 2f;
|
||||
this.addRenderLayer(new Mk42Layer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Mk42Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Mk42Entity 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(Mk42Entity 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())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(Mk42Entity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.Mle1934Layer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Mle1934Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
||||
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 Mle1934Renderer extends GeoEntityRenderer<Mle1934Entity> {
|
||||
|
||||
public Mle1934Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Mle1934Model());
|
||||
this.shadowRadius = 2f;
|
||||
this.addRenderLayer(new Mle1934Layer(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, 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(Mle1934Entity 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())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(Mle1934Entity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.MortarLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.MortarModel;
|
||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||
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 MortarRenderer extends GeoEntityRenderer<MortarEntity> {
|
||||
|
||||
public MortarRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new MortarModel());
|
||||
this.shadowRadius = 0f;
|
||||
this.addRenderLayer(new MortarLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(MortarEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, MortarEntity 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(MortarEntity 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())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(MortarEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowName(MortarEntity animatable) {
|
||||
return animatable.hasCustomName();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.MortarShellEntityModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.MortarShellEntity;
|
||||
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 MortarShellRenderer extends GeoEntityRenderer<MortarShellEntity> {
|
||||
public MortarShellRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new MortarShellEntityModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(MortarShellEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, MortarShellEntity 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(MortarShellEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(MortarShellEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.ProjectileEntityInsideLayer;
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.ProjectileEntityLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.ProjectileEntityModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
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 ProjectileEntityRenderer extends GeoEntityRenderer<ProjectileEntity> {
|
||||
public ProjectileEntityRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new ProjectileEntityModel());
|
||||
this.shadowRadius = 0f;
|
||||
this.addRenderLayer(new ProjectileEntityLayer(this));
|
||||
this.addRenderLayer(new ProjectileEntityInsideLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(ProjectileEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, ProjectileEntity entity, BakedGeoModel model, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
if (entity.tickCount > 1) {
|
||||
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(ProjectileEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
if (entityIn.tickCount > 1) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(ProjectileEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.RgoGrenadeEntityModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RgoGrenadeEntity;
|
||||
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 RgoGrenadeRenderer extends GeoEntityRenderer<RgoGrenadeEntity> {
|
||||
public RgoGrenadeRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new RgoGrenadeEntityModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(RgoGrenadeEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, RgoGrenadeEntity 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(RgoGrenadeEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(RgoGrenadeEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.RpgRocketLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.RpgRocketModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.RpgRocketEntity;
|
||||
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 RpgRocketRenderer extends GeoEntityRenderer<RpgRocketEntity> {
|
||||
public RpgRocketRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new RpgRocketModel());
|
||||
this.addRenderLayer(new RpgRocketLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(RpgRocketEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, RpgRocketEntity 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(RpgRocketEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(RpgRocketEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.SenpaiModel;
|
||||
import com.atsuishio.superbwarfare.entity.SenpaiEntity;
|
||||
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.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
public class SenpaiRenderer extends GeoEntityRenderer<SenpaiEntity> {
|
||||
public SenpaiRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new SenpaiModel());
|
||||
this.shadowRadius = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(SenpaiEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, SenpaiEntity 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
|
||||
protected float getDeathMaxRotation(SenpaiEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.SmallCannonShellLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.SmallCannonShellModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.SmallCannonShellEntity;
|
||||
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 SmallCannonShellRenderer extends GeoEntityRenderer<SmallCannonShellEntity> {
|
||||
public SmallCannonShellRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new SmallCannonShellModel());
|
||||
this.addRenderLayer(new SmallCannonShellLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(SmallCannonShellEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, SmallCannonShellEntity 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(SmallCannonShellEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.SpeedBoatHeatLayer;
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.SpeedBoatLayer;
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.SpeedBoatPowerLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.SpeedboatModel;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.SpeedboatEntity;
|
||||
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 net.minecraft.world.phys.Vec3;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity.YAW;
|
||||
|
||||
public class SpeedboatRenderer extends GeoEntityRenderer<SpeedboatEntity> {
|
||||
|
||||
public SpeedboatRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new SpeedboatModel());
|
||||
this.addRenderLayer(new SpeedBoatLayer(this));
|
||||
this.addRenderLayer(new SpeedBoatPowerLayer(this));
|
||||
this.addRenderLayer(new SpeedBoatHeatLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(SpeedboatEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, SpeedboatEntity 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(SpeedboatEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
Vec3 root = new Vec3(0, 0.9, 0);
|
||||
poseStack.rotateAround(Axis.YP.rotationDegrees(-entityYaw), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())), (float) root.x, (float) root.y, (float) root.z);
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, SpeedboatEntity 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("root")) {
|
||||
float a = animatable.getEntityData().get(YAW);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
bone.setPosZ(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.125f);
|
||||
bone.setRotX(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.5f);
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 0.125f);
|
||||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 0.75f);
|
||||
}
|
||||
|
||||
if (name.equals("Rotor")) {
|
||||
bone.setRotZ(Mth.lerp(partialTick, animatable.rotorRotO, animatable.getRotorRot()));
|
||||
}
|
||||
if (name.equals("duo")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.rudderRotO, animatable.getRudderRot()));
|
||||
}
|
||||
if (name.equals("paota")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
if (name.equals("gun")) {
|
||||
|
||||
float a = animatable.getTurretYaw(partialTick);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setRotX(
|
||||
-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD
|
||||
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
|
||||
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD
|
||||
);
|
||||
}
|
||||
if (name.equals("flare")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(SpeedboatEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.TaserBulletProjectileModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.TaserBulletEntity;
|
||||
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 TaserBulletProjectileRenderer extends GeoEntityRenderer<TaserBulletEntity> {
|
||||
public TaserBulletProjectileRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new TaserBulletProjectileModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(TaserBulletEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, TaserBulletEntity 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(TaserBulletEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(TaserBulletEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Tom6Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity;
|
||||
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 net.minecraft.world.phys.Vec3;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Tom6Entity.MELON;
|
||||
|
||||
public class Tom6Renderer extends GeoEntityRenderer<Tom6Entity> {
|
||||
|
||||
public Tom6Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Tom6Model());
|
||||
this.shadowRadius = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Tom6Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Tom6Entity 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(Tom6Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
Vec3 root = new Vec3(0, 0.5, 0);
|
||||
poseStack.rotateAround(Axis.YP.rotationDegrees(-entityYaw), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())), (float) root.x, (float) root.y, (float) root.z);
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Tom6Entity 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("melon")) {
|
||||
bone.setHidden(!animatable.getEntityData().get(MELON));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.projectile.WgMissileLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.WgMissileModel;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.WgMissileEntity;
|
||||
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 WgMissileRenderer extends GeoEntityRenderer<WgMissileEntity> {
|
||||
public WgMissileRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new WgMissileModel());
|
||||
this.addRenderLayer(new WgMissileLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(WgMissileEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, WgMissileEntity 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(WgMissileEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot()) - 90));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(90 + Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float getDeathMaxRotation(WgMissileEntity entityLivingBaseIn) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.model.entity.WheelChairModel;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.WheelChairEntity;
|
||||
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 net.minecraft.world.phys.Vec3;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
public class WheelChairRenderer extends GeoEntityRenderer<WheelChairEntity> {
|
||||
|
||||
public WheelChairRenderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new WheelChairModel());
|
||||
this.shadowRadius = 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(WheelChairEntity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, WheelChairEntity 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(WheelChairEntity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
Vec3 root = new Vec3(0, 0.4, 0);
|
||||
poseStack.rotateAround(Axis.YP.rotationDegrees(-entityYaw), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())), (float) root.x, (float) root.y, (float) root.z);
|
||||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())), (float) root.x, (float) root.y, (float) root.z);
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, WheelChairEntity 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("w_rb")) {
|
||||
bone.setRotX(Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("w_lb")) {
|
||||
bone.setRotX(Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("w_rr")) {
|
||||
bone.setRotX(4 * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
if (name.equals("w_lr")) {
|
||||
bone.setRotX(4 * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,260 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.layer.vehicle.Yx100GlowLayer;
|
||||
import com.atsuishio.superbwarfare.client.model.entity.Yx100Model;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity;
|
||||
import com.atsuishio.superbwarfare.event.ClientEventHandler;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static com.atsuishio.superbwarfare.entity.vehicle.Yx100Entity.YAW;
|
||||
|
||||
public class Yx100Renderer extends GeoEntityRenderer<Yx100Entity> {
|
||||
|
||||
public Yx100Renderer(EntityRendererProvider.Context renderManager) {
|
||||
super(renderManager, new Yx100Model());
|
||||
this.addRenderLayer(new Yx100GlowLayer(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(Yx100Entity animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preRender(PoseStack poseStack, Yx100Entity 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(Yx100Entity entityIn, float entityYaw, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
|
||||
poseStack.pushPose();
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(-Mth.lerp(partialTicks, entityIn.yRotO, entityIn.getYRot())));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.lerp(partialTicks, entityIn.xRotO, entityIn.getXRot())));
|
||||
poseStack.mulPose(Axis.ZP.rotationDegrees(Mth.lerp(partialTicks, entityIn.prevRoll, entityIn.getRoll())));
|
||||
super.render(entityIn, entityYaw, partialTicks, poseStack, bufferIn, packedLightIn);
|
||||
poseStack.popPose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack poseStack, Yx100Entity animatable, GeoBone bone, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, boolean isReRender, float partialTick, int packedLight, int packedOverlay, int color) {
|
||||
String name = bone.getName();
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (name.equals("wheelL" + i)) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.leftWheelRotO, animatable.getLeftWheelRot()));
|
||||
}
|
||||
if (name.equals("wheelR" + i)) {
|
||||
bone.setRotX(1.5f * Mth.lerp(partialTick, animatable.rightWheelRotO, animatable.getRightWheelRot()));
|
||||
}
|
||||
}
|
||||
|
||||
if (name.equals("turret")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
if (name.equals("barrel")) {
|
||||
float a = animatable.getTurretYaw(partialTick);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setRotX(
|
||||
-Mth.lerp(partialTick, animatable.turretXRotO, animatable.getTurretXRot()) * Mth.DEG_TO_RAD
|
||||
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
|
||||
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD
|
||||
);
|
||||
}
|
||||
|
||||
if (name.equals("jiqiang")) {
|
||||
bone.setRotY(Mth.lerp(partialTick, animatable.gunYRotO, animatable.getGunYRot()) * Mth.DEG_TO_RAD - Mth.lerp(partialTick, animatable.turretYRotO, animatable.getTurretYRot()) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
if (name.equals("qiangguan")) {
|
||||
float a = animatable.getTurretYaw(partialTick);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setRotX(Mth.clamp(
|
||||
-Mth.lerp(partialTick, animatable.gunXRotO, animatable.getGunXRot()) * Mth.DEG_TO_RAD
|
||||
- r * animatable.getPitch(partialTick) * Mth.DEG_TO_RAD
|
||||
- r2 * animatable.getRoll(partialTick) * Mth.DEG_TO_RAD,
|
||||
-10 * Mth.DEG_TO_RAD, 60 * Mth.DEG_TO_RAD)
|
||||
);
|
||||
}
|
||||
|
||||
if (name.equals("flare")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
if (name.equals("flare2")) {
|
||||
bone.setRotZ((float) (0.5 * (Math.random() - 0.5)));
|
||||
}
|
||||
|
||||
if (name.equals("leida") && animatable.getEnergy() > 0) {
|
||||
bone.setRotY((System.currentTimeMillis() % 36000000) / 300f);
|
||||
}
|
||||
|
||||
if (name.equals("base")) {
|
||||
|
||||
Player player = Minecraft.getInstance().player;
|
||||
bone.setHidden(ClientEventHandler.zoomVehicle && animatable.getFirstPassenger() == player);
|
||||
|
||||
float a = animatable.getEntityData().get(YAW);
|
||||
float r = (Mth.abs(a) - 90f) / 90f;
|
||||
|
||||
bone.setPosZ(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 1.75f);
|
||||
bone.setRotX(r * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD);
|
||||
|
||||
float r2;
|
||||
|
||||
if (Mth.abs(a) <= 90f) {
|
||||
r2 = a / 90f;
|
||||
} else {
|
||||
if (a < 0) {
|
||||
r2 = -(180f + a) / 90f;
|
||||
} else {
|
||||
r2 = (180f - a) / 90f;
|
||||
}
|
||||
}
|
||||
|
||||
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 1f);
|
||||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 1.5f);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 41; i++) {
|
||||
float tO = animatable.leftTrackO + 2 * i;
|
||||
float t = animatable.getLeftTrack() + 2 * i;
|
||||
|
||||
while (t >= 80) {
|
||||
t -= 80;
|
||||
}
|
||||
while (t <= 0) {
|
||||
t += 80;
|
||||
}
|
||||
while (tO >= 80) {
|
||||
tO -= 80;
|
||||
}
|
||||
while (tO <= 0) {
|
||||
tO += 80;
|
||||
}
|
||||
|
||||
float tO2 = animatable.rightTrackO + 2 * i;
|
||||
float t2 = animatable.getRightTrack() + 2 * i;
|
||||
|
||||
while (t2 >= 80) {
|
||||
t2 -= 80;
|
||||
}
|
||||
while (t2 <= 0) {
|
||||
t2 += 80;
|
||||
}
|
||||
while (tO2 >= 80) {
|
||||
tO2 -= 80;
|
||||
}
|
||||
while (tO2 <= 0) {
|
||||
tO2 += 80;
|
||||
}
|
||||
|
||||
if (name.equals("trackL" + i)) {
|
||||
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO), getBoneMoveY(t)));
|
||||
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO), getBoneMoveZ(t)));
|
||||
}
|
||||
|
||||
if (name.equals("trackR" + i)) {
|
||||
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO2), getBoneMoveY(t2)));
|
||||
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO2), getBoneMoveZ(t2)));
|
||||
}
|
||||
|
||||
if (name.equals("trackLRot" + i)) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO), getBoneRotX(t)) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
if (name.equals("trackRRot" + i)) {
|
||||
bone.setRotX(-Mth.lerp(partialTick, getBoneRotX(tO2), getBoneRotX(t2)) * Mth.DEG_TO_RAD);
|
||||
}
|
||||
|
||||
}
|
||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
public float getBoneRotX(float t) {
|
||||
if (t <= 32.5833) return 0F;
|
||||
if (t <= 33.5833) return Mth.lerp(t - 32.5833F, 0F, -45F);
|
||||
if (t <= 34.5833) return Mth.lerp(t - 33.5833F, -45F, -90F);
|
||||
if (t <= 36.8333) return Mth.lerp((t - 34.5833F) / (36.8333F - 34.5833F), -90F, -150F);
|
||||
if (t <= 40.5833) return -150F;
|
||||
if (t <= 41.0833) return Mth.lerp((t - 40.5833F) / (41.0833F - 40.5833F), -150F, -180F);
|
||||
if (t <= 70) return -180F;
|
||||
if (t <= 71) return Mth.lerp(t - 70F, -180F, -210F);
|
||||
if (t <= 74.25) return -210F;
|
||||
if (t <= 76.5) return Mth.lerp((t - 74.25F) / (76.5F - 74.25F), -210F, -270F);
|
||||
if (t <= 77.5) return Mth.lerp(t - 76.5F, -270F, -315F);
|
||||
if (t <= 79.75) return Mth.lerp((t - 77.5F) / (79.75F - 77.5F), -315F, -360F);
|
||||
|
||||
return 0F;
|
||||
}
|
||||
|
||||
public float getBoneMoveY(float t) {
|
||||
if (t <= 32.5833) return 0F;
|
||||
if (t <= 33.0833) return Mth.lerp((t - 32.5833F) / (33.0833F - 32.5833F), 0F, -1F);
|
||||
if (t <= 34.0833) return Mth.lerp(t - 33.0833F, -1F, -2.5F);
|
||||
if (t <= 35.5833) return Mth.lerp((t - 34.0833F) / (35.5833F - 34.0833F), -2.5F, -7.5F);
|
||||
if (t <= 36.8333) return Mth.lerp((t - 35.5833F) / (36.8333F - 35.5833F), -7.5F, -12.25F);
|
||||
if (t <= 41.0833) return Mth.lerp((t - 36.8333F) / (41.0833F - 36.8333F), -12.25F, -20.9F);
|
||||
if (t <= 70) return -20.9F;
|
||||
if (t <= 74.25) return Mth.lerp((t - 70F) / (74.25F - 70F), -20.9F, -12.25F);
|
||||
if (t <= 76) return Mth.lerp((t - 74.25F) / (76F - 74.25F), -12.25F, -7.5F);
|
||||
if (t <= 77.75) return Mth.lerp((t - 76F) / (77.75F - 76F), -7.5F, -2F);
|
||||
if (t <= 79.25) return Mth.lerp((t - 77.75F) / (79.25F - 77.75F), -2F, -0.3F);
|
||||
|
||||
return Mth.lerp((t - 79.25F) / (80F - 79.25F), -0.3F, 0F);
|
||||
}
|
||||
|
||||
public float getBoneMoveZ(float t) {
|
||||
if (t <= 32.5833) return Mth.lerp(t / (32.5833F - 0F), 0F, 135.6F);
|
||||
if (t <= 33.0833) return Mth.lerp((t - 32.5833F) / (33.0833F - 32.5833F), 135.6F, 137.75F);
|
||||
if (t <= 34.0833) return Mth.lerp(t - 33.0833F, 137.75F, 140.25F);
|
||||
if (t <= 35.5833) return 140.25F;
|
||||
if (t <= 36.8333) return Mth.lerp((t - 35.5833F) / (36.8333F - 35.5833F), 140.25F, 137.25F);
|
||||
if (t <= 41.0833) return Mth.lerp((t - 36.8333F) / (41.0833F - 36.8333F), 137.25F, 121.5F);
|
||||
if (t <= 70) return Mth.lerp((t - 41.0833F) / (70F - 41.0833F), 121.5F, 11.5F);
|
||||
if (t <= 74.25) return Mth.lerp((t - 70F) / (74.25F - 70F), 11.5F, -3.75F);
|
||||
if (t <= 76) return Mth.lerp((t - 74.25F) / (76F - 74.25F), -3.75F, -10F);
|
||||
if (t <= 77.75) return Mth.lerp((t - 76F) / (77.75F - 76F), -10F, -8.25F);
|
||||
if (t <= 79.25) return Mth.lerp((t - 77.75F) / (79.25F - 77.75F), -8.25F, -4.12F);
|
||||
|
||||
return Mth.lerp((t - 79.25F) / (80F - 79.25F), -4.12F, 0F);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,116 @@
|
|||
package com.atsuishio.superbwarfare.client.renderer.item;
|
||||
|
||||
import com.atsuishio.superbwarfare.client.AnimationHelper;
|
||||
import com.atsuishio.superbwarfare.client.model.item.LungeMineModel;
|
||||
import com.atsuishio.superbwarfare.item.LungeMine;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.PlayerModel;
|
||||
import net.minecraft.client.player.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.player.PlayerRenderer;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.ItemDisplayContext;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
||||
import software.bernie.geckolib.cache.object.GeoBone;
|
||||
import software.bernie.geckolib.renderer.GeoItemRenderer;
|
||||
import software.bernie.geckolib.util.RenderUtil;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class LungeMineRenderer extends GeoItemRenderer<LungeMine> {
|
||||
|
||||
public LungeMineRenderer() {
|
||||
super(new LungeMineModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderType getRenderType(LungeMine animatable, ResourceLocation texture, MultiBufferSource bufferSource, float partialTick) {
|
||||
return RenderType.entityTranslucent(getTextureLocation(animatable));
|
||||
}
|
||||
|
||||
private static final float SCALE_RECIPROCAL = 1.0f / 16.0f;
|
||||
protected boolean renderArms = false;
|
||||
protected MultiBufferSource currentBuffer;
|
||||
protected RenderType renderType;
|
||||
public ItemDisplayContext transformType;
|
||||
protected LungeMine animatable;
|
||||
private final Set<String> hiddenBones = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void renderByItem(ItemStack stack, ItemDisplayContext transformType, PoseStack matrixStack, MultiBufferSource bufferIn, int combinedLightIn, int p_239207_6_) {
|
||||
this.transformType = transformType;
|
||||
if (this.animatable != null)
|
||||
this.animatable.getTransformType(transformType);
|
||||
super.renderByItem(stack, transformType, matrixStack, bufferIn, combinedLightIn, p_239207_6_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actuallyRender(PoseStack matrixStackIn, LungeMine animatable, BakedGeoModel model, RenderType type, MultiBufferSource renderTypeBuffer, VertexConsumer vertexBuilder, boolean isRenderer, float partialTicks, int packedLightIn,
|
||||
int packedOverlayIn, int color) {
|
||||
this.currentBuffer = renderTypeBuffer;
|
||||
this.renderType = type;
|
||||
this.animatable = animatable;
|
||||
super.actuallyRender(matrixStackIn, animatable, model, type, renderTypeBuffer, vertexBuilder, isRenderer, partialTicks, packedLightIn, packedOverlayIn, color);
|
||||
if (this.renderArms) {
|
||||
this.renderArms = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderRecursively(PoseStack stack, LungeMine animatable, GeoBone bone, RenderType type, MultiBufferSource buffer, VertexConsumer bufferIn, boolean isReRender, float partialTick, int packedLightIn, int packedOverlayIn, int color) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
String name = bone.getName();
|
||||
boolean renderingArms = false;
|
||||
if (name.equals("Lefthand") || name.equals("Righthand")) {
|
||||
bone.setHidden(true);
|
||||
renderingArms = true;
|
||||
} else {
|
||||
bone.setHidden(this.hiddenBones.contains(name));
|
||||
}
|
||||
|
||||
if (this.transformType.firstPerson() && renderingArms) {
|
||||
AbstractClientPlayer localPlayer = mc.player;
|
||||
|
||||
if (localPlayer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerRenderer playerRenderer = (PlayerRenderer) mc.getEntityRenderDispatcher().getRenderer(localPlayer);
|
||||
PlayerModel<AbstractClientPlayer> model = playerRenderer.getModel();
|
||||
stack.pushPose();
|
||||
RenderUtil.translateMatrixToBone(stack, bone);
|
||||
RenderUtil.translateToPivotPoint(stack, bone);
|
||||
RenderUtil.rotateMatrixAroundBone(stack, bone);
|
||||
RenderUtil.scaleMatrixForBone(stack, bone);
|
||||
RenderUtil.translateAwayFromPivotPoint(stack, bone);
|
||||
ResourceLocation loc = localPlayer.getSkin().texture();
|
||||
VertexConsumer armBuilder = this.currentBuffer.getBuffer(RenderType.entitySolid(loc));
|
||||
VertexConsumer sleeveBuilder = this.currentBuffer.getBuffer(RenderType.entityTranslucent(loc));
|
||||
if (name.equals("Lefthand")) {
|
||||
stack.translate(-1.0f * SCALE_RECIPROCAL, 2.0f * SCALE_RECIPROCAL, 0.0f);
|
||||
AnimationHelper.renderPartOverBone2(model.leftArm, bone, stack, armBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1);
|
||||
AnimationHelper.renderPartOverBone2(model.leftSleeve, bone, stack, sleeveBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1);
|
||||
} else {
|
||||
stack.translate(SCALE_RECIPROCAL, 2.0f * SCALE_RECIPROCAL, 0.0f);
|
||||
AnimationHelper.renderPartOverBone2(model.rightArm, bone, stack, armBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1);
|
||||
AnimationHelper.renderPartOverBone2(model.rightSleeve, bone, stack, sleeveBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1);
|
||||
}
|
||||
|
||||
this.currentBuffer.getBuffer(this.renderType);
|
||||
stack.popPose();
|
||||
}
|
||||
super.renderRecursively(stack, animatable, bone, type, buffer, bufferIn, isReRender, partialTick, packedLightIn, packedOverlayIn, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(LungeMine instance) {
|
||||
return super.getTextureLocation(instance);
|
||||
}
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ public class ConfigCommand {
|
|||
.then(Commands.literal("explosionDestroy").requires(s -> s.hasPermission(2)).then(Commands.argument("value", BoolArgumentType.bool()).executes(context -> {
|
||||
var value = BoolArgumentType.getBool(context, "value");
|
||||
ExplosionConfig.EXPLOSION_DESTROY.set(value);
|
||||
ExplosionConfig.EXPLOSION_DESTROY.save();
|
||||
|
||||
context.getSource().sendSuccess(() -> Component.translatable(value ? "commands.config.explosion_destroy.enabled" : "commands.config.explosion_destroy.disabled"), true);
|
||||
return 0;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package com.atsuishio.superbwarfare.compat.jade;
|
||||
|
||||
import com.atsuishio.superbwarfare.block.ContainerBlock;
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.C4InfoProvider;
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.ContainerEntityProvider;
|
||||
import com.atsuishio.superbwarfare.compat.jade.providers.VehicleHealthProvider;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import snownee.jade.api.IWailaClientRegistration;
|
||||
import snownee.jade.api.IWailaCommonRegistration;
|
||||
|
@ -19,8 +21,7 @@ public class SbwJadePlugin implements IWailaPlugin {
|
|||
@Override
|
||||
public void registerClient(IWailaClientRegistration registration) {
|
||||
registration.registerEntityComponent(VehicleHealthProvider.INSTANCE, VehicleEntity.class);
|
||||
// TODO C4
|
||||
// registration.registerEntityComponent(C4InfoProvider.INSTANCE, C4Entity.class);
|
||||
registration.registerEntityComponent(C4InfoProvider.INSTANCE, C4Entity.class);
|
||||
registration.registerBlockComponent(ContainerEntityProvider.INSTANCE, ContainerBlock.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
package com.atsuishio.superbwarfare.compat.jade.providers;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.C4Entity;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import snownee.jade.api.EntityAccessor;
|
||||
import snownee.jade.api.IEntityComponentProvider;
|
||||
|
@ -13,20 +17,19 @@ public enum C4InfoProvider implements IEntityComponentProvider {
|
|||
private static final ResourceLocation ID = ModUtils.loc("c4_info");
|
||||
|
||||
public void appendTooltip(ITooltip tooltip, EntityAccessor accessor, IPluginConfig config) {
|
||||
// TODO C4 Info
|
||||
// var c4 = (C4Entity) accessor.getEntity();
|
||||
//
|
||||
// if (c4.getEntityData().get(C4Entity.IS_CONTROLLABLE)) {
|
||||
// // 遥控
|
||||
// tooltip.add(Component.translatable("des.jade_plugin_superbwarfare.c4.remote_control").withStyle(ChatFormatting.YELLOW));
|
||||
// } else {
|
||||
// // 定时
|
||||
// var timeLeft = ExplosionConfig.C4_EXPLOSION_COUNTDOWN.get() - c4.tickCount;
|
||||
// tooltip.add(Component.translatable(
|
||||
// "des.jade_plugin_superbwarfare.c4.time_left",
|
||||
// String.format("%.2f", timeLeft / 20.0)
|
||||
// ).withStyle(ChatFormatting.YELLOW));
|
||||
// }
|
||||
var c4 = (C4Entity) accessor.getEntity();
|
||||
|
||||
if (c4.getEntityData().get(C4Entity.IS_CONTROLLABLE)) {
|
||||
// 遥控
|
||||
tooltip.add(Component.translatable("des.jade_plugin_superbwarfare.c4.remote_control").withStyle(ChatFormatting.YELLOW));
|
||||
} else {
|
||||
// 定时
|
||||
var timeLeft = ExplosionConfig.C4_EXPLOSION_COUNTDOWN.get() - c4.tickCount;
|
||||
tooltip.add(Component.translatable(
|
||||
"des.jade_plugin_superbwarfare.c4.time_left",
|
||||
String.format("%.2f", timeLeft / 20.0)
|
||||
).withStyle(ChatFormatting.YELLOW));
|
||||
}
|
||||
}
|
||||
|
||||
public ResourceLocation getUid() {
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.mojang.serialization.Codec;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.component.DataComponentType;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.neoforged.bus.api.IEventBus;
|
||||
import net.neoforged.neoforge.registries.DeferredHolder;
|
||||
import net.neoforged.neoforge.registries.DeferredRegister;
|
||||
|
@ -40,11 +39,6 @@ public class ModDataComponents {
|
|||
builder -> builder.persistent(AmmoBoxInfo.CODEC)
|
||||
);
|
||||
|
||||
public static final DeferredHolder<DataComponentType<?>, DataComponentType<CompoundTag>> GUN_DATA = register(
|
||||
"gun_data",
|
||||
builder -> builder.persistent(CompoundTag.CODEC)
|
||||
);
|
||||
|
||||
private static <T> DeferredHolder<DataComponentType<?>, DataComponentType<T>> register(String name, UnaryOperator<DataComponentType.Builder<T>> builderOperator) {
|
||||
return DATA_COMPONENT_TYPES.register(name, () -> builderOperator.apply(DataComponentType.builder()).build());
|
||||
}
|
||||
|
|
|
@ -33,15 +33,13 @@ public class ModItemModelProvider extends ItemModelProvider {
|
|||
simpleItem(ModItems.LARGE_MOTOR);
|
||||
simpleItem(ModItems.WHEEL);
|
||||
simpleItem(ModItems.TRACK);
|
||||
// TODO drone
|
||||
// simpleItem(ModItems.DRONE);
|
||||
simpleItem(ModItems.DRONE);
|
||||
simpleItem(ModItems.LIGHT_ARMAMENT_MODULE);
|
||||
simpleItem(ModItems.MEDIUM_ARMAMENT_MODULE);
|
||||
simpleItem(ModItems.HEAVY_ARMAMENT_MODULE);
|
||||
|
||||
simpleItem(ModItems.TARGET_DEPLOYER);
|
||||
// TODO mortar
|
||||
// simpleItem(ModItems.MORTAR_DEPLOYER);
|
||||
simpleItem(ModItems.MORTAR_DEPLOYER);
|
||||
simpleItem(ModItems.MORTAR_BARREL);
|
||||
simpleItem(ModItems.MORTAR_BASE_PLATE);
|
||||
simpleItem(ModItems.MORTAR_BIPOD);
|
||||
|
@ -71,8 +69,7 @@ public class ModItemModelProvider extends ItemModelProvider {
|
|||
simpleItem(ModItems.RAW_SILVER);
|
||||
simpleItem(ModItems.SILVER_INGOT);
|
||||
handheldItem(ModItems.CROWBAR);
|
||||
// TODO defuser
|
||||
// handheldItem(ModItems.DEFUSER);
|
||||
handheldItem(ModItems.DEFUSER);
|
||||
simpleItem(ModItems.FIRING_PARAMETERS);
|
||||
simpleItem(ModItems.BEAM_TEST);
|
||||
simpleItem(ModItems.HANDGUN_AMMO);
|
||||
|
|
|
@ -0,0 +1,275 @@
|
|||
package com.atsuishio.superbwarfare.entity;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||
import com.atsuishio.superbwarfare.init.*;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
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.level.ServerLevel;
|
||||
import net.minecraft.server.players.OldUsersConverter;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
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.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.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.neoforged.neoforge.event.EventHooks;
|
||||
import net.neoforged.neoforge.items.ItemHandlerHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
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 javax.annotation.Nullable;
|
||||
import java.util.Comparator;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ClaymoreEntity extends Entity implements GeoEntity, OwnableEntity {
|
||||
|
||||
protected static final EntityDataAccessor<Optional<UUID>> OWNER_UUID = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.OPTIONAL_UUID);
|
||||
protected static final EntityDataAccessor<String> LAST_ATTACKER_UUID = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.STRING);
|
||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(ClaymoreEntity.class, EntityDataSerializers.FLOAT);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
public ClaymoreEntity(EntityType<ClaymoreEntity> type, Level world) {
|
||||
super(type, world);
|
||||
this.noCulling = true;
|
||||
}
|
||||
|
||||
public ClaymoreEntity(LivingEntity owner, Level level) {
|
||||
super(ModEntities.CLAYMORE.get(), level);
|
||||
this.setOwnerUUID(owner.getUUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void defineSynchedData(SynchedEntityData.Builder builder) {
|
||||
builder.define(OWNER_UUID, Optional.empty())
|
||||
.define(LAST_ATTACKER_UUID, "undefined")
|
||||
.define(HEALTH, 10f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPickable() {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hurt(DamageSource source, float amount) {
|
||||
if (source.getDirectEntity() instanceof ThrownPotion || source.getDirectEntity() instanceof AreaEffectCloud)
|
||||
return false;
|
||||
if (source.is(DamageTypes.FALL))
|
||||
return false;
|
||||
if (source.is(DamageTypes.CACTUS))
|
||||
return false;
|
||||
if (source.is(DamageTypes.DROWN))
|
||||
return false;
|
||||
if (source.is(DamageTypes.DRAGON_BREATH))
|
||||
return false;
|
||||
if (source.is(DamageTypes.WITHER))
|
||||
return false;
|
||||
if (source.is(DamageTypes.WITHER_SKULL))
|
||||
return false;
|
||||
if (source.is(ModDamageTypes.CUSTOM_EXPLOSION) || source.is(ModDamageTypes.MINE) || source.is(ModDamageTypes.PROJECTILE_BOOM)) {
|
||||
amount *= 0.2f;
|
||||
}
|
||||
|
||||
if (source.getEntity() != null) {
|
||||
this.entityData.set(LAST_ATTACKER_UUID, source.getEntity().getStringUUID());
|
||||
}
|
||||
|
||||
if (this.level() instanceof ServerLevel serverLevel) {
|
||||
ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 0.2, this.getZ(), 2, 0.02, 0.02, 0.02, 0.1, false);
|
||||
}
|
||||
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
|
||||
this.entityData.set(HEALTH, this.entityData.get(HEALTH) - amount);
|
||||
|
||||
return super.hurt(source, amount);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean isOwnedBy(LivingEntity pEntity) {
|
||||
return pEntity == this.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAdditionalSaveData(CompoundTag compound) {
|
||||
compound.putFloat("Health", this.entityData.get(HEALTH));
|
||||
compound.putString("LastAttacker", this.entityData.get(LAST_ATTACKER_UUID));
|
||||
if (this.getOwnerUUID() != null) {
|
||||
compound.putUUID("Owner", this.getOwnerUUID());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readAdditionalSaveData(CompoundTag compound) {
|
||||
if (compound.contains("Health")) {
|
||||
this.entityData.set(HEALTH, compound.getFloat("Health"));
|
||||
}
|
||||
|
||||
if (compound.contains("LastAttacker")) {
|
||||
this.entityData.set(LAST_ATTACKER_UUID, compound.getString("LastAttacker"));
|
||||
}
|
||||
|
||||
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) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResult interact(Player player, InteractionHand hand) {
|
||||
if (this.isOwnedBy(player) && player.isShiftKeyDown()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
this.discard();
|
||||
}
|
||||
|
||||
if (!player.getAbilities().instabuild) {
|
||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.CLAYMORE_MINE.get()));
|
||||
}
|
||||
}
|
||||
|
||||
return InteractionResult.sidedSuccess(this.level().isClientSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
var level = this.level();
|
||||
var x = this.getX();
|
||||
var y = this.getY();
|
||||
var z = this.getZ();
|
||||
|
||||
if (this.tickCount >= 12000) {
|
||||
if (!this.level().isClientSide()) this.discard();
|
||||
}
|
||||
|
||||
if (this.tickCount >= 40) {
|
||||
final Vec3 center = new Vec3(x + 1.5 * this.getLookAngle().x, y + 1.5 * this.getLookAngle().y, z + 1.5 * this.getLookAngle().z);
|
||||
for (Entity target : level.getEntitiesOfClass(Entity.class, new AABB(center, center).inflate(2.5 / 2d), e -> true).stream().sorted(Comparator.comparingDouble(e -> e.distanceToSqr(center))).toList()) {
|
||||
var condition = this.getOwner() != target
|
||||
&& (target instanceof LivingEntity || target instanceof VehicleEntity)
|
||||
&& !(target instanceof TargetEntity)
|
||||
&& !(target instanceof Player player && (player.isCreative() || player.isSpectator()))
|
||||
&& (this.getOwner() != null && !this.getOwner().isAlliedTo(target) || target.getTeam() == null || target.getTeam().getName().equals("TDM"))
|
||||
&& !target.isShiftKeyDown();
|
||||
if (!condition) continue;
|
||||
|
||||
if (!level.isClientSide()) {
|
||||
if (!this.level().isClientSide()) {
|
||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
|
||||
ModUtils.queueServerWork(1, () -> {
|
||||
if (!level.isClientSide()) {
|
||||
triggerExplode();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.03, 0.0));
|
||||
|
||||
if (!this.level().noCollision(this.getBoundingBox())) {
|
||||
this.moveTowardsClosestSpace(this.getX(), (this.getBoundingBox().minY + this.getBoundingBox().maxY) / 2.0, this.getZ());
|
||||
}
|
||||
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
float f = 0.98F;
|
||||
if (this.onGround()) {
|
||||
BlockPos pos = this.getBlockPosBelowThatAffectsMyMovement();
|
||||
f = this.level().getBlockState(pos).getFriction(this.level(), pos, this) * 0.98F;
|
||||
}
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.98, f));
|
||||
if (this.onGround()) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, -0.9, 1.0));
|
||||
}
|
||||
|
||||
if (this.entityData.get(HEALTH) <= 0) {
|
||||
destroy();
|
||||
}
|
||||
|
||||
this.refreshDimensions();
|
||||
}
|
||||
|
||||
public void destroy() {
|
||||
if (level() instanceof ServerLevel) {
|
||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), attacker == null ? this : attacker,
|
||||
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), attacker == null ? this : attacker, attacker == null ? this : attacker), 25.0f,
|
||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
EventHooks.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
private void triggerExplode() {
|
||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||
ModDamageTypes.causeMineDamage(this.level().registryAccess(), this.getOwner()), 140f,
|
||||
this.getX(), this.getEyeY(), this.getZ(), 4f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
EventHooks.onExplosionStart(this.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull EntityDimensions getDimensions(@NotNull Pose p_33597_) {
|
||||
return super.getDimensions(p_33597_).scale((float) 0.5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPushable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar data) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.cache;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue