refacto: renaming FloralWorkstation -> FloralWorkbench
Some checks are pending
Build / build (push) Waiting to run

This commit is contained in:
SushiCannibale 2025-08-02 18:18:07 +02:00
parent f13546e9b4
commit efb3f565f7
10 changed files with 45 additions and 50 deletions

View file

@ -3,7 +3,7 @@ package fr.sushi.charmsnfabrics.client;
import fr.sushi.charmsnfabrics.CharmsAndFabrics; import fr.sushi.charmsnfabrics.CharmsAndFabrics;
import fr.sushi.charmsnfabrics.client.datagen.CnFModelProvider; import fr.sushi.charmsnfabrics.client.datagen.CnFModelProvider;
import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel; import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel;
import fr.sushi.charmsnfabrics.client.renderer.FloralWorkstationRenderer; import fr.sushi.charmsnfabrics.client.renderer.FloralWorkbenchRenderer;
import fr.sushi.charmsnfabrics.client.renderer.FlowerCrownRenderer; import fr.sushi.charmsnfabrics.client.renderer.FlowerCrownRenderer;
import fr.sushi.charmsnfabrics.common.CnFRegistries; import fr.sushi.charmsnfabrics.common.CnFRegistries;
import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.Dist;
@ -31,8 +31,7 @@ public class CnFClient
@SubscribeEvent @SubscribeEvent
private static void onClientSetup(final FMLClientSetupEvent event) private static void onClientSetup(final FMLClientSetupEvent event)
{ {
ICurioRenderer.register( ICurioRenderer.register(CnFRegistries.Items.FLOWER_CROWN.get(),
CnFRegistries.Items.FLOWER_CROWN.get(),
FlowerCrownRenderer::new); FlowerCrownRenderer::new);
} }
@ -49,12 +48,13 @@ public class CnFClient
final EntityRenderersEvent.RegisterRenderers event) final EntityRenderersEvent.RegisterRenderers event)
{ {
event.registerBlockEntityRenderer( event.registerBlockEntityRenderer(
CnFRegistries.Entities.FLORAL_BLOCK_ENTITY.get(), CnFRegistries.Entities.FLORAL_WORKBENCH_BLOCKENTITY.get(),
FloralWorkstationRenderer::new); FloralWorkbenchRenderer::new);
} }
@SubscribeEvent @SubscribeEvent
private static void onGatherClientData(final GatherDataEvent.Client event) { private static void onGatherClientData(final GatherDataEvent.Client event)
{
event.createProvider(CnFModelProvider::new); event.createProvider(CnFModelProvider::new);
} }
} }

View file

@ -8,15 +8,11 @@ import net.minecraft.client.data.models.ModelProvider;
import net.minecraft.client.data.models.MultiVariant; import net.minecraft.client.data.models.MultiVariant;
import net.minecraft.client.data.models.model.ModelLocationUtils; import net.minecraft.client.data.models.model.ModelLocationUtils;
import net.minecraft.client.data.models.model.ModelTemplates; import net.minecraft.client.data.models.model.ModelTemplates;
import net.minecraft.client.renderer.item.BlockModelWrapper;
import net.minecraft.client.renderer.item.ClientItem;
import net.minecraft.data.PackOutput; import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import java.util.Collections;
public class CnFModelProvider extends ModelProvider public class CnFModelProvider extends ModelProvider
{ {
public CnFModelProvider(PackOutput output) public CnFModelProvider(PackOutput output)
@ -26,7 +22,7 @@ public class CnFModelProvider extends ModelProvider
private void registerFloralWorkbench(BlockModelGenerators blockModels) private void registerFloralWorkbench(BlockModelGenerators blockModels)
{ {
Block block = CnFRegistries.Blocks.FLORAL_WORKSTATION.get(); Block block = CnFRegistries.Blocks.FLORAL_WORKBENCH.get();
ResourceLocation model = ModelLocationUtils.getModelLocation(block); ResourceLocation model = ModelLocationUtils.getModelLocation(block);
MultiVariant variants = BlockModelGenerators.plainVariant(model); MultiVariant variants = BlockModelGenerators.plainVariant(model);

View file

@ -5,7 +5,7 @@ import com.mojang.blaze3d.vertex.VertexConsumer;
import fr.sushi.charmsnfabrics.CharmsAndFabrics; import fr.sushi.charmsnfabrics.CharmsAndFabrics;
import fr.sushi.charmsnfabrics.client.CnFLayers; import fr.sushi.charmsnfabrics.client.CnFLayers;
import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel; import fr.sushi.charmsnfabrics.client.model.FlowerCrownModel;
import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkstationBlockEntity; import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkbenchBlockEntity;
import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
@ -13,27 +13,28 @@ import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
public class FloralWorkstationRenderer implements BlockEntityRenderer<FloralWorkstationBlockEntity> public class FloralWorkbenchRenderer implements BlockEntityRenderer<FloralWorkbenchBlockEntity>
{ {
private final FlowerCrownModel model; private final FlowerCrownModel model;
public FloralWorkstationRenderer(BlockEntityRendererProvider.Context ctx) public FloralWorkbenchRenderer(BlockEntityRendererProvider.Context ctx)
{ {
this.model = new FlowerCrownModel( this.model = new FlowerCrownModel(ctx.bakeLayer(CnFLayers.CROWN_LAYER));
ctx.bakeLayer(CnFLayers.CROWN_LAYER));
} }
@Override @Override
public void render(FloralWorkstationBlockEntity blockEntity, float partialTick, public void render(FloralWorkbenchBlockEntity blockEntity,
PoseStack poseStack, MultiBufferSource bufferSource, float partialTick, PoseStack poseStack,
int packedLight, int packedOverlay, Vec3 cameraPos) MultiBufferSource bufferSource, int packedLight, int packedOverlay,
Vec3 cameraPos)
{ {
poseStack.pushPose(); poseStack.pushPose();
poseStack.translate(0.5f, 1.625f, 0.5f); poseStack.translate(0.5f, 1.625f, 0.5f);
ResourceLocation texture = ResourceLocation.fromNamespaceAndPath( ResourceLocation texture =
CharmsAndFabrics.MODID, ResourceLocation.fromNamespaceAndPath(CharmsAndFabrics.MODID,
"textures/models/accessory/flower_crown.png"); "textures/models/accessory/flower_crown.png");
VertexConsumer consumer = bufferSource.getBuffer(RenderType.entityCutout(texture)); VertexConsumer consumer =
bufferSource.getBuffer(RenderType.entityCutout(texture));
this.model.renderToBuffer(poseStack, consumer, 0xff, packedOverlay); this.model.renderToBuffer(poseStack, consumer, 0xff, packedOverlay);
poseStack.popPose(); poseStack.popPose();
} }

View file

@ -43,11 +43,9 @@ public class FlowerCrownRenderer implements ICurioRenderer
ResourceLocation texture = item.getModelTexture(); ResourceLocation texture = item.getModelTexture();
VertexConsumer vertexconsumer = VertexConsumer vertexconsumer =
ItemRenderer.getArmorFoilBuffer(renderTypeBuffer, ItemRenderer.getArmorFoilBuffer(renderTypeBuffer,
RenderType.entityCutout( RenderType.entityCutout(texture), stack.hasFoil());
texture),
stack.hasFoil());
ICurioRenderer.setupHumanoidAnimations(this.model, renderState); ICurioRenderer.setupHumanoidAnimations(this.model, renderState);
this.model.renderToBuffer(poseStack, vertexconsumer, packedLight, this.model.renderToBuffer(poseStack, vertexconsumer, packedLight,
OverlayTexture.NO_OVERLAY); OverlayTexture.NO_OVERLAY);
} }
} }

View file

@ -1,8 +1,8 @@
package fr.sushi.charmsnfabrics.common; package fr.sushi.charmsnfabrics.common;
import fr.sushi.charmsnfabrics.CharmsAndFabrics; import fr.sushi.charmsnfabrics.CharmsAndFabrics;
import fr.sushi.charmsnfabrics.common.block.FloralWorkstation; import fr.sushi.charmsnfabrics.common.block.FloralWorkbench;
import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkstationBlockEntity; import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkbenchBlockEntity;
import fr.sushi.charmsnfabrics.common.item.FlowerCrown; import fr.sushi.charmsnfabrics.common.item.FlowerCrown;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
@ -34,19 +34,19 @@ public class CnFRegistries
(properties) -> new FlowerCrown( (properties) -> new FlowerCrown(
properties.stacksTo(1))); properties.stacksTo(1)));
/* BlockItems */ /* BlockItems */
public static final DeferredItem<BlockItem> FLORAL_WORKSTATION = public static final DeferredItem<BlockItem> FLORAL_WORKBENCH =
ITEMS.registerItem("floral_workstation", ITEMS.registerItem("floral_workbench",
properties -> new BlockItem( properties -> new BlockItem(
Blocks.FLORAL_WORKSTATION.get(), properties)); Blocks.FLORAL_WORKBENCH.get(), properties));
} }
public static class Blocks public static class Blocks
{ {
public static final DeferredRegister.Blocks BLOCKS = public static final DeferredRegister.Blocks BLOCKS =
DeferredRegister.createBlocks(CharmsAndFabrics.MODID); DeferredRegister.createBlocks(CharmsAndFabrics.MODID);
public static final DeferredBlock<Block> FLORAL_WORKSTATION = public static final DeferredBlock<Block> FLORAL_WORKBENCH =
BLOCKS.register("floral_workstation", BLOCKS.register("floral_workbench",
registry_name -> new FloralWorkstation( registry_name -> new FloralWorkbench(
BlockBehaviour.Properties.of() BlockBehaviour.Properties.of()
.setId(ResourceKey.create( .setId(ResourceKey.create(
Registries.BLOCK, Registries.BLOCK,
@ -75,7 +75,7 @@ public class CnFRegistries
output.accept( output.accept(
Items.FLOWER_CROWN.get()); Items.FLOWER_CROWN.get());
output.accept( output.accept(
Blocks.FLORAL_WORKSTATION.toStack()); Blocks.FLORAL_WORKBENCH.toStack());
}).build()); }).build());
} }
@ -85,12 +85,12 @@ public class CnFRegistries
BLOCK_ENTITY_TYPES = BLOCK_ENTITY_TYPES =
DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE,
CharmsAndFabrics.MODID); CharmsAndFabrics.MODID);
public static final Supplier<BlockEntityType<FloralWorkstationBlockEntity>> public static final Supplier<BlockEntityType<FloralWorkbenchBlockEntity>>
FLORAL_BLOCK_ENTITY = FLORAL_WORKBENCH_BLOCKENTITY =
BLOCK_ENTITY_TYPES.register("floral_blockstation_entity", BLOCK_ENTITY_TYPES.register("floral_workbench_entity",
() -> new BlockEntityType<>( () -> new BlockEntityType<>(
FloralWorkstationBlockEntity::new, FloralWorkbenchBlockEntity::new,
Set.of(Blocks.FLORAL_WORKSTATION.get()))); Set.of(Blocks.FLORAL_WORKBENCH.get())));
} }
public static void register(IEventBus bus) public static void register(IEventBus bus)

View file

@ -1,6 +1,6 @@
package fr.sushi.charmsnfabrics.common.block; package fr.sushi.charmsnfabrics.common.block;
import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkstationBlockEntity; import fr.sushi.charmsnfabrics.common.entities.block.FloralWorkbenchBlockEntity;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.item.context.BlockPlaceContext;
@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Map; import java.util.Map;
public class FloralWorkstation extends Block implements EntityBlock public class FloralWorkbench extends Block implements EntityBlock
{ {
public static final EnumProperty<Direction> FACING = public static final EnumProperty<Direction> FACING =
HorizontalDirectionalBlock.FACING; HorizontalDirectionalBlock.FACING;
@ -36,7 +36,7 @@ public class FloralWorkstation extends Block implements EntityBlock
private static final Map<Direction.Axis, VoxelShape> SHAPES = private static final Map<Direction.Axis, VoxelShape> SHAPES =
Shapes.rotateHorizontalAxis(Shapes.or(LEGS, TABLE, SUPPORT)); Shapes.rotateHorizontalAxis(Shapes.or(LEGS, TABLE, SUPPORT));
public FloralWorkstation(BlockBehaviour.Properties properties) public FloralWorkbench(BlockBehaviour.Properties properties)
{ {
super(properties); super(properties);
this.registerDefaultState( this.registerDefaultState(
@ -73,6 +73,6 @@ public class FloralWorkstation extends Block implements EntityBlock
@Override @Override
public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state) public @Nullable BlockEntity newBlockEntity(BlockPos pos, BlockState state)
{ {
return new FloralWorkstationBlockEntity(pos, state); return new FloralWorkbenchBlockEntity(pos, state);
} }
} }

View file

@ -5,11 +5,11 @@ import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
public class FloralWorkstationBlockEntity extends BlockEntity public class FloralWorkbenchBlockEntity extends BlockEntity
{ {
public FloralWorkstationBlockEntity(BlockPos pos, BlockState blockState) public FloralWorkbenchBlockEntity(BlockPos pos, BlockState blockState)
{ {
super(CnFRegistries.Entities.FLORAL_BLOCK_ENTITY.get(), pos, super(CnFRegistries.Entities.FLORAL_WORKBENCH_BLOCKENTITY.get(), pos,
blockState); blockState);
} }

View file

@ -1,7 +1,7 @@
{ {
"itemGroup.charmsnfabrics": "Charms & Fabrics", "itemGroup.charmsnfabrics": "Charms & Fabrics",
"item.charmsnfabrics.flower_crown": "Flower Crown", "item.charmsnfabrics.flower_crown": "Flower Crown",
"item.charmsnfabrics.floral_workstation": "Floral Workstation", "item.charmsnfabrics.floral_workbench": "Floral Workbench",
"charmsnfabrics.configuration.title": "Charms & Fabrics Configs", "charmsnfabrics.configuration.title": "Charms & Fabrics Configs",
"charmsnfabrics.configuration.section.charmsnfabrics.common.toml": "Charms & Fabrics Configs", "charmsnfabrics.configuration.section.charmsnfabrics.common.toml": "Charms & Fabrics Configs",

View file

@ -4,7 +4,7 @@
"texture_size": [64, 64], "texture_size": [64, 64],
"render_type": "minecraft:cutout_mipped", "render_type": "minecraft:cutout_mipped",
"textures": { "textures": {
"0": "charmsnfabrics:block/floral_workstation", "0": "charmsnfabrics:block/floral_workbench",
"particle": "minecraft:block/oak_planks" "particle": "minecraft:block/oak_planks"
}, },
"elements": [ "elements": [