Crystalite Elytra
This commit is contained in:
parent
1ad72cbe88
commit
a6895004c7
22 changed files with 160 additions and 100 deletions
|
@ -16,7 +16,7 @@ import net.minecraft.world.entity.EquipmentSlot;
|
|||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.PlayerModelPart;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import ru.betterend.item.ArmoredElytra;
|
||||
import ru.betterend.interfaces.FallFlyingItem;
|
||||
import ru.betterend.item.model.ArmoredElytraModel;
|
||||
|
||||
public class ArmoredElytraLayer<T extends LivingEntity, M extends EntityModel<T>> extends ElytraLayer<T, M> {
|
||||
|
@ -28,8 +28,8 @@ public class ArmoredElytraLayer<T extends LivingEntity, M extends EntityModel<T>
|
|||
|
||||
public void render(PoseStack poseStack, MultiBufferSource multiBufferSource, int i, T livingEntity, float f, float g, float h, float j, float k, float l) {
|
||||
ItemStack itemStack = livingEntity.getItemBySlot(EquipmentSlot.CHEST);
|
||||
if (itemStack.getItem() instanceof ArmoredElytra) {
|
||||
ResourceLocation wingsTexture = ((ArmoredElytra) itemStack.getItem()).getWingTexture();
|
||||
if (itemStack.getItem() instanceof FallFlyingItem) {
|
||||
ResourceLocation wingsTexture = ((FallFlyingItem) itemStack.getItem()).getModelTexture();
|
||||
if (livingEntity instanceof AbstractClientPlayer) {
|
||||
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) livingEntity;
|
||||
if (abstractClientPlayer.isElytraLoaded() && abstractClientPlayer.getElytraTextureLocation() != null) {
|
||||
|
|
|
@ -47,42 +47,6 @@ public class EndCrystalRenderer {
|
|||
matrices.popPose();
|
||||
}
|
||||
|
||||
public static void renderBeam(BlockPos start, BlockPos end, float tickDelta, int age, PoseStack matrices, MultiBufferSource vertexConsumers, int light) {
|
||||
float dx = start.getX() - end.getX() + 1.0F;
|
||||
float dy = start.getY() - end.getY() + 1.0F;
|
||||
float dz = start.getZ() - end.getZ() + 1.0F;
|
||||
float f = Mth.sqrt(dx * dx + dz * dz);
|
||||
float g = Mth.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
matrices.pushPose();
|
||||
matrices.translate(0.0D, 2.0D, 0.0D);
|
||||
matrices.mulPose(Vector3f.YP.rotation((float)(-Math.atan2((double) dz, (double) dx)) - 1.5707964F));
|
||||
matrices.mulPose(Vector3f.XP.rotation((float)(-Math.atan2((double) f, (double) dy)) - 1.5707964F));
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(CRYSTAL_BEAM_LAYER);
|
||||
float h = 0.0F - ((float) age + tickDelta) * 0.01F;
|
||||
float i = Mth.sqrt(dx * dx + dy * dy + dz * dz) / 32.0F - ((float) age + tickDelta) * 0.01F;
|
||||
float k = 0.0F;
|
||||
float l = 0.75F;
|
||||
float m = 0.0F;
|
||||
PoseStack.Pose entry = matrices.last();
|
||||
Matrix4f matrix4f = entry.pose();
|
||||
Matrix3f matrix3f = entry.normal();
|
||||
|
||||
for(int n = 1; n <= 8; ++n) {
|
||||
float o = Mth.sin((float) n * 6.2831855F / 8.0F) * 0.75F;
|
||||
float p = Mth.cos((float) n * 6.2831855F / 8.0F) * 0.75F;
|
||||
float q = (float) n / 8.0F;
|
||||
vertexConsumer.vertex(matrix4f, k * 0.2F, l * 0.2F, 0.0F).color(0, 0, 0, 255).uv(m, h).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
|
||||
vertexConsumer.vertex(matrix4f, k, l, g).color(255, 255, 255, 255).uv(m, i).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
|
||||
vertexConsumer.vertex(matrix4f, o, p, g).color(255, 255, 255, 255).uv(q, i).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
|
||||
vertexConsumer.vertex(matrix4f, o * 0.2F, p * 0.2F, 0.0F).color(0, 0, 0, 255).uv(q, h).overlayCoords(OverlayTexture.NO_OVERLAY).uv2(light).normal(matrix3f, 0.0F, -1.0F, 0.0F).endVertex();
|
||||
k = o;
|
||||
l = p;
|
||||
m = q;
|
||||
}
|
||||
|
||||
matrices.popPose();
|
||||
}
|
||||
|
||||
static {
|
||||
END_CRYSTAL = RenderType.entityCutoutNoCull(CRYSTAL_TEXTURE);
|
||||
CRYSTAL_BEAM_LAYER = RenderType.entitySmoothCutout(CRYSTAL_BEAM_TEXTURE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue