Jump to content

Recommended Posts

Posted

Firstly I want to make my new custom block have a transparent section http://puu.sh/72piA/a97662d114.jpg

I want the blue part to be transparent, but im 99% sure I'm missing a step with minecraft because when i was modeling in techne it was exactly how I wanted it.

 

I'm currently running 1.6.4 forge, used techne to model the block and import into java.

 

This is the custom renderer.

 

import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import bigbaddevil7.supernova.SuperNovaInfo;
import bigbaddevil7.supernova.model.ModelCarbonGenerator;


public class RendererCarbonGenerator extends TileEntitySpecialRenderer{
    private static final ResourceLocation texture = new ResourceLocation(SuperNovaInfo.ID.toLowerCase(), "textures/model/generator.png");

    private ModelCarbonGenerator model;

    public RendererCarbonGenerator()
    {
        this.model = new ModelCarbonGenerator();
    }

    @Override    
    public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
        GL11.glRotatef(180, 0F, 0F, 1F);
        this.bindTexture(texture);
        GL11.glPushMatrix();
        model.renderModel(0.0625F);
        GL11.glPopMatrix();
        GL11.glPopMatrix();
    }
    
}

 

 

And yes i have done all of the getRenderType(), isOpaquecube() {return false;}, and renderAsNormalBlock{ return false;}.

 

Second question is since this is 2 blocks tall I made the setBlockBounds()

 this.setBlockBounds(0F, 0F, 0F, 1F, 2F, 1F); 

to mach accordingly, but the top part of the structure can still have blocks placed through this. How do I fix that problem as well

Posted

GL11.glEnable(GL11.GL_BLEND)

 

See line 95.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Alright I looked at the code and saw what you were taking about (by the way interesting model). It now renders see through how I wanted. When you look at the block out of the corner of your screen it gets the transparent part becomes brighter.

Posted

Alright I looked at the code and saw what you were taking about. It now renders see through how I wanted. When you look at the block out of the corner of your screen it gets the transparent part becomes brighter.

 

Not sure what's up with that.  Things near the edge of the view cone generally behave oddly anyway.

 

(by the way interesting model)

 

Thanks!

Here's a screenshot of it in the world.

(Hmm.  Need to double check the glass edges.  I think I saw them missing the edging the other day...)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

So does that case render the item that is placed in the slot? If so how did you go about doing it. I want some of my machines to render items hovering in locations. For example this machine here. http://puu.sh/72wvz/16f6819567.jpg

I would like for items to hover there to give the machine more of an effect that its working on its items.

 

It happens there in model class.  See line 60.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

I need to learn more about openGL. At this point I think it's slightly out of my league.

 

The OGL code there just rotates the item entity so it lays flat instead of standing upright.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Let me see if I understand this properly then. 1st you do a check to make sure that there is something there, if so you do some math to rotate it flat, and this

RenderManager.instance.renderEntityWithPosYaw(es.itemEnt, 0, 0, 0, 0, 0);

is the piece of code that actually displays the item?

 

The item you check gets passed from what I assume is the TileEntityClass for your pedestal that has a method called itemEnt()

Posted

Let me see if I understand this properly then. 1st you do a check to make sure that there is something there, if so you do some math to rotate it flat, and this

RenderManager.instance.renderEntityWithPosYaw(es.itemEnt, 0, 0, 0, 0, 0);

is the piece of code that actually displays the item?

 

The item you check gets passed from what I assume is the TileEntityClass for your pedestal that has a method called itemEnt()

 

All correct.

(Except that it's a field, not a method)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

hmmm. Will have to tinker with that. I was looking through the forums and you answered someones question which I have the same problem and it was the boundbox/hitbox post. You said in or order to properly make 2 tall hit boxes you should use two blocks like pistons. Can you describe how to go about doing that?

Posted

hmmm. Will have to tinker with that. I was looking through the forums and you answered someones question which I have the same problem and it was the boundbox/hitbox post. You said in or order to properly make 2 tall hit boxes you should use two blocks like pistons. Can you describe how to go about doing that?

 

Creating a new block, not putting it in the creative menu or giving it a recipe or anything (it's a technical block).  When your block is added to the world it checks the space above it for Material.air (this is better than checking for actually air, as some mods add blocks that should be treated like air).

If air: replace it with the technical block

If not air: drop self / prevent placement

 

Then when either block is broken it breaks the other block.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

so I would create a new block and not give it anything except what I need to register it to minecraft such as id and unlocalized name and in the onBlockAdded() have it places the block one above it? Minecraft differently has some interesting mechanics.

 

 

EDIT

Ive been looking on how doors does it's update and they use an onNeighborBlockChange() for its updates when the top or bottom block is destroyed.

And the canPlaceBlockAt() it checks to make sure its below y lvl 255 and then checks both the block below and the block up 1 above.

 

Is that correct? I'm missing the part where it adds the block above upon initial placement of the door.

 

The trickiest machine im going to have to do will be something like this

 

Looking from the top(S = source block, T = technical block, A = air block)

 

Layer 1:

ATA

TST

ATA

 

Layer 2: (Ycoord + 1)

ATA

TTT

ATA

 

I wasn't planning on working with the onNeighborBlockChange() until after this when I would learn how to make multiblock structures, but that kinda didn't go as planned, so I'm fuzzy to this here.

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.