fix: packedLight forced to 0xff + blank placeholder texture
Some checks are pending
Build / build (push) Waiting to run
Some checks are pending
Build / build (push) Waiting to run
This commit is contained in:
parent
58d146e04e
commit
8a5d79280c
4 changed files with 56 additions and 2 deletions
|
@ -2,6 +2,7 @@ package fr.sushi.charmsnfabrics.client;
|
|||
|
||||
import fr.sushi.charmsnfabrics.CharmsAndFabrics;
|
||||
import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel;
|
||||
import fr.sushi.charmsnfabrics.client.renderer.FloralWorkshopRenderer;
|
||||
import fr.sushi.charmsnfabrics.client.renderer.FlowerCrownRenderer;
|
||||
import fr.sushi.charmsnfabrics.common.CharmsAndFabricRegistries;
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
|
@ -22,7 +23,7 @@ public class CharmsFabricsClient
|
|||
public CharmsFabricsClient(ModContainer container)
|
||||
{
|
||||
container.registerExtensionPoint(IConfigScreenFactory.class,
|
||||
ConfigurationScreen::new);
|
||||
ConfigurationScreen::new);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -38,6 +39,15 @@ public class CharmsFabricsClient
|
|||
final EntityRenderersEvent.RegisterLayerDefinitions event)
|
||||
{
|
||||
event.registerLayerDefinition(CharmsAndFabricsLayers.CROWN_LAYER,
|
||||
FlowerCrownModel::createLayer);
|
||||
FlowerCrownModel::createLayer);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
private static void onRegisterRenderers(
|
||||
final EntityRenderersEvent.RegisterRenderers event)
|
||||
{
|
||||
event.registerBlockEntityRenderer(
|
||||
CharmsAndFabricRegistries.Entities.FLORAL_BLOCK_ENTITY.get(),
|
||||
FloralWorkshopRenderer::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package fr.sushi.charmsnfabrics.client.renderer;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import fr.sushi.charmsnfabrics.CharmsAndFabrics;
|
||||
import fr.sushi.charmsnfabrics.client.CharmsAndFabricsLayers;
|
||||
import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel;
|
||||
import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkshopBlockEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class FloralWorkshopRenderer implements BlockEntityRenderer<FloralWorkshopBlockEntity>
|
||||
{
|
||||
private final FlowerCrownModel model;
|
||||
|
||||
public FloralWorkshopRenderer(BlockEntityRendererProvider.Context ctx)
|
||||
{
|
||||
this.model = new FlowerCrownModel(
|
||||
ctx.bakeLayer(CharmsAndFabricsLayers.CROWN_LAYER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(FloralWorkshopBlockEntity blockEntity, float partialTick,
|
||||
PoseStack poseStack, MultiBufferSource bufferSource,
|
||||
int packedLight, int packedOverlay, Vec3 cameraPos)
|
||||
{
|
||||
poseStack.pushPose();
|
||||
poseStack.translate(0.5f, 1.625f, 0.5f);
|
||||
ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(
|
||||
CharmsAndFabrics.MODID,
|
||||
"textures/models/accessory/flower_crown.png");
|
||||
VertexConsumer consumer = bufferSource.getBuffer(RenderType.entityCutout(texture));
|
||||
this.model.renderToBuffer(poseStack, consumer, 0xff, packedOverlay);
|
||||
poseStack.popPose();
|
||||
}
|
||||
}
|
|
@ -2,6 +2,8 @@ package fr.sushi.charmsnfabrics.common.entities.block;
|
|||
|
||||
import fr.sushi.charmsnfabrics.common.CharmsAndFabricRegistries;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
|
@ -12,4 +14,5 @@ public class FloralWorkshopBlockEntity extends BlockEntity
|
|||
super(CharmsAndFabricRegistries.Entities.FLORAL_BLOCK_ENTITY.get(), pos,
|
||||
blockState);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 99 B |
Loading…
Add table
Add a link
Reference in a new issue