From b1a2cebbd634784721c6ac73f121edb9ab3723e1 Mon Sep 17 00:00:00 2001 From: Lizbeth Rika Date: Tue, 18 Aug 2015 03:17:42 +0100 Subject: [PATCH] New Flugel Tiara mechanics. --- .../equipment/bauble/ItemFlightTiara.java | 54 +++++++++++++++--- .../botania/common/lexicon/LexiconData.java | 2 +- .../resources/assets/botania/lang/en_US.lang | 4 +- src/main/resources/assets/botania/sounds.json | 1 + .../resources/assets/botania/sounds/dash.ogg | Bin 0 -> 5096 bytes 5 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 src/main/resources/assets/botania/sounds/dash.ogg diff --git a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java index cf43ddb16..de3ea389c 100644 --- a/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java +++ b/src/main/java/vazkii/botania/common/item/equipment/bauble/ItemFlightTiara.java @@ -36,12 +36,14 @@ import net.minecraft.stats.Achievement; import net.minecraft.util.IIcon; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; +import net.minecraft.util.Vec3; import net.minecraftforge.client.event.RenderPlayerEvent; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import org.lwjgl.opengl.GL11; +import codechicken.lib.vec.Vector3; import vazkii.botania.api.item.IBaubleRender; import vazkii.botania.api.mana.IManaUsingItem; import vazkii.botania.api.mana.ManaItemHandler; @@ -71,6 +73,8 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub private static final String TAG_FLYING = "flying"; private static final String TAG_TIME_LEFT = "timeLeft"; private static final String TAG_INFINITE_FLIGHT = "infiniteFlight"; + private static final String TAG_DASH_COOLDOWN = "dashCooldown"; + private static final String TAG_IS_SPRINTING = "isSprinting"; public static List playersWithFlight = new ArrayList(); private static final int COST = 35; @@ -162,12 +166,48 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub EntityPlayer p = (EntityPlayer) player; boolean flying = p.capabilities.isFlying; + boolean wasSprting = ItemNBTHelper.getBoolean(stack, TAG_IS_SPRINTING, false); + boolean isSprinting = p.isSprinting(); + if(isSprinting != wasSprting) + ItemNBTHelper.setBoolean(stack, TAG_IS_SPRINTING, isSprinting); + int time = ItemNBTHelper.getInt(stack, TAG_TIME_LEFT, MAX_FLY_TIME); int newTime = time; - if(flying && time > 0 && !ItemNBTHelper.getBoolean(stack, TAG_INFINITE_FLIGHT, false)) - newTime--; - else if(!flying && time < MAX_FLY_TIME && player.ticksExisted % 2 == 0) - newTime++; + Vector3 look = new Vector3(p.getLookVec()); + look.y = 0; + look.normalize(); + + if(flying) { + if(time > 0 && !ItemNBTHelper.getBoolean(stack, TAG_INFINITE_FLIGHT, false)) + newTime--; + final int maxCd = 60; + int cooldown = ItemNBTHelper.getInt(stack, TAG_DASH_COOLDOWN, 0); + if(!wasSprting && isSprinting && cooldown == 0) { + p.motionX += look.x; + p.motionZ += look.z; + p.worldObj.playSoundAtEntity(p, "botania:dash", 1F, 1F); + ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, maxCd); + } else if(cooldown > 0) { + if(maxCd - cooldown < 2) + player.moveFlying(0F, 1F, 5F); + else if(maxCd - cooldown < 10) + player.setSprinting(false); + ItemNBTHelper.setInt(stack, TAG_DASH_COOLDOWN, cooldown - 1); + } + + } else if(!flying) { + boolean doGlide = player.isSneaking() && !player.onGround; + if(time < MAX_FLY_TIME && player.ticksExisted % (doGlide ? 6 : 2) == 0) + newTime++; + + if(doGlide) { + player.motionY = Math.max(-0.15F, player.motionY); + float mul = 0.6F; + player.motionX = look.x * mul; + player.motionZ = look.z * mul; + player.fallDistance = 0F; + } + } ItemNBTHelper.setBoolean(stack, TAG_FLYING, flying); if(newTime != time) @@ -186,11 +226,9 @@ public class ItemFlightTiara extends ItemBauble implements IManaUsingItem, IBaub if(shouldPlayerHaveFlight(player)) { player.capabilities.allowFlying = true; if(player.capabilities.isFlying) { - if(!player.worldObj.isRemote) { + if(!player.worldObj.isRemote) ManaItemHandler.requestManaExact(tiara, player, getCost(tiara, left), true); - if(left < 3 && !player.inventory.hasItem(ModItems.flugelEye)) - player.setFire(5); - } else if(Math.abs(player.motionX) > 0.1 || Math.abs(player.motionZ) > 0.1) { + else if(Math.abs(player.motionX) > 0.1 || Math.abs(player.motionZ) > 0.1) { double x = event.entityLiving.posX - 0.5; double y = event.entityLiving.posY - 1.7; double z = event.entityLiving.posZ - 0.5; diff --git a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java index eb56d39b2..995940cc4 100644 --- a/src/main/java/vazkii/botania/common/lexicon/LexiconData.java +++ b/src/main/java/vazkii/botania/common/lexicon/LexiconData.java @@ -783,7 +783,7 @@ public final class LexiconData { new PageText("11"), new PageCraftingRecipe("12", ModCraftingRecipes.recipeRedStringRelay)); flightTiara = new ALexiconEntry(LibLexicon.ENDER_FLIGHT_TIARA, categoryEnder); - flightTiara.setLexiconPages(new PageText("0"), new PageText("4"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeFlightTiara), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipesWings)); + flightTiara.setLexiconPages(new PageText("0"), new PageText("4"), new PageText("5"), new PageText("6"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeFlightTiara), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipesWings)); corporea = new ALexiconEntry(LibLexicon.ENDER_CORPOREA, categoryEnder); corporea.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("3"), new PageText("4"), new PageText("5"), new PageText("6"), new PageCraftingRecipe("7", ModCraftingRecipes.recipeCorporeaSpark), new PageCraftingRecipe("8", ModCraftingRecipes.recipeMasterCorporeaSpark)); diff --git a/src/main/resources/assets/botania/lang/en_US.lang b/src/main/resources/assets/botania/lang/en_US.lang index 3005e4d3d..be04d843a 100644 --- a/src/main/resources/assets/botania/lang/en_US.lang +++ b/src/main/resources/assets/botania/lang/en_US.lang @@ -2522,7 +2522,9 @@ botania.page.redString12=The &1Red Stringed Spoofer&0. # -- FLUGEL TIARA botania.entry.flightTiara=Flügel Tiara botania.page.flightTiara0=The &4Flügel&0 were once a dominant species in the lands, now they're but a race past extinct, once created as godslayers, who possessed the ability of flight.
The usage of &1Gaia Spirits&0 allows for a small replica of their power, in the form of the &1Flügel Tiara&0, which, at the cost of &4Mana&0 allows for flight. -botania.page.flightTiara4=Not all is perfect with reproducing old technology though, the tiara has its flaws, that meaning it can't provide the power of flight constantly. If used for over ten seconds without letting it recharge it'll stop being able to provide the power of flight, it'll also set the wearer aflame.
A "flight bar" is displayed on the HUD to help monitor this. +botania.page.flightTiara4=Not all is perfect with reproducing old technology though, the tiara has its flaws, that meaning it can't provide the power of flight constantly. If used for over ten seconds without letting it recharge it'll stop being able to provide the power of flight.
A "flight bar" is displayed on the HUD to help monitor this. +botania.page.flightTiara5=In adition to simple flight, the tiara grants the wearer the ability to &4dash&0 and &4glide&0. Pressing the sprint key (CTRL by default) while flying, provided one isn't sprinting already, will start a dash, a quick speed boost in the direction the wearer's facing.
Dashes can only be done every 3 seconds. +botania.page.flightTiara6=Gliding allows one to gently descend to the ground while also covering a decent horizontal distance. It also prevents fall damage. To glide, one would simply sneak while falling.
Gliding can be executed even with an empty flight bar, but while gliding, the flight bar regenerates slower than normally. botania.page.flightTiara1=Forty thousand books from another world botania.page.flightTiara2=Combining the Tiara with a variety of Quartz species allows for it to create various different kinds of aesthetic wings, one for each style of quartz.
The recipes for the various types of quartz can be found in the &4Decorative Blocks&0 entry under &4Miscellaneous&0, &1Elven Quartz&0 is acquired by trading &1Nether Quartz&0 with the elves. botania.page.flightTiara3=Adding Wings (they can be swapped any time) diff --git a/src/main/resources/assets/botania/sounds.json b/src/main/resources/assets/botania/sounds.json index f870ca126..8fe1f76f1 100644 --- a/src/main/resources/assets/botania/sounds.json +++ b/src/main/resources/assets/botania/sounds.json @@ -6,6 +6,7 @@ "babylonSpawn": { "category": "player", "sounds":["babylonSpawn"] }, "bifrostRod": { "category": "player", "sounds":["bifrostRod"] }, "blackLotus": { "category": "block", "sounds":["blackLotus"] }, + "dash": { "category": "player", "sounds":["dash"] }, "ding": { "category": "block", "sounds":["ding"] }, "divaCharm": { "category": "player", "sounds":["divaCharm"] }, "divinationRod": { "category": "player", "sounds":["divinationRod"] }, diff --git a/src/main/resources/assets/botania/sounds/dash.ogg b/src/main/resources/assets/botania/sounds/dash.ogg new file mode 100644 index 0000000000000000000000000000000000000000..c24ea2cda43157e2610e20acae189003228bdac6 GIT binary patch literal 5096 zcmcgvdpwleyMISys5EIXYG}kTuZ@hThH5k9^0tZBwdu0Uqzq|e*d=OXMq5TUW7sZ3 zXhw}pC{yX|E~*(sqZCRvUECs6lG^)MXU+Jv&-tCt`TRcTud_aD);#a~to2>bZ9UI= zH|^OI2x&n7Y_QcV(QfQ>0b`2!`KS1B7F+cSvpi&$V_G)*FTre5t^B*GR${^eY;F#!1B`?9q##r$SMv@J3b0*-jVk&(2d%Ru9=Kcr~?;I%LQ`qe20X#MyTw z$6W?cE(BFnQnFr9^l(eg>O!p$gmaCp3{p{!^JN0sJ2=WiW%VY7{>UFyy2)l!lbz)7<(%Ri8J3}xFX-rxlP3P zbG~J9A_t9zW%$4!8U_rRQdy6XUFQZfv#AQge+}kpGXRBgbB%Z90s*;rHE2A*BhIP? zn5v*BZa^)(;w`-R7HxbRpZvA$=TzPIzK5?taCdM_?{v(M(=pGwBc4r1JnD|vRv7U_ z7PGBq+qT}sf9-13Q#GN~oL9i=pnK}+z@Zm!gt&VbiC)$Ikh!lRbpUh%r_^1DXP}OUJH5~Fa;p; z*ZSOZ^!-0}m0>j?5PZ1&T*R*-)Du=%G;X&R;q&h&pDGIf!TF7ZJ{Q(*`V}z~SKNE* zAkIbSC!Z{$w-R1ga&oB|^}T)U&dVQ7f%6tY9w3(}ND3UYm1;@m=u=xPcA?9MgaSXr zQ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