mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-25 18:47:40 +01:00
Added Block object to the CustomBlock constructor
This commit is contained in:
parent
f544f090ae
commit
38abe55161
@ -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
|
||||
|
@ -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
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user