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:
24
shared/build.gradle.kts
Normal file
24
shared/build.gradle.kts
Normal 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)
|
||||
}
|
||||
@@ -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,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();
|
||||
}
|
||||
}
|
||||
@@ -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