Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.rbs.slurpiesdongles.events;
- import com.rbs.slurpiesdongles.init.SlurpiesDonglesItems;
- import net.minecraft.item.ItemStack;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.common.gameevent.TickEvent;
- /**
- * Created by RedBu on 3/21/2016.
- */
- public class EventHandler {
- //private static int flytime = 0;
- @SubscribeEvent
- public void onPlayerTick(TickEvent.PlayerTickEvent event) {
- boolean allowFlying = false;
- boolean wasFlyingAllowed = false;
- if (event.player.inventory.armorInventory[0] != null && event.player.inventory.armorInventory[1] != null && event.player.inventory.armorInventory[2] != null && event.player.inventory.armorInventory[3] != null) {
- ItemStack helmet = event.player.inventory.armorInventory[3];
- ItemStack chestplate = event.player.inventory.armorInventory[2];
- ItemStack leggings = event.player.inventory.armorInventory[1];
- ItemStack boots = event.player.inventory.armorInventory[0];
- if (boots.getItem() == SlurpiesDonglesItems.topaz_boots && chestplate.getItem() == SlurpiesDonglesItems.topaz_chestplate && leggings.getItem() == SlurpiesDonglesItems.topaz_leggings && helmet.getItem() == SlurpiesDonglesItems.topaz_helmet) {
- allowFlying = true;
- wasFlyingAllowed = true;
- }
- }
- if (allowFlying) {
- event.player.capabilities.allowFlying = true;
- event.player.fallDistance = 0.0F; {
- if (wasFlyingAllowed) {
- event.player.capabilities.allowFlying = true;
- event.player.fallDistance = 0.0F;
- }
- else if (wasFlyingAllowed) {
- wasFlyingAllowed = false; <----- This line here is NOT being used. The "wasFlyingAllowed" part is grayed out and says the statement false was not applied.
- }
- }
- if (!event.player.capabilities.isCreativeMode) {
- event.player.capabilities.isFlying = false;
- event.player.capabilities.allowFlying = false;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement