mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
Added the Orechid.
This commit is contained in:
1 parent
1c52485d31
commit
7c64a4ddb4
7 files changed
+100
-4
No files matched your search
@@ -43,7 +43,7 @@ public final class BotaniaAPI {
|
||||
|
||||
private static BiMap<String, Class<? extends SubTileEntity>> subTiles = HashBiMap.<String, Class<? extends SubTileEntity>> create();
|
||||
|
||||
private static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
public static Map<String, Integer> oreWeights = new HashMap<String, Integer>();
|
||||
|
||||
static {
|
||||
registerSubTile("", DummySubTile.class);
|
||||
|
||||
@@ -90,7 +90,7 @@ public class SubTileFunctional extends SubTileEntity {
|
||||
int size = network.getAllPoolsInWorld(supertile.worldObj.provider.dimensionId).size();
|
||||
if(size != sizeLastCheck) {
|
||||
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
|
||||
linkedPool =network.getClosestPool(coords, supertile.worldObj.provider.dimensionId, range);
|
||||
linkedPool = network.getClosestPool(coords, supertile.worldObj.provider.dimensionId, range);
|
||||
sizeLastCheck = size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
LibBlockNames.SUBTILE_BELLETHORN,
|
||||
LibBlockNames.SUBTILE_HEISEI_DREAM,
|
||||
LibBlockNames.SUBTILE_TIGERSEYE,
|
||||
|
||||
LibBlockNames.SUBTILE_ORECHID
|
||||
};
|
||||
|
||||
protected BlockSpecialFlower() {
|
||||
|
||||
@@ -20,6 +20,7 @@ import vazkii.botania.common.block.subtile.functional.SubTileBellethorn;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHeiseiDream;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileJadedAmaranthus;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileTigerseye;
|
||||
import vazkii.botania.common.block.subtile.functional.SubtileOrechid;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileEndoflame;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
|
||||
@@ -110,6 +111,7 @@ public final class ModBlocks {
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_HEISEI_DREAM, SubTileHeiseiDream.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TIGERSEYE, SubTileTigerseye.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JADED_AMARANTHUS, SubTileJadedAmaranthus.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ORECHID, SubtileOrechid.class);
|
||||
}
|
||||
|
||||
private static void registerMultiparts() {
|
||||
|
||||
@@ -11,6 +11,97 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.functional;
|
||||
|
||||
public class SubtileOrechid {
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.WeightedRandom;
|
||||
import net.minecraft.util.WeightedRandomItem;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.subtile.SubTileFunctional;
|
||||
|
||||
public class SubtileOrechid extends SubTileFunctional {
|
||||
|
||||
private static final int COST = 17500;
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(!supertile.worldObj.isRemote && mana >= COST && supertile.worldObj.getTotalWorldTime() % 5 == 0) {
|
||||
ChunkCoordinates coords = getCoordsToPut();
|
||||
if(coords != null) {
|
||||
ItemStack stack = getOreToPut();
|
||||
if(stack != null) {
|
||||
supertile.worldObj.setBlock(coords.posX, coords.posY, coords.posZ, stack.itemID, stack.getItemDamage(), 1 | 2);
|
||||
|
||||
mana -= COST;
|
||||
PacketDispatcher.sendPacketToAllInDimension(supertile.getDescriptionPacket(), supertile.worldObj.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getOreToPut() {
|
||||
Collection<WeightedRandomItem> values = new ArrayList();
|
||||
for(String s : BotaniaAPI.oreWeights.keySet())
|
||||
values.add(new StringRandomItem(BotaniaAPI.oreWeights.get(s), s));
|
||||
|
||||
String ore = ((StringRandomItem) WeightedRandom.getRandomItem(supertile.worldObj.rand, values)).s;
|
||||
|
||||
List<ItemStack> ores = OreDictionary.getOres(ore);
|
||||
if(ores.isEmpty())
|
||||
return getOreToPut();
|
||||
|
||||
return ores.get(0);
|
||||
}
|
||||
|
||||
public ChunkCoordinates getCoordsToPut() {
|
||||
List<ChunkCoordinates> possibleCoords = new ArrayList();
|
||||
int range = 5;
|
||||
int rangeY = 3;
|
||||
|
||||
for(int i = -range; i < range; i++)
|
||||
for(int j = -rangeY; j < rangeY; j++)
|
||||
for(int k = -range; k < range; k++) {
|
||||
int x = supertile.xCoord + i;
|
||||
int y = supertile.yCoord + j;
|
||||
int z = supertile.zCoord + k;
|
||||
int id = supertile.worldObj.getBlockId(x, y, z);
|
||||
Block block = Block.blocksList[id];
|
||||
if(block != null && block.isGenMineableReplaceable(supertile.worldObj, x, y, z, Block.stone.blockID))
|
||||
possibleCoords.add(new ChunkCoordinates(x, y, z));
|
||||
}
|
||||
|
||||
if(possibleCoords.isEmpty())
|
||||
return null;
|
||||
return possibleCoords.get(supertile.worldObj.rand.nextInt(possibleCoords.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0x818181;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return COST;
|
||||
}
|
||||
|
||||
private static class StringRandomItem extends WeightedRandomItem {
|
||||
|
||||
public String s;
|
||||
|
||||
public StringRandomItem(int par1, String s) {
|
||||
super(par1);
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -44,5 +44,6 @@ public final class LibBlockNames {
|
||||
public static final String SUBTILE_HEISEI_DREAM = "heiseiDream";
|
||||
public static final String SUBTILE_TIGERSEYE = "tigerseye";
|
||||
public static final String SUBTILE_JADED_AMARANTHUS = "jadedAmaranthus";
|
||||
public static final String SUBTILE_ORECHID = "orechid";
|
||||
|
||||
}
|
||||
@@ -129,6 +129,8 @@ tile.botania:flower.tigerseye.name=Tigerseye
|
||||
tile.botania:flower.tigerseye.reference=The palmtop tiger
|
||||
tile.botania:flower.jadedAmaranthus.name=Jaded Amaranthus
|
||||
tile.botania:flower.jadedAmaranthus.reference=A couple died for this
|
||||
tile.botania:flower.orechid.name=Orechid
|
||||
tile.botania:flower.orechid.reference=I seed what you did there
|
||||
|
||||
# ITEM NAMES
|
||||
item.botania:lexicon.name=Lexica Botania
|
||||
|
||||
Reference in new issue
Block a user