aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornea <romangraef@gmail.com>2022-02-15 20:56:09 +0100
committernea <romangraef@gmail.com>2022-04-14 04:10:06 +0200
commita2854c8f47c8d727a8e90141557d0006a2c2d8a9 (patch)
tree747792b8b6cacdc464e8b76ba94b5eef084f3136 /src
parent83195cbb9d2618e0f913f4d77f76bb5800f8950d (diff)
downloadNotEnoughUpdates-a2854c8f47c8d727a8e90141557d0006a2c2d8a9.tar.gz
NotEnoughUpdates-a2854c8f47c8d727a8e90141557d0006a2c2d8a9.tar.bz2
NotEnoughUpdates-a2854c8f47c8d727a8e90141557d0006a2c2d8a9.zip
Fix cookie fuckup
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EquipmentModifier.java30
1 files changed, 25 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EquipmentModifier.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EquipmentModifier.java
index ed1a932b..e68aa948 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EquipmentModifier.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/entityviewer/EquipmentModifier.java
@@ -4,21 +4,41 @@ import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NEUManager;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
public class EquipmentModifier extends EntityViewerModifier {
@Override
public EntityLivingBase applyModifier(EntityLivingBase base, JsonObject info) {
NEUManager manager = NotEnoughUpdates.INSTANCE.manager;
if (info.has("hand"))
- base.setCurrentItemOrArmor(0, manager.createItem(info.get("hand").getAsString()));
+ setCurrentItemOrArmor(base, 0, manager.createItem(info.get("hand").getAsString()));
if (info.has("helmet"))
- base.setCurrentItemOrArmor(4, manager.createItem(info.get("helmet").getAsString()));
+ setCurrentItemOrArmor(base, 4, manager.createItem(info.get("helmet").getAsString()));
if (info.has("chestplate"))
- base.setCurrentItemOrArmor(3, manager.createItem(info.get("chestplate").getAsString()));
+ setCurrentItemOrArmor(base, 3, manager.createItem(info.get("chestplate").getAsString()));
if (info.has("leggings"))
- base.setCurrentItemOrArmor(2, manager.createItem(info.get("leggings").getAsString()));
+ setCurrentItemOrArmor(base, 2, manager.createItem(info.get("leggings").getAsString()));
if (info.has("feet"))
- base.setCurrentItemOrArmor(1, manager.createItem(info.get("feet").getAsString()));
+ setCurrentItemOrArmor(base, 1, manager.createItem(info.get("feet").getAsString()));
return base;
}
+
+ public void setCurrentItemOrArmor(EntityLivingBase entity, int slot, ItemStack itemStack) {
+ if (entity instanceof EntityPlayer) {
+ setPlayerCurrentItemOrArmor((EntityPlayer) entity, slot, itemStack);
+ } else {
+ entity.setCurrentItemOrArmor(slot, itemStack);
+ }
+ }
+
+ // Biscuit person needs to learn how to code and not fuck up valid vanilla behaviour
+ public static void setPlayerCurrentItemOrArmor(EntityPlayer player, int slot, ItemStack itemStack) {
+ if (slot == 0) {
+ player.inventory.mainInventory[player.inventory.currentItem] = itemStack;
+ } else {
+ player.inventory.armorInventory[slot - 1] = itemStack;
+ }
+ }
+
}