Jump to content

TESR's sharing entity instances.


KeeganDeathman

Recommended Posts

Across all my mods, it seems like all my TESRs are sharing a tile entity instances, that are bound to the same tile entity. The solar panel and wind turbines are sharing one.

For instance, in LabStuff, if more one wind turbine entity is in view, they both start spinning faster, or if one is in no-spin conditions, but the others are, they all start spinning. Regardless of y-position or ability to see the sky.

In DLStuff, if you right click while holding left-control and are holding an unprogrammed d-pad on a laptop, you plug it in to download the os. But if you do it again, you get it back. This also renders a d-pad and cord plugged into the back of the laptop. But if you take the d-pad out, or destroy the block and replace it even, the d-pad is still being rendered.

Any ideas?

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

Because when I remove the variable for the model, I have to start referencing the class directly when it comes time to render.

When I do that it says I have to make renderModel static.

When I do that it says I need to make Screen, Keys, Cord, and Tablet static as well.

Those are the parts BTW.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

Well that fixed the problem of getting the tablet back.

But in my testing world, both laptops show the tablet. Im not sure if they share the tablet tough. Like you can put it one and take it out another.

The tile entity is located in the tileentity package, duh.

And if you ask me why I have the tablet stored in a custom variable, yet still have a container set up. I used to have a whole different setup for putting the tablet in, so theres where the container comes from. And the other thing, I forgot.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

If the lcontrol is pressed and your not sneaking when you right click the laptop, it checks to see if it is false(I found a weird bug where i had to change the boolean to reflect if there wan't a tablet, so to render it needs to be false) and if it is it adds the tile entities store tablet item to your inventory and sets the TEs to null. It then sets noTablet to true. If noTablet was true(meaning the port is open) it takes the dPad from you, sets the tablet item, and sets noTablet to false.

I also have a addCraftingToCrafters and releated methods setup in the container, but to call it the GUI must be opened. I can't send a packet because server to client packets don't work because you said I'd never need them.

 

//no lcontrol if statement
else if(!player.isSneaking() && Keyboard.isKeyDown(Keyboard.KEY_LCONTROL))
        	{
        		TileEntityDLLaptop te = (TileEntityDLLaptop)world.getTileEntity(x, y, z);
        		if(!te.noTablet)
        		{
        			player.inventory.addItemStackToInventory(te.tabletItem);
        			te.noTablet = true;
        			te.setTabletItem(null);
        			world.markBlockForUpdate(x, y, z);
            		player.openGui(DLStuff.instance, 0, world, x, y, z);

        			return true;
        		}
        		else if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().isItemEqual(new ItemStack(DLStuff.itemUnProgrammedDPad)))
        		{
        			player.inventory.decrStackSize(player.inventory.currentItem, 1);
        			te.setTabletItem(new ItemStack(DLStuff.itemUnProgrammedDPad));
            		te.noTablet = false;
            		world.markBlockForUpdate(x, y, z);
            		player.openGui(DLStuff.instance, 0, world, x, y, z);
            		return true;
        		}
        		return false;
        	}

 

public void detectAndSendChanges()
    {
        super.detectAndSendChanges();

        for (int i = 0; i < this.crafters.size(); ++i)
        {
            ICrafting icrafting = (ICrafting)this.crafters.get(i);

            if (this.lastTablet != this.tile.isTablet())
            {
            	int tabletInt;
            	if(this.tile.isTablet())
            		tabletInt = 1;
   			 	else
   			 		tabletInt = 0;
                icrafting.sendProgressBarUpdate(this, 0, tabletInt);
            }
        }
        this.lastTablet = tile.isTablet();
    }
    

	@SideOnly(Side.CLIENT)
    public void updateProgressBar(int p_75137_1_, int p_75137_2_)
    {
        if (p_75137_1_ == 0)
        {
        	boolean tablet;
        	if(p_75137_2_ == 0)
        		tablet = true;
        	else
        		tablet = false;
            this.tile.setTablet(tablet);
            System.out.println("Updated client tablet, " + tablet);
        }
    }

	 public void addCraftingToCrafters(ICrafting p_75132_1_)
	 {
		 super.addCraftingToCrafters(p_75132_1_);
		 int tabletInt;
		 if(this.tile.isTablet())
			 tabletInt = 1;
		 else
			 tabletInt = 0;
		 p_75132_1_.sendProgressBarUpdate(this, 0, tabletInt);
	 }

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

Link to comment
Share on other sites

Oh yeah,

I originally had a whole gui for the drives of the computer but scratched it due to, problems.

Maybe I'll have it so if your holding a tablet, it gets put in. And then if I can get it to be able to call the gui from the tablet if block, I should be good.

[shadow=gray,left][glow=red,2,300]KEEGAN[/glow][/shadow]

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.



×
×
  • Create New...

Important Information

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