mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Reverted something
This commit is contained in:
parent
e3dd81e11f
commit
0585e703dc
3 changed files with 4 additions and 36 deletions
|
@ -1,16 +1,13 @@
|
|||
package ellpeck.actuallyadditions.event;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
|
||||
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
|
||||
import ellpeck.actuallyadditions.items.InitItems;
|
||||
import ellpeck.actuallyadditions.items.ItemWingsOfTheBats;
|
||||
import ellpeck.actuallyadditions.util.ModUtil;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntityOcelot;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.PlayerCapabilities;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
|
||||
|
@ -51,15 +48,6 @@ public class EntityLivingEvent{
|
|||
if(wingsEquipped){
|
||||
//Allow the Player to fly when he has Wings equipped
|
||||
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{
|
||||
//Make the Player not winged
|
||||
|
@ -71,19 +59,8 @@ public class EntityLivingEvent{
|
|||
//Enables Fall Damage again (Automatically gets disabled for some reason)
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,6 @@ public class InitItems{
|
|||
|
||||
public static Item itemTeleStaff;
|
||||
public static Item itemWingsOfTheBats;
|
||||
public static Item itemWingsOfTheBatsHastily;
|
||||
|
||||
public static void init(){
|
||||
ModUtil.LOGGER.info("Initializing Items...");
|
||||
|
@ -117,10 +116,8 @@ public class InitItems{
|
|||
itemTeleStaff = new ItemTeleStaff();
|
||||
ItemUtil.register(itemTeleStaff);
|
||||
|
||||
itemWingsOfTheBats = new ItemWingsOfTheBats(false);
|
||||
itemWingsOfTheBats = new ItemWingsOfTheBats();
|
||||
ItemUtil.register(itemWingsOfTheBats);
|
||||
itemWingsOfTheBatsHastily = new ItemWingsOfTheBats(true);
|
||||
ItemUtil.register(itemWingsOfTheBatsHastily);
|
||||
|
||||
itemDrill = new ItemDrill();
|
||||
ItemUtil.register(itemDrill);
|
||||
|
|
|
@ -27,14 +27,8 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
|
|||
*/
|
||||
public static ArrayList<String> wingedPlayers = new ArrayList<>();
|
||||
|
||||
public static final float FLY_SPEED = 0.125F;
|
||||
public static final float STANDARD_FLY_SPEED = 0.05F;
|
||||
|
||||
public boolean isHastily;
|
||||
|
||||
public ItemWingsOfTheBats(boolean isHastily){
|
||||
public ItemWingsOfTheBats(){
|
||||
this.setMaxStackSize(1);
|
||||
this.isHastily = isHastily;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +66,7 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
|
|||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return this.isHastily ? EnumRarity.epic : EnumRarity.rare;
|
||||
return EnumRarity.epic;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +89,7 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{
|
|||
|
||||
@Override
|
||||
public String getName(){
|
||||
return this.isHastily ? "itemWingOfTheBatsHastily" : "itemWingsOfTheBats";
|
||||
return "itemWingsOfTheBats";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue