mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 19:29:31 +00:00
another half
This commit is contained in:
1 parent
64d90dd502
commit
233ab271f7
33 files changed
+329
-429
No files matched your search
@@ -38,6 +38,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -233,7 +234,7 @@ public class TileEntitySpecialFlower extends TileEntity implements ITickableTile
|
||||
/**
|
||||
* Called when a player right clicks this sub tile.
|
||||
*/
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, Direction side, double hitX, double hitY, double hitZ) { return false; }
|
||||
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { return false; }
|
||||
|
||||
/**
|
||||
* Called when this sub tile is added to the world.
|
||||
|
||||
@@ -66,8 +66,9 @@ public final class MultiblockRenderHandler {
|
||||
@SubscribeEvent
|
||||
public static void onWorldRenderLast(RenderWorldLastEvent event) {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
if(mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getBlockPos() != null && (!mc.player.isSneaking() || anchor != null)) {
|
||||
renderPlayerLook(mc.player, mc.objectMouseOver);
|
||||
if(mc.player != null && mc.objectMouseOver != null && mc.objectMouseOver.getType() != RayTraceResult.Type.BLOCK
|
||||
&& (!mc.player.isSneaking() || anchor != null)) {
|
||||
renderPlayerLook(mc.player, (BlockRayTraceResult) mc.objectMouseOver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SharedConstants;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
@@ -54,6 +55,7 @@ import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.core.handler.ModSounds;
|
||||
import vazkii.botania.common.item.ItemLexicon;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lexicon.page.PageText;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
@@ -117,6 +119,14 @@ public class GuiLexicon extends Screen {
|
||||
protected final Minecraft mc = Minecraft.getInstance();
|
||||
int left, top;
|
||||
|
||||
public GuiLexicon() {
|
||||
this(new TranslationTextComponent(ModItems.lexicon.getTranslationKey()));
|
||||
}
|
||||
|
||||
protected GuiLexicon(ITextComponent title) {
|
||||
super(title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void init() {
|
||||
super.init();
|
||||
@@ -164,7 +174,7 @@ public class GuiLexicon extends Screen {
|
||||
int x = 18;
|
||||
for(int i = 0; i < 12; i++) {
|
||||
int y = 16 + i * 12;
|
||||
buttons.add(new GuiButtonInvisible((GuiLexiconIndex) this, i, left + x, top + y, 110, 10, ""));
|
||||
buttons.add(new GuiButtonInvisible((GuiLexiconIndex) this, left + x, top + y, 110, 10, ""));
|
||||
}
|
||||
populateIndex();
|
||||
} else if(isCategoryIndex()) {
|
||||
@@ -177,32 +187,32 @@ public class GuiLexicon extends Screen {
|
||||
int y = i / perline;
|
||||
|
||||
int size = 22;
|
||||
GuiButtonCategory button = new GuiButtonCategory(i, left + 18 + x * size, top + 50 + y * size, this, category);
|
||||
GuiButtonCategory button = new GuiButtonCategory(left + 18 + x * size, top + 50 + y * size, this, category);
|
||||
buttons.add(button);
|
||||
}
|
||||
}
|
||||
populateBookmarks();
|
||||
if(isMainPage()) {
|
||||
buttons.add(new GuiButtonOptions(-1, left + 20, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonAchievement(-2, left + 33, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonChallenges(-3, left + 45, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonScaleChange(-4, left + 57, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonOptions(left + 20, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonAchievement(left + 33, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonChallenges(left + 45, top + guiHeight - 25));
|
||||
buttons.add(new GuiButtonScaleChange(left + 57, top + guiHeight - 25));
|
||||
|
||||
GuiButtonUpdateWarning button = new GuiButtonUpdateWarning(-98, left - 6, top + guiHeight - 70);
|
||||
GuiButtonUpdateWarning button = new GuiButtonUpdateWarning(left - 6, top + guiHeight - 70);
|
||||
buttons.add(button);
|
||||
|
||||
if(PersistentVariableHelper.lastBotaniaVersion.equals(LibMisc.VERSION)) {
|
||||
button.enabled = false;
|
||||
button.active = false;
|
||||
button.visible = false;
|
||||
}
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
if(now.getMonth() == Month.NOVEMBER && now.getDayOfMonth() == 22)
|
||||
buttons.add(new GuiButtonDoot(-99, left + 100, top + 12));
|
||||
buttons.add(new GuiButtonDoot(left + 100, top + 12));
|
||||
}
|
||||
|
||||
buttons.add(new GuiButtonNotes(this, 1336, left - 4, top - 4));
|
||||
buttons.add(new GuiButtonNotes(this, left - 4, top - 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -356,7 +366,7 @@ public class GuiLexicon extends Screen {
|
||||
|
||||
public void drawBookmark(int x, int y, String s, boolean drawLeft, int color, int v) {
|
||||
// This function is called from the buttons so I can't use font
|
||||
FontRenderer font = Minecraft.getInstance().font;
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
int l = font.getStringWidth(s);
|
||||
int fontOff = 0;
|
||||
|
||||
@@ -471,13 +481,13 @@ public class GuiLexicon extends Screen {
|
||||
for(int i = 0; i < len + (addEnabled ? 1 : 0); i++) {
|
||||
boolean isAdd = i == bookmarks.size();
|
||||
GuiLexicon gui = isAdd ? null : bookmarks.get(i);
|
||||
buttons.add(new GuiButtonBookmark(BOOKMARK_START + i, left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));
|
||||
buttons.add(new GuiButtonBookmark(left + 138, top + 18 + 14 * i, gui == null ? this : gui, gui == null ? "+" : gui.getTitle()));
|
||||
}
|
||||
|
||||
if(isMainPage())
|
||||
buttons.add(new GuiButtonHistory(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
|
||||
buttons.add(new GuiButtonHistory(left + 138, top + guiHeight - 24, I18n.format("botaniamisc.history"), this));
|
||||
else if(isChallenge())
|
||||
buttons.add(new GuiButtonChallengeInfo(BOOKMARK_START + MAX_BOOKMARK_COUNT, left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
|
||||
buttons.add(new GuiButtonChallengeInfo(left + 138, top + guiHeight - 24, I18n.format("botaniamisc.info"), this));
|
||||
}
|
||||
|
||||
public static void startTutorial() {
|
||||
|
||||
@@ -16,7 +16,10 @@ import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import vazkii.botania.client.challenge.Challenge;
|
||||
import vazkii.botania.client.challenge.ModChallenges;
|
||||
@@ -40,35 +43,21 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
public GuiLexiconChallenge(GuiLexicon parent, Challenge challenge) {
|
||||
this.parent = parent;
|
||||
this.challenge = challenge;
|
||||
setTitle();
|
||||
}
|
||||
|
||||
private void setTitle() {
|
||||
title = challenge == null ? "(null)" : I18n.format(challenge.unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitGui() {
|
||||
super.onInitGui();
|
||||
setTitle();
|
||||
|
||||
buttons.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(completeButton = new Button(13, left + 20, top + guiHeight - 35, guiWidth - 40, 20, "") {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
challenge.complete = !challenge.complete;
|
||||
setCompleteButtonTitle();
|
||||
PersistentVariableHelper.saveSafe();
|
||||
}
|
||||
});
|
||||
buttons.add(backButton = new GuiButtonBack(left + guiWidth / 2 - 8, top + guiHeight + 2, b -> {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
buttons.add(completeButton = new Button(left + 20, top + guiHeight - 35, guiWidth - 40, 20, "", b -> {
|
||||
challenge.complete = !challenge.complete;
|
||||
setCompleteButtonTitle();
|
||||
PersistentVariableHelper.saveSafe();
|
||||
}));
|
||||
setCompleteButtonTitle();
|
||||
}
|
||||
|
||||
@@ -82,8 +71,8 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
fontRenderer.drawString(TextFormatting.BOLD + I18n.format(challenge.unlocalizedName), left + 38, top + 13, 0);
|
||||
fontRenderer.drawString(I18n.format(challenge.level.getName()) + ((challenge.icon.getItem() instanceof ItemRune) ? "+" : "") + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.format(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
|
||||
font.drawString(TextFormatting.BOLD + I18n.format(challenge.unlocalizedName), left + 38, top + 13, 0);
|
||||
font.drawString(I18n.format(challenge.level.getName()) + ((challenge.icon.getItem() instanceof ItemRune) ? "+" : "") + " / " + (challenge.complete ? TextFormatting.DARK_GREEN : TextFormatting.DARK_RED) + I18n.format(challenge.complete ? "botaniamisc.completed" : "botaniamisc.notCompleted"), left + 38, top + 23, 0);
|
||||
|
||||
int width = guiWidth - 30;
|
||||
int x = left + 16;
|
||||
@@ -116,12 +105,12 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
private void setCompleteButtonTitle() {
|
||||
completeButton.displayString = I18n.format(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted");
|
||||
completeButton.setMessage(I18n.format(challenge.complete ? "botaniamisc.markNotCompleted" : "botaniamisc.markCompleted"));
|
||||
}
|
||||
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
if(backButton.active) {
|
||||
backButton.playDownSound(mc.getSoundHandler());
|
||||
backButton.onClick(backButton.x, backButton.y);
|
||||
}
|
||||
}
|
||||
@@ -137,8 +126,10 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public ITextComponent getTitle() {
|
||||
return challenge == null
|
||||
? new StringTextComponent("(null)")
|
||||
: new TranslationTextComponent(challenge.unlocalizedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -167,7 +158,6 @@ public class GuiLexiconChallenge extends GuiLexicon implements IParented {
|
||||
super.load(cmp);
|
||||
String challengeName = cmp.getString(TAG_CHALLENGE);
|
||||
challenge = ModChallenges.challengeLookup.get(challengeName);
|
||||
setTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,9 @@ package vazkii.botania.client.gui.lexicon;
|
||||
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import vazkii.botania.client.challenge.Challenge;
|
||||
import vazkii.botania.client.challenge.EnumChallengeLevel;
|
||||
@@ -30,23 +32,18 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
private Button backButton;
|
||||
|
||||
public GuiLexiconChallengesList() {
|
||||
parent = new GuiLexicon();
|
||||
title = I18n.format("botaniamisc.challenges");
|
||||
super(new TranslationTextComponent("botaniamisc.challenges"));
|
||||
parent = new GuiLexicon(getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitGui() {
|
||||
super.onInitGui();
|
||||
title = I18n.format("botaniamisc.challenges");
|
||||
|
||||
buttons.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(backButton = new GuiButtonBack(left + guiWidth / 2 - 8, top + guiHeight + 2, b -> {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
|
||||
int perline = 6;
|
||||
int i = 13;
|
||||
@@ -54,7 +51,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
for(EnumChallengeLevel level : EnumChallengeLevel.class.getEnumConstants()) {
|
||||
int j = 0;
|
||||
for(Challenge c : ModChallenges.challenges.get(level)) {
|
||||
buttons.add(new GuiButtonChallengeIcon(i, left + 20 + j % perline * 18, y + j / perline * 17, c, this));
|
||||
buttons.add(new GuiButtonChallengeIcon(left + 20 + j % perline * 18, y + j / perline * 17, c, this));
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
@@ -83,7 +80,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
back();
|
||||
return true;
|
||||
} else if(keyCode == GLFW.GLFW_KEY_HOME) {
|
||||
mc.displayGuiScreen(new GuiLexicon());
|
||||
mc.displayGuiScreen(new GuiLexicon(getTitle()));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
return true;
|
||||
}
|
||||
@@ -101,7 +98,7 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
if(backButton.active) {
|
||||
backButton.playDownSound(mc.getSoundHandler());
|
||||
backButton.onClick(backButton.x, backButton.y);
|
||||
}
|
||||
@@ -117,11 +114,6 @@ public class GuiLexiconChallengesList extends GuiLexicon implements IParented {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isChallenge() {
|
||||
return true;
|
||||
|
||||
@@ -17,6 +17,8 @@ import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -77,63 +79,43 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
public void onInitGui() {
|
||||
super.onInitGui();
|
||||
|
||||
buttons.add(backButton = new GuiButtonBackWithShift(0, left + guiWidth / 2 - 8, top + guiHeight + 2) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
mc.displayGuiScreen(Screen.isShiftKeyDown() ? new GuiLexicon() : parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(leftButton = new GuiButtonPage(1, left, top + guiHeight - 10, false) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
page--;
|
||||
entry.pages.get(page).onOpened(GuiLexiconEntry.this);
|
||||
buttons.add(backButton = new GuiButtonBackWithShift(left + guiWidth / 2 - 8, top + guiHeight + 2, b -> {
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
mc.displayGuiScreen(Screen.hasShiftDown() ? new GuiLexicon() : parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
buttons.add(leftButton = new GuiButtonPage(left, top + guiHeight - 10, false, b -> {
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
page--;
|
||||
entry.pages.get(page).onOpened(GuiLexiconEntry.this);
|
||||
|
||||
ClientTickHandler.notifyPageChange();
|
||||
updatePageButtons();
|
||||
}
|
||||
});
|
||||
buttons.add(rightButton = new GuiButtonPage(2, left + guiWidth - 18, top + guiHeight - 10, true) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
page++;
|
||||
entry.pages.get(page).onOpened(GuiLexiconEntry.this);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
updatePageButtons();
|
||||
}));
|
||||
buttons.add(rightButton = new GuiButtonPage(left + guiWidth - 18, top + guiHeight - 10, true, b -> {
|
||||
entry.pages.get(page).onClosed(GuiLexiconEntry.this);
|
||||
page++;
|
||||
entry.pages.get(page).onOpened(GuiLexiconEntry.this);
|
||||
|
||||
ClientTickHandler.notifyPageChange();
|
||||
updatePageButtons();
|
||||
}
|
||||
});
|
||||
buttons.add(new GuiButtonShare(3, left + guiWidth - 6, top - 2) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
String cmd = "/botania-share " + entry.getUnlocalizedName();
|
||||
ClientTickHandler.notifyPageChange();
|
||||
updatePageButtons();
|
||||
}));
|
||||
buttons.add(new GuiButtonShare(left + guiWidth - 6, top - 2, b -> {
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
String cmd = "/botania-share " + entry.getUnlocalizedName();
|
||||
|
||||
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
|
||||
mc.player.sendChatMessage(cmd);
|
||||
}
|
||||
});
|
||||
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
|
||||
mc.player.sendChatMessage(cmd);
|
||||
}));
|
||||
if(entry.getWebLink() != null)
|
||||
buttons.add(new GuiButtonViewOnline(4, left - 8, top + 12) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
try {
|
||||
if(Desktop.isDesktopSupported())
|
||||
Desktop.getDesktop().browse(new URI(entry.getWebLink()));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
buttons.add(new GuiButtonViewOnline(left - 8, top + 12, b -> {
|
||||
try {
|
||||
if(Desktop.isDesktopSupported())
|
||||
Desktop.getDesktop().browse(new URI(entry.getWebLink()));
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
if(!GuiLexicon.isValidLexiconGui(this)) {
|
||||
currentOpenLexicon = new GuiLexicon();
|
||||
@@ -165,8 +147,8 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return String.format("%s " + TextFormatting.ITALIC + "(%s/%s)", title, page + 1, entry.pages.size());
|
||||
public ITextComponent getTitle() {
|
||||
return new StringTextComponent(String.format("%s " + TextFormatting.ITALIC + "(%s/%s)", title, page + 1, entry.pages.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -185,10 +167,10 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
private void updatePageButtons() {
|
||||
leftButton.enabled = page != 0;
|
||||
rightButton.enabled = page + 1 < entry.pages.size();
|
||||
leftButton.active = page != 0;
|
||||
rightButton.active = page + 1 < entry.pages.size();
|
||||
if(firstEntry)
|
||||
backButton.enabled = !rightButton.enabled;
|
||||
backButton.active = !rightButton.active;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -227,7 +209,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
return;
|
||||
}
|
||||
|
||||
if(rightButton.enabled && rightButton.visible)
|
||||
if(rightButton.active && rightButton.visible)
|
||||
orientTutorialArrowWithButton(rightButton);
|
||||
}
|
||||
|
||||
@@ -333,23 +315,23 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
|
||||
}
|
||||
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
if(backButton.active) {
|
||||
backButton.playDownSound(mc.getSoundHandler());
|
||||
backButton.onClick(backButton.x, backButton.y);
|
||||
}
|
||||
}
|
||||
|
||||
private void nextPage() {
|
||||
if(rightButton.enabled) {
|
||||
rightButton.playPressSound(mc.getSoundHandler());
|
||||
if(rightButton.active) {
|
||||
rightButton.playDownSound(mc.getSoundHandler());
|
||||
rightButton.onClick(rightButton.x, rightButton.y);
|
||||
updateNote();
|
||||
}
|
||||
}
|
||||
|
||||
private void prevPage() {
|
||||
if(leftButton.enabled) {
|
||||
leftButton.playPressSound(mc.getSoundHandler());
|
||||
if(leftButton.active) {
|
||||
leftButton.playDownSound(mc.getSoundHandler());
|
||||
leftButton.onClick(leftButton.x, leftButton.y);
|
||||
updateNote();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,9 @@ import net.minecraft.item.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
import vazkii.botania.api.BotaniaAPI;
|
||||
import vazkii.botania.api.lexicon.ILexicon;
|
||||
@@ -59,13 +61,9 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
final List<LexiconEntry> entriesToDisplay = new ArrayList<>();
|
||||
|
||||
public GuiLexiconIndex(LexiconCategory category) {
|
||||
super(new TranslationTextComponent("botaniamisc.lexiconIndex"));
|
||||
this.category = category;
|
||||
parent = new GuiLexicon();
|
||||
setTitle();
|
||||
}
|
||||
|
||||
private void setTitle() {
|
||||
title = I18n.format(category == null ? "botaniamisc.lexiconIndex" : category.getUnlocalizedName());
|
||||
this.parent = new GuiLexicon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,8 +72,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return title;
|
||||
public ITextComponent getTitle() {
|
||||
return category == null ? super.getTitle() : new TranslationTextComponent(category.getUnlocalizedName());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,38 +97,26 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
return;
|
||||
}
|
||||
|
||||
buttons.add(backButton = new GuiButtonBack(12, left + guiWidth / 2 - 8, top + guiHeight + 2) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(leftButton = new GuiButtonPage(13, left, top + guiHeight - 10, false) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
page--;
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(rightButton = new GuiButtonPage(14, left + guiWidth - 18, top + guiHeight - 10, true) {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
page++;
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
});
|
||||
buttons.add(backButton = new GuiButtonBack(left + guiWidth / 2 - 8, top + guiHeight + 2, b -> {
|
||||
mc.displayGuiScreen(parent);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
buttons.add(leftButton = new GuiButtonPage(left, top + guiHeight - 10, false, b -> {
|
||||
page--;
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
buttons.add(rightButton = new GuiButtonPage(left + guiWidth - 18, top + guiHeight - 10, true, b -> {
|
||||
page++;
|
||||
updatePageButtons();
|
||||
populateIndex();
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}));
|
||||
|
||||
searchField = new TextFieldWidget(15, fontRenderer, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10);
|
||||
searchField = new TextFieldWidget(font, left + guiWidth / 2 + 28, top + guiHeight + 6, 200, 10, "");
|
||||
searchField.setCanLoseFocus(false);
|
||||
searchField.setFocused(true);
|
||||
searchField.changeFocus(true);
|
||||
searchField.setEnableBackgroundDrawing(false);
|
||||
|
||||
updateAll();
|
||||
@@ -178,14 +164,14 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) buttons.get(i - page * 12);
|
||||
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
|
||||
if(entry != null) {
|
||||
button.displayString = entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.format(entry.getUnlocalizedName());
|
||||
button.setMessage(entry.getKnowledgeType().color + "" + (entry.isPriority() ? TextFormatting.ITALIC : "") + I18n.format(entry.getUnlocalizedName()));
|
||||
button.displayStack = entry.getIcon();
|
||||
if(entry == tutEntry)
|
||||
tutPage = page;
|
||||
|
||||
if(entry instanceof DogLexiconEntry)
|
||||
button.dog = true;
|
||||
} else button.displayString = "";
|
||||
} else button.setMessage("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -204,7 +190,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
drawBookmark(left + 138, top + guiHeight - 24, " " + searchField.getText(), false);
|
||||
mc.textureManager.bindTexture(texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(left + 134, top + guiHeight - 26, 86, 180, 12, 12);
|
||||
blit(left + 134, top + guiHeight - 26, 86, 180, 12, 12);
|
||||
|
||||
if(entriesToDisplay.size() == 1) {
|
||||
String s = I18n.format("botaniamisc.enterToView");
|
||||
@@ -216,7 +202,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
float animationTime = 4F;
|
||||
if(isShiftKeyDown()) {
|
||||
if(hasShiftDown()) {
|
||||
if(currentButton != null)
|
||||
infoTime = Math.min(animationTime, infoTime + timeDelta);
|
||||
} else {
|
||||
@@ -247,8 +233,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translatef(x, y, 0);
|
||||
GlStateManager.scalef(fract, 1F, 1F);
|
||||
AbstractGui.drawRect(12, -30, width + 20, -2, 0x44000000);
|
||||
AbstractGui.drawRect(10, -32, width + 22, -2, 0x44000000);
|
||||
AbstractGui.fill(12, -30, width + 20, -2, 0x44000000);
|
||||
AbstractGui.fill(10, -32, width + 22, -2, 0x44000000);
|
||||
|
||||
drawBookmark(width / 2 + 16, -8, s, true, 0xFFFFFF, 180);
|
||||
|
||||
@@ -313,8 +299,8 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
private void updatePageButtons() {
|
||||
leftButton.enabled = page != 0;
|
||||
rightButton.enabled = page < (entriesToDisplay.size() - 1) / 12;
|
||||
leftButton.active = page != 0;
|
||||
rightButton.active = page < (entriesToDisplay.size() - 1) / 12;
|
||||
putTutorialArrow();
|
||||
}
|
||||
|
||||
@@ -366,7 +352,7 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double w) {
|
||||
public boolean mouseScrolled(double x, double y, double w) {
|
||||
if(w < 0)
|
||||
nextPage();
|
||||
else if(w > 0)
|
||||
@@ -416,22 +402,22 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
}
|
||||
|
||||
private void back() {
|
||||
if(backButton.enabled) {
|
||||
backButton.playPressSound(mc.getSoundHandler());
|
||||
if(backButton.active) {
|
||||
backButton.playDownSound(mc.getSoundHandler());
|
||||
backButton.onClick(backButton.x, backButton.y);
|
||||
}
|
||||
}
|
||||
|
||||
private void nextPage() {
|
||||
if(rightButton.enabled) {
|
||||
rightButton.playPressSound(mc.getSoundHandler());
|
||||
if(rightButton.active) {
|
||||
rightButton.playDownSound(mc.getSoundHandler());
|
||||
rightButton.onClick(rightButton.x, rightButton.y);
|
||||
}
|
||||
}
|
||||
|
||||
private void prevPage() {
|
||||
if(leftButton.enabled) {
|
||||
leftButton.playPressSound(mc.getSoundHandler());
|
||||
if(leftButton.active) {
|
||||
leftButton.playDownSound(mc.getSoundHandler());
|
||||
leftButton.onClick(leftButton.x, leftButton.y);
|
||||
}
|
||||
}
|
||||
@@ -455,14 +441,12 @@ public class GuiLexiconIndex extends GuiLexicon implements IParented {
|
||||
break;
|
||||
}
|
||||
page = cmp.getInt(TAG_PAGE);
|
||||
setTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiLexicon copy() {
|
||||
GuiLexiconIndex gui = new GuiLexiconIndex(category);
|
||||
gui.page = page;
|
||||
gui.setTitle();
|
||||
return gui;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,29 +27,25 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonAchievement extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonAchievement(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
public GuiButtonAchievement(int x, int y) {
|
||||
super(x, y, 11, 11, "", b -> {
|
||||
if(Minecraft.getInstance().player != null) {
|
||||
AdvancementsScreen gui = new AdvancementsScreen(Minecraft.getInstance().player.connection.getAdvancementManager());
|
||||
Minecraft.getInstance().displayGuiScreen(gui);
|
||||
ResourceLocation tab = new ResourceLocation(LibMisc.MOD_ID, "main/root");
|
||||
gui.setSelectedTab(Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(tab));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
if(Minecraft.getInstance().player != null) {
|
||||
AdvancementsScreen gui = new AdvancementsScreen(Minecraft.getInstance().player.connection.getAdvancementManager());
|
||||
Minecraft.getInstance().displayGuiScreen(gui);
|
||||
ResourceLocation tab = new ResourceLocation(LibMisc.MOD_ID, "main/root");
|
||||
gui.setSelectedTab(Minecraft.getInstance().player.connection.getAdvancementManager().getAdvancementList().getAdvancement(tab));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 109 : 98, 191, 11, 11);
|
||||
blit(x, y, k == 2 ? 109 : 98, 191, 11, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(TextFormatting.GREEN + I18n.format("botaniamisc.advancements"));
|
||||
|
||||
@@ -22,15 +22,15 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonBack extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonBack(int x, int y) {
|
||||
super(x, y, 18, 9, "");
|
||||
public GuiButtonBack(int x, int y, IPressable onPress) {
|
||||
super(x, y, 18, 9, "", onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
if(enabled) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
if(active) {
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -18,8 +18,8 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonBackWithShift extends GuiButtonBack {
|
||||
|
||||
public GuiButtonBackWithShift(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3);
|
||||
public GuiButtonBackWithShift(int x, int y, IPressable onPress) {
|
||||
super(x, y, onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,52 +19,49 @@ public class GuiButtonBookmark extends GuiButtonLexicon {
|
||||
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonBookmark(int par1, int par2, int par3, GuiLexicon gui, String str) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonBookmark(int x, int y, GuiLexicon gui, String str) {
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str, b -> {
|
||||
boolean modified = false;
|
||||
int i = id - GuiLexicon.BOOKMARK_START;
|
||||
String key = gui.getNotesKey();
|
||||
if(i == GuiLexicon.bookmarks.size()) {
|
||||
if(!GuiLexicon.bookmarkKeys.contains(key)) {
|
||||
GuiLexicon.bookmarks.add(gui.copy());
|
||||
GuiLexicon.bookmarkKeys.add(key);
|
||||
modified = true;
|
||||
}
|
||||
} else {
|
||||
if(Screen.hasShiftDown()) {
|
||||
GuiLexicon.bookmarks.remove(i);
|
||||
GuiLexicon.bookmarkKeys.remove(i);
|
||||
|
||||
modified = true;
|
||||
} else {
|
||||
GuiLexicon bookmark = GuiLexicon.bookmarks.get(i).copy();
|
||||
if(!bookmark.getTitle().equals(gui.getTitle())) {
|
||||
Minecraft.getInstance().displayGuiScreen(bookmark);
|
||||
if(bookmark instanceof IParented)
|
||||
((IParented) bookmark).setParent(gui);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gui.bookmarksNeedPopulation = true;
|
||||
if(modified)
|
||||
PersistentVariableHelper.saveSafe();
|
||||
});
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
boolean modified = false;
|
||||
int i = id - GuiLexicon.BOOKMARK_START;
|
||||
String key = gui.getNotesKey();
|
||||
if(i == GuiLexicon.bookmarks.size()) {
|
||||
if(!GuiLexicon.bookmarkKeys.contains(key)) {
|
||||
GuiLexicon.bookmarks.add(gui.copy());
|
||||
GuiLexicon.bookmarkKeys.add(key);
|
||||
modified = true;
|
||||
}
|
||||
} else {
|
||||
if(Screen.hasShiftDown()) {
|
||||
GuiLexicon.bookmarks.remove(i);
|
||||
GuiLexicon.bookmarkKeys.remove(i);
|
||||
|
||||
modified = true;
|
||||
} else {
|
||||
GuiLexicon bookmark = GuiLexicon.bookmarks.get(i).copy();
|
||||
if(!bookmark.getTitle().equals(gui.getTitle())) {
|
||||
Minecraft.getInstance().displayGuiScreen(bookmark);
|
||||
if(bookmark instanceof IParented)
|
||||
((IParented) bookmark).setParent(gui);
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gui.bookmarksNeedPopulation = true;
|
||||
if(modified)
|
||||
PersistentVariableHelper.saveSafe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
gui.drawBookmark(x, y, displayString, false);
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
gui.drawBookmark(x, y, getMessage(), false);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
if(displayString.equals("+"))
|
||||
if(getMessage().equals("+"))
|
||||
tooltip.add(I18n.format("botaniamisc.clickToAdd"));
|
||||
else {
|
||||
tooltip.add(I18n.format("botaniamisc.bookmark", id - GuiLexicon.BOOKMARK_START + 1));
|
||||
|
||||
@@ -66,10 +66,11 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
ARBShaderObjects.glUniform1fARB(heightMatchUniform, heightMatch);
|
||||
};
|
||||
|
||||
int activeTex = 0;
|
||||
|
||||
public GuiButtonCategory(int id, int x, int y, GuiLexicon gui, LexiconCategory category) {
|
||||
super(id, x, y, 16, 16, "");
|
||||
public GuiButtonCategory(int x, int y, GuiLexicon gui, LexiconCategory category) {
|
||||
super(x, y, 16, 16, "", b -> {
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
});
|
||||
this.gui = gui;
|
||||
this.category = category;
|
||||
}
|
||||
@@ -77,13 +78,11 @@ public class GuiButtonCategory extends GuiButtonLexicon {
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconIndex(category));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mx, int my, float partialTicks) {
|
||||
boolean inside = isPressable(mx, my);
|
||||
boolean inside = isHovered();
|
||||
if(inside)
|
||||
ticksHovered = Math.min(time, ticksHovered + gui.timeDelta);
|
||||
else ticksHovered = Math.max(0F, ticksHovered - gui.timeDelta);
|
||||
|
||||
@@ -28,22 +28,16 @@ public class GuiButtonChallengeIcon extends GuiButtonLexicon {
|
||||
public final Challenge challenge;
|
||||
private final GuiLexicon owner;
|
||||
|
||||
public GuiButtonChallengeIcon(int id, int x, int y, Challenge challenge, GuiLexicon owner) {
|
||||
super(id, x, y, 16, 16, "");
|
||||
public GuiButtonChallengeIcon(int x, int y, Challenge challenge, GuiLexicon owner) {
|
||||
super(x, y, 16, 16, "", b -> Minecraft.getInstance().displayGuiScreen(new GuiLexiconChallenge(owner, challenge)));
|
||||
this.challenge = challenge;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconChallenge(owner, challenge));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
@@ -26,23 +26,19 @@ public class GuiButtonChallengeInfo extends GuiButtonLexicon {
|
||||
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonChallengeInfo(int par1, int par2, int par3, String str, GuiLexicon gui) {
|
||||
super(par1, par2, par3, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
public GuiButtonChallengeInfo(int x, int y, String str, GuiLexicon gui) {
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str, b -> {
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, gui));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
});
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconEntry(LexiconData.challenges, gui));
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
gui.drawBookmark(x, y, displayString, false);
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
gui.drawBookmark(x, y, getMessage(), false);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(I18n.format("botaniamisc.challengeInfo"));
|
||||
|
||||
@@ -24,20 +24,16 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonChallenges extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonChallenges(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconChallengesList());
|
||||
public GuiButtonChallenges(int x, int y) {
|
||||
super(x, y, 11, 11, "", b -> {
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconChallengesList());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -28,14 +28,14 @@ import java.util.List;
|
||||
// I should've done this last year
|
||||
public class GuiButtonDoot extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonDoot(int id, int x, int y) {
|
||||
super(id, x, y, 16, 16, "");
|
||||
public GuiButtonDoot(int x, int y) {
|
||||
super(x, y, 16, 16, "", b -> {});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -27,22 +27,18 @@ public class GuiButtonHistory extends GuiButtonLexicon {
|
||||
final GuiLexicon gui;
|
||||
|
||||
public GuiButtonHistory(int x, int y, String str, GuiLexicon gui) {
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str);
|
||||
super(x, y, gui.bookmarkWidth(str) + 5, 11, str, b -> {
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconHistory());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
});
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexiconHistory());
|
||||
ClientTickHandler.notifyPageChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
gui.drawBookmark(x, y, displayString, false);
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
gui.drawBookmark(x, y, getMessage(), false);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(I18n.format("botaniamisc.historyLong"));
|
||||
|
||||
@@ -29,8 +29,20 @@ import javax.annotation.Nonnull;
|
||||
public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
private static final ResourceLocation dogResource = new ResourceLocation(LibResources.GUI_DOG);
|
||||
private static final IPressable ON_PRESS = b -> {
|
||||
GuiButtonInvisible button = (GuiButtonInvisible) b;
|
||||
if (button.dog) {
|
||||
button.enableDog = true;
|
||||
PersistentVariableHelper.dog = true;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
} else {
|
||||
// todo 1.13 is this the right place? moved from GuiLexiconIndex.actionPerformed
|
||||
int index = id + button.gui.page * 12;
|
||||
button.gui.openEntry(index);
|
||||
}
|
||||
};
|
||||
|
||||
final GuiLexiconIndex gui;
|
||||
private final GuiLexiconIndex gui;
|
||||
public ItemStack displayStack = ItemStack.EMPTY;
|
||||
public boolean dog = false;
|
||||
private float timeHover = 0;
|
||||
@@ -38,25 +50,11 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
private boolean enableDog = false;
|
||||
private double dogPos = 0;
|
||||
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int par1, int par2, int par3, int par4, int par5, String par6Str) {
|
||||
super(par1, par2, par3, par4, par5, par6Str);
|
||||
public GuiButtonInvisible(GuiLexiconIndex gui, int x, int y, int width, int height, String text) {
|
||||
super(x, y, width, height, text, ON_PRESS);
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
if (dog) {
|
||||
enableDog = true;
|
||||
PersistentVariableHelper.dog = true;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
} else {
|
||||
// todo 1.13 is this the right place? moved from GuiLexiconIndex.actionPerformed
|
||||
int index = id + gui.page * 12;
|
||||
gui.openEntry(index);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
if(enableDog) {
|
||||
@@ -72,11 +70,11 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
GlStateManager.translated(-dogPos, 0, 0);
|
||||
}
|
||||
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
boolean showStack = !displayStack.isEmpty() && !displayString.isEmpty();
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
boolean showStack = !displayStack.isEmpty() && !getMessage().isEmpty();
|
||||
|
||||
if(!displayString.isEmpty() && k == 2) {
|
||||
if(!getMessage().isEmpty() && k == 2) {
|
||||
timeHover = Math.min(5, timeHover + gui.timeDelta);
|
||||
gui.setHoveredButton(this);
|
||||
} else timeHover = Math.max(0, timeHover - gui.timeDelta);
|
||||
@@ -87,7 +85,7 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
GlStateManager.disableAlphaTest();
|
||||
int color = 0;
|
||||
String format = FontHelper.getFormatFromString(displayString);
|
||||
String format = FontHelper.getFormatFromString(getMessage());
|
||||
if(format.length() > 1) {
|
||||
char key = format.charAt(format.length() - 1);
|
||||
if(key == 'o' && format.length() > 3)
|
||||
@@ -104,10 +102,10 @@ public class GuiButtonInvisible extends GuiButtonLexicon {
|
||||
|
||||
int maxalpha = 0x22;
|
||||
int alpha = Math.min(maxalpha, (int) (timeHover / 4 * maxalpha));
|
||||
drawRect(x - 5, y, (int) (x - 5 + timeHover * 24), y + height, alpha << 24 | color);
|
||||
fill(x - 5, y, (int) (x - 5 + timeHover * 24), y + height, alpha << 24 | color);
|
||||
GlStateManager.enableAlphaTest();
|
||||
|
||||
Minecraft.getInstance().fontRenderer.drawString(displayString, x + (showStack ? 7 : 0), y + (height - 8) / 2, 0);
|
||||
Minecraft.getInstance().fontRenderer.drawString(getMessage(), x + (showStack ? 7 : 0), y + (height - 8) / 2, 0);
|
||||
|
||||
if(showStack) {
|
||||
GlStateManager.scalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
@@ -18,8 +18,8 @@ import vazkii.botania.common.core.handler.ModSounds;
|
||||
|
||||
public class GuiButtonLexicon extends Button {
|
||||
|
||||
public GuiButtonLexicon(int x, int y, int width, int height, String text) {
|
||||
super(x, y, width, height, text);
|
||||
public GuiButtonLexicon(int x, int y, int width, int height, String text, IPressable onPress) {
|
||||
super(x, y, width, height, text, onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,25 +25,19 @@ public class GuiButtonNotes extends GuiButtonLexicon {
|
||||
|
||||
private final GuiLexicon parent;
|
||||
|
||||
public GuiButtonNotes(GuiLexicon parent, int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
public GuiButtonNotes(GuiLexicon parent, int x, int y) {
|
||||
super(x, y, 11, 11, "", b -> GuiLexicon.notesEnabled = !GuiLexicon.notesEnabled);
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
GuiLexicon.notesEnabled = !GuiLexicon.notesEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int x, int y, float partialTicks) {
|
||||
hovered = x >= this.x && y >= this.y && x < this.x + width && y < this.y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = x >= this.x && y >= this.y && x < this.x + width && y < this.y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 130 : 120, 191, 10, 11);
|
||||
blit(x, y, k == 2 ? 130 : 120, 191, 10, 11);
|
||||
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
if(GuiLexicon.notesEnabled)
|
||||
|
||||
@@ -24,20 +24,16 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonOptions extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonOptions(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
// todo 1.13 Minecraft.getInstance().displayGuiScreen(new GuiBotaniaConfig(lexicon));
|
||||
public GuiButtonOptions(int x, int y) {
|
||||
super(x, y, 11, 11, "", b -> {
|
||||
// todo 1.14 config gui
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -23,20 +23,20 @@ public class GuiButtonPage extends GuiButtonLexicon {
|
||||
|
||||
private final boolean right;
|
||||
|
||||
public GuiButtonPage(int par1, int par2, int par3, boolean right) {
|
||||
super(par1, par2, par3, 18, 10, "");
|
||||
public GuiButtonPage(int x, int y, boolean right, IPressable onPress) {
|
||||
super(x, y, 18, 10, "", onPress);
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
if(enabled) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
if(active) {
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
|
||||
blit(x, y, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
|
||||
|
||||
if(k == 2)
|
||||
RenderHelper.renderTooltip(mouseX, mouseY, Collections.singletonList(I18n.format(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
|
||||
|
||||
@@ -24,26 +24,22 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonScaleChange extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonScaleChange(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
}
|
||||
public GuiButtonScaleChange(int x, int y) {
|
||||
super(x, y, 11, 11, "", b -> {
|
||||
int maxAllowed = GuiLexicon.getMaxAllowedScale();
|
||||
if(PersistentVariableHelper.lexiconGuiScale >= maxAllowed)
|
||||
PersistentVariableHelper.lexiconGuiScale = 2;
|
||||
else PersistentVariableHelper.lexiconGuiScale++;
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
int maxAllowed = GuiLexicon.getMaxAllowedScale();
|
||||
if(PersistentVariableHelper.lexiconGuiScale >= maxAllowed)
|
||||
PersistentVariableHelper.lexiconGuiScale = 2;
|
||||
else PersistentVariableHelper.lexiconGuiScale++;
|
||||
|
||||
PersistentVariableHelper.saveSafe();
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexicon());
|
||||
PersistentVariableHelper.saveSafe();
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiLexicon());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
|
||||
@@ -23,18 +23,18 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonShare extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonShare(int par1, int par2, int par3) {
|
||||
super(par1, par2, par3, 10, 12, "");
|
||||
public GuiButtonShare(int x, int y, IPressable onPress) {
|
||||
super(x, y, 10, 12, "", onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 10 : 0 , 200, 10, 12);
|
||||
blit(x, y, k == 2 ? 10 : 0 , 200, 10, 12);
|
||||
|
||||
List<String> tooltip = getTooltip();
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
|
||||
+10
-13
@@ -29,14 +29,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiButtonUpdateWarning extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonUpdateWarning(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY) {
|
||||
super.onClick(mouseX, mouseY);
|
||||
private static final IPressable OPEN_CHANGELOG = b -> {
|
||||
if(Screen.hasShiftDown()) {
|
||||
try {
|
||||
if(Desktop.isDesktopSupported())
|
||||
@@ -47,18 +40,22 @@ public class GuiButtonUpdateWarning extends GuiButtonLexicon {
|
||||
} else {
|
||||
PersistentVariableHelper.lastBotaniaVersion = LibMisc.VERSION;
|
||||
PersistentVariableHelper.saveSafe();
|
||||
this.visible = false;
|
||||
this.enabled = false;
|
||||
b.visible = false;
|
||||
b.active = false;
|
||||
}
|
||||
};
|
||||
|
||||
public GuiButtonUpdateWarning(int x, int y) {
|
||||
super(x, y, 11, 11, "", OPEN_CHANGELOG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
if(!visible || !enabled)
|
||||
if(!visible || !active)
|
||||
return;
|
||||
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
boolean red = k == 2 || ClientTickHandler.ticksInGame % 10 < 5;
|
||||
|
||||
|
||||
@@ -23,18 +23,18 @@ import java.util.List;
|
||||
|
||||
public class GuiButtonViewOnline extends GuiButtonLexicon {
|
||||
|
||||
public GuiButtonViewOnline(int id, int x, int y) {
|
||||
super(id, x, y, 11, 11, "");
|
||||
public GuiButtonViewOnline(int x, int y, IPressable onPress) {
|
||||
super(x, y, 11, 11, "", onPress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks) {
|
||||
hovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getHoverState(hovered);
|
||||
isHovered = mouseX >= x && mouseY >= y && mouseX < x + width && mouseY < y + height;
|
||||
int k = getYImage(isHovered());
|
||||
|
||||
Minecraft.getInstance().textureManager.bindTexture(GuiLexicon.texture);
|
||||
GlStateManager.color4f(1F, 1F, 1F, 1F);
|
||||
drawTexturedModalRect(x, y, k == 2 ? 41 : 30, 200, 11, 11);
|
||||
blit(x, y, k == 2 ? 41 : 30, 200, 11, 11);
|
||||
|
||||
List<String> tooltip = Collections.singletonList(TextFormatting.AQUA + I18n.format("botaniamisc.viewOnline"));
|
||||
int tooltipY = (tooltip.size() - 1) * 10;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class RenderTileBellows extends TileEntityRenderer<TileBellows> {
|
||||
@Override
|
||||
public void render(@Nullable TileBellows bellows, double d0, double d1, double d2, float f, int digProgress) {
|
||||
if (bellows != null)
|
||||
if (!bellows.getWorld().isBlockLoaded(bellows.getPos(), false)
|
||||
if (!bellows.getWorld().isBlockLoaded(bellows.getPos())
|
||||
|| bellows.getWorld().getBlockState(bellows.getPos()).getBlock() != ModBlocks.bellows)
|
||||
return;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package vazkii.botania.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -45,7 +46,7 @@ public abstract class BlockCamo extends BlockMod {
|
||||
|
||||
ItemStack currentStack = player.getHeldItem(hand);
|
||||
if(!currentStack.isEmpty()
|
||||
&& Block.getBlockFromItem(currentStack.getItem()) != null
|
||||
&& Block.getBlockFromItem(currentStack.getItem()) != Blocks.AIR
|
||||
&& tile instanceof TileCamo) {
|
||||
TileCamo camo = (TileCamo) tile;
|
||||
BlockItemUseContext ctx = new BlockItemUseContext(world, player, hand, currentStack, hit);
|
||||
|
||||
@@ -124,7 +124,7 @@ public class BlockFloatingSpecialFlower extends BlockFloatingFlower implements I
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit.getFace(), hit.getHitVec().x, hit.getHitVec().y, hit.getHitVec().z) || super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit) || super.onBlockActivated(state, world, pos, player, hand, hit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,8 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IEnviromentBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.storage.loot.LootContext;
|
||||
import net.minecraft.world.storage.loot.LootParameters;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import vazkii.botania.api.lexicon.ILexiconable;
|
||||
@@ -43,6 +45,7 @@ import vazkii.botania.api.wand.IWandable;
|
||||
import vazkii.botania.common.item.material.ItemDye;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class BlockSpecialFlower extends FlowerBlock implements ISpecialFlower, IWandable, ILexiconable, IWandHUD {
|
||||
@@ -104,32 +107,15 @@ public class BlockSpecialFlower extends FlowerBlock implements ISpecialFlower, I
|
||||
((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockHarvested(world, pos, state, player);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean removedByPlayer(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, @Nonnull PlayerEntity player, boolean willHarvest, IFluidState fluidState) {
|
||||
if (willHarvest) {
|
||||
// Copy of super.removedByPlayer but don't set to air yet
|
||||
// This is so getDrops below will have a TE to work with
|
||||
onBlockHarvested(world, pos, state, player);
|
||||
return true;
|
||||
public List<ItemStack> getDrops(@Nonnull BlockState state, @Nonnull LootContext.Builder builder) {
|
||||
List<ItemStack> drops = super.getDrops(state, builder);
|
||||
TileEntity te = builder.get(LootParameters.BLOCK_ENTITY);
|
||||
if(te instanceof TileEntitySpecialFlower) {
|
||||
return ((TileEntitySpecialFlower) te).getDrops(drops, builder);
|
||||
} else {
|
||||
return super.removedByPlayer(state, world, pos, player, willHarvest, fluidState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock(@Nonnull World world, PlayerEntity player, @Nonnull BlockPos pos, @Nonnull BlockState state, TileEntity te, ItemStack stack) {
|
||||
super.harvestBlock(world, player, pos, state, te, stack);
|
||||
// Now delete the block and TE
|
||||
world.removeBlock(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(@Nonnull BlockState state, NonNullList<ItemStack> list, World world, BlockPos pos, int fortune) {
|
||||
super.getDrops(state, list, world, pos, fortune);
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof TileEntitySpecialFlower) {
|
||||
((TileEntitySpecialFlower) tile).getDrops(list);
|
||||
return drops;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +168,7 @@ public class BlockSpecialFlower extends FlowerBlock implements ISpecialFlower, I
|
||||
return true;
|
||||
}
|
||||
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, side, hitX, hitY, hitZ);
|
||||
return ((TileEntitySpecialFlower) world.getTileEntity(pos)).onBlockActivated(world, pos, state, player, hand, hit);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -72,12 +72,6 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Item getItemDropped(BlockState state, World world, BlockPos pos, int fortune) {
|
||||
return Items.AIR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state) {
|
||||
return true;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.common.item;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
@@ -74,7 +75,9 @@ public class ItemVirus extends ItemMod {
|
||||
|
||||
horse.remove();
|
||||
|
||||
AbstractHorseEntity newHorse = stack.getItem() == ModItems.necroVirus ? new ZombieHorseEntity(player.world) : new SkeletonHorseEntity(player.world);
|
||||
AbstractHorseEntity newHorse = stack.getItem() == ModItems.necroVirus
|
||||
? EntityType.ZOMBIE_HORSE.create(player.world)
|
||||
: EntityType.SKELETON_HORSE.create(player.world);
|
||||
newHorse.setTamedBy(player);
|
||||
newHorse.setPositionAndRotation(horse.posX, horse.posY, horse.posZ, horse.rotationYaw, horse.rotationPitch);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package vazkii.botania.common.lexicon.page;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
@@ -74,7 +75,7 @@ public class PageElvenRecipe extends PageRecipe {
|
||||
|
||||
TextureAtlasSprite portalIcon = MiscellaneousIcons.INSTANCE.alfPortalTex;
|
||||
Minecraft.getInstance().textureManager.bindTexture(AtlasTexture.LOCATION_BLOCKS_TEXTURE);
|
||||
((Screen) gui).blit(gui.getLeft() + 22, gui.getTop() + 36, portalIcon, 48, 48);
|
||||
AbstractGui.blit(gui.getLeft() + 22, gui.getTop() + 36, 48, 48, 0, portalIcon); // todo 1.14 zlevel?
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
Reference in new issue
Block a user