-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inventory System #2
Open
dagger8243
wants to merge
5
commits into
BlueWeabo:master
Choose a base branch
from
dagger8243:dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6d42fae
Data class
dagger8243 113ce14
Merge remote-tracking branch 'origin' into dev
dagger8243 c50ed41
Data classes
dagger8243 5919aa5
Spotless Apply and changes to public
dagger8243 f9a7f1d
1. Separated item and fluid inventories
dagger8243 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
23 changes: 23 additions & 0 deletions
23
src/main/java/com/gtnewhorizons/mutecore/api/inventories/InventoryBase.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,23 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
import java.util.UUID; | ||
|
||
public class InventoryBase { | ||
|
||
// Config related data | ||
public int maxPerSlot; | ||
public int maxSlots; | ||
|
||
// Identifiers | ||
private UUID KEY; | ||
public String name; | ||
|
||
public InventoryBase(int maxPerSlot, int maxSlots) { | ||
this.maxPerSlot = maxPerSlot; | ||
this.maxSlots = maxSlots; | ||
} | ||
|
||
public UUID getKey() { | ||
return this.KEY; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/com/gtnewhorizons/mutecore/api/inventories/InventoryFluid.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,35 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
import com.cleanroommc.modularui.utils.fluid.FluidTankLong; | ||
import com.gtnewhorizons.mutecore.api.data.WorldStateValidator; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
|
||
public class InventoryFluid extends InventoryBase implements WorldStateValidator { | ||
|
||
private FluidTankLong[] fluids; | ||
|
||
private final String NBTTAG_KEY = "MuTEFluidInventory"; | ||
|
||
public InventoryFluid(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
this.fluids = new FluidTankLong[maxSlots]; | ||
} | ||
|
||
@Override | ||
public void save(NBTTagCompound nbt) { | ||
|
||
} | ||
|
||
@Override | ||
public void load(NBTTagCompound nbt) { | ||
|
||
} | ||
|
||
public FluidTankLong getFluid(int index) { | ||
return this.fluids[index]; | ||
} | ||
|
||
public void setFluid(int index, FluidTankLong fluid) { | ||
this.fluids[index] = fluid; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gtnewhorizons/mutecore/api/inventories/InventoryInputFluid.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,7 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
public class InventoryInputFluid extends InventoryFluid { | ||
public InventoryInputFluid(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/com/gtnewhorizons/mutecore/api/inventories/InventoryManager.java
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not needed. |
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,8 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
/* | ||
* For logic | ||
*/ | ||
public class InventoryManager { | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gtnewhorizons/mutecore/api/inventories/InventoryOutputFluid.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,7 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
public class InventoryOutputFluid extends InventoryFluid { | ||
public InventoryOutputFluid(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gtnewhorizons/mutecore/api/inventories/ItemInputInventory.java
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The way that it done, input will either be overriden or override ItemOutput. |
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,7 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
public class ItemInputInventory extends ItemInventory { | ||
public ItemInputInventory(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/com/gtnewhorizons/mutecore/api/inventories/ItemInventory.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,50 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
import com.cleanroommc.modularui.utils.item.ItemStackLong; | ||
import com.gtnewhorizons.mutecore.api.data.WorldStateValidator; | ||
import net.minecraft.nbt.NBTTagCompound; | ||
import net.minecraft.nbt.NBTTagList; | ||
|
||
public class ItemInventory extends InventoryBase implements WorldStateValidator { | ||
|
||
private ItemStackLong[] items; | ||
|
||
private final String NBTTAG_KEY = "MuTEItemInventory"; | ||
|
||
public ItemInventory(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
this.items = new ItemStackLong[maxSlots]; | ||
} | ||
|
||
@Override | ||
public void save(NBTTagCompound nbt) { | ||
// no clue if this works, idea was to shove items under its | ||
// own NBT compound tag for easier read when/if needed | ||
|
||
// even less of a clue what to name these variables | ||
NBTTagCompound inv = nbt.getCompoundTag(NBTTAG_KEY); | ||
NBTTagList itemList = new NBTTagList(); | ||
|
||
for (ItemStackLong item : items) { | ||
NBTTagCompound entry = new NBTTagCompound(); | ||
item.writeToNBT(entry); | ||
itemList.appendTag(entry); | ||
} | ||
|
||
inv.setTag("Items", itemList); | ||
inv.setString("UUID", this.getKey().toString()); | ||
} | ||
|
||
@Override | ||
public void load(NBTTagCompound nbt) { | ||
// for (???) { items.add(ItemStackLong.loadFromNBT(???)); } | ||
} | ||
|
||
public ItemStackLong getItem(int index) { | ||
return this.items[index]; | ||
} | ||
|
||
public void setItem(int index, ItemStackLong item) { | ||
this.items[index] = item; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/com/gtnewhorizons/mutecore/api/inventories/ItemOutputInventory.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,7 @@ | ||
package com.gtnewhorizons.mutecore.api.inventories; | ||
|
||
public class ItemOutputInventory extends ItemInventory { | ||
public ItemOutputInventory(int maxPerSlot, int maxSlots) { | ||
super(maxPerSlot, maxSlots); | ||
} | ||
} |
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
5 changes: 2 additions & 3 deletions
5
src/main/java/com/gtnewhorizons/mutecore/api/render/MuTEIcon.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
4 changes: 3 additions & 1 deletion
4
src/main/java/com/gtnewhorizons/mutecore/api/render/MuTERender.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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
package com.gtnewhorizons.mutecore.api.render; | ||
|
||
import dev.dominion.ecs.api.Entity; | ||
import net.minecraft.client.renderer.RenderBlocks; | ||
import net.minecraft.world.IBlockAccess; | ||
|
||
import dev.dominion.ecs.api.Entity; | ||
|
||
public interface MuTERender { | ||
|
||
void render(Entity entity, RenderBlocks render, int x, int y, int z, IBlockAccess world); | ||
} |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing a getter for size of inventory and max contained per slot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those are maxSlots and maxPerSlot respectively, public fields so didnt think it needed getters