mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #2285 from PewPewCricket/master
Add Paintable Network Cable
This commit is contained in:
commit
d389a2cf84
@ -34,6 +34,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
import net.minecraftforge.fluids.FluidRegistry;
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
@ -803,6 +804,7 @@ public class ModBlocks {
|
|||||||
public static Block radio_torch_reader;
|
public static Block radio_torch_reader;
|
||||||
public static Block radio_torch_controller;
|
public static Block radio_torch_controller;
|
||||||
public static Block radio_telex;
|
public static Block radio_telex;
|
||||||
|
public static Block oc_cable_paintable;
|
||||||
|
|
||||||
public static Block conveyor;
|
public static Block conveyor;
|
||||||
public static Block conveyor_express;
|
public static Block conveyor_express;
|
||||||
@ -2340,6 +2342,10 @@ public class ModBlocks {
|
|||||||
absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink");
|
absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink");
|
||||||
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
||||||
|
|
||||||
|
if (Loader.isModLoaded("OpenComputers")) {
|
||||||
|
oc_cable_paintable = new BlockOpenComputersCablePaintable().setBlockName("oc_cable_paintable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||||
|
}
|
||||||
|
|
||||||
volcano_core = new BlockVolcano().setBlockName("volcano_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_core");
|
volcano_core = new BlockVolcano().setBlockName("volcano_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_core");
|
||||||
volcano_rad_core = new BlockVolcano().setBlockName("volcano_rad_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_rad_core");
|
volcano_rad_core = new BlockVolcano().setBlockName("volcano_rad_core").setBlockUnbreakable().setResistance(10000.0F).setCreativeTab(MainRegistry.nukeTab).setBlockTextureName(RefStrings.MODID + ":volcano_rad_core");
|
||||||
|
|
||||||
@ -3532,6 +3538,11 @@ public class ModBlocks {
|
|||||||
GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName());
|
GameRegistry.registerBlock(gas_explosive, gas_explosive.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName());
|
GameRegistry.registerBlock(vacuum, vacuum.getUnlocalizedName());
|
||||||
|
|
||||||
|
// OC Compat Items
|
||||||
|
if (Loader.isModLoaded("OpenComputers")) {
|
||||||
|
register(oc_cable_paintable);
|
||||||
|
}
|
||||||
|
|
||||||
//???
|
//???
|
||||||
GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName());
|
GameRegistry.registerBlock(crystal_virus, crystal_virus.getUnlocalizedName());
|
||||||
GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName());
|
GameRegistry.registerBlock(crystal_hardened, crystal_hardened.getUnlocalizedName());
|
||||||
|
|||||||
@ -0,0 +1,344 @@
|
|||||||
|
package com.hbm.blocks.network;
|
||||||
|
|
||||||
|
import api.hbm.block.IToolable;
|
||||||
|
import com.hbm.blocks.IBlockMultiPass;
|
||||||
|
import com.hbm.interfaces.ICopiable;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.render.block.RenderBlockMultipass;
|
||||||
|
import com.hbm.tileentity.TileEntityLoadedBase;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import li.cil.oc.api.network.Environment;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.Packet;
|
||||||
|
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import li.cil.oc.api.network.Message;
|
||||||
|
import li.cil.oc.api.network.Node;
|
||||||
|
import li.cil.oc.api.Network;
|
||||||
|
import li.cil.oc.api.network.Visibility;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
import li.cil.oc.api.network.SidedEnvironment;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import li.cil.oc.api.internal.Colored;
|
||||||
|
import com.hbm.handler.CompatHandler.OCColors;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class BlockOpenComputersCablePaintable extends BlockContainer implements IToolable, IBlockMultiPass {
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT) protected IIcon overlay;
|
||||||
|
@SideOnly(Side.CLIENT) protected IIcon overlayColor;
|
||||||
|
|
||||||
|
public BlockOpenComputersCablePaintable() {
|
||||||
|
super(Material.iron);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
|
return new TileEntityOpenComputersCablePaintable();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void registerBlockIcons(IIconRegister reg) {
|
||||||
|
this.blockIcon = reg.registerIcon(RefStrings.MODID + ":oc_cable_base");
|
||||||
|
this.overlay = reg.registerIcon(RefStrings.MODID + ":oc_cable_overlay");
|
||||||
|
this.overlayColor = reg.registerIcon(RefStrings.MODID + ":oc_cable_color");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if(tile instanceof TileEntityOpenComputersCablePaintable) {
|
||||||
|
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||||
|
|
||||||
|
if(pipe.block != null) {
|
||||||
|
if(RenderBlockMultipass.currentPass == 1) {
|
||||||
|
return this.overlay;
|
||||||
|
} else if(RenderBlockMultipass.currentPass == 2) {
|
||||||
|
return this.overlayColor;
|
||||||
|
} else {
|
||||||
|
return pipe.block.getIcon(side, pipe.meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return RenderBlockMultipass.currentPass == 1 ? this.overlay : RenderBlockMultipass.currentPass == 2 ? this.overlayColor : this.blockIcon;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z) {
|
||||||
|
if (RenderBlockMultipass.currentPass == 2) {
|
||||||
|
TileEntityOpenComputersCablePaintable tile = (TileEntityOpenComputersCablePaintable) world.getTileEntity(x, y, z);
|
||||||
|
if (tile == null)
|
||||||
|
return 0xffffff;
|
||||||
|
|
||||||
|
return tile.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0xffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float fX, float fY, float fZ) {
|
||||||
|
|
||||||
|
ItemStack stack = player.getHeldItem();
|
||||||
|
|
||||||
|
if (stack == null)
|
||||||
|
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||||
|
|
||||||
|
if (stack.getItem() instanceof ItemBlock) {
|
||||||
|
ItemBlock ib = (ItemBlock) stack.getItem();
|
||||||
|
Block block = ib.field_150939_a;
|
||||||
|
|
||||||
|
if(block.renderAsNormalBlock() && block != this) {
|
||||||
|
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if(tile instanceof TileEntityOpenComputersCablePaintable) {
|
||||||
|
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||||
|
|
||||||
|
if(pipe.block == null) {
|
||||||
|
pipe.block = block;
|
||||||
|
pipe.meta = stack.getItemDamage() & 15;
|
||||||
|
world.markBlockForUpdate(x, y, z);
|
||||||
|
pipe.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
boolean isDye = false;
|
||||||
|
int[] dicts = OreDictionary.getOreIDs(stack);
|
||||||
|
for (int dict : dicts) {
|
||||||
|
String dictName = OreDictionary.getOreName(dict);
|
||||||
|
if (dictName.equals("dye"))
|
||||||
|
isDye = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isDye) {
|
||||||
|
TileEntityOpenComputersCablePaintable tile = (TileEntityOpenComputersCablePaintable) world.getTileEntity(x, y, z);
|
||||||
|
tile.setColor(OCColors.fromDye(stack).getColor());
|
||||||
|
world.markBlockForUpdate(x, y, z);
|
||||||
|
tile.markDirty();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onBlockActivated(world, x, y, z, player, side, fX, fY, fZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
|
||||||
|
|
||||||
|
if(tool != ToolType.SCREWDRIVER) return false;
|
||||||
|
|
||||||
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if(tile instanceof TileEntityOpenComputersCablePaintable) {
|
||||||
|
TileEntityOpenComputersCablePaintable pipe = (TileEntityOpenComputersCablePaintable) tile;
|
||||||
|
|
||||||
|
if(pipe.block != null) {
|
||||||
|
pipe.block = null;
|
||||||
|
world.markBlockForUpdate(x, y, z);
|
||||||
|
pipe.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getPasses() {
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderType(){
|
||||||
|
return IBlockMultiPass.getRenderType();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Optional.InterfaceList({
|
||||||
|
@Optional.Interface(iface = "li.cil.oc.api.network.Environment", modid = "OpenComputers"),
|
||||||
|
@Optional.Interface(iface = "li.cil.oc.api.network.SidedEnvironment", modid = "OpenComputers"),
|
||||||
|
@Optional.Interface(iface = "li.cil.oc.api.network.Colored", modid = "OpenComputers")
|
||||||
|
})
|
||||||
|
public static class TileEntityOpenComputersCablePaintable extends TileEntityLoadedBase implements Environment, SidedEnvironment, Colored, ICopiable {
|
||||||
|
|
||||||
|
protected Node node;
|
||||||
|
protected boolean addedToNetwork = false;
|
||||||
|
|
||||||
|
private Block block;
|
||||||
|
private int meta;
|
||||||
|
private Block lastBlock;
|
||||||
|
private int lastMeta;
|
||||||
|
private OCColors color = OCColors.LIGHTGRAY;
|
||||||
|
|
||||||
|
public TileEntityOpenComputersCablePaintable() {
|
||||||
|
node = Network.newNode(this, Visibility.None).create();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateEntity() {
|
||||||
|
super.updateEntity();
|
||||||
|
|
||||||
|
if(worldObj.isRemote && (lastBlock != block || lastMeta != meta)) {
|
||||||
|
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||||
|
lastBlock = block;
|
||||||
|
lastMeta = meta;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!this.getWorldObj().isRemote && !addedToNetwork) {
|
||||||
|
addedToNetwork = true;
|
||||||
|
Network.joinOrCreateNetwork(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet getDescriptionPacket() {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
this.writeToNBT(nbt);
|
||||||
|
return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, 0, nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||||
|
this.readFromNBT(pkt.func_148857_g());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
super.readFromNBT(nbt);
|
||||||
|
int id = nbt.getInteger("block");
|
||||||
|
this.block = id == 0 ? null : Block.getBlockById(id);
|
||||||
|
this.meta = nbt.getInteger("meta");
|
||||||
|
|
||||||
|
this.color = OCColors.fromInt(nbt.getInteger("dyeColor"));
|
||||||
|
|
||||||
|
if (node != null && node.host() == this) {
|
||||||
|
node.load(nbt.getCompoundTag("oc:node"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
|
super.writeToNBT(nbt);
|
||||||
|
if(block != null) nbt.setInteger("block", Block.getIdFromBlock(block));
|
||||||
|
nbt.setInteger("meta", meta);
|
||||||
|
|
||||||
|
nbt.setInteger("dyeColor", color.getColor());
|
||||||
|
|
||||||
|
if (node != null && node.host() == this) {
|
||||||
|
final NBTTagCompound nodeNbt = new NBTTagCompound();
|
||||||
|
node.save(nodeNbt);
|
||||||
|
nbt.setTag("oc:node", nodeNbt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public NBTTagCompound getSettings(World world, int x, int y, int z) {
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
if(block != null) {
|
||||||
|
nbt.setInteger("paintblock", Block.getIdFromBlock(block));
|
||||||
|
nbt.setInteger("paintmeta", meta);
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pasteSettings(NBTTagCompound nbt, int index, World world, EntityPlayer player, int x, int y, int z) {
|
||||||
|
if(nbt.hasKey("paintblock")) {
|
||||||
|
this.block = Block.getBlockById(nbt.getInteger("paintblock"));
|
||||||
|
this.meta = nbt.getInteger("paintmeta");
|
||||||
|
this.color = OCColors.fromInt(nbt.getInteger("dyeColor"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// OC Cable Things
|
||||||
|
@Override
|
||||||
|
public Node node() {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Node sidedNode(ForgeDirection side) {
|
||||||
|
if (side == ForgeDirection.UNKNOWN)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
int neighborX = super.xCoord + side.offsetX;
|
||||||
|
int neighborY = super.yCoord + side.offsetY;
|
||||||
|
int neighborZ = super.zCoord + side.offsetZ;
|
||||||
|
TileEntity neighbor = worldObj.getTileEntity(neighborX, neighborY, neighborZ);
|
||||||
|
|
||||||
|
// If a cable does not support colors but is a valid cable block, allow it to connect regardless of color.
|
||||||
|
if (!(neighbor instanceof Colored)) {
|
||||||
|
if (neighbor instanceof Environment)
|
||||||
|
return node;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
Colored cable = (Colored) neighbor;
|
||||||
|
if (cable.getColor() == color.getColor())
|
||||||
|
return node;
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onConnect(Node node) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDisconnect(Node node) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessage(Message message) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChunkUnload() {
|
||||||
|
super.onChunkUnload();
|
||||||
|
if (node != null) node.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void invalidate() {
|
||||||
|
super.invalidate();
|
||||||
|
if (node != null) node.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canConnect(net.minecraftforge.common.util.ForgeDirection side) {
|
||||||
|
if (side == ForgeDirection.UNKNOWN)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int neighborX = super.xCoord + side.offsetX;
|
||||||
|
int neighborY = super.yCoord + side.offsetY;
|
||||||
|
int neighborZ = super.zCoord + side.offsetZ;
|
||||||
|
TileEntity neighbor = worldObj.getTileEntity(neighborX, neighborY, neighborZ);
|
||||||
|
|
||||||
|
// If a cable does not support colors but is a valid cable block, allow it to connect regardless of color.
|
||||||
|
if (!(neighbor instanceof Colored)) {
|
||||||
|
return neighbor instanceof Environment;
|
||||||
|
}
|
||||||
|
|
||||||
|
Colored cable = (Colored) neighbor;
|
||||||
|
return cable.getColor() == color.getColor();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(int newColor) {
|
||||||
|
color = OCColors.fromInt(newColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return color.getColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,11 +1,13 @@
|
|||||||
package com.hbm.handler;
|
package com.hbm.handler;
|
||||||
|
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.network.BlockOpenComputersCablePaintable;
|
||||||
import com.hbm.inventory.RecipesCommon;
|
import com.hbm.inventory.RecipesCommon;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
import com.hbm.lib.RefStrings;
|
import com.hbm.lib.RefStrings;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
|
import com.hbm.util.ItemStackUtil;
|
||||||
import cpw.mods.fml.common.Loader;
|
import cpw.mods.fml.common.Loader;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import li.cil.oc.api.Items;
|
import li.cil.oc.api.Items;
|
||||||
@ -15,6 +17,7 @@ import li.cil.oc.api.machine.Context;
|
|||||||
import li.cil.oc.api.network.*;
|
import li.cil.oc.api.network.*;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -108,27 +111,66 @@ public class CompatHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple enum for mapping OC color ordinals to a nicer format for adding new disks.
|
* Simple enum for mapping OC color ordinals to a nicer format for adding new disks.
|
||||||
*/
|
*/
|
||||||
public enum OCColors {
|
public enum OCColors {
|
||||||
BLACK, //0x444444
|
BLACK(0x444444, "dyeBlack"),
|
||||||
RED, //0xB3312C
|
RED(0xB3312C, "dyeRed"),
|
||||||
GREEN, //0x339911
|
GREEN(0x339911, "dyeGreen"),
|
||||||
BROWN, //0x51301A
|
BROWN(0x51301A, "dyeBrown"),
|
||||||
BLUE, //0x6666FF
|
BLUE(0x6666FF, "dyeBlue"),
|
||||||
PURPLE, //0x7B2FBE
|
PURPLE(0x7B2FBE, "dyePurple"),
|
||||||
CYAN, //0x66FFFF
|
CYAN(0x66FFFF, "dyeCyan"),
|
||||||
LIGHTGRAY, //0xABABAB
|
LIGHTGRAY(0xABABAB, "dyeLightGray"),
|
||||||
GRAY, //0x666666
|
GRAY(0x666666, "dyeGray"),
|
||||||
PINK, //0xD88198
|
PINK(0xD88198, "dyePink"),
|
||||||
LIME, //0x66FF66
|
LIME(0x66FF66, "dyeLime"),
|
||||||
YELLOW, //0xFFFF66
|
YELLOW(0xFFFF66, "dyeYellow"),
|
||||||
LIGHTBLUE, //0xAAAAFF
|
LIGHTBLUE(0xAAAAFF, "dyeLightBlue"),
|
||||||
MAGENTA, //0xC354CD
|
MAGENTA(0xC354CD, "dyeMagenta"),
|
||||||
ORANGE, //0xEB8844
|
ORANGE(0xEB8844, "dyeOrange"),
|
||||||
WHITE //0xF0F0F0
|
WHITE(0xF0F0F0, "dyeWhite"),
|
||||||
}
|
NONE(0x0, "");
|
||||||
|
|
||||||
|
private final int color;
|
||||||
|
private final String dictName;
|
||||||
|
|
||||||
|
OCColors(int color, String dictName) {
|
||||||
|
this.color = color;
|
||||||
|
this.dictName = dictName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OCColors fromInt(int intColor) {
|
||||||
|
for (OCColors iColor : OCColors.values()) {
|
||||||
|
if (intColor == iColor.getColor())
|
||||||
|
return iColor;
|
||||||
|
}
|
||||||
|
return OCColors.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OCColors fromDye(ItemStack stack) {
|
||||||
|
List<String> oreNames = ItemStackUtil.getOreDictNames(stack);
|
||||||
|
|
||||||
|
for(String dict : oreNames) {
|
||||||
|
if(!(dict.length() > 3) || !dict.startsWith("dye"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (OCColors color : OCColors.values()) {
|
||||||
|
if(!color.dictName.equals(dict))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return OCColors.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Where all disks are stored with their name and `FloppyDisk` class.
|
// Where all disks are stored with their name and `FloppyDisk` class.
|
||||||
public static HashMap<String, FloppyDisk> disks = new HashMap<>();
|
public static HashMap<String, FloppyDisk> disks = new HashMap<>();
|
||||||
|
|||||||
@ -237,6 +237,8 @@ public class CraftingManager {
|
|||||||
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', BE.ingot(), 'R', ModItems.coil_tungsten, 'W', CU.plateCast(), 'F', Item.getItemFromBlock(Blocks.furnace) });
|
addRecipeAuto(new ItemStack(Item.getItemFromBlock(ModBlocks.machine_electric_furnace_off), 1), new Object[] { "BBB", "WFW", "RRR", 'B', BE.ingot(), 'R', ModItems.coil_tungsten, 'W', CU.plateCast(), 'F', Item.getItemFromBlock(Blocks.furnace) });
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.red_wire_coated, 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.plate_polymer, 'I', MINGRADE.ingot(), 'R', MINGRADE.wireFine() });
|
addRecipeAuto(new ItemStack(ModBlocks.red_wire_coated, 16), new Object[] { "WRW", "RIR", "WRW", 'W', ModItems.plate_polymer, 'I', MINGRADE.ingot(), 'R', MINGRADE.wireFine() });
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.red_cable_paintable, 16), new Object[] { "WRW", "RIR", "WRW", 'W', STEEL.plate(), 'I', MINGRADE.ingot(), 'R', MINGRADE.wireFine() });
|
addRecipeAuto(new ItemStack(ModBlocks.red_cable_paintable, 16), new Object[] { "WRW", "RIR", "WRW", 'W', STEEL.plate(), 'I', MINGRADE.ingot(), 'R', MINGRADE.wireFine() });
|
||||||
|
if (ModBlocks.oc_cable_paintable != null)
|
||||||
|
addRecipeAuto(new ItemStack(ModBlocks.oc_cable_paintable, 16), new Object[] { "WRW", "RIR", "WRW", 'W', STEEL.plate(), 'I', REDSTONE.dust(), 'R', MINGRADE.wireFine() });
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.cable_switch, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.red_wire_coated });
|
addRecipeAuto(new ItemStack(ModBlocks.cable_switch, 1), new Object[] { "S", "W", 'S', Blocks.lever, 'W', ModBlocks.red_wire_coated });
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.cable_detector, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.red_wire_coated });
|
addRecipeAuto(new ItemStack(ModBlocks.cable_detector, 1), new Object[] { "S", "W", 'S', REDSTONE.dust(), 'W', ModBlocks.red_wire_coated });
|
||||||
addRecipeAuto(new ItemStack(ModBlocks.cable_diode, 1), new Object[] { " Q ", "CAC", " Q ", 'Q', SI.nugget(), 'C', ModBlocks.red_cable, 'A', AL.ingot() });
|
addRecipeAuto(new ItemStack(ModBlocks.cable_diode, 1), new Object[] { " Q ", "CAC", " Q ", 'Q', SI.nugget(), 'C', ModBlocks.red_cable, 'A', AL.ingot() });
|
||||||
|
|||||||
@ -40,6 +40,7 @@ import com.hbm.blocks.network.FluidDuctPaintable.TileEntityPipePaintable;
|
|||||||
import com.hbm.blocks.network.FluidDuctPaintableBlockExhaust.TileEntityPipeExhaustPaintable;
|
import com.hbm.blocks.network.FluidDuctPaintableBlockExhaust.TileEntityPipeExhaustPaintable;
|
||||||
import com.hbm.blocks.network.FluidPump.TileEntityFluidPump;
|
import com.hbm.blocks.network.FluidPump.TileEntityFluidPump;
|
||||||
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
|
import com.hbm.blocks.rail.RailStandardSwitch.TileEntityRailSwitch;
|
||||||
|
import com.hbm.blocks.network.BlockOpenComputersCablePaintable.TileEntityOpenComputersCablePaintable;
|
||||||
import com.hbm.tileentity.bomb.*;
|
import com.hbm.tileentity.bomb.*;
|
||||||
import com.hbm.tileentity.deco.*;
|
import com.hbm.tileentity.deco.*;
|
||||||
import com.hbm.tileentity.machine.*;
|
import com.hbm.tileentity.machine.*;
|
||||||
@ -50,6 +51,7 @@ import com.hbm.tileentity.machine.rbmk.*;
|
|||||||
import com.hbm.tileentity.machine.storage.*;
|
import com.hbm.tileentity.machine.storage.*;
|
||||||
import com.hbm.tileentity.network.*;
|
import com.hbm.tileentity.network.*;
|
||||||
import com.hbm.tileentity.turret.*;
|
import com.hbm.tileentity.turret.*;
|
||||||
|
import cpw.mods.fml.common.Loader;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
@ -451,6 +453,13 @@ public class TileMappings {
|
|||||||
put(TileEntityDroneRequester.class, "tileentity_drone_requester");
|
put(TileEntityDroneRequester.class, "tileentity_drone_requester");
|
||||||
|
|
||||||
put(TileEntityRailSwitch.class, "tileentity_rail_switch");
|
put(TileEntityRailSwitch.class, "tileentity_rail_switch");
|
||||||
|
|
||||||
|
// OC Compat items
|
||||||
|
boolean ocPresent = Loader.isModLoaded("OpenComputers");
|
||||||
|
|
||||||
|
if (ocPresent) {
|
||||||
|
put(TileEntityOpenComputersCablePaintable.class, "tileentity_oc_cable_paintable");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void put(Class<? extends TileEntity> clazz, String... names) {
|
private static void put(Class<? extends TileEntity> clazz, String... names) {
|
||||||
|
|||||||
@ -6230,3 +6230,5 @@ desc.gui.upgrade.effectiveness= * §aEffectiveness§r: Stacks to level 3
|
|||||||
desc.gui.upgrade.overdrive= * §7Overdrive§r: Stacks to level 3
|
desc.gui.upgrade.overdrive= * §7Overdrive§r: Stacks to level 3
|
||||||
desc.gui.upgrade.power= * §1Power-Saving§r: Stacks to level 3
|
desc.gui.upgrade.power= * §1Power-Saving§r: Stacks to level 3
|
||||||
desc.gui.upgrade.speed= * §4Speed§r: Stacks to level 3
|
desc.gui.upgrade.speed= * §4Speed§r: Stacks to level 3
|
||||||
|
|
||||||
|
tile.oc_cable_paintable.name=Paintable Network Cable
|
||||||
|
|||||||
BIN
src/main/resources/assets/hbm/textures/blocks/oc_cable_base.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/oc_cable_base.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 612 B |
BIN
src/main/resources/assets/hbm/textures/blocks/oc_cable_color.png
Normal file
BIN
src/main/resources/assets/hbm/textures/blocks/oc_cable_color.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 111 B |
Binary file not shown.
|
After Width: | Height: | Size: 139 B |
Loading…
x
Reference in New Issue
Block a user