Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build

on:
push:
branches:
- '**'
tags-ignore:
- 'v*'
pull_request:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Build
run: ./gradlew clean build
- name: Upload NeoForge jars
uses: actions/upload-artifact@v4
with:
name: neoforge-jars
path: "**/build/libs/*.jar"
24 changes: 24 additions & 0 deletions .github/workflows/publish_github_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Publish GitHub Packages

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Publish to GitHub Packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish
13 changes: 13 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Target: NeoForge 1.21.1

Java: 21

Goal: ./gradlew build succeeds

Keep behavior identical unless required for compatibility

Prefer minimal diffs; don’t reformat everything

After build passes, run a client dev run if available (runClient / runGameTestServer depending on setup)

If the project is Architectury multi-loader: keep common logic shared; put loader specifics in the NeoForge module
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,30 @@ Felnull integration mod library.
[CurseForge](https://www.curseforge.com/minecraft/mc-mods/otyacraft-engine)
[Modrinth](https://modrinth.com/mod/otyacraft-engine)

# Maven coordinates

Group: `dev.felnull`
Artifact: `otyacraftengine` (common), `otyacraftengine-fabric`, `otyacraftengine-forge`
Version: see tags/releases

GitHub Packages (Maven): `https://maven.pkg.github.com/TeamFelnull/OtyacraftEngine`

```gradle
repositories {
maven {
url = uri("https://maven.pkg.github.com/TeamFelnull/OtyacraftEngine")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
```

# Using libraries

The following libraries are used for this mod,
but they are included in the mod's jar file and do not need to be installed separately.

[Animated GIF library for Java](https://github.com/rtyley/animated-gif-lib-for-java)
[Felnull Java library](https://github.com/TeamFelnull/FelNullJavaLibrary)
[Felnull Java library](https://github.com/TeamFelnull/FelNullJavaLibrary)
12 changes: 9 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.1-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id 'org.jetbrains.changelog' version "2.0.0"
}

Expand Down Expand Up @@ -41,12 +41,18 @@ allprojects {
group = rootProject.maven_group

repositories {

mavenCentral()
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.neoforged.net/releases" }
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
maven { url "https://maven.felnull.dev/" }
}

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 17
options.release = 21
}

java {
Expand Down
10 changes: 9 additions & 1 deletion common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,13 @@ publishing {
password = "${project.maven_put_pass}" != '' ? "${project.maven_put_pass}" : System.getenv('mavenpassword')
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/TeamFelnull/OtyacraftEngine"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.jetbrains.annotations.NotNull;

public class ModInvolvementTrigger extends SimpleCriterionTrigger<ModInvolvementTrigger.TriggerInstance> {
static final ResourceLocation ID = new ResourceLocation(OtyacraftEngine.MODID, "mod_involvement");
static final ResourceLocation ID = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "mod_involvement");

@Override
public ResourceLocation getId() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void clear() {
private Function<String, ResourceLocation> createSkinTextureLocationCache() {
return FNDataUtil.memoize(url -> {
String hashStr = Hashing.sha1().hashUnencodedChars(FilenameUtils.getBaseName(url)).toString();
return new ResourceLocation("skins/" + hashStr);
return ResourceLocation.parse("skins/" + hashStr);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


public interface OEBaseComponent extends OEBaseGUI {
ResourceLocation OE_WIDGETS = new ResourceLocation(OtyacraftEngine.MODID, "textures/gui/widgets.png");
ResourceLocation OE_WIDGETS = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "textures/gui/widgets.png");

@NotNull
TextureRegion getTexture();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected ClientIVShapeLoader(@NotNull ResourceManager resourceManager, @NotNull
var p = location.getPath();
var vs = VoxelClientShape.parse(jo);
if (vs != null)
builder.put(new ResourceLocation(location.getNamespace(), p.substring("voxel_shape/".length(), p.length() - ".json".length())), vs);
builder.put(ResourceLocation.fromNamespaceAndPath(location.getNamespace(), p.substring("voxel_shape/".length(), p.length() - ".json".length())), vs);
} catch (Exception e) {
LOGGER.error("Error occurred while loading shape resource json " + location, e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

public class ClientIVShapeManager extends PlatformResourceReloadListener<ClientIVShapeLoader> {
private static final ClientIVShapeManager INSTANCE = new ClientIVShapeManager();
private static final ResourceLocation VOXEL_SHAPE = new ResourceLocation(OtyacraftEngine.MODID, "voxel_shape");
private static final ResourceLocation VOXEL_SHAPE = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "voxel_shape");
private Map<ResourceLocation, VoxelClientShape> voxelClientShapes;
private Map<ResourceLocation, VoxelClientShape> legacyVoxelClientShapes = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public final class OETextureUtils {
private static final Minecraft mc = Minecraft.getInstance();
private static final ResourceLocation ERROR_ICON = new ResourceLocation(OtyacraftEngine.MODID, "textures/gui/error_icon.png");
private static final ResourceLocation ERROR_ICON = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "textures/gui/error_icon.png");
private static ResourceLocation LOADING_ICON;

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ public static TextureLoadResult getAndLoadURLTextureAsync(@NotNull String url, b
public static ResourceLocation getLoadingIcon() {
if (LOADING_ICON == null) {
ResourceManager rm = mc.getResourceManager();
var r = rm.getResource(new ResourceLocation(OtyacraftEngine.MODID, "textures/gui/loading_icon.gif"));
var r = rm.getResource(ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "textures/gui/loading_icon.gif"));
if (r.isPresent()) {
try (var st = r.get().open()) {
var ret = getAndLoadNativeTexture(UUID.randomUUID(), st);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ default FileModel particleOnlyModel(@NotNull Block block, @NotNull ResourceLocat
* @param block ブロック
*/
default void builtinEntityBlockItemModel(@NotNull Block block) {
parentedBlockItemModel(block, new ResourceLocation("builtin/entity"));
parentedBlockItemModel(block, ResourceLocation.parse("builtin/entity"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ default MutableFileModel handheldFlatItem(@NotNull ResourceLocation itemLocation
*/
@NotNull
default MutableFileModel builtinEntityItem(@NotNull Item item) {
return parentedItem(item, new ResourceLocation("builtin/entity"));
return parentedItem(item, ResourceLocation.parse("builtin/entity"));
}

/**
Expand All @@ -129,7 +129,7 @@ default MutableFileModel builtinEntityItem(@NotNull Item item) {
*/
@NotNull
default MutableFileModel builtinEntityItem(@NotNull ResourceLocation itemLocation) {
return parentedItem(itemLocation, new ResourceLocation("builtin/entity"));
return parentedItem(itemLocation, ResourceLocation.parse("builtin/entity"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import net.minecraft.world.level.block.state.properties.BooleanProperty;

public abstract class BlockStateAndModelProviderWrapper extends DataProviderWrapper<DataProvider> {
public static final ResourceLocation OE_BASE_BLOCK_ENTITY_MODEL = new ResourceLocation(OtyacraftEngine.MODID, "base/block_entity");
public static final ResourceLocation OE_BASE_BLOCK_ENTITY_APPEARANCE_MODEL = new ResourceLocation(OtyacraftEngine.MODID, "base/block_entity_appearance");
public static final ResourceLocation OE_BASE_BLOCK_ENTITY_MODEL = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "base/block_entity");
public static final ResourceLocation OE_BASE_BLOCK_ENTITY_APPEARANCE_MODEL = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "base/block_entity_appearance");
private final DataProvider blockStateAndModelProvider;

public BlockStateAndModelProviderWrapper(PackOutput packOutput, CrossDataGeneratorAccess crossDataGeneratorAccess) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public interface DataProviderWrapperBase {
CrossDataGeneratorAccess getCrossGeneratorAccess();

default ResourceLocation modLoc(String id) {
return new ResourceLocation(getCrossGeneratorAccess().getMod().getModId(), id);
return ResourceLocation.fromNamespaceAndPath(getCrossGeneratorAccess().getMod().getModId(), id);
}

default DataGenerator getGenerator() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ protected Pair<ResourceLocation, String> toResourceLocationAndExtension(Path inp
}
}

return Pair.of(new ResourceLocation(relativePath.getName(1).toFile().getName(), sb.toString()), ex);
return Pair.of(ResourceLocation.fromNamespaceAndPath(relativePath.getName(1).toFile().getName(), sb.toString()), ex);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public List<ModelProcessProviderWrapper.ModelData> process(CachedOutput cachedOu
var p = modelData.location().getPath();
var ps = p.split("/");
ps[ps.length - 1] = n.getKey();
return new ModelProcessProviderWrapper.ModelData(new ResourceLocation(modelData.location().getNamespace(), String.join("/", ps)), n.getValue());
return new ModelProcessProviderWrapper.ModelData(ResourceLocation.fromNamespaceAndPath(modelData.location().getNamespace(), String.join("/", ps)), n.getValue());
}).toList();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class PlayerItemLocations {
public static final HandItemLocationFactory HAND_ITEM = new HandItemLocationFactory();

public static void init() {
register(new ResourceLocation(OtyacraftEngine.MODID, "hand"), HAND_ITEM);
register(ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "hand"), HAND_ITEM);
}

private static void register(ResourceLocation location, PlayerItemLocationFactory<? extends PlayerItemLocation> factory) {
Expand All @@ -35,7 +35,7 @@ public static CompoundTag saveToTag(PlayerItemLocation location) {
}

public static PlayerItemLocation loadFromTag(CompoundTag tag) {
var rl = new ResourceLocation(tag.getString("id"));
var rl = ResourceLocation.parse(tag.getString("id"));
var factory = FACTORS.get(rl);
if (factory == null)
throw new IllegalArgumentException("Unregistered player item location");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
import java.util.UUID;

public class OEPackets {
public static final ResourceLocation BLOCK_ENTITY_INSTRUCTION = new ResourceLocation(OtyacraftEngine.MODID, "block_entity_instruction");
public static final ResourceLocation BLOCK_ENTITY_INSTRUCTION_RETURN = new ResourceLocation(OtyacraftEngine.MODID, "block_entity_instruction_return");
public static final ResourceLocation ITEM_INSTRUCTION = new ResourceLocation(OtyacraftEngine.MODID, "item_instruction");
public static final ResourceLocation ITEM_INSTRUCTION_RETURN = new ResourceLocation(OtyacraftEngine.MODID, "item_instruction_return");
public static final ResourceLocation BLOCK_ENTITY_INSTRUCTION = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "block_entity_instruction");
public static final ResourceLocation BLOCK_ENTITY_INSTRUCTION_RETURN = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "block_entity_instruction_return");
public static final ResourceLocation ITEM_INSTRUCTION = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "item_instruction");
public static final ResourceLocation ITEM_INSTRUCTION_RETURN = ResourceLocation.fromNamespaceAndPath(OtyacraftEngine.MODID, "item_instruction_return");

public static void init() {
NetworkManager.registerReceiver(NetworkManager.c2s(), BLOCK_ENTITY_INSTRUCTION, (friendlyByteBuf, packetContext) -> ServerMessageHandler.onBlockEntityInstructionMessage(new BlockEntityInstructionMessage(friendlyByteBuf), packetContext));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private VoxelShape getShapeFromJsonV3(JsonObject shapeJ, ResourceLocation locati
ResourceLocation relocation;
if (shapeJ.has("render_edges") && shapeJ.get("render_edges").isJsonPrimitive()) {
var reloc = shapeJ.get("render_edges").getAsString();
relocation = new ResourceLocation(reloc);
relocation = ResourceLocation.parse(reloc);
} else {
relocation = location;
}
Expand Down
12 changes: 10 additions & 2 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ publishing {
password = "${project.maven_put_pass}" != '' ? "${project.maven_put_pass}" : System.getenv('mavenpassword')
}
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/TeamFelnull/OtyacraftEngine"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

Expand All @@ -141,7 +149,7 @@ curseforge {

releaseType = "${rootProject.release_type}"
addGameVersion "${rootProject.minecraft_version}"
addGameVersion 'Java 17'
addGameVersion 'Java 21'
addGameVersion "Fabric"
addGameVersion "Quilt"

Expand Down Expand Up @@ -189,4 +197,4 @@ if (System.getenv('modrinthapikey') != null && "${modrinth_id}" != '') {
}
changelog = file('../LATEST_CHANGELOG.md').text
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,11 @@ private FileModel of(ResourceLocation location) {
}

private ResourceLocation blockLoc(ResourceLocation loc) {
return new ResourceLocation(loc.getNamespace(), "block/" + loc.getPath());
return ResourceLocation.fromNamespaceAndPath(loc.getNamespace(), "block/" + loc.getPath());
}

private ResourceLocation blockLoc(String name) {
return new ResourceLocation(crossDataGeneratorAccess.getMod().getModId(), "block/" + name);
return ResourceLocation.fromNamespaceAndPath(crossDataGeneratorAccess.getMod().getModId(), "block/" + name);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ private MutableFileModelImpl createModel(ModelTemplate modelTemplate, TextureMap
}

private static ResourceLocation decorateItemModelLocation(ResourceLocation location) {
return new ResourceLocation(location.getNamespace(), "item/" + location.getPath());
return ResourceLocation.fromNamespaceAndPath(location.getNamespace(), "item/" + location.getPath());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ private static Supplier<TagKey<Item>> bind(String id) {
}

private static ResourceLocation cLoc(String path) {
return new ResourceLocation("c", path);
return ResourceLocation.fromNamespaceAndPath("c", path);
}

private static ResourceLocation[] drinks() {
Expand Down
8 changes: 4 additions & 4 deletions fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
],
"depends": {
"fabric": "*",
"minecraft": ">=1.20",
"architectury": ">=9.0.8",
"cloth-config2": ">=11.0.99"
"minecraft": ">=1.21.1",
"architectury": ">=13.0.6",
"cloth-config2": ">=15.0.128"
},
"custom": {
"modmenu": {
Expand All @@ -44,4 +44,4 @@
]
}
}
}
}
Loading