Jump to content

Recommended Posts

Posted

Alright, so, I need to 'remove' the wood tools, the wood pick, shovel, ax, etc., but I don't know how to go about doing it. I've tried extending and overriding Item, but it tells me that I can't. I really don't want to have to go about editing the main files, since that will ruin compatibility : P.

Posted

Alright, so, I need to 'remove' the wood tools, the wood pick, shovel, ax, etc., but I don't know how to go about doing it. I've tried extending and overriding Item, but it tells me that I can't. I really don't want to have to go about editing the main files, since that will ruin compatibility : P.

Posted

Someone may well correct me on this, but I'm not sure if you can.

 

It's something I've considered before (I wanted to remove all swords and armor for my futuristic server) but I couldn't find any way of doing it without modifying the base classes. There might be some sort of clever way of disabling them from being crafted or put into creative mode, but I don't know about entirely removing them.

 

 

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted

Someone may well correct me on this, but I'm not sure if you can.

 

It's something I've considered before (I wanted to remove all swords and armor for my futuristic server) but I couldn't find any way of doing it without modifying the base classes. There might be some sort of clever way of disabling them from being crafted or put into creative mode, but I don't know about entirely removing them.

 

 

width=463 height=200

http://s13.postimg.org/z9mlly2av/siglogo.png[/img]

My mods (Links coming soon)

Cities | Roads | Remula | SilvaniaMod | MoreStats

Posted

why don't you delete the recipes of the wooden tools?

Would that help?

 

If yes do not say i do not know how that works.

 

Search for terrafirmacraft at github. They have a function that called RemoveRecipe

in their Class: TerraFirmaCraft

 

and if you copy this function into your mod it have to look like this when you use it:

 

RemoveRecipe(new ItemStack(Block.brick, 1));

Posted

why don't you delete the recipes of the wooden tools?

Would that help?

 

If yes do not say i do not know how that works.

 

Search for terrafirmacraft at github. They have a function that called RemoveRecipe

in their Class: TerraFirmaCraft

 

and if you copy this function into your mod it have to look like this when you use it:

 

RemoveRecipe(new ItemStack(Block.brick, 1));

Posted

why don't you delete the recipes of the wooden tools?

Would that help?

 

If yes do not say i do not know how that works.

 

Search for terrafirmacraft at github. They have a function that called RemoveRecipe

in their Class: TerraFirmaCraft

 

and if you copy this function into your mod it have to look like this when you use it:

 

RemoveRecipe(new ItemStack(Block.brick, 1));

 

Yeah, I knew about this, I just wanted to know if there was an alternative.

Posted

why don't you delete the recipes of the wooden tools?

Would that help?

 

If yes do not say i do not know how that works.

 

Search for terrafirmacraft at github. They have a function that called RemoveRecipe

in their Class: TerraFirmaCraft

 

and if you copy this function into your mod it have to look like this when you use it:

 

RemoveRecipe(new ItemStack(Block.brick, 1));

 

Yeah, I knew about this, I just wanted to know if there was an alternative.

Posted

I've been doing the same thing, trying to remove the recipe for the Golden Sword. The method seems to work for ShapelessRecipes (I tried (Item.book) and (Item.planks,  4)), but doesn't work for ShapedRecipes ((Item.stick, 4), (Item.jukebox), (Item.swordGold)). I'm thinking something's changed since the code was posted.

 

My method call:

removeRecipe(new ItemStack(Item.swordGold));

 

The Method:

private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot
{
    ItemStack recipeResult = null;
    ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList();
    
    for (int scan = 0; scan < recipes.size(); scan++)
    {
        IRecipe tmpRecipe = (IRecipe) recipes.get(scan);
        if (tmpRecipe instanceof ShapedRecipes)
        {
            ShapedRecipes recipe = (ShapedRecipes)tmpRecipe;
            recipeResult = recipe.getRecipeOutput();
        }
        else if (tmpRecipe instanceof ShapelessRecipes)
        {
            ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe;
            recipeResult = recipe.getRecipeOutput();
        }
        if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
        {
            System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult);
            recipes.remove(scan);
        }
    }
}

 

EDIT: I got it to work, though I'm not sure if it is safe or not. I simply don't check what the recipe is an instance of anymore:

 

private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot
{
    ItemStack recipeResult = null;
    ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList();
    
    for (int scan = 0; scan < recipes.size(); scan++)
    {
        IRecipe tmpRecipe = (IRecipe) recipes.get(scan);
        recipeResult = tmpRecipe.getRecipeOutput();

if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
        {
            System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult);
            recipes.remove(scan);
        }
    }
}

Posted

I've been doing the same thing, trying to remove the recipe for the Golden Sword. The method seems to work for ShapelessRecipes (I tried (Item.book) and (Item.planks,  4)), but doesn't work for ShapedRecipes ((Item.stick, 4), (Item.jukebox), (Item.swordGold)). I'm thinking something's changed since the code was posted.

 

My method call:

removeRecipe(new ItemStack(Item.swordGold));

 

The Method:

private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot
{
    ItemStack recipeResult = null;
    ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList();
    
    for (int scan = 0; scan < recipes.size(); scan++)
    {
        IRecipe tmpRecipe = (IRecipe) recipes.get(scan);
        if (tmpRecipe instanceof ShapedRecipes)
        {
            ShapedRecipes recipe = (ShapedRecipes)tmpRecipe;
            recipeResult = recipe.getRecipeOutput();
        }
        else if (tmpRecipe instanceof ShapelessRecipes)
        {
            ShapelessRecipes recipe = (ShapelessRecipes)tmpRecipe;
            recipeResult = recipe.getRecipeOutput();
        }
        if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
        {
            System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult);
            recipes.remove(scan);
        }
    }
}

 

EDIT: I got it to work, though I'm not sure if it is safe or not. I simply don't check what the recipe is an instance of anymore:

 

private static void removeRecipe(ItemStack resultItem) //Code by yope_fried inspired by pigalot
{
    ItemStack recipeResult = null;
    ArrayList recipes = (ArrayList) CraftingManager.getInstance().getRecipeList();
    
    for (int scan = 0; scan < recipes.size(); scan++)
    {
        IRecipe tmpRecipe = (IRecipe) recipes.get(scan);
        recipeResult = tmpRecipe.getRecipeOutput();

if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
        {
            System.out.println("Removed Recipe: " + recipes.get(scan) + " -> " + recipeResult);
            recipes.remove(scan);
        }
    }
}

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



×
×
  • Create New...

Important Information

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