From ec49003ca5af34b96062d0379833285f2e84ad70 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Fri, 25 Apr 2014 22:41:51 +0100 Subject: [PATCH] Soujourner's Strap effect, some changes to base bauble code for it to work propperly too. --- .../item/equipment/bauble/ItemAuraRing.java | 1 + .../item/equipment/bauble/ItemBauble.java | 16 ++++-- .../equipment/bauble/ItemGreaterAuraRing.java | 1 + .../item/equipment/bauble/ItemTinyPlanet.java | 1 + .../item/equipment/bauble/ItemTravelBelt.java | 47 +++++++++++++++++- resources/assets/botania/lang/en_US.lang | 2 +- .../textures/items/sojournersstrap_test.png | Bin 542 -> 0 bytes .../botania/textures/items/travelBelt.png | Bin 3040 -> 542 bytes 8 files changed, 61 insertions(+), 7 deletions(-) delete mode 100644 resources/assets/botania/textures/items/sojournersstrap_test.png diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemAuraRing.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemAuraRing.java index 1d94fad25..58f57116e 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemAuraRing.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemAuraRing.java @@ -26,6 +26,7 @@ public class ItemAuraRing extends ItemBauble { @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { + super.onWornTick(stack, player); if(player instanceof EntityPlayer && player.worldObj.getTotalWorldTime() % 2 == 0) ManaItemHandler.dispatchManaExact(stack, (EntityPlayer) player, 1, true); } diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemBauble.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemBauble.java index 37f194070..a0485c656 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemBauble.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemBauble.java @@ -90,10 +90,21 @@ public abstract class ItemBauble extends ItemMod implements IBauble { return true; } + @Override + public void onWornTick(ItemStack stack, EntityLivingBase player) { + if(player.ticksExisted == 1) + onEquippedOrLoadedIntoWorld(stack, player); + } + @Override public void onEquipped(ItemStack stack, EntityLivingBase player) { if(!player.worldObj.isRemote) player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1.3F); + onEquippedOrLoadedIntoWorld(stack, player); + } + + public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) { + // NO-OP } @Override @@ -101,9 +112,4 @@ public abstract class ItemBauble extends ItemMod implements IBauble { // NO-OP } - @Override - public void onWornTick(ItemStack stack, EntityLivingBase player) { - // NO-OP - } - } diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemGreaterAuraRing.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemGreaterAuraRing.java index 1f61e49c8..bc941cf43 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemGreaterAuraRing.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemGreaterAuraRing.java @@ -26,6 +26,7 @@ public class ItemGreaterAuraRing extends ItemBauble { @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { + super.onWornTick(stack, player); if(player instanceof EntityPlayer) ManaItemHandler.dispatchManaExact(stack, (EntityPlayer) player, player.worldObj.getTotalWorldTime() % 3 == 0 ? 2 : 1, true); } diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java index ebcea8890..c4372bd28 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTinyPlanet.java @@ -39,6 +39,7 @@ public class ItemTinyPlanet extends ItemBauble { @Override public void onWornTick(ItemStack stack, EntityLivingBase player) { + super.onWornTick(stack, player); int range = 8; List entities = player.worldObj.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(player.posX - range, player.posY - range, player.posZ - range, player.posX + range, player.posY + range, player.posZ + range)); for(Entity entity : entities) { diff --git a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java index 5788d2d9a..d4e07a47c 100644 --- a/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java +++ b/MODSRC/vazkii/botania/common/item/equipment/bauble/ItemTravelBelt.java @@ -11,19 +11,64 @@ */ package vazkii.botania.common.item.equipment.bauble; -import vazkii.botania.common.lib.LibItemNames; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent; +import vazkii.botania.common.lib.LibItemNames; import baubles.api.BaubleType; +import baubles.common.lib.PlayerHandler; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class ItemTravelBelt extends ItemBauble { public ItemTravelBelt() { super(LibItemNames.TRAVEL_BELT); + MinecraftForge.EVENT_BUS.register(this); } @Override public BaubleType getBaubleType(ItemStack itemstack) { return BaubleType.BELT; } + + @Override + public void onWornTick(ItemStack stack, EntityLivingBase entity) { + super.onWornTick(stack, entity); + if(entity instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) entity; + if((player.onGround || player.capabilities.isFlying) && player.moveForward > 0F) + player.moveFlying(0F, 1F, player.capabilities.isFlying ? 0.035F : 0.07F); + + if(player.isSneaking()) + player.stepHeight = 0.50001F; // Not 0.5F because that is the default + else if(player.stepHeight == 0.50001F) + player.stepHeight = 1F; + } + } + + @SubscribeEvent + public void onPlayerJump(LivingJumpEvent event) { + if(event.entityLiving instanceof EntityPlayer) { + EntityPlayer player = (EntityPlayer) event.entityLiving; + ItemStack belt = PlayerHandler.getPlayerBaubles(player).getStackInSlot(3); + + if(belt != null && belt.getItem() == this) { + player.motionY += 0.2; + player.fallDistance = -1F; + } + } + } + + @Override + public void onEquippedOrLoadedIntoWorld(ItemStack stack, EntityLivingBase player) { + player.stepHeight = 1F; + } + + @Override + public void onUnequipped(ItemStack stack, EntityLivingBase player) { + player.stepHeight = 0.5F; + } } diff --git a/resources/assets/botania/lang/en_US.lang b/resources/assets/botania/lang/en_US.lang index 572aae588..11541d7b2 100644 --- a/resources/assets/botania/lang/en_US.lang +++ b/resources/assets/botania/lang/en_US.lang @@ -710,7 +710,7 @@ botania.page.auraRing2=Upgrading the ring # -- SOUJOURNER'S SASH botania.entry.travelBelt=Soujourner's Sash -botania.page.travelBelt0=(todo) +botania.page.travelBelt0=Traversing terrain sometimes proves to be a hassle. The &1Soujourner's Sash&0 can be equipped in the &4Belt&0 slot, and when worn will increase the movement speed, jump height and resistance to fall damage of the wearer.
Lastly, if not sneaking, it also allows the wearer to walk over 1 block high gaps without jumping with ease. botania.page.travelBelt1=...everell # - MISCLANEOUS diff --git a/resources/assets/botania/textures/items/sojournersstrap_test.png b/resources/assets/botania/textures/items/sojournersstrap_test.png deleted file mode 100644 index 1607ef55cb447e7e2c5eba05a58909e05f80abfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 542 zcmV+(0^$9MP)<{98gxZibW?9;ba!ELWdKlNX>N2bPDNB8 zb~7$DE-^7j^FlWO00EjwL_t(IPhH$Hbo|$yy!}5zY#LA)n*mB} z|NHv-7|;y>VNe)=T!7tx2!4ncfNWd_NCvoqU7*>v{6DL22v7){3xI5p7%~=!w)`&^ zVgU|ByasGpS^0n2)CjNy46|lffn!0bJ_Ham7C>A*9 zMgCXZmn>48%sdxHnq0HI{N{}RzQK+WDjWeD{kjKTp6XtG0+G7xhuiUOxZlJWvF gCMz?MhW|4F09=J<-eEH7Qvd(}07*qoM6N<$f`J&`Pyhe` diff --git a/resources/assets/botania/textures/items/travelBelt.png b/resources/assets/botania/textures/items/travelBelt.png index 2bc277db2a78d78e61a25149a01fd50f1a3c9e40..1607ef55cb447e7e2c5eba05a58909e05f80abfa 100644 GIT binary patch delta 516 zcmV+f0{i{o7oG%=B!2{FK}|sb0I`n?{9y$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