diff options
author | nea <romangraef@gmail.com> | 2022-02-22 11:49:00 +0100 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-04-14 04:10:06 +0200 |
commit | 8708bbfa4f77a289288a356502807ebf92f7e8a8 (patch) | |
tree | fd5c99c39dd3c9c7a551fbaf09dff6c470bd9c5b /src/main/java/io | |
parent | 3644e419bf9f0a55a5c249bd94999a1c29795e6d (diff) | |
download | NotEnoughUpdates-8708bbfa4f77a289288a356502807ebf92f7e8a8.tar.gz NotEnoughUpdates-8708bbfa4f77a289288a356502807ebf92f7e8a8.tar.bz2 NotEnoughUpdates-8708bbfa4f77a289288a356502807ebf92f7e8a8.zip |
add extra skin parts and make less tabs
Diffstat (limited to 'src/main/java/io')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java | 17 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java index 13b4fd7c..1bdd54fa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java @@ -1,9 +1,13 @@ package io.github.moulberry.notenoughupdates.miscfeatures.entityviewer; +import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.util.ResourceLocation; +import java.util.Map; + public class SkinModifier extends EntityViewerModifier { @Override public EntityLivingBase applyModifier(EntityLivingBase base, JsonObject info) { @@ -18,6 +22,19 @@ public class SkinModifier extends EntityViewerModifier { if (info.has("slim")) { player.overrideIsSlim = info.get("slim").getAsBoolean(); } + if (info.has("parts")) { + JsonObject parts = info.getAsJsonObject("parts"); + byte partBitField = player.getDataWatcher().getWatchableObjectByte(10); + for (Map.Entry<String, JsonElement> part : parts.entrySet()) { + EnumPlayerModelParts modelPart = EnumPlayerModelParts.valueOf(part.getKey()); + if (part.getValue().getAsBoolean()) { + partBitField |= modelPart.getPartMask(); + } else { + partBitField &= ~modelPart.getPartMask(); + } + } + player.getDataWatcher().updateObject(10, partBitField); + } } return base; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java index 8e013bbb..71f801ae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java @@ -143,6 +143,7 @@ public class GuiItemRecipe extends GuiScreen { } private void drawTabHoverInformation(int mouseX, int mouseY) { + if (tabs.size() < 2) return; for (int i = 0; i < tabs.size(); i++) { if (isWithinRect(mouseX - guiLeft, mouseY - guiTop, TAB_POS_X, TAB_POS_Y + TAB_OFFSET_Y * i, TAB_SIZE_X, TAB_SIZE_Y)) { RecipeType type = tabs.get(i); @@ -157,6 +158,7 @@ public class GuiItemRecipe extends GuiScreen { } private void drawTabs() { + if (tabs.size() < 2) return; for (int i = 0; i < tabs.size(); i++) { RecipeType recipeType = tabs.get(i); int tabPosX = guiLeft + TAB_POS_X, tabPosY = guiTop + TAB_OFFSET_Y * i + TAB_POS_Y; @@ -171,7 +173,7 @@ public class GuiItemRecipe extends GuiScreen { TAB_TEXTURE_SIZE_X, TAB_SIZE_X ); Minecraft.getMinecraft().getTextureManager().bindTexture(recipeType.getIcon()); - drawTexturedModalRect(tabPosX + 7, tabPosY + 6, 6, 0, 16, 16); + drawTexturedModalRect(tabPosX + 7, tabPosY + 7, 6, 0, 16, 16); } } |