mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Cleanup + updated RedstonePlacementRule
This commit is contained in:
parent
54111ece6a
commit
a06274f877
@ -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,16 +39,15 @@ 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 player the player interacting
|
||||
* @param hand the hand used to interact
|
||||
* @param blockPosition the position of this block
|
||||
* @param data the data at this position
|
||||
* @param data the data at this position
|
||||
* @return true if this block blocks normal item use, false otherwise
|
||||
*/
|
||||
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
|
||||
|
@ -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) {
|
||||
|
@ -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 {
|
||||
|
||||
@ -202,7 +205,7 @@ public class RegistryMain {
|
||||
if (statePropertiesObject != null) {
|
||||
Set<Map.Entry<String, JsonElement>> statePropertiesEntries = statePropertiesObject.entrySet();//will return members of your object
|
||||
for (Map.Entry<String, JsonElement> propertyEntry : statePropertiesEntries) {
|
||||
String propertyValue = propertyEntry.getKey()+"="+propertyEntry.getValue().getAsString();
|
||||
String propertyValue = propertyEntry.getKey() + "=" + propertyEntry.getValue().getAsString();
|
||||
|
||||
blockState.propertiesValues.add(propertyValue);
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ public class SchedulerManager {
|
||||
|
||||
/**
|
||||
* Adds a task to run when the server shutdowns
|
||||
*
|
||||
* @param runnable the task to perform
|
||||
* @return
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user