Jump to content

Recommended Posts

Posted
13 minutes ago, Leomelonseeds said:

OK so in my tileentity class, how would I detect if it is being rendered in the invertory?

 

The TileEntity shouldn't know or care about that, the TileEntitySpecialRenderer should initialise its stored TileEntity instance with any data required to render it in the inventory.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

hmmmmm... my grill is opening in the inventory too, how do I fix that...

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted
1 hour ago, Leomelonseeds said:

hmmmmm... my grill is opening in the inventory too, how do I fix that...

 

Post your code.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
package com.leomelonseeds.moarstuff.client.render.blocks;

import com.leomelonseeds.moarstuff.blocks.BlockGrill;
import com.leomelonseeds.moarstuff.blocks.Modblocks;
import com.leomelonseeds.moarstuff.client.model.ModelGrill;
import com.leomelonseeds.moarstuff.tileentity.Grill;

import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.model.ModelChest;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class TileGrillRenderer extends TileEntitySpecialRenderer<Grill>
{
    
    private static final ResourceLocation TEXTURE_BURNING = new ResourceLocation("moarstuff:textures/entity/grill/grill_on.png");
    private static final ResourceLocation TEXTURE_NORMAL = new ResourceLocation("moarstuff:textures/entity/grill/grill_off.png");
    private final ModelGrill simpleChest = new ModelGrill();
  
  
    public TileGrillRenderer(){
    	
    }
    
    
    @Override
    public void renderTileEntityAt(Grill te, double x, double y, double z, float partialTicks, int destroyStage)
    {   
    	
    	Grill grill = new Grill();
    	if(te != null){
    	GlStateManager.enableDepth();
        GlStateManager.depthFunc(515);
        GlStateManager.depthMask(true);
        
        int i;

        if (te.hasWorldObj())
        {
            Block block = te.getBlockType();
            i = te.getBlockMetadata();

        }
        else
        {
            i = 0;
        }

        ModelGrill modelgrill = this.simpleChest;
                

                if (destroyStage >= 0)
                {
                    this.bindTexture(DESTROY_STAGES[destroyStage]);
                    GlStateManager.matrixMode(5890);
                    GlStateManager.pushMatrix();
                    GlStateManager.scale(4.0F, 4.0F, 1.0F);
                    GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
                    GlStateManager.matrixMode(5888);
                }
                else if(te.isBurning == true){
                	this.bindTexture(TEXTURE_BURNING);
                }
           
                else
                {
                    this.bindTexture(TEXTURE_NORMAL);
                }
            
         
            GlStateManager.pushMatrix();
            GlStateManager.enableRescaleNormal();

            if (destroyStage < 0)
            {
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            }

            GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F);
            GlStateManager.scale(1.0F, -1.0F, -1.0F);
            GlStateManager.translate(0.5F, 0.5F, 0.5F);
           
            int j = 0;

            if (i == 2)
            {
                j = 180;
            }

            if (i == 3)
            {
                j = 0;
            }

            if (i == 4)
            {
                j = 90;
            }

            if (i == 5)
            {
                j = -90;
            }

           

            GlStateManager.rotate((float)j, 0.0F, 1.0F, 0.0F);
            GlStateManager.translate(-0.5F, -0.5F, -0.5F);
            
           
            
        
            float f = te.prevLidAngle + (te.lidAngle - te.prevLidAngle) * partialTicks;
            
            

            

            f = 1.0F - f;
            f = 1.0F - f * f * f;
            modelgrill.chestLid.rotateAngleX = -(f * ((float)Math.PI / 2F));
            modelgrill.renderAll();
            GlStateManager.disableRescaleNormal();
            GlStateManager.popMatrix();
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
           

            if (destroyStage >= 0)
            {
                GlStateManager.matrixMode(5890);
                GlStateManager.popMatrix();
                GlStateManager.matrixMode(5888);
            }
    	}else{
    		
    		GlStateManager.enableDepth();
            GlStateManager.depthFunc(515);
            GlStateManager.depthMask(true);
                     
        

            ModelGrill mg = this.simpleChest;
                    

                    if (destroyStage >= 0)
                    {
                        this.bindTexture(DESTROY_STAGES[destroyStage]);
                        GlStateManager.matrixMode(5890);
                        GlStateManager.pushMatrix();
                        GlStateManager.scale(4.0F, 4.0F, 1.0F);
                        GlStateManager.translate(0.0625F, 0.0625F, 0.0625F);
                        GlStateManager.matrixMode(5888);
                    }
               
                    else
                    {
                        this.bindTexture(TEXTURE_NORMAL);
                    }
                
             
                GlStateManager.pushMatrix();
                GlStateManager.enableRescaleNormal();

                if (destroyStage < 0)
                {
                    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
                }

                GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F);
                GlStateManager.scale(1.0F, -1.0F, -1.0F);
                GlStateManager.translate(0.5F, 0.5F, 0.5F);
                
                GlStateManager.translate(-0.5F, -0.5F, -0.5F);
                
               
              
                mg.renderAll();
                GlStateManager.disableRescaleNormal();
                GlStateManager.popMatrix();
                GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
               

                if (destroyStage >= 0)
                {
                    GlStateManager.matrixMode(5890);
                    GlStateManager.popMatrix();
                    GlStateManager.matrixMode(5888);
                }
    	}
    	
        }
    }

Also, read the above posts.

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

Your TE class shouldn't even be instanced for inventory render.

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

Well its not. Also do you know if changing the grill texture to 16x16 (currently its 14x14) will cause any edits to have to be made in my TESR (not the model class)?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted
31 minutes ago, Leomelonseeds said:

Well its not.

Then why does said non-existent instance need to know?

32 minutes ago, Leomelonseeds said:

 do you know if changing the grill texture to 16x16 (currently its 14x14) will cause any edits to have to be made in my TESR (not the model class)?

Probably.

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
17 hours ago, Draco18s said:

Then why does said non-existent instance need to know?

What do you mean. Why exactly is my grill opening in the inventory....?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted
3 hours ago, Leomelonseeds said:

What do you mean. Why exactly is my grill opening in the inventory....?

If your block is in your inventory, it exists as an item. You need to register your inventory variant or item model to use the closed version.

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 (edited)

These questions are probably really stupid.

9 minutes ago, Draco18s said:

item model to use the closed version

Do I use the json? I dont have a "closed version" where do I put that or what is that even

Edited by Leomelonseeds

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

Also, how do I detect of a item has been placed inside the GUI?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted
On 2/15/2017 at 8:47 PM, Leomelonseeds said:

Do I use the json? I dont have a "closed version" where do I put that or what is that even

 

On 2/20/2017 at 8:53 PM, Leomelonseeds said:

Also, how do I detect of a item has been placed inside the GUI

Does nobody know the answer to these questions?

 

Also yay Im a diamond finder now :)

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

  • 3 weeks later...
Posted

You know what? Im done with the Grill. If you guys are not wanting to help, then I will not want to continue working on it.

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

  • 4 weeks later...
Posted

Please please please help me! At least point me in the right direction. Or at least tell me you guys repeatedly ignore me like nothing happened. Whats wrong?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted

For the record, I'm not ignoring your posts.

I just have no fucking idea.

  • Like 1

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
On 21-2-2017 at 5:53 AM, Leomelonseeds said:

Also, how do I detect of a item has been placed inside the GUI?

 
 

Either check the inventory every tick (not recommended) or make a custom Slot implementation which calls a method when an ItemStack gets placed inside the Slot.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted
On 4/10/2017 at 8:07 PM, Draco18s said:

I just have no fucking idea.

Oh. 

...

Sry 'bout that.

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

Posted
On 4/11/2017 at 11:55 AM, larsgerrits said:

Either check the inventory every tick (not recommended) or make a custom Slot implementation which calls a method when an ItemStack gets placed inside the Slot.

Thank you for finally replying! How bout the inventory opening? Do I have to create an ItemBlock for the Grill (dont judge me on not having one)?

Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.

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.