-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from jaquadro/capabilities2
Capabilities2
- Loading branch information
Showing
78 changed files
with
3,522 additions
and
2,957 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
6 changes: 6 additions & 0 deletions
6
resources/assets/storagedrawers/models/item/upgrade_conversion.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "storagedrawers:items/upgrade_conversion" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
resources/assets/storagedrawers/recipes/upgrade_conversion.json
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"conditions": [{ | ||
"type": "minecraft:item_exists", | ||
"item": "storagedrawers:upgrade_conversion" | ||
}], | ||
"type": "minecraft:crafting_shaped", | ||
"pattern": [ | ||
"#/#", | ||
"/X/", | ||
"#/#" | ||
], | ||
"key": { | ||
"/": { "ore": "stickWood", "type": "forge:ore_dict" }, | ||
"#": { "item": "minecraft:dye", "data": 4 }, | ||
"X": { "item": "storagedrawers:upgrade_template" } | ||
}, | ||
"result": { "item": "storagedrawers:upgrade_conversion" } | ||
} |
Binary file modified
BIN
+10 Bytes
(100%)
resources/assets/storagedrawers/textures/gui/drawers_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+11 Bytes
(100%)
resources/assets/storagedrawers/textures/gui/drawers_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+12 Bytes
(100%)
resources/assets/storagedrawers/textures/gui/drawers_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+12 Bytes
(100%)
resources/assets/storagedrawers/textures/gui/drawers_comp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+488 Bytes
resources/assets/storagedrawers/textures/items/upgrade_conversion.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
59 changes: 59 additions & 0 deletions
59
src/com/jaquadro/minecraft/storagedrawers/api/capabilities/IItemRepository.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package com.jaquadro.minecraft.storagedrawers.api.capabilities; | ||
|
||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.NonNullList; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public interface IItemRepository | ||
{ | ||
/** | ||
* Gets a list of all items in the inventory. The same item may appear multiple times with varying counts. | ||
* | ||
* @return A list of zero or more items in the inventory. | ||
*/ | ||
@Nonnull | ||
NonNullList<ItemRecord> getAllItems (); | ||
|
||
/** | ||
* Inserts an ItemStack into the inventory and returns the remainder. | ||
* | ||
* @param stack ItemStack to insert. | ||
* @param simulate If true, the insertion is only simulated | ||
* @return The remaining ItemStack that was not inserted. If the entire stack was accepted, returns | ||
* ItemStack.EMPTY instead. | ||
*/ | ||
@Nonnull | ||
ItemStack insertItem (@Nonnull ItemStack stack, boolean simulate); | ||
|
||
/** | ||
* Tries to extract the given ItemStack from the inventory. The returned value will be a matching ItemStack | ||
* with a stack size equal to or less than amount, or the empty ItemStack if the item could not be found at all. | ||
* The returned stack size may exceed the itemstack's getMaxStackSize() value. | ||
* | ||
* @param stack The item to extract. The stack size is ignored. | ||
* @param amount Amount to extract (may be greater than the stacks max limit) | ||
* @param simulate If true, the extraction is only simulated | ||
* @return ItemStack extracted from the inventory, or ItemStack.EMPTY if nothing could be extracted. | ||
*/ | ||
@Nonnull | ||
ItemStack extractItem (@Nonnull ItemStack stack, int amount, boolean simulate); | ||
|
||
/** | ||
* An item record representing an item and the amount stored. | ||
* | ||
* The ItemStack held by itemPrototype always reports a stack size of 1. | ||
* IT IS IMPORTANT THAT YOU NEVER MODIFY itemPrototype. | ||
*/ | ||
class ItemRecord | ||
{ | ||
@Nonnull | ||
public final ItemStack itemPrototype; | ||
public final int count; | ||
|
||
public ItemRecord (@Nonnull ItemStack itemPrototype, int count) { | ||
this.itemPrototype = itemPrototype; | ||
this.count = count; | ||
} | ||
} | ||
} |
84 changes: 84 additions & 0 deletions
84
src/com/jaquadro/minecraft/storagedrawers/api/storage/Drawers.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package com.jaquadro.minecraft.storagedrawers.api.storage; | ||
|
||
import net.minecraft.item.ItemStack; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
public class Drawers | ||
{ | ||
public static final IDrawer DISABLED = new DisabledDrawer(); | ||
public static final IFractionalDrawer DISABLED_FRACTIONAL = new DisabledFractionalDrawer(); | ||
|
||
private static class DisabledDrawer implements IDrawer | ||
{ | ||
@Nonnull | ||
@Override | ||
public ItemStack getStoredItemPrototype () { | ||
return ItemStack.EMPTY; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public IDrawer setStoredItem (@Nonnull ItemStack itemPrototype) { | ||
return this; | ||
} | ||
|
||
@Override | ||
public int getStoredItemCount () { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void setStoredItemCount (int amount) { | ||
|
||
} | ||
|
||
@Override | ||
public int getMaxCapacity (@Nonnull ItemStack itemPrototype) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int getRemainingCapacity () { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean canItemBeStored (@Nonnull ItemStack itemPrototype) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean canItemBeExtracted (@Nonnull ItemStack itemPrototype) { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isEmpty () { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean isEnabled () { | ||
return false; | ||
} | ||
} | ||
|
||
private static class DisabledFractionalDrawer extends DisabledDrawer implements IFractionalDrawer | ||
{ | ||
@Override | ||
public int getConversionRate () { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public int getStoredItemRemainder () { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public boolean isSmallestUnit () { | ||
return false; | ||
} | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
src/com/jaquadro/minecraft/storagedrawers/api/storage/EmptyDrawerAttributes.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.jaquadro.minecraft.storagedrawers.api.storage; | ||
|
||
public class EmptyDrawerAttributes implements IDrawerAttributes | ||
{ | ||
public EmptyDrawerAttributes () { } | ||
} |
This file contains 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
Oops, something went wrong.