Adopted new Math and Widget changes
This commit is contained in:
parent
e608bf21fe
commit
ff77134ead
15 changed files with 62 additions and 51 deletions
|
@ -5,7 +5,7 @@ import org.betterx.bclib.client.models.BaseChestBlockModel;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -73,7 +73,7 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
|
||||
matrices.pushPose();
|
||||
matrices.translate(0.5D, 0.5D, 0.5D);
|
||||
matrices.mulPose(Vector3f.YP.rotationDegrees(-f));
|
||||
matrices.mulPose(Axis.YP.rotationDegrees(-f));
|
||||
matrices.translate(-0.5D, -0.5D, -0.5D);
|
||||
|
||||
if (worldExists) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.betterx.bclib.blocks.BaseSignBlock;
|
|||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.model.geom.ModelLayers;
|
||||
|
@ -68,10 +68,10 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
|
||||
BlockState blockState = signBlockEntity.getBlockState();
|
||||
if (blockState.getValue(BaseSignBlock.FLOOR)) {
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(angle));
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(angle));
|
||||
model.stick.visible = true;
|
||||
} else {
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(angle + 180));
|
||||
matrixStack.mulPose(Axis.YP.rotationDegrees(angle + 180));
|
||||
matrixStack.translate(0.0D, -0.3125D, -0.4375D);
|
||||
model.stick.visible = false;
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ import org.betterx.bclib.items.boat.CustomBoatTypeOverride;
|
|||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Quaternion;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
import net.minecraft.client.model.BoatModel;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -19,6 +18,8 @@ import net.minecraft.world.entity.vehicle.ChestBoat;
|
|||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import org.joml.Quaternionf;
|
||||
|
||||
@Environment(value = EnvType.CLIENT)
|
||||
public class BoatRenderer {
|
||||
|
||||
|
@ -37,22 +38,25 @@ public class BoatRenderer {
|
|||
float k;
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(0.0, 0.375, 0.0);
|
||||
poseStack.mulPose(Vector3f.YP.rotationDegrees(180.0f - f));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(180.0f - f));
|
||||
float h = (float) boat.getHurtTime() - g;
|
||||
float j = boat.getDamage() - g;
|
||||
if (j < 0.0f) {
|
||||
j = 0.0f;
|
||||
}
|
||||
if (h > 0.0f) {
|
||||
poseStack.mulPose(Vector3f.XP.rotationDegrees(Mth.sin(h) * h * j / 10.0f * (float) boat.getHurtDir()));
|
||||
poseStack.mulPose(Axis.XP.rotationDegrees(Mth.sin(h) * h * j / 10.0f * (float) boat.getHurtDir()));
|
||||
}
|
||||
if (!Mth.equal(k = boat.getBubbleAngle(g), 0.0f)) {
|
||||
poseStack.mulPose(new Quaternion(new Vector3f(1.0f, 0.0f, 1.0f), boat.getBubbleAngle(g), true));
|
||||
poseStack.mulPose(new Quaternionf().setAngleAxis(
|
||||
boat.getBubbleAngle(g) * ((float) Math.PI / 180),
|
||||
1.0f, 0.0f, 1.0f
|
||||
));
|
||||
}
|
||||
ResourceLocation resourceLocation = hasChest ? type.chestBoatTexture : type.boatTexture;
|
||||
BoatModel boatModel = type.getBoatModel(hasChest);
|
||||
poseStack.scale(-1.0f, -1.0f, 1.0f);
|
||||
poseStack.mulPose(Vector3f.YP.rotationDegrees(90.0f));
|
||||
poseStack.mulPose(Axis.YP.rotationDegrees(90.0f));
|
||||
boatModel.setupAnim(boat, g, 0.0f, -0.1f, 0.0f, 0.0f);
|
||||
VertexConsumer vertexConsumer = multiBufferSource.getBuffer(boatModel.renderType(resourceLocation));
|
||||
boatModel.renderToBuffer(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue