Skip to content

Commit

Permalink
oops v0.8.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Devan-Kerman committed Jan 9, 2024
1 parent 3a68543 commit 7ea80db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ loader_version=0.14.21
fabric_version=0.84.0+1.20.1

# Mod Properties
mod_version=0.8.0
mod_version=0.8.1
maven_group=net.devtech
archives_base_name=arrp
# Dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public void dumpDirect(Path output) {
for(Map.Entry<List<String>, Supplier<byte[]>> e : this.root.entrySet()) {
String pathStr = String.join("/", e.getKey());
Path path = output.resolve(pathStr);
if(path.startsWith(output)) {
if(path.toAbsolutePath().startsWith(output.toAbsolutePath())) {
Files.createDirectories(path.getParent());
Files.write(path, e.getValue().get());
} else {
Expand Down Expand Up @@ -554,7 +554,7 @@ private void write(Path dir, Identifier identifier, byte[] data) {
String namespace = identifier.getNamespace();
String path = identifier.getPath();
Path file = dir.resolve(namespace).resolve(path);
if(file.startsWith(dir)) {
if(file.toAbsolutePath().startsWith(dir.toAbsolutePath())) {
Files.createDirectories(file.getParent());
try(OutputStream output = Files.newOutputStream(file)) {
output.write(data);
Expand Down
8 changes: 8 additions & 0 deletions src/test/java/test/RRPPreTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.devtech.arrp.api.RuntimeResourcePack;
import net.devtech.arrp.impl.RuntimeResourcePackImpl;
import net.devtech.arrp.json.blockstate.JMultipart;
import net.devtech.arrp.json.blockstate.JState;
Expand All @@ -27,9 +28,14 @@

import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import java.nio.file.Path;

public class RRPPreTest {
public static void main(String[] args) {
RuntimeResourcePack pack = RuntimeResourcePack.create("test:test");
pack.addLang(new Identifier("aaaa:aaaa"), new JLang().entry("aaaa", "bbbbb"));
pack.dumpDirect(Path.of("aaaa"));

JState iron_block = state(variant(JState.model("block/iron_block")));
JState oak_fence = state(multipart(JState.model("block/oak_fence_post")),
multipart(JState.model("block/oak_fence_side").uvlock()).when(when().add("north", "true")),
Expand All @@ -47,6 +53,8 @@ public static void main(String[] args) {
.west(face("all").uv(9, 0, 11, 16))
.east(face("all").uv(9, 0, 11, 16))));



Gson gson = new GsonBuilder().registerTypeAdapter(JMultipart.class, new JMultipart.Serializer())
.registerTypeAdapter(JWhen.class, new JWhen.Serializer())
.registerTypeAdapter(JState.class, new JState.Serializer())
Expand Down

0 comments on commit 7ea80db

Please # to comment.