Skip to content

Implement Recipes#1027

Closed
Maxqia wants to merge 4 commits intoSpongePowered:bleedingfrom
Maxqia:recipe
Closed

Implement Recipes#1027
Maxqia wants to merge 4 commits intoSpongePowered:bleedingfrom
Maxqia:recipe

Conversation

@Maxqia
Copy link
Contributor

@Maxqia Maxqia commented Nov 19, 2016

API | Common

@kashike kashike changed the title [WIP] Implement Recipes [WIP] Implement Furnace Recipes Nov 19, 2016
@kashike kashike added the type: enhancement An improvement label Nov 19, 2016
@@ -0,0 +1,47 @@
package org.spongepowered.common.mixin.core.item.recipe;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing licence header.

@@ -0,0 +1,47 @@
package org.spongepowered.common.mixin.core.item.recipe;

import java.util.Map;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong import order.

import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.common.item.inventory.util.ItemStackUtil;

import net.minecraft.item.ItemStack;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong import order.


@Override
public boolean removeSmeltingRecipe(org.spongepowered.api.item.inventory.ItemStack input) {
ItemStack stack = smeltingList.remove(input);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.


@Override
public org.spongepowered.api.item.inventory.ItemStack getMapping(org.spongepowered.api.item.inventory.ItemStack stack) {
return ItemStackUtil.cloneDefensive(smeltingList.get(stack));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.


@Override
public float getExperience(org.spongepowered.api.item.inventory.ItemStack stack) {
return experienceList.get(stack);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this.

@kashike kashike self-assigned this Nov 19, 2016
if (experienceList.remove(stack) != null) {
return true;
}
throw new RuntimeException("It was in one map but not the other?");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw new AssertionError("It was on one map but not the other.");


@Override
public void addSmeltingRecipe(org.spongepowered.api.item.inventory.ItemStack input, org.spongepowered.api.item.inventory.ItemStack output, float exp) {
addSmeltingRecipe(ItemStackUtil.toNative(input), ItemStackUtil.toNative(output), exp);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is toNative simply for casting?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

@liach
Copy link
Contributor

liach commented Nov 19, 2016

Why do you never update submodule?

@kashike kashike added the status: wip Work in progress label Nov 19, 2016
@kashike kashike changed the title [WIP] Implement Furnace Recipes Implement Furnace Recipes Nov 19, 2016
@Maxqia
Copy link
Contributor Author

Maxqia commented Nov 20, 2016

Now with more testing!
EDIT: removed itemstackutil changes

@Override
public float getExperience(org.spongepowered.api.item.inventory.ItemStack stack) {
return this.experienceList.get(stack);
public Optional<Float> getExperience(org.spongepowered.api.item.inventory.ItemStack stack) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be an OptionalDouble available in java.util.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That exists?!? ..., but it's kind of stupid, it always says it's present even if it's null

@Maxqia Maxqia force-pushed the recipe branch 2 times, most recently from fa10699 to 4473c32 Compare November 23, 2016 05:15
@Maxqia Maxqia force-pushed the recipe branch 3 times, most recently from c45c58e to 94a6073 Compare December 12, 2016 02:39
checkNotNull(ingredient, "ingredient");
checkNotNull(result, "result");
checkNotNull(experience, "experience");
return this;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused. This is not how builders are supposed to work.

@Maxqia Maxqia force-pushed the recipe branch 4 times, most recently from fe40d11 to 9685e2f Compare January 3, 2017 09:19
@Maxqia Maxqia changed the title Implement Furnace Recipes Implement Recipes Jan 3, 2017
@Maxqia Maxqia changed the title Implement Recipes [WIP] Implement Recipes Jan 3, 2017
@Maxqia Maxqia changed the title [WIP] Implement Recipes [Not WIP] Implement Recipes Jan 7, 2017
@stephan-gh stephan-gh removed the status: wip Work in progress label Jan 7, 2017
@stephan-gh stephan-gh changed the title [Not WIP] Implement Recipes Implement Recipes Jan 7, 2017
return returnVal;
}

public static <T> ImmutableMap<T, ItemStackSnapshot> mapItemStackSnapshot(Map<T, ItemStack> map) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should move to util classes.


@Override
public Optional<ImmutableCollection<ItemStackSnapshot>> getResults(GridInventory grid) {
throw new NotImplementedException("TODO"); // dunno how to convert a gridinventory to a IInventory...
Copy link
Contributor

@liach liach Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:trollface:

@Shadow net.minecraft.item.ItemStack getRecipeOutput();

@Override
default ImmutableCollection<ItemStackSnapshot> getResults() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you using ImmutableCollection?

@kashike
Copy link
Contributor

kashike commented Jun 17, 2017

I'm going to close this in favour of #1395.

@kashike kashike closed this Jun 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement An improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants