From 945ad194ceb222e7bdd60c2f6baeb84a95f02d4f Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 9 Aug 2015 23:06:43 +0200 Subject: [PATCH] Finally gave actual credit to people I took code from because I wanted to do that for a long time and now don't feel stupid and mean anymore --- README.md | 3 ++- .../event/EntityLivingEvent.java | 8 ++++++++ .../items/ItemWingsOfTheBats.java | 2 ++ .../tile/TileEntityXPSolidifier.java | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d33da907f..c71b9c2fe 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Everything that is not listed below applies to the above. - When it comes to the Mod, always link back to the the Forum Thread linked above. ### NOTES -- The above License only applies for Code I wrote myself, any APIs used (such as the CoFH API and the InventoryTweaks API) have their own License that is being respected. +- The above License only applies for Code I wrote myself, any APIs used (such as the CoFH API) have their own License that is being respected. +- There are some excerpts from other code used (such as the OpenBlocks XP System). Credit to the creators of these parts is always given and their Permission is granted or their License is respected. - Almost all of the Assets used in this Mod are made by Glenthor and are owned by me. You are not allowed to copy them for any other Project without my Permission. © 2015 Ellpeck \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java b/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java index 50f694700..2e9463eff 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java +++ b/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java @@ -31,6 +31,14 @@ public class EntityLivingEvent{ } //Wings allowing Flight + this.doWingStuff(event); + } + + /** + * Makes players be able to fly if they have Wings Of The Bats equipped + * (Partially excerpted from Botania's Wing System (as I had fiddled around with the system and couldn't make it work) with permission, thanks!) + */ + private void doWingStuff(LivingUpdateEvent event){ if(event.entityLiving instanceof EntityPlayer){ EntityPlayer player = (EntityPlayer)event.entityLiving; boolean wingsEquipped = ItemWingsOfTheBats.getWingItem(player) != null; diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java index 6c280a55d..5093bd907 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemWingsOfTheBats.java @@ -24,6 +24,8 @@ public class ItemWingsOfTheBats extends Item implements INameableItem{ * * Saves Remote Players separately to make de-synced Event Calling * not bug out Capabilities when taking off the Wings + * + * (Partially excerpted from Botania's Wing System (as I had fiddled around with the system and couldn't make it work) with permission, thanks!) */ public static ArrayList wingedPlayers = new ArrayList(); diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java index 2061e0505..90983f0d4 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityXPSolidifier.java @@ -86,10 +86,22 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I } } + /** + * Gets the Player's XP + * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) + * @param player The Player + * @return The XP + */ private int getPlayerXP(EntityPlayer player){ return (int)(this.getExperienceForLevel(player.experienceLevel)+(player.experience*player.xpBarCap())); } + /** + * Adds (or removes, if negative) a certain amount of XP from a player + * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) + * @param player The Player + * @param amount The Amount + */ private void addPlayerXP(EntityPlayer player, int amount){ int experience = getPlayerXP(player)+amount; player.experienceTotal = experience; @@ -104,6 +116,12 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I player.experience = (float)(experience-expForLevel)/(float)player.xpBarCap(); } + /** + * Gets the amount of experience a certain level contains + * (Excerpted from OpenBlocks' XP system with permission, thanks guys!) + * @param level The Level in question + * @return The total XP the level has + */ private int getExperienceForLevel(int level){ if(level > 0){ if(level > 0 && level < 16) return level*17;