-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3528aec
commit 41e6be6
Showing
56 changed files
with
468 additions
and
785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
blockentity/common/src/main/java/band/kessoku/lib/api/blockentity/BlockEntityAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package band.kessoku.lib.api.blockentity; | ||
|
||
public class BlockEntityAccess { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
blockentity/common/src/main/java/band/kessoku/lib/api/blockentity/KessokuBlockEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package band.kessoku.lib.api.blockentity; | ||
|
||
import org.slf4j.Marker; | ||
import org.slf4j.MarkerFactory; | ||
|
||
public class KessokuBlockEntity { | ||
public static final String MOD_ID = "kessoku_blockentity"; | ||
public static final String NAME = "Kessoku Block Entity API"; | ||
public static final Marker MARKER = MarkerFactory.getMarker("[" + NAME +"]"); | ||
} |
8 changes: 8 additions & 0 deletions
8
blockentity/common/src/main/resources/kessoku_blockentity.mixins.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"required": true, | ||
"package": "band.kessoku.lib.mixin.blockentity", | ||
"compatibilityLevel": "JAVA_21", | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
apply from: rootProject.file("gradle/scripts/klib-common.gradle") | ||
|
||
base.archivesName = rootProject.name + "-component" | ||
|
||
kessoku { | ||
module("base", "common") | ||
module("registry", "common") | ||
module("data", "common") | ||
} | ||
|
27 changes: 27 additions & 0 deletions
27
component/common/src/main/java/band/kessoku/lib/api/component/KessokuComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package band.kessoku.lib.api.component; | ||
|
||
import band.kessoku.lib.api.registry.KessokuRegistry; | ||
import band.kessoku.lib.impl.Progress; | ||
import net.minecraft.component.ComponentType; | ||
import net.minecraft.util.Identifier; | ||
import org.slf4j.Marker; | ||
import org.slf4j.MarkerFactory; | ||
|
||
public class KessokuComponent { | ||
public static final String MOD_ID = "kessoku_component"; | ||
public static final String NAME = "Kessoku Component API"; | ||
public static final Marker MARKER = MarkerFactory.getMarker("[" + NAME +"]"); | ||
|
||
public static final ComponentType<Progress> PROGRESS_COMPONENT_TYPE; | ||
|
||
public static void init() { | ||
|
||
} | ||
|
||
static { | ||
PROGRESS_COMPONENT_TYPE = KessokuRegistry.registerComponentType( | ||
Identifier.of("kessoku", "progress"), | ||
builder -> builder.codec(Progress.CODEC).packetCodec(Progress.PACKET_CODEC) | ||
); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import net.fabricmc.loom.util.ModPlatform | ||
|
||
apply from: rootProject.file("gradle/scripts/klib-fabric.gradle") | ||
|
||
base.archivesName = rootProject.name + "-component" | ||
|
||
kessoku { | ||
module("base", "common") | ||
|
||
common("component", ModPlatform.FABRIC) | ||
shadowBundle("component", ModPlatform.FABRIC) | ||
} |
13 changes: 13 additions & 0 deletions
13
...t/fabric/src/main/java/band/kessoku/lib/impl/component/fabric/KessokuComponentFabric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package band.kessoku.lib.impl.component.fabric; | ||
|
||
import band.kessoku.lib.api.KessokuLib; | ||
import band.kessoku.lib.api.component.KessokuComponent; | ||
import net.fabricmc.api.ModInitializer; | ||
|
||
public class KessokuComponentFabric implements ModInitializer { | ||
@Override | ||
public void onInitialize() { | ||
KessokuLib.loadModule(KessokuComponent.class); | ||
KessokuComponent.init(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"schemaVersion": 1, | ||
"id": "kessoku_data", | ||
"version": "${version}", | ||
"name": "Kessoku Component", | ||
"description": "A API about component in Minecraft.", | ||
"authors": [ | ||
"Kessoku Tea Time" | ||
], | ||
"contact": { | ||
"homepage": "https://modrinth.com/mod/kessoku-lib", | ||
"sources": "https://github.com/KessokuTeaTime/KessokuLib", | ||
"issues": "https://github.com/KessokuTeaTime/KessokuLib/issues" | ||
}, | ||
"license": "LGPL-3.0-only", | ||
"icon": "icon.png", | ||
"entrypoints": { | ||
"main": [ | ||
"band.kessoku.lib.impl.component.fabric.KessokuComponentFabric" | ||
] | ||
}, | ||
"environment": "*", | ||
"depends": { | ||
"fabricloader": ">=0.16.0", | ||
"minecraft": "1.21", | ||
"java": ">=21", | ||
"fabric-api": "*" | ||
}, | ||
"custom": { | ||
"modmenu": { | ||
"badges": [ | ||
"library" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import net.fabricmc.loom.util.ModPlatform | ||
|
||
apply from: rootProject.file("gradle/scripts/klib-neo.gradle") | ||
|
||
base.archivesName = rootProject.name + "-component" | ||
|
||
kessoku { | ||
module("base", "common") | ||
|
||
common("component", ModPlatform.NEOFORGE) | ||
shadowBundle("component", ModPlatform.NEOFORGE) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
loom.platform=neoforge |
13 changes: 13 additions & 0 deletions
13
component/neo/src/main/java/band/kessoku/lib/impl/component/forge/KessokuComponentForge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package band.kessoku.lib.impl.component.forge; | ||
|
||
import band.kessoku.lib.api.KessokuLib; | ||
import band.kessoku.lib.api.component.KessokuComponent; | ||
import net.neoforged.fml.common.Mod; | ||
|
||
@Mod(KessokuComponent.MOD_ID) | ||
public class KessokuComponentForge { | ||
public KessokuComponentForge() { | ||
KessokuLib.loadModule(KessokuComponent.class); | ||
KessokuComponent.init(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
component/neo/src/main/resources/META-INF/neoforge.mods.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
modLoader = "javafml" | ||
loaderVersion = "[4,)" | ||
license = "LGPL-3.0-only" | ||
issueTrackerURL = "https://github.com/KessokuTeaTime/KessokuLib/issues" | ||
|
||
[[mods]] | ||
modId = "kessoku_data" | ||
version = "${version}" | ||
displayName = "Kessoku Data" | ||
description = ''' | ||
A API about component in Minecraft. | ||
''' | ||
logoFile = "icon.png" | ||
authors = "Kessoku Tea Time" | ||
displayURL = "https://modrinth.com/mod/kessoku-lib" | ||
|
||
[[dependencies.kessoku_data]] | ||
modId = "neoforge" | ||
type = "required" | ||
versionRange = "[21.0,)" | ||
ordering = "NONE" | ||
side = "BOTH" | ||
|
||
[[dependencies.kessoku_data]] | ||
modId = "minecraft" | ||
type = "required" | ||
versionRange = "[1.21,)" | ||
ordering = "NONE" | ||
side = "BOTH" |
6 changes: 6 additions & 0 deletions
6
data/common/src/main/java/band/kessoku/lib/api/data/DataAccess.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package band.kessoku.lib.api.data; | ||
|
||
@FunctionalInterface | ||
public interface DataAccess<T, S extends DataStructure> { | ||
S get(T target); | ||
} |
25 changes: 1 addition & 24 deletions
25
data/common/src/main/java/band/kessoku/lib/api/data/DataStructure.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,5 @@ | ||
/* | ||
* Copyright (c) 2024 KessokuTeaTime | ||
* | ||
* Licensed under the GNU Lesser General Pubic License, Version 3 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.gnu.org/licenses/lgpl-3.0.html | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package band.kessoku.lib.api.data; | ||
|
||
/** | ||
* This is an interface used to abstract a structure holding some data and implement processing logic. | ||
* <p> | ||
* When building structure, data must be member variable and {@link DataStructure#integrate(Data) "integrate()"} | ||
* can be used to hold data for other usages. | ||
* </p> | ||
*/ | ||
public interface DataStructure { | ||
<T, K extends Data<T>> K integrate(K data); | ||
<K extends DataStructure> K integrate(K dataStructure); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
data/common/src/main/java/band/kessoku/lib/impl/Progress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package band.kessoku.lib.impl; | ||
|
||
import band.kessoku.lib.api.data.DataStructure; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import net.minecraft.network.RegistryByteBuf; | ||
import net.minecraft.network.codec.PacketCodec; | ||
|
||
public class Progress implements DataStructure { | ||
public static final Codec<Progress> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
Codec.INT.fieldOf("time").forGetter(Progress::time), | ||
Codec.INT.fieldOf("totalTime").forGetter(Progress::totalTime) | ||
).apply(instance, Progress::new)); | ||
public static final PacketCodec<RegistryByteBuf, Progress> PACKET_CODEC = new PacketCodec<>() { | ||
@Override | ||
public Progress decode(RegistryByteBuf buf) { | ||
return new Progress(buf.readInt(), buf.readInt()); | ||
} | ||
|
||
@Override | ||
public void encode(RegistryByteBuf buf, Progress value) { | ||
buf.writeInt(value.time()); | ||
buf.writeInt(value.totalTime()); | ||
} | ||
}; | ||
|
||
private int time = 0; | ||
private int totalTime; | ||
|
||
private Progress(int time, int totalTime) { | ||
this.time = time; | ||
this.totalTime = totalTime; | ||
|
||
} | ||
|
||
public Progress(int totalTime) { | ||
this.totalTime = totalTime; | ||
} | ||
|
||
public void process() { | ||
process(1); | ||
} | ||
|
||
public void process(int time) { | ||
this.time += time; | ||
} | ||
|
||
public void reset(int totalTime) { | ||
this.time = 0; | ||
this.totalTime = totalTime; | ||
} | ||
|
||
public int time() { | ||
return this.time; | ||
} | ||
|
||
public int totalTime() { | ||
return this.totalTime; | ||
} | ||
|
||
public float decimal() { | ||
if (totalTime == 0) | ||
return 0.0f; | ||
return ((float) time) / totalTime; | ||
} | ||
} |
Oops, something went wrong.