tutorial:blockstate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
tutorial:blockstate [2022/12/16 01:42] – [A note about performance] solidblock | tutorial:blockstate [2022/12/16 01:52] – solidblock | ||
---|---|---|---|
Line 4: | Line 4: | ||
This is what '' | This is what '' | ||
| | ||
- | First we define the boolean property of the block - whether or not it is charged (careful not to import the wrong BooleanProperty!): | + | First we define the boolean property of the block - whether or not it is charged (careful not to import the wrong '' |
+ | |||
+ | In fact, you can also use existing properties defined in vanilla, which can be found in '' | ||
<code java> | <code java> | ||
public class ChargeableBlock extends Block { | public class ChargeableBlock extends Block { | ||
public static final BooleanProperty CHARGED = BooleanProperty.of(" | public static final BooleanProperty CHARGED = BooleanProperty.of(" | ||
| | ||
- | // The block instance. You can place it anywhere. | + | // The block instance. You can place it anywhere. Make the class is initialized. |
- | public static final ChargeableBlock CHARGEABLE_BLOCK = Registry.register( | + | public static final ChargeableBlock CHARGEABLE_BLOCK = new ChargeableBlock(FabricBlockSettings.copyOf(Blocks.STONE)); |
- | Registries.BLOCK, | + | } |
- | | + | </ |
- | new ChargeableBlock( | + | <code java> |
+ | public class ExampleMod implements ModInitializer { | ||
+ | @Override | ||
+ | public void onInitialize() { | ||
+ | | ||
+ | | ||
+ | } | ||
} | } | ||
</ | </ |
tutorial/blockstate.txt · Last modified: 2023/11/18 08:13 by solidblock