MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    Model

    Planifier Épinglé Verrouillé Déplacé Sans suite
    1.7.10
    27 Messages 5 Publieurs 4.5k Vues 1 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • I Hors-ligne
      impuuu
      dernière édition par

      OK demain la je peut pas

      1 réponse Dernière réponse Répondre Citer 0
      • I Hors-ligne
        impuuu
        dernière édition par

        CommonProxy

        package fr.impuuu.havenrp.proxy;
        
        public class CommonProxy
        {
            public void registerRender(){
                System.out.println("Methode Coté serveur !");
            }
        
            public void registerRenderThings()
            {
        
            }
        }
        
        

        ClientProxy

        package fr.impuuu.havenrp.proxy;
        
        import java.awt.Desktop;
        import java.io.IOException;
        import java.net.URI;
        
        import org.lwjgl.opengl.Display;
        
        import cpw.mods.fml.client.FMLClientHandler;
        import cpw.mods.fml.client.registry.ClientRegistry;
        import cpw.mods.fml.common.ObfuscationReflectionHelper;
        import cpw.mods.fml.common.eventhandler.SubscribeEvent;
        import cpw.mods.fml.relauncher.SideOnly;
        import fr.impuuu.havenrp.render.RenderCoco;
        import fr.impuuu.havenrp.titleentity.TileEntityCoco;
        import net.minecraft.client.gui.FontRenderer;
        import net.minecraft.client.gui.GuiButton;
        import net.minecraft.client.gui.GuiIngameMenu;
        import net.minecraft.client.gui.GuiMainMenu;
        import net.minecraft.client.multiplayer.GuiConnecting;
        import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
        import net.minecraft.client.resources.I18n;
        import net.minecraft.util.EnumChatFormatting;
        import net.minecraft.util.ResourceLocation;
        import net.minecraftforge.client.event.RenderGameOverlayEvent;
        import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
        import net.minecraftforge.common.MinecraftForge;
        
        public class ClientProxy extends CommonProxy
        {
            public ClientProxy(){
                MinecraftForge.EVENT_BUS.register(this);
                MinecraftForge.EVENT_BUS.register(this);
            }
            public void registerRenderThings(){
                TileEntitySpecialRenderer render = new RenderCoco();
                ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCoco.class, render);
            }
            @SubscribeEvent
            public void onInitGuiEvent(InitGuiEvent.Post event) {
                if (event.gui instanceof GuiMainMenu) { // On regarde si le gui est bien le menu principal
                    for (Object b : event.buttonList) { // On parcourt la liste des boutons
                        if (((GuiButton) b).id == 14) { // Si c'est le bouton "Minecraft Realms" (qui a l'ID 14)
                            ((GuiButton) b).visible = false; // On ne l'affiche plus
                        }
                        if(((GuiButton) b).id == 6){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 1){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 0){
                            ((GuiButton) b).visible = false ;
                        }
                        if(((GuiButton) b).id == 2){
                            ((GuiButton) b).visible = false ;
                        }
                        if(((GuiButton) b).id == 5){
                            ((GuiButton) b).visible = false ;
                        }
                        if(((GuiButton) b).id == 4){
                            ((GuiButton) b).visible = false ;
                        }
                    }
                    int i = event.gui.height / 4 + 48; // On définit une variable pour simplifier le code (elle est utilisée par Minecraft)
                    event.buttonList.add(new GuiButton(130, event.gui.width / 2 - 100, i + 24 * 2, 200, 20, EnumChatFormatting.GRAY+"Teamspeak") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique
                            if (Desktop.isDesktopSupported()) { // Si on peut utiliser des URIs
                                try {
                                    Desktop.getDesktop().browse(new URI("ts3server://212.83.151.173?port=10614")); // On essaye de lancer TeamSpeak
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    }
                                }
        
                        }
                    });
                    event.buttonList.add(new GuiButton(31, event.gui.width / 2 - 100, i + 72, 200, 20, EnumChatFormatting.BLUE+"Site") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique
                            if (Desktop.isDesktopSupported()) { // Si on peut utiliser des URIs
                                try {
                                    Desktop.getDesktop().browse(new URI("http://havenrp-v2.livehost.fr/")); // On essaye de lancer TeamSpeak
                                } catch (Exception e) {
                                    e.printStackTrace();
                                    }
                                }
        
                        }
                    });
        
                    event.buttonList.add(new GuiButton(1, event.gui.width / 2 - 100, i + 0 * 2, 200, 20, EnumChatFormatting.DARK_AQUA+"Options") { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                        }
                    });
                    event.buttonList.add(new GuiButton(31, event.gui.width / 2 - 100, i + 12 * 2, 200, 20, EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11"+EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"HavenRP"+EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11"
        ) { // On crée un bouton avec l'ID 30 de 100 de large et 20 de large appelé "Teamspeak"
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique
                            FMLClientHandler.instance().connectToServerAtStartup("MineLifeRP.crystal-serv.com", 25790);                    
                        }
                    });
                    ObfuscationReflectionHelper.setPrivateValue(GuiMainMenu.class, (GuiMainMenu) event.gui, EnumChatFormatting.GOLD+"HavenRP :)", "splashText", "field_73975_c");
            }
        
            }
            @SubscribeEvent
            public void InitGuiEvent(InitGuiEvent.Post e) {
                if(e.gui instanceof GuiIngameMenu){
                    for(Object b : e.buttonList){
                        if(((GuiButton) b).id == 1){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 12){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 7){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 5){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 6){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 4){
                            ((GuiButton) b).visible = false;
                        }
                        if(((GuiButton) b).id == 0){
                            ((GuiButton) b).visible = false;
                        }
                        }
                    byte b0 = -16;
                    e.buttonList.add(new GuiButton(4, e.gui.width / 2 - 100, e.gui.height / 4 + 24 + b0, 200, 20, EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11"+EnumChatFormatting.RED+""+EnumChatFormatting.BOLD+"Retour au jeu"+EnumChatFormatting.DARK_RED+""+EnumChatFormatting.OBFUSCATED+"11") {
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                        }
                    });
                    e.buttonList.add(new GuiButton(0, e.gui.width / 2 - 100, e.gui.height / 4 + 48 + b0, 200, 20, EnumChatFormatting.DARK_AQUA+"Options") {
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique                    
                        }
                    });
                    e.buttonList.add(new GuiButton(40, e.gui.width / 2 - 100, e.gui.height / 4 + 72 + b0, 200, 20, EnumChatFormatting.GRAY+"Teamspeak 3"){
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique
                            if (Desktop.isDesktopSupported()) {
        
                                try {
                                    Desktop.getDesktop().browse(new URI("ts3server://212.83.151.173?port=10614")); // On essaye de lancer TeamSpeak
                                } catch (Exception e) {
                                    e.printStackTrace();
        
                            }
        
                            }
        
                            }
        
                    });
                    e.buttonList.add(new GuiButton(41, e.gui.width / 2 - 100, e.gui.height / 4 + 96 + b0, 200, 20, EnumChatFormatting.BLUE+"Site"){
                        @Override
                        public void mouseReleased(int x, int y) { // Lorsque l'on clique
                            if (Desktop.isDesktopSupported()) {
        
                                try {
                                    Desktop.getDesktop().browse(new URI("http://havenrp-v2.livehost.fr/")); // On essaye de lancer TeamSpeak
                                } catch (Exception e) {
                                    e.printStackTrace();
        
                            }
        
                            }
        
                            }
                    });
        
                    }
            }
        
        }
        
        

        Classe Principale

        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.ItemFood;
        import net.minecraft.item.ItemStack;
        import net.minecraft.util.EnumChatFormatting;
        import net.minecraft.util.ResourceLocation;
        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.block.BlockPomme;
        import fr.impuuu.havenrp.block.ClayStairs;
        import fr.impuuu.havenrp.block.CocoBlock;
        import fr.impuuu.havenrp.block.Plante;
        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);
        
            @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;
           /*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 Block_Coco;
        
            @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);
                /*Block*/
                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_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_Block");
        
                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");
        
                /*Block*/
                GameRegistry.registerBlock(BlockPomme, "Block_de_Pomme");
                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(Plante_cannabis, "Plante_de_cannabis");
                GameRegistry.registerBlock(Plante_mari, "Plante_de_marijuana");
                GameRegistry.registerBlock(Block_Coco, "Block_de_coco");
        
            }
        
            @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(item500).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());
                }
            }
            */
        }
        
        
        1 réponse Dernière réponse Répondre Citer 0
        • AymericRedA Hors-ligne
          AymericRed
          dernière édition par

          Eclipse te met quoi comme erreur (et où) ?

          Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

          AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

          Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
          Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

          1 réponse Dernière réponse Répondre Citer 0
          • robin4002R Hors-ligne
            robin4002 Moddeurs confirmés Rédacteurs Administrateurs
            dernière édition par

            Ton code est bon, il ne devrait pas avoir d’erreur.

            1 réponse Dernière réponse Répondre Citer 0
            • I Hors-ligne
              impuuu
              dernière édition par

              oui je comprend pas ses le 64x32 je croit ou il faudrait register le model dans la classe princial

              1 réponse Dernière réponse Répondre Citer 0
              • AymericRedA Hors-ligne
                AymericRed
                dernière édition par

                64x32 non normalement ça marche, et ça ne sert à rien dans la classe principale, du moment que tu le register.
                Et tu peux répondre à ma question ? Tu as quoi comme erreur ?

                Si je vous ai aidé, n'oubliez pas d’être heureux, j'aiderai encore +

                AymericRed, moddeur expérimenté qui aide sur ce forum et qui peut accepter de faire un mod Forge rémunéré de temps en temps.

                Mes tutos : Table de craft, plugin NEI, plugin JEI, modifier l'overlay
                Je suis un membre apprécié et joueur, j'ai déjà obtenu 6 points de réputation.

                1 réponse Dernière réponse Répondre Citer 0
                • robin4002R Hors-ligne
                  robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                  dernière édition par

                  Actuellement tu as une erreur ou juste pas de rendu ?

                  1 réponse Dernière réponse Répondre Citer 0
                  • I Hors-ligne
                    impuuu
                    dernière édition par

                    non juste le model s affiche pas sa me met un block video

                    1 réponse Dernière réponse Répondre Citer 0
                    • robin4002R Hors-ligne
                      robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                      dernière édition par

                      un bloc vidéo ?!?!?
                      vide plutôt non ?

                      Je crois savoir pourquoi.
                      Il te manque la fonction hasTileEntity dans ton bloc.

                      1 réponse Dernière réponse Répondre Citer 0
                      • I Hors-ligne
                        impuuu
                        dernière édition par

                        vide oui tu pourait me dit ou je les met le hasTileEntity

                        1 réponse Dernière réponse Répondre Citer 0
                        • robin4002R Hors-ligne
                          robin4002 Moddeurs confirmés Rédacteurs Administrateurs
                          dernière édition par

                          Dans la classe de ton bloc :

                          @Override
                          public boolean hasTileEntity(int metadata)
                          {
                          return true;
                          }
                          
                          1 réponse Dernière réponse Répondre Citer 0
                          • 1
                          • 2
                          • 2 / 2
                          • Premier message
                            Dernier message
                          Design by Woryk
                          ContactMentions Légales

                          MINECRAFT FORGE FRANCE © 2024

                          Powered by NodeBB