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.client.datagen.CnFModelProvider;
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.common.CnFRegistries;
import net.neoforged.api.distmarker.Dist;
@ -31,8 +31,7 @@ public class CnFClient
@SubscribeEvent
private static void onClientSetup(final FMLClientSetupEvent event)
{
ICurioRenderer.register(
CnFRegistries.Items.FLOWER_CROWN.get(),
ICurioRenderer.register(CnFRegistries.Items.FLOWER_CROWN.get(),
FlowerCrownRenderer::new);
}
@ -49,12 +48,13 @@ public class CnFClient
final EntityRenderersEvent.RegisterRenderers event)
{
event.registerBlockEntityRenderer(
CnFRegistries.Entities.FLORAL_BLOCK_ENTITY.get(),
FloralWorkstationRenderer::new);
CnFRegistries.Entities.FLORAL_WORKBENCH_BLOCKENTITY.get(),
FloralWorkbenchRenderer::new);
}
@SubscribeEvent
private static void onGatherClientData(final GatherDataEvent.Client event) {
private static void onGatherClientData(final GatherDataEvent.Client event)
{
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.model.ModelLocationUtils;
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.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import java.util.Collections;
public class CnFModelProvider extends ModelProvider
{
public CnFModelProvider(PackOutput output)
@ -26,7 +22,7 @@ public class CnFModelProvider extends ModelProvider
private void registerFloralWorkbench(BlockModelGenerators blockModels)
{
Block block = CnFRegistries.Blocks.FLORAL_WORKSTATION.get();
Block block = CnFRegistries.Blocks.FLORAL_WORKBENCH.get();
ResourceLocation model = ModelLocationUtils.getModelLocation(block);
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.client.CnFLayers;
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.RenderType;
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.world.phys.Vec3;
public class FloralWorkstationRenderer implements BlockEntityRenderer<FloralWorkstationBlockEntity>
public class FloralWorkbenchRenderer implements BlockEntityRenderer<FloralWorkbenchBlockEntity>
{
private final FlowerCrownModel model;
public FloralWorkstationRenderer(BlockEntityRendererProvider.Context ctx)
public FloralWorkbenchRenderer(BlockEntityRendererProvider.Context ctx)
{
this.model = new FlowerCrownModel(
ctx.bakeLayer(CnFLayers.CROWN_LAYER));
this.model = new FlowerCrownModel(ctx.bakeLayer(CnFLayers.CROWN_LAYER));
}
@Override
public void render(FloralWorkstationBlockEntity blockEntity, float partialTick,
PoseStack poseStack, MultiBufferSource bufferSource,
int packedLight, int packedOverlay, Vec3 cameraPos)
public void render(FloralWorkbenchBlockEntity 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));
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();
}

View file

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

View file

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

View file

@ -1,6 +1,6 @@
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.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
@ -21,7 +21,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Map;
public class FloralWorkstation extends Block implements EntityBlock
public class FloralWorkbench extends Block implements EntityBlock
{
public static final EnumProperty<Direction> FACING =
HorizontalDirectionalBlock.FACING;
@ -36,7 +36,7 @@ public class FloralWorkstation extends Block implements EntityBlock
private static final Map<Direction.Axis, VoxelShape> SHAPES =
Shapes.rotateHorizontalAxis(Shapes.or(LEGS, TABLE, SUPPORT));
public FloralWorkstation(BlockBehaviour.Properties properties)
public FloralWorkbench(BlockBehaviour.Properties properties)
{
super(properties);
this.registerDefaultState(
@ -73,6 +73,6 @@ public class FloralWorkstation extends Block implements EntityBlock
@Override
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.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);
}

View file

@ -1,7 +1,7 @@
{
"itemGroup.charmsnfabrics": "Charms & Fabrics",
"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.section.charmsnfabrics.common.toml": "Charms & Fabrics Configs",

View file

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