Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need help with making mod


Herpahermaderp
 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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));

Link to comment
Share on other sites

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));

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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);
        }
    }
}

Link to comment
Share on other sites

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);
        }
    }
}

Link to comment
Share on other sites

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
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.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • By looking at the log output for command 'gradlew --debug runData', it appears that the Standard Library jars get passed to Forge via the '-cp' command line parameter correctly in both versions. Trying to create a workaround earlier revealed that the module resolver is aware of the Standard Library's exports, and therefore conflicts with any attempt to manually copy stdlib over to 'build/classes/kotlin/main'. This means I cannot create a workaround that way. I have also switched to 1.18, and this issue still persists. This is most likely an issue regarding JVM options, which I do not have enough knowledge about. The build.gradle snippets shown above (remember switching jvmTarget in kotlinOptions to 17 when building for 1.18), alongside with the following piece of code for a mod class, should be enough to reproduce: File: src/main/kotlin/com/example/examplemod/ExampleMod.kt package com.example.examplemod import net.minecraftforge.fml.common.Mod import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.Logger @Mod("examplemod") class ExampleMod { init { LOGGER.info("Hello World!") } companion object { private val LOGGER: Logger = LogManager.getLogger() } } Note that removing the explicit type Logger (so it becomes 'private val LOGGER = LogManager.getLogger()') loads successfully, because when there is no explicit type specified, Koltin implicitly infers a so-called platform type, shown in IDE as 'Logger!' (note the exclamation mark). This platform type is not null checked by default, so there are no references to 'kotlin.jvm.internal.Intrinsics' for null checks. Specifying the type explicitly as not null however creates a null check under the hood, because in Kotlin, for a type to be nullable, it has to be suffixed with a question mark (Logger?). Otherwise it is guaranteed to be not null. Explanation for those not knowing Kotlin: The 'init' block is essentially a constructor block. The Java equivalent would be 'public ExampleMod() { LOGGER.info("Hello World!"); }'. Declarations inside 'companion object' basically behave like static declarations, so the Java equivalent would be 'private static Logger LOGGER = LogManager.getLogger();'. Looking forward to a fix! Thank you for your time.
    • affter a bit of time this worked: @SubscribeEvent public static void renderPlayerPre(RenderPlayerEvent.Pre event) { //here i was canceling the pre event so... event.getRenderer().getEntityModel().bipedLeftArm.showModel = false; } @SubscribeEvent public static void renderPlayerPost(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); ModelRenderer rightArm = model.bipedLeftArm; rightArm.showModel = true; rightArm.render( event.getMatrixStack(), event.getBuffers().getBuffer(RenderType.getEntitySolid(((AbstractClientPlayerEntity)player).getLocationSkin())), Minecraft.getInstance().getRenderManager().getPackedLight(player, 1f), OverlayTexture.NO_OVERLAY); } But just one more thing, i promess no more questions..., the hand is like this: https://imgur.com/a/KTVudC3, and there is no offsetX, Y, or Z, do i need arm.rotationPointSOMETHING to move the hand wherever i want?
    • 1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.
    • I get this error when i start up forge sever for 1.12.2 :https://pastebin.com/Hz1dGb4P
    • Then analyze the vanilla code and find the right names!!!
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.