Reorganized blocks in basic tier

This commit is contained in:
Calclavia 2015-01-14 19:32:53 +08:00
parent 3e7e126a92
commit d97edd17bb
14 changed files with 209 additions and 220 deletions

View file

@ -3,9 +3,8 @@
# The %v may be followed by a number if there are multiple pieces of calculated data, but it will be explained in a comment.
# A % followed by a number is used for colors. The exact usage will be outlined in the comment above the localization.
itemGroup.edx=Resonant Induction
itemGroup.edx.core=Resonant Induction Core
meta.edx.description=Resonant Induction is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place!
itemGroup.edx=Electrodynamics
meta.edx.description=Electrodynamics is a Minecraft mod focusing on the manipulation of electricity and wireless technology. Ever wanted blazing electrical shocks flying off your evil lairs? You've came to the right place!
meta.edx.credits=Visit website for credits.
fluid.mixture=Mixture
@ -38,6 +37,7 @@ misc.bucketMolten=Molten Bucket
tile.edx:oreCopper.name=Copper Ore
tile.edx:oreTin.name=Tin Ore
tile.edx:glassJar.name=Glass Jar
tile.edx:sieve.name=Sieve
# Items
item.edx:circuitBasic.name=Basic Circuit

View file

@ -1,13 +1,14 @@
package edx.basic
import edx.basic.blocks.{ItemImprint, TileImprinter, TileTurntable}
import edx.basic.engineering.ItemHammer
import edx.basic.firebox.{TileFirebox, TileHotPlate}
import edx.basic.fluid.grate.TileGrate
import edx.basic.fluid.gutter.TileGutter
import edx.basic.fluid.tank.TileTank
import edx.basic.process.grinding.{ItemHammer, TileWorkbench}
import edx.basic.process.mixing.TileGlassJar
import edx.basic.process.{TileCastingMold, TileSieve, TileWorkbench}
import edx.basic.process.sifting.TileSieve
import edx.basic.process.smelting.TileCastingMold
import edx.basic.process.smelting.firebox.{TileFirebox, TileHotPlate}
import edx.core.resource.content.{ItemAlloyDust, TileDust}
import edx.core.{EDXCreativeTab, Reference}
import edx.mechanical.mech.gear.ItemHandCrank

View file

@ -6,6 +6,7 @@ import codechicken.multipart.ControlKeyModifer
import cpw.mods.fml.common.network.ByteBufUtils
import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.basic.blocks.ItemImprint
import edx.basic.process.grinding.ItemHammer
import edx.core.{Electrodynamics, Reference}
import io.netty.buffer.ByteBuf
import net.minecraft.block.Block
@ -133,6 +134,162 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
return 10 + (if (this.invPlayer != null) this.invPlayer.getSizeInventory else 0)
}
override def setInventorySlotContents(slot: Int, itemStack: ItemStack)
{
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
{
craftingMatrix(slot) = itemStack
}
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
{
outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END) = itemStack
}
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && this.invPlayer != null)
{
this.invPlayer.setInventorySlotContents(slot - TileEngineeringTable.CRAFTING_OUTPUT_END, itemStack)
val player: EntityPlayer = this.invPlayer.player
if (player.isInstanceOf[EntityPlayerMP])
{
(player.asInstanceOf[EntityPlayerMP]).sendContainerToPlayer(player.inventoryContainer)
}
}
else if (searchInventories)
{
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
val slotID: Int = slot - idDisplacement
if (slotID >= 0 && slotID < inventory.getSizeInventory)
{
inventory.setInventorySlotContents(slotID, itemStack)
}
idDisplacement += inventory.getSizeInventory
}
}
}
onInventoryChanged
}
/**
* Updates all the output slots. Call this to update the Engineering Table.
*/
override def onInventoryChanged
{
if (worldObj != null)
{
if (!worldObj.isRemote)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = null
var didCraft: Boolean = false
val inventoryCrafting: InventoryCrafting = this.getCraftingMatrix
val matrixOutput: ItemStack = CraftingManager.getInstance.findMatchingRecipe(inventoryCrafting, this.worldObj)
if (matrixOutput != null && this.getCraftingManager.getIdealRecipe(matrixOutput) != null)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = matrixOutput
didCraft = true
}
if (!didCraft)
{
val filterStack: ItemStack = craftingMatrix(TileEngineeringTable.CENTER_SLOT)
if (filterStack != null && filterStack.getItem.isInstanceOf[ItemImprint])
{
val filters: java.util.List[ItemStack] = ItemImprint.getFilters(filterStack)
for (o <- filters)
{
val outputStack: ItemStack = o
if (outputStack != null)
{
val idealRecipe: Pair[ItemStack, Array[ItemStack]] = this.getCraftingManager.getIdealRecipe(outputStack)
if (idealRecipe != null)
{
val recipeOutput: ItemStack = idealRecipe.left
if (recipeOutput != null & recipeOutput.stackSize > 0)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = recipeOutput
didCraft = true
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
return
}
}
}
}
}
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
}
}
}
/**
* Gets the AutoCraftingManager that does all the crafting results
*/
def getCraftingManager: AutoCraftingManager =
{
if (craftManager == null)
{
craftManager = new AutoCraftingManager(this)
}
return craftManager
}
/**
* Construct an InventoryCrafting Matrix on the fly.
*
* @return
*/
def getCraftingMatrix: InventoryCrafting =
{
val inventoryCrafting: InventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3)
for (i <- 0 until this.craftingMatrix.length)
{
inventoryCrafting.setInventorySlotContents(i, this.craftingMatrix(i))
}
return inventoryCrafting
}
/**
* DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY!
*/
override def getStackInSlot(slot: Int): ItemStack =
{
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
{
return this.craftingMatrix(slot)
}
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
{
return outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END)
}
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && invPlayer != null)
{
return this.invPlayer.getStackInSlot(slot - TileEngineeringTable.CRAFTING_OUTPUT_END)
}
else if (searchInventories)
{
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
val slotID: Int = slot - idDisplacement
if (slotID >= 0 && slotID < inventory.getSizeInventory)
{
return inventory.getStackInSlot(slotID)
}
idDisplacement += inventory.getSizeInventory
}
}
}
return null
}
override def use(player: EntityPlayer, hitSide: Int, hit: Vector3): Boolean =
{
if (player.getCurrentEquippedItem != null && player.getCurrentEquippedItem.getItem.isInstanceOf[ItemHammer])
@ -417,162 +574,6 @@ class TileEngineeringTable extends TileInventory(Material.wood) with IPacketRece
}
}
override def setInventorySlotContents(slot: Int, itemStack: ItemStack)
{
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
{
craftingMatrix(slot) = itemStack
}
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
{
outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END) = itemStack
}
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && this.invPlayer != null)
{
this.invPlayer.setInventorySlotContents(slot - TileEngineeringTable.CRAFTING_OUTPUT_END, itemStack)
val player: EntityPlayer = this.invPlayer.player
if (player.isInstanceOf[EntityPlayerMP])
{
(player.asInstanceOf[EntityPlayerMP]).sendContainerToPlayer(player.inventoryContainer)
}
}
else if (searchInventories)
{
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
val slotID: Int = slot - idDisplacement
if (slotID >= 0 && slotID < inventory.getSizeInventory)
{
inventory.setInventorySlotContents(slotID, itemStack)
}
idDisplacement += inventory.getSizeInventory
}
}
}
onInventoryChanged
}
/**
* Updates all the output slots. Call this to update the Engineering Table.
*/
override def onInventoryChanged
{
if (worldObj != null)
{
if (!worldObj.isRemote)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = null
var didCraft: Boolean = false
val inventoryCrafting: InventoryCrafting = this.getCraftingMatrix
val matrixOutput: ItemStack = CraftingManager.getInstance.findMatchingRecipe(inventoryCrafting, this.worldObj)
if (matrixOutput != null && this.getCraftingManager.getIdealRecipe(matrixOutput) != null)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = matrixOutput
didCraft = true
}
if (!didCraft)
{
val filterStack: ItemStack = craftingMatrix(TileEngineeringTable.CENTER_SLOT)
if (filterStack != null && filterStack.getItem.isInstanceOf[ItemImprint])
{
val filters: java.util.List[ItemStack] = ItemImprint.getFilters(filterStack)
for (o <- filters)
{
val outputStack: ItemStack = o
if (outputStack != null)
{
val idealRecipe: Pair[ItemStack, Array[ItemStack]] = this.getCraftingManager.getIdealRecipe(outputStack)
if (idealRecipe != null)
{
val recipeOutput: ItemStack = idealRecipe.left
if (recipeOutput != null & recipeOutput.stackSize > 0)
{
this.outputInventory(TileEngineeringTable.CRAFTING_OUTPUT_SLOT) = recipeOutput
didCraft = true
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
return
}
}
}
}
}
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord)
}
}
}
/**
* Gets the AutoCraftingManager that does all the crafting results
*/
def getCraftingManager: AutoCraftingManager =
{
if (craftManager == null)
{
craftManager = new AutoCraftingManager(this)
}
return craftManager
}
/**
* Construct an InventoryCrafting Matrix on the fly.
*
* @return
*/
def getCraftingMatrix: InventoryCrafting =
{
val inventoryCrafting: InventoryCrafting = new InventoryCrafting(new ContainerDummy(this), 3, 3)
for (i <- 0 until this.craftingMatrix.length)
{
inventoryCrafting.setInventorySlotContents(i, this.craftingMatrix(i))
}
return inventoryCrafting
}
/**
* DO NOT USE THIS INTERNALLY. FOR EXTERNAL USE ONLY!
*/
override def getStackInSlot(slot: Int): ItemStack =
{
if (slot < TileEngineeringTable.CRAFTING_MATRIX_END)
{
return this.craftingMatrix(slot)
}
else if (slot < TileEngineeringTable.CRAFTING_OUTPUT_END)
{
return outputInventory(slot - TileEngineeringTable.CRAFTING_MATRIX_END)
}
else if (slot < TileEngineeringTable.PLAYER_OUTPUT_END && invPlayer != null)
{
return this.invPlayer.getStackInSlot(slot - TileEngineeringTable.CRAFTING_OUTPUT_END)
}
else if (searchInventories)
{
var idDisplacement: Int = TileEngineeringTable.PLAYER_OUTPUT_END
for (dir <- ForgeDirection.VALID_DIRECTIONS)
{
val tile: TileEntity = toVectorWorld.add(dir).getTileEntity
if (tile.isInstanceOf[IInventory])
{
val inventory: IInventory = tile.asInstanceOf[IInventory]
val slotID: Int = slot - idDisplacement
if (slotID >= 0 && slotID < inventory.getSizeInventory)
{
return inventory.getStackInSlot(slotID)
}
idDisplacement += inventory.getSizeInventory
}
}
}
return null
}
override def isItemValidForSlot(i: Int, itemstack: ItemStack): Boolean =
{
return true

View file

@ -1,23 +0,0 @@
package edx.basic.process
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.client.renderer.RenderBlocks
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer
import net.minecraft.tileentity.TileEntity
import resonant.lib.render.RenderItemOverlayUtility
@SideOnly(Side.CLIENT)
class RenderMillstone extends TileEntitySpecialRenderer
{
private final val renderBlocks: RenderBlocks = new RenderBlocks
def renderTileEntityAt(tileEntity: TileEntity, x: Double, y: Double, z: Double, var8: Float)
{
if (tileEntity.isInstanceOf[TileSieve])
{
val tile: TileSieve = tileEntity.asInstanceOf[TileSieve]
RenderItemOverlayUtility.renderItemOnSides(tileEntity, tile.getStackInSlot(0), x, y, z, "")
}
}
}

View file

@ -1,4 +1,4 @@
package edx.basic.engineering
package edx.basic.process.grinding
;

View file

@ -1,6 +1,5 @@
package edx.basic.process
package edx.basic.process.grinding
import edx.basic.engineering.ItemHammer
import edx.core.{Electrodynamics, Reference}
import io.netty.buffer.ByteBuf
import net.minecraft.block.Block

View file

@ -1,5 +1,6 @@
package edx.basic.process
package edx.basic.process.sifting
import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.core.Reference
import edx.core.resource.content.ItemRubble
import io.netty.buffer.ByteBuf
@ -13,6 +14,7 @@ import resonant.lib.network.discriminator.PacketType
import resonant.lib.network.handle.{TPacketReceiver, TPacketSender}
import resonant.lib.prefab.tile.spatial.SpatialTile
import resonant.lib.render.RenderUtility
import resonant.lib.transform.region.Cuboid
import resonant.lib.transform.vector.Vector3
import resonant.lib.wrapper.ByteBufWrapper._
@ -25,6 +27,9 @@ class TileSieve extends SpatialTile(Material.wood) with TInventory with TPacketS
{
//Constructor
setTextureName("material_wood_top")
bounds = new Cuboid(0.1, 0, 0.1, 0.9, 0.3, 0.9)
normalRender = false
isOpaqueCube = false
override def canUpdate: Boolean = false
@ -46,10 +51,13 @@ class TileSieve extends SpatialTile(Material.wood) with TInventory with TPacketS
return true
}
override def renderDynamic(pos: Vector3, frame: Float, pass: Int): Unit =
@SideOnly(Side.CLIENT)
override def renderDynamic(pos: Vector3, frame: Float, pass: Int)
{
GL11.glPushMatrix()
GL11.glTranslated(pos.x, pos.y, pos.z)
GL11.glTranslatef(0.5f, 1.2f, 0.5f)
GL11.glScalef(1.8f, 1.8f, 1.8f)
RenderUtility.bind(Reference.domain, Reference.modelPath + "sieve.png")
TileSieve.model.renderAll()
GL11.glPopMatrix()

View file

@ -1,4 +1,4 @@
package edx.basic.process
package edx.basic.process.smelting
import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.core.Reference

View file

@ -1,4 +1,4 @@
package edx.basic.process
package edx.basic.process.smelting
import cpw.mods.fml.common.network.ByteBufUtils
import edx.core.Reference

View file

@ -1,4 +1,4 @@
package edx.basic.firebox
package edx.basic.process.smelting.firebox
import cpw.mods.fml.relauncher.{Side, SideOnly}
import net.minecraft.client.renderer.RenderBlocks

View file

@ -1,4 +1,4 @@
package edx.basic.firebox
package edx.basic.process.smelting.firebox
import java.util.List
@ -159,6 +159,11 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
return this.getBlockMetadata == 1
}
def canBurn(stack: ItemStack): Boolean =
{
return TileEntityFurnace.getItemBurnTime(stack) > 0
}
override def randomDisplayTick(): Unit =
{
if (isBurning)
@ -184,6 +189,8 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
}
}
def isBurning: Boolean = burnTime > 0
override def getSizeInventory = 1
def getMeltIronEnergy(volume: Float): Long =
@ -198,11 +205,6 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
return i == 0 && canBurn(itemStack)
}
def canBurn(stack: ItemStack): Boolean =
{
return TileEntityFurnace.getItemBurnTime(stack) > 0
}
/**
* Override this method
* Be sure to super this method or manually write the id into the packet when sending
@ -293,8 +295,6 @@ class TileFirebox extends SpatialTile(Material.rock) with IFluidHandler with TIn
return if (isBurning) (if (isElectric) SpatialBlock.icon.get("firebox_electric_side_on") else SpatialBlock.icon.get("firebox_side_on")) else (if (isElectric) SpatialBlock.icon.get("firebox_electric_side_off") else SpatialBlock.icon.get("firebox_side_off"))
}
def isBurning: Boolean = burnTime > 0
override def click(player: EntityPlayer)
{
if (server)

View file

@ -1,4 +1,4 @@
package edx.basic.firebox
package edx.basic.process.smelting.firebox
import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.core.Reference
@ -87,6 +87,22 @@ class TileHotPlate extends SpatialTile(Material.iron) with TInventory with TPack
def canSmelt(stack: ItemStack): Boolean = stack != null && FurnaceRecipes.smelting.getSmeltingResult(stack) != null
override def getSizeInventory: Int = 4
def canRun: Boolean =
{
val tileEntity = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)
if (tileEntity.isInstanceOf[TileFirebox])
{
if ((tileEntity.asInstanceOf[TileFirebox]).isBurning)
{
return true
}
}
return false
}
override def randomDisplayTick()
{
val height = 0.2
@ -119,8 +135,6 @@ class TileHotPlate extends SpatialTile(Material.iron) with TInventory with TPack
return smeltTime(i)
}
override def getSizeInventory: Int = 4
override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean =
{
return i < getSizeInventory && canSmelt(itemStack)
@ -175,20 +189,6 @@ class TileHotPlate extends SpatialTile(Material.iron) with TInventory with TPack
return if (access.getBlockMetadata(xi, yi, zi) == 1) SpatialBlock.icon.get("electricHotPlate") else (if (canRun) SpatialBlock.icon.get("hotPlate_on") else SpatialBlock.icon.get(getTextureName))
}
def canRun: Boolean =
{
val tileEntity = worldObj.getTileEntity(xCoord, yCoord - 1, zCoord)
if (tileEntity.isInstanceOf[TileFirebox])
{
if ((tileEntity.asInstanceOf[TileFirebox]).isBurning)
{
return true
}
}
return false
}
@SideOnly(Side.CLIENT)
override def getIcon(side: Int, meta: Int): IIcon =
{

View file

@ -7,9 +7,10 @@ import cpw.mods.fml.client.FMLClientHandler
import cpw.mods.fml.client.registry.{ClientRegistry, RenderingRegistry}
import cpw.mods.fml.relauncher.{Side, SideOnly}
import edx.basic.BasicContent
import edx.basic.firebox.{RenderHotPlate, TileHotPlate}
import edx.basic.process.mixing.TileGlassJar
import edx.basic.process.{RenderCastingMold, RenderMillstone, TileCastingMold, TileSieve}
import edx.basic.process.sifting.TileSieve
import edx.basic.process.smelting.firebox.{RenderHotPlate, TileHotPlate}
import edx.basic.process.smelting.{RenderCastingMold, TileCastingMold}
import edx.electrical.ElectricalContent
import edx.electrical.multimeter.{GuiMultimeter, PartMultimeter, RenderMultimeter}
import edx.electrical.tesla.{RenderTesla, TileTesla}

View file

@ -18,6 +18,7 @@ import resonant.lib.transform.vector.Vector3
/**
* Redirects lasers to one point
*
* @author Calclavia
*/
object TileFocusCrystal
@ -28,6 +29,7 @@ object TileFocusCrystal
class TileFocusCrystal extends TileFocus(Material.rock) with ILaserHandler with IFocus
{
//TODO: FIX ITEM RENDERING BY USING ISIMPLEITEMRENDERER
private var normal = new Vector3(0, 1, 0)
private var energy = 0D
private var color = new Vector3(1, 1, 1)