9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-26 10:29:20 +00:00

红石基础

This commit is contained in:
XiaoMoMi
2025-05-25 02:52:33 +08:00
parent 539dcd7d8f
commit de47525c3b
27 changed files with 810 additions and 52 deletions

View File

@@ -1,9 +1,18 @@
package net.momirealms.craftengine.shared.block;
import java.util.Optional;
import java.util.concurrent.Callable;
public abstract class BlockBehavior {
@SuppressWarnings("unchecked")
public <T extends BlockBehavior> Optional<T> getAs(Class<T> tClass) {
if (tClass.isInstance(this)) {
return Optional.of((T) this);
}
return Optional.empty();
}
public Object rotate(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
return superMethod.call();
}
@@ -16,6 +25,10 @@ public abstract class BlockBehavior {
return superMethod.call();
}
public void neighborChanged(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}
public void tick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
superMethod.call();
}