use of com.minecolonies.coremod.client.gui.WindowGuiCrafting in project minecolonies by Minecolonies.
the class GuiHandler method getClientGuiElement.
@Override
public Object getClientGuiElement(final int id, final EntityPlayer player, final World world, final int x, final int y, final int z) {
if (id == ID.DEFAULT.ordinal()) {
final BlockPos pos = new BlockPos(x, y, z);
final TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof ScarecrowTileEntity) {
return new GuiField(player.inventory, (ScarecrowTileEntity) tileEntity, world, pos);
} else if (tileEntity instanceof TileEntityRack) {
return new GuiRack(player.inventory, (TileEntityRack) tileEntity, ((TileEntityRack) tileEntity).getOtherChest(), world, pos);
} else {
@Nullable final AbstractBuildingView building = ColonyManager.getBuildingView(new BlockPos(x, y, z));
if (building instanceof AbstractBuildingWorker.View) {
return new WindowGuiCrafting(player.inventory, world, (AbstractBuildingWorker.View) building);
}
}
} else if (id == ID.BUILDING_INVENTORY.ordinal()) {
final TileEntity entity = world.getTileEntity(new BlockPos(x, y, z));
if (entity instanceof TileEntityColonyBuilding) {
final TileEntityColonyBuilding tileEntityColonyBuilding = (TileEntityColonyBuilding) entity;
return new GuiChest(player.inventory, tileEntityColonyBuilding);
}
} else if (id == ID.CITIZEN_INVENTORY.ordinal()) {
final ColonyView view = ColonyManager.getColonyView(x);
final CitizenDataView citizenDataView = view.getCitizen(y);
return new GuiChest(player.inventory, citizenDataView.getInventory());
}
return null;
}
Aggregations