-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
7 changed files
with
116 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#loader recipeevent crafttweaker | ||
#debug | ||
|
||
recipes.addShapeless(<minecraft:diamond> ,[<minecraft:diamond>]); |
1 change: 1 addition & 0 deletions
1
...mple/assets/extra_recipe/crt/test_item.zs → ...assets/extra_recipe/crt/test/test_item.zs
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,4 +1,5 @@ | ||
#priority 1 | ||
#debug | ||
#loader contenttweaker | ||
|
||
import mods.contenttweaker.VanillaFactory; | ||
|
This file was deleted.
Oops, something went wrong.
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
92 changes: 92 additions & 0 deletions
92
src/main/java/mods/Hileb/rml/compat/crt/RMLScriptProvider.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,92 @@ | ||
package mods.Hileb.rml.compat.crt; | ||
|
||
import crafttweaker.runtime.IScriptIterator; | ||
import crafttweaker.runtime.IScriptProvider; | ||
|
||
import java.io.BufferedInputStream; | ||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.ArrayList; | ||
import java.util.Iterator; | ||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* @Project ResourceModLoader | ||
* @Author Hileb | ||
* @Date 2024/3/16 20:49 | ||
**/ | ||
public class RMLScriptProvider implements IScriptProvider { | ||
private final List<CustomScript> scripts; | ||
|
||
public RMLScriptProvider() { | ||
scripts = new ArrayList<>(); | ||
} | ||
|
||
public void add(String name, byte[] content) { | ||
scripts.add(new CustomScript(name, content)); | ||
} | ||
|
||
@Override | ||
public Iterator<IScriptIterator> getScripts() { | ||
return scripts.stream().map(CustomScript::iterator).collect(Collectors.toSet()).iterator(); | ||
} | ||
|
||
private static class CustomScript { | ||
|
||
private final String name; | ||
private final byte[] content; | ||
|
||
public CustomScript(String name, byte[] content) { | ||
this.name = name; | ||
this.content = content; | ||
} | ||
|
||
public IScriptIterator iterator(){ | ||
return new ScriptIteratorSingle(name, content); | ||
} | ||
} | ||
|
||
static class ScriptIteratorSingle implements IScriptIterator { | ||
|
||
private final byte[] file; | ||
private final String name; | ||
private boolean first = true; | ||
|
||
ScriptIteratorSingle(String name, byte[] file) { | ||
this.file = file; | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String getGroupName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public boolean next() { | ||
if(first) { | ||
first = false; | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public InputStream open() throws IOException { | ||
return new BufferedInputStream(new ByteArrayInputStream(file)); | ||
} | ||
|
||
@Override | ||
public IScriptIterator copyCurrent() { | ||
return new ScriptIteratorSingle(name, file); | ||
} | ||
} | ||
} |
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