Closed
Conversation
kashike
suggested changes
Nov 19, 2016
| @@ -0,0 +1,47 @@ | |||
| package org.spongepowered.common.mixin.core.item.recipe; | |||
| @@ -0,0 +1,47 @@ | |||
| package org.spongepowered.common.mixin.core.item.recipe; | |||
|
|
|||
| import java.util.Map; | |||
| import org.spongepowered.asm.mixin.Shadow; | ||
| import org.spongepowered.common.item.inventory.util.ItemStackUtil; | ||
|
|
||
| import net.minecraft.item.ItemStack; |
|
|
||
| @Override | ||
| public boolean removeSmeltingRecipe(org.spongepowered.api.item.inventory.ItemStack input) { | ||
| ItemStack stack = smeltingList.remove(input); |
|
|
||
| @Override | ||
| public org.spongepowered.api.item.inventory.ItemStack getMapping(org.spongepowered.api.item.inventory.ItemStack stack) { | ||
| return ItemStackUtil.cloneDefensive(smeltingList.get(stack)); |
|
|
||
| @Override | ||
| public float getExperience(org.spongepowered.api.item.inventory.ItemStack stack) { | ||
| return experienceList.get(stack); |
liach
reviewed
Nov 19, 2016
| if (experienceList.remove(stack) != null) { | ||
| return true; | ||
| } | ||
| throw new RuntimeException("It was in one map but not the other?"); |
Contributor
There was a problem hiding this comment.
throw new AssertionError("It was on one map but not the other.");
liach
reviewed
Nov 19, 2016
|
|
||
| @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); |
Contributor
There was a problem hiding this comment.
Is toNative simply for casting?
Contributor
|
Why do you never update submodule? |
Contributor
Author
|
Now with more testing! |
liach
reviewed
Nov 20, 2016
| @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) { |
Contributor
There was a problem hiding this comment.
There should be an OptionalDouble available in java.util.
Contributor
Author
There was a problem hiding this comment.
That exists?!? ..., but it's kind of stupid, it always says it's present even if it's null
fa10699 to
4473c32
Compare
c45c58e to
94a6073
Compare
Limeth
reviewed
Jan 1, 2017
| checkNotNull(ingredient, "ingredient"); | ||
| checkNotNull(result, "result"); | ||
| checkNotNull(experience, "experience"); | ||
| return this; |
There was a problem hiding this comment.
I am confused. This is not how builders are supposed to work.
fe40d11 to
9685e2f
Compare
liach
reviewed
Mar 13, 2017
| return returnVal; | ||
| } | ||
|
|
||
| public static <T> ImmutableMap<T, ItemStackSnapshot> mapItemStackSnapshot(Map<T, ItemStack> map) { |
Contributor
There was a problem hiding this comment.
These should move to util classes.
liach
reviewed
Mar 13, 2017
|
|
||
| @Override | ||
| public Optional<ImmutableCollection<ItemStackSnapshot>> getResults(GridInventory grid) { | ||
| throw new NotImplementedException("TODO"); // dunno how to convert a gridinventory to a IInventory... |
liach
reviewed
Mar 13, 2017
| @Shadow net.minecraft.item.ItemStack getRecipeOutput(); | ||
|
|
||
| @Override | ||
| default ImmutableCollection<ItemStackSnapshot> getResults() { |
Contributor
There was a problem hiding this comment.
Why are you using ImmutableCollection?
Contributor
|
I'm going to close this in favour of #1395. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
API | Common