Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new textures for wireless coloring #15

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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)
Expand Down Expand Up @@ -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"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -173,15 +173,32 @@ 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(
side: ForgeDirection,
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
}

Expand Down