Jump to content

Recommended Posts

Posted

Hi there!

 

I would really need some help with my custom dimension... I can't light my portal.

 

Here's my custom fire onBlockAdd method:

 

public void onBlockAdded(World world, int x, int y, int z) {
if (world.getBlock(x, y - 1, z).equals(TheDogDim.cuteBlock)) {
	System.out.println("[WOG] [iNFO] Cute Block lit up");
	if (TheDogDim.cutePortal.func_150000_e(world, x, y, z)) // tryToCreatePortal is func_150000_e
		System.out.println("[WOG] [iNFO] Cute Portal opened");
}
}

 

 

And here's my tryToCreatePortal (func_150000_e):

 

@Override
public boolean func_150000_e(World world, int x, int y, int z) {
        CutePortal.Size size = new CutePortal.Size(world, x, y, z, 1);
        CutePortal.Size size1 = new CutePortal.Size(world, x, y, z, 2);

        if (size.func_150860_b() && size.field_150864_e == 0)
        {
            size.func_150859_c();
            return true;
        }
        else if (size1.func_150860_b() && size1.field_150864_e == 0)
        {
            size1.func_150859_c();
            return true;
        }
        else
        {
            return false;
        }
    }

 

 

I just coped-pasted the method from blockportal... and I don't need to override the onEntityCollidedWithBlock because it only does player.setInPortal()...

 

Anyway, here's my Size class (from the portal block). Again, I copy-pasted it and replaced obsidian with my block and the fire as well...

 

 

public static class Size
    {
        private final World field_150867_a;
        private final int field_150865_b;
        private final int field_150866_c;
        private final int field_150863_d;
        private int field_150864_e = 0;
        private ChunkCoordinates field_150861_f;
        private int field_150862_g;
        private int field_150868_h;
        private static final String __OBFID = "CL_00000285";

        public Size(World p_i45415_1_, int p_i45415_2_, int p_i45415_3_, 
        		int p_i45415_4_, int p_i45415_5_)
        {
            this.field_150867_a = p_i45415_1_;
            this.field_150865_b = p_i45415_5_;
            this.field_150863_d = BlockPortal.field_150001_a[p_i45415_5_][0];
            this.field_150866_c = BlockPortal.field_150001_a[p_i45415_5_][1];

            for (int i1 = p_i45415_3_; p_i45415_3_ > i1 - 21 && p_i45415_3_
            		> 0 && this.func_150857_a(p_i45415_1_.getBlock(
            				p_i45415_2_, p_i45415_3_ - 1, p_i45415_4_)); --p_i45415_3_)
            {
                ;
            }

            int j1 = this.func_150853_a(p_i45415_2_, p_i45415_3_,
            		p_i45415_4_, this.field_150863_d) - 1;

            if (j1 >= 0)
            {
                this.field_150861_f = new ChunkCoordinates(p_i45415_2_ +
                		j1 * Direction.offsetX[this.field_150863_d], p_i45415_3_,
                		p_i45415_4_ + j1 * Direction.offsetZ[this.field_150863_d]);
                this.field_150868_h = this.func_150853_a(this.field_150861_f.posX,
                		this.field_150861_f.posY, this.field_150861_f.posZ,
                		this.field_150866_c);

                if (this.field_150868_h < 2 || this.field_150868_h > 21)
                {
                    this.field_150861_f = null;
                    this.field_150868_h = 0;
                }
            }

            if (this.field_150861_f != null)
            {
                this.field_150862_g = this.func_150858_a();
            }
        }

        protected int func_150853_a(int p_150853_1_, int p_150853_2_, int p_150853_3_,
        		int p_150853_4_)
        {
            int j1 = Direction.offsetX[p_150853_4_];
            int k1 = Direction.offsetZ[p_150853_4_];
            int i1;
            Block block;

            for (i1 = 0; i1 < 22; ++i1)
            {
                block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1,
                		p_150853_2_, p_150853_3_ + k1 * i1);

                if (!this.func_150857_a(block))
                {
                    break;
                }

                Block block1 = this.field_150867_a.getBlock(p_150853_1_ + j1 *
                		i1, p_150853_2_ - 1, p_150853_3_ + k1 * i1);

                if (block1 != TheDogDim.cuteBlock)
                {
                    break;
                }
            }

            block = this.field_150867_a.getBlock(p_150853_1_ + j1 * i1, p_150853_2_,
            		p_150853_3_ + k1 * i1);
            return block == TheDogDim.cuteBlock ? i1 : 0;
        }

        protected int func_150858_a()
        {
            int i;
            int j;
            int k;
            int l;
            label56:

            for (this.field_150862_g = 0; this.field_150862_g < 21;
            		++this.field_150862_g)
            {
                i = this.field_150861_f.posY + this.field_150862_g;

                for (j = 0; j < this.field_150868_h; ++j)
                {
                    k = this.field_150861_f.posX + j * Direction.offsetX[blockPortal
                               .field_150001_a[this.field_150865_b][1]];
                    l = this.field_150861_f.posZ + j * Direction.offsetZ[blockPortal
                               .field_150001_a[this.field_150865_b][1]];
                    Block block = this.field_150867_a.getBlock(k, i, l);

                    if (!this.func_150857_a(block))
                    {
                        break label56;
                    }

                    if (block == TheDogDim.cutePortal)
                    {
                        ++this.field_150864_e;
                    }

                    if (j == 0)
                    {
                        block = this.field_150867_a.getBlock(k + Direction
                        		.offsetX[blockPortal.field_150001_a[this.field_150865_b]
                        		[0]], i, l + Direction.offsetZ[blockPortal
                        		.field_150001_a[this.field_150865_b][0]]);

                        if (block != TheDogDim.cuteBlock)
                        {
                            break label56;
                        }
                    }
                    else if (j == this.field_150868_h - 1)
                    {
                        block = this.field_150867_a.getBlock(k + Direction
                        		.offsetX[blockPortal.field_150001_a[this.field_150865_b]
                        		[1]], i, l + Direction.offsetZ[blockPortal
                        		.field_150001_a[this.field_150865_b][1]]);

                        if (block != TheDogDim.cuteBlock)
                        {
                            break label56;
                        }
                    }
                }
            }
            
            for (i = 0; i < this.field_150868_h; ++i)
            {
                j = this.field_150861_f.posX + i * Direction.offsetX
                		[blockPortal.field_150001_a[this.field_150865_b][1]];
                k = this.field_150861_f.posY + this.field_150862_g;
                l = this.field_150861_f.posZ + i * Direction.offsetZ
                		[blockPortal.field_150001_a[this.field_150865_b][1]];

                if (this.field_150867_a.getBlock(j, k, l) != TheDogDim.cuteBlock)
                {
                    this.field_150862_g = 0;
                    break;
                }
            }

            if (this.field_150862_g <= 21 && this.field_150862_g >= 3)
            {
                return this.field_150862_g;
            }
            else
            {
                this.field_150861_f = null;
                this.field_150868_h = 0;
                this.field_150862_g = 0;
                return 0;
            }
        }

        protected boolean func_150857_a(Block p_150857_1_)
        {
            return p_150857_1_.getMaterial() == Material.air || p_150857_1_ ==
            		TheDogDim.cuteFire || p_150857_1_ == TheDogDim.cutePortal;
        }

        public boolean func_150860_b()
        {
            return this.field_150861_f != null && this.field_150868_h >= 2
            		&& this.field_150868_h <= 21 && this.field_150862_g >= 3
            		&& this.field_150862_g <= 21;
        }

        public void func_150859_c()
        {
            for (int i = 0; i < this.field_150868_h; ++i)
            {
                int j = this.field_150861_f.posX + Direction.offsetX
                		[this.field_150866_c] * i;
                int k = this.field_150861_f.posZ + Direction.offsetZ
                		[this.field_150866_c] * i;

                for (int l = 0; l < this.field_150862_g; ++l)
                {
                    int i1 = this.field_150861_f.posY + l;
                    this.field_150867_a.setBlock(j, i1, k, TheDogDim.cutePortal,
                    		this.field_150865_b, 2);
                }
            }
        }
    }

 

 

And the log output is:

 

[WOG] [info] Cute Block lit up
[WOG] [info] Cute Portal opened

 

 

Also, I have a custom teleporter but I'm not very sure where to put it...

Please help!

 

Thanks in advance,

Mateiaru

Posted

One thing that jumps out at me is that I see "BlockPortal" several times.  Are you sure you changed all the needed references?

 

I'm not sure about the player logic for portals not being specific.  I thought I remembered it looking for the standard blocks, but it has been awhile.

 

At the time, it frustrated me a bunch, so I ended up writing completely custom portal logic.  I recently rewrote it for large portals.  If you don't give this solved, PM me and i'll help you out with a bit of it.

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.