Jump to content

Adding a New Door


intermediateuser

Recommended Posts

What's the basic structure for this?  I was going to just copy BlockDoor and ItemDoor and work with that, but in the process of doing so I came across EnumHelper.addDoor().  This leads me to think Forge has an easy way to add doors, but aside from this one clue I don't see how.

 

Should I just go with my original method, or should I utilize whatever method Forge has intended for this—and if the latter, how?

Link to comment
Share on other sites

  • 4 months later...

This is all AFAIK.

 

BlockDoor creates a door by looking at the material you pass into it. It creates either an iron or wood door in vanilla by combining some strings to create the top and bottom texture name (and then flipping them for the opposite side).

 

Even if I pass wood as my material (which I think should just result in a wood door), my door still does appear untextured in the game world. It can be placed, but you can only see a frame if you move your mouse over it.

 

The only difference between how I call my BlockCustomDoor class and how it vanilla does it is I cannot get "disableStats()" to work. I thought "Block.disableStats()" would work, but that is not the case. I really don't understand what "disableStats()" and if that is my problem.

Link to comment
Share on other sites

I really don't understand what "disableStats()" and if that is my problem.

 

You haven't looked at the stats feature in Minecraft have you?  It tracks the number of blocks of given types mined, broken, placed, and so on.

disableStats() just turns stats off for that block.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

If it's untextured I would look at the getIcon and registerIcon methods :P

Remember that you are free to create your own Icon variables and register a top an bottom doir texture, then by metadata decide which to return in the geticon.

 

I suggest you look at how the door blocks metadata is used ;)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

If it's untextured I would look at the getIcon and registerIcon methods :P

Remember that you are free to create your own Icon variables and register a top an bottom doir texture, then by metadata decide which to return in the geticon.

 

I suggest you look at how the door blocks metadata is used ;)

 

To be clear, it has no texture; not even the missing texture.

 

I have looked at the getIcon and registerIcon method. As I said above, BlockDoor registers the block's texture by combining the door's material as well as "_lower" and "_upper"; even if I use the materials the in vanilla - wood and iron - I have the same problem. Here is how I call (invoke?) my custom class.

 

	stoneDoor = new BlockCustomDoor(1016, Material.wood).setUnlocalizedName("door_wood").setTextureName("door_wood").setCreativeTab(CreativeTabs.tabBlock);

 

And this is my BlockCustomDoor class

 

package whalecraft;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;

public class BlockCustomDoor extends BlockDoor {

protected BlockCustomDoor(int par1, Material par2Material) {
	super(par1, par2Material);
	// TODO Auto-generated constructor stub
}



}

Link to comment
Share on other sites

Hi

 

Have you tried putting a breakpoint in the rendering code to see what is happening?

 

BlockDoor uses a special renderer (renderType = 7) and since you're deriving from BlockDoor, it will probably be calling the same renderer.  Under some conditions the door doesn't render at all (if the adjacent block doesn't have the same ID).  To be honest I don't understand exactly what it's doing there, but it might be causing your problem.

 

RenderBlocks.renderBlockDoor():
    public boolean renderBlockDoor(Block par1Block, int par2, int par3, int par4)
    {
        Tessellator tessellator = Tessellator.instance;   // add breakpoint here
        int l = this.blockAccess.getBlockMetadata(par2, par3, par4);

        if ((l &  != 0)
        {
            if (this.blockAccess.getBlockId(par2, par3 - 1, par4) != par1Block.blockID)
            {
                return false;
            }
        }
        else if (this.blockAccess.getBlockId(par2, par3 + 1, par4) != par1Block.blockID)
        {
            return false;
        }

 

-TGG

Link to comment
Share on other sites

I think you may be on to something, TheGreyGhost.

 

I actually noticed that the wireframe which shows the door actually only shows the bottom block of the door. Perhaps the top door block is not being created and, because of the render type, it doesn't render the bottom block (as it isn't next to another block with the same ID) and the top block just doesn't exist at all.

 

BQt9zPw.png

 

I'm not sure why the top block isn't being created (if that is the problem), but I feel like I am getting closer...

 

EDIT: Figured this out. Will post a tutorial on doors tomorrow as I, obviously, couldn't find one myself. Save some people some trouble.

Link to comment
Share on other sites

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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