This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
MindenCucc's profile picture

Custom computers

Started by MindenCucc, 19 May 2015 - 12:17 AM
MindenCucc #1
Posted 19 May 2015 - 02:17 AM
Hi!

I'm trying to make a custom computer. It works correctly, but it's invisible.
Spoiler

Here's the code:
Spoiler

comp = (BlockComputer) new BlockComputer().setBlockUnbreakable();
GameRegistry.registerBlock(comp, ItemComputer.class, "comp");

I suggest, that Dan should make some kind of code, that allows us to make custom computers.

And yes, those are the items for the invisible computers. :P/>

I've tried this with Forge#1360 with CC1.64-1.73, and still no luck.
Edited on 20 May 2015 - 02:10 PM
theoriginalbit #2
Posted 19 May 2015 - 02:30 AM
have you heard of inheritance?
MindenCucc #3
Posted 19 May 2015 - 02:52 AM
Sorry that I say this, but I'm not a noob in programming. I've tried almost everything possible. I've even made a custom TE, but the problem was that the redstone connection wasn't working, but the texture was. I have placed a breakpoint on getTexture(int side), and it looks like that it's never getting called.

Here's the inheritance:
Spoiler

A little peek inside cc.jar says, that it should call generic.getTexture, if the block has a TE, and it's a TileGeneric. On the image, my TE is clearly extending TileGeneric. I don't know what's going on now.
MindenCucc #4
Posted 20 May 2015 - 02:48 PM
Hmm… it looks like this is a weird bug in MC/Forge

Spoiler

It looks like that there's a syncing issue, because the client thinks, that there's no TE.
SquidDev #5
Posted 20 May 2015 - 02:53 PM
Is the code on GitHub, or somewhere public. I might be able to have a look - I doubt this is a bug with Forge and more likely your code somewhere, also shouldn't this be in Ask a Pro?
MindenCucc #6
Posted 20 May 2015 - 02:57 PM
Well, idk. This post is intended to show the hassle that I put into making a custom computer, thus showing Dan to extend the API to be able to make custom computers. And for the GitHub thing, I'll put it up, just wait a bit.

Edit: GitHub for Windows is a b****, but here's the repo, but I'm still uploading it.
Edited on 20 May 2015 - 01:40 PM
HPWebcamAble #7
Posted 22 May 2015 - 04:20 AM
Well I'm not going to pretend I know how to mod very well, but I have a single working mod prototype.


And this is how I make blocks with multisided textures:

@Override
public void registerBlockIcons(IIconRegister iconReg)
{
iconArray[1] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_top");
iconArray[0] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_bottom");
iconArray[2] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_side");
iconArray[3] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_side");
iconArray[4] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_side");
iconArray[5] = iconReg.registerIcon(StringLibrary.MODID + ":prefueled_furnace_front");
debug("Prefueled Furnace texture registered");
}

@Override
public IIcon getIcon(int side, int meta)
{
return iconArray[side];
}

This is in the block's class, not its tile entity's class

(Note my tile entity doesn't work, but the block textures do)
Edited on 22 May 2015 - 02:21 AM
MindenCucc #8
Posted 22 May 2015 - 01:17 PM
The getIcon is the problem. In BlockGenetic Dan added a final modifier to that function, so I can't override it.