Jump to content

Recommended Posts

Posted

public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int a, float b, float x, float y){

    TileEntityiTrade tileEntity = (TileEntityiTrade) world.getBlockTileEntity(i, j, k);

if (tileEntity == null) return false;

entityplayer.openGui(iCraftMain.instance, 1, world, i, k, k);

return true;

}

 

Gui Handler

 

package iCraft.Gui;

 

import iCraft.Client.EnumGui;

import iCraft.Packet.Handler.TileEntityiTrade;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.world.World;

import cpw.mods.fml.common.network.IGuiHandler;

 

public class iGuiHandler implements IGuiHandler{

 

@Override

public Object getServerGuiElement(int ID, EntityPlayer player, World world,

int x, int y, int z) {

TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

if(ID == 1)

{

if(tileEntity instanceof TileEntityiTrade)

{

return new ContaineriTrade(player.inventory, (TileEntityiTrade) tileEntity,ID,player);

}

}

return null;

}

 

 

 

@Override

public Object getClientGuiElement(int ID, EntityPlayer player, World world,

int x, int y, int z) {

TileEntity tileEntity = world.getBlockTileEntity(x, y, z);

if(ID == 1)

{

System.out.println("Tile : "+tileEntity);

if(tileEntity instanceof TileEntityiTrade)

{

return new GuiiTradeOwner(player.inventory, (TileEntityiTrade) tileEntity,ID,player);

}

}

return null;

}

 

}

 

If player right click[ Player place the block ]

Gui can open it

But if !playerowner gui can't open it

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.