mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-18 11:19:24 +00:00
Content update (continued)
This commit is contained in:
1 parent
9028d32b6e
commit
29eee40824
92 files changed
+3233
-2211
No files matched your search
@@ -4,6 +4,9 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -11,28 +14,41 @@ import net.minecraft.potion.Potion;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import taintedmagic.api.IRenderInventoryItem;
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public class ClientHandler
|
||||
{
|
||||
/*
|
||||
* Render items implementing IRenderInventoryItem
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onPlayerRender (RenderPlayerEvent.Specials.Post event)
|
||||
{
|
||||
EntityPlayer p = event.entityPlayer;
|
||||
if (p.getActivePotionEffect(Potion.invisibility) != null) return;
|
||||
|
||||
ItemStack[] inv = p.inventory.mainInventory;
|
||||
List<Item> rendering = new ArrayList<Item>();
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
ItemStack s = inv[i];
|
||||
if (s != null && s.getItem() instanceof IRenderInventoryItem && !rendering.contains(s.getItem()))
|
||||
{
|
||||
((IRenderInventoryItem) s.getItem()).render(p, s, event.partialRenderTick);
|
||||
rendering.add(s.getItem());
|
||||
}
|
||||
if (i == 36) rendering.clear();
|
||||
}
|
||||
}
|
||||
public static int ticks;
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEnd (TickEvent event)
|
||||
{
|
||||
if (event.phase == TickEvent.Phase.END)
|
||||
{
|
||||
HUDHandler.updateTicks();
|
||||
ticks++;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Render items implementing IRenderInventoryItem
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onPlayerRender (RenderPlayerEvent.Specials.Post event)
|
||||
{
|
||||
EntityPlayer p = event.entityPlayer;
|
||||
if (p.getActivePotionEffect(Potion.invisibility) != null) return;
|
||||
|
||||
ItemStack[] inv = p.inventory.mainInventory;
|
||||
List<Item> rendering = new ArrayList<Item>();
|
||||
for (int i = 0; i < 36; i++)
|
||||
{
|
||||
ItemStack s = inv[i];
|
||||
if (s != null && s.getItem() instanceof IRenderInventoryItem && !rendering.contains(s.getItem()))
|
||||
{
|
||||
((IRenderInventoryItem) s.getItem()).render(p, s, event.partialRenderTick);
|
||||
rendering.add(s.getItem());
|
||||
}
|
||||
if (i == 36) rendering.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user