mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 12:19:46 +00:00
Added water to the Petal Apothecary.
This commit is contained in:
1 parent
0cc1e1faa7
commit
7f96d1c884
4 files changed
+116
-2
No files matched your search
@@ -11,7 +11,10 @@
|
||||
*/
|
||||
package vazkii.botania.client.render.tile;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -21,6 +24,7 @@ import org.lwjgl.opengl.GL12;
|
||||
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.client.model.ModelAltar;
|
||||
import vazkii.botania.common.block.tile.TileAltar;
|
||||
|
||||
public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
|
||||
@@ -28,7 +32,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
ModelAltar model = new ModelAltar();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float f) {
|
||||
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float ticks) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
@@ -37,7 +41,24 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
|
||||
GL11.glTranslated(d0 + 0.5, d1 + 1.5, d2 + 0.5);
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
model.render();
|
||||
GL11.glScalef(1F, -1F, -1F);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if(((TileAltar) tileentity).hasWater) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glPushMatrix();
|
||||
float f = 1F / 256F * 10F;
|
||||
float p = -(1F / 16F * 6F);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
GL11.glTranslatef(p, -0.3F, p);
|
||||
GL11.glRotatef(90F, 1F, 0F, 0F);
|
||||
GL11.glScalef(f, f, f);
|
||||
new RenderItem().renderIcon(0, 0, Block.waterStill.getIcon(0, 0), 16, 16);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@
|
||||
*/
|
||||
package vazkii.botania.common.block;
|
||||
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.client.lib.LibRenderIDs;
|
||||
@@ -28,6 +32,22 @@ public class BlockAltar extends BlockModContainer {
|
||||
setUnlocalizedName(LibBlockNames.ALTAR);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
|
||||
TileAltar tile = (TileAltar) par1World.getBlockTileEntity(par2, par3, par4);
|
||||
if(stack != null && stack.itemID == Item.bucketWater.itemID) {
|
||||
if(!tile.hasWater) {
|
||||
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, new ItemStack(Item.bucketEmpty));
|
||||
tile.hasWater = true;
|
||||
PacketDispatcher.sendPacketToAllInDimension(tile.getDescriptionPacket(), par1World.provider.dimensionId);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
|
||||
@@ -11,8 +11,23 @@
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileAltar extends TileEntity {
|
||||
public class TileAltar extends TileMod {
|
||||
|
||||
public static final String TAG_HAS_WATER = "hasWater";
|
||||
|
||||
public boolean hasWater = false;
|
||||
|
||||
@Override
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
cmp.setBoolean(TAG_HAS_WATER, hasWater);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
hasWater = cmp.getBoolean(TAG_HAS_WATER);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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 @ [Jan 21, 2014, 9:18:28 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.tile;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.INetworkManager;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileMod extends TileEntity {
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.writeToNBT(par1nbtTagCompound);
|
||||
|
||||
writeCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1nbtTagCompound) {
|
||||
super.readFromNBT(par1nbtTagCompound);
|
||||
|
||||
readCustomNBT(par1nbtTagCompound);
|
||||
}
|
||||
|
||||
public void writeCustomNBT(NBTTagCompound cmp) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void readCustomNBT(NBTTagCompound cmp) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
writeCustomNBT(nbttagcompound);
|
||||
return new Packet132TileEntityData(xCoord, yCoord, zCoord, -999, nbttagcompound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) {
|
||||
super.onDataPacket(manager, packet);
|
||||
readCustomNBT(packet.data);
|
||||
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user