-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- allow baubles to retain compatibility with mods created for older versions. - BaublesApi.getBaubles now returns IInventory again and a new method has been created to return the new handler if you want to use that instead.
- Loading branch information
Azanor
committed
Oct 4, 2016
1 parent
15ada5d
commit b2a15b8
Showing
10 changed files
with
131 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
gradlew build | ||
pause | ||
cmd /k gradlew build |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
gradlew setupDecompWorkspace eclipse | ||
pause | ||
cmd /k gradlew setupDecompWorkspace eclipse |
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
106 changes: 106 additions & 0 deletions
106
src/main/java/baubles/api/inv/BaublesInventoryWrapper.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,106 @@ | ||
package baubles.api.inv; | ||
|
||
import baubles.api.cap.IBaublesItemHandler; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.inventory.IInventory; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.text.ITextComponent; | ||
import net.minecraft.util.text.TextComponentString; | ||
|
||
public class BaublesInventoryWrapper implements IInventory { | ||
|
||
final IBaublesItemHandler handler; | ||
|
||
public BaublesInventoryWrapper(IBaublesItemHandler handler) { | ||
super(); | ||
this.handler = handler; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "BaublesInventory"; | ||
} | ||
|
||
@Override | ||
public boolean hasCustomName() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public ITextComponent getDisplayName() { | ||
return new TextComponentString(this.getName()); | ||
} | ||
|
||
@Override | ||
public int getSizeInventory() { | ||
return handler.getSlots(); | ||
} | ||
|
||
@Override | ||
public ItemStack getStackInSlot(int index) { | ||
return handler.getStackInSlot(index); | ||
} | ||
|
||
@Override | ||
public ItemStack decrStackSize(int index, int count) { | ||
return handler.extractItem(index, count, false); | ||
} | ||
|
||
@Override | ||
public ItemStack removeStackFromSlot(int index) { | ||
ItemStack out = this.getStackInSlot(index); | ||
handler.setStackInSlot(index, null); | ||
return out; | ||
} | ||
|
||
@Override | ||
public void setInventorySlotContents(int index, ItemStack stack) { | ||
handler.setStackInSlot(index, stack); | ||
} | ||
|
||
@Override | ||
public int getInventoryStackLimit() { | ||
return 64; | ||
} | ||
|
||
@Override | ||
public void markDirty() { } | ||
|
||
@Override | ||
public boolean isUseableByPlayer(EntityPlayer player) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public void openInventory(EntityPlayer player) { } | ||
|
||
@Override | ||
public void closeInventory(EntityPlayer player) { } | ||
|
||
@Override | ||
public boolean isItemValidForSlot(int index, ItemStack stack) { | ||
return handler.isItemValidForSlot(index, stack, null); | ||
} | ||
|
||
@Override | ||
public int getField(int id) { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void setField(int id, int value) {} | ||
|
||
@Override | ||
public int getFieldCount() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
public void clear() { | ||
for (int i = 0; i < this.getSizeInventory(); ++i) | ||
{ | ||
this.setInventorySlotContents(i, null); | ||
} | ||
} | ||
|
||
} |
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