Search in sources :

Example 41 with RfToolsDimensionManager

use of mcjty.rftools.dimension.RfToolsDimensionManager in project RFTools by McJty.

the class CmdAddEffect method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length < 2) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Several parameters are missing!"));
        return;
    } else if (args.length > 2) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    String effectName = fetchString(sender, args, 1, "");
    effectName = "EFFECT_" + effectName.toUpperCase();
    EffectType type = null;
    try {
        type = EffectType.valueOf(effectName);
    } catch (IllegalArgumentException e) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Bad effect name!"));
        return;
    }
    World world = sender.getEntityWorld();
    int dim = world.provider.dimensionId;
    RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
    DimensionInformation information = dimensionManager.getDimensionInformation(dim);
    if (information == null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
        return;
    }
    information.getEffectTypes().add(type);
    dimensionManager.save(world);
}
Also used : EffectType(mcjty.rftools.dimension.world.types.EffectType) World(net.minecraft.world.World) ChatComponentText(net.minecraft.util.ChatComponentText) DimensionInformation(mcjty.rftools.dimension.DimensionInformation) RfToolsDimensionManager(mcjty.rftools.dimension.RfToolsDimensionManager)

Example 42 with RfToolsDimensionManager

use of mcjty.rftools.dimension.RfToolsDimensionManager in project RFTools by McJty.

the class CmdCreateTab method execute.

@Override
public void execute(ICommandSender sender, String[] args) {
    if (args.length < 2) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "The dimension parameter is missing!"));
        return;
    } else if (args.length > 2) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
        return;
    }
    int dim = fetchInt(sender, args, 1, 0);
    World world = sender.getEntityWorld();
    RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
    DimensionDescriptor dimensionDescriptor = dimensionManager.getDimensionDescriptor(dim);
    if (dimensionDescriptor == null) {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Not an RFTools dimension!"));
        return;
    }
    if (sender instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) sender;
        ItemStack tab = DimensionEnscriberTileEntity.createRealizedTab(dimensionDescriptor, sender.getEntityWorld());
        InventoryHelper.mergeItemStack(player.inventory, false, tab, 0, 35, null);
    } else {
        sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command only works as a player!"));
    }
}
Also used : DimensionDescriptor(mcjty.rftools.dimension.description.DimensionDescriptor) EntityPlayer(net.minecraft.entity.player.EntityPlayer) World(net.minecraft.world.World) ItemStack(net.minecraft.item.ItemStack) ChatComponentText(net.minecraft.util.ChatComponentText) RfToolsDimensionManager(mcjty.rftools.dimension.RfToolsDimensionManager)

Example 43 with RfToolsDimensionManager

use of mcjty.rftools.dimension.RfToolsDimensionManager in project RFTools by McJty.

the class CheckDimletConfigHelper method checkDimletsFromServer.

public static void checkDimletsFromServer(PacketCheckDimletConfig message) {
    World world = Minecraft.getMinecraft().theWorld;
    RfToolsDimensionManager dimensionManager = RfToolsDimensionManager.getDimensionManager(world);
    dimensionManager.checkDimletConfigFromServer(message.getDimlets(), world);
}
Also used : World(net.minecraft.world.World) RfToolsDimensionManager(mcjty.rftools.dimension.RfToolsDimensionManager)

Aggregations

RfToolsDimensionManager (mcjty.rftools.dimension.RfToolsDimensionManager)43 DimensionInformation (mcjty.rftools.dimension.DimensionInformation)29 World (net.minecraft.world.World)27 ChatComponentText (net.minecraft.util.ChatComponentText)16 DimensionStorage (mcjty.rftools.dimension.DimensionStorage)11 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)9 EntityPlayer (net.minecraft.entity.player.EntityPlayer)6 DimensionDescriptor (mcjty.rftools.dimension.description.DimensionDescriptor)5 ItemStack (net.minecraft.item.ItemStack)5 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)5 File (java.io.File)3 Coordinate (mcjty.lib.varia.Coordinate)3 EffectType (mcjty.rftools.dimension.world.types.EffectType)3 IOException (java.io.IOException)2 Map (java.util.Map)2 GenericEnergyReceiverTileEntity (mcjty.lib.entity.GenericEnergyReceiverTileEntity)2 GlobalCoordinate (mcjty.lib.varia.GlobalCoordinate)2 TeleportDestinations (mcjty.rftools.blocks.teleporter.TeleportDestinations)2 IMob (net.minecraft.entity.monster.IMob)2 IAnimals (net.minecraft.entity.passive.IAnimals)2