-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathPaintUtils.java.superzanti
More file actions
106 lines (94 loc) · 2.71 KB
/
PaintUtils.java.superzanti
File metadata and controls
106 lines (94 loc) · 2.71 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package openmods.utils.render;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import openmods.Mods;
import com.google.common.collect.Sets;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
public class PaintUtils {
private final Set<Block> allowed = Sets.newHashSet();
public static final PaintUtils instance = new PaintUtils();
protected PaintUtils() {
allowed.add(Blocks.stone);
allowed.add(Blocks.cobblestone);
allowed.add(Blocks.mossy_cobblestone);
allowed.add(Blocks.sandstone);
allowed.add(Blocks.iron_block);
allowed.add(Blocks.stonebrick);
allowed.add(Blocks.glass);
allowed.add(Blocks.planks);
allowed.add(Blocks.dirt);
allowed.add(Blocks.log);
allowed.add(Blocks.log2);
allowed.add(Blocks.gold_block);
allowed.add(Blocks.emerald_block);
allowed.add(Blocks.lapis_block);
allowed.add(Blocks.quartz_block);
allowed.add(Blocks.end_stone);
allowed.add(Blocks.leaves);
allowed.add(Blocks.leaves2);
if (Loader.isModLoaded(Mods.TINKERSCONSTRUCT)) {
addBlocksForMod(Mods.TINKERSCONSTRUCT,
"GlassBlock",
"decoration.multibrick",
"decoration.multibrickfancy",
"leaves");
}
if (Loader.isModLoaded(Mods.EXTRAUTILITIES)) {
addBlocksForMod(Mods.EXTRAUTILITIES,
"greenScreen",
"extrautils:decor");
}
if (Loader.isModLoaded(Mods.BIOMESOPLENTY)) {
addBlocksForMod(Mods.BIOMESOPLENTY,
"bop.planks",
"appleLeaves",
"persimmonLeaves",
"leaves1",
"leaves2",
"leaves3",
"leaves4",
"colorizedLeaves1",
"colorizedLeaves2");
}
if (Loader.isModLoaded("Natura")) {
addBlocksForMod("Natura",
"floraleaves",
"floraleavesnocolor",
"Dark Leaves",
"Rare Leaves");
}
if (Loader.isModLoaded("TwilightForest")) {
addBlocksForMod("TwilightForest",
"TFLeaves",
"TFMagicLeaves",
"TFLeaves3",
"DarkLeaves",
"GiantLeaves");
}
if (Loader.isModLoaded("chisel")) {
addBlocksForMod("chisel",
"leaves");
}
if (Loader.isModLoaded("IC2")) {
addBlocksForMod("IC2",
"blockRubLeaves");
}
}
protected void addBlocksForMod(String modId, String... blocks) {
for (String blockName : blocks) {
Block block = GameRegistry.findBlock(modId, blockName);
if (block != null) allowed.add(block);
}
}
public boolean isAllowedToReplace(Block block) {
if (block == null || block.canProvidePower()) return false;
return block.isNormalCube() || allowed.contains(block) || block.getRenderType() == 0 ;
}
public boolean isAllowedToReplace(World world, int x, int y, int z) {
if (world.isAirBlock(x, y, z)) { return false; }
return isAllowedToReplace(world.getBlock(x, y, z));
}
}