mirror of
https://github.com/Xiao-MoMi/craft-engine.git
synced 2025-12-26 02:19:23 +00:00
Initial commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package net.momirealms.craftengine.shared;
|
||||
|
||||
public class ObjectHolder<T> {
|
||||
private T value;
|
||||
|
||||
public ObjectHolder(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public ObjectHolder() {
|
||||
}
|
||||
|
||||
public T value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void bindValue(T value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
import net.momirealms.craftengine.shared.ObjectHolder;
|
||||
|
||||
public interface BehaviorHolder {
|
||||
|
||||
ObjectHolder<BlockBehavior> getBehaviorHolder();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
public abstract class BlockBehavior {
|
||||
|
||||
public Object updateShape(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return superMethod.call();
|
||||
}
|
||||
|
||||
public Object getFluidState(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return superMethod.call();
|
||||
}
|
||||
|
||||
public void tick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
public void randomTick(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
public void onPlace(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
public boolean canSurvive(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
return (boolean) superMethod.call();
|
||||
}
|
||||
|
||||
public void onBrokenAfterFall(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
public void onLand(Object thisBlock, Object[] args, Callable<Object> superMethod) throws Exception {
|
||||
superMethod.call();
|
||||
}
|
||||
|
||||
public boolean isValidBoneMealTarget(Object thisBlock, Object[] args) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBoneMealSuccess(Object thisBlock, Object[] args) throws Exception {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void performBoneMeal(Object thisBlock, Object[] args) throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
public interface BlockShape {
|
||||
|
||||
Object getShape(Object thisObj, Object[] args) throws Exception;
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
public class EmptyBlockBehavior extends BlockBehavior {
|
||||
public static final EmptyBlockBehavior INSTANCE = new EmptyBlockBehavior();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
public interface NoteBlockIndicator {
|
||||
|
||||
boolean isNoteBlock();
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package net.momirealms.craftengine.shared.block;
|
||||
|
||||
import net.momirealms.craftengine.shared.ObjectHolder;
|
||||
|
||||
public interface ShapeHolder {
|
||||
|
||||
ObjectHolder<BlockShape> getShapeHolder();
|
||||
}
|
||||
Reference in New Issue
Block a user