Search in sources :

Example 1 with EnumStructureConfiguration

use of com.wuest.prefab.Proxy.Messages.StructureTagMessage.EnumStructureConfiguration in project MC-Prefab by Brian-Wuest.

the class StructureHandler method onMessage.

@Override
public IMessage onMessage(final StructureTagMessage message, final MessageContext ctx) {
    // Or Minecraft.getMinecraft() on the client.
    IThreadListener mainThread = (WorldServer) ctx.getServerHandler().player.world;
    mainThread.addScheduledTask(new Runnable() {

        @Override
        public void run() {
            // This is server side. Build the structure.
            EnumStructureConfiguration structureConfig = message.getStructureConfig();
            StructureConfiguration configuration = structureConfig.structureConfig.ReadFromNBTTagCompound(message.getMessageTag());
            configuration.BuildStructure(ctx.getServerHandler().player, ctx.getServerHandler().player.world);
        }
    });
    // no response in this case
    return null;
}
Also used : StructureConfiguration(com.wuest.prefab.Config.Structures.StructureConfiguration) EnumStructureConfiguration(com.wuest.prefab.Proxy.Messages.StructureTagMessage.EnumStructureConfiguration) IThreadListener(net.minecraft.util.IThreadListener) WorldServer(net.minecraft.world.WorldServer) EnumStructureConfiguration(com.wuest.prefab.Proxy.Messages.StructureTagMessage.EnumStructureConfiguration)

Aggregations

StructureConfiguration (com.wuest.prefab.Config.Structures.StructureConfiguration)1 EnumStructureConfiguration (com.wuest.prefab.Proxy.Messages.StructureTagMessage.EnumStructureConfiguration)1 IThreadListener (net.minecraft.util.IThreadListener)1 WorldServer (net.minecraft.world.WorldServer)1