Jump to content

Custom cable?


Bamse5b

Recommended Posts

BTW, Heres my render code:

package CCTV;

import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
import java.io.InputStream;

public class RenderFineWire extends TileEntitySpecialRenderer{

public RenderFineWire(){
model = new ModelFineWire();
}

public void renderAModelAt(TileEntityFineWire tileEntity, double d, double d1, double d2, float f) {

int rotation = 0;
if(tileEntity.worldObj != null)
{
rotation = tileEntity.getBlockMetadata();
}
bindTextureByName("/mods/CCTV/textures/customBlocks/CameraTable.png"); //texture
GL11.glPushMatrix();
GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);

if (tileEntity.isConnected[0] != false)
{
model.renderBottom();
}
if (tileEntity.isConnected[1] != false)
{
model.renderTop();
}
if (tileEntity.isConnected[2] != false)
{
model.renderFront();
}
if (tileEntity.isConnected[3] != false)
{
model.renderBack();
}
if (tileEntity.isConnected[4] != false)
{
model.renderRight();
}
if (tileEntity.isConnected[5] != false)
{
model.renderLeft();
}

model.renderMiddle();
GL11.glPopMatrix();
}

private ModelFineWire model;

public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{
this.renderAModelAt((TileEntityFineWire)par1TileEntity, par2, par4, par6, par8);
}
}

Link to comment
Share on other sites

BTW, Heres my render code:

package CCTV;

import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;
import java.io.IOException;
import java.io.InputStream;

public class RenderFineWire extends TileEntitySpecialRenderer{

public RenderFineWire(){
model = new ModelFineWire();
}

public void renderAModelAt(TileEntityFineWire tileEntity, double d, double d1, double d2, float f) {

int rotation = 0;
if(tileEntity.worldObj != null)
{
rotation = tileEntity.getBlockMetadata();
}
bindTextureByName("/mods/CCTV/textures/customBlocks/CameraTable.png"); //texture
GL11.glPushMatrix();
GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);

if (tileEntity.isConnected[0] != false)
{
model.renderBottom();
}
if (tileEntity.isConnected[1] != false)
{
model.renderTop();
}
if (tileEntity.isConnected[2] != false)
{
model.renderFront();
}
if (tileEntity.isConnected[3] != false)
{
model.renderBack();
}
if (tileEntity.isConnected[4] != false)
{
model.renderRight();
}
if (tileEntity.isConnected[5] != false)
{
model.renderLeft();
}

model.renderMiddle();
GL11.glPopMatrix();
}

private ModelFineWire model;

public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
{
this.renderAModelAt((TileEntityFineWire)par1TileEntity, par2, par4, par6, par8);
}
}

Link to comment
Share on other sites

Isn't this:

if (tileEntity.isConnected[5] != false)
{
model.renderLeft();
}

 

Checking to see if the tileEntity has a connection to the left side, and if it is it will render the left side connection for your block?

For me it seems like the above code should work, if your renderLeft() method is written properly that is :P

 

I'm not sure if I see what your problem is, you're code seems fine, so since it's not working I wonder if this part of the code is copied from a tutorial or some other code?

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I didnt copy it, i just looked how other people did it and found out its the tile entity thats going to check if theres any other cables next to it. But I dont know how to check it, right now i can make a part visible if I change a false to true..

Link to comment
Share on other sites

Correct, but I only got this part working :P

package CCTV;

import net.minecraft.tileentity.TileEntity;

public class TileEntityFineWire extends TileEntity{

public boolean[] isConnected = { false, false, false, false, false, false };

public TileEntityFineWire()
{
}
}

Link to comment
Share on other sites

Yes I do understand what you mean, but I'm trying to ask you what logically must be true in order for it to connect to the left side?

 

Edit: I don't mean for you to tell me some code for it, just tell me what you believe is needed to be true in order for it to connect to the left.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

well I think you missed the question, I didn't ask if the method needs to be true, not about the code at all.

 

If you stop thinking about the code, just think that the system is working and everything is fine.

If the cable connects to the left side, what needs to be on the left side?

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I want it to connect to another cable!

1. Yes that's the answer, there needs to be another cable there!

So how do we check to see if there is a cable at that place? :)

 

WITHOUT changing false to true!

 

If you never will change the value false to true, what's the point of having them at all?

If the value can't change from true to false and back to true depending on it's connection status what's the point of the variable then? :P

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I want it to connect to another cable!

1. Yes that's the answer, there needs to be another cable there!

 

WITHOUT changing false to true!

 

If you never will change the value false to true, what's the point of having them at all?

If the value can't change from true to false and back to true depending on it's connection status what's the point of the variable then? :P

Do you understand that at all?! The variables are there so the code will CHANGE THEM when it detects another cable!! But im asking HOW TO DETECT IF THERE IS ANOTHER CABLE NEARBY!!!  >:(

Link to comment
Share on other sites

Yeah I know what they are meant to do and I understand the concept perfectly, but at the same time I'm trying to teach you how it works and I also try to point out that the statement you made would not work out.

 

I assumed you intended for them to change and not having to hard code them to be true or false.

But what you said was that you intended them to not change from false to true.

 

HOW TO DETECT IF THERE IS ANOTHER CABLE NEARBY!!!  >:(

So you told me you needed a cable to be at the left location in order to connect to it, right?

Well how do you detect if there's a block at a given position inn the world?

Is there a method to let you know what block is at a given x,y,z position?

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

1. I'm trying to help you and you get pissed at me.. makes me wonder why I bother use my spare time to answer logic questions inn the first place. Come'on man..

 

2. I know of the UE mod/framework and have used it earlier yeah, since you are looking at the code for it you could just see how he is checking if it's touching another cable? :P

 

3. I'm not sure I see you're problem really? My suggestion above would work to achieve what you asked for and you did not say "without checking the block" so WTF is your problem?

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Forget it, found out how... This was a little useless  :'(

Yeah.. you could just read the code on how UE is doing it, or said you wanted to do it like UE, or in general be more clear about what you wanted to achieve. As far as I can tell the problem you stated would be solvable by my suggestion of getting the block or te from the location to the left of the cable.. So I still don't see you're problem nor any reason for your anger.

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Forget it, found out how... This was a little useless  :'(

Yeah.. you could just read the code on how UE is doing it, or said you wanted to do it like UE, or in general be more clear about what you wanted to achieve. As far as I can tell the problem you stated would be solvable by my suggestion of getting the block or te from the location to the left of the cable.. So I still don't see you're problem nor any reason for your anger.

Bevause you could explain it good enogh for a guy thats not english -.-

Link to comment
Share on other sites

I'm sorry?

 

I tried my best to keep my English as decent and grammaticly correct as I could, and keep my terms as simple as possible to make it harder to misunderstand me as my english sucks. Considering that my english skills are quite limited due to the fact that I'm scandinavian and we lack a proper english educational system.

 

So I have no idea how I could in a simpler way ask you for your thoughts and poked you inn the correct direction?

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.