Cleanup + updated RedstonePlacementRule

This commit is contained in:
Felix Cravic 2020-04-28 22:08:39 +02:00
parent 54111ece6a
commit a06274f877
4 changed files with 17 additions and 10 deletions

View File

@ -8,7 +8,7 @@ import net.minestom.server.utils.time.UpdateOption;
/**
* TODO
* - option to set the global as "global breaking" meaning that multiple players mining the same block will break it faster (cumulation)
* - option to set the global as "global breaking" meaning that multiple players mining the same block will break it faster (accumulation)
*/
public abstract class CustomBlock {
@ -24,11 +24,14 @@ public abstract class CustomBlock {
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");
}
public UpdateOption getUpdateOption() {
return null;
}
public abstract void onPlace(Instance instance, BlockPosition blockPosition, Data data);
public abstract void onDestroy(Instance instance, BlockPosition blockPosition, Data data);
@ -36,6 +39,7 @@ public abstract class CustomBlock {
/**
* Handles interactions with this block. Can also block normal item use (containers should block when opening the
* menu, this prevents the player from placing a block when opening it for instance)
*
* @param player the player interacting
* @param hand the hand used to interact
* @param blockPosition the position of this block
@ -44,8 +48,6 @@ public abstract class CustomBlock {
*/
public abstract boolean onInteract(Player player, Player.Hand hand, BlockPosition blockPosition, Data data);
public abstract UpdateOption getUpdateOption();
/**
* This id can be serialized in chunk file, meaning no duplicate should exist
* Changing this value halfway should mean potentially breaking the world

View File

@ -69,7 +69,8 @@ public class RedstonePlacementRule extends BlockPlacementRule {
// TODO power
return Block.REDSTONE_WIRE.withProperties(east, north, power, south, west);
return Block.REDSTONE_WIRE.withProperties("east=" + east, "north=" + north,
"power=" + power, "south=" + south, "west=" + west);
}
private boolean isRedstone(Instance instance, int x, int y, int z) {

View File

@ -14,7 +14,10 @@ import net.minestom.server.stat.StatisticType;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class RegistryMain {

View File

@ -38,6 +38,7 @@ public class SchedulerManager {
/**
* Adds a task to run when the server shutdowns
*
* @param runnable the task to perform
* @return
*/