diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_off.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_off.png index e3e6a11..39f40ab 100644 Binary files a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_off.png and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_off.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on.png deleted file mode 100644 index ae74228..0000000 Binary files a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on.png and /dev/null differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on1.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on1.png new file mode 100644 index 0000000..4ec707b Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on1.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on10.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on10.png new file mode 100644 index 0000000..89a9b41 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on10.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on11.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on11.png new file mode 100644 index 0000000..25e72e6 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on11.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on12.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on12.png new file mode 100644 index 0000000..11c0f06 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on12.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on13.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on13.png new file mode 100644 index 0000000..c7f7934 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on13.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on14.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on14.png new file mode 100644 index 0000000..8c3d5f1 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on14.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on15.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on15.png new file mode 100644 index 0000000..f573508 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on15.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on16.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on16.png new file mode 100644 index 0000000..52bbd9e Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on16.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on17.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on17.png new file mode 100644 index 0000000..9e876de Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on17.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on2.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on2.png new file mode 100644 index 0000000..8322559 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on2.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on3.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on3.png new file mode 100644 index 0000000..34dcfc4 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on3.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on4.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on4.png new file mode 100644 index 0000000..c5cb4d6 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on4.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on5.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on5.png new file mode 100644 index 0000000..99a2ea9 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on5.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on6.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on6.png new file mode 100644 index 0000000..dfb149b Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on6.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on7.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on7.png new file mode 100644 index 0000000..368a4db Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on7.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on8.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on8.png new file mode 100644 index 0000000..e2f6f46 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on8.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on9.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on9.png new file mode 100644 index 0000000..182bba8 Binary files /dev/null and b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/side_on9.png differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_off.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_off.png deleted file mode 100644 index ba716e3..0000000 Binary files a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_off.png and /dev/null differ diff --git a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_on.png b/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_on.png deleted file mode 100644 index 315e50a..0000000 Binary files a/src/main/resources/assets/ae2stuff/textures/blocks/wireless/top_on.png and /dev/null differ diff --git a/src/main/scala/net/bdew/ae2stuff/machines/wireless/BlockWireless.scala b/src/main/scala/net/bdew/ae2stuff/machines/wireless/BlockWireless.scala index 9c972d1..4e53c60 100644 --- a/src/main/scala/net/bdew/ae2stuff/machines/wireless/BlockWireless.scala +++ b/src/main/scala/net/bdew/ae2stuff/machines/wireless/BlockWireless.scala @@ -9,6 +9,7 @@ package net.bdew.ae2stuff.machines.wireless +import appeng.api.util.AEColor import appeng.items.tools.quartz.ToolQuartzCuttingKnife import cpw.mods.fml.relauncher.{Side, SideOnly} import net.bdew.ae2stuff.misc.{BlockWrenchable, MachineMaterial} @@ -20,7 +21,8 @@ import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.ItemStack import net.minecraft.util.IIcon -import net.minecraft.world.World +import net.minecraft.world.{IBlockAccess, World} +import net.minecraftforge.common.util.ForgeDirection object BlockWireless extends SimpleBlock("Wireless", MachineMaterial) @@ -79,30 +81,41 @@ object BlockWireless false } - var icon_on_side: IIcon = null - var icon_off_side: IIcon = null - var icon_on_top: IIcon = null - var icon_off_top: IIcon = null + var icon_on: List[IIcon] = null + var icon_off: IIcon = null @SideOnly(Side.CLIENT) - override def getIcon(side: Int, meta: Int): IIcon = - if (side == 0 || side == 1) { - if (meta > 0) - icon_on_top - else - icon_off_top - } else { - if (meta > 0) - icon_on_side - else - icon_off_side + override def getIcon( + worldIn: IBlockAccess, + x: Int, + y: Int, + z: Int, + side: Int + ): IIcon = { + val te = worldIn.getTileEntity(x, y, z) + val meta = worldIn.getBlockMetadata(x, y, z) + + if (te.isInstanceOf[TileWireless]) { + if (meta > 0) { + val color = te.asInstanceOf[TileWireless].color.ordinal() + return icon_on.apply(color) + } } + icon_off + } + + override def getIcon(side: Int, meta: Int): IIcon = { + icon_on.apply(AEColor.Transparent.ordinal()) + } @SideOnly(Side.CLIENT) override def registerBlockIcons(reg: IIconRegister): Unit = { - icon_on_side = reg.registerIcon(Misc.iconName(modId, name, "side_on")) - icon_off_side = reg.registerIcon(Misc.iconName(modId, name, "side_off")) - icon_on_top = reg.registerIcon(Misc.iconName(modId, name, "top_on")) - icon_off_top = reg.registerIcon(Misc.iconName(modId, name, "top_off")) + val index = 1.to(17) + icon_on = index + .map(index => + reg.registerIcon(Misc.iconName(modId, name, "side_on" + index)) + ) + .toList + icon_off = reg.registerIcon(Misc.iconName(modId, name, "side_off")) } } diff --git a/src/main/scala/net/bdew/ae2stuff/machines/wireless/TileWireless.scala b/src/main/scala/net/bdew/ae2stuff/machines/wireless/TileWireless.scala index 8193ff6..61dd7f3 100644 --- a/src/main/scala/net/bdew/ae2stuff/machines/wireless/TileWireless.scala +++ b/src/main/scala/net/bdew/ae2stuff/machines/wireless/TileWireless.scala @@ -14,12 +14,12 @@ import appeng.api.AEApi import appeng.api.implementations.tiles.IColorableTile import appeng.api.networking.{GridFlags, IGridConnection} import appeng.api.util.AEColor -import appeng.me.helpers.AENetworkProxy import net.bdew.ae2stuff.AE2Stuff import net.bdew.ae2stuff.grid.{GridTile, VariableIdlePower} import net.bdew.lib.block.BlockRef import net.bdew.lib.data.base.{TileDataSlots, UpdateKind} import net.bdew.lib.multiblock.data.DataSlotPos +import net.bdew.lib.nbt.NBT import net.minecraft.block.Block import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.ItemStack @@ -173,6 +173,16 @@ class TileWireless } val colorIdx = t.getShort("Color").toInt this.color = AEColor.values().apply(colorIdx) + if (hasWorldObj) { + worldObj.markBlockRangeForRenderUpdate( + xCoord, + yCoord, + zCoord, + xCoord, + yCoord, + zCoord + ) + } } override def recolourBlock( @@ -180,8 +190,15 @@ class TileWireless colour: AEColor, who: EntityPlayer ): Boolean = { + if (this.color == colour) { + return false + } this.color = colour - this.getGridNode(side).updateState() + if (getGridNode(side) != null) { + getGridNode(side).updateState() + worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) +// markDirty() + } true }