blob: 8cc47d0476f66f796d5c712ca20c8baef982b070 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
package me.Danker.features;
import me.Danker.commands.ToggleCommand;
import me.Danker.utils.Utils;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.ArrayList;
import java.util.List;
public class HidePlayerArmour {
List<ItemStack> armour = new ArrayList<>();
@SubscribeEvent
public void onRenderLivingPre(RenderLivingEvent.Pre<EntityLivingBase> event) {
if (ToggleCommand.hideArmour && Utils.inSkyblock) {
if (event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
for (int i = 0; i < player.inventory.armorInventory.length; i++) {
if (player.inventory.armorInventory[i] != null) {
armour.add(player.inventory.armorInventory[i].copy());
player.inventory.armorInventory[i] = null;
} else {
armour.add(null);
}
}
}
}
}
@SubscribeEvent
public void onRenderLivingPost(RenderLivingEvent.Post<EntityLivingBase> event) {
if (ToggleCommand.hideArmour && Utils.inSkyblock) {
if (event.entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.entity;
for (int i = 0; i < player.inventory.armorInventory.length; i++) {
player.inventory.armorInventory[i] = armour.get(i);
}
armour.clear();
}
}
}
}
|