Hammering now works again

This commit is contained in:
Calclavia 2015-01-03 19:54:54 +08:00
parent ab142ce7b7
commit 1d60a0e3d6
3 changed files with 16 additions and 16 deletions

View file

@ -89,6 +89,8 @@ tile.resonantinduction:firebox.1.name=Electric Firebox
tile.resonantinduction:hotPlate.name=Hot Plate tile.resonantinduction:hotPlate.name=Hot Plate
tile.resonantinduction:workbench.name=Workbench
tile.resonantinduction:workbench.tooltip=The workbench is used for hammering and sawing resources.
tile.resonantinduction:engineeringTable.name=Engineering Table tile.resonantinduction:engineeringTable.name=Engineering Table
engineerTable.config.inventory.true=Engineering table is now connected to nearby inventories. engineerTable.config.inventory.true=Engineering table is now connected to nearby inventories.
engineerTable.config.inventory.false=Engineering table is now disconnected from nearby inventories. engineerTable.config.inventory.false=Engineering table is now disconnected from nearby inventories.

View file

@ -16,11 +16,10 @@ import resonant.lib.prefab.tile.TileInventory
import resonant.lib.render.{RenderItemOverlayUtility, RenderUtility} import resonant.lib.render.{RenderItemOverlayUtility, RenderUtility}
import resonant.lib.transform.vector.Vector3 import resonant.lib.transform.vector.Vector3
import resonant.lib.utility.inventory.InventoryUtility import resonant.lib.utility.inventory.InventoryUtility
import resonant.lib.wrapper.ByteBufWrapper._
import resonantinduction.archaic.engineering.ItemHammer import resonantinduction.archaic.engineering.ItemHammer
import resonantinduction.core.resource.content.{ItemDust, ItemRubble}
import resonantinduction.core.{Reference, ResonantInduction} import resonantinduction.core.{Reference, ResonantInduction}
import resonant.lib.wrapper.ByteBufWrapper._
/** /**
* The workbench is meant for manual ore and wood processing. * The workbench is meant for manual ore and wood processing.
* It is also the core block in Resonant Induction that leads the player to all aspect of the mod. * It is also the core block in Resonant Induction that leads the player to all aspect of the mod.
@ -82,47 +81,44 @@ class TileWorkbench extends TileInventory(Material.rock) with TPacketSender with
world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, Reference.prefix + "hammer", 0.5f, 0.8f + (0.2f * world.rand.nextFloat)) world.playSoundEffect(x + 0.5, y + 0.5, z + 0.5, Reference.prefix + "hammer", 0.5f, 0.8f + (0.2f * world.rand.nextFloat))
player.addExhaustion(0.1f) player.addExhaustion(0.1f)
player.getCurrentEquippedItem.damageItem(1, player) player.getCurrentEquippedItem.damageItem(1, player)
return true
} }
} }
} }
}
else
{
interactCurrentItem(this, 0, player)
onInventoryChanged()
return true return true
} }
} }
return false //Try putting the current item in.
interactCurrentItem(this, 0, player)
onInventoryChanged()
return true
} }
override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean = override def isItemValidForSlot(i: Int, itemStack: ItemStack): Boolean =
{ {
if (i == 0) return true
return itemStack.getItem.isInstanceOf[ItemRubble] || itemStack.getItem.isInstanceOf[ItemDust]
return false
} }
/** Called each time the inventory changes */ /** Called each time the inventory changes */
override def onInventoryChanged() override def onInventoryChanged()
{ {
super.onInventoryChanged() super.onInventoryChanged()
sendDescPacket()
if (!world.isRemote)
sendDescPacket()
} }
override def read(buf: ByteBuf, id: Int, packetType: PacketType) override def read(buf: ByteBuf, id: Int, packetType: PacketType)
{ {
super.read(buf, id, packetType) super.read(buf, id, packetType)
buf <<< getInventory buf >>> getInventory
} }
override def write(buf: ByteBuf, id: Int) override def write(buf: ByteBuf, id: Int)
{ {
super.write(buf, id) super.write(buf, id)
buf >>> getInventory buf <<< getInventory
} }
/** /**

View file

@ -60,12 +60,14 @@ final object ResonantInduction
def init(evt: FMLInitializationEvent) def init(evt: FMLInitializationEvent)
{ {
ResonantPartFactory.init() ResonantPartFactory.init()
ResourceFactory.init()
loadables.init() loadables.init()
} }
@EventHandler @EventHandler
def postInit(evt: FMLPostInitializationEvent) def postInit(evt: FMLPostInitializationEvent)
{ {
ResourceFactory.generateAll()
loadables.postInit() loadables.postInit()
} }
} }