Java Code Examples for net.minecraft.item.Items#WRITTEN_BOOK

The following examples show how to use net.minecraft.item.Items#WRITTEN_BOOK . 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: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBookToolTip(Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.WRITABLE_BOOK && slot.getStack().getItem() != Items.WRITTEN_BOOK) return;
	
	if (pages == null) pages = ItemContentUtils.getTextInBook(slot.getStack());
	if (pages.isEmpty()) return;
	
	/* Cycle through pages */
	if (mc.player.age % 80 == 0 && !shown) {
		shown = true;
		if (pageCount == pages.size() - 1) pageCount = 0;
		else pageCount++;
	} else if (mc.player.age % 80 != 0) shown = false;
	
	int lenght = mc.textRenderer.getStringWidth("Page: " + (pageCount + 1) + "/" + pages.size());
	
	renderTooltipBox(mX + 56 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 19, 5, lenght, true);
	renderTooltipBox(mX, mY - pages.get(pageCount).size() * 10 - 6, pages.get(pageCount).size() * 10 - 2, 120, true);
	mc.textRenderer.drawWithShadow("Page: " + (pageCount + 1) + "/" + pages.size(),
			mX + 68 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 32, -1);
	
	int count = 0;
	for (String s: pages.get(pageCount)) {
		mc.textRenderer.drawWithShadow(s, mX + 12, mY - 18 - pages.get(pageCount).size() * 10 + count * 10, 0x00c0c0);
		count++;
	}
	
}
 
Example 2
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBookToolTip(MatrixStack matrix, Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.WRITABLE_BOOK && slot.getStack().getItem() != Items.WRITTEN_BOOK) return;
	
	if (pages == null) pages = ItemContentUtils.getTextInBook(slot.getStack());
	if (pages.isEmpty()) return;
	
	/* Cycle through pages */
	if (mc.player.age % 80 == 0 && !shown) {
		shown = true;
		if (pageCount == pages.size() - 1) pageCount = 0;
		else pageCount++;
	} else if (mc.player.age % 80 != 0) shown = false;
	
	int lenght = mc.textRenderer.getWidth("Page: " + (pageCount + 1) + "/" + pages.size());
	
	renderTooltipBox(mX + 56 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 19, 5, lenght, true);
	renderTooltipBox(mX, mY - pages.get(pageCount).size() * 10 - 6, pages.get(pageCount).size() * 10 - 2, 120, true);
	mc.textRenderer.drawWithShadow(matrix, "Page: " + (pageCount + 1) + "/" + pages.size(),
			mX + 68 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 32, -1);
	
	int count = 0;
	for (String s: pages.get(pageCount)) {
		mc.textRenderer.drawWithShadow(matrix, s, mX + 12, mY - 18 - pages.get(pageCount).size() * 10 + count * 10, 0x00c0c0);
		count++;
	}
	
}
 
Example 3
Source File: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBookToolTip(Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.WRITABLE_BOOK && slot.getStack().getItem() != Items.WRITTEN_BOOK) return;
	
	if (pages == null) pages = ItemContentUtils.getTextInBook(slot.getStack());
	if (pages.isEmpty()) return;
	
	/* Cycle through pages */
	if (mc.player.age % 80 == 0 && !shown) {
		shown = true;
		if (pageCount == pages.size() - 1) pageCount = 0;
		else pageCount++;
	} else if (mc.player.age % 80 != 0) shown = false;
	
	int lenght = mc.textRenderer.getStringWidth("Page: " + (pageCount + 1) + "/" + pages.size());
	
	renderTooltipBox(mX + 56 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 19, 5, lenght, true);
	renderTooltipBox(mX, mY - pages.get(pageCount).size() * 10 - 6, pages.get(pageCount).size() * 10 - 2, 120, true);
	mc.textRenderer.drawWithShadow("Page: " + (pageCount + 1) + "/" + pages.size(),
			mX + 68 - lenght / 2, mY - pages.get(pageCount).size() * 10 - 32, -1);
	
	int count = 0;
	for (String s: pages.get(pageCount)) {
		mc.textRenderer.drawWithShadow(s, mX + 12, mY - 18 - pages.get(pageCount).size() * 10 + count * 10, 0x00c0c0);
		count++;
	}
	
}