Reverted something

This commit is contained in:
Ellpeck 2015-07-17 12:47:42 +02:00
parent e3dd81e11f
commit 0585e703dc
3 changed files with 4 additions and 36 deletions

View file

@ -1,16 +1,13 @@
package ellpeck.actuallyadditions.event; package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.ReflectionHelper;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.ItemWingsOfTheBats; import ellpeck.actuallyadditions.items.ItemWingsOfTheBats;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityOcelot;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerCapabilities;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
@ -51,15 +48,6 @@ public class EntityLivingEvent{
if(wingsEquipped){ if(wingsEquipped){
//Allow the Player to fly when he has Wings equipped //Allow the Player to fly when he has Wings equipped
player.capabilities.allowFlying = true; player.capabilities.allowFlying = true;
if(((ItemWingsOfTheBats)wings.getItem()).isHastily){
//Speed Upgrade with hastily Wings
this.setFlySpeed(player, ItemWingsOfTheBats.FLY_SPEED);
}
else{
//When switching from Hastily to not Hastily immediately, still remove the Speed!
this.setFlySpeed(player, ItemWingsOfTheBats.STANDARD_FLY_SPEED);
}
} }
else{ else{
//Make the Player not winged //Make the Player not winged
@ -71,19 +59,8 @@ public class EntityLivingEvent{
//Enables Fall Damage again (Automatically gets disabled for some reason) //Enables Fall Damage again (Automatically gets disabled for some reason)
player.capabilities.disableDamage = false; player.capabilities.disableDamage = false;
} }
//Remove the Speed Effect
this.setFlySpeed(player, ItemWingsOfTheBats.STANDARD_FLY_SPEED);
} }
} }
} }
} }
private void setFlySpeed(EntityPlayer player, float speed){
try{
ReflectionHelper.setPrivateValue(PlayerCapabilities.class, player.capabilities, speed, 5);
}
catch(Exception e){
ModUtil.LOGGER.fatal("Something went wrong here!", e);
}
}
} }

View file

@ -97,7 +97,6 @@ public class InitItems{
public static Item itemTeleStaff; public static Item itemTeleStaff;
public static Item itemWingsOfTheBats; public static Item itemWingsOfTheBats;
public static Item itemWingsOfTheBatsHastily;
public static void init(){ public static void init(){
ModUtil.LOGGER.info("Initializing Items..."); ModUtil.LOGGER.info("Initializing Items...");
@ -117,10 +116,8 @@ public class InitItems{
itemTeleStaff = new ItemTeleStaff(); itemTeleStaff = new ItemTeleStaff();
ItemUtil.register(itemTeleStaff); ItemUtil.register(itemTeleStaff);
itemWingsOfTheBats = new ItemWingsOfTheBats(false); itemWingsOfTheBats = new ItemWingsOfTheBats();
ItemUtil.register(itemWingsOfTheBats); ItemUtil.register(itemWingsOfTheBats);
itemWingsOfTheBatsHastily = new ItemWingsOfTheBats(true);
ItemUtil.register(itemWingsOfTheBatsHastily);
itemDrill = new ItemDrill(); itemDrill = new ItemDrill();
ItemUtil.register(itemDrill); ItemUtil.register(itemDrill);

View file

@ -27,14 +27,8 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
*/ */
public static ArrayList<String> wingedPlayers = new ArrayList<>(); public static ArrayList<String> wingedPlayers = new ArrayList<>();
public static final float FLY_SPEED = 0.125F; public ItemWingsOfTheBats(){
public static final float STANDARD_FLY_SPEED = 0.05F;
public boolean isHastily;
public ItemWingsOfTheBats(boolean isHastily){
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.isHastily = isHastily;
} }
/** /**
@ -72,7 +66,7 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return this.isHastily ? EnumRarity.epic : EnumRarity.rare; return EnumRarity.epic;
} }
@Override @Override
@ -95,7 +89,7 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
@Override @Override
public String getName(){ public String getName(){
return this.isHastily ? "itemWingOfTheBatsHastily" : "itemWingsOfTheBats"; return "itemWingsOfTheBats";
} }
/** /**