#Modifying block entity rendering based on the player
97 messages · Page 1 of 1 (latest)
Like specifically the if?
Or the contents as well?
Just without the entire contents
Also one thing, idk but you never reset the value so outside the if set the scale to 1
Maybe
One sec sorry
All good
Okay
This is my best guess then
I don’t follow sorry
yeah sure np
i reverted the changes to back when it was working and for some reason it isnt now
package net.doomxd.boe.block.entity.renderer;
import net.doomxd.boe.block.entity.custom.ElseBlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.awt.*;
public class ElseBlockEntityRenderer implements BlockEntityRenderer<ElseBlockEntity> {
public ElseBlockEntityRenderer(BlockEntityRendererFactory.Context context) {
}
@Override
public void render(ElseBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
}
private int getLightLevel(World world, BlockPos pos) {
int bLight = world.getLightLevel(LightType.BLOCK, pos);
int sLight = world.getLightLevel(LightType.SKY, pos);
return LightmapTextureManager.pack(bLight, sLight);
}
}
Let's see how this goes on a phone
for some reason its rendering like this rn even tho i reset the code to what you see up there
package net.doomxd.boe.block.entity.renderer;
import net.doomxd.boe.block.entity.custom.ElseBlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.LightmapTextureManager;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import java.awt.*;
public class ElseBlockEntityRenderer implements BlockEntityRenderer<ElseBlockEntity> {
public ElseBlockEntityRenderer(BlockEntityRendererFactory.Context context) {
}
@Override
public void render(ElseBlockEntity entity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
matricies.push()
if(player.isSneaking() && player != null) {
matrices.scale(0,0,0)
} else {
matrices.scale(1,1,1)
}
matrices.pop()
}
private int getLightLevel(World world, BlockPos pos) {
int bLight = world.getLightLevel(LightType.BLOCK, pos);
int sLight = world.getLightLevel(LightType.SKY, pos);
return LightmapTextureManager.pack(bLight, sLight);
}
}
Just look at that if that I added and the else
I see
Sry bout the formatting, having to use my phone rn
No worries, your help really means a lot even if your forgetting a couple semi colons lol
Yeah I plugged it in, for some reason it’s still blank but since it was like that even when there was nothing in the render box I assume that means I did smth stupid elsewhere
I dunno why tho this was working fine an hour ago
I honestly don't know of that is gonna work out not
Or*
I just might be sleep deprived lmao
It’s alright lol
What does the block do that requires an entity renderer
I was trying to make it disappear and reappear based on the player viewing it and the people here said I need a block entity and a block entity renderer for it, I’m very new so I’m just following orders
Lmao
... Did you not tell it to render...
I told it to render as invisible, unless a boolean that was set to false by default was true while I was experimenting earlier
Oh
Just look at me I put the name space of an old mod in one of my new mods by accident
And somehow moved where data gen outputs files
And made particles being registered stop data gen from working
So like... Ya I'm stupid to
Oh lord
I mean I spent two hours trying to figure out why the block textures were purple and black
Only to realize I put them in the items folder
😭
Hell I didn’t even realize
A friend of mine did
It doesn’t seem like the scaling works sadly
aw dang it
did you try this code
I copy and pasted the whole thing over my file
reeeeeeeeeeeeeeeeeeeeeeeeeeee
i also love how you didnt notice i switched accounts
You know I did realize the fault looked weird all of a sudden, but I thought I just missed it before
*faunt
*font
lol
So for the record all I’m doing when I copy and paste it in to change it is adding some semi colons, retyping the first matrices because it gets an error and flipping the if player is null and is sneaking because it tells me that it’s already too late to check for null if its second
I assume none of that could be the problem?
i honestly have no idea just give me a few to get my brain to wake up again
And just to be clear, I have basically no idea matracies actually does I just saw it in like four YouTube videos about item renders and on the documentation and I think it works how I’m using it here?
This is kind of just guess work tbh
i belive so, also do you happen to know what the large oak tree is called file wise
?
like the big sprawling branch one?
I don’t know sorry
sigh all good
I started learning fabric last week. I’m sorry. :(
alll good just was checken bc ive been looking for like an hour
So from what I can tell or at least guess
The commands are going through just it’s not targeted onto the actual block
I have absolutely no idea how to do that
I got to call it a night sadly, if you think of smth please lmk
okay i will gn