fixed some issues with the ward effect

This commit is contained in:
Ell 2023-02-16 20:01:21 +01:00
parent d73751b536
commit 4af1787320
3 changed files with 12 additions and 11 deletions

View file

@ -34,19 +34,19 @@ public class RenderGeneratorLimitRemover implements BlockEntityRenderer<BlockEnt
public void render(BlockEntityGeneratorLimitRemover te, float v, PoseStack matrixStack, MultiBufferSource iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) { public void render(BlockEntityGeneratorLimitRemover te, float v, PoseStack matrixStack, MultiBufferSource iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
var above = te.getLevel().getBlockEntity(te.getBlockPos().above()); var above = te.getLevel().getBlockEntity(te.getBlockPos().above());
if (above instanceof BlockEntityImpl && ((BlockEntityImpl) above).wantsLimitRemover()) { if (above instanceof BlockEntityImpl && ((BlockEntityImpl) above).wantsLimitRemover()) {
RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 1, 0, combinedOverlayIn, RenderGeneratorLimitRemover.RES); RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 1, 0, combinedOverlayIn, RenderGeneratorLimitRemover.RES, 1);
RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 0, 0, combinedOverlayIn, RenderGeneratorLimitRemover.RES); RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 0, 0, combinedOverlayIn, RenderGeneratorLimitRemover.RES, 1);
} }
} }
public static void renderGlint(PoseStack stack, MultiBufferSource buffer, ModelLimitRemoverGlint model, int xOff, int yOff, int zOff, int combinedOverlayIn, ResourceLocation texture) { public static void renderGlint(PoseStack stack, MultiBufferSource buffer, ModelLimitRemoverGlint model, int xOff, int yOff, int zOff, int combinedOverlayIn, ResourceLocation texture, float maxAlpha) {
stack.pushPose(); stack.pushPose();
var brightness = 15 << 20 | 15 << 4; var brightness = 15 << 20 | 15 << 4;
var alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F; var alpha = ((float) Math.sin(System.currentTimeMillis() / 800D) + 1F) / 2F;
stack.translate(-0.001F + xOff, 1 + 0.001F + yOff, 1 + 0.001F + zOff); stack.translate(-0.002F + xOff, 1 + 0.002F + yOff, 1 + 0.002F + zOff);
stack.mulPose(Vector3f.XP.rotationDegrees(180F)); stack.mulPose(Vector3f.XP.rotationDegrees(180F));
stack.scale(1.002F, 1.002F, 1.002F); stack.scale(1.004F, 1.004F, 1.004F);
model.renderToBuffer(stack, buffer.getBuffer(model.renderType(texture)), brightness, combinedOverlayIn, 1, 1, 1, alpha); model.renderToBuffer(stack, buffer.getBuffer(model.renderType(texture)), brightness, combinedOverlayIn, 1, 1, 1, alpha * maxAlpha);
stack.popPose(); stack.popPose();
} }

View file

@ -25,10 +25,11 @@ public class RenderLowerLimiter implements BlockEntityRenderer<BlockEntityLowerL
@Override @Override
public void render(BlockEntityLowerLimiter te, float v, PoseStack matrixStack, MultiBufferSource iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) { public void render(BlockEntityLowerLimiter te, float v, PoseStack matrixStack, MultiBufferSource iRenderTypeBuffer, int combinedLightIn, int combinedOverlayIn) {
for (var dir : Direction.values()) { for (var dir : Direction.values()) {
var entity = te.getLevel().getBlockEntity(te.getBlockPos().relative(dir)); var offset = te.getBlockPos().relative(dir);
if (entity instanceof BlockEntityImpl impl && impl.allowsLowerLimiter()) { if (te.getLevel().getBlockEntity(offset) instanceof BlockEntityImpl impl && impl.allowsLowerLimiter()) {
RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, dir.getStepX(), dir.getStepY(), dir.getStepZ(), combinedOverlayIn, RenderLowerLimiter.RES); var alpha = te.getLevel().getBlockState(offset).isCollisionShapeFullBlock(te.getLevel(), offset) ? 1 : 0.25F;
RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 0, 0, combinedOverlayIn, RenderLowerLimiter.RES); RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, dir.getStepX(), dir.getStepY(), dir.getStepZ(), combinedOverlayIn, RenderLowerLimiter.RES, alpha);
RenderGeneratorLimitRemover.renderGlint(matrixStack, iRenderTypeBuffer, this.model, 0, 0, 0, combinedOverlayIn, RenderLowerLimiter.RES, 1);
} }
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"parent": "minecraft:block/block", "parent": "minecraft:block/block",
"render_type": "translucent", "render_type": "cutout_mipped",
"ambientocclusion": false, "ambientocclusion": false,
"textures": { "textures": {
"particle": "naturesaura:block/spring", "particle": "naturesaura:block/spring",