Cleanup and update changes to 1.7.2

This commit is contained in:
bdew committed 2014-06-18 11:37:56 +03:00
1 parent 5166576d30
commit 7a5982bf37
11 files changed
+27 -26

No files matched your search

+1 -1
View File
@@ -82,7 +82,7 @@ object Misc {
if (cls.isInstance(v)) Some(v.asInstanceOf[T]) else None
def getNeighbourTile[T](origin: TileEntity, dir: ForgeDirection, cls: Class[T]) =
Option(origin.getWorldObj.getBlockTileEntity(origin.xCoord + dir.offsetX,
Option(origin.getWorldObj.getTileEntity(origin.xCoord + dir.offsetX,
origin.yCoord + dir.offsetY, origin.zCoord + dir.offsetZ)) flatMap (asInstanceOpt(_, cls))
}
+2 -2
View File
@@ -29,8 +29,8 @@ class BlockManager() {
GameRegistry.registerCustomItemStack(name, new ItemStack(block))
if (block.isInstanceOf[HasTE[_]])
GameRegistry.registerTileEntity(block.asInstanceOf[HasTE[_]].TEClass,
"%s.%s".format(Misc.getActiveModId, name))
GameRegistry.registerTileEntity(block.asInstanceOf[HasTE[_]].TEClass,
"%s.%s".format(Misc.getActiveModId, name))
return block
}
+5 -4
View File
@@ -14,6 +14,7 @@ import net.minecraft.world.{IBlockAccess, World}
import net.minecraft.entity.player.EntityPlayer
import net.bdew.lib.Misc
import net.bdew.lib.items.ItemUtils
import net.minecraft.block.Block
trait BlockCoverable[T <: TileCoverable] extends HasTE[T] {
override def onBlockActivated(world: World, x: Int, y: Int, z: Int, player: EntityPlayer, face: Int, xoffs: Float, yoffs: Float, zoffs: Float): Boolean = {
@@ -52,17 +53,17 @@ trait BlockCoverable[T <: TileCoverable] extends HasTE[T] {
super.onBlockActivated(world, x, y, z, player, face, xoffs, yoffs, zoffs)
}
override def getBlockTexture(w: IBlockAccess, x: Int, y: Int, z: Int, side: Int) =
override def getIcon(w: IBlockAccess, x: Int, y: Int, z: Int, side: Int) =
(for {
coverStack <- Option(getTE(w, x, y, z).covers(Misc.forgeDirection(side)).cval)
coverItem <- Option(coverStack.getItem) flatMap (Misc.asInstanceOpt(_, classOf[ItemCover]))
} yield coverItem.getCoverIcon(coverStack)
) getOrElse super.getBlockTexture(w, x, y, z, side)
) getOrElse super.getIcon(w, x, y, z, side)
override def breakBlock(world: World, x: Int, y: Int, z: Int, blockId: Int, meta: Int) {
override def breakBlock(world: World, x: Int, y: Int, z: Int, block: Block, meta: Int) {
if (!world.isRemote)
for ((dir, covOpt) <- getTE(world, x, y, z).covers; cover <- Option(covOpt.cval))
ItemUtils.throwItemAt(world, x, y, z, cover)
super.breakBlock(world, x, y, z, blockId, meta)
super.breakBlock(world, x, y, z, block, meta)
}
}
+3 -3
View File
@@ -10,14 +10,14 @@
package net.bdew.lib.covers
import net.minecraft.item.{ItemStack, Item}
import net.minecraftforge.common.ForgeDirection
import net.minecraft.util.Icon
import net.minecraft.util.IIcon
import net.minecraftforge.common.util.ForgeDirection
trait ItemCover extends Item {
/**
* @return Icon to render, MUST be on terrain spritesheet (0), not item!
*/
def getCoverIcon(stack: ItemStack): Icon
def getCoverIcon(stack: ItemStack): IIcon
/**
* Perform tick, called on server only
+1 -1
View File
@@ -10,10 +10,10 @@
package net.bdew.lib.covers
import net.bdew.lib.data.base.{UpdateKind, TileDataSlots}
import net.minecraftforge.common.ForgeDirection
import net.bdew.lib.data.DataSlotItemStack
import net.bdew.lib.Misc
import net.minecraft.item.ItemStack
import net.minecraftforge.common.util.ForgeDirection
trait TileCoverable extends TileDataSlots {
val covers = (ForgeDirection.VALID_DIRECTIONS map { x =>
+1 -1
View File
@@ -16,7 +16,7 @@ import net.minecraft.entity.player.EntityPlayer
import net.minecraft.inventory.{ISidedInventory, IInventory}
import net.bdew.lib.Misc
import java.util.Random
import net.minecraftforge.common.ForgeDirection
import net.minecraftforge.common.util.ForgeDirection
object ItemUtils {
def throwItemAt(world: World, x: Int, y: Int, z: Int, stack: ItemStack) {
@@ -1,10 +1,10 @@
/*
* Copyright (c) bdew, 2014
* https://github.com/bdew/teleporter
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* 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/teleporter/master/MMPL-1.0.txt
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.network
+3 -3
View File
@@ -1,10 +1,10 @@
/*
* Copyright (c) bdew, 2014
* https://github.com/bdew/teleporter
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* 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/teleporter/master/MMPL-1.0.txt
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.network
@@ -1,10 +1,10 @@
/*
* Copyright (c) bdew, 2014
* https://github.com/bdew/teleporter
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* 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/teleporter/master/MMPL-1.0.txt
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.network
@@ -1,10 +1,10 @@
/*
* Copyright (c) bdew, 2014
* https://github.com/bdew/teleporter
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/bdlib
*
* 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/teleporter/master/MMPL-1.0.txt
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.network
@@ -1,10 +1,10 @@
/*
* Copyright (c) bdew, 2013 - 2014
* https://github.com/bdew/gendustry
* https://github.com/bdew/bdlib
*
* 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
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
*/
package net.bdew.lib.recipes.lootlist