SHOW:
|
|
- or go back to the newest paste.
1 | block class | |
2 | ||
3 | package com.sixthsurge.smithing.blocks.toolsmithtable; | |
4 | ||
5 | import com.sixthsurge.smithing.SmithingMod; | |
6 | import net.minecraft.block.Block; | |
7 | import net.minecraft.block.BlockState; | |
8 | import net.minecraft.block.SoundType; | |
9 | import net.minecraft.block.material.Material; | |
10 | import net.minecraft.tileentity.TileEntity; | |
11 | import net.minecraft.world.IBlockReader; | |
12 | ||
13 | import javax.annotation.Nullable; | |
14 | ||
15 | public class ToolsmithTable extends Block { | |
16 | ||
17 | public static ToolsmithTable instance; | |
18 | ||
19 | public ToolsmithTable() { | |
20 | super(Properties.create(Material.ROCK) | |
21 | .sound(SoundType.WOOD) | |
22 | .hardnessAndResistance(1.0f) | |
23 | ); | |
24 | ||
25 | setRegistryName(SmithingMod.MOD_ID, "toolsmith_table"); | |
26 | ||
27 | instance = this; | |
28 | } | |
29 | ||
30 | @Override | |
31 | public boolean hasTileEntity() { return true; } | |
32 | ||
33 | @Nullable | |
34 | @Override | |
35 | public TileEntity createTileEntity(BlockState state, IBlockReader world) { | |
36 | return new ToolsmithTableTile(); | |
37 | } | |
38 | } | |
39 | ||
40 | tile entity class | |
41 | ||
42 | package com.sixthsurge.smithing.blocks.toolsmithtable; | |
43 | ||
44 | import com.sixthsurge.smithing.SmithingMod; | |
45 | import com.sixthsurge.smithing.blocks.SmithingBlocks; | |
46 | import net.minecraft.tileentity.ITickableTileEntity; | |
47 | import net.minecraft.tileentity.TileEntity; | |
48 | import org.apache.logging.log4j.Level; | |
49 | ||
50 | public class ToolsmithTableTile extends TileEntity implements ITickableTileEntity { | |
51 | ||
52 | public ToolsmithTableTile() { | |
53 | super(SmithingBlocks.toolsmith_table_tile); | |
54 | } | |
55 | ||
56 | @Override | |
57 | public void tick() { | |
58 | SmithingMod.getLogger().log(Level.DEBUG.DEBUG, "Test"); | |
59 | } | |
60 | } | |
61 | ||
62 | ||
63 | where i register it (in a class with @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) | |
64 | ||
65 | @SubscribeEvent | |
66 | public static void onTileEntityRegistry(final RegistryEvent.Register<TileEntityType<?>> event) { | |
67 | event.getRegistry().register(TileEntityType.Builder.create(ToolsmithTableTile::new, ToolsmithTable.instance).build(null).setRegistryName(SmithingMod.MOD_ID, "toolsmith_table")); | |
68 | } |