forked from friendlyhj/GrassUtils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCotUtils.zs
More file actions
87 lines (80 loc) · 3.26 KB
/
CotUtils.zs
File metadata and controls
87 lines (80 loc) · 3.26 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#loader contenttweaker
#priority 30000
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;
import mods.contenttweaker.Item;
import mods.contenttweaker.CreativeTab;
import mods.contenttweaker.Fluid;
import mods.contenttweaker.Color;
import mods.contenttweaker.BlockMaterial;
import mods.contenttweaker.SoundType;
import mods.contenttweaker.SoundEvent;
import crafttweaker.creativetabs.ICreativeTab;
import scripts.grassUtils.StringHelperCot as StringHelper;
import scripts.grassUtils.classes.MaterialSystemHelper.MaterialSystemHelper;
import scripts.grassUtils.LoggerCot as Logger;
static enumRarityLevel as string[] = ["COMMON", "UNCOMMON", "RARE", "EPIC"];
static tab as CreativeTab = null;
function addNormalItem(name as string) {
Logger.sendInfo("Adding item " ~ name);
var itemt as Item = VanillaFactory.createItem(name);
if (!isNull(tab)){
itemt.creativeTab = tab;
}
itemt.register();
}
function addRareItem(name as string, glow as bool, rarityLevel as int) {
Logger.sendInfo("Adding rare item " ~ name);
var itemt as Item = VanillaFactory.createItem(name);
itemt.glowing = glow;
itemt.rarity = enumRarityLevel[rarityLevel];
if (!isNull(tab)){
itemt.creativeTab = tab;
}
itemt.register();
}
function addFluid(name as string,color as int,temperature as int,viscosity as int,density as int,luminosity as int,isLava as bool){
Logger.sendInfo("Adding fluid " ~ name);
var fluidt as Fluid = VanillaFactory.createFluid(name, color);
fluidt.temperature = temperature; //default 300
fluidt.viscosity = viscosity; //default 1000
fluidt.density = density; //default 1000
fluidt.luminosity = luminosity; //default 0
if (isLava) {
fluidt.material = <blockmaterial:lava>;
fluidt.stillLocation = "base:fluids/molten";
fluidt.flowingLocation = "base:fluids/molten_flowing";
} else {
fluidt.material = <blockmaterial:water>;
fluidt.stillLocation = "base:fluids/liquid";
fluidt.flowingLocation = "base:fluids/liquid_flow";
}
fluidt.register();
}
function addBlock(name as string,blockMaterial as BlockMaterial,hardness as float,resistance as float,blockSoundType as SoundType,lightValue as int,gravity as bool,toolClass as string,toolLevel as int){
Logger.sendInfo("Adding block " ~ name);
var blockt as Block = VanillaFactory.createBlock(name,blockMaterial);
blockt.setBlockHardness(hardness);
blockt.setBlockResistance(resistance);
blockt.setBlockSoundType(blockSoundType);
blockt.setLightValue(lightValue);
blockt.gravity = gravity;
blockt.setToolClass(toolClass);
blockt.setToolLevel(toolLevel);
if (!isNull(tab)){
blockt.creativeTab = tab;
}
blockt.register();
}
function addCreativeTabAndNormalItem(creativeTabID as string, itemID as string) {
Logger.sendInfo("Adding creative tab " ~ creativeTabID ~ " with item " ~ itemID);
var item as Item = VanillaFactory.createItem(itemID);
var creativetab as CreativeTab = VanillaFactory.createCreativeTab(creativeTabID, item);
creativetab.register();
item.creativeTab = creativetab;
item.register();
tab = creativetab;
}
function getMaterialSystemHelper(id as string) as MaterialSystemHelper {
return MaterialSystemHelper(id);
}