Merge pull request #110 from primetoxinz/master
Fix invisibility potions and cloaking device
This commit is contained in:
commit
1c74e3ce7a
1 changed files with 5 additions and 13 deletions
|
@ -3,33 +3,25 @@ package techreborn.events;
|
|||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.PlayerTickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import techreborn.api.TechRebornItems;
|
||||
import net.minecraft.item.Item;
|
||||
import techreborn.init.ModItems;
|
||||
import techreborn.items.tools.ItemCloakingDevice;
|
||||
|
||||
public class TRTickHandler extends TickEvent {
|
||||
public TRTickHandler(Type type, Side side, Phase phase) {
|
||||
super(type, side, phase);
|
||||
|
||||
}
|
||||
|
||||
public Item previouslyWearing;
|
||||
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
|
||||
public void onPlayerTick(TickEvent.PlayerTickEvent e) {
|
||||
EntityPlayer player = e.player;
|
||||
Item chestslot = player.getEquipmentInSlot(3) != null ? player.getEquipmentInSlot(3v).getItem() : null;
|
||||
|
||||
if(player.getEquipmentInSlot(3)== null) {
|
||||
if(previouslyWearing != chestslot && previouslyWearing == ModItems.cloakingDevice && player.isInvisible())
|
||||
player.setInvisible(false);
|
||||
|
||||
}
|
||||
else if(player.getEquipmentInSlot(3).getItem() != ModItems.cloakingDevice) {
|
||||
player.setInvisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
previouslyWearing = chestslot;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue