Added the Munchdew.

This commit is contained in:
Vasco Lavos committed 2014-05-15 22:18:05 +01:00
1 parent acbf050bf8
commit bfe10b3713
5 files changed
+88

No files matched your search

@@ -60,6 +60,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
LibBlockNames.SUBTILE_HYDROANGEAS,
LibBlockNames.SUBTILE_THERMALILY,
LibBlockNames.SUBTILE_ARCANE_ROSE,
LibBlockNames.SUBTILE_MUNCHDEW,
// Functional
LibBlockNames.SUBTILE_JADED_AMARANTHUS,
@@ -35,6 +35,7 @@ import vazkii.botania.common.block.subtile.generating.SubTileArcaneRose;
import vazkii.botania.common.block.subtile.generating.SubTileDaybloom;
import vazkii.botania.common.block.subtile.generating.SubTileEndoflame;
import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
import vazkii.botania.common.block.subtile.generating.SubTileMunchdew;
import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
import vazkii.botania.common.block.tile.TileAltar;
@@ -139,6 +140,7 @@ public final class ModBlocks {
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_THERMALILY, SubTileThermalily.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NIGHTSHADE, SubTileNightshade.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ARCANE_ROSE, SubTileArcaneRose.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MUNCHDEW, SubTileMunchdew.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DREADTHORN, SubTileDreadthorn.class);
@@ -0,0 +1,82 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [May 15, 2014, 7:25:47 PM (GMT)]
*/
package vazkii.botania.common.block.subtile.generating;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.subtile.SubTileGenerating;
public class SubTileMunchdew extends SubTileGenerating {
@Override
public void onUpdate() {
super.onUpdate();
int manaPerLeaf = 16;
if(getMaxMana() - mana >= manaPerLeaf && !supertile.getWorldObj().isRemote && supertile.getWorldObj().getTotalWorldTime() % 4 == 0) {
List<ChunkCoordinates> coords = new ArrayList();
int range = 8;
int rangeY = 16;
int x = supertile.xCoord;
int y = supertile.yCoord;
int z = supertile.zCoord;
for(int i = -range; i < range + 1; i++)
for(int j = 0; j < rangeY; j++)
for(int k = -range; k < range + 1; k++) {
int xp = x + i;
int yp = y + j;
int zp = z + k;
Block block = supertile.getWorldObj().getBlock(xp, yp, zp);
if(block.getMaterial() == Material.leaves) {
boolean exposed = false;
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
if(supertile.getWorldObj().getBlock(xp + dir.offsetX, yp + dir.offsetY, zp + dir.offsetZ).isAir(supertile.getWorldObj(), xp + dir.offsetX, yp + dir.offsetY, zp + dir.offsetZ)) {
exposed = true;
break;
}
if(exposed)
coords.add(new ChunkCoordinates(xp, yp, zp));
}
}
if(coords.isEmpty())
return;
Collections.shuffle(coords);
ChunkCoordinates breakCoords = coords.get(0);
Block block = supertile.getWorldObj().getBlock(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
int meta = supertile.getWorldObj().getBlockMetadata(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
supertile.getWorldObj().setBlockToAir(breakCoords.posX, breakCoords.posY, breakCoords.posZ);
supertile.getWorldObj().playAuxSFX(2001, breakCoords.posX, breakCoords.posY, breakCoords.posZ, Block.getIdFromBlock(block) + (meta << 12));
mana += manaPerLeaf;
}
}
@Override
public int getColor() {
return 0x79C42F;
}
@Override
public int getMaxMana() {
return 200;
}
}
@@ -48,6 +48,7 @@ public final class LibBlockNames {
public static final String SUBTILE_THERMALILY = "thermalily";
public static final String SUBTILE_NIGHTSHADE = "nightshade";
public static final String SUBTILE_ARCANE_ROSE = "arcanerose";
public static final String SUBTILE_MUNCHDEW = "munchdew";
public static final String SUBTILE_BELLETHORN = "bellethorn";
public static final String SUBTILE_DREADTHORN = "dreadthorn";
+2
View File
@@ -149,6 +149,8 @@ tile.botania:flower.nightshade.name=Nightshade
tile.botania:flower.nightshade.reference=Ghastly signature
tile.botania:flower.arcanerose.name=Rosa Arcana
tile.botania:flower.arcanerose.reference=Ten blue orbs in the corner
tile.botania:flower.munchdew.name=Munchdew
tile.botania:flower.munchdew.reference=Nommy nommy
# - FUNCTIONAL
tile.botania:flower.bellethorn.name=Bellethorne