diff --git a/src/main/java/fr/themode/demo/blocks/StoneBlock.java b/src/main/java/fr/themode/demo/blocks/StoneBlock.java index d061841c9..29ffe78b1 100644 --- a/src/main/java/fr/themode/demo/blocks/StoneBlock.java +++ b/src/main/java/fr/themode/demo/blocks/StoneBlock.java @@ -3,6 +3,7 @@ package fr.themode.demo.blocks; import net.minestom.server.data.Data; import net.minestom.server.entity.Player; import net.minestom.server.instance.Instance; +import net.minestom.server.instance.block.Block; import net.minestom.server.instance.block.CustomBlock; import net.minestom.server.utils.BlockPosition; import net.minestom.server.utils.time.UpdateOption; @@ -10,7 +11,7 @@ import net.minestom.server.utils.time.UpdateOption; public class StoneBlock extends CustomBlock { public StoneBlock() { - super((short) 1, "custom_block"); + super(Block.STONE, "custom_block"); } @Override diff --git a/src/main/java/fr/themode/demo/blocks/UpdatableBlockDemo.java b/src/main/java/fr/themode/demo/blocks/UpdatableBlockDemo.java index 37dd2f266..7b25074cb 100644 --- a/src/main/java/fr/themode/demo/blocks/UpdatableBlockDemo.java +++ b/src/main/java/fr/themode/demo/blocks/UpdatableBlockDemo.java @@ -3,6 +3,7 @@ package fr.themode.demo.blocks; import net.minestom.server.data.Data; import net.minestom.server.entity.Player; import net.minestom.server.instance.Instance; +import net.minestom.server.instance.block.Block; import net.minestom.server.instance.block.CustomBlock; import net.minestom.server.utils.BlockPosition; import net.minestom.server.utils.time.TimeUnit; @@ -13,7 +14,7 @@ public class UpdatableBlockDemo extends CustomBlock { private static final UpdateOption UPDATE_OPTION = new UpdateOption(20, TimeUnit.TICK); public UpdatableBlockDemo() { - super((short) 11, "updatable"); + super(Block.DIRT, "updatable"); } @Override diff --git a/src/main/java/net/minestom/server/instance/block/CustomBlock.java b/src/main/java/net/minestom/server/instance/block/CustomBlock.java index 5d1fa674d..eee01f71e 100644 --- a/src/main/java/net/minestom/server/instance/block/CustomBlock.java +++ b/src/main/java/net/minestom/server/instance/block/CustomBlock.java @@ -20,6 +20,10 @@ public abstract class CustomBlock { this.identifier = identifier; } + public CustomBlock(Block block, String identifier) { + this(block.getBlockId(), identifier); + } + // TODO add another object parameter which will offer a lot of integrated features (like break animation, id change etc...) public void update(Instance instance, BlockPosition blockPosition, Data data) { throw new UnsupportedOperationException("Update method not overridden");