mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -9,8 +9,7 @@ import net.minecraft.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class ModifierPage extends BookPage
|
||||
{
|
||||
public class ModifierPage extends BookPage {
|
||||
String type;
|
||||
ItemStack[] icons;
|
||||
ItemStack[][] iconsMulti;
|
||||
@@ -20,28 +19,23 @@ public class ModifierPage extends BookPage
|
||||
int counter;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("tooltype");
|
||||
if (nodes != null)
|
||||
type = nodes.item(0).getTextContent();
|
||||
if (nodes != null) type = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("recipe");
|
||||
if (nodes != null)
|
||||
{
|
||||
if (nodes != null) {
|
||||
String recipe = nodes.item(0).getTextContent();
|
||||
icons = MantleClientRegistry.getRecipeIcons(recipe);
|
||||
|
||||
if (type.equals("travelmulti"))
|
||||
{
|
||||
if (type.equals("travelmulti")) {
|
||||
List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
|
||||
List<String> tools = new LinkedList<String>();
|
||||
String[] suffixes = new String[] { "goggles", "vest", "wings", "boots", "glove", "belt" };
|
||||
for (String suffix : suffixes)
|
||||
{
|
||||
ItemStack[] icons2 = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null)
|
||||
{
|
||||
String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
|
||||
for (String suffix : suffixes) {
|
||||
ItemStack[] icons2 =
|
||||
MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null) {
|
||||
stacks.add(icons2);
|
||||
tools.add(suffix);
|
||||
}
|
||||
@@ -49,8 +43,7 @@ public class ModifierPage extends BookPage
|
||||
|
||||
iconsMulti = new ItemStack[stacks.size()][];
|
||||
toolMulti = new ItemStack[stacks.size()];
|
||||
for (int i = 0; i < stacks.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < stacks.size(); i++) {
|
||||
iconsMulti[i] = stacks.get(i);
|
||||
toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
|
||||
}
|
||||
@@ -64,67 +57,87 @@ public class ModifierPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String tStation = StatCollector.translateToLocal("manual.page.modifier1");
|
||||
if (icons.length > 3)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable)
|
||||
tStation = StatCollector.translateToLocal(tStation);
|
||||
if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
|
||||
manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
|
||||
if (type.equals("weapon"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti"))
|
||||
toolstack = toolMulti[counter];
|
||||
if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles")) toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti")) toolstack = toolMulti[counter];
|
||||
|
||||
// update displayed item
|
||||
if (iconsMulti != null && iconsMulti.length > 0 && type.equals("travelmulti") && System.currentTimeMillis() - lastUpdate > 1000)
|
||||
{
|
||||
if (iconsMulti != null
|
||||
&& iconsMulti.length > 0
|
||||
&& type.equals("travelmulti")
|
||||
&& System.currentTimeMillis() - lastUpdate > 1000) {
|
||||
lastUpdate = System.currentTimeMillis();
|
||||
counter++;
|
||||
if (counter >= iconsMulti.length)
|
||||
counter = 0;
|
||||
if (counter >= iconsMulti.length) counter = 0;
|
||||
icons = iconsMulti[counter];
|
||||
toolstack = toolMulti[counter];
|
||||
}
|
||||
|
||||
manual.renderitem.zLevel = 100;
|
||||
if (icons.length < 4)
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons.length < 4) {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 54) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 130) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons[2] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 74) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 140) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[2],
|
||||
(localWidth + 18) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
} else {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 74) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 140) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
if (icons[4] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[4], (localWidth + 36) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[4],
|
||||
(localWidth + 36) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
}
|
||||
manual.renderitem.zLevel = 0;
|
||||
|
||||
@@ -136,12 +149,9 @@ public class ModifierPage extends BookPage
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookmodify.png");
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
public void renderBackgroundLayer(int localWidth, int localHeight) {
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
if (icons.length > 3)
|
||||
manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else
|
||||
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
if (icons.length > 3) manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user