Skip to content

Commit ae6af3d

Browse files
author
ShadowFox
committed
Painting the town: Adding Paintslinger API support
1 parent 8bc9f81 commit ae6af3d

File tree

4 files changed

+48
-12
lines changed

4 files changed

+48
-12
lines changed

.gitignore

+28
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,31 @@ Thumbs.db
3131
*.jar
3232
!/gradle/wrapper/gradle-wrapper.jar
3333
!GardenOfGlass.jar
34+
35+
### OSX (adds a lot of garbage)###
36+
.DS_Store
37+
.AppleDouble
38+
.LSOverride
39+
40+
# Icon must end with two \r
41+
Icon
42+
43+
44+
# Thumbnails
45+
._*
46+
47+
# Files that might appear in the root of a volume
48+
.DocumentRevisions-V100
49+
.fseventsd
50+
.Spotlight-V100
51+
.TemporaryItems
52+
.Trashes
53+
.VolumeIcon.icns
54+
55+
# Directories potentially created on remote AFP share
56+
.AppleDB
57+
.AppleDesktop
58+
Network Trash Folder
59+
Temporary Items
60+
.apdisk
61+

src/main/java/vazkii/botania/api/BotaniaAPI.java

+15
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public final class BotaniaAPI {
8484
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
8585
public static Map<Item, Block> seeds = new HashMap();
8686
public static Set<Item> looniumBlacklist = new LinkedHashSet();
87+
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
8788

8889
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
8990
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
@@ -228,6 +229,12 @@ public final class BotaniaAPI {
228229
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
229230
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
230231
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
232+
233+
registerPaintableBlock(Blocks.stained_glass);
234+
registerPaintableBlock(Blocks.stained_glass_pane);
235+
registerPaintableBlock(Blocks.stained_hardened_clay);
236+
registerPaintableBlock(Blocks.wool);
237+
registerPaintableBlock(Blocks.carpet);
231238
}
232239

233240
/**
@@ -267,6 +274,14 @@ public static Brew getBrewFromKey(String key) {
267274
return fallbackBrew;
268275
}
269276

277+
/**
278+
* Registers a paintableBlock and returns it.
279+
*/
280+
public static Block registerPaintableBlock(Block paintable){
281+
paintableBlocks.add(paintable);
282+
return paintable;
283+
}
284+
270285
/**
271286
* Registers a Petal Recipe.
272287
* @param output The ItemStack to craft.

src/main/java/vazkii/botania/common/block/ModBlocks.java

+3
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,9 @@ public static void init() {
392392
OreDictionary.registerOre("chestWood", Blocks.chest);
393393
OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table);
394394

395+
BotaniaAPI.registerPaintableBlock(unstableBlock);
396+
BotaniaAPI.registerPaintableBlock(manaBeacon);
397+
395398
initTileEntities();
396399
}
397400

src/main/java/vazkii/botania/common/item/lens/LensPaint.java

+2-12
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,13 @@
2222
import net.minecraft.util.ChunkCoordinates;
2323
import net.minecraft.util.MovingObjectPosition;
2424
import net.minecraftforge.common.util.ForgeDirection;
25+
import vazkii.botania.api.BotaniaAPI;
2526
import vazkii.botania.api.internal.IManaBurst;
2627
import vazkii.botania.common.Botania;
2728
import vazkii.botania.common.block.ModBlocks;
2829

2930
public class LensPaint extends Lens {
3031

31-
static final List<Block> paintableBlocks = new ArrayList() {{
32-
add(Blocks.stained_glass);
33-
add(Blocks.stained_glass_pane);
34-
add(Blocks.stained_hardened_clay);
35-
add(Blocks.wool);
36-
add(Blocks.carpet);
37-
add(ModBlocks.unstableBlock);
38-
add(ModBlocks.manaBeacon);
39-
}
40-
};
41-
4232
@Override
4333
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
4434
int storedColor = ItemLens.getStoredColor(stack);
@@ -54,7 +44,7 @@ public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObje
5444
dead = true;
5545
} else {
5646
Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
57-
if(paintableBlocks.contains(block)) {
47+
if(BotaniaAPI.paintableBlocks.contains(block)) {
5848
int meta = entity.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ);
5949
List<ChunkCoordinates> coordsToPaint = new ArrayList();
6050
List<ChunkCoordinates> coordsFound = new ArrayList();

0 commit comments

Comments
 (0)