Merge branch '1.16' into feature/sapper

This commit is contained in:
Justin Vitale 2020-07-07 19:07:44 +10:00
commit 1c07084416
4 changed files with 57 additions and 3 deletions

View file

@ -61,7 +61,8 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
protected RebornInventory<StorageUnitBaseBlockEntity> inventory;
private int maxCapacity;
private boolean shouldUpdate = false;
private boolean shouldUpdate = true;
private int prevCount = -1;
private ItemStack storeItemStack;
@ -118,6 +119,12 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
}
}
// Update for locked item for clients
if(isLocked() && prevCount != this.getCurrentCapacity()){
prevCount = this.getCurrentCapacity();
syncWithAll();
}
if (shouldUpdate) {
inventory.setChanged();
@ -421,12 +428,13 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
}
public void setLocked(boolean value) {
// Only set lockedItem in response to user input
if (isLocked() == value) {
return;
}
// Only set lockedItem in response to user input
lockedItemStack = value ? getStoredStack().copy() : ItemStack.EMPTY;
syncWithAll();
}
public boolean canModifyLocking() {
@ -448,9 +456,16 @@ public class StorageUnitBaseBlockEntity extends MachineBaseBlockEntity
@Override
public boolean isValid(int slot, ItemStack stack) {
if (slot == INPUT_SLOT && isLocked()) {
return ItemUtils.isItemEqual(lockedItemStack, stack, true, true);
}
if (slot == INPUT_SLOT && !(isEmpty() || isSameType(stack))) {
return false;
}
return super.isValid(slot, stack);
}
}

View file

@ -50,6 +50,8 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
// Draw slots
drawSlot(matrixStack, 100, 53, layer);
drawSlot(matrixStack, 140, 53, layer);
builder.drawLockButton(matrixStack,this, 150, 4, mouseX, mouseY, layer, storageEntity.isLocked());
}
@Override
@ -64,7 +66,7 @@ public class GuiStorageUnit extends GuiBase<BuiltScreenHandler> {
textRenderer.draw(matrixStack, new TranslatableText("techreborn.tooltip.unit.empty"), 10, 20, 4210752);
} else {
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.store"), 10, 20, 4210752);
textRenderer.draw(matrixStack, storageEntity.getStoredStack().getName(), 10, 30, 4210752);
textRenderer.draw(matrixStack, storageEntity.getDisplayedStack().getName(), 10, 30, 4210752);
textRenderer.draw(matrixStack, new TranslatableText("gui.techreborn.storage.amount"), 10, 50, 4210752);
textRenderer.draw(matrixStack, String.valueOf(storageEntity.getCurrentCapacity()), 10, 60, 4210752);

View file

@ -0,0 +1,18 @@
{
"type": "techreborn:grinder",
"power": 2,
"time": 200,
"ingredients": [
{
"tag": "c:sulfurs"
}
],
"results": [
{
"item": "techreborn:sulfur_dust"
}
],
"conditions": {
"reborncore:tag": "c:sulfurs"
}
}

View file

@ -0,0 +1,19 @@
{
"type": "techreborn:grinder",
"power": 2,
"time": 220,
"ingredients": [
{
"tag": "c:sulfur_ores"
}
],
"results": [
{
"item": "techreborn:sulfur_dust",
"count": 2
}
],
"conditions": {
"reborncore:tag": "c:sulfur_ores"
}
}