Jump to content

Recommended Posts

Posted

EDIT: Detailed

 

Hello,

 

So I have created a TE that uses 2 INPUTS for 1 OUTPUT, however, when I go to put the intended recipe in, the TE does not process it into the intended output, instead it sits and idles. What I want to have happen is for the TE to use BOTH inputs for 1 output.

 

Here is the TE:

 

 

  Reveal hidden contents

 

 

Container:

 

  Reveal hidden contents

 

 

RecipeRegistry:

public class AtomicDiffuserRecipeRegistry {

        public static void registerFinally(){
            int recipeStartedAt = PlentifulMiscAPI.ATOMIC_RECIPES.size();

            ArrayList<String> addedRecipes = new ArrayList<String>();
            for(int i = recipeStartedAt; i < PlentifulMiscAPI.ATOMIC_RECIPES.size(); i++){
                AtomicDiffuserRecipe recipe = PlentifulMiscAPI.ATOMIC_RECIPES.get(i);
                addedRecipes.add(recipe.firstInput+"+"+recipe.secondInput+" -> "+recipe.output);
            }
            ModUtil.LOGGER.info("Added "+addedRecipes.size()+" Atomic Recipes automatically: "+addedRecipes);
        }
/*
        public static boolean hasBlacklistedOutput(ItemStack output, String[] config){
            if(StackUtil.isValid(output)){
                Item item = output.getItem();
                if(item != null){
                    String reg = item.getRegistryName().toString();

                    for(String conf : config){
                        String confReg = conf;
                        int meta = 0;

                        if(conf.contains("@")){
                            try{
                                String[] split = conf.split("@");
                                confReg = split[0];
                                meta = Integer.parseInt(split[1]);
                            }
                            catch(Exception e){
                                ModUtil.LOGGER.warn("A config option appears to be incorrect: The entry "+conf+" can't be parsed!");
                            }
                        }

                        if(reg.equals(confReg) && output.getItemDamage() == meta){
                            return true;
                        }
                    }

                    return false;
                }
            }
            return true;
        }
*/
        private static boolean hasException(String ore){
            for(String conf : ConfigStringListValues.ATOMIC_RECIPE_EXCEPTIONS.getValue()){
                if(conf.equals(ore)){
                    return true;
                }
            }
            return false;
        }

        public static ItemStack getOutput(ItemStack input, ItemStack inputSecond){
            AtomicDiffuserRecipe recipe = getRecipeFromInput(input, inputSecond);
            return recipe == null ? null : recipe.output;
        }

        public static AtomicDiffuserRecipe getRecipeFromInput(ItemStack input, ItemStack secondInput){
            for(AtomicDiffuserRecipe recipe : PlentifulMiscAPI.ATOMIC_RECIPES){
                if(ItemUtil.areItemsEqual(recipe.firstInput, input, true) && ItemUtil.areItemsEqual(recipe.secondInput, secondInput, true)){
                    return recipe;
                }
            }
            return null;
        }
}

 

Recipes:

public final class AtomicDiffuserRecipes {

    public static final ArrayList<AtomicDiffuserRecipe> MISC_RECIPES = new ArrayList<AtomicDiffuserRecipe>();
    public void init() {

        ModUtil.LOGGER.info("Initializing Atomic Diffuser Recipes...");

        PlentifulMiscAPI.addAtomicRecipe(new ItemStack(Items.BONE), new ItemStack(Items.STICK), new ItemStack(Items.APPLE));
        MISC_RECIPES.add(RecipeUtil.lastAtomicRecipe());

        AtomicDiffuserRecipeRegistry.registerFinally();
    }
}

 

Main API:

public final class PlentifulMiscAPI{

    public static final String MOD_ID = "plentifulmisc";
    public static final String API_ID = MOD_ID+"api";
    public static final String API_VERSION = "1";

    public static IMethodHandler methodHandler;

    public static IRelayConnectionHandler connectionHandler;

    public static final List<AtomicDiffuserRecipe> ATOMIC_RECIPES = new ArrayList<AtomicDiffuserRecipe>();

    public static void addAtomicRecipe(ItemStack firstInput, ItemStack secondInput, ItemStack output){
        ATOMIC_RECIPES.add(new AtomicDiffuserRecipe(firstInput, secondInput, output));
    }

    public static boolean addAtomicRecipes(List<ItemStack> firstInput, List<ItemStack> secondInput, List<ItemStack> output)
    {
        return methodHandler.addAtomicRecipes(firstInput, secondInput, output);
    }

}

 

Recipe:

public class AtomicDiffuserRecipe {

    public ItemStack firstInput;
    public ItemStack secondInput;
    public ItemStack output;

    public AtomicDiffuserRecipe(ItemStack firstInput, ItemStack secondInput, ItemStack output) {
        this.firstInput = firstInput;
        this.secondInput = secondInput;
        this.output = output;
    }
}

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

Posted

Hi Lambda

  On 11/26/2016 at 11:42 PM, Lambda said:

I'm running into some issues with the crafting handler and such

In order to help you, we really need a more detailed description of the problems you're having :)

 

ie.

What you expect to happen

vs

What actually happens (detailed symptoms, error logs, etc).

 

-TGG

Posted

Post your ItemUtil.areItemsEqual method.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  public static boolean areItemsEqual(ItemStack stack1, ItemStack stack2, boolean checkWildcard){
        return StackUtil.isValid(stack1) && StackUtil.isValid(stack2) && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == UtilBase.WILDCARD || stack2.getItemDamage() == UtilBase.WILDCARD)));
    }

Relatively new to modding.

Currently developing:

https://github.com/LambdaXV/DynamicGenerators

Posted

Hmm.

You might have to step through in the debugger.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Put a breakpoint on the canSmeltOn method, and step through line by line to figure out why it's not getting a result.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
  On 11/29/2016 at 12:13 AM, Lambda said:

Just got into Intellj, would you know how to add breakpoints, google search shows ALT+INS but that isnt working :/

 

Click on the margin between the line numbers and the code.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

But the breakpoint not next to the method name, but next to the first line of code after the method.

Method breakpoints are extremely sluggish.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

  Quote

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Different problem now. https://paste.ee/p/iDo8lS35
    • I would like to have a BoP sapling drop from my block if it is also installed. I think I have done everything and I cannot pinpoint the problem, which is the error in the logs that appears when joining a world:   [Worker-Main-11/ERROR] [ne.mi.co.ForgeHooks/]: Couldn't parse element loot_tables:grasses:blocks/leaves_block com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'biomesoplenty:magic_sapling' My code:   LootItemConditions.CONDITIONS.register(modEventBus); public class LootItemConditions { public static final DeferredRegister<LootItemConditionType> CONDITIONS = DeferredRegister.create(Registries.LOOT_CONDITION_TYPE, Grasses.MOD_ID); public static final RegistryObject<LootItemConditionType> IS_MOD_LOADED = CONDITIONS.register("is_mod_loaded", () -> new LootItemConditionType(new IsModLoaded.ConditionSerializer())); } public class IsModLoaded implements LootItemCondition { private final boolean exists; private final String modID; public IsModLoaded(String modID) { this.exists = ModList.get().isLoaded(modID); this.modID = modID; } @Override public LootItemConditionType getType() { return LootItemConditions.IS_MOD_LOADED.get(); } @Override public boolean test(LootContext context) { return this.exists; } public static LootItemCondition.Builder builder(String modid) { return () -> new IsModLoaded(modid); } public static class ConditionSerializer implements Serializer<IsModLoaded> { @Override public void serialize(JsonObject json, IsModLoaded instance, JsonSerializationContext ctx) { json.addProperty("modid", instance.modID); } @Override public IsModLoaded deserialize(JsonObject json, JsonDeserializationContext ctx) { return new IsModLoaded(GsonHelper.getAsString(json, "modid")); } } } protected LootTable.Builder createLeavesDropsWithModIDCheck(Block selfBlock, Item sapling, Property<?>[] properties, String modIDToCheck, float... chances) { CopyBlockState.Builder blockStateCopyBuilder = CopyBlockState.copyState(selfBlock); for(Property<?> property : properties) { blockStateCopyBuilder.copy(property); } return LootTable.lootTable() .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(LootItem.lootTableItem(selfBlock) .when(HAS_SHEARS_OR_SILK_TOUCH) .apply(blockStateCopyBuilder))) .withPool(LootPool.lootPool().setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionCondition(selfBlock, LootItem.lootTableItem(sapling)) .when(IsModLoaded.builder(modIDToCheck))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, chances)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH)) .withPool(LootPool.lootPool().name("sticks").setRolls(ConstantValue.exactly(1.0F)) .add(this.applyExplosionDecay(selfBlock, LootItem.lootTableItem(Items.STICK). apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F)))) .when(BonusLevelTableCondition.bonusLevelFlatChance(Enchantments.BLOCK_FORTUNE, NORMAL_LEAVES_STICK_CHANCES)) .when(HAS_NO_SHEARS_OR_SILK_TOUCH))); } I don't know. Am I making a mistake somewhere? Am I forgetting something? Should there be something else?
    • https://paste.ee/p/h1JX9bbl
    • Add the latest.log from your logs-folder
  • Topics

×
×
  • Create New...

Important Information

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