Jump to content

Kaneka

Members
  • Posts

    110
  • Joined

  • Last visited

Posts posted by Kaneka

  1. Hi everyone,

     

    I am trying to generate structures with mod blocks, but atm I dont know how to do this. I found a tutorial with MCedit, but i read that there is no compability with mod blocks.

    Can someone help me?

    Additional to say, i have my own ChunkProvider, maybe it can make the thing easier!

     

    Thanks for every answer!

     

    Kaneka

  2. This do no work....addenchantment return void, but the addRecipe method needs only ItemStack as input, but i think i found the major problem:

    My code in CraftingRecipes:

    ..
    GameRegistry.addShapelessRecipe(new ItemStack(Modblocks.eff1,1,0), Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(Enchantment.efficiency, 1)));
    ...
    

     

    GameRegistry.class:

    ...
    public static void addShapelessRecipe(ItemStack output, Object... params)
        {
            CraftingManager.getInstance().addShapelessRecipe(output, params);
        }
    ...
    

     

    CrafttingManager.class:

    ...
    public void addShapelessRecipe(ItemStack stack, Object ... recipeComponents)
        {
            ArrayList arraylist = Lists.newArrayList();
            Object[] aobject = recipeComponents;
            int i = recipeComponents.length;
    
            for (int j = 0; j < i; ++j)
            {
                Object object1 = aobject[j];
    
                if (object1 instanceof ItemStack)
                {
                    arraylist.add(((ItemStack)object1).copy());
                }
                else if (object1 instanceof Item)
                {
                    arraylist.add(new ItemStack((Item)object1));
                }
                else
                {
                    if (!(object1 instanceof Block))
                    {
                        throw new IllegalArgumentException("Invalid shapeless recipe: unknown type " + object1.getClass().getName() + "!");
                    }
    
                    arraylist.add(new ItemStack((Block)object1));
                }
            }
    
           [u] this.recipes.add(new ShapelessRecipes(stack, arraylist));[/u]
        }
    
    ...
    

     

    recipes.class:

    ...
    public void addShapelessRecipe(ItemStack stack, Object ... recipeComponents)
        {
            ArrayList arraylist = Lists.newArrayList();
            Object[] aobject = recipeComponents;
            int i = recipeComponents.length;
    
            for (int j = 0; j < i; ++j)
            {
                Object object1 = aobject[j];
    
                if (object1 instanceof ItemStack)
                {
                    arraylist.add(((ItemStack)object1).copy());
                }
                else if (object1 instanceof Item)
                {
                    arraylist.add(new ItemStack((Item)object1));
                }
                else
                {
                    if (!(object1 instanceof Block))
                    {
                        throw new IllegalArgumentException("Invalid shapeless recipe: unknown type " + object1.getClass().getName() + "!");
                    }
    
                    arraylist.add(new ItemStack((Block)object1));
                }
            }
    
            [u]this.recipes.add(new ShapelessRecipes(stack, arraylist));[/u]
        }
    ...
    

     

    ShapelessRecipes.class

    ...
    public boolean matches(InventoryCrafting p_77569_1_, World worldIn)
        {
            ArrayList arraylist = Lists.newArrayList(this.recipeItems);
    
            for (int i = 0; i < p_77569_1_.getHeight(); ++i)
            {
                for (int j = 0; j < p_77569_1_.getWidth(); ++j)
                {
                    ItemStack itemstack = p_77569_1_.getStackInRowAndColumn(j, i);
    
                    if (itemstack != null)
                    {
                        boolean flag = false;
                        Iterator iterator = arraylist.iterator();
    
                        while (iterator.hasNext())
                        {
                            ItemStack itemstack1 = (ItemStack)iterator.next();
    
                            if (itemstack.getItem() == itemstack1.getItem() && (itemstack1.getMetadata() == 32767 || itemstack.getMetadata() == itemstack1.getMetadata()))
                            {
                                flag = true;
                                arraylist.remove(itemstack1);
                                break;
                            }
                        }
    
                        if (!flag)
                        {
                            return false;
                        }
                    }
                }
            }
    
            return arraylist.isEmpty();
        }
    ...
    

     

    I see that with the .getItem in the last Code it erases the enchantment....

  3. It is set up correctly, my mod works fine...check planttech if you dont think so ....see here(I deletet all unimportant parts and wrote there a ...):

    Main.class:

    public class Main
    {
       ...
        @SidedProxy(clientSide="net.kaneka.planttech.ClientProxy", serverSide="net.kaneka.planttech.ServerProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preinit(FMLPreInitializationEvent e)
        {
        	 
        		...
        	
    	this.proxy.preInit(e);
    
        }
        
        @EventHandler
        public void init(FMLInitializationEvent e)
        {
        	
        	this.proxy.init(e);
        	
    
        }
        
        @EventHandler
        public void postinit(FMLPostInitializationEvent e)
        {
    	this.proxy.postInit(e);
        }
    }

     

    Commonproxy.class:

    public class CommonProxy {
    
    
        public void preInit(FMLPreInitializationEvent e) 
        {
        	...
        	
        }
    
        public void init(FMLInitializationEvent e) 
        {
        	Craftingrecipes.addRecipe();
        	
        	...
        	
        }
    
        public void postInit(FMLPostInitializationEvent e) 
        {
    
        }
    }
    

     

    and least but not last:

    Craftingrecipes:

    public class Craftingrecipes {
    
    public static void addRecipe()
    {
                  ....
    ItemStack eff1 = new ItemStack(Items.enchanted_book);
    	eff1.addEnchantment(Enchantment.efficiency, 1);
    
    
    	GameRegistry.addShapelessRecipe(new ItemStack(Modblocks.eff1), eff1);
    
    }
    }
    
    

  4. hi, i read the ItemEnchantedBook, and see that the addEnchantment - method adds the NBT, but this wount work :

    ItemStack eff1 = new ItemStack(Items.enchanted_book);
    eff1.addEnchantment(Enchantment.efficiency, 1);
    
    GameRegistry.addShapelessRecipe(new ItemStack(Modblocks.eff1), eff1);
    

  5. ItemStack item = new ItemStack(Items.enchanted_book);
    
    
    @Override
    public Item getItemDropped(IBlockState state, Random rand, int fortune) {
    
    
    	item.addEnchantment(Enchantment.sharpness, 5);
    	return item.getItem();
    }
    

     

    It do not work....help please.

  6. Hi everyone,

     

    for my mod i need to extend a GuiContainer, because my Slots are to much for the normal size, the background isnt that problem, I draw it atm with

    this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize+16);
    

     

    Everything is drawn, that is not the problem, but the problem I have is, that I needed to put the slots for inventory and hotbar a bit lower, and now the problem is happening.

    When I am clicking on the items in the hotbar, i throw one of the items i am clicking on(not the whole stack, just 1 at a time) out of my inventory into the world.

    And this is not what it ment to be doing..

    May someone help??

     

    Thanks for every answer.

     

    Kaneka

  7. Hope this is enought:

     

    public class GuiGuidebook extends GuiScreen {
    public static final ResourceLocation BACKGROUND = new ResourceLocation("planttech:textures/gui/bookt.png");
    private static ResourceLocation[] picture = new ResourceLocation[bookTotalPages];
    
    ...
    
    public GuiGuidebook()
    {
        stringHeaderText[0] = "Compost Bin";
        stringPageText[0] = "Takes apples, potatoes, leaves or equal and a bit of time to transform them to biomass. \n\nThe basic of every good planttechian!";
        picture[0] = new ResourceLocation("planttech:textures/gui/recipes/compostbin.png");
    
    ...
    
    public void drawScreen(int parWidth, int parHeight, float p_73863_3_)
    {
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        
        mc.getTextureManager().bindTexture(BACKGROUND);
        int offsetFromScreenLeft = (width - bookImageWidth ) / 2;
        drawModalRectWithCustomSizedTexture(offsetFromScreenLeft, 2, 0, 0, 400, 250, 400, 300);
        mc.getTextureManager().bindTexture(picture[currPage]);
        drawModalRectWithCustomSizedTexture(280, 80, 0, 0, 100, 100, 100, 100);
    ...
    

     

    If more is needet, tell me to post more

  8. Hi everyone,

     

    I am trying to make a GuiScreen as a guide for my mod, and it have pictures in it. And in Eclipse it works well, every picture is shown, but when i export the mod, the bookbackground is shown, every text shows up, but the images i put in are only shown as error image(these purple/black image). Where is my mistake when it is right in Eclipse but not in the exported mod?

     

    Thanks for answers,

     

    Kaneka

  9. Hello everybody,

     

    I am trying to make a guiscreen for my mod, but it always uses my texture for the background as a square, but my texture is scaled 400x600 px.

    I used the drawTexturedModalRect method for the drawing.

    Can someone help me?

     

    Thanks for the answers!

     

    Kaneka

  10. Thanks all for the answers, i already got a IGuiHandler in my mod, cause i have planty machines in it with GUI. Hope i can manage to add this to my mod, cause it is complex enought and if you have to go to my minecraftforum thread to check everything, this isnt effectiv :D

     

  11. Hello everybody,

     

    my mod is growing and i am thinking of making a "book" like the one from Tinker Construct or Draconic Evolution, but i am programming in 1.8.

    Is there any guide or something like that where i can learn it? Or can someone tell me how to do it?

     

    Thanks for the answers,

     

    Kaneka

  12. hi,

     

    you could even drop exp with

     

    public void dropXpOnBlockBreak(World worldIn, BlockPos pos, int amount)
        {
            if (!worldIn.isRemote)
            {
                while (amount > 0)
                {
                    int j = EntityXPOrb.getXPSplit(amount);
                    amount -= j;
                    worldIn.spawnEntityInWorld(new EntityXPOrb(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, j));
                }
            }
        }
    

    (Taken from the Block.class)

×
×
  • Create New...

Important Information

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