mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-26 10:29:20 +00:00
红石基础
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user