mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-14 01:04:16 +00:00
Hourglasses. Todo: HUD, inventory rendering, recipes and stuff.
This commit is contained in:
1 parent
1a27dbc876
commit
40237cdb66
12 files changed
+464
-2
No files matched your search
@@ -84,6 +84,7 @@ import vazkii.botania.client.render.tile.RenderTileCorporeaCrystalCube;
|
||||
import vazkii.botania.client.render.tile.RenderTileCorporeaIndex;
|
||||
import vazkii.botania.client.render.tile.RenderTileEnchanter;
|
||||
import vazkii.botania.client.render.tile.RenderTileFloatingFlower;
|
||||
import vazkii.botania.client.render.tile.RenderTileHourglass;
|
||||
import vazkii.botania.client.render.tile.RenderTileIncensePlate;
|
||||
import vazkii.botania.client.render.tile.RenderTilePool;
|
||||
import vazkii.botania.client.render.tile.RenderTilePrism;
|
||||
@@ -104,6 +105,7 @@ import vazkii.botania.common.block.tile.TileBrewery;
|
||||
import vazkii.botania.common.block.tile.TileEnchanter;
|
||||
import vazkii.botania.common.block.tile.TileFloatingFlower;
|
||||
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileIncensePlate;
|
||||
import vazkii.botania.common.block.tile.TilePylon;
|
||||
import vazkii.botania.common.block.tile.TileRuneAltar;
|
||||
@@ -187,6 +189,7 @@ public class ClientProxy extends CommonProxy {
|
||||
LibRenderIDs.idDoubleFlower = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idCorporeaCrystalCybe = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idIncensePlate = RenderingRegistry.getNextAvailableRenderId();
|
||||
LibRenderIDs.idHourglass = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new RenderAltar());
|
||||
RenderingRegistry.registerBlockHandler(new RenderSpecialFlower(LibRenderIDs.idSpecialFlower));
|
||||
@@ -238,6 +241,7 @@ public class ClientProxy extends CommonProxy {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TilePump.class, new RenderTilePump());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileCorporeaCrystalCube.class, new RenderTileCorporeaCrystalCube());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileIncensePlate.class, new RenderTileIncensePlate());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileHourglass.class, new RenderTileHourglass());
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntitySkull.class, new RenderTileSkullOverride());
|
||||
|
||||
|
||||
@@ -26,5 +26,6 @@ public final class LibRenderIDs {
|
||||
public static int idDoubleFlower = -1;
|
||||
public static int idCorporeaCrystalCybe = -1;
|
||||
public static int idIncensePlate = -1;
|
||||
public static int idHourglass = -1;
|
||||
|
||||
}
|
||||
@@ -112,6 +112,7 @@ public final class LibResources {
|
||||
public static final String MODEL_PINK_WITHER = PREFIX_MODEL + "pinkWither.png";
|
||||
public static final String MODEL_CRYSTAL_CUBE = PREFIX_MODEL + "crystalCube.png";
|
||||
public static final String MODEL_INCENSE_PLATE = PREFIX_MODEL + "incensePlate.png";
|
||||
public static final String MODEL_HOURGLASS = PREFIX_MODEL + "hourglass.png";
|
||||
|
||||
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
|
||||
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/**
|
||||
* This class was created by <wiiv>. 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 @ [? (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.botania.client.core.helper.ShaderHelper;
|
||||
|
||||
public class ModelHourglass extends ModelBase {
|
||||
|
||||
public ModelRenderer ring;
|
||||
public ModelRenderer base1;
|
||||
public ModelRenderer base2;
|
||||
public ModelRenderer glass1;
|
||||
public ModelRenderer sand1;
|
||||
public ModelRenderer glass2;
|
||||
public ModelRenderer sand2;
|
||||
|
||||
public ModelHourglass() {
|
||||
textureWidth = 48;
|
||||
textureHeight = 24;
|
||||
sand2 = new ModelRenderer(this, 24, 0);
|
||||
sand2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
sand2.addBox(0F, 0F, 0F, 5, 5, 5, 0.0F); // -2.5F, 1.0F, -2.5F
|
||||
sand1 = new ModelRenderer(this, 24, 0);
|
||||
sand1.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
sand1.addBox(0F, 0F, 0F, 5, 5, 5, 0.0F); // -2.5F, -6.0F, -2.5F
|
||||
glass1 = new ModelRenderer(this, 0, 0);
|
||||
glass1.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
glass1.addBox(-3.0F, -6.501F, -3.0F, 6, 6, 6, 0.0F);
|
||||
base2 = new ModelRenderer(this, 0, 12);
|
||||
base2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
base2.addBox(-3.5F, 6.502F, -3.5F, 7, 1, 7, 0.0F);
|
||||
base1 = new ModelRenderer(this, 0, 12);
|
||||
base1.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
base1.addBox(-3.5F, -7.502F, -3.5F, 7, 1, 7, 0.0F);
|
||||
ring = new ModelRenderer(this, 28, 12);
|
||||
ring.setRotationPoint(0.0F, 15.5F, 0.0F);
|
||||
ring.addBox(-2.0F, -16F, -2.0F, 4, 1, 4, 0.0F);
|
||||
glass2 = new ModelRenderer(this, 0, 0);
|
||||
glass2.setRotationPoint(0.0F, 0.0F, 0.0F);
|
||||
glass2.addBox(-3.0F, 0.501F, -3.0F, 6, 6, 6, 0.0F);
|
||||
}
|
||||
|
||||
public void render(float fract1, float fract2, boolean flip, int color) {
|
||||
if(flip) {
|
||||
float fract3 = fract1;
|
||||
fract1 = fract2;
|
||||
fract2 = fract3;
|
||||
}
|
||||
|
||||
float f = 1F / 16F;
|
||||
ring.render(f);
|
||||
base1.render(f);
|
||||
base2.render(f);
|
||||
Color c = new Color(color);
|
||||
GL11.glColor3ub((byte) c.getRed(), (byte) c.getGreen(), (byte) c.getBlue());
|
||||
GL11.glEnable(GL11.GL_NORMALIZE);
|
||||
|
||||
if(fract1 > 0) {
|
||||
GL11.glPushMatrix();
|
||||
if(flip)
|
||||
GL11.glTranslatef(-2.5F * f, 1.0F * f, -2.5F * f);
|
||||
else {
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-2.5F * f, -6.0F * f, -2.5F * f);
|
||||
}
|
||||
|
||||
GL11.glScalef(1F, fract1, 1F);
|
||||
sand1.render(f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
if(fract2 > 0) {
|
||||
GL11.glPushMatrix();
|
||||
if(flip)
|
||||
GL11.glTranslatef(-2.5F * f, -6.0F * f, -2.5F * f);
|
||||
else {
|
||||
GL11.glRotatef(180F, 0F, 0F, 1F);
|
||||
GL11.glTranslatef(-2.5F * f, 1.0F * f, -2.5F * f);
|
||||
}
|
||||
|
||||
GL11.glScalef(1F, fract2, 1F);
|
||||
sand2.render(f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
GL11.glDisable(GL11.GL_NORMALIZE);
|
||||
GL11.glColor3f(1F, 1F, 1F);
|
||||
glass1.render(f);
|
||||
glass2.render(f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
/**
|
||||
* 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 the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 29, 2015, 8:19:32 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.model.ModelHourglass;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
|
||||
public class RenderTileHourglass extends TileEntitySpecialRenderer {
|
||||
|
||||
ResourceLocation texture = new ResourceLocation(LibResources.MODEL_HOURGLASS);
|
||||
ModelHourglass model = new ModelHourglass();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
|
||||
TileHourglass hourglass = (TileHourglass) tileentity;
|
||||
model = new ModelHourglass();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslated(d0, d1, d2);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
int wtime = tileentity.getWorldObj() == null ? 0 : ClientTickHandler.ticksInGame;
|
||||
if(wtime != 0)
|
||||
wtime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
|
||||
|
||||
float time = wtime == 0 ? 0 : wtime + ticks;
|
||||
float x = 0.5F + (float) Math.cos(time * 0.05F) * 0.025F;
|
||||
float y = 0.55F + (float) (Math.sin(time * 0.04F) + 1F) * 0.05F;
|
||||
float z = 0.5F + (float) Math.sin(time * 0.05F) * 0.025F;
|
||||
ItemStack stack = hourglass.getStackInSlot(0);
|
||||
|
||||
float fract1 = stack == null ? 0 : hourglass.timeFraction;
|
||||
float fract2 = stack == null ? 0 : 1F - hourglass.timeFraction;
|
||||
GL11.glTranslatef(x, y, z);
|
||||
|
||||
float rot = hourglass.flip ? 180F : 1F;
|
||||
if(hourglass.flipTicks > 0)
|
||||
rot += (float) (hourglass.flipTicks - ticks) * (180F / 4F);
|
||||
GL11.glRotatef(rot, 0F, 0F, 1F);
|
||||
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render(fract1, fract2, hourglass.flip, hourglass.getColor());
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/**
|
||||
* 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 the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 29, 2015, 8:17:08 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileSimpleInventory;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
public class BlockHourglass extends BlockModContainer {
|
||||
|
||||
Random random;
|
||||
|
||||
protected BlockHourglass() {
|
||||
super(Material.iron);
|
||||
setBlockName(LibBlockNames.HOURGLASS);
|
||||
setHardness(2.0F);
|
||||
setStepSound(soundTypeMetal);
|
||||
|
||||
float f = 1F / 16F;
|
||||
float w = 8F * f;
|
||||
float d = (1F - w) / 2;
|
||||
setBlockBounds(d, 0F, d, 1F - d, 1.15F, 1F - d);
|
||||
|
||||
random = new Random();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xs, float ys, float zs) {
|
||||
TileHourglass hourglass = (TileHourglass) world.getTileEntity(x, y, z);
|
||||
ItemStack hgStack = hourglass.getStackInSlot(0);
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if(hgStack == null && hourglass.getStackItemTime(stack) > 0) {
|
||||
hourglass.setInventorySlotContents(0, stack.copy());
|
||||
hourglass.markDirty();
|
||||
stack.stackSize = 0;
|
||||
return true;
|
||||
} else if(hgStack != null) {
|
||||
ItemStack copy = hgStack.copy();
|
||||
if(!player.inventory.addItemStackToInventory(copy))
|
||||
player.dropPlayerItemWithRandomChoice(copy, false);
|
||||
hourglass.setInventorySlotContents(0, null);
|
||||
hourglass.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return world.getBlockMetadata(x, y, z) == 0 ? 0 : 15;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World world) {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 0, 1 | 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
|
||||
|
||||
if (inv != null) {
|
||||
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
|
||||
ItemStack itemstack = inv.getStackInSlot(j1);
|
||||
|
||||
if (itemstack != null) {
|
||||
float f = random.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = random.nextFloat() * 0.8F + 0.1F;
|
||||
EntityItem entityitem;
|
||||
|
||||
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
|
||||
int k1 = random.nextInt(21) + 10;
|
||||
|
||||
if (k1 > itemstack.stackSize)
|
||||
k1 = itemstack.stackSize;
|
||||
|
||||
itemstack.stackSize -= k1;
|
||||
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)random.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)random.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)random.nextGaussian() * f3;
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
par1World.func_147453_f(par2, par3, par4, par5);
|
||||
}
|
||||
|
||||
super.breakBlock(par1World, par2, par3, par4, par5, par6);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_) {
|
||||
return ModBlocks.manaGlass.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return LibRenderIDs.idHourglass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileHourglass();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +119,7 @@ import vazkii.botania.common.block.tile.TileFakeAir;
|
||||
import vazkii.botania.common.block.tile.TileFloatingFlower;
|
||||
import vazkii.botania.common.block.tile.TileFloatingSpecialFlower;
|
||||
import vazkii.botania.common.block.tile.TileForestEye;
|
||||
import vazkii.botania.common.block.tile.TileHourglass;
|
||||
import vazkii.botania.common.block.tile.TileIncensePlate;
|
||||
import vazkii.botania.common.block.tile.TileManaBeacon;
|
||||
import vazkii.botania.common.block.tile.TileManaFlame;
|
||||
@@ -226,6 +227,7 @@ public final class ModBlocks {
|
||||
public static Block corporeaInterceptor;
|
||||
public static Block corporeaCrystalCube;
|
||||
public static Block incensePlate;
|
||||
public static Block hourglass;
|
||||
|
||||
public static void init() {
|
||||
flower = new BlockModFlower();
|
||||
@@ -297,7 +299,8 @@ public final class ModBlocks {
|
||||
corporeaInterceptor = new BlockCorporeaInterceptor();
|
||||
corporeaCrystalCube = new BlockCorporeaCrystalCube();
|
||||
incensePlate = new BlockIncensePlate();
|
||||
|
||||
hourglass = new BlockHourglass();
|
||||
|
||||
ModFluffBlocks.init();
|
||||
|
||||
for(int i = 0; i < 16; i++)
|
||||
@@ -385,6 +388,7 @@ public final class ModBlocks {
|
||||
registerTile(TileCorporeaInterceptor.class, LibBlockNames.CORPOREA_INTERCEPTOR);
|
||||
registerTile(TileCorporeaCrystalCube.class, LibBlockNames.CORPOREA_CRYSTAL_CUBE);
|
||||
registerTile(TileIncensePlate.class, LibBlockNames.INCENSE_PLATE);
|
||||
registerTile(TileHourglass.class, LibBlockNames.HOURGLASS);
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_PUREDAISY, SubTilePureDaisy.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_MANASTAR, SubTileManastar.class);
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
/**
|
||||
* 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 the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [May 29, 2015, 8:21:17 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
public class TileHourglass extends TileSimpleInventory {
|
||||
|
||||
private static final String TAG_TIME = "time";
|
||||
int time = 0;
|
||||
public float timeFraction = 0F;
|
||||
public boolean flip = false;
|
||||
public int flipTicks = 0;
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
super.updateEntity();
|
||||
|
||||
int totalTime = getTotalTime();
|
||||
if(totalTime > 0) {
|
||||
time++;
|
||||
if(time >= totalTime) {
|
||||
time = 0;
|
||||
flip = !flip;
|
||||
flipTicks = 4;
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 1 | 2);
|
||||
worldObj.scheduleBlockUpdate(xCoord, yCoord, zCoord, getBlockType(), getBlockType().tickRate(worldObj));
|
||||
}
|
||||
timeFraction = (float) time / (float) totalTime;
|
||||
} else {
|
||||
time = 0;
|
||||
timeFraction = 0F;
|
||||
}
|
||||
|
||||
if(flipTicks > 0)
|
||||
flipTicks--;
|
||||
}
|
||||
|
||||
public int getTotalTime() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
if(stack == null)
|
||||
return 0;
|
||||
|
||||
return getStackItemTime(stack) * stack.stackSize;
|
||||
}
|
||||
|
||||
public static int getStackItemTime(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return 0;
|
||||
if(stack.getItem() == Item.getItemFromBlock(Blocks.sand))
|
||||
return stack.getItemDamage() == 1 ? 200 : 20;
|
||||
if(stack.getItem() == Item.getItemFromBlock(Blocks.soul_sand))
|
||||
return 1200;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
ItemStack stack = getStackInSlot(0);
|
||||
if(stack == null)
|
||||
return 0;
|
||||
if(stack.getItem() == Item.getItemFromBlock(Blocks.sand))
|
||||
return stack.getItemDamage() == 1 ? 0xE95800 : 0xFFEC49;
|
||||
if(stack.getItem() == Item.getItemFromBlock(Blocks.soul_sand))
|
||||
return 0x5A412f;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeCustomNBT(par1nbtTagCompound);
|
||||
par1nbtTagCompound.setInteger(TAG_TIME, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readCustomNBT(par1nbtTagCompound);
|
||||
time = par1nbtTagCompound.getInteger(TAG_TIME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
super.markDirty();
|
||||
time = 0;
|
||||
timeFraction = 0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return LibBlockNames.HOURGLASS;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,7 +125,8 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.bloodPendant);
|
||||
addBlock(ModBlocks.pylon);
|
||||
addBlock(ModBlocks.pistonRelay);
|
||||
|
||||
addBlock(ModBlocks.hourglass);
|
||||
|
||||
addBlock(ModBlocks.redStringContainer);
|
||||
addBlock(ModBlocks.redStringDispenser);
|
||||
addBlock(ModBlocks.redStringFertilizer);
|
||||
|
||||
@@ -84,6 +84,7 @@ public final class LibBlockNames {
|
||||
public static final String CORPOREA_INTERCEPTOR = "corporeaInterceptor";
|
||||
public static final String CORPOREA_CRYSTAL_CUBE = "corporeaCrystalCube";
|
||||
public static final String INCENSE_PLATE = "incensePlate";
|
||||
public static final String HOURGLASS = "hourglass";
|
||||
|
||||
public static final String SUBTILE_PUREDAISY = "puredaisy";
|
||||
public static final String SUBTILE_MANASTAR = "manastar";
|
||||
|
||||
Reference in new issue
Block a user