Jump to content
  • Home
  • Files
  • Docs
Status Updates
  • All Content

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Rosy162

Rosy162

Members
 View Profile  See their activity
  • Content Count

    3
  • Joined

    November 14, 2020
  • Last visited

    10 hours ago

Community Reputation

0 Neutral

About Rosy162

  • Rank
    Tree Puncher

Converted

  • Gender
    Female
  • Personal Text
    have no idea what im doing .___.
  1. Rosy162

    [1.16.4] how do i get the entity that a player is looking at

    Rosy162 replied to Rosy162's topic in Modder Support

    i got it working thank u :^))
    • December 19, 2020
    • 2 replies
  2. Rosy162 started following [1.12.2] player.isElytraFlying() is not being set to true when flying with custom elytra code and [1.16.4] how do i get the entity that a player is looking at December 19, 2020
  3. Rosy162

    [1.16.4] how do i get the entity that a player is looking at

    Rosy162 posted a topic in Modder Support

    how do i get the entity that a player is looking at? idk how to do it .-.
    • December 19, 2020
    • 2 replies
  4. Rosy162 Rosy162 changed their profile photo November 14, 2020
  5. Rosy162

    [1.12.2] player.isElytraFlying() is not being set to true when flying with custom elytra code

    Rosy162 posted a topic in Modder Support

    ok so i have a very specific issue that i dont know how to solve. im trying to make a mod which uses the baubles api that allows you to place the elytra in the baubles (body) slot. ive got pretty much everything to work but in EntityLivingBase, the method updateElytra() is checking if the chestplate slot has the elytra and if it doesnt it sets the player.isElytraFlying() method to false, regardless of if you are actually flying with the elytra. this is causing issues minecraft uses this method to decide when to calculate the elytra damage and so on... when im flying with the elytra in the baubles slot, player.isElytraFlying() is returning true and false repeatedly because of this method. i need it to always return true when you are flying but idk how to do that. hopefully someone smarter than me can help .-. sorry if im being stupid. here is the code for my custom elytra item: @Mod.EventBusSubscriber public class BaubleItemElytra extends ItemElytra implements IBauble { private static boolean render = true; public Method setFlagMethod; public BaubleItemElytra() { super(); this.setUnlocalizedName("elytra"); try { // this method is what is used to make the player fly, it is private so i get it here ._. try { setFlagMethod = Entity.class.getDeclaredMethod("setFlag", int.class, boolean.class); } catch (Exception e) { setFlagMethod = Entity.class.getDeclaredMethod("func_70052_a", int.class, boolean.class); } setFlagMethod.setAccessible(true); } catch (NoSuchMethodException e) {} } @Override public BaubleType getBaubleType(ItemStack stack) { return BaubleType.BODY; } //register item @SubscribeEvent public static void register(RegistryEvent.Register<Item> event) { event.getRegistry().register((new BaubleItemElytra().setRegistryName("minecraft", "elytra"))); } //registers the elytra render once, //BaubleLayerElytra is just the same as the vanilla LayerElytra but it checks for the bauble slot @SubscribeEvent public static void onPlayerRender(RenderPlayerEvent.Pre event) { if (render) { event.getRenderer().addLayer(new BaubleLayerElytra(event.getRenderer())); render = false; } } //cant equip if you have elytra equipped already @Override public boolean canEquip(ItemStack itemstack, EntityLivingBase player) { return !slotHasElytra((EntityPlayer)player); } @Override public void onEquipped(ItemStack itemstack, EntityLivingBase player) { player.playSound(SoundEvents.ITEM_ARMOR_EQIIP_ELYTRA, .75F, 1.9f); //chatMessage(player, "equipped"); } @Override public void onUnequipped(ItemStack itemstack, EntityLivingBase player) { //chatMessage(player, "unequipped"); setFlying(player, false); player.playSound(SoundEvents.ITEM_ARMOR_EQIIP_ELYTRA, .75F, 1.8f); } public static boolean slotHasElytra(EntityPlayer player) { return player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() instanceof ItemElytra; } @Override public void onWornTick(ItemStack itemstack, EntityLivingBase player) { //unequips elytra in bauble if elytra is in chestplate slot if (slotHasElytra((EntityPlayer)player)) { ((EntityPlayer)player).addItemStackToInventory(itemstack.copy()); BaublesApi.getBaublesHandler((EntityPlayer)player).setStackInSlot(5, ItemStack.EMPTY);; } boolean flag = player.isElytraFlying(); //chatMessage(player, "check flying:" + player.isElytraFlying()); if (flag && !player.onGround && !player.isRiding() && isUsable(itemstack)) { flag = true; if ((player.getTicksElytraFlying() + 1) % 20 == 0) { //itemstack.damageItem(1, player); } } else { flag = false; //if you press jump in the right conditions you fly if (Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed() && !player.isElytraFlying() && isUsable(itemstack) && player.motionY < 0.0D && !player.isInLava() && !player.isInWater() && !player.onGround) { flag = true; } } if (flag != player.isElytraFlying()) { setFlying(player, flag); //chatMessage(player, "flying set to: " + flag); } } //sets the player to the flying state public void setFlying(EntityLivingBase player, boolean fly) { try { setFlagMethod.invoke(player, 7, fly); } catch (Exception e) {} } private void chatMessage(EntityLivingBase player, String text) { ((EntityPlayer)player).sendMessage(new TextComponentString(text)); } //right clicking puts it in the bauble body slot if its empty, if its full it puts it in the chestplate @Override public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { player.playSound(SoundEvents.ITEM_ARMOR_EQIIP_ELYTRA, .75F, 1.9f); if (!world.isRemote) { IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player); ItemStack stack = baubles.getStackInSlot(5); if ((stack == null || stack.isEmpty()) && baubles.isItemValidForSlot(5, player.getHeldItem(hand), player)) { baubles.setStackInSlot(5, player.getHeldItem(hand).copy()); if (!player.capabilities.isCreativeMode) { player.inventory.setInventorySlotContents(player.inventory.currentItem, ItemStack.EMPTY); } //onEquipped(player.getHeldItem(hand), player); } else { super.onItemRightClick(world, player, hand); } } return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand)); } }
    • November 14, 2020
    • 2 replies
  • All Activity
  • Home
  • Rosy162
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community