diff --git a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java index 477592c6f..451ad8cd2 100644 --- a/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java +++ b/src/main/java/vazkii/botania/common/block/BlockSpecialFlower.java @@ -71,6 +71,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid LibBlockNames.SUBTILE_KEKIMURUS, LibBlockNames.SUBTILE_GOURMARYLLIS, LibBlockNames.SUBTILE_NARSLIMMUS, + LibBlockNames.SUBTILE_SPECTROLUS, // Functional LibBlockNames.SUBTILE_JADED_AMARANTHUS, diff --git a/src/main/java/vazkii/botania/common/block/ModBlocks.java b/src/main/java/vazkii/botania/common/block/ModBlocks.java index 401bcac43..a2e0fe9dc 100644 --- a/src/main/java/vazkii/botania/common/block/ModBlocks.java +++ b/src/main/java/vazkii/botania/common/block/ModBlocks.java @@ -92,6 +92,7 @@ import vazkii.botania.common.block.subtile.generating.SubTileKekimurus; import vazkii.botania.common.block.subtile.generating.SubTileMunchdew; import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus; import vazkii.botania.common.block.subtile.generating.SubTileNightshade; +import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus; import vazkii.botania.common.block.subtile.generating.SubTileThermalily; import vazkii.botania.common.block.tile.TileAlfPortal; import vazkii.botania.common.block.tile.TileAltar; @@ -330,6 +331,7 @@ public final class ModBlocks { BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_KEKIMURUS, SubTileKekimurus.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_GOURMARYLLIS, SubTileGourmaryllis.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NARSLIMMUS, SubTileNarslimmus.class); + BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_SPECTROLUS, SubTileSpectrolus.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class); BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DREADTHORN, SubTileDreadthorn.class); diff --git a/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileSpectrolus.java b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileSpectrolus.java new file mode 100644 index 000000000..7aea89ad0 --- /dev/null +++ b/src/main/java/vazkii/botania/common/block/subtile/generating/SubTileSpectrolus.java @@ -0,0 +1,108 @@ +/** + * This class was created by . 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 the + * Botania License: http://botaniamod.net/license.php + * + * File Created @ [Jan 30, 2015, 1:37:26 PM (GMT)] + */ +package vazkii.botania.common.block.subtile.generating; + +import java.awt.Color; +import java.util.List; + +import org.lwjgl.opengl.GL11; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.entity.RenderItem; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemFood; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import vazkii.botania.api.subtile.SubTileGenerating; + +public class SubTileSpectrolus extends SubTileGenerating { + + private static final String TAG_NEXT_COLOR = "nextColor"; + + int nextColor; + + @Override + public void onUpdate() { + super.onUpdate(); + + if(!supertile.getWorldObj().isRemote) { + int range = 1; + Item wool = Item.getItemFromBlock(Blocks.wool); + List items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range + 1, supertile.yCoord + range + 1, supertile.zCoord + range + 1)); + for(EntityItem item : items) { + ItemStack stack = item.getEntityItem(); + if(stack != null && stack.getItem() == wool) { + int meta = stack.getItemDamage(); + if(meta == nextColor) { + mana = Math.min(getMaxMana(), mana + 100); + nextColor = nextColor == 15 ? 0 : nextColor + 1; + + sync(); + } + item.setDead(); + } + } + } + } + + @Override + public int getMaxMana() { + return 2000; + } + + @Override + public int getColor() { + return Color.HSBtoRGB((float) ticksExisted / 100F, 1F, 1F); + } + + @Override + public void renderHUD(Minecraft mc, ScaledResolution res) { + super.renderHUD(mc, res); + + ItemStack stack = new ItemStack(Blocks.wool, 1, nextColor); + int color = getColor(); + + GL11.glEnable(GL11.GL_BLEND); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + if(stack != null && stack.getItem() != null) { + String stackName = stack.getDisplayName(); + int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2; + int x = res.getScaledWidth() / 2 - width; + int y = res.getScaledHeight() / 2 + 30; + + mc.fontRenderer.drawStringWithShadow(stackName, x + 20, y + 5, color); + RenderHelper.enableGUIStandardItemLighting(); + RenderItem.getInstance().renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, stack, x, y); + RenderHelper.disableStandardItemLighting(); + } + + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_BLEND); + } + + @Override + public void writeToPacketNBT(NBTTagCompound cmp) { + super.writeToPacketNBT(cmp); + cmp.setInteger(TAG_NEXT_COLOR, nextColor); + } + + @Override + public void readFromPacketNBT(NBTTagCompound cmp) { + super.readFromPacketNBT(cmp); + nextColor = cmp.getInteger(TAG_NEXT_COLOR); + } + +} diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 635bed684..20162a5c6 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -686,6 +686,8 @@ tile.botania:flower.gourmaryllis.name=Gourmaryllis tile.botania:flower.gourmaryllis.reference=Fuyukai Desu tile.botania:flower.narslimmus.name=Narslimmus tile.botania:flower.narslimmus.reference=What's this? It's all sticky +tile.botania:flower.spectrolus.name=Spectrolus +tile.botania:flower.spectrolus.reference=Profiting off Hate # - FUNCTIONAL tile.botania:flower.bellethorn.name=Bellethorne @@ -2168,4 +2170,3 @@ botania.page.tcIntegration6b=The official frowny face # -- BUILDCRAFT INTEGRATION botania.entry.bcIntegration=Buildcraft Integration botania.page.bcIntegration0=Recent advances in piping technology have allowed &1Gates&0 to get a feel of the &4Mana&0 around them. A &1Gate&0 can now sense whether a &4Mana&0 container is empty, full or if it contains any mana.
&1Gates&0 can also use the &1Mana Detector&0 trigger to detect if a mana is passing by the pipe block. In addition, they can also sense when a &1Runic Altar&0 is ready to create runes. - diff --git a/src/main/resources/assets/botania/textures/blocks/unused/flowerRainbow.png b/src/main/resources/assets/botania/textures/blocks/alt/spectrolus.png similarity index 100% rename from src/main/resources/assets/botania/textures/blocks/unused/flowerRainbow.png rename to src/main/resources/assets/botania/textures/blocks/alt/spectrolus.png diff --git a/src/main/resources/assets/botania/textures/blocks/spectrolus.png b/src/main/resources/assets/botania/textures/blocks/spectrolus.png new file mode 100644 index 000000000..b2af5d27b Binary files /dev/null and b/src/main/resources/assets/botania/textures/blocks/spectrolus.png differ