-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreaterune.py
67 lines (54 loc) · 1.91 KB
/
createrune.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import sys
rune_Path = "./src/main/java/xilef11/mc/runesofwizardry_classics/runes/Rune"
lang_file = "src/main/resources/assets/runesofwizardry_classics/lang/en_US.lang"
runes_file = "src/main/java/xilef11/mc/runesofwizardry_classics/ModRunes.java"
shortName = sys.argv[1]
locName = sys.argv[2]
clas = open(rune_Path+shortName+".java","w")
clas.write('''
package xilef11.mc.runesofwizardry_classics.runes;
import java.io.IOException;
import java.util.Set;
import xilef11.mc.runesofwizardry_classics.Refs;
import xilef11.mc.runesofwizardry_classics.runes.entity.RuneEntityUnimplemented;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3i;
import com.zpig333.runesofwizardry.api.RuneEntity;
import com.zpig333.runesofwizardry.core.rune.PatternUtils;
import com.zpig333.runesofwizardry.tileentity.TileEntityDustActive;
public class Rune'''+shortName+''' extends ClassicRune {
@Override
protected ItemStack[][] setupPattern() throws IOException {
return PatternUtils.importFromJson(Refs.PATTERN_PATH+"rune'''+shortName+'''.json");
}
@Override
protected Vec3i setupEntityPos() {
return new Vec3i(0,0,0);
}
@Override
protected ItemStack[][] setupSacrifice() {
return new ItemStack[][]{
{}
};
}
@Override
public String getName() {
return Refs.Lang.RUNE+".'''+shortName.lower()+'''";
}
@Override
public RuneEntity createRune(ItemStack[][] actualPattern, EnumFacing front,
Set<BlockPos> dusts, TileEntityDustActive entity) {
return new RuneEntityUnimplemented(actualPattern, front, dusts, entity, this);
}
}
''')
clas.close()
lang = open(lang_file,"a")
lang.write('runesofwizardry_classics.rune.'+shortName.lower()+'='+locName+'\n')
lang.close()
#Note: This will always append to the complete end of the file
runes = open(runes_file,"a")
runes.write(' DustRegistry.registerRune(new Rune'+shortName+'());\n')
runes.close()