aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/SkinModifier.java17
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemRecipe.java4
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);
}
}