Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Thornack

  1. I have no idea where to even look the error only happens once in a while it seems so Im not sure what code to provide
  2. I think I can bandaid the solution by setting the delayBeforeCanPickup variable for the entity item (somehow) but i think id rather know what the real issue is so i can fix it
  3. This happens when I run a dedicated server, join the world, then store an entity inside my itemstack using my item and pick up the resultant item containing the nbt data for my entity "too fast" it seems (although it doesnt happen every time which is odd) Anyone know why this would occur? [13:57:03] [Netty IO #2/ERROR] [FML]: NetworkDispatcher exception io.netty.handler.codec.EncoderException: java.util.ConcurrentModificationException at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:129) ~[MessageToByteEncoder.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:637) ~[DefaultChannelHandlerContext.class:?] at cpw.mods.fml.common.network.handshake.NetworkDispatcher.write(NetworkDispatcher.java:423) ~[NetworkDispatcher.class:?] at io.netty.channel.DefaultChannelHandlerContext.invokeWrite(DefaultChannelHandlerContext.java:644) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.write(DefaultChannelHandlerContext.java:698) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:688) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelHandlerContext.writeAndFlush(DefaultChannelHandlerContext.java:717) ~[DefaultChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:893) ~[DefaultChannelPipeline.class:?] at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:239) ~[AbstractChannel.class:?] at net.minecraft.network.NetworkManager$1.run(NetworkManager.java:197) [NetworkManager$1.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [singleThreadEventExecutor.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [singleThreadEventExecutor$2.class:?] at java.lang.Thread.run(Unknown Source) [?:1.7.0_25] Caused by: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(Unknown Source) ~[?:1.7.0_25] at java.util.HashMap$KeyIterator.next(Unknown Source) ~[?:1.7.0_25] at net.minecraft.nbt.NBTTagCompound.write(NBTTagCompound.java:33) ~[NBTTagCompound.class:?] at net.minecraft.nbt.CompressedStreamTools.func_150663_a(CompressedStreamTools.java:158) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.write(CompressedStreamTools.java:148) ~[CompressedStreamTools.class:?] at net.minecraft.nbt.CompressedStreamTools.compress(CompressedStreamTools.java:88) ~[CompressedStreamTools.class:?] at net.minecraft.network.PacketBuffer.writeNBTTagCompoundToBuffer(PacketBuffer.java:94) ~[PacketBuffer.class:?] at net.minecraft.network.PacketBuffer.writeItemStackToBuffer(PacketBuffer.java:140) ~[PacketBuffer.class:?] at net.minecraft.entity.DataWatcher.writeWatchableObjectToPacketBuffer(DataWatcher.java:289) ~[DataWatcher.class:?] at net.minecraft.entity.DataWatcher.writeWatchedListToPacketBuffer(DataWatcher.java:186) ~[DataWatcher.class:?] at net.minecraft.network.play.server.S1CPacketEntityMetadata.writePacketData(S1CPacketEntityMetadata.java:50) ~[s1CPacketEntityMetadata.class:?] at net.minecraft.util.MessageSerializer.encode(MessageSerializer.java:46) ~[MessageSerializer.class:?] at net.minecraft.util.MessageSerializer.encode(MessageSerializer.java:53) ~[MessageSerializer.class:?] at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:111) ~[MessageToByteEncoder.class:?] ... 15 more [13:57:03] [server thread/INFO]: Player14 lost connection: TranslatableComponent{key='disconnect.genericReason', args=[internal Exception: io.netty.handler.codec.EncoderException: java.util.ConcurrentModificationException], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}} [13:57:03] [server thread/INFO]: Player14 left the game
  4. So it seems that for mobs the throwable heading is incorrect if you calculate it the way that EntityThrowable calculates it. The way around this was to instead use the entitites look vector.x (y and z) coordinates inside the setThrowableHeading method to calculate the correct heading after you create an instance of your EntityThrowable. EntityRangedAttackBase distanceAttack = new EntityRangedAttack(world, entityUsingAttackItem).setType(attackType).setAreaOfEffectRadius(damageRadius); distanceAttack.setBaseDamageForProjectileAttack(baseDmg); distanceAttack.setThrowableHeading(entityUsingAttackItem.getLookVec().xCoord, entityUsingAttackItem.getLookVec().yCoord + 0.1, entityUsingAttackItem.getLookVec().zCoord, 1.5F, 1.0F);
  5. Hi Everyone, So I have been developing a system where I have items that launch projectiles. I want these items to work for both the player and mobs. They work perfectly fine for the player atm but for the mob the projectiles are launched at the incorrect lookvector. I noticed that the client and server values for the look vector are not in sync. How does minecraft sync them up?
  6. I use the LivingHurtEvent to set the last attacker and then I just get the attacker in my AI and it works @SubscribeEvent public void hurt(LivingHurtEvent event) { if(event.entity instanceof EntityCustom){ EntityCustom entity = (EntityCustom) event.entity; entity.setLastAttacker(event.source.getEntity()); } } now it isnt null public boolean shouldExecute() { System.out.println("ATTACKING ENTITY IS: " + this.taskOwner.getLastAttacker()); }
  7. Hi everyone, I am working on a targeting AI, it is basically identical atm to the skeleton targeting AI as I have just started and I got this to work for my entity all of the methods are called properly etc etc. I was wondering if anyone would know how I could get the last attackerEntity that attacked the entity doing the targeting? I basically want to use this to change the targeting code so that instead of doing the regular targeting code that a skeleton does, my ai will do revenge attacks on the last attacking entity inside the shouldExecute method? I have tried outprinting the following to see whether or not i could get the entity using getLastAttacker(); System.out.println("LAST ENTITY TO ATTACK ME WAS: " + this.taskOwner.getLastAttacker()); but I get null every tick. anyone know why?
  8. I have been looking at it but when I try to use their method i cannot achieve what i want since the movingObjectPosition is null when you aim into the sky and I want my mob to spawn regardless of where you point the mouse (at a set radius) and if you point it on the ground it spawns just above the block you pointed at.
  9. My thoughts were to use my IEEP class for my player so that I can simply grab the values from the ray trace send them to the IEEP class on server side and then access the IEEP class from server side in the onItemRightClick method to use them for my spawning coordinates but I feel like there is a better way to achieve this since my rayTrace would happen in the onItemRightClick method
  10. Hi everyone, I have an item that stores an entity. I want this item to spawn the entity a given distance away from wherever the player right clicked the item based on a raytrace. I now have an issue if (world.isRemote){ MovingObjectPosition mop = player.rayTrace(5, 1.0F); int xCoord; int yCoord; int zCoord; if (!world.isAirBlock(mop.blockX, mop.blockY, mop.blockZ)){ xCoord = mop.blockX; yCoord= mop.blockY + 1; zCoord = mop.blockZ; } else { xCoord = mop.blockX; yCoord= mop.blockY; zCoord = mop.blockZ; } //send the packet here to update the server values so that I can then spawn my entity at a later time in the code } The ray trace has to occur client side but I need the results of the ray trace on server side. How would you suggest the packet to work so that I can pass the values from the client player to the server so that they can be used to spawn the entity? public class PacketC2SUpdateRayTraceCoords extends AbstractMessageToServer<PacketC2SUpdateRayTraceCoords> { private int xCoord; private int yCoord; private int zCoord; public PacketC2SUpdateRayTraceCoords() { } public PacketC2SUpdateRayTraceCoords(int xCoord, int yCoord, int zCoord) { //these are obtained from the client this.xCoord = xCoord; this.yCoord = yCoord; this.zCoord = zCoord; } @Override protected void read(PacketBuffer buffer) throws IOException { xCoord = buffer.readInt(); yCoord = buffer.readInt(); zCoord = buffer.readInt(); } @Override protected void write(PacketBuffer buffer) throws IOException { buffer.writeInt(xCoord); buffer.writeInt(yCoord); buffer.writeInt(zCoord); } @Override public void process(EntityPlayer player, Side side) { //The stuff in here occurs server side } }
  11. So As you can see i followed your suggestions and the itemstack is invulnerable but once I pick it up I cannot drop the itemstack from my hotbar or inventory. would you know why?
  12. if I change @Override public Entity createEntity(World world, Entity location, ItemStack itemstack){ System.out.println("HERE"); return new EntityIndestructableItem(world, location.posX, location.posY, location.posZ, itemstack); to @Override public Entity createEntity(World world, Entity location, ItemStack itemstack){ System.out.println("HERE"); return new EntityIndestructableItem(world, location.posX, location.posY, location.posZ); I can drop the item but it immediately turns into a stone block which i pick up immediately.... anyone know what the issue is?
  13. I figured out that my entity was invisible (I had to register the entity in common proxy which i fixed) so now when the lava goes to destroy the item it persists however I still cannot drop the item once I pick it up. Any ideas what would cause the item not to be droppable using the Q btn?
  14. In my item.java class I did the following @Override public boolean hasCustomEntity(ItemStack stack){ return true; } @Override public Entity createEntity(World world, Entity location, ItemStack itemstack){ System.out.println("HERE"); return new EntityIndestructableItem(world, location.posX, location.posY, location.posZ, itemstack); } @Override public int getEntityLifespan(ItemStack itemStack, World world){ return Integer.MAX_VALUE; } public class EntityIndestructableItem extends EntityItem { public EntityIndestructableItem(World worldIn, double x, double y, double z) { super(worldIn, x, y, z); isImmuneToFire = true; } public EntityIndestructableItem(World world, double x, double y, double z, ItemStack stack) { super(world, x, y, z, stack); isImmuneToFire = true; } public EntityIndestructableItem(World worldIn) { super(worldIn); isImmuneToFire = true; } @Override public boolean isEntityInvulnerable() { return true; } @Override public boolean attackEntityFrom(DamageSource source, float amount) { if(source.getDamageType().equals(DamageSource.outOfWorld.damageType)) { return true; } // prevent any damage besides out of world return false; } } but now I cannot drop the item on the ground and the if the item is on the ground then it disapears when lava kills it and when I take lava away the item reappears
  15. Hi Everyone (yes i should probably update my forge to the newer version but that'll take forever atm and I havent been on in a while but) How would you make an itemstack indestructible (and by that i mean if it gets thrown into lava or gets left out in the world the item wont ever be destroyed no matter what happens to it)? Is this even possible?
  16. Anyone have any other ideas? Ernio suggested I move my dev environment to 1.8 so i can use net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup to move the camera but.... when I did that it resulted in 1500+ errors of all sorts and its very overwhelming to deal with that so ill stick to 1.7.10 for now. Does anyone have any other solutions?
  17. Ive tried a few things and havent found a good solution to this. Can anyone think of any way to solve the clipping issue where the players head is inside the block after the players hitbox was resized and eye height was changed??
  18. Setting the ySize variable every tick and then moving rendering upwards solves the issue where the head goes into the block but you still get the weird black halo and the model goes black (unless you are flying). Does anyone know how to solve the head going through a block problem in a different way so that it will go under the block without having the weird black texture issues?
  19. Im just messing around with this some more, Ive moved away from using Tick event and I have a problem. I cannot set the ySize once. My morph function is called once and that is triggered by a button click from the user. This function is called server side only and so when I reset the bounding box I then have to update the client via a packet. My packet is as follows. public class PacketSyncS2CBoundingBox extends AbstractMessageToClient<PacketSyncS2CBoundingBox> { private float playerWidth; private float playerHeight; // private float playerYSize; private float playerEyeHeight; public PacketSyncS2CBoundingBox() {} public PacketSyncS2CBoundingBox(float playerWidth, float playerHeight,float playerYSize, float playerEyeHeight) { this.playerWidth = playerWidth; this.playerHeight = playerHeight; //this.playerYSize = playerYSize; this.playerEyeHeight = playerEyeHeight; } @Override protected void read(PacketBuffer buffer) throws IOException { playerWidth = buffer.readFloat(); playerHeight = buffer.readFloat(); //playerYSize = buffer.readFloat(); playerEyeHeight = buffer.readFloat(); } @Override protected void write(PacketBuffer buffer) throws IOException { buffer.writeFloat(playerWidth); buffer.writeFloat(playerHeight); //buffer.writeFloat(playerYSize); buffer.writeFloat(playerEyeHeight); } @Override public void process(EntityPlayer player, Side side) { System.out.println(" CLIENT MORPH width "+playerWidth +" height "+ playerHeight +" eyeHeight "+ playerEyeHeight); player.width = playerWidth; player.height = playerHeight; //player.ySize = playerYSize; player.eyeHeight = playerEyeHeight; player.boundingBox.setBB(AxisAlignedBB.getBoundingBox((double)player.boundingBox.minX, ((double)player.boundingBox.minY), (double)player.boundingBox.minZ, (double)player.boundingBox.minX + 0.9D,(double) player.boundingBox.minY + 0.9D,(double) player.boundingBox.minZ + 0.9D)); } } Now, the reason I commented out the ySize variable is because if I change it on the server and then send the packet and update its vaue on the client the ySize variable changes. It seems to decrease until it is 0 again. Hence I run into the issue I had before where my players head collides with the box and I get the following: this is a series of screenshots of my player moving through a 1 block tall gap under this bridge from the left to the right. As you can see in the middle image the players head is inside the block rather than under it my players head goes inside of the block. I want the players head to go under the block. When I changed the YSize in onTick it worked great because the ySize variable couldnt change (but this introduced the issue of rendering the model with the dark overlay texture and that weird oval texture from before). Does anyone know how to fix the head going through the block problem that you see in the above photo (the middle screenshot)?
  20. Im not sure how to move the box, if I lower the min yCoord then I get an illegal stance exception. I know how to move the rendering up, I do that with my model but even when I move the rendering of the model using yOffset in my renderer I still get the model turning black and that weird halo effect.
  21. The min position of the bounding box seems to be set at the height of the (+) targeting cursor. That isnt the main issue though, I can deal with the box not displaying properly because the collisions seem to work out so that I can still walk through holes that are only 1 block in size. The biggest issue is the model turning dark and the weird black oval haze texture that renders if my player is too low to the ground. if (ySize > 1.4849999F) then model is dark and that weird black oval halo texture around the sides of the screen shows up. but if (ySize < 1.4849999F) model is normal and that oval texture doesnt show. I need my ySize to be at 2.75 as this makes walking under the 1 block in height gaps possible. (if you dont have it set that high then the players head goes through the blocks and not under it resulting in a black screen for the player)
  22. how would you move it down by 1? if I take the maxY bounding box coord and move that down by 1 I get collision problems. I think the bounding box is actually set by height and width somehow.
  23. If there is any way to stop the rendering that causes the model to go black and the weird black halo crop effect that surrounds the screen then this technique would be pretty cool since hit mechanics work perfectly (just re resized to work with the smaller shorter player. And, if replacing the player model one can simply change the models yOffset and it will render perfectly on top of the ground. (just need to stop it from going black). Its pretty awesome because you can see normally when you go underneath a 1 block high space. (you can fit inside a 1 block sized hole with the above code). Here are a few screenshots of the view resizing when I go underneath the 1 block high bridge I built. The player travelled Left in the order of 4->3->2->1
  24. Ok So I played around with this and this is what I got. public void playerTick(PlayerTickEvent event) { event.player.width = 0.9F; event.player.height =0.9F; event.player.ySize = 2.75F; event.player.eyeHeight = (float) 0.43; event.player.boundingBox.setBB(AxisAlignedBB.getBoundingBox((double)event.player.boundingBox.minX, (double)event.player.boundingBox.minY, (double)event.player.boundingBox.minZ, (double)event.player.boundingBox.minX + 0.9D,(double) event.player.boundingBox.minY + 0.9D,(double) event.player.boundingBox.minZ + 0.9D)); } Everything is great except what you see in the following image: The model goes dark and I get this weird halo effect around the entity. I dont want this. Does anyone know why it happens and where so I can disable it?? As a note, I figured out that if I change the ySize variable and make it positive it moves the players camera view down. But I guess if the player camera view goes below a certain value (ySize > 1.4849999F) then your player model will go dark and that round halo effect gets rendered. I want to turn this off. Also if you give ySize a negative value your game displays an illegal stance exception
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.