mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-26 21:09:23 +01:00
parent
90c1f2c25f
commit
5e63208098
2 changed files with 18 additions and 12 deletions
|
@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityBookletStand;
|
|||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
@ -67,7 +68,10 @@ public final class PacketHandler{
|
|||
|
||||
if(tile instanceof IButtonReactor){
|
||||
IButtonReactor reactor = (IButtonReactor)tile;
|
||||
reactor.onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)world.getEntityByID(compound.getInteger("PlayerID")));
|
||||
Entity entity = world.getEntityByID(compound.getInteger("PlayerID"));
|
||||
if(entity != null && entity instanceof EntityPlayer){
|
||||
reactor.onButtonPressed(compound.getInteger("ButtonID"), (EntityPlayer)entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -45,18 +45,20 @@ public class TileEntityGiantChest extends TileEntityInventoryBase implements IBu
|
|||
|
||||
@Override
|
||||
public void onButtonPressed(int buttonID, EntityPlayer player){
|
||||
GuiHandler.GuiTypes type;
|
||||
if(player != null && this.pos != null){
|
||||
GuiHandler.GuiTypes type;
|
||||
|
||||
if(buttonID == 0){
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST;
|
||||
}
|
||||
else if(buttonID == 1){
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST_PAGE_2;
|
||||
}
|
||||
else{
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST_PAGE_3;
|
||||
}
|
||||
if(buttonID == 0){
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST;
|
||||
}
|
||||
else if(buttonID == 1){
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST_PAGE_2;
|
||||
}
|
||||
else{
|
||||
type = GuiHandler.GuiTypes.GIANT_CHEST_PAGE_3;
|
||||
}
|
||||
|
||||
player.openGui(ActuallyAdditions.instance, type.ordinal(), this.worldObj, this.pos.getX(), this.pos.getY(), this.pos.getZ());
|
||||
player.openGui(ActuallyAdditions.instance, type.ordinal(), this.worldObj, this.pos.getX(), this.pos.getY(), this.pos.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue