YOU CANT CHANGE THE TEXTURE OF THE DOOR YET! I DONT KNOW HOW! IF I KNOW IT I WILL UPDATE THE
POST!
NON MODLOADER
Hello guys!
Iam making this tutorial becaus i want you guys to get a look on how to make your own door!
First of all Create a new File named BlockSomethingDoor.java and ItemSomethingDoor.java
When done with that you should add these lines into BlockSomethingDoor.java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// Block, Material, IBlockAccess, World,
// Item, AxisAlignedBB, EntityPlayer, Vec3D,
// MovingObjectPosition
public class BlockSomethingDoor extends Block
{
protected BlockSomethingDoor(int i, Material material)
{
super(i, material);
blockIndexInTexture = 97;
if(material == Material.wood)
{
blockIndexInTexture++;
}
float f = 0.5F;
float f1 = 1.0F;
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
public int getBlockTextureFromSideAndMetadata(int i, int j)
{
if(i == 0 || i == 1)
{
return blockIndexInTexture;
}
int k = getState(j);
if((k == 0 || k == 2) ^ (i <= 3))
{
return blockIndexInTexture;
}
int l = k / 2 + (i & 1 ^ k);
l += (j & 4) / 4;
int i1 = blockIndexInTexture - (j & 8) * 2;
if((l & 1) != 0)
{
i1 = -i1;
}
return i1;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean renderAsNormalBlock()
{
return false;
}
public int getRenderType()
{
return 7;
}
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
{
setBlockBoundsBasedOnState(world, i, j, k);
return super.getSelectedBoundingBoxFromPool(world, i, j, k);
}
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
{
setBlockBoundsBasedOnState(world, i, j, k);
return super.getCollisionBoundingBoxFromPool(world, i, j, k);
}
public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
{
setDoorRotation(getState(iblockaccess.getBlockMetadata(i, j, k)));
}
public void setDoorRotation(int i)
{
float f = 0.1875F;
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
if(i == 0)
{
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
}
if(i == 1)
{
setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
if(i == 2)
{
setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
if(i == 3)
{
setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
}
}
public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
{
blockActivated(world, i, j, k, entityplayer);
}
public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
{
if(blockMaterial == Material.iron)
{
return true;
}
int l = world.getBlockMetadata(i, j, k);
if((l & 8) != 0)
{
if(world.getBlockId(i, j - 1, k) == blockID)
{
blockActivated(world, i, j - 1, k, entityplayer);
}
return true;
}
if(world.getBlockId(i, j + 1, k) == blockID)
{
world.setBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8);
}
world.setBlockMetadataWithNotify(i, j, k, l ^ 4);
world.markBlocksDirty(i, j - 1, k, i, j, k);
world.func_28107_a(entityplayer, 1003, i, j, k, 0);
return true;
}
public void openDoor(World world, int i, int j, int k, boolean flag)
{
int l = world.getBlockMetadata(i, j, k);
if((l & 8) != 0)
{
if(world.getBlockId(i, j - 1, k) == blockID)
{
openDoor(world, i, j - 1, k, flag);
}
return;
}
boolean flag1 = (world.getBlockMetadata(i, j, k) & 4) > 0;
if(flag1 == flag)
{
return;
}
if(world.getBlockId(i, j + 1, k) == blockID)
{
world.setBlockMetadataWithNotify(i, j + 1, k, (l ^ 4) + 8);
}
world.setBlockMetadataWithNotify(i, j, k, l ^ 4);
world.markBlocksDirty(i, j - 1, k, i, j, k);
world.func_28107_a(null, 1003, i, j, k, 0);
}
public void onNeighborBlockChange(World world, int i, int j, int k, int l)
{
int i1 = world.getBlockMetadata(i, j, k);
if((i1 & 8) != 0)
{
if(world.getBlockId(i, j - 1, k) != blockID)
{
world.setBlockWithNotify(i, j, k, 0);
}
if(l > 0 && Block.blocksList[l].canProvidePower())
{
onNeighborBlockChange(world, i, j - 1, k, l);
}
} else
{
boolean flag = false;
if(world.getBlockId(i, j + 1, k) != blockID)
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
}
if(!world.func_28100_h(i, j - 1, k))
{
world.setBlockWithNotify(i, j, k, 0);
flag = true;
if(world.getBlockId(i, j + 1, k) == blockID)
{
world.setBlockWithNotify(i, j + 1, k, 0);
}
}
if(flag)
{
if(!world.multiplayerWorld)
{
dropBlockAsItem(world, i, j, k, i1);
}
} else
if(l > 0 && Block.blocksList[l].canProvidePower())
{
boolean flag1 = world.isBlockIndirectlyGettingPowered(i, j, k) || world.isBlockIndirectlyGettingPowered(i, j + 1, k);
openDoor(world, i, j, k, flag1);
}
}
}
public int idDropped(int i, Random random)
{
if((i & 8) != 0)
{
return 0;
}
if(blockMaterial == Material.iron)
{
return Item.doorSteel.shiftedIndex;
} else
{
return Item.doorWood.shiftedIndex;
}
}
public MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1)
{
setBlockBoundsBasedOnState(world, i, j, k);
return super.collisionRayTrace(world, i, j, k, vec3d, vec3d1);
}
public int getState(int i)
{
if((i & 4) == 0)
{
return i - 1 & 3;
} else
{
return i & 3;
}
}
public boolean canPlaceBlockAt(World world, int i, int j, int k)
{
if(j >= 127)
{
return false;
} else
{
return world.func_28100_h(i, j - 1, k) && super.canPlaceBlockAt(world, i, j, k) && super.canPlaceBlockAt(world, i, j + 1, k);
}
}
public static boolean isOpen(int i)
{
return (i & 4) != 0;
}
}
Change the Something to your Block*Door if you get what i mean!
Then into ItemSomethingDoor.java, add these lines.
Why using no modloader? if you use that adding texture is easy, and no incompatibility with other mods. (apart from the possibility of item/block numbers conflicting
Looks like you just copied the Door class files and added "Something between every "BlockDoor" or "ItemDoor" You should explain what it does. And if it doesnt change textures, there really isn't any point...
POST!
NON MODLOADER
Hello guys!
Iam making this tutorial becaus i want you guys to get a look on how to make your own door!
First of all Create a new File named BlockSomethingDoor.java and ItemSomethingDoor.java
When done with that you should add these lines into BlockSomethingDoor.java
Change the Something to your Block*Door if you get what i mean!
Then into ItemSomethingDoor.java, add these lines.
And change the Something to whatever your Item*Door.java is!
Then go into Item.java and add this line at linenumber 287:
then add this line at linenumber 362:
If you want a easy crafting recipe, go inte CraftingManager.java and add this and line 203:
Remember to change where it says Something to that you want!
Please support! By click my image in my signature!
hahah no lol
You could of just looked it up @_@
ok sry for that this is my first tutorial so dont be "angry" or something!
sry i forgot!
He's not angry. Hes giving "Constructive Criticism".