use of com.builtbroken.mc.lib.modflags.Region in project Engine by VoltzEngine-Project.
the class SelectionHandler method updatePlayerRenderData.
public static void updatePlayerRenderData(EntityPlayerMP player) {
List<Cube> cubes = new ArrayList();
List<Cube> regions = new ArrayList();
Cube selection = getSelection(player);
for (Cube cube : selections.values()) {
if (cube != selection && cube.distance(new Pos(player)) <= 160) {
cubes.add(cube);
}
}
for (Region region : RegionManager.getControllerForWorld(player.worldObj).getRegionsNear(player, 160)) {
for (Cube cube : region.segments) {
if (cube.isCloseToAnyCorner(new Pos(player), 160)) {
regions.add(cube);
}
}
}
Engine.instance.packetHandler.sendToPlayer(new PacketSelectionData(selection, cubes, regions), player);
}
use of com.builtbroken.mc.lib.modflags.Region in project Engine by VoltzEngine-Project.
the class CommandNewRegion method handleEntityPlayerCommand.
@Override
public boolean handleEntityPlayerCommand(EntityPlayer player, String[] args) {
if (args.length > 0) {
String name = args[0];
if (RegionManager.getControllerForWorld(player.worldObj).getRegion(name) == null) {
Cube cube = SelectionHandler.getSelection(player);
if (cube != null && cube.isValid()) {
Region region = RegionManager.getControllerForWorld(player.worldObj).createNewRegion(name, cube);
if (region != null) {
region.getAccessProfile().getGroup("owner").addMember(player);
player.addChatMessage(new ChatComponentText("Region created"));
} else {
player.addChatMessage(new ChatComponentText("Error creating region"));
}
} else {
player.addChatMessage(new ChatComponentText("Invalid selection to create region"));
}
} else {
player.addChatMessage(new ChatComponentText("A region by that name already exists"));
}
} else {
player.addChatMessage(new ChatComponentText("Need a region name"));
}
return true;
}
use of com.builtbroken.mc.lib.modflags.Region in project Engine by VoltzEngine-Project.
the class CommandRegion method handleEntityPlayerCommand.
@Override
public boolean handleEntityPlayerCommand(EntityPlayer player, String[] args) {
if (args.length > 0) {
String name = args[0];
Region region = RegionManager.getControllerForWorld(player.worldObj).getRegion(name);
if (region != null) {
if (args.length > 1) {
for (AbstractCommand command : subCommands) {
if (command instanceof SubCommandRegion && command.getCommandName().equalsIgnoreCase(args[1])) {
if (((SubCommandRegion) command).handle(player, region, removeFront(args, 2))) {
return true;
}
}
}
}
player.addChatMessage(new ChatComponentText("Unknown region sub command"));
} else {
player.addChatMessage(new ChatComponentText("Unknown region"));
}
} else {
player.addChatMessage(new ChatComponentText("Missing region name"));
}
return true;
}
Aggregations