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
  • Triphion
The update for 1.13 is being worked on - please be patient. (Updated 02/14/19)

Triphion

Members
 View Profile  See their activity
  • Content count

    76
  • Joined

    July 20, 2017
  • Last visited

    February 11

Community Reputation

0 Neutral

About Triphion

  • Rank
    Stone Miner

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Triphion

    [1.11.2] Trying to filter entity attack targets

    Triphion replied to Triphion's topic in Modder Support

    for (Entity entity : this.friendlyList) { if (entity.isDead) { this.friendlyList.remove(entity); } } Noticed aswell that if an undead dies, it crashes, i tried making this method to fix it, but to no avail. Edit: fixed it. Removed the method in its entirety and it somehow solved the problem ¯\_(ツ)_/¯ But i still need help regarding selecting target that is closest to the entity. @Override public void setAttackTarget(EntityLivingBase entitylivingbaseIn) { if (this.canTarget) { this.enemyList.removeAll(this.friendlyList); Entity enemy = (Entity) this.enemyList.get(0); double d0 = this.getDistanceSqToEntity((Entity) enemy); EntityLivingBase entityToAttack = (EntityLivingBase) enemy; if (d0 < 30.0D && d0 > 0) { entitylivingbaseIn = (EntityLivingBase) enemy; super.setAttackTarget(entitylivingbaseIn); } else { super.setAttackTarget(null); } } } I've started with this, but it's nowhere near done. So i need a few pointers to get the target i want. Edit: I fixed it! Thanks for all your help guys! ^^ @Override public void setAttackTarget(EntityLivingBase entitylivingbaseIn) { if (this.canTarget) { for (Entity entity : this.enemyList) { double d0 = this.getDistanceSqToEntity(entity); if (d0 < 40.0D) { super.setAttackTarget((EntityLivingBase) entity); } } } else { super.setAttackTarget(null); } } @Override protected void updateAITasks() { this.targetList = this.world.getEntitiesWithinAABBExcludingEntity(this, new AxisAlignedBB((double)this.posX - 17.5D, (double)this.posY - 17.5D, (double)this.posZ - 17.5D, (double)this.posX + 17.5D, (double)this.posY + 17.5D, (double)this.posZ + 17.5D)); if (this.getAttackTarget() == null && this.isAlly()) { for (Entity entity : this.targetList) { if (entity instanceof EntityUndead && ((EntityUndead) entity).isAlly() && !this.friendlyList.contains(entity)) { this.friendlyList.add(entity); } if (entity instanceof EntityPlayerMP && !this.friendlyList.contains(entity)) { this.friendlyList.add(entity); } } } else if (!(this.getAttackTarget() == null)) { this.canTarget = false; if (this.friendlyList.contains(this.getAttackTarget())) { this.setAttackTarget(null); } } this.targetList.removeAll(this.friendlyList); this.enemyList.clear(); this.enemyList.addAll(this.targetList); if (!this.enemyList.isEmpty()) { this.canTarget = true; } else if (this.enemyList.isEmpty()) { this.canTarget = false; } }
    • February 11
    • 6 replies
  2. Triphion

    [1.11.2] Trying to filter entity attack targets

    Triphion replied to Triphion's topic in Modder Support

    Tried a much higher limit aswell as no limit. But it still crashes. Any other suggestion on why it crashes? It gets called too often in updateAITasks and i should use some other update method? Undead class: https://github.com/triphion/Ancient-Mod/blob/master/src/main/java/ancient/entity/EntityUndead
    • February 11
    • 6 replies
  3. Triphion

    [1.11.2] Trying to filter entity attack targets

    Triphion replied to Triphion's topic in Modder Support

    if (this.getAttackTarget() == null && this.isAlly()) { for (Entity entity : this.targetList) { if (entity instanceof EntityUndead && ((EntityUndead) entity).isAlly() && !friendlyList.contains(entity)) { friendlyList.add(entity); } if (entity instanceof EntityPlayerMP && !friendlyList.contains(entity)) { friendlyList.add(entity); } } } Did it and it works, now however i need to check for all entities in the enemy list for the one that is closest to the entity. Any suggestions? Edit: I realized that the game crashes when there's too many loyal undeads. Not sure where in the code it gets overexerted.
    • February 11
    • 6 replies
  4. Triphion started following [1.11.2] Server won't let me update my teleport position and [1.11.2] Trying to filter entity attack targets February 10
  5. Triphion

    [1.11.2] Trying to filter entity attack targets

    Triphion posted a topic in Modder Support

    What i'm trying to achieve is a filtering system where my loyal undeads will select its next target based on a list that will get updated in updateAITasks. I think i have almost got it, but i'm still running into a few problems, such as the entity selecting a few targets that is not supposed to be targeted. To make sure this does what it's supposed to, i made a targetList which creates an aabb around the entity and then checks if there are any allies in that aabb, if there are, it adds the allies in the aabb. Or atleast is supposed to, but my problem is that i don't know how to reference all the friendly ones and then add them all at the same time. My entity class = https://github.com/triphion/Ancient-Mod/blob/master/src/main/java/ancient/entity/EntityUndead Worth noting is the way i'm adding and filtering. So first of i start with checking if the current target is null and if the targetList has any loyal undeads or players in it. If it has, then it's supposed to add them all. Then i remove them from the targetList and then add all of the remaining entities in the enemyList. Then every time this method gets called, so as to not overexert anything, i remove all the entities in the enemyList and then the process continue.
    • February 10
    • 6 replies
  6. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    Worked for me. A massive thanks to everyone who helped me! :D
    • October 1, 2018
    • 18 replies
  7. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    I do have a logger function, but only one that gets called preinit. If i want the logger function to get called, this way of doing it does work when im on singleplayer, however in server window, the log function never gets mentioned? @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if (!worldIn.isRemote) { EntityLivingBase player = ((EntityLivingBase)playerIn); RayTraceResult pos = player.rayTrace(22.0D, 20.0F); double x = pos.getBlockPos().getX(); double y = pos.getBlockPos().getY() + 1.0D; double z = pos.getBlockPos().getZ(); Utils.getLogger().info("Raytrace: " + pos.toString().substring(5)); if (player.attemptTeleport(x, y, z)) { player.getHeldItem(handIn).damageItem(1, playerIn); } } else{ return new ActionResult(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); } return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); }
    • September 30, 2018
    • 18 replies
  8. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    Found it. java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: net.minecraft.entity.EntityLivingBase.rayTrace(DF)Lnet/minecraft/util/math/RayTraceResult; at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_151] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_151] at net.minecraft.util.Util.runTask(Util.java:30) [Util.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:754) [MinecraftServer.class:?] at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:402) [DedicatedServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:699) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:548) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:748) [?:1.8.0_151] Caused by: java.lang.NoSuchMethodError: net.minecraft.entity.EntityLivingBase.rayTrace(DF)Lnet/minecraft/util/math/RayTraceResult; at com.triphion.ancient.items.ItemTheCosmician.onItemRightClick(ItemTheCosmician.java:45) ~[ItemTheCosmician.class:?] at net.minecraft.item.ItemStack.useItemRightClick(ItemStack.java:213) ~[ItemStack.class:?] at net.minecraft.server.management.PlayerInteractionManager.processRightClick(PlayerInteractionManager.java:387) ~[PlayerInteractionManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processTryUseItem(NetHandlerPlayServer.java:739) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:43) ~[CPacketPlayerTryUseItem.class:?] at net.minecraft.network.play.client.CPacketPlayerTryUseItem.processPacket(CPacketPlayerTryUseItem.java:9) ~[CPacketPlayerTryUseItem.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_151] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_151] at net.minecraft.util.Util.runTask(Util.java:29) ~[Util.class:?] ... 5 more [14:11:24] [Server thread/FATAL]: Error executing task This is the error and i have no idea how to fix it. The line that is the problem is the raytracing line that i talked about but i don't know more than this. This is line 45: RayTraceResult pos = player.rayTrace(22.0D, 20.0F); Any ideas?
    • September 30, 2018
    • 18 replies
  9. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    Yes, that is the one. But now i realize the if(!worldIn.isRemote) but the raytracing isn't working serverside. Anything i'm missing? Also, i added added a cast to the player saying it's an entitylivingbase, although the player class does extend entitylivingbase but i thought it could help just being even more specific.
    • September 30, 2018
    • 18 replies
  10. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    So i tried with console-printing and when im on the server it doesn't get called after the if(!worldIn.isRemote) check for some reason. @Override public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { scala.Console.print("Gets called. "); if (!worldIn.isRemote) { scala.Console.print("worki. "); RayTraceResult pos = playerIn.rayTrace(22.0D, 0.0F); double x = pos.getBlockPos().getX(); double y = pos.getBlockPos().getY() + 1.0D; double z = pos.getBlockPos().getZ(); if (playerIn.attemptTeleport(x, y, z)) { scala.Console.print("Teleported. "); playerIn.getHeldItem(handIn).damageItem(1, playerIn); } } else{ return new ActionResult(EnumActionResult.FAIL, playerIn.getHeldItem(handIn)); } return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } Anything that seems to doesn't work on server here? EDIT: I got a message from the server window that there's a problem with my raytracing apparently? Doesn't that get called correctly on server side, am i missing some important raytracing check for serverside?
    • September 30, 2018
    • 18 replies
  11. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    What is that? I have no idea what that is. Could you explain it to me? EDIT: Oh, i realized that you meant the Minecraft item, sorry about that. I'll take a look.
    • September 30, 2018
    • 18 replies
  12. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    Tried it, but server won't activate my item. And if i add the "else if(worldIn.isRemote)" i'm back where i started. This is a gyazo gif of what happens: https://gyazo.com/789d6fcf8c9f3c05c3fcdfc191aa96a7
    • September 29, 2018
    • 18 replies
  13. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if(!playerIn.world.isRemote) { RayTraceResult pos = playerIn.rayTrace(22.0D, 0.0F); double x = pos.getBlockPos().getX(); double y = pos.getBlockPos().getY() + 1.0D; double z = pos.getBlockPos().getZ(); playerIn.setPositionAndUpdate(x, y, z); playerIn.getHeldItem(handIn).damageItem(1, playerIn); return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } return new ActionResult(EnumActionResult.FAIL, playerIn.getHeldItem(handIn)); } I tried this, but now it doesn't work at all in server. Also tried with only checking if(!worldIn.isremote) but doesn't work in servers either.
    • September 29, 2018
    • 18 replies
  14. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion replied to Triphion's topic in Modder Support

    But i don't understand that part, i can still teleport if i look into the ground like 5 blocks forward, but not any more than that. Why is that? As you can see, my raytrace is far more than 5 blocks.
    • September 29, 2018
    • 18 replies
  15. Triphion

    [1.11.2] Server won't let me update my teleport position

    Triphion posted a topic in Modder Support

    So to get rid of a misunderstanding here, i can use the item, and it does teleport me if i click on the ground or something like 5 blocks away. However if i click beyond that then i will teleport to the position im looking at but right after the server will teleport me straight back to my beginning-position. It works on singleplayer, and the raytrace is further away than 5 blocks, it's actually a raytrace distance of 22 blocks. Any help would be much appreciated. @Override public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { if(!playerIn.world.isRemote) { RayTraceResult pos = playerIn.rayTrace(22.0D, 0.0F); double x = pos.getBlockPos().getX(); double y = pos.getBlockPos().getY() + 1.0D; double z = pos.getBlockPos().getZ(); playerIn.setPositionAndUpdate(x, y, z); worldIn.updateEntities(); playerIn.getHeldItem(handIn).damageItem(1, playerIn); return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } else if(playerIn.world.isRemote) { RayTraceResult pos = playerIn.rayTrace(22.0D, 0.0F); double x = pos.getBlockPos().getX(); double y = pos.getBlockPos().getY() + 1.0D; double z = pos.getBlockPos().getZ(); playerIn.setPositionAndUpdate(x, y, z); worldIn.updateEntities(); playerIn.getHeldItem(handIn).damageItem(1, playerIn); return new ActionResult(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn)); } return new ActionResult(EnumActionResult.FAIL, playerIn.getHeldItem(handIn)); }
    • September 29, 2018
    • 18 replies
  16. Triphion

    Can't remove task from my entity

    Triphion replied to Triphion's topic in Modder Support

    I got it to work! Thanks for all your help everyone! 😁
    • September 26, 2018
    • 16 replies
  • All Activity
  • Home
  • Triphion
  • Theme
  • Contact Us

Copyright © 2017 ForgeDevelopment LLC Powered by Invision Community