Search in sources :

Example 1 with TableDataSourceWorldScriptHolder

use of ivorius.reccomplex.gui.worldscripts.TableDataSourceWorldScriptHolder in project RecurrentComplex by Ivorforce.

the class PacketWorldDataHandler method processClient.

@SideOnly(Side.CLIENT)
@Override
public void processClient(PacketWorldData message, MessageContext ctx) {
    GuiScreen screen = Minecraft.getMinecraft().currentScreen;
    if (!(screen instanceof TableNavigator))
        throw new RuntimeException();
    TableDataSource dataSource = ((TableNavigator) screen).currentTable().getDataSource();
    if (!(dataSource instanceof TableDataSourceWorldScriptHolder))
        throw new RuntimeException();
    WorldScriptHolder script = ((TableDataSourceWorldScriptHolder) dataSource).script;
    script.worldData = message.worldData;
    // From now this MUST be lower corner
    script.origin = new BlockArea(message.capturePoint1, message.capturePoint2).getLowerCorner();
    if (screen instanceof TableDelegate)
        ((TableDelegate) screen).reloadData();
}
Also used : TableDataSourceWorldScriptHolder(ivorius.reccomplex.gui.worldscripts.TableDataSourceWorldScriptHolder) BlockArea(ivorius.ivtoolkit.blocks.BlockArea) TableDataSource(ivorius.reccomplex.gui.table.datasource.TableDataSource) TableDelegate(ivorius.reccomplex.gui.table.TableDelegate) WorldScriptHolder(ivorius.reccomplex.world.gen.script.WorldScriptHolder) TableDataSourceWorldScriptHolder(ivorius.reccomplex.gui.worldscripts.TableDataSourceWorldScriptHolder) GuiScreen(net.minecraft.client.gui.GuiScreen) TableNavigator(ivorius.reccomplex.gui.table.TableNavigator) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

BlockArea (ivorius.ivtoolkit.blocks.BlockArea)1 TableDelegate (ivorius.reccomplex.gui.table.TableDelegate)1 TableNavigator (ivorius.reccomplex.gui.table.TableNavigator)1 TableDataSource (ivorius.reccomplex.gui.table.datasource.TableDataSource)1 TableDataSourceWorldScriptHolder (ivorius.reccomplex.gui.worldscripts.TableDataSourceWorldScriptHolder)1 WorldScriptHolder (ivorius.reccomplex.world.gen.script.WorldScriptHolder)1 GuiScreen (net.minecraft.client.gui.GuiScreen)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1