mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-19 03:39:17 +00:00
Finish the dodge ring
This commit is contained in:
1 parent
23f6260902
commit
a3408e1d2c
7 files changed
+81
-6
No files matched your search
@@ -62,6 +62,7 @@ import vazkii.botania.common.item.ItemCraftingHalo;
|
||||
import vazkii.botania.common.item.ItemSextant;
|
||||
import vazkii.botania.common.item.ItemTwigWand;
|
||||
import vazkii.botania.common.item.ModItems;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
|
||||
import vazkii.botania.common.lib.LibObfuscation;
|
||||
@@ -81,12 +82,27 @@ public final class HUDHandler {
|
||||
|
||||
if(event.getType() == ElementType.HEALTH) {
|
||||
profiler.startSection("botania-hud");
|
||||
ItemStack amulet = PlayerHandler.getPlayerBaubles(mc.thePlayer).getStackInSlot(0);
|
||||
IInventory baublesInv = PlayerHandler.getPlayerBaubles(mc.thePlayer);
|
||||
ItemStack amulet = baublesInv.getStackInSlot(0);
|
||||
if(amulet != null && amulet.getItem() == ModItems.flightTiara) {
|
||||
profiler.startSection("flugelTiara");
|
||||
ItemFlightTiara.renderHUD(event.getResolution(), mc.thePlayer, amulet);
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
dodgeRing: {
|
||||
ItemStack ring = baublesInv.getStackInSlot(1);
|
||||
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing)) {
|
||||
ring = baublesInv.getStackInSlot(2);
|
||||
if(ring == null || !(ring.getItem() instanceof ItemDodgeRing))
|
||||
break dodgeRing;
|
||||
}
|
||||
|
||||
profiler.startSection("dodgeRing");
|
||||
ItemDodgeRing.renderHUD(event.getResolution(), mc.thePlayer, ring, event.getPartialTicks());
|
||||
profiler.endSection();
|
||||
}
|
||||
|
||||
profiler.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,6 +293,7 @@ public final class ModCraftingRecipes {
|
||||
public static List<IRecipe> recipesAltGrassSeeds;
|
||||
public static IRecipe recipeSpeedUpBelt;
|
||||
public static IRecipe recipeBaubleCase;
|
||||
public static IRecipe recipeDodgeRing;
|
||||
|
||||
// Garden of Glass
|
||||
public static IRecipe recipeRootToSapling;
|
||||
@@ -1981,6 +1982,14 @@ public final class ModCraftingRecipes {
|
||||
'G', "ingotGold");
|
||||
recipeBaubleCase = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
// Ring of Dexterous Motion Recipe
|
||||
addOreDictRecipe(new ItemStack(ModItems.dodgeRing),
|
||||
"EM ", "M M", " MR",
|
||||
'E', "gemEmerald",
|
||||
'M', LibOreDict.MANA_STEEL,
|
||||
'R', LibOreDict.RUNE[3]);
|
||||
recipeDodgeRing = BotaniaAPI.getLatestAddedRecipe();
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Storage Block/Nugget Recipes
|
||||
|
||||
@@ -10,21 +10,29 @@
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.api.BaublesApi;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.client.core.handler.ClientTickHandler;
|
||||
import vazkii.botania.client.core.helper.RenderHelper;
|
||||
import vazkii.botania.common.core.handler.ConfigHandler;
|
||||
import vazkii.botania.common.core.helper.ItemNBTHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
@@ -34,6 +42,8 @@ import vazkii.botania.common.network.PacketHandler;
|
||||
public class ItemDodgeRing extends ItemBauble {
|
||||
|
||||
public static final String TAG_DODGE_COOLDOWN = "dodgeCooldown";
|
||||
public static final int MAX_CD = 20;
|
||||
|
||||
int leftDown, rightDown;
|
||||
|
||||
public ItemDodgeRing() {
|
||||
@@ -82,12 +92,16 @@ public class ItemDodgeRing extends ItemBauble {
|
||||
ItemNBTHelper.setInt(stack, TAG_DODGE_COOLDOWN, cd - 1);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void dodge(EntityPlayer player, boolean left) {
|
||||
if(!player.onGround || player.moveForward > 0.2 || player.moveForward < 0.2)
|
||||
if(player.capabilities.isFlying || !player.onGround || player.moveForward > 0.2 || player.moveForward < -0.2)
|
||||
return;
|
||||
|
||||
Vector3 lookVec = new Vector3(player.getLookVec());
|
||||
Vector3 sideVec = lookVec.crossProduct(new Vector3(0, left ? -1 : 1, 0)).multiply(1.25);
|
||||
float yaw = player.rotationYaw;
|
||||
float x = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
|
||||
float z = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
|
||||
Vector3 lookVec = new Vector3(x, 0, z);
|
||||
Vector3 sideVec = lookVec.crossProduct(new Vector3(0, left ? 1 : -1, 0)).multiply(1.25);
|
||||
|
||||
player.motionX = sideVec.x;
|
||||
player.motionY = sideVec.y;
|
||||
@@ -95,6 +109,30 @@ public class ItemDodgeRing extends ItemBauble {
|
||||
|
||||
PacketHandler.sendToServer(new PacketDodge());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static void renderHUD(ScaledResolution resolution, EntityPlayer player, ItemStack stack, float pticks) {
|
||||
int u = Math.max(1, stack.getItemDamage()) * 9 - 9;
|
||||
int v = 0;
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
int xo = resolution.getScaledWidth() / 2 - 20;
|
||||
int x = xo;
|
||||
int y = resolution.getScaledHeight() / 2 + 20;
|
||||
|
||||
if(!player.capabilities.isFlying) {
|
||||
int cd = ItemNBTHelper.getInt(stack, TAG_DODGE_COOLDOWN, 0);
|
||||
int width = Math.min((int) (((float) cd - pticks) * 2), 40);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
if(width > 0) {
|
||||
Gui.drawRect(xo, y - 2, xo + 40, y - 1, 0x88000000);
|
||||
Gui.drawRect(xo, y - 2, xo + width, y - 1, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack arg0) {
|
||||
|
||||
@@ -250,6 +250,7 @@ public final class LexiconData {
|
||||
public static LexiconEntry swapRing;
|
||||
public static LexiconEntry speedUpBelt;
|
||||
public static LexiconEntry baubleBox;
|
||||
public static LexiconEntry dodgeRing;
|
||||
|
||||
public static LexiconEntry alfhomancyIntro;
|
||||
public static LexiconEntry elvenMessage;
|
||||
@@ -1215,6 +1216,9 @@ public final class LexiconData {
|
||||
baubleBox.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeBaubleCase))
|
||||
.setPriority();
|
||||
|
||||
dodgeRing = new BasicLexiconEntry(LibLexicon.BAUBLE_DODGE_RING, categoryBaubles);
|
||||
dodgeRing.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeDodgeRing));
|
||||
|
||||
// ALFHOMANCY ENTRIES
|
||||
alfhomancyIntro = new BasicLexiconEntry(LibLexicon.ALF_INTRO, categoryAlfhomancy);
|
||||
alfhomancyIntro.setPriority()
|
||||
|
||||
@@ -225,6 +225,7 @@ public final class LibLexicon {
|
||||
public static final String BAUBLE_SWAP_RING = "swapRing";
|
||||
public static final String BAUBLE_SPEED_UP_BELT = "speedUpBelt";
|
||||
public static final String BAUBLE_BOX = "baubleBox";
|
||||
public static final String BAUBLE_DODGE_RING = "dodgeRing";
|
||||
|
||||
public static final String ALF_INTRO = "aIntro";
|
||||
public static final String ALF_MESSAGE = "elfMessage";
|
||||
|
||||
@@ -50,7 +50,7 @@ public class PacketDodge implements IMessage {
|
||||
}
|
||||
|
||||
player.addExhaustion(0.3F);
|
||||
ItemNBTHelper.setInt(ringStack, ItemDodgeRing.TAG_DODGE_COOLDOWN, 10);
|
||||
ItemNBTHelper.setInt(ringStack, ItemDodgeRing.TAG_DODGE_COOLDOWN, ItemDodgeRing.MAX_CD);
|
||||
});
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user