9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-28 11:29:17 +00:00

Release 0.0.10

This commit is contained in:
XiaoMoMi
2025-02-11 22:56:41 +08:00
parent ee8ea4c091
commit 0f2c2d4859
3762 changed files with 92819 additions and 1 deletions

24
shared/build.gradle.kts Normal file
View File

@@ -0,0 +1,24 @@
plugins {
id("java-library")
}
repositories {
mavenCentral()
}
dependencies {
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
options.release.set(21)
dependsOn(tasks.clean)
}

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,38 @@
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();
}
}

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();
}