Merge pull request #1464 from L0neKitsune/master

Painting the town:  Adding Paintslinger API support
This commit is contained in:
Vasco Lavos committed 2015-10-23 14:27:30 +02:00
commit 4286dd5222
4 files changed
+48 -12

No files matched your search

@@ -84,6 +84,7 @@ public final class BotaniaAPI {
public static Map<String, Integer> oreWeightsNether = new HashMap<String, Integer>();
public static Map<Item, Block> seeds = new HashMap();
public static Set<Item> looniumBlacklist = new LinkedHashSet();
public static Set<Block> paintableBlocks = new LinkedHashSet<Block>();
public static ArmorMaterial manasteelArmorMaterial = EnumHelper.addArmorMaterial("MANASTEEL", 16, new int[] { 2, 6, 5, 2 }, 18);
public static ToolMaterial manasteelToolMaterial = EnumHelper.addToolMaterial("MANASTEEL", 3, 300, 6.2F, 2F, 20);
@@ -228,6 +229,12 @@ public final class BotaniaAPI {
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
registerPaintableBlock(Blocks.stained_glass);
registerPaintableBlock(Blocks.stained_glass_pane);
registerPaintableBlock(Blocks.stained_hardened_clay);
registerPaintableBlock(Blocks.wool);
registerPaintableBlock(Blocks.carpet);
}
/**
@@ -267,6 +274,14 @@ public final class BotaniaAPI {
return fallbackBrew;
}
/**
* Registers a paintableBlock and returns it.
*/
public static Block registerPaintableBlock(Block paintable){
paintableBlocks.add(paintable);
return paintable;
}
/**
* Registers a Petal Recipe.
* @param output The ItemStack to craft.
@@ -392,6 +392,9 @@ public final class ModBlocks {
OreDictionary.registerOre("chestWood", Blocks.chest);
OreDictionary.registerOre("craftingTableWood", Blocks.crafting_table);
BotaniaAPI.registerPaintableBlock(unstableBlock);
BotaniaAPI.registerPaintableBlock(manaBeacon);
initTileEntities();
}
@@ -22,23 +22,13 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
public class LensPaint extends Lens {
static final List<Block> paintableBlocks = new ArrayList() {{
add(Blocks.stained_glass);
add(Blocks.stained_glass_pane);
add(Blocks.stained_hardened_clay);
add(Blocks.wool);
add(Blocks.carpet);
add(ModBlocks.unstableBlock);
add(ModBlocks.manaBeacon);
}
};
@Override
public boolean collideBurst(IManaBurst burst, EntityThrowable entity, MovingObjectPosition pos, boolean isManaBlock, boolean dead, ItemStack stack) {
int storedColor = ItemLens.getStoredColor(stack);
@@ -54,7 +44,7 @@ public class LensPaint extends Lens {
dead = true;
} else {
Block block = entity.worldObj.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if(paintableBlocks.contains(block)) {
if(BotaniaAPI.paintableBlocks.contains(block)) {
int meta = entity.worldObj.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ);
List<ChunkCoordinates> coordsToPaint = new ArrayList();
List<ChunkCoordinates> coordsFound = new ArrayList();