use of net.minecraft.entity.player.EntityPlayer in project BluePower by Qmunity.
the class PneumaticTube method rayTrace.
@Override
public QMovingObjectPosition rayTrace(Vec3d start, Vec3d end) {
QMovingObjectPosition mop = super.rayTrace(start, end);
if (mop == null)
return null;
EntityPlayer player = BluePower.proxy.getPlayer();
if (redwireType != null && player != null && player.isSneaking()) {
double wireSize = getSize() / 16D;
double frameSeparation = 4 / 16D - (wireSize - 2 / 16D);
double frameThickness = 1 / 16D;
frameThickness /= 1.5;
frameSeparation -= 1 / 32D;
QMovingObjectPosition wire = RayTracer.instance().rayTraceCubes(getFrameBoxes(wireSize, frameSeparation, frameThickness, shouldRenderConnection(ForgeDirection.DOWN), shouldRenderConnection(ForgeDirection.UP), shouldRenderConnection(ForgeDirection.WEST), shouldRenderConnection(ForgeDirection.EAST), shouldRenderConnection(ForgeDirection.NORTH), shouldRenderConnection(ForgeDirection.SOUTH), redstoneConnections[ForgeDirection.DOWN.ordinal()], redstoneConnections[ForgeDirection.UP.ordinal()], redstoneConnections[ForgeDirection.WEST.ordinal()], redstoneConnections[ForgeDirection.EAST.ordinal()], redstoneConnections[ForgeDirection.NORTH.ordinal()], redstoneConnections[ForgeDirection.SOUTH.ordinal()], getParent() != null && getWorld() != null), start, end, new Vec3i(this));
QMovingObjectPosition frame = RayTracer.instance().rayTraceCubes(getFrameBoxes(), start, end, new Vec3i(this));
if (wire != null) {
if (frame != null) {
if (wire.hitVec.distanceTo(start.toVec3()) < frame.hitVec.distanceTo(start.toVec3()))
mop.hitInfo = PartManager.getPartInfo("wire." + redwireType.getName()).getStack();
} else {
mop.hitInfo = PartManager.getPartInfo("wire." + redwireType.getName()).getStack();
}
}
}
return mop;
}
use of net.minecraft.entity.player.EntityPlayer in project LogisticsPipes by RS485.
the class MorePageDisplay method display.
public void display(ICommandSender sender, int page, boolean flag, boolean all, int linesub) {
if (terminated) {
return;
}
sender.addChatMessage(new ChatComponentText("%LPCLEARCHAT%"));
int count = row - header.size() - 1 - linesub;
page = (page > 0 && !all ? page : 1);
currentpage = page;
int pagecount = getPageCount(count);
currentpagecount = pagecount;
if (all) {
count = -2;
}
for (Object zeilenobject : header.toArray()) {
if (!(zeilenobject instanceof String)) {
continue;
}
sender.addChatMessage(new ChatComponentText(replaceMeta((String) zeilenobject, page, count)));
}
int currentPage = 0;
int lineOnCurentPage = 0;
int doneLines = 0;
for (int i = 0; i < content.size(); i++, lineOnCurentPage++) {
if (all) {
sender.addChatMessage(new ChatComponentText(content.get(i).content));
} else {
int I;
for (I = i; I < (content.size() - 1) && content.get(I + 1).connected; I++) {
;
}
int needed = I - i;
if (lineOnCurentPage + needed > count - 1) {
currentPage++;
lineOnCurentPage = 0;
}
if (page == currentPage + 1) {
sender.addChatMessage(new ChatComponentText(content.get(i).content));
doneLines = lineOnCurentPage;
}
}
}
if (!all) {
clearscreen(sender, row - 2 - header.size() - doneLines - linesub);
}
if (all && count > content.size()) {
clearscreen(sender, count - content.size());
}
if (!flag) {
printLastLine(sender);
}
if (sender instanceof EntityPlayer) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), (EntityPlayer) sender);
}
}
use of net.minecraft.entity.player.EntityPlayer in project LogisticsPipes by RS485.
the class MorePageDisplay method handleChat.
public boolean handleChat(String input, ICommandSender sender) {
if (terminated) {
return false;
}
if (input.equalsIgnoreCase("exit") || input.equalsIgnoreCase("quit") || input.equalsIgnoreCase("q") || input.equalsIgnoreCase("e")) {
terminated = true;
sender.addChatMessage(new ChatComponentText("%LPCLEARCHAT%"));
for (Object zeilenobject : header.toArray()) {
if (!(zeilenobject instanceof String)) {
continue;
}
sender.addChatMessage(new ChatComponentText(replaceMeta((String) zeilenobject, 0, -1)));
}
clearscreen(sender, 19 - header.size());
sender.addChatMessage(new ChatComponentText(ChatColor.AQUA + "Pageview: " + ChatColor.RED + "Exit."));
sender.addChatMessage(new ChatComponentText("%LPRESTORESENDMESSAGE%"));
} else if (input.equalsIgnoreCase("next") || input.equalsIgnoreCase("nex") || input.equalsIgnoreCase("n")) {
if (currentpage > (currentpagecount - 1)) {
display(sender, 0);
} else {
currentpage++;
display(sender, currentpage);
}
if (sender instanceof EntityPlayer) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), (EntityPlayer) sender);
}
} else if (input.equalsIgnoreCase("previous") || input.equalsIgnoreCase("prev") || input.equalsIgnoreCase("pre") || input.equalsIgnoreCase("p")) {
if (currentpage < 2) {
display(sender, currentpagecount);
} else {
currentpage--;
display(sender, currentpage);
}
} else if (MorePageDisplay.isNumber(input)) {
if (MorePageDisplay.toNumber(input) <= currentpagecount && MorePageDisplay.toNumber(input) > 0) {
display(sender, MorePageDisplay.toNumber(input));
} else {
display(sender, currentpage, true);
sender.addChatMessage(new ChatComponentText(ChatColor.AQUA + "Pageview:" + ChatColor.RED + " Not a valid number."));
}
} else if (input.equalsIgnoreCase("reprint")) {
display(sender, currentpage);
} else if (input.equalsIgnoreCase("all")) {
display(sender, currentpage, false, true, 0);
} else if (input.startsWith("save ")) {
sender.addChatMessage(new ChatComponentText("%LPADDTOSENDMESSAGE%" + input.substring(5)));
display(sender, currentpage, true, false, 1);
sender.addChatMessage(new ChatComponentText(ChatColor.AQUA + "Added '" + ChatColor.YELLOW + input.substring(5) + ChatColor.AQUA + "' to your chat history."));
printLastLine(sender, false);
if (sender instanceof EntityPlayer) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), (EntityPlayer) sender);
}
} else if (input.equals("save")) {
display(sender, currentpage, true, false, 2);
sender.addChatMessage(new ChatComponentText(ChatColor.AQUA + "Add an command after the '" + ChatColor.YELLOW + "save " + ChatColor.AQUA + "' and it will be added to your chat history."));
printLastLine(sender, false);
if (sender instanceof EntityPlayer) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), (EntityPlayer) sender);
}
} else {
//display(sender,currentpage,true);
printLastLine(sender, true);
if (sender instanceof EntityPlayer) {
MainProxy.sendPacketToPlayer(PacketHandler.getPacket(OpenChatGui.class), (EntityPlayer) sender);
}
}
return true;
}
use of net.minecraft.entity.player.EntityPlayer in project LogisticsPipes by RS485.
the class BypassCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
if (!LogisticsSecurityTileEntity.byPassed.contains((EntityPlayer) sender)) {
LogisticsSecurityTileEntity.byPassed.add((EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Enabled"));
} else {
LogisticsSecurityTileEntity.byPassed.remove((EntityPlayer) sender);
sender.addChatMessage(new ChatComponentText("Disabled"));
}
}
use of net.minecraft.entity.player.EntityPlayer in project LogisticsPipes by RS485.
the class HandCommand method executeCommand.
@Override
public void executeCommand(ICommandSender sender, String[] args) {
EntityPlayer player = (EntityPlayer) sender;
ItemStack item = player.inventory.mainInventory[player.inventory.currentItem];
if (item != null) {
DebugGuiController.instance().startWatchingOf(item, player);
sender.addChatMessage(new ChatComponentText("Starting HandDebuging"));
}
}
Aggregations