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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I'm using Modrinth as a launcher for a forge modpack on 1.20.1, and can't diagnose the issue on the crash log myself. Have tried repairing the Minecraft instillation as well as removing a few mods that have been problematic for me in the past to no avail. Crash log is below, if any further information is necessary let me know. Thank you! https://paste.ee/p/k6xnS
    • Hey folks. I am working on a custom "Mecha" entity (extended from LivingEntity) that the player builds up from blocks that should get modular stats depending on the used blocks. e.g. depending on what will be used for the legs, the entity will have a different jump strength. However, something unexpected is happening when trying to override a few of LivingEntity's functions and using my new own "Mecha" specific fields: instead of their actual instance-specific value, the default value is used (0f for a float, null for an object...) This is especially strange as when executing with the same entity from a point in the code specific to the mecha entity, the correct value is used. Here are some code snippets to better illustrate what I mean: /* The main Mecha class, cut down for brevity */ public class Mecha extends LivingEntity { protected float jumpMultiplier; //somewhere later during the code when spawning the entity, jumpMultiplier is set to something like 1.5f //changing the access to public didn't help @Override //Overridden from LivingEntity, this function is only used in the jumpFromGround() function, used in the aiStep() function, used in the LivingEntity tick() function protected float getJumpPower() { //something is wrong with this function //for some reason I can't correctly access the fields and methods from the instanciated entity when I am in one of those overridden protected functions. this is very annoying LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 0f return this.jumpMultiplier * super.getJumpPower(); } //The code above does not operate properly. Written as is, the entity will not jump, and adding debug logs shows that when executing the code, the value of this.jumpMultiplier is 0f //in contrast, it will be the correct value when done here: @Override public void tick() { super.tick(); //inherited LivingEntity logic //Custom logic LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 1.5f } } My actual code is slightly different, as the jumpMuliplier is stored in another object (so I am calling "this.legModule.getJumpPower()" instead of the float), but even using a simple float exactly like in the code above didn't help. When running my usual code, the object I try to use is found to be null instead, leading to a crash from a nullPointerException. Here is the stacktrace of said crash: The full code can be viewed here. I have found a workaround in the case of jump strength, but have already found the same problem for another parameter I want to do, and I do not understand why the code is behaving as such, and I would very much like to be able to override those methods as intended - they seemed to work just fine like that for vanilla mobs... Any clues as to what may be happening here?
    • Please delete post. Had not noticed the newest edition for 1.20.6 which resolves the issue.
    • https://paste.ee/p/GTgAV Here's my debug log, I'm on 1.18.2 with forge 40.2.4 and I just want to get it to work!! I cant find any mod names in the error part and I would like some help from the pros!! I have 203 mods at the moment.
  • Topics

×
×
  • Create New...

Important Information

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