Jump to content

Recommended Posts

Posted

I'm having an odd issue.  Sometimes when I go through my custom portals, the player immediately take damage like something hit me.  The player jumps with knockback and this sometimes lands in lava or a long fall. 

 

i've looked at the destination and the player is arriving inside the center of the portal block, not in one of the frame blocks.

 

 

Anyone had experience with this?

 

 

Part of code actually moving the player.

 

 

 

        playerMP.motionX = playerMP.motionY = playerMP.motionZ = 0.0D;

        playerMP.fallDistance = 0.0F;

        playerMP.setPositionAndRotation(dx, dy, dz, entity.rotationYaw, entity.rotationPitch);

       

        // Set Dimension

        playerMP.mcServer.getConfigurationManager().transferPlayerToDimension(playerMP, dimension, this);

 

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I think the problem is, that you moves the position of the player BEFORE transferring dimension.

It would probably cause some issues, like on the case that teleport to the position is invalid.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Posted

I tried it after and it did nothing.  The player kept the same coordinates from the old dimension.

 

Do I have to delay the movement request a tick or something?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

public void onEntityCollidedWithBlock(World p_149670_1_, int p_149670_2_, int p_149670_3_, int p_149670_4_, Entity entity)
    {
    	if ((entity.ridingEntity == null)&& (entity.riddenByEntity == null) && ((entity instanceof EntityPlayerMP))) 
    	{
		EntityPlayerMP thePlayer = (EntityPlayerMP) entity;
		if (thePlayer.timeUntilPortal > 0) 
		{
			thePlayer.timeUntilPortal = 10;
		}
		else if (thePlayer.dimension != mod_cobalt.cobaltdimension) 
		{
			thePlayer.timeUntilPortal = 10;
			thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, mod_cobalt.cobaltdimension, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(mod_cobalt.cobaltdimension)));
		} 
		else 
		{
			thePlayer.timeUntilPortal = 10;
			thePlayer.mcServer.getConfigurationManager().transferPlayerToDimension(thePlayer, 0, new TeleporterCobalt(thePlayer.mcServer.worldServerForDimension(0)));
		}
		if (entity instanceof EntityPlayer) 
		{
			EntityPlayer entityplayer = (EntityPlayer) entity;
			entityplayer.addStat(mod_cobalt.cobaltachiev14, 1);
		}
	}
    }

 

You need also a custom Teleporter

 

 

Maybe this will help ya ^^ I can send you my whole dimension/Portal code if doesn't work.

Posted

Dragonisser,

I've got a custom Teleporter.  That line of code is from it. 

 

I just pulled out the lines of code that impact where the playere is at and when they transfer.

 

It works great.  I even have the screen wobble with the right colors for my portal colors and entry timers working perfectly.

 

The only problem is that about every other time, the player acts like he got hit with damage, jumps and makes the hurt noise.  No damage received though.  Sometimes this moves him out into lava though.

 

I'm teleporting him into the east most or north most portal block.  I'm starting to wonder if I should teleport him to the open air spot just outside the portal block.  Thoughts?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

I'm not sure I understand your question.  If you build a custom teleporter, how do you not specify where the player goes?

 

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

As far down the rabbit hole as I went, I don't think I can.  It won't be compatiable.

 

I tested on normal portals that it didn't occur.  It doesn't.  I tracked the code all the way through from vanilla entering a portal to being in the new dimension.  I 'think' i'm duplicating it in the exact same order.

 

It really does seem to be that some of the time (with no pattern I can see), it decides a portal block is solid and should hurt you.

 

As I type that, it gives me an idea.  Before shifting the landing spot, I'm going to watch the damage event and see if it is showing anything.  Maybe that will shed some light.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

WOOTA!!!!!!

 

Fixed it.

 

This may be difficult to follow, but I'll give it a shot.  i was shifting the player to the center of the portal block by adding 0.5x and 0.5z.  For some reason this made the player register a collision with the portal frame.  The player can stand there just fine without damage, but if he teleports there, oh hell.  Not sure how that makes sense, but its is reality.

 

So I did a little checking on position to make sure I moved the player to the exact spot between the end of one portal block and the start of the next.  BINGO!  No more issue.

 

Thanks everyone for the help.

 

 

Long time Bukkit & Forge Programmer

Happy to try and help

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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