Attempt at making the signblockentity render
This commit is contained in:
parent
16b59becf5
commit
2ce52a4861
|
@ -0,0 +1,15 @@
|
||||||
|
package net.parsell.cherry;
|
||||||
|
|
||||||
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.BlockEntityRendererRegistry;
|
||||||
|
import net.minecraft.client.render.block.entity.SignBlockEntityRenderer;
|
||||||
|
import net.parsell.cherry.core.CherryBlocks;
|
||||||
|
|
||||||
|
public class CherryClient implements ClientModInitializer {
|
||||||
|
@Override
|
||||||
|
public void onInitializeClient(){
|
||||||
|
System.out.println("Cherry Client Initilizating...");
|
||||||
|
BlockEntityRendererRegistry.INSTANCE.register(CherryBlocks.CHERRYSIGN_ENTITY, SignBlockEntityRenderer::new);
|
||||||
|
System.out.println("Sign entity registered without error");
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ public class CherryBlocks {
|
||||||
public static final Block CHERRYBUTTON = registerButton("cherry_button", FabricBlockSettings.copyOf(Blocks.OAK_BUTTON), 5, 20); //TODO: recipe, loot tables, tags (as required)
|
public static final Block CHERRYBUTTON = registerButton("cherry_button", FabricBlockSettings.copyOf(Blocks.OAK_BUTTON), 5, 20); //TODO: recipe, loot tables, tags (as required)
|
||||||
public static final Block CHERRYPRESSUREPLATE = registerPressurePlate("cherry_pressure_plate", PressurePlateBlock.ActivationRule.EVERYTHING, FabricBlockSettings.copyOf(Blocks.OAK_PRESSURE_PLATE), 5, 20); //TODO: recipe, loot tables, tags (as required)
|
public static final Block CHERRYPRESSUREPLATE = registerPressurePlate("cherry_pressure_plate", PressurePlateBlock.ActivationRule.EVERYTHING, FabricBlockSettings.copyOf(Blocks.OAK_PRESSURE_PLATE), 5, 20); //TODO: recipe, loot tables, tags (as required)
|
||||||
public static final Block CHERRYSIGN = registerSign("cherry_sign", SignType.OAK, FabricBlockSettings.copyOf(Blocks.OAK_SIGN), 5, 20); // TODO: recipe, loot tables
|
public static final Block CHERRYSIGN = registerSign("cherry_sign", SignType.OAK, FabricBlockSettings.copyOf(Blocks.OAK_SIGN), 5, 20); // TODO: recipe, loot tables
|
||||||
|
public static final BlockEntityType<SignBlockEntity> CHERRYSIGN_ENTITY = BlockEntityType.Builder.create(SignBlockEntity::new, CHERRYSIGN).build(null);
|
||||||
|
|
||||||
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
private static Block registerBlock(String blockID, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
||||||
Block block = new Block(settings);
|
Block block = new Block(settings);
|
||||||
|
@ -86,7 +87,6 @@ public class CherryBlocks {
|
||||||
private static Block registerSign(String blockID, SignType type, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
private static Block registerSign(String blockID, SignType type, FabricBlockSettings settings, int burnChance, int burnSpread) {
|
||||||
Block block = new SignBlock(settings, type);
|
Block block = new SignBlock(settings, type);
|
||||||
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
Registry.register(Registry.BLOCK, new Identifier("cherry", blockID), block);
|
||||||
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier("cherry", blockID), BlockEntityType.Builder.create(SignBlockEntity::new, block).build(null));
|
|
||||||
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
FlammableBlockRegistry.getDefaultInstance().add(block, burnChance, burnSpread);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
@ -154,5 +154,10 @@ public class CherryBlocks {
|
||||||
|
|
||||||
// Register unique logs
|
// Register unique logs
|
||||||
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
|
AxeItemAccessor.setStrippedLogs(STRIPPABLE_BLOCKS.build());
|
||||||
|
System.out.println(CHERRYSIGN_ENTITY.toString());
|
||||||
|
if(!(CHERRYSIGN_ENTITY == null))
|
||||||
|
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier("cherry", "cherry_sign"), CHERRYSIGN_ENTITY);
|
||||||
|
else
|
||||||
|
System.out.println("cherry:cherry_sign entity is null");
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 1009 B |
Binary file not shown.
After Width: | Height: | Size: 604 B |
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
|
"client": [
|
||||||
|
"net.parsell.cherry.CherryClient"
|
||||||
|
],
|
||||||
"main": [
|
"main": [
|
||||||
"net.parsell.cherry.Cherry"
|
"net.parsell.cherry.Cherry"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue