Jump to content

Recommended Posts

Posted

Hello all,

 

I've been having trouble rendering an entity in forge, and I'm not quite sure what the problem is.

I have it rendering 2 faces of a cube, but whenever i look at a certain angle the cube disappears. It seems that it is only visible from the orientation 102(west) through -152(north)

2l111l.pngartlk.jpg

 

here is the code inside of my "Render" file

 

package over.extrashapes;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;


import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.util.Icon;
import net.minecraft.util.ResourceLocation;

public class ShapeRender extends Render {

ResourceLocation texture = null;
public ShapeRender ()
{

}
@Override
public void doRender(Entity entity, double par2, double par4, double par6,float f, float f1) {
	 GL11.glDisable(GL11.GL_TEXTURE_2D);
	 GL11.glDisable(GL11.GL_LIGHTING);
	 //GL11.glEnable(GL11.GL_BLEND);
	// GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	 //GL11.glEnable(GL12.GL_RESCALE_NORMAL);

	GL11.glPushMatrix();
	   GL11.glTranslatef((float)par2, (float)par4, (float)par6);


           Tessellator tessellator = Tessellator.instance;
           tessellator.startDrawing(GL11.GL_QUADS);
           tessellator.setColorRGBA(0, 0, 0, 128);
	   tessellator.setNormal(0, 0, 0);
           
	   //front
           tessellator.addVertex(0, 0, 0);
           tessellator.addVertex(0, 1, 0);
           tessellator.addVertex(1, 1, 0);
           tessellator.addVertex(1, 0, 0);
           
           
           //back
           tessellator.addVertex(1, 0, 1);
           tessellator.addVertex(1, 1, 1);
           tessellator.addVertex(0, 1, 1);
           tessellator.addVertex(0, 0, 1);
         

         
           tessellator.draw();
           
	   GL11.glPopMatrix();
	   
	  // GL11.glDisable(GL11.GL_BLEND);
	   GL11.glEnable(GL11.GL_LIGHTING);
	   GL11.glEnable(GL11.GL_TEXTURE_2D);

}

@Override
protected ResourceLocation getEntityTexture(Entity entity) {
	// TODO Auto-generated method stub
	return null;
}

}

 

any suggestions or solutions would be awesome, this has been haunting me for a couple days

 

Thanks

Posted

Hi

 

So I gather your entity is that big black shape on the left?

 

When the entity disappears, do you know for certain that the renderer has drawn it?  I.e. perhaps it is being culled by the frustrum code and it never gets to the renderer?  (I suggest adding some println to check)

 

I can't see anything wrong with the render code but then I'm no expert.  I've previously had rather strange bugs where my render varied depending on what else had previously been rendered in the same scene, because I wasn't setting all the necessary settings. 

 

Fresh out of other ideas, sorry...

 

-TGG

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 am trying to make a custom item that converts to another custom item when eaten. The food properties includes "usingConvertsTo(ModItems.ITEM_NAME.get())", however since the item is not yet registered during the registration process, the get() method returns null. Is there any way to work around this?
    • Having problems with forge installation on headless arch linux, regardless of forge-server from yay or manual wget, Cant find class error and results in net/minecraft/world/waypoints/Waypoint$Icon.class   net/minecraft/world/waypoints/Waypoint.class   net/minecraft/world/waypoints/WaypointManager.class   net/minecraft/world/waypoints/WaypointStyleAsset.class   net/minecraft/world/waypoints/WaypointStyleAssets.class   net/minecraft/world/waypoints/WaypointTransmitter$BlockConnection.class   net/minecraft/world/waypoints/WaypointTransmitter$ChunkConnection.class   net/minecraft/world/waypoints/WaypointTransmitter$Connection.class   net/minecraft/world/waypoints/WaypointTransmitter$EntityAzimuthConnection.class   net/minecraft/world/waypoints/WaypointTransmitter$EntityBlockConnection.class   net/minecraft/world/waypoints/WaypointTransmitter$EntityChunkConnection.class   net/minecraft/world/waypoints/WaypointTransmitter.class   version.json   Processor failed, invalid outputs:     /srv/minecraft/./libraries/net/minecraft/server/1.21.6/server-1.21.6-official.jar       Expected: b1448d2c947e923ccd63224defc3b51e5a72a98d       Actual:   5f30bf411bd0d1208baca6b7be1584442f4f6579 There was an error during installation
    • This is my first time setting up a minecraft server, and I had wanted to add modding capabilities with forge but I keep getting errors while installing? I have tried installing several versions of forge but i have ended up getting unable to find class and checksum errors? Same thing when trying yay -S forge-server The only thing that works is installing the vanilla minecraft server from minecraft itself?   net/minecraft/util/parsing/packrat/Atom.class   net/minecraft/util/parsing/packrat/CachedParseState$CacheEntry.class   net/minecraft/util/parsing/packrat/CachedParseState$PositionCache.class   net/minecraft/util/parsing/packrat/CachedParseState$Silent.class   net/minecraft/util/parsing/packrat/CachedParseState$SimpleControl.class   net/minecraft/util/parsing/packrat/CachedParseState.class   net/minecraft/util/parsing/packrat/Control$1.class   net/minecraft/util/parsing/packrat/Control.class   net/minecraft/util/parsing/packrat/DelayedException.class   net/minecraft/util/parsing/packrat/Dictionary$Entry.class   net/minecraft/util/parsing/packrat/Dictionary$Reference.class   net/minecraft/util/parsing/packrat/Dictionary.class   net/minecraft/util/parsing/packrat/ErrorCollector$LongestOnly$MutableErrorEntry.class   net/minecraft/util/parsing/packrat/ErrorCollector$LongestOnly.class   net/minecraft/util/parsing/packrat/ErrorCollector$Nop.class   net/minecraft/util/parsing/packrat/ErrorCollector.class   net/minecraft/util/parsing/packrat/ErrorEntry.class   net/minecraft/util/parsing/packrat/NamedRule.class   net/minecraft/util/parsing/packrat/ParseState.class   net/minecraft/util/parsing/packrat/Rule$RuleAction.class   net/minecraft/util/parsing/packrat/Rule$SimpleRuleAction.class   net/minecraft/util/parsing/packrat/Rule$WrappedTerm.class Processor failed, invalid outputs:     /srv/minecraft/./libraries/net/minecraft/server/1.21.6/server-1.21.6-official.jar       Expected: b1448d2c947e923ccd63224defc3b51e5a72a98d       Actual:   5f30bf411bd0d1208baca6b7be1584442f4f6579 There was an error during installation  
    • Fight with others to gain more hearts.
    • I wanted to try out Immersive railroading mod + Miszko's train resource pack, but everytime i create a world. it just gives me saving world after the map icon shows 100% and then crashes..   latest.log here https://drive.google.com/file/d/14v1pGCoytqyDvVwPayfUkYolmxcZ7z6-/view?usp=sharing
  • Topics

×
×
  • Create New...

Important Information

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