mirror of
https://github.com/GTNewHorizons/gendustry.git
synced 2026-11-24 22:14:22 +00:00
Initial implementation of covers
This commit is contained in:
1 parent
c8a32236c0
commit
f237e87939
11 files changed
+111
-6
No files matched your search
+1
-1
@@ -19,7 +19,7 @@ apply plugin: 'forge'
|
||||
apply plugin: 'scala'
|
||||
|
||||
version = "1.1.3"
|
||||
ext.bdlibver = "1.2.2.45"
|
||||
ext.bdlibver = "1.2.3.47"
|
||||
ext.versuffix = "mc164"
|
||||
ext.apiVer = version
|
||||
|
||||
|
||||
@@ -27,6 +27,8 @@ item.gendustry.GeneSampleBlank.name=Blank Gene Sample
|
||||
item.gendustry.Waste.name=Genetic Waste
|
||||
item.gendustry.grafter.name=Industrial Grafter
|
||||
item.gendustry.scoop.name=Scooporator MX200 Turbo
|
||||
item.gendustry.ImportCover.name=Item Import Cover
|
||||
item.gendustry.EjectCover.name=Item Eject Cover
|
||||
|
||||
# ==== FLUIDS ====
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
@@ -10,7 +10,7 @@
|
||||
package net.bdew.gendustry.config
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry
|
||||
import net.bdew.gendustry.items.{IndustrialScoop, IndustrialGrafter, GeneTemplate, GeneSample}
|
||||
import net.bdew.gendustry.items._
|
||||
import net.bdew.gendustry.machines.apiary.upgrades.ItemApiaryUpgrade
|
||||
import net.bdew.lib.config.ItemManager
|
||||
import net.bdew.gendustry.Gendustry
|
||||
@@ -43,5 +43,8 @@ object Items extends ItemManager(Config.IDs) {
|
||||
regSimpleItem("UpgradeFrame")
|
||||
regSimpleItem("ClimateModule")
|
||||
|
||||
val coverEject = regItem(new EjectCover(ids.getItemId("EjectCover")))
|
||||
val coverImport = regItem(new ImportCover(ids.getItemId("ImportCover")))
|
||||
|
||||
Gendustry.logInfo("Items loaded")
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.items
|
||||
|
||||
import net.bdew.lib.items.{ItemUtils, SimpleItem}
|
||||
import net.bdew.lib.covers.{TileCoverable, ItemCover}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraft.inventory.{IInventory, ISidedInventory}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.lib.Misc
|
||||
|
||||
class EjectCover(id: Int) extends SimpleItem(id, "EjectCover") with ItemCover {
|
||||
override def getCoverIcon = itemIcon
|
||||
override def getSpriteNumber = 0
|
||||
|
||||
override def isValidTile(te: TileCoverable) = te.isInstanceOf[ISidedInventory with IInventory]
|
||||
|
||||
override def tickCover(te: TileCoverable, side: ForgeDirection): Unit = {
|
||||
if (te.worldObj.getTotalWorldTime % 20 != 0) return
|
||||
val inv = te.asInstanceOf[ISidedInventory with IInventory]
|
||||
for {
|
||||
target <- Misc.getNeighbourTile(te, side, classOf[IInventory])
|
||||
slot <- inv.getAccessibleSlotsFromSide(side.ordinal())
|
||||
stack <- Option(inv.getStackInSlot(slot))
|
||||
if inv.canExtractItem(slot, stack, side.ordinal())
|
||||
} {
|
||||
val slots = ItemUtils.getAccessibleSlotsFromSide(target, side.getOpposite)
|
||||
inv.setInventorySlotContents(slot, ItemUtils.addStackToSlots(stack, target, slots, true))
|
||||
inv.onInventoryChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/eject")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/gendustry
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/gendustry/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.gendustry.items
|
||||
|
||||
import net.bdew.lib.items.{ItemUtils, SimpleItem}
|
||||
import net.bdew.lib.covers.{TileCoverable, ItemCover}
|
||||
import net.minecraftforge.common.ForgeDirection
|
||||
import net.minecraft.inventory.{IInventory, ISidedInventory}
|
||||
import net.minecraft.client.renderer.texture.IconRegister
|
||||
import cpw.mods.fml.relauncher.{Side, SideOnly}
|
||||
import net.bdew.gendustry.Gendustry
|
||||
import net.bdew.lib.Misc
|
||||
|
||||
class ImportCover(id: Int) extends SimpleItem(id, "ImportCover") with ItemCover {
|
||||
override def getCoverIcon = itemIcon
|
||||
override def getSpriteNumber = 0
|
||||
|
||||
override def isValidTile(te: TileCoverable) = te.isInstanceOf[ISidedInventory]
|
||||
|
||||
override def tickCover(te: TileCoverable, side: ForgeDirection): Unit = {
|
||||
if (te.worldObj.getTotalWorldTime % 20 != 0) return
|
||||
val inv = te.asInstanceOf[ISidedInventory with IInventory]
|
||||
val insertSlots = inv.getAccessibleSlotsFromSide(side.ordinal())
|
||||
for {
|
||||
from <- Misc.getNeighbourTile(te, side, classOf[IInventory])
|
||||
slot <- ItemUtils.getAccessibleSlotsFromSide(from, side.getOpposite)
|
||||
stack <- Option(from.getStackInSlot(slot))
|
||||
if (Misc.asInstanceOpt(from, classOf[ISidedInventory]) map (_.canExtractItem(slot, stack, side.getOpposite.ordinal()))
|
||||
getOrElse true)
|
||||
} {
|
||||
from.setInventorySlotContents(slot, ItemUtils.addStackToSlots(stack, inv, insertSlots, true))
|
||||
from.onInventoryChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
override def registerIcons(reg: IconRegister) {
|
||||
itemIcon = reg.registerIcon(Gendustry.modId + ":covers/import")
|
||||
}
|
||||
}
|
||||
@@ -24,8 +24,13 @@ import net.bdew.gendustry.config.Machines
|
||||
import net.minecraft.entity.EntityLivingBase
|
||||
import net.minecraft.item.ItemStack
|
||||
import net.bdew.gendustry.gui.BlockGuiWrenchable
|
||||
import net.bdew.lib.covers.BlockCoverable
|
||||
|
||||
class BlockApiary(id: Int) extends Block(id, Material.rock) with HasTE[TileApiary] with BlockGuiWrenchable with BreakableInventoryBlock {
|
||||
class BlockApiary(id: Int) extends Block(id, Material.rock)
|
||||
with HasTE[TileApiary]
|
||||
with BlockGuiWrenchable
|
||||
with BlockCoverable[TileApiary]
|
||||
with BreakableInventoryBlock {
|
||||
private var icons: Array[Icon] = null
|
||||
val TEClass = classOf[TileApiary]
|
||||
lazy val guiId: Int = Machines.apiary.guiId
|
||||
|
||||
@@ -34,6 +34,7 @@ import net.bdew.gendustry.compat.triggers.ForestryErrorSource
|
||||
import net.bdew.gendustry.gui.rscontrol.TileRSContollable
|
||||
import net.bdew.gendustry.api.items.IApiaryUpgrade
|
||||
import net.bdew.gendustry.api.blocks.IIndustrialApiary
|
||||
import net.bdew.lib.covers.{ItemCover, TileCoverable}
|
||||
|
||||
class TileApiary extends TileExtended
|
||||
with TileDataSlots
|
||||
@@ -43,6 +44,7 @@ with BreakableInventoryTile
|
||||
with TilePowered
|
||||
with ForestryErrorSource
|
||||
with TileRSContollable
|
||||
with TileCoverable
|
||||
with IIndustrialApiary {
|
||||
|
||||
object slots {
|
||||
@@ -259,7 +261,9 @@ with IIndustrialApiary {
|
||||
|
||||
override def validate() {
|
||||
super.validate()
|
||||
if (worldObj!=null && !worldObj.isRemote)
|
||||
if (worldObj != null && !worldObj.isRemote)
|
||||
Sanity.check(this)
|
||||
}
|
||||
|
||||
override def isValidCover(side: ForgeDirection, cover: ItemCover) = true
|
||||
}
|
||||
@@ -20,8 +20,6 @@ class BaseDataProvider[T](cls: Class[T]) extends IWailaDataProvider {
|
||||
def getHeadStrings(target: T, stack: ItemStack, acc: IWailaDataAccessor, cfg: IWailaConfigHandler): Iterable[String] = None
|
||||
def getBodyStrings(target: T, stack: ItemStack, acc: IWailaDataAccessor, cfg: IWailaConfigHandler): Iterable[String] = None
|
||||
|
||||
println("BDP: %s < %s".format(this, cls))
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
final override def getWailaTail(itemStack: ItemStack, currenttip: util.List[String], accessor: IWailaDataAccessor, config: IWailaConfigHandler) = {
|
||||
|
||||
Reference in new issue
Block a user