Texture Porte



  • Bonjour je cree un porte tous marche comme il faut mais sa me mes pas les texture ni du bloc ni de l item est je veut que sa souvre que a la redstone mais sa souvre a la main

    Classe Principal

    package fr.impuuu.havenrp.common;
    
    import java.io.InputStream;
    import java.nio.ByteBuffer;
    
    import org.lwjgl.opengl.Display;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockFlower;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiMainMenu;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.init.Blocks;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemArmor.ArmorMaterial;
    import net.minecraft.item.ItemFood;
    import net.minecraft.item.ItemPickaxe;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.EnumChatFormatting;
    import net.minecraft.util.ResourceLocation;
    import net.minecraftforge.common.util.EnumHelper;
    import cpw.mods.fml.client.FMLClientHandler;
    import cpw.mods.fml.common.FMLCommonHandler;
    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.Mod.Instance;
    import cpw.mods.fml.common.SidedProxy;
    import cpw.mods.fml.common.event.FMLInitializationEvent;
    import cpw.mods.fml.common.event.FMLPostInitializationEvent;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.eventhandler.SubscribeEvent;
    import cpw.mods.fml.common.gameevent.TickEvent;
    import cpw.mods.fml.common.registry.GameRegistry;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import fr.impuuu.havenrp.armor.Maire_Armor;
    import fr.impuuu.havenrp.block.*;
    import fr.impuuu.havenrp.item.AncienLogo;
    import fr.impuuu.havenrp.item.Cannabis;
    import fr.impuuu.havenrp.item.Item10;
    import fr.impuuu.havenrp.item.Item100;
    import fr.impuuu.havenrp.item.Item20;
    import fr.impuuu.havenrp.item.Item200;
    import fr.impuuu.havenrp.item.Item5;
    import fr.impuuu.havenrp.item.Item50;
    import fr.impuuu.havenrp.item.Item500;
    import fr.impuuu.havenrp.item.ItemPorte;
    import fr.impuuu.havenrp.item.Logo;
    import fr.impuuu.havenrp.item.Marijuana;
    import fr.impuuu.havenrp.item.Meth;
    import fr.impuuu.havenrp.item.Poudre_Meth;
    import fr.impuuu.havenrp.item.carte_credit;
    import fr.impuuu.havenrp.item.ingot_Meth;
    import fr.impuuu.havenrp.item.itemCokaine;
    import fr.impuuu.havenrp.item.itemCokaine1;
    import fr.impuuu.havenrp.item.itemCokaine2;
    import fr.impuuu.havenrp.item.itemCokaine3;
    import fr.impuuu.havenrp.item.itemCokaine4;
    import fr.impuuu.havenrp.item.itemDiamant;
    import fr.impuuu.havenrp.item.itemFer;
    import fr.impuuu.havenrp.item.itemPepiteDiamant;
    import fr.impuuu.havenrp.proxy.CommonProxy;
    
    @Mod(modid = "havenrp", name = "HavenRP", version ="2.0")
    public class HavenRP
    {
        private static final ResourceLocation icon = new ResourceLocation("havenrp", "textures/icon/icon.png");
        public static final String MODID = "havenrp";
        @Instance(MODID)
        public static HavenRP instance;
        public static final Block.SoundType soundTypeGrass = new Block.SoundType("grass", 1.0F, 1.0F);
        public static final Block.SoundType soundTypeStone = new Block.SoundType("stone", 1.0F, 1.0F);
    
        @SidedProxy(clientSide = "fr.impuuu.havenrp.proxy.ClientProxy", serverSide = "fr.impuuu.havenrp.proxy.CommonProxy")
        public static CommonProxy proxy;
    
        public static Item item5;
        public static Item item10;
        public static Item item20;
        public static Item item50;
        public static Item item100;
        public static Item item200;
        public static Item item500;
        public static Item itemFer;
        public static Item itemPomme;
        public static Item itemDiamant;
        public static Item itemPepiteDiamant;
        public static Item itemCokaine;
        public static Item itemCokaine1;
        public static Item itemCokaine2;
        public static Item itemCokaine3;
        public static Item itemCokaine4;
        public static Item itemCoco;
        public static Item itemPioche; 
        public static Item ancienLogo;
        public static Item Poudre_Meth;
        public static Item Meth;
        public static Item ingot_Meth;
        public static Item Logo;
        public static Item Cannabis;
        public static Item Marijuana;
        public static Item carte_credit;
        public static Item Maire_Plastron;
        public static Item ItemPorte;
    
       /*Block*/
        public static Block BlockPomme, white_clay_stairs, orange_clay_stairs, magenta_clay_stairs, light_blue_clay_stairs, yellow_clay_stairs, lime_clay_stairs
        , pink_clay_stairs, gray_clay_stairs, light_gray_clay_stairs
        , cyan_clay_stairs, purple_clay_stairs, blue_clay_stairs,
        brown_clay_stairs, green_clay_stairs, red_clay_stairs,
        black_clay_stairs;
        public static Block Plante_cannabis;
        public static Block Plante_mari;
        public static Block Plante_Cokaine;
        public static Block Block_Coco;
        public static Block Minerais_Diamant;
        public static Block cyan_clay_glow;
        public static Block blue_clay_glow;
        public static Block light_blue_clay_glow;
        public static Block MineraisMeth;
        public static Block porte;
    
        public static final Item.ToolMaterial pioche = EnumHelper.addToolMaterial("pioche", 2, 1000, 6.0F, 0.0F, 14);
        public static ArmorMaterial Maire_P = EnumHelper.addArmorMaterial("Maire_Plastron", 1, new int[]{1, 3, 2, 1}, 0);
    
        @EventHandler
        public void preInit(FMLPreInitializationEvent event)
        {
    
            item5 = new Item5().setUnlocalizedName("5").setTextureName(MODID+":billet_5").setCreativeTab(tabHavenRP);
            item10 = new Item10().setUnlocalizedName("10").setTextureName(MODID+":billet_10").setCreativeTab(tabHavenRP);
            item20 = new Item20().setUnlocalizedName("20").setTextureName(MODID+":billet_20").setCreativeTab(tabHavenRP);
            item50 = new Item50().setUnlocalizedName("50").setTextureName(MODID+":billet_50").setCreativeTab(tabHavenRP);
            item100 = new Item100().setUnlocalizedName("100").setTextureName(MODID+":billet_100").setCreativeTab(tabHavenRP);
            item200 = new Item200().setUnlocalizedName("200").setTextureName(MODID+":billet_200").setCreativeTab(tabHavenRP);
            item500 = new Item500().setUnlocalizedName("500").setTextureName(MODID+":billet_500").setCreativeTab(tabHavenRP);
            itemFer = new itemFer().setUnlocalizedName("Fer").setTextureName(MODID+":Fer_ingot").setMaxStackSize(8).setCreativeTab(tabHavenRP);
            itemPomme = new ItemFood(4, 0.3F, false).setUnlocalizedName("Pomme").setTextureName(MODID+":Pomme_item").setMaxStackSize(16).setCreativeTab(tabHavenRP);
            itemDiamant = new itemDiamant().setUnlocalizedName("Diamant").setTextureName(MODID+":Diamant").setMaxStackSize(2).setCreativeTab(tabHavenRP);
            itemPepiteDiamant = new itemPepiteDiamant().setUnlocalizedName("Pepite_Diamant").setTextureName(MODID+":Pepite_Diamant").setMaxStackSize(4).setCreativeTab(tabHavenRP);
            itemCokaine = new itemCokaine().setUnlocalizedName("Cokaine_0").setTextureName(MODID+":coka0").setMaxStackSize(10).setCreativeTab(tabHavenRP);
            itemCokaine1 = new itemCokaine1().setUnlocalizedName("Cokaine_1").setTextureName(MODID+":coka1").setMaxStackSize(8).setCreativeTab(tabHavenRP);
            itemCokaine2 = new itemCokaine2().setUnlocalizedName("Cokaine_2").setTextureName(MODID+":coka2").setMaxStackSize(6).setCreativeTab(tabHavenRP);
            itemCokaine3 = new itemCokaine3().setUnlocalizedName("Cokaine_3").setTextureName(MODID+":coka3").setMaxStackSize(4).setCreativeTab(tabHavenRP);
            itemCokaine4 = new itemCokaine4().setUnlocalizedName("Cokaine_4").setTextureName(MODID+":coka4").setMaxStackSize(2).setCreativeTab(tabHavenRP);
            itemCoco = new ItemFood(3, 0.2F, false).setUnlocalizedName("Coco").setTextureName(MODID+":coco").setMaxStackSize(16).setCreativeTab(tabHavenRP);
            itemPioche = new ItemPioche(pioche).setUnlocalizedName("Pioche").setTextureName(MODID+":Pioche").setMaxStackSize(1).setCreativeTab(tabHavenRP);
            ancienLogo = new AncienLogo().setUnlocalizedName("Ancien_Logo").setTextureName(MODID+":Ancien_Logo").setMaxStackSize(1).setCreativeTab(tabHavenRP);
            Poudre_Meth = new Poudre_Meth().setUnlocalizedName("Poudre_Meth").setTextureName(MODID+":Poudre_Meth").setMaxStackSize(4).setCreativeTab(tabHavenRP);
            Meth = new Meth().setUnlocalizedName("Meth").setTextureName(MODID+":Meth").setMaxStackSize(2).setCreativeTab(tabHavenRP);
            ingot_Meth = new ingot_Meth().setUnlocalizedName("ingot_Meth").setTextureName(MODID+":ingot_Meth").setMaxStackSize(1).setCreativeTab(tabHavenRP);
            Logo = new Logo().setUnlocalizedName("Logo").setTextureName(MODID+":Logo").setMaxStackSize(1);
            Cannabis = new Cannabis().setUnlocalizedName("Cannabis").setTextureName(MODID+":Cannabis").setMaxStackSize(8).setCreativeTab(tabHavenRP);
            Marijuana = new Marijuana().setUnlocalizedName("Marijuana").setTextureName(MODID+":Marijuana").setMaxStackSize(8).setCreativeTab(tabHavenRP);
            carte_credit = new carte_credit().setUnlocalizedName("Carte_Credit").setTextureName(MODID+":carte_credit").setMaxStackSize(1).setCreativeTab(tabHavenRP);
            Maire_Plastron = new Maire_Armor(Maire_P, 1).setUnlocalizedName("Maire_Plastron").setTextureName(MODID+":Maire_Plastron").setMaxStackSize(1).setCreativeTab(tabHavenRP);
            ItemPorte = new ItemPorte().setUnlocalizedName("item_door").setTextureName("item_door");
    
            BlockPomme = new BlockPomme(Material.leaves).setBlockName("Blockdepomme").setBlockTextureName(MODID+":PommeBlock").setCreativeTab(tabHavenRP).setHardness(0.5F);
            Plante_cannabis = new Plante(Material.plants).setBlockName("Plante_Cannabis").setBlockTextureName(MODID+":Plante_Cannabis").setStepSound(soundTypeGrass).setCreativeTab(tabHavenRP).setHardness(0.4F);
            Plante_Cokaine = new Plante(Material.plants).setBlockName("Plante_Cokaine").setBlockTextureName(MODID+":Plante_Cokaine").setStepSound(soundTypeGrass).setCreativeTab(tabHavenRP).setHardness(0.5F);
            Plante_mari = new Plante(Material.plants).setBlockName("Plante_mari").setBlockTextureName(MODID+":Plante_Mari").setStepSound(soundTypeGrass).setCreativeTab(tabHavenRP).setHardness(0.3F);
            Block_Coco = new CocoBlock(Material.leaves).setBlockName("Coco_Block").setBlockTextureName(MODID+":Coco");
            Minerais_Diamant = new MineraisDiamant(Material.rock).setBlockName("Minerais_Diamant").setBlockTextureName(MODID+":Minerais_Diamant").setCreativeTab(tabHavenRP).setHardness(4.0F).setResistance(6.0F).setStepSound(soundTypeStone);
            cyan_clay_glow = new Clay_glow(Material.clay).setBlockName("Cyan_Clay_Glow").setBlockTextureName(MODID+":cyan_clay_glow").setCreativeTab(tabHavenRP).setBlockUnbreakable().setLightLevel(1.0F);
            blue_clay_glow = new Clay_glow(Material.clay).setBlockName("Blue_Clay_Glow").setBlockTextureName(MODID+":blue_clay_glow").setCreativeTab(tabHavenRP).setBlockUnbreakable().setLightLevel(1.0F);
            light_blue_clay_glow = new Clay_glow(Material.clay).setBlockName("Light_Blue_Clay_Glow").setBlockTextureName(MODID+":light_blue_clay_glow").setCreativeTab(tabHavenRP).setBlockUnbreakable().setLightLevel(1.0F);
            MineraisMeth = new MineraisMeth(Material.rock).setBlockName("Minerais_Meth").setBlockTextureName(MODID+":Minerais_Meth").setCreativeTab(tabHavenRP).setHardness(25.5F);
            porte = new porte().setBlockName("door").setBlockTextureName("door_porte");
    
            white_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 0).setBlockName("white_clay_stairs").setCreativeTab(tabHavenRP);
            orange_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 1).setBlockName("orange_clay_stairs").setCreativeTab(tabHavenRP);
            magenta_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 2).setBlockName("magenta_clay_stairs").setCreativeTab(tabHavenRP);
            light_blue_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 3).setBlockName("light_blue_clay_stairs").setCreativeTab(tabHavenRP);
            yellow_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 4).setBlockName("yellow_clay_stairs").setCreativeTab(tabHavenRP);
            lime_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 5).setBlockName("lime_clay_stairs").setCreativeTab(tabHavenRP);
            pink_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 6).setBlockName("pink_clay_stairs").setCreativeTab(tabHavenRP);
            gray_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 7).setBlockName("gray_clay_stairs").setCreativeTab(tabHavenRP);
            light_gray_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 8).setBlockName("light_gray_clay_stairs").setCreativeTab(tabHavenRP);
            cyan_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 9).setBlockName("cyan_clay_stairs").setCreativeTab(tabHavenRP);
            purple_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 10).setBlockName("purple_clay_stairs").setCreativeTab(tabHavenRP);
            blue_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 11).setBlockName("blue_clay_stairs").setCreativeTab(tabHavenRP);
            brown_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 12).setBlockName("brown_clay_stairs").setCreativeTab(tabHavenRP);
            green_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 13).setBlockName("green_clay_stairs").setCreativeTab(tabHavenRP);
            red_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 14).setBlockName("red_clay_stairs").setCreativeTab(tabHavenRP);
            black_clay_stairs = new ClayStairs(Blocks.stained_hardened_clay, 15).setBlockName("black_clay_stairs").setCreativeTab(tabHavenRP);
    
            GameRegistry.registerItem(item5, "5€");
            GameRegistry.registerItem(item10, "10€");
            GameRegistry.registerItem(item20, "20€");
            GameRegistry.registerItem(item50, "50€");
            GameRegistry.registerItem(item100, "100€");
            GameRegistry.registerItem(item200, "200€");
            GameRegistry.registerItem(item500, "500€");
            GameRegistry.registerItem(itemFer, "Fer");
            GameRegistry.registerItem(itemPomme, "Pomme");
            GameRegistry.registerItem(itemPepiteDiamant, "itemPepiteDiamant");
            GameRegistry.registerItem(itemDiamant, "itemDiamant");
            GameRegistry.registerItem(itemCokaine, "itemCokaine");
            GameRegistry.registerItem(itemCokaine1, "itemCokaine1");
            GameRegistry.registerItem(itemCokaine2, "itemCokaine2");
            GameRegistry.registerItem(itemCokaine3, "itemCokaine3");
            GameRegistry.registerItem(itemCokaine4, "itemCokaine4");
            GameRegistry.registerItem(itemCoco, "itemCoco");
            GameRegistry.registerItem(itemPioche, "itemPioche");
            GameRegistry.registerItem(ancienLogo, "ancienLogo");
            GameRegistry.registerItem(Poudre_Meth, "Poudre_Meth");
            GameRegistry.registerItem(Meth, "Meth");
            GameRegistry.registerItem(ingot_Meth, "ingot_Meth");
            GameRegistry.registerItem(Logo, "Logo");
            GameRegistry.registerItem(Marijuana, "Marijuana");
            GameRegistry.registerItem(Cannabis, "Cannabis");
            GameRegistry.registerItem(carte_credit, "carte_credit");
            GameRegistry.registerItem(Maire_Plastron, "gilet_explo");
            GameRegistry.registerItem(ItemPorte, "itemPorte");
    
            /*Clay*/
            GameRegistry.registerBlock(white_clay_stairs, "white_clay_stairs");
            GameRegistry.registerBlock(orange_clay_stairs, "orange_clay_stairs");
            GameRegistry.registerBlock(magenta_clay_stairs, "magenta_clay_stairs");
            GameRegistry.registerBlock(light_blue_clay_stairs, "light_blue_clay_stairs");
            GameRegistry.registerBlock(yellow_clay_stairs, "yellow_clay_stairs");
            GameRegistry.registerBlock(lime_clay_stairs, "lime_clay_stairs");
            GameRegistry.registerBlock(pink_clay_stairs, "pink_clay_stairs");
            GameRegistry.registerBlock(gray_clay_stairs, "gray_clay_stairs");
            GameRegistry.registerBlock(light_gray_clay_stairs, "light_gray_clay_stairs");
            GameRegistry.registerBlock(cyan_clay_stairs, "cyan_clay_stairs");
            GameRegistry.registerBlock(purple_clay_stairs, "purple_clay_stairs");
            GameRegistry.registerBlock(blue_clay_stairs, "blue_clay_stairs");
            GameRegistry.registerBlock(brown_clay_stairs, "brown_clay_stairs");
            GameRegistry.registerBlock(green_clay_stairs, "green_clay_stairs");
            GameRegistry.registerBlock(red_clay_stairs, "red_clay_stairs");
            GameRegistry.registerBlock(black_clay_stairs, "black_clay_stairs");
            GameRegistry.registerBlock(light_blue_clay_glow, "light_blue_clay_glow");
            GameRegistry.registerBlock(cyan_clay_glow, "cyan_clay_glow");
            GameRegistry.registerBlock(blue_clay_glow, "blue_clay_glow");
    
            /*Block*/
            GameRegistry.registerBlock(Plante_cannabis, "Plante_de_cannabis");
            GameRegistry.registerBlock(Plante_Cokaine, "Plante_de_Cokaine");
            GameRegistry.registerBlock(Plante_mari, "Plante_de_marijuana");
            GameRegistry.registerBlock(Block_Coco, "Block_de_coco");
            GameRegistry.registerBlock(Minerais_Diamant, "Minerais_Diamant");
            GameRegistry.registerBlock(BlockPomme, "Block_de_Pomme");
            GameRegistry.registerBlock(MineraisMeth, "Minerais_Meth");
            GameRegistry.registerBlock(porte, "porte");
    
        }
    
        @EventHandler
        public void init(FMLInitializationEvent event)
        {  
            FMLCommonHandler.instance().bus().register(this);
            proxy.registerRender();
            proxy.registerRenderThings();
        }
        @EventHandler
        public void postInit(FMLPostInitializationEvent event)
        { 
        }
        public static CreativeTabs tabHavenRP = new CreativeTabs("HavenRP"){
            @Override
            public Item getTabIconItem(){
                return new ItemStack(Logo).getItem();
            }
        };
    /*
        @SubscribeEvent
        @SideOnly(Side.CLIENT)
        public void onTick(TickEvent.ClientTickEvent event)
        {
            Minecraft mc = FMLClientHandler.instance().getClient();
            if(mc.currentScreen != null && mc.currentScreen.getClass().equals(GuiMainMenu.class))
            {
                mc.displayGuiScreen(new GuiCustomMainMenu());
            }
        }
        */
    }
    
    

    ItemPorte

    package fr.impuuu.havenrp.item;
    
    import fr.impuuu.havenrp.common.HavenRP;
    import net.minecraft.block.Block;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemDoor;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.World;
    
    public class ItemPorte extends Item
    
    {
    
        public ItemPorte()
    
        {
    
            this.maxStackSize = 1;
    
            this.setCreativeTab(CreativeTabs.tabBlock);
    
        }
    
        public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
    
        {
    
            if(side != 1)
    
            {
    
                return false;
    
            }
    
            else
    
            {
    
                ++y;
    
                Block block = HavenRP.porte;
    
                if(player.canPlayerEdit(x, y, z, side, itemStack) && player.canPlayerEdit(x, y + 1, z, side, itemStack))
    
                {
    
                    if(!block.canPlaceBlockAt(world, x, y, z))
    
                    {
    
                        return false;
    
                    }
    
                    else
    
                    {
    
                        int i1 = MathHelper.floor_double((double)((player.rotationYaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
    
                        placeDoorBlock(world, x, y, z, i1, block);
    
                        –itemStack.stackSize;
    
                        return true;
    
                    }
    
                }
    
                else
    
                {
    
                    return false;
    
                }
    
            }
    
        }
    
        public static void placeDoorBlock(World world, int x, int y, int z, int side, Block block)
    
        {
    
            byte b0 = 0;
    
            byte b1 = 0;
    
            if(side == 0)
    
            {
    
                b1 = 1;
    
            }
    
            if(side == 1)
    
            {
    
                b0 = -1;
    
            }
    
            if(side == 2)
    
            {
    
                b1 = -1;
    
            }
    
            if(side == 3)
    
            {
    
                b0 = 1;
    
            }
    
            int i1 = (world.getBlock(x - b0, y, z - b1).isNormalCube() ? 1 : 0) + (world.getBlock(x - b0, y + 1, z - b1).isNormalCube() ? 1 : 0);
    
            int j1 = (world.getBlock(x + b0, y, z + b1).isNormalCube() ? 1 : 0) + (world.getBlock(x + b0, y + 1, z + b1).isNormalCube() ? 1 : 0);
    
            boolean flag = world.getBlock(x - b0, y, z - b1) == block || world.getBlock(x - b0, y + 1, z - b1) == block;
    
            boolean flag1 = world.getBlock(x + b0, y, z + b1) == block || world.getBlock(x + b0, y + 1, z + b1) == block;
    
            boolean flag2 = false;
    
            if(flag && !flag1)
    
            {
    
                flag2 = true;
    
            }
    
            else if(j1 > i1)
    
            {
    
                flag2 = true;
    
            }
    
            world.setBlock(x, y, z, block, side, 2);
    
            world.setBlock(x, y + 1, z, block, 8 | (flag2 ? 1 : 0), 2);
    
            world.notifyBlocksOfNeighborChange(x, y, z, block);
    
            world.notifyBlocksOfNeighborChange(x, y + 1, z, block);
    
        }
    
    }
    
    

    BlockPorte

    package fr.impuuu.havenrp.block;
    
    import java.util.Random;
    
    import javax.swing.Icon;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockDoor;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.IconFlipped;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.ChunkCoordinates;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import fr.impuuu.havenrp.common.HavenRP;
    
    public class porte
    extends BlockDoor
    
    {
    
        public porte()
    
        {
    
            super(Material.iron);
    
            this.setHardness(3.0F);
    
            this.setResistance(5.0F);
    
            this.disableStats();
    
        }
    
        @Override
    
        public Item getItemDropped(int par1, Random rand, int par3)
    
        {   
    
            return HavenRP.ItemPorte;
    
        }
    
        @Override
    
        @SideOnly(Side.CLIENT)
    
        public Item getItem(World world, int x, int y, int z)
    
        {
    
            return HavenRP.ItemPorte;
    
        }
    
        @Override
    
        public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
    
        {
    
            int i1 = this.func_150012_g(world, x, y, z);
    
            int j1 = i1 & 7;
    
            j1 ^= 4;
    
            //ouvre la porte
    
            if ((i1 & 8) == 0)
    
            {
    
                world.setBlockMetadataWithNotify(x, y, z, j1, 2);
    
                world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
    
            }
    
            else
    
            {
    
                world.setBlockMetadataWithNotify(x, y - 1, z, j1, 2);
    
                world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z);
    
            }
    
            //jouer le son
    
            world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);
    
            return true;
    
        }
    
    }
    
    

  • Administrateurs

    Salut,
    Lorsque tu lances ton jeu, a-t-il des erreurs "missing textures" dans les logs ? Si oui, tu peux envoyer un copier/coller des logs ?



  • C'est normal, à chaque fois tu as oublié le modid devant le nom de texture.

    Pour activer seulement à la redstone il faut enlever la fonction onBlockActivated et copie (de façon intelligente car la porte de minecraft utilise des metadatas un peu spéciaux) le code de la porte de minecraft.

    PS : pense à la convention java -> porte devrait être BlockDoor


  • Administrateurs

    @'SCAREX':

    C'est normal, à chaque fois tu as oublié le modid devant le nom de texture.

    J'avais même pas vu x)



  • oui mais sa me mes pas un porte en fer puisque on peut l ouvrir a la main je veut que elle soit activer par la redstone



  • @'SCAREX':

    Pour activer seulement à la redstone il faut enlever la fonction onBlockActivated et copie (de façon intelligente car la porte de minecraft utilise des metadatas un peu spéciaux) le code de la porte de minecraft.



  • oui mais sur serveur la porte souvre pas a la redstone



  • Montre ton code au lieu de dire sa marche pas devinez le problème vous même.

    Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk



  • 
    1.  **package** fr.impuuu.havenrp.block;
    2.  **import** java.util.Random;
    3.  **import** javax.swing.Icon;
    4.  **import** net.minecraft.block.Block;
    5.  **import** net.minecraft.block.BlockDoor;
    6.  **import** net.minecraft.block.material.Material;
    7.  **import** net.minecraft.client.renderer.IconFlipped;
    8.  **import** net.minecraft.client.renderer.texture.IIconRegister;
    9.  **import** net.minecraft.entity.player.EntityPlayer;
    10.  **import** net.minecraft.init.Blocks;
    11.  **import** net.minecraft.init.Items;
    12.  **import** net.minecraft.item.Item;
    13.  **import** net.minecraft.util.AxisAlignedBB;
    14.  **import** net.minecraft.util.ChunkCoordinates;
    15.  **import** net.minecraft.util.IIcon;
    16.  **import** net.minecraft.util.MovingObjectPosition;
    17.  **import** net.minecraft.util.Vec3;
    18.  **import** net.minecraft.world.IBlockAccess;
    19.  **import** net.minecraft.world.World;
    20.  **import** cpw.mods.fml.relauncher.Side;
    21.  **import** cpw.mods.fml.relauncher.SideOnly;
    22.  **import** fr.impuuu.havenrp.common.HavenRP;
    23.  **public** **class** porte
    24.  **extends** BlockDoor
    25.  {
    26.      **public** porte()
    27.      {
    28.          **super**(Material.iron);
    29.          **this**.setHardness(3.0F);
    30.          **this**.setResistance(5.0F);
    31.          **this**.disableStats();
    32.      }
    33.      @Override
    34.      **public** Item getItemDropped(**int** par1, Random rand, **int** par3)
    35.      {   
    36.          **return** HavenRP.ItemPorte;
    37.      }
    38.      @Override
    39.      @SideOnly(Side.CLIENT)
    40.      **public** Item getItem(World world, **int** x, **int** y, **int** z)
    41.      {
    42.          **return** HavenRP.ItemPorte;
    43.      }
    44.  }
    
    

  • Administrateurs

    package fr.impuuu.havenrp.block;
    
    import java.util.Random;
    import javax.swing.Icon;
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockDoor;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.IconFlipped;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.ChunkCoordinates;
    import net.minecraft.util.IIcon;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import fr.impuuu.havenrp.common.HavenRP;
    
    public class porte extends BlockDoor
    {
        public porte()
        {
            super(Material.iron);
            this.setHardness(3.0F);
            this.setResistance(5.0F);
            this.disableStats();
        }
    
        @Override
        public Item getItemDropped(int par1, Random rand, int par3)
        {   
            return HavenRP.ItemPorte;
        }
    
        @Override
        @SideOnly(Side.CLIENT)
        public Item getItem(World world, int x, int y, int z)
        {
            return HavenRP.ItemPorte;
        }
    }
    

    C'est plus propre comme ça non ?
    Vous faites comment vos copier/coller pour vous retrouver avec cette horreur ?



  • Si on copie le contenu d'une balise java, on se retrouve avec ça et il faut enlever tout le formatage + la numérotation.
    Pour ta porte je regarde demain mais ça devrait marcher à le redstone là.

    Envoyé de mon RAINBOW LITE 4G en utilisant Tapatalk



  • sur ses elle souvre 10 sec plus tard des fois elle souvre pas



  • help plz en retirerent le onBlockActivated sur serveur kcauldron sa marche pas


  • Administrateurs

    Elle devrait s'ouvrir pourtant. Sur un serveur forge normal ça fonctionne ?



  • J'ai essayé de t'aider impuu sur skype mais tu m'as demandé le code complet hors moi je veut t'aider pas te passer le code car on m'as fait sa et je regrette



  • de mon coté le serveur forge souvre pas