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);
}
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!"));
}
}
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);
}
Aggregations