Fix some class attributes being hidden.
This commit is contained in:
@@ -44,19 +44,19 @@ public class ExporterNetworkNode extends NetworkNode implements IComparable, ITy
|
||||
boolean changed = false;
|
||||
|
||||
for (int i = 0; i < itemFilters.getSlots(); ++i) {
|
||||
ItemStack filterSlot = itemFilters.getStackInSlot(i);
|
||||
ItemStack filteredItem = itemFilters.getStackInSlot(i);
|
||||
|
||||
if (filterSlot.getCount() > 1) {
|
||||
filterSlot.setCount(1);
|
||||
if (filteredItem.getCount() > 1) {
|
||||
filteredItem.setCount(1);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < fluidFilters.getSlots(); ++i) {
|
||||
FluidStack filterSlot = fluidFilters.getFluid(i);
|
||||
FluidStack filteredFluid = fluidFilters.getFluid(i);
|
||||
|
||||
if (!filterSlot.isEmpty() && filterSlot.getAmount() != FluidAttributes.BUCKET_VOLUME) {
|
||||
filterSlot.setAmount(FluidAttributes.BUCKET_VOLUME);
|
||||
if (!filteredFluid.isEmpty() && filteredFluid.getAmount() != FluidAttributes.BUCKET_VOLUME) {
|
||||
filteredFluid.setAmount(FluidAttributes.BUCKET_VOLUME);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@@ -113,7 +113,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
||||
}
|
||||
});
|
||||
|
||||
private boolean reading;
|
||||
private boolean readingInventory;
|
||||
|
||||
private final Set<ICraftingGridListener> craftingListeners = new HashSet<>();
|
||||
|
||||
@@ -381,7 +381,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
||||
|
||||
craftingListeners.forEach(ICraftingGridListener::onCraftingMatrixChanged);
|
||||
|
||||
if (!reading) {
|
||||
if (!readingInventory) {
|
||||
markDirty();
|
||||
}
|
||||
}
|
||||
@@ -662,7 +662,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
||||
allowedTagList.readFromNbt(tag.getCompound(NBT_ALLOWED_TAGS));
|
||||
}
|
||||
|
||||
reading = true;
|
||||
readingInventory = true;
|
||||
|
||||
StackUtils.readItems(matrix, 0, tag);
|
||||
StackUtils.readItems(patterns, 1, tag);
|
||||
@@ -681,7 +681,7 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
||||
tabPage = tag.getInt(NBT_TAB_PAGE);
|
||||
}
|
||||
|
||||
reading = false;
|
||||
readingInventory = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -24,7 +24,7 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class FluidStorageCache implements IStorageCache<FluidStack> {
|
||||
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> network -> network.getFluidStorageCache().invalidate(cause);
|
||||
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> invalidatedNetwork -> invalidatedNetwork.getFluidStorageCache().invalidate(cause);
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(FluidStorageCache.class);
|
||||
|
||||
|
@@ -24,7 +24,7 @@ import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class ItemStorageCache implements IStorageCache<ItemStack> {
|
||||
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> network -> network.getItemStorageCache().invalidate(cause);
|
||||
public static final Function<InvalidateCause, Consumer<INetwork>> INVALIDATE_ACTION = cause -> invalidatedNetwork -> invalidatedNetwork.getItemStorageCache().invalidate(cause);
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(ItemStorageCache.class);
|
||||
|
||||
|
@@ -115,19 +115,19 @@ public class StorageDiskManager extends WorldSavedData implements IStorageDiskMa
|
||||
|
||||
@Override
|
||||
public CompoundNBT write(CompoundNBT tag) {
|
||||
ListNBT disks = new ListNBT();
|
||||
ListNBT disksTag = new ListNBT();
|
||||
|
||||
for (Map.Entry<UUID, IStorageDisk> entry : this.disks.entrySet()) {
|
||||
for (Map.Entry<UUID, IStorageDisk> entry : disks.entrySet()) {
|
||||
CompoundNBT diskTag = new CompoundNBT();
|
||||
|
||||
diskTag.putUniqueId(NBT_DISK_ID, entry.getKey());
|
||||
diskTag.put(NBT_DISK_DATA, entry.getValue().writeToNbt());
|
||||
diskTag.putString(NBT_DISK_TYPE, entry.getValue().getFactoryId().toString());
|
||||
|
||||
disks.add(diskTag);
|
||||
disksTag.add(diskTag);
|
||||
}
|
||||
|
||||
tag.put(NBT_DISKS, disks);
|
||||
tag.put(NBT_DISKS, disksTag);
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
@@ -32,8 +32,8 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class GridContainer extends BaseContainer implements ICraftingGridListener {
|
||||
private final IGrid grid;
|
||||
private IStorageCache cache;
|
||||
private IStorageCacheListener listener;
|
||||
private IStorageCache storageCache;
|
||||
private IStorageCacheListener storageCacheListener;
|
||||
private IScreenInfoProvider screenInfoProvider;
|
||||
|
||||
private ResultCraftingGridSlot craftingResultSlot;
|
||||
@@ -247,18 +247,18 @@ public class GridContainer extends BaseContainer implements ICraftingGridListene
|
||||
// The grid is offline.
|
||||
if (grid.getStorageCache() == null) {
|
||||
// The grid just went offline, there is still a listener.
|
||||
if (listener != null) {
|
||||
if (storageCacheListener != null) {
|
||||
// Remove it from the previous cache and clean up.
|
||||
cache.removeListener(listener);
|
||||
storageCache.removeListener(storageCacheListener);
|
||||
|
||||
listener = null;
|
||||
cache = null;
|
||||
storageCacheListener = null;
|
||||
storageCache = null;
|
||||
}
|
||||
} else if (listener == null) { // The grid came online.
|
||||
listener = grid.createListener((ServerPlayerEntity) getPlayer());
|
||||
cache = grid.getStorageCache();
|
||||
} else if (storageCacheListener == null) { // The grid came online.
|
||||
storageCacheListener = grid.createListener((ServerPlayerEntity) getPlayer());
|
||||
storageCache = grid.getStorageCache();
|
||||
|
||||
cache.addListener(listener);
|
||||
storageCache.addListener(storageCacheListener);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -272,8 +272,8 @@ public class GridContainer extends BaseContainer implements ICraftingGridListene
|
||||
if (!player.getEntityWorld().isRemote) {
|
||||
grid.onClosed(player);
|
||||
|
||||
if (cache != null && listener != null) {
|
||||
cache.removeListener(listener);
|
||||
if (storageCache != null && storageCacheListener != null) {
|
||||
storageCache.removeListener(storageCacheListener);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -59,17 +59,14 @@ public class FilterItem extends Item {
|
||||
return new TranslationTextComponent("gui.refinedstorage.filter");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Container createMenu(int windowId, PlayerInventory inventory, PlayerEntity player) {
|
||||
return new FilterContainer(player, inventory.getCurrentItem(), windowId);
|
||||
}
|
||||
});
|
||||
|
||||
return new ActionResult<>(ActionResultType.SUCCESS, stack);
|
||||
}
|
||||
|
||||
return new ActionResult<>(ActionResultType.PASS, stack);
|
||||
return new ActionResult<>(ActionResultType.CONSUME, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -76,7 +76,7 @@ public class FilterScreen extends BaseScreen<FilterContainer> {
|
||||
nameField.setCanLoseFocus(true);
|
||||
nameField.setFocused2(false);
|
||||
nameField.setTextColor(RenderSettings.INSTANCE.getSecondaryColor());
|
||||
nameField.setResponder(name -> sendUpdate());
|
||||
nameField.setResponder(content -> sendUpdate());
|
||||
|
||||
addButton(nameField);
|
||||
|
||||
|
@@ -85,7 +85,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
ItemListLine line = new ItemListLine();
|
||||
|
||||
for (Item item : ItemTags.getCollection().get(owningTag).getAllElements()) {
|
||||
for (Item itemInTag : ItemTags.getCollection().get(owningTag).getAllElements()) {
|
||||
if (itemCount > 0 && itemCount % 8 == 0) {
|
||||
lines.add(line);
|
||||
line = new ItemListLine();
|
||||
@@ -93,7 +93,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
itemCount++;
|
||||
|
||||
line.addItem(new ItemStack(item));
|
||||
line.addItem(new ItemStack(itemInTag));
|
||||
}
|
||||
|
||||
lines.add(line);
|
||||
@@ -108,7 +108,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
FluidListLine line = new FluidListLine();
|
||||
|
||||
for (Fluid fluid : FluidTags.getCollection().get(owningTag).getAllElements()) {
|
||||
for (Fluid fluidInTag : FluidTags.getCollection().get(owningTag).getAllElements()) {
|
||||
if (fluidCount > 0 && fluidCount % 8 == 0) {
|
||||
lines.add(line);
|
||||
line = new FluidListLine();
|
||||
@@ -116,7 +116,7 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
fluidCount++;
|
||||
|
||||
line.addFluid(new FluidStack(fluid, FluidAttributes.BUCKET_VOLUME));
|
||||
line.addFluid(new FluidStack(fluidInTag, FluidAttributes.BUCKET_VOLUME));
|
||||
}
|
||||
|
||||
lines.add(line);
|
||||
@@ -332,8 +332,8 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
for (ItemStack item : items) {
|
||||
renderItem(matrixStack, x + 3, y, item);
|
||||
for (ItemStack itemInList : items) {
|
||||
renderItem(matrixStack, x + 3, y, itemInList);
|
||||
|
||||
x += 17;
|
||||
}
|
||||
@@ -341,9 +341,9 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
@Override
|
||||
public void renderTooltip(MatrixStack matrixStack, int x, int y, int mx, int my) {
|
||||
for (ItemStack item : items) {
|
||||
for (ItemStack itemInList : items) {
|
||||
if (RenderUtils.inBounds(x + 3, y, 16, 16, mx, my)) {
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, item, mx, my, RenderUtils.getTooltipFromItem(item));
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, itemInList, mx, my, RenderUtils.getTooltipFromItem(itemInList));
|
||||
}
|
||||
|
||||
x += 17;
|
||||
@@ -360,8 +360,8 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, int x, int y) {
|
||||
for (FluidStack fluid : fluids) {
|
||||
FluidRenderer.INSTANCE.render(matrixStack, x + 3, y, fluid);
|
||||
for (FluidStack fluidInList : fluids) {
|
||||
FluidRenderer.INSTANCE.render(matrixStack, x + 3, y, fluidInList);
|
||||
|
||||
x += 17;
|
||||
}
|
||||
@@ -369,9 +369,9 @@ public class AlternativesScreen extends BaseScreen<AlternativesContainer> {
|
||||
|
||||
@Override
|
||||
public void renderTooltip(MatrixStack matrixStack, int x, int y, int mx, int my) {
|
||||
for (FluidStack fluid : fluids) {
|
||||
for (FluidStack fluidInList : fluids) {
|
||||
if (RenderUtils.inBounds(x + 3, y, 16, 16, mx, my)) {
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, mx, my, fluid.getDisplayName().getString());
|
||||
AlternativesScreen.this.renderTooltip(matrixStack, mx, my, fluidInList.getDisplayName().getString());
|
||||
}
|
||||
|
||||
x += 17;
|
||||
|
@@ -15,10 +15,10 @@ public class TooltipGridFilter implements Predicate<IGridStack> {
|
||||
|
||||
@Override
|
||||
public boolean test(IGridStack stack) {
|
||||
List<ITextComponent> tooltip = stack.getTooltip(false);
|
||||
List<ITextComponent> stackTooltip = stack.getTooltip(false);
|
||||
|
||||
for (int i = 1; i < tooltip.size(); ++i) {
|
||||
if (tooltip.get(i).getString().toLowerCase().contains(this.tooltip.toLowerCase())) {
|
||||
for (int i = 1; i < stackTooltip.size(); ++i) {
|
||||
if (stackTooltip.get(i).getString().toLowerCase().contains(tooltip.toLowerCase())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -49,10 +49,10 @@ public abstract class BaseGridView implements IGridView {
|
||||
return;
|
||||
}
|
||||
|
||||
List<IGridStack> stacks = new ArrayList<>();
|
||||
List<IGridStack> newStacks = new ArrayList<>();
|
||||
|
||||
if (screen.getGrid().isGridActive()) {
|
||||
stacks.addAll(map.values());
|
||||
newStacks.addAll(map.values());
|
||||
|
||||
IGrid grid = screen.getGrid();
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class BaseGridView implements IGridView {
|
||||
(grid.getTabSelected() >= 0 && grid.getTabSelected() < grid.getTabs().size()) ? grid.getTabs().get(grid.getTabSelected()).getFilters() : grid.getFilters()
|
||||
);
|
||||
|
||||
stacks.removeIf(stack -> {
|
||||
newStacks.removeIf(stack -> {
|
||||
// If this is a crafting stack,
|
||||
// and there is a regular matching stack in the view too,
|
||||
// and we aren't in "view only craftables" mode,
|
||||
@@ -85,16 +85,16 @@ public abstract class BaseGridView implements IGridView {
|
||||
|
||||
SortingDirection sortingDirection = grid.getSortingDirection() == IGrid.SORTING_DIRECTION_DESCENDING ? SortingDirection.DESCENDING : SortingDirection.ASCENDING;
|
||||
|
||||
stacks.sort((left, right) -> defaultSorter.compare(left, right, sortingDirection));
|
||||
newStacks.sort((left, right) -> defaultSorter.compare(left, right, sortingDirection));
|
||||
|
||||
for (IGridSorter sorter : sorters) {
|
||||
if (sorter.isApplicable(grid)) {
|
||||
stacks.sort((left, right) -> sorter.compare(left, right, sortingDirection));
|
||||
newStacks.sort((left, right) -> sorter.compare(left, right, sortingDirection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.stacks = stacks;
|
||||
this.stacks = newStacks;
|
||||
|
||||
this.screen.updateScrollbar();
|
||||
}
|
||||
|
@@ -107,16 +107,16 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
||||
storage = null;
|
||||
cache = null;
|
||||
} else {
|
||||
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) player.world).getByStack(getDiskInventory().getStackInSlot(0));
|
||||
IStorageDisk diskInSlot = API.instance().getStorageDiskManager((ServerWorld) player.world).getByStack(getDiskInventory().getStackInSlot(0));
|
||||
|
||||
if (disk != null) {
|
||||
if (diskInSlot != null) {
|
||||
StorageType type = ((IStorageDiskProvider) getDiskInventory().getStackInSlot(0).getItem()).getType();
|
||||
|
||||
if (type == StorageType.ITEM) {
|
||||
storage = new PortableItemStorageDisk(disk, PortableGrid.this);
|
||||
storage = new PortableItemStorageDisk(diskInSlot, PortableGrid.this);
|
||||
cache = new PortableItemStorageCache(PortableGrid.this);
|
||||
} else if (type == StorageType.FLUID) {
|
||||
storage = new PortableFluidStorageDisk(disk, PortableGrid.this);
|
||||
storage = new PortableFluidStorageDisk(diskInSlot, PortableGrid.this);
|
||||
cache = new PortableFluidStorageCache(PortableGrid.this);
|
||||
}
|
||||
|
||||
@@ -186,20 +186,17 @@ public class PortableGrid implements IGrid, IPortableGrid, IStorageDiskContainer
|
||||
@Override
|
||||
public void drainEnergy(int energy) {
|
||||
if (RS.SERVER_CONFIG.getPortableGrid().getUseEnergy() && ((PortableGridBlockItem) stack.getItem()).getType() != PortableGridBlockItem.Type.CREATIVE) {
|
||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
||||
|
||||
if (storage != null) {
|
||||
storage.extractEnergy(energy, false);
|
||||
}
|
||||
stack.getCapability(CapabilityEnergy.ENERGY, null)
|
||||
.ifPresent(energyStorage -> energyStorage.extractEnergy(energy, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergy() {
|
||||
if (RS.SERVER_CONFIG.getPortableGrid().getUseEnergy() && ((PortableGridBlockItem) stack.getItem()).getType() != PortableGridBlockItem.Type.CREATIVE) {
|
||||
IEnergyStorage storage = stack.getCapability(CapabilityEnergy.ENERGY, null).orElse(null);
|
||||
|
||||
return storage == null ? RS.SERVER_CONFIG.getPortableGrid().getCapacity() : storage.getEnergyStored();
|
||||
return stack.getCapability(CapabilityEnergy.ENERGY, null)
|
||||
.map(IEnergyStorage::getEnergyStored)
|
||||
.orElse(RS.SERVER_CONFIG.getPortableGrid().getCapacity());
|
||||
}
|
||||
|
||||
return RS.SERVER_CONFIG.getPortableGrid().getCapacity();
|
||||
|
@@ -194,16 +194,16 @@ public class PortableGridTile extends BaseTile implements ITickableTileEntity, I
|
||||
this.storage = null;
|
||||
this.cache = null;
|
||||
} else {
|
||||
IStorageDisk disk = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(getDiskInventory().getStackInSlot(0));
|
||||
IStorageDisk diskInSlot = API.instance().getStorageDiskManager((ServerWorld) world).getByStack(getDiskInventory().getStackInSlot(0));
|
||||
|
||||
if (disk != null) {
|
||||
StorageType type = ((IStorageDiskProvider) getDiskInventory().getStackInSlot(0).getItem()).getType();
|
||||
if (diskInSlot != null) {
|
||||
StorageType diskType = ((IStorageDiskProvider) getDiskInventory().getStackInSlot(0).getItem()).getType();
|
||||
|
||||
if (type == StorageType.ITEM) {
|
||||
this.storage = new PortableItemStorageDisk(disk, this);
|
||||
if (diskType == StorageType.ITEM) {
|
||||
this.storage = new PortableItemStorageDisk(diskInSlot, this);
|
||||
this.cache = new PortableItemStorageCache(this);
|
||||
} else if (type == StorageType.FLUID) {
|
||||
this.storage = new PortableFluidStorageDisk(disk, this);
|
||||
} else if (diskType == StorageType.FLUID) {
|
||||
this.storage = new PortableFluidStorageDisk(diskInSlot, this);
|
||||
this.cache = new PortableFluidStorageCache(this);
|
||||
}
|
||||
|
||||
@@ -236,9 +236,7 @@ public class PortableGridTile extends BaseTile implements ITickableTileEntity, I
|
||||
this.tabPage = WirelessGridItem.getTabPage(stack);
|
||||
this.size = WirelessGridItem.getSize(stack);
|
||||
|
||||
IEnergyStorage energyStorage = stack.getCapability(CapabilityEnergy.ENERGY).orElse(null);
|
||||
|
||||
this.energyStorage = createEnergyStorage(energyStorage != null ? energyStorage.getEnergyStored() : 0);
|
||||
this.energyStorage = createEnergyStorage(stack.getCapability(CapabilityEnergy.ENERGY).map(IEnergyStorage::getEnergyStored).orElse(0));
|
||||
|
||||
if (stack.hasTag()) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
|
Reference in New Issue
Block a user