com.mojang.realmsclient.gui.ChatFormatting Java Examples

The following examples show how to use com.mojang.realmsclient.gui.ChatFormatting. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RadarHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
public RadarHack()
{
	super("Radar",
		"Shows the location of nearby entities.\n" + ChatFormatting.RED
			+ "red" + ChatFormatting.RESET + " - players\n"
			+ ChatFormatting.GOLD + "orange" + ChatFormatting.RESET
			+ " - monsters\n" + ChatFormatting.GREEN + "green"
			+ ChatFormatting.RESET + " - animals\n" + ChatFormatting.GRAY
			+ "gray" + ChatFormatting.RESET + " - others\n");
	setCategory(Category.RENDER);
	addSetting(radius);
	addSetting(rotate);
	addSetting(filterPlayers);
	addSetting(filterSleeping);
	addSetting(filterMonsters);
	addSetting(filterAnimals);
	addSetting(filterInvisible);
	
	window = new Window("Radar");
	window.setPinned(true);
	window.setInvisible(true);
	window.add(new Radar(this));
}
 
Example #2
Source File: PortalFinderModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
private void printPortalToChat(Vec3d portal) {
    final TextComponentString portalTextComponent = new TextComponentString("Portal found!");

    String overworld = "";
    String nether = "";

    if (Minecraft.getMinecraft().player.dimension == 0) { // overworld
        overworld = String.format("Overworld: X: %s, Y: %s, Z: %s", (int) portal.x, (int) portal.y, (int) portal.z);
        nether = String.format("Nether: X: %s, Y: %s, Z: %s", (int) portal.x / 8, (int) portal.y, (int) portal.z / 8);
    } else if (Minecraft.getMinecraft().player.dimension == -1) { // nether
        overworld = String.format("Overworld: X: %s, Y: %s, Z: %s", (int) portal.x * 8, (int) portal.y, (int) portal.z * 8);
        nether = String.format("Nether: X: %s, Y: %s, Z: %s", (int) portal.x, (int) portal.y, (int) portal.z);
    }

    int playerDistance = (int) Minecraft.getMinecraft().player.getDistance(portal.x, portal.y, portal.z);
    String distance = ChatFormatting.GRAY + "" + playerDistance + "m away";

    String hoverText = overworld + "\n" + nether + "\n" + distance;
    portalTextComponent.setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(hoverText))));

    Seppuku.INSTANCE.logcChat(portalTextComponent);
}
 
Example #3
Source File: ItemExpCapsule.java    From Cyberware with MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
	int xp = 0;
	if (stack.hasTagCompound())
	{
		NBTTagCompound c = stack.getTagCompound();
		if (c.hasKey("xp"))
		{
			xp = c.getInteger("xp");
		}
	}
	String before = I18n.format("cyberware.tooltip.expCapsule.before");
	if (before.length() > 0) before = before += " ";
	
	String after = I18n.format("cyberware.tooltip.expCapsule.after");
	if (after.length() > 0) after = " " + after;
	
	tooltip.add(ChatFormatting.RED + before + xp + after);
}
 
Example #4
Source File: ItemAsteroidChip.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void addInformation(ItemStack stack, World player, java.util.List list, ITooltipFlag bool) {

	if(!stack.hasTagCompound()) {
		list.add(LibVulpes.proxy.getLocalizedString("msg.unprogrammed"));
	}
	else {
		if(stack.getItemDamage()  == 0) {

			list.add(LibVulpes.proxy.getLocalizedString("msg.asteroidChip.asteroid") + "-" + ChatFormatting.DARK_GREEN  + getUUID(stack));

			super.addInformation(stack, player, list, bool);

			//list.add("Mass: " + unknown);
			//list.add("Atmosphere Density: " + unknown);
			//list.add("Distance From Star: " + unknown);

		}
	}
}
 
Example #5
Source File: TutorialComponent.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
public TutorialComponent() {
    super("Tutorial", "");

    final String tutorialData = "Hud Editor Tutorial\n\n" +
            ChatFormatting.BOLD + "Anchor Points\n" + ChatFormatting.RESET +
            "- Move hud components by clicking & dragging them.\n" +
            "- Anchor points are located at each corner of the screen, and also one centered at the top of the screen.\n" +
            "- Drag a component near an anchor point and release the mouse to lock it in place.\n\n" +
            ChatFormatting.BOLD + "Combine\n" + ChatFormatting.RESET +
            "- Combine components together by dragging one into another one, releasing the mouse will combine them together.\n" +
            "- Both top and bottom parts of a component are able to be glued to.";

    this.setTextData(tutorialData);

    this.setVisible(true);
    this.setSnappable(false);
    this.setW(200);
    this.setH(173);
    this.setX((Minecraft.getMinecraft().displayWidth / 2) - (this.getW() / 2));
    this.setY((Minecraft.getMinecraft().displayHeight / 2) - (this.getH() / 2));
}
 
Example #6
Source File: GuiHyperiumScreenTos.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    drawDefaultBackground();
    super.drawScreen(mouseX, mouseY, partialTicks);

    drawRect(0, 79, width, 148, 0x66000000);
    drawRect(0, 80, width, 149, 0x66000000);

    drawCenteredString(fontRendererObj, I18n.format("disclaimer.line1",
        ChatFormatting.BOLD + I18n.format("disclaimer.line1.bold") + ChatFormatting.RESET),
        width / 2, 90, Color.WHITE.getRGB());

    drawCenteredString(fontRendererObj, I18n.format("disclaimer.line2"), width / 2, 100,
        Color.WHITE.getRGB());

    drawCenteredString(fontRendererObj, I18n.format("disclaimer.line3"), width / 2, 110,
        Color.WHITE.getRGB());

    drawCenteredString(fontRendererObj, I18n.format("disclaimer.line4",
        ChatFormatting.GRAY + I18n.format("disclaimer.line4.policylink")
            + ChatFormatting.RESET), width / 2, 120, Color.WHITE.getRGB());

    drawCenteredString(fontRendererObj, I18n.format("disclaimer.line5"), width / 2, 130,
        Color.WHITE.getRGB());
}
 
Example #7
Source File: CoordsComponent.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
    final DecimalFormat df = new DecimalFormat("#.#");

    final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.RESET +
            df.format(Minecraft.getMinecraft().player.posX) + ChatFormatting.RESET + "," +
            ChatFormatting.GRAY + " y " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RESET + "," +
            ChatFormatting.GRAY + " z " + ChatFormatting.RESET + df.format(Minecraft.getMinecraft().player.posZ) + ChatFormatting.RESET;

    this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(coords));
    this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);

    //RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0xAA202020);
    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(coords, this.getX(), this.getY(), -1);
}
 
Example #8
Source File: NetherCoordsComponent.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);
    final DecimalFormat df = new DecimalFormat("#.#");

    final String coords = ChatFormatting.GRAY + "x " + ChatFormatting.RED +
            df.format(Minecraft.getMinecraft().player.posX * 8) + ChatFormatting.RED + "," +
            ChatFormatting.GRAY + " y " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RED + "," +
            ChatFormatting.GRAY + " z " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posZ * 8) + ChatFormatting.RESET;

    final String nether = ChatFormatting.GRAY + "x " + ChatFormatting.RED +
            df.format(Minecraft.getMinecraft().player.posX / 8) + ChatFormatting.RED + "," +
            ChatFormatting.GRAY + " y " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posY) + ChatFormatting.RED + "," +
            ChatFormatting.GRAY + " z " + ChatFormatting.RED + df.format(Minecraft.getMinecraft().player.posZ / 8) + ChatFormatting.RESET;

    this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(Minecraft.getMinecraft().player.dimension == -1 ? coords : nether));
    this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);

    //RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(Minecraft.getMinecraft().player.dimension == -1 ? coords : nether, this.getX(), this.getY(), -1);
}
 
Example #9
Source File: EditBlockListScreen.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private String renderIconAndGetName(ItemStack stack, int y)
{
	if(WItem.isNullOrEmpty(stack))
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(
			new ItemStack(Blocks.GRASS), 0, 0);
		RenderHelper.disableStandardItemLighting();
		GL11.glPopMatrix();
		
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		FontRenderer fr = WMinecraft.getFontRenderer();
		fr.drawString("?", 55, y + 2, 0xf0f0f0, true);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		
		return ChatFormatting.ITALIC + "unknown block"
			+ ChatFormatting.RESET;
		
	}else
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
		RenderHelper.disableStandardItemLighting();
		
		GL11.glPopMatrix();
		
		return stack.getDisplayName();
	}
}
 
Example #10
Source File: MobSpawnEspHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
public MobSpawnEspHack()
{
	super("MobSpawnESP",
		"Highlights areas where mobs can spawn.\n" + ChatFormatting.YELLOW
			+ "yellow" + ChatFormatting.RESET
			+ " - mobs can spawn at night\n" + ChatFormatting.RED + "red"
			+ ChatFormatting.RESET + " - mobs can always spawn");
	setCategory(Category.RENDER);
	addSetting(drawDistance);
	addSetting(loadingSpeed);
}
 
Example #11
Source File: ItemBlueprint.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
	if (stack.hasTagCompound())
	{
		NBTTagCompound comp = stack.getTagCompound();
		if (comp.hasKey("blueprintItem"))
		{
			GameSettings settings = Minecraft.getMinecraft().gameSettings;
			if (settings.isKeyDown(settings.keyBindSneak))
			{
				ItemStack blueprintItem = ItemStack.loadItemStackFromNBT(comp.getCompoundTag("blueprintItem"));
				if (blueprintItem != null && CyberwareAPI.canDeconstruct(blueprintItem))
				{
					ItemStack[] items = CyberwareAPI.getComponents(blueprintItem).clone();
					tooltip.add(I18n.format("cyberware.tooltip.blueprint", blueprintItem.getDisplayName()));
					for (ItemStack item : items)
					{
						if (item != null)
						{
							tooltip.add(item.stackSize + " x " + item.getDisplayName());
						}
					}
					return;
				}
			}
			else
			{
				tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.shiftPrompt", Minecraft.getMinecraft().gameSettings.keyBindSneak.getDisplayName()));
				return;
			}
		}
	}
	tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.craftBlueprint"));
}
 
Example #12
Source File: ItemNeuropozyne.java    From Cyberware with MIT License 5 votes vote down vote up
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{

	String neuropozyne = I18n.format("cyberware.tooltip.neuropozyne");

	tooltip.add(ChatFormatting.BLUE + neuropozyne);
}
 
Example #13
Source File: ItemBlockCyberware.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
	if (this.tt != null)
	{
		for (String str : tt)
		{
			tooltip.add(ChatFormatting.DARK_GRAY + I18n.format(str));
		}
	}
}
 
Example #14
Source File: ItemComponentBox.java    From Cyberware with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
{
	tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.componentBox"));
	tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.componentBox2"));
}
 
Example #15
Source File: ItemSpaceArmor.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, World p_77624_2_,
		List list, ITooltipFlag p_77624_4_) {
	super.addInformation(stack, p_77624_2_, list, p_77624_4_);

	list.add(LibVulpes.proxy.getLocalizedString("msg.modules"));

	for(ItemStack componentStack : getComponents(stack)) {
		list.add(ChatFormatting.DARK_GRAY + componentStack.getDisplayName());
	}
}
 
Example #16
Source File: ItemIdWithName.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
   @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World player,
		List list, ITooltipFlag bool) {
	if(stack.getItemDamage() == -1) {
		list.add(ChatFormatting.GRAY + "Unprogrammed");
	}
	else {
		list.add(getName(stack));
	}
}
 
Example #17
Source File: ItemStationChip.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
   @SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World player, List list,
		ITooltipFlag bool) {
	if(getUUID(stack) == 0)
		list.add(ChatFormatting.GRAY + LibVulpes.proxy.getLocalizedString("msg.unprogrammed"));
	else {
		list.add(ChatFormatting.GREEN + LibVulpes.proxy.getLocalizedString("msg.stationchip.sation") + getUUID(stack));
		super.addInformation(stack, player, list, bool);
		if(player.provider.getDimension() == Configuration.spaceDimId) {
            Entity p = Minecraft.getMinecraft().player;
			ISpaceObject obj = SpaceObjectManager.getSpaceManager().getSpaceStationFromBlockCoords(p.getPosition());
			
			if(obj != null) {
				Vector3F<Float> vec = getTakeoffCoords(stack, obj.getOrbitingPlanetId());
				
				if(vec != null) {
					list.add("X: " + vec.x);
					list.add("Z: " + vec.z);
				}
				else {
					list.add("X: N/A");
					list.add("Z: N/A");
				}
			}
		}
		
	}
}
 
Example #18
Source File: ItemSatellite.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, World player, List list,
           ITooltipFlag bool) {

	SatelliteProperties properties = getSatellite(stack);

	if(properties != null) {
		int dataStorage, powerGeneration, powerStorage;

		list.add(getName(stack));
		list.add("ID: " + properties.getId());

		if(SatelliteProperties.Property.BATTERY.isOfType(properties.getPropertyFlag())) {
			if( (powerStorage = properties.getPowerStorage()) > 0)
				list.add(LibVulpes.proxy.getLocalizedString("msg.itemsatellite.pwr") + powerStorage);
			else
				list.add(ChatFormatting.RED + LibVulpes.proxy.getLocalizedString("msg.itemsatellite.nopwr"));
		}

		if(SatelliteProperties.Property.POWER_GEN.isOfType(properties.getPropertyFlag())) {
			if( ( powerGeneration=properties.getPowerGeneration() ) > 0)
				list.add(LibVulpes.proxy.getLocalizedString("msg.itemsatellite.pwrgen") + powerGeneration);
			else
				list.add(ChatFormatting.RED + LibVulpes.proxy.getLocalizedString("msg.itemsatellite.nopwrgen"));
		}

		if(SatelliteProperties.Property.DATA.isOfType(properties.getPropertyFlag())) {
			if( (dataStorage = properties.getMaxDataStorage()) > 0 ) 
				list.add(LibVulpes.proxy.getLocalizedString("msg.itemsatellite.data") + ZUtils.formatNumber(dataStorage));
			else
				list.add(ChatFormatting.YELLOW + LibVulpes.proxy.getLocalizedString("msg.itemsatellite.nodata"));
		}
	}
	else {
		list.add(ChatFormatting.RED + LibVulpes.proxy.getLocalizedString("msg.itemsatellite.empty"));
	}
}
 
Example #19
Source File: ItemPlanetIdentificationChip.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void addInformation(ItemStack stack, World player, List list,
           ITooltipFlag bool){

	if(!stack.hasTagCompound()) {
		list.add(LibVulpes.proxy.getLocalizedString("msg.unprogrammed"));
	}
	else if(!hasValidDimension(stack)) {
		list.add(ChatFormatting.RED + LibVulpes.proxy.getLocalizedString("msg.programfail"));
	}
	else {
		if(stack.getItemDamage()  == 0) {
			DimensionProperties props = DimensionManager.getInstance().getDimensionProperties(getDimensionId(stack));

			String unknown = ChatFormatting.YELLOW + "???";
			String dimName = stack.getTagCompound().getString(dimensionNameIdentifier);

			list.add(LibVulpes.proxy.getLocalizedString("msg.itemplanetidchip.planetname") + ChatFormatting.DARK_GREEN  + dimName);

			if( !props.getRequiredArtifacts().isEmpty()) {
				list.add(LibVulpes.proxy.getLocalizedString("msg.itemplanetidchip.artifacts"));
				for(ItemStack stack2 : props.getRequiredArtifacts())
				{
					list.add(ChatFormatting.DARK_PURPLE + "    " + stack2.getDisplayName());
				}
			}

			//super.addInformation(stack, player, list, bool);

			//list.add("Mass: " + unknown);
			//list.add("Atmosphere Density: " + unknown);
			//list.add("Distance From Star: " + unknown);

		}
		else { //Space station
			list.add(LibVulpes.proxy.getLocalizedString("msg.itemplanetidchip.stationid") + ChatFormatting.DARK_GREEN + stack.getTagCompound().getString(dimensionNameIdentifier));
		}
	}
}
 
Example #20
Source File: AgriAlphaWarnings.java    From AgriCraft with MIT License 5 votes vote down vote up
public static void chooseMessage(Consumer<String> consumer) {
    if (AgriCraftConfig.disableLinks) {
        consumer.accept(ChatFormatting.DARK_AQUA + BORING_WARNING);
    } else {
        for (String line : WARNINGS[chooseMessageNumber()]) {
            consumer.accept(ChatFormatting.DARK_AQUA + line);
        }
    }
}
 
Example #21
Source File: TunnellerHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
public TunnellerHack()
{
	super("Tunneller",
		"Automatically digs a tunnel.\n\n" + ChatFormatting.RED
			+ ChatFormatting.BOLD + "WARNING:" + ChatFormatting.RESET
			+ " Although this bot will try to avoid\n"
			+ "lava and other dangers, there is no guarantee\n"
			+ "that it won't die. Only send it out with gear\n"
			+ "that you don't mind losing.");
	setCategory(Category.BLOCKS);
	addSetting(size);
	addSetting(limit);
	addSetting(torches);
}
 
Example #22
Source File: Command.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public void printUsage() {
    final String[] usage = this.getUsage().split("\n");
    Seppuku.INSTANCE.logChat(ChatFormatting.GRAY + this.getDisplayName() + " usage: ");

    if (this.textComponentUsage != null) {
        this.getTextComponentUsage().getSiblings().forEach(Seppuku.INSTANCE::logcChat);
    } else {
        for (String u : usage) {
            Seppuku.INSTANCE.logChat(u);
        }
    }
}
 
Example #23
Source File: ClientProxy.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void addMaterialFormulaHandler(ItemTooltipEvent event) {
    ItemStack itemStack = event.getItemStack();
    if (!(itemStack.getItem() instanceof ItemBlock)) {
        UnificationEntry unificationEntry = OreDictUnifier.getUnificationEntry(itemStack);
        if (unificationEntry != null && unificationEntry.material != null) {
            String formula = unificationEntry.material.chemicalFormula;
            if (formula != null && !formula.isEmpty() && !formula.equals("?")) {
                event.getToolTip().add(1, ChatFormatting.GRAY.toString() + unificationEntry.material.chemicalFormula);
            }
        }
    }
}
 
Example #24
Source File: SexyFontRenderer.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public int drawString(String text, float x, float y, int color, boolean dropShadow) {
	if(!(SexyFont.sexyTime || SexyFont.alwaysSexyTime)) {
		return super.drawString(text, x, y, color, dropShadow);
	}
	
	if(SexyFont.intermittentSexyTime) {
		int hash = text.hashCode() % 8;
		int offset = (int) (Minecraft.getSystemTime() / 230f) % 8;
		if((hash + offset) % 8 != 0) {
			return super.drawString(text, x, y, color, dropShadow);
		}
	}
	
	//Ok this is epic
	float posX = x;
	float huehuehue = (Minecraft.getSystemTime() / 700f) % 1;
	float huehuehueStep = rangeRemap((float) (Math.sin(Minecraft.getSystemTime() / 2000f) % 6.28318f), -1, 1, 0.01f, 0.15f);
	
	String textRender = ChatFormatting.stripFormatting(text);
	
	for(int i = 0; i < textRender.length(); i++) {
		int c = (color & 0xFF000000) | MathHelper.hsvToRGB(huehuehue, .8f, 1);
		
		float yOffset = (float) Math.sin(i + (Minecraft.getSystemTime() / 300f));
		
		posX = super.drawString(String.valueOf(textRender.charAt(i)), posX, y + yOffset, c, true) - 1;
		
		huehuehue += huehuehueStep;
		huehuehue %= 1;
	}
	
	return (int) posX;
}
 
Example #25
Source File: CalcStrongholdCommand.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        if (this.firstStart != null && this.firstEnd != null && this.secondStart != null && this.secondEnd != null) {
            final double[] start = new double[]{this.secondStart.x, this.secondStart.z, this.secondEnd.x, this.secondEnd.z};
            final double[] end = new double[]{this.firstStart.x, this.firstStart.z, this.firstEnd.x, this.firstEnd.z};
            final double[] intersection = MathUtil.calcIntersection(start, end);

            if (Double.isNaN(intersection[0]) || Double.isNaN(intersection[1]) || Double.isInfinite(intersection[0]) || Double.isInfinite(intersection[1])) {
                Seppuku.INSTANCE.errorChat("Error lines are parallel");
                Seppuku.INSTANCE.getEventManager().removeEventListener(this);
                return;
            }

            final double dist = Minecraft.getMinecraft().player.getDistance(intersection[0], Minecraft.getMinecraft().player.posY, intersection[1]);

            final TextComponentString component = new TextComponentString("Stronghold found " + ChatFormatting.GRAY + (int) dist + "m away");
            final String coords = String.format("X: %s, Y: ?, Z: %s\nClick to add a Waypoint", (int) intersection[0], (int) intersection[1]);
            final CommandsModule cmds = (CommandsModule) Seppuku.INSTANCE.getModuleManager().find(CommandsModule.class);

            if (cmds != null) {
                component.setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(coords))).setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, cmds.prefix.getValue() + "Waypoints add Stronghold " + intersection[0] + " " + Minecraft.getMinecraft().player.posY + " " + intersection[1])));
            }

            Seppuku.INSTANCE.logcChat(component);
            Seppuku.INSTANCE.getNotificationManager().addNotification("", "Stronghold found " + ChatFormatting.GRAY + (int) dist + "m away");
            this.firstStart = null;
            this.firstEnd = null;
            this.secondStart = null;
            this.secondEnd = null;
            Seppuku.INSTANCE.getEventManager().removeEventListener(this);
        }
    }
}
 
Example #26
Source File: TpsComponent.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);

    final String tickrate = String.format(ChatFormatting.WHITE + "TPS: %.2f", Seppuku.INSTANCE.getTickRateManager().getTickRate());

    this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(tickrate));
    this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);

    //RenderUtil.drawRect(this.getX(), this.getY(), this.getX() + this.getW(), this.getY() + this.getH(), 0x90222222);
    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(tickrate, this.getX(), this.getY(), -1);
}
 
Example #27
Source File: DirectionComponent.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTicks) {
    super.render(mouseX, mouseY, partialTicks);

    final Minecraft mc = Minecraft.getMinecraft();
    final String direction = String.format("%s" + " " + ChatFormatting.GRAY + "%s", this.getFacing(), this.getTowards());
    this.setW(Minecraft.getMinecraft().fontRenderer.getStringWidth(direction));
    this.setH(Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT);

    Minecraft.getMinecraft().fontRenderer.drawStringWithShadow(direction, this.getX(), this.getY(), -1);
}
 
Example #28
Source File: VisualRangeModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onEntityRemove(EventRemoveEntity event) {
    if (Minecraft.getMinecraft().world != null && !Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
        if (this.prevPlayer != event.getEntity().getEntityId()) {
            this.prevPlayer = event.getEntity().getEntityId();
            final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
            final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has left your visual range.";
            Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
            Seppuku.INSTANCE.logChat(msg);
        }
    }
}
 
Example #29
Source File: VisualRangeModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onEntityAdded(EventAddEntity event) {
    if (Minecraft.getMinecraft().world != null && !Minecraft.getMinecraft().player.isDead && event.getEntity() instanceof EntityPlayer && !event.getEntity().getName().equalsIgnoreCase(Minecraft.getMinecraft().player.getName())) {
        final Friend friend = Seppuku.INSTANCE.getFriendManager().isFriend(event.getEntity());
        final String msg = (friend != null ? ChatFormatting.DARK_PURPLE : ChatFormatting.RED) + (friend != null ? friend.getAlias() : event.getEntity().getName()) + ChatFormatting.WHITE + " has entered your visual range.";
        Seppuku.INSTANCE.getNotificationManager().addNotification("", msg);
        Seppuku.INSTANCE.logChat(msg);
        if (event.getEntity().getEntityId() == this.prevPlayer) {
            this.prevPlayer = -1;
        }
    }
}
 
Example #30
Source File: PortalFinderModule.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
private void printEndPortalToChat(Vec3d portal) {
    final TextComponentString portalTextComponent = new TextComponentString("End Portal found!");

    String coords = String.format("X: %s, Y: %s, Z: %s", (int) portal.x, (int) portal.y, (int) portal.z);
    int playerDistance = (int) Minecraft.getMinecraft().player.getDistance(portal.x, portal.y, portal.z);
    String distance = ChatFormatting.GRAY + "" + playerDistance + "m away";

    String hoverText = coords + "\n" + distance;
    portalTextComponent.setStyle(new Style().setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TextComponentString(hoverText))));

    Seppuku.INSTANCE.logcChat(portalTextComponent);
}