Jump to content

AliceTheGorgon

Members
  • Posts

    5
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    Code Dabbler

AliceTheGorgon's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. onEntityCollidedWithBlock only seemed to trigger with arrows (which seem to slightly enter the block), while players, mobs, and items, just seem to bump into the block without triggering it. onEntityWalking seems to work properly, both pushing the player, and being called with an EntityClientPlayerMP. I probably should have mentioned, however, that I want to be able to move all types entities, and move them from a distance. (The goal for this block is to function similarly to the Arcane Levitator from Thaumcraft 3, except to also be able to push (or pull) in all six directions, instead of only pushing up.) As for onFallenUpon, things just get strange. That method does get called on both the client and server, once with an EntityClientPlayerMP and once with an EntityPlayerMP, but then the player doesn't actually move when using addVelocity, or even when their velocity is manually set (even though the velocity does indeed get set, as a check of the entity's velocity afterward shows). Even stranger, checking the entity's velocity afterwards shows that it slows as if reaching the top of a jump, but the entity is still firmly on the ground. If I repeatedly jump up and down on the block, it will keep increasing my "motionY" to greater and greater levels, but I never actually rocket into the sky as the high motionY would suggest I should. If I put a block above myself, the motionY does not keep increasing the more I jump on the block. It does the same thing for mobs too, detects them, sets their velocity, and then they simply stay firmly on the ground. It also doesn't seem to detect items that fall on it.
  2. I don't have a tick handler class (I was using the updateTick method in my block's class), and the proxies are just the ones from the wiki tutorial which preload the textures. Taking a cue from you comment, however, I've just moved the method that pushes entities into the proxy classes, and called it from the block's updateTick method. Unfortunately, even after making the code run in the client proxy, the World.getEntitiesWithinAABB method still only seems to return EntityPlayerMP when the player is within the bounding box, instead of returning an EntityClientPlayerMP. After a bit more testing, it turns out that this is because the block only receives the server's world object when it ticks, so when it passes that to the client proxy, the client proxy doesn't have the client world, and only the client's world will have the EntityClientPlayerMP in it to detect and move the player. So now the question is, how do I get the client's world, so that I can detect the EntityClientPlayerMP in it? With the TileEntity (and also the block's onBlockActivated), it will be triggered by both the client and server, and thus gets the proper client world to push the player in. Whereas blocks seem to only receive the server world when they get ticked, and never the client world.
  3. Making a new post to ensure that anyone who has subscribed to the thread gets a notification. After much more poking around, I finally figured out a work around. I made the block extend BlockContainer instead of just Block, and added a tileEntity that moves entities in its UpdateEntity method. Lolth knows why player movement is handled client-side instead of server-side, or why the updateTick method of a standard block doesn't bother to get used for prediction by the client. If anyone knows how to properly notify the client that stuff is being pushed around without resorting to using a tile entity, please let me know. Until then, I'll just have to make do with this method. Edit: Sorry about the squished together "[solved]" title edit. Apparently I was just barely under the title length limit with the original title, so there wasn't much leeway for me to use.
  4. Sorry to bump the thread, but it's been three days since I posted, which seems like a safe amount of time to wait. I've been poking around a bit, but still haven't figured out what the problem is. My guess is that it's related to the fact that onBlockActivated gets called twice, once with an EntityClientPlayerMP and once with an EntityPlayerMP, but I have no idea why that is, or how to get an EntityClientPlayerMP for updateTick to act upon. Especially since casting from EntityPlayerMP to EntityClientPlayerMP is not possible.
  5. Here's the code: Edit: And here's the code on paste.minecraftforge.net for the syntax highlighting: http://paste.minecraftforge.net/view/4eed23b9 public void updateTick(World currentWorld, int x, int y, int z, Random random) { currentWorld.scheduleBlockUpdate(x, y, z, this.blockID, this.tickRate()); AxisAlignedBB interactionBox = AxisAlignedBB.getBoundingBox(x, y, z, x+1, y+8, z+1); List entitiesToPush = currentWorld.getEntitiesWithinAABBExcludingEntity((Entity)null, interactionBox); Iterator entityToCheck = entitiesToPush.iterator(); while (entityToCheck.hasNext()) { Object tempObject = entityToCheck.next(); Entity currentEntity = (Entity) tempObject; System.out.println(currentEntity.toString()); currentEntity.addVelocity(0, 1, 0); } } public boolean onBlockActivated(World currentWorld, int x, int y, int z, EntityPlayer activatingPlayer, int par6, float par7, float par8, float par9) { System.out.println(activatingPlayer.toString()); activatingPlayer.addVelocity(0, 1, 0); return true; } The output from updateTick when I stand within the bounding box is: EntityPlayerMP['Player926'/533, l='New World', x=4.85, y=64.00, z=229.69] The physical result of standing in the bounding box is absolutely nothing. Though other entities (mobs, items, etc) do get pushed properly, though there is some visual jittering if the block tries to keep them at a steady height. The output from onBlockActivated is: EntityClientPlayerMP['Player926'/533, l='MpServer', x=3.44, y=65.62, z=229.95] EntityPlayerMP['Player926'/533, l='New World', x=3.44, y=64.00, z=229.95] The physical result of right-clicking the block is that I get flung up into the air, as expected. The forge modloader version is 4.7.4.520, and the forge version is v6.6.0.497. Minecraft coder pack is version 7.26. The Minecraft version is, of course, 1.4.7. Does anyone know what I'm doing wrong? Or if this is a bug of some sort? Edit2: Note, I have changed the types in the updateTick code from "Entity" to "EntityPlayer", and even "EntityPlayerMP", but none of those changed the output or actually moved the player.
×
×
  • Create New...

Important Information

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