Added glass jar ItemBlock
This commit is contained in:
parent
95cc5a3405
commit
db0708fcc4
|
@ -0,0 +1,45 @@
|
||||||
|
package resonantinduction.archaic.process.mixing
|
||||||
|
|
||||||
|
import net.minecraft.block.Block
|
||||||
|
import net.minecraft.entity.Entity
|
||||||
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
|
import net.minecraft.item.ItemStack
|
||||||
|
import net.minecraft.world.World
|
||||||
|
import resonant.lib.prefab.tile.item.ItemBlockSaved
|
||||||
|
import resonant.lib.transform.vector.{IVector3, Vector3}
|
||||||
|
import resonant.lib.utility.nbt.NBTUtility
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The ItemBlock for the glass jar
|
||||||
|
* @author Calclavia
|
||||||
|
*/
|
||||||
|
class ItemGlassJar(block: Block) extends ItemBlockSaved(block)
|
||||||
|
{
|
||||||
|
var lastLook: Vector3 = null
|
||||||
|
|
||||||
|
override def onUpdate(stack: ItemStack, world: World, entity: Entity, p_77663_4_ : Int, p_77663_5_ : Boolean): Unit =
|
||||||
|
{
|
||||||
|
val player = entity.asInstanceOf[EntityPlayer]
|
||||||
|
|
||||||
|
if (!world.isRemote)
|
||||||
|
{
|
||||||
|
val currLook = new Vector3(player.getLookVec).asInstanceOf[IVector3]
|
||||||
|
|
||||||
|
if (lastLook == null)
|
||||||
|
{
|
||||||
|
lastLook = currLook.asInstanceOf[Vector3]
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lastLook.distance(currLook) > 1.0D)
|
||||||
|
{
|
||||||
|
if (world.rand.nextFloat() < 0.05)
|
||||||
|
{
|
||||||
|
//Set mixed
|
||||||
|
NBTUtility.getNBTTagCompound(stack).setBoolean("mixed", true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lastLook = currLook.asInstanceOf[Vector3]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,6 @@ import org.lwjgl.opengl.GL11
|
||||||
import resonant.lib.factory.resources.item.TItemResource
|
import resonant.lib.factory.resources.item.TItemResource
|
||||||
import resonant.lib.network.discriminator.PacketType
|
import resonant.lib.network.discriminator.PacketType
|
||||||
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
|
||||||
import resonant.lib.prefab.tile.item.ItemBlockSaved
|
|
||||||
import resonant.lib.prefab.tile.spatial.SpatialTile
|
import resonant.lib.prefab.tile.spatial.SpatialTile
|
||||||
import resonant.lib.render.RenderUtility
|
import resonant.lib.render.RenderUtility
|
||||||
import resonant.lib.render.model.ModelCube
|
import resonant.lib.render.model.ModelCube
|
||||||
|
@ -45,7 +44,7 @@ class TileGlassJar extends SpatialTile(Material.wood) with TPacketReceiver with
|
||||||
bounds = new Cuboid(0.2, 0, 0.2, 0.8, 1, 0.8)
|
bounds = new Cuboid(0.2, 0, 0.2, 0.8, 1, 0.8)
|
||||||
normalRender = false
|
normalRender = false
|
||||||
isOpaqueCube = false
|
isOpaqueCube = false
|
||||||
itemBlock = classOf[ItemBlockSaved]
|
itemBlock = classOf[ItemGlassJar]
|
||||||
|
|
||||||
def percentage(material: String): Float = mixture(material) / mixtureSize.toFloat
|
def percentage(material: String): Float = mixture(material) / mixtureSize.toFloat
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue