9
0
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:
XiaoMoMi
2025-03-13 15:52:31 +08:00
commit 29276e92cc
3956 changed files with 108711 additions and 0 deletions

View File

@@ -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;
}
}

View File

@@ -0,0 +1,8 @@
package net.momirealms.craftengine.shared.block;
import net.momirealms.craftengine.shared.ObjectHolder;
public interface BehaviorHolder {
ObjectHolder<BlockBehavior> getBehaviorHolder();
}

View File

@@ -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 {
}
}

View File

@@ -0,0 +1,6 @@
package net.momirealms.craftengine.shared.block;
public interface BlockShape {
Object getShape(Object thisObj, Object[] args) throws Exception;
}

View File

@@ -0,0 +1,5 @@
package net.momirealms.craftengine.shared.block;
public class EmptyBlockBehavior extends BlockBehavior {
public static final EmptyBlockBehavior INSTANCE = new EmptyBlockBehavior();
}

View File

@@ -0,0 +1,6 @@
package net.momirealms.craftengine.shared.block;
public interface NoteBlockIndicator {
boolean isNoteBlock();
}

View File

@@ -0,0 +1,8 @@
package net.momirealms.craftengine.shared.block;
import net.momirealms.craftengine.shared.ObjectHolder;
public interface ShapeHolder {
ObjectHolder<BlockShape> getShapeHolder();
}