More SonarQube fixes.
This commit is contained in:
@@ -9,18 +9,34 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public final class RSLootFunctions {
|
public final class RSLootFunctions {
|
||||||
public static LootFunctionType STORAGE_BLOCK;
|
private static LootFunctionType storageBlock;
|
||||||
public static LootFunctionType PORTABLE_GRID;
|
private static LootFunctionType portableGrid;
|
||||||
public static LootFunctionType CRAFTER;
|
private static LootFunctionType crafter;
|
||||||
public static LootFunctionType CONTROLLER;
|
private static LootFunctionType controller;
|
||||||
|
|
||||||
private RSLootFunctions() {
|
private RSLootFunctions() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
STORAGE_BLOCK = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "storage_block"), new LootFunctionType(new StorageBlockLootFunction.Serializer()));
|
storageBlock = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "storage_block"), new LootFunctionType(new StorageBlockLootFunction.Serializer()));
|
||||||
PORTABLE_GRID = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "portable_grid"), new LootFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
portableGrid = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "portable_grid"), new LootFunctionType(new PortableGridBlockLootFunction.Serializer()));
|
||||||
CRAFTER = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "crafter"), new LootFunctionType(new CrafterLootFunction.Serializer()));
|
crafter = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "crafter"), new LootFunctionType(new CrafterLootFunction.Serializer()));
|
||||||
CONTROLLER = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "controller"), new LootFunctionType(new ControllerLootFunction.Serializer()));
|
controller = Registry.register(Registry.LOOT_FUNCTION_TYPE, new ResourceLocation(RS.ID, "controller"), new LootFunctionType(new ControllerLootFunction.Serializer()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LootFunctionType getStorageBlock() {
|
||||||
|
return storageBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LootFunctionType getPortableGrid() {
|
||||||
|
return portableGrid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LootFunctionType getCrafter() {
|
||||||
|
return crafter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static LootFunctionType getController() {
|
||||||
|
return controller;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -125,7 +125,7 @@ public class CraftingCalculator {
|
|||||||
} else if (node instanceof ProcessingNode) {
|
} else if (node instanceof ProcessingNode) {
|
||||||
ProcessingNode processing = (ProcessingNode) node;
|
ProcessingNode processing = (ProcessingNode) node;
|
||||||
|
|
||||||
calculateForFluids(qty, storageSource, fluidStorageSource, results, fluidResults, pattern, inputs, fluidsToExtract, processing);
|
calculateForFluids(qty, storageSource, fluidStorageSource, results, fluidResults, inputs, fluidsToExtract, processing);
|
||||||
|
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
results.add(output, output.getCount() * qty);
|
results.add(output, output.getCount() * qty);
|
||||||
@@ -241,7 +241,6 @@ public class CraftingCalculator {
|
|||||||
IStackList<FluidStack> fluidStorageSource,
|
IStackList<FluidStack> fluidStorageSource,
|
||||||
IStackList<ItemStack> results,
|
IStackList<ItemStack> results,
|
||||||
IStackList<FluidStack> fluidResults,
|
IStackList<FluidStack> fluidResults,
|
||||||
ICraftingPattern pattern,
|
|
||||||
CraftingPatternInputs inputs,
|
CraftingPatternInputs inputs,
|
||||||
IStackList<FluidStack> fluidsToExtract,
|
IStackList<FluidStack> fluidsToExtract,
|
||||||
ProcessingNode node) throws CraftingCalculatorException {
|
ProcessingNode node) throws CraftingCalculatorException {
|
||||||
@@ -335,9 +334,30 @@ public class CraftingCalculator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int getQuantityPerCraft(@Nullable ItemStack item, @Nullable FluidStack fluid, ICraftingPattern pattern) {
|
private int getQuantityPerCraft(@Nullable ItemStack item, @Nullable FluidStack fluid, ICraftingPattern pattern) {
|
||||||
|
if (item != null) {
|
||||||
|
return getQuantityPerCraftForItem(item, pattern);
|
||||||
|
} else if (fluid != null) {
|
||||||
|
return getQuantityPerCraftForFluid(fluid, pattern);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getQuantityPerCraftForFluid(FluidStack fluid, ICraftingPattern pattern) {
|
||||||
|
int qty = 0;
|
||||||
|
|
||||||
|
for (FluidStack output : pattern.getFluidOutputs()) {
|
||||||
|
if (API.instance().getComparer().isEqual(output, fluid, IComparer.COMPARE_NBT)) {
|
||||||
|
qty += output.getAmount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return qty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getQuantityPerCraftForItem(ItemStack item, ICraftingPattern pattern) {
|
||||||
int qty = 0;
|
int qty = 0;
|
||||||
|
|
||||||
if (item != null) {
|
|
||||||
for (ItemStack output : pattern.getOutputs()) {
|
for (ItemStack output : pattern.getOutputs()) {
|
||||||
if (API.instance().getComparer().isEqualNoQuantity(output, item)) {
|
if (API.instance().getComparer().isEqualNoQuantity(output, item)) {
|
||||||
qty += output.getCount();
|
qty += output.getCount();
|
||||||
@@ -347,13 +367,6 @@ public class CraftingCalculator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (fluid != null) {
|
|
||||||
for (FluidStack output : pattern.getFluidOutputs()) {
|
|
||||||
if (API.instance().getComparer().isEqual(output, fluid, IComparer.COMPARE_NBT)) {
|
|
||||||
qty += output.getAmount();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return qty;
|
return qty;
|
||||||
}
|
}
|
||||||
|
@@ -287,7 +287,11 @@ public class GridNetworkNode extends NetworkNode implements INetworkAwareGrid, I
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public IStorageCache getStorageCache() {
|
public IStorageCache getStorageCache() {
|
||||||
return network != null ? (type == GridType.FLUID ? network.getFluidStorageCache() : network.getItemStorageCache()) : null;
|
if (network != null) {
|
||||||
|
return type == GridType.FLUID ? network.getFluidStorageCache() : network.getItemStorageCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@@ -27,9 +27,18 @@ public class BlockModels {
|
|||||||
generator.getVariantBuilder(block)
|
generator.getVariantBuilder(block)
|
||||||
.forAllStates(state -> {
|
.forAllStates(state -> {
|
||||||
Direction dir = state.get(BlockDirection.ANY.getProperty());
|
Direction dir = state.get(BlockDirection.ANY.getProperty());
|
||||||
|
|
||||||
|
int xRotation = 0;
|
||||||
|
if (dir == Direction.DOWN) {
|
||||||
|
xRotation = 180;
|
||||||
|
}
|
||||||
|
if (dir.getAxis().isHorizontal()) {
|
||||||
|
xRotation = 90;
|
||||||
|
}
|
||||||
|
|
||||||
return ConfiguredModel.builder()
|
return ConfiguredModel.builder()
|
||||||
.modelFile(modelFunc.apply(state))
|
.modelFile(modelFunc.apply(state))
|
||||||
.rotationX(dir == Direction.DOWN ? 180 : dir.getAxis().isHorizontal() ? 90 : 0)
|
.rotationX(xRotation)
|
||||||
.rotationY(dir.getAxis().isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + angleOffset) % 360)
|
.rotationY(dir.getAxis().isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + angleOffset) % 360)
|
||||||
.build();
|
.build();
|
||||||
});
|
});
|
||||||
@@ -39,9 +48,17 @@ public class BlockModels {
|
|||||||
generator.getVariantBuilder(block)
|
generator.getVariantBuilder(block)
|
||||||
.forAllStates(state -> {
|
.forAllStates(state -> {
|
||||||
Direction dir = state.get(BlockDirection.ANY.getProperty());
|
Direction dir = state.get(BlockDirection.ANY.getProperty());
|
||||||
|
|
||||||
|
int xRotation;
|
||||||
|
if (dir.getAxis() == Direction.Axis.Y) {
|
||||||
|
xRotation = dir == Direction.UP ? 180 : 0;
|
||||||
|
} else {
|
||||||
|
xRotation = dir.getAxis().isHorizontal() ? 90 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
return ConfiguredModel.builder()
|
return ConfiguredModel.builder()
|
||||||
.modelFile(modelFunc.apply(state))
|
.modelFile(modelFunc.apply(state))
|
||||||
.rotationX(dir.getAxis() == Direction.Axis.Y ? (dir == Direction.UP ? 180 : 0) : dir.getAxis().isHorizontal() ? 90 : 0)
|
.rotationX(xRotation)
|
||||||
.rotationY(dir.getAxis().isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + angleOffset) % 360)
|
.rotationY(dir.getAxis().isVertical() ? 0 : (((int) dir.getHorizontalAngle()) + angleOffset) % 360)
|
||||||
.build();
|
.build();
|
||||||
});
|
});
|
||||||
|
@@ -34,7 +34,7 @@ public class ControllerLootFunction extends LootFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootFunctionType func_230425_b_() {
|
public LootFunctionType func_230425_b_() {
|
||||||
return RSLootFunctions.CONTROLLER;
|
return RSLootFunctions.getController();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LootFunction.Builder<?> builder() {
|
public static LootFunction.Builder<?> builder() {
|
||||||
|
@@ -36,7 +36,7 @@ public class CrafterLootFunction extends LootFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootFunctionType func_230425_b_() {
|
public LootFunctionType func_230425_b_() {
|
||||||
return RSLootFunctions.CRAFTER;
|
return RSLootFunctions.getCrafter();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LootFunction.Builder<?> builder() {
|
public static LootFunction.Builder<?> builder() {
|
||||||
|
@@ -30,7 +30,7 @@ public class PortableGridBlockLootFunction extends LootFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootFunctionType func_230425_b_() {
|
public LootFunctionType func_230425_b_() {
|
||||||
return RSLootFunctions.PORTABLE_GRID;
|
return RSLootFunctions.getPortableGrid();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootFunction.Serializer<PortableGridBlockLootFunction> {
|
public static class Serializer extends LootFunction.Serializer<PortableGridBlockLootFunction> {
|
||||||
|
@@ -51,7 +51,7 @@ public class StorageBlockLootFunction extends LootFunction {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LootFunctionType func_230425_b_() {
|
public LootFunctionType func_230425_b_() {
|
||||||
return RSLootFunctions.STORAGE_BLOCK;
|
return RSLootFunctions.getStorageBlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Serializer extends LootFunction.Serializer<StorageBlockLootFunction> {
|
public static class Serializer extends LootFunction.Serializer<StorageBlockLootFunction> {
|
||||||
|
@@ -356,7 +356,7 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
public abstract void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY);
|
public abstract void renderForeground(MatrixStack matrixStack, int mouseX, int mouseY);
|
||||||
|
|
||||||
public static <T> void executeLater(Class<T> clazz, Consumer<T> callback) {
|
public static <T> void executeLater(Class<T> clazz, Consumer<T> callback) {
|
||||||
ACTIONS.computeIfAbsent(clazz, eky -> new ArrayDeque<>()).add(callback);
|
ACTIONS.computeIfAbsent(clazz, key -> new ArrayDeque<>()).add(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void executeLater(Consumer<ContainerScreen> callback) {
|
public static void executeLater(Consumer<ContainerScreen> callback) {
|
||||||
|
@@ -91,7 +91,16 @@ public class CrafterManagerScreen extends BaseScreen<CrafterManagerContainer> im
|
|||||||
for (int i = 0; i < rows; ++i) {
|
for (int i = 0; i < rows; ++i) {
|
||||||
yy += 18;
|
yy += 18;
|
||||||
|
|
||||||
blit(matrixStack, x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize, 18);
|
int yTextureStart = getTopHeight();
|
||||||
|
if (i > 0) {
|
||||||
|
if (i == rows - 1) {
|
||||||
|
yTextureStart += 18 * 2;
|
||||||
|
} else {
|
||||||
|
yTextureStart += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blit(matrixStack, x, yy, 0, yTextureStart, xSize, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
yy += 18;
|
yy += 18;
|
||||||
|
@@ -15,12 +15,14 @@ public class DiskDriveScreen extends StorageScreen<DiskDriveContainer> {
|
|||||||
inventory,
|
inventory,
|
||||||
title,
|
title,
|
||||||
"gui/disk_drive.png",
|
"gui/disk_drive.png",
|
||||||
|
new StorageScreenTileDataParameters(
|
||||||
DiskDriveTile.TYPE,
|
DiskDriveTile.TYPE,
|
||||||
NetworkNodeTile.REDSTONE_MODE,
|
NetworkNodeTile.REDSTONE_MODE,
|
||||||
DiskDriveTile.COMPARE,
|
DiskDriveTile.COMPARE,
|
||||||
DiskDriveTile.WHITELIST_BLACKLIST,
|
DiskDriveTile.WHITELIST_BLACKLIST,
|
||||||
DiskDriveTile.PRIORITY,
|
DiskDriveTile.PRIORITY,
|
||||||
DiskDriveTile.ACCESS_TYPE,
|
DiskDriveTile.ACCESS_TYPE
|
||||||
|
),
|
||||||
DiskDriveTile.STORED::getValue,
|
DiskDriveTile.STORED::getValue,
|
||||||
DiskDriveTile.CAPACITY::getValue
|
DiskDriveTile.CAPACITY::getValue
|
||||||
);
|
);
|
||||||
|
@@ -13,12 +13,14 @@ public class ExternalStorageScreen extends StorageScreen<ExternalStorageContaine
|
|||||||
inventory,
|
inventory,
|
||||||
title,
|
title,
|
||||||
"gui/storage.png",
|
"gui/storage.png",
|
||||||
|
new StorageScreenTileDataParameters(
|
||||||
ExternalStorageTile.TYPE,
|
ExternalStorageTile.TYPE,
|
||||||
NetworkNodeTile.REDSTONE_MODE,
|
NetworkNodeTile.REDSTONE_MODE,
|
||||||
ExternalStorageTile.COMPARE,
|
ExternalStorageTile.COMPARE,
|
||||||
ExternalStorageTile.WHITELIST_BLACKLIST,
|
ExternalStorageTile.WHITELIST_BLACKLIST,
|
||||||
ExternalStorageTile.PRIORITY,
|
ExternalStorageTile.PRIORITY,
|
||||||
ExternalStorageTile.ACCESS_TYPE,
|
ExternalStorageTile.ACCESS_TYPE
|
||||||
|
),
|
||||||
ExternalStorageTile.STORED::getValue,
|
ExternalStorageTile.STORED::getValue,
|
||||||
ExternalStorageTile.CAPACITY::getValue
|
ExternalStorageTile.CAPACITY::getValue
|
||||||
);
|
);
|
||||||
|
@@ -13,12 +13,14 @@ public class FluidStorageBlockScreen extends StorageScreen<FluidStorageContainer
|
|||||||
inventory,
|
inventory,
|
||||||
title,
|
title,
|
||||||
"gui/storage.png",
|
"gui/storage.png",
|
||||||
|
new StorageScreenTileDataParameters(
|
||||||
null,
|
null,
|
||||||
NetworkNodeTile.REDSTONE_MODE,
|
NetworkNodeTile.REDSTONE_MODE,
|
||||||
FluidStorageTile.COMPARE,
|
FluidStorageTile.COMPARE,
|
||||||
FluidStorageTile.WHITELIST_BLACKLIST,
|
FluidStorageTile.WHITELIST_BLACKLIST,
|
||||||
FluidStorageTile.PRIORITY,
|
FluidStorageTile.PRIORITY,
|
||||||
FluidStorageTile.ACCESS_TYPE,
|
FluidStorageTile.ACCESS_TYPE
|
||||||
|
),
|
||||||
FluidStorageTile.STORED::getValue,
|
FluidStorageTile.STORED::getValue,
|
||||||
() -> (long) ((FluidStorageTile) container.getTile()).getFluidStorageType().getCapacity()
|
() -> (long) ((FluidStorageTile) container.getTile()).getFluidStorageType().getCapacity()
|
||||||
);
|
);
|
||||||
|
@@ -13,12 +13,14 @@ public class StorageBlockScreen extends StorageScreen<StorageContainer> {
|
|||||||
inventory,
|
inventory,
|
||||||
title,
|
title,
|
||||||
"gui/storage.png",
|
"gui/storage.png",
|
||||||
|
new StorageScreenTileDataParameters(
|
||||||
null,
|
null,
|
||||||
NetworkNodeTile.REDSTONE_MODE,
|
NetworkNodeTile.REDSTONE_MODE,
|
||||||
StorageTile.COMPARE,
|
StorageTile.COMPARE,
|
||||||
StorageTile.WHITELIST_BLACKLIST,
|
StorageTile.WHITELIST_BLACKLIST,
|
||||||
StorageTile.PRIORITY,
|
StorageTile.PRIORITY,
|
||||||
StorageTile.ACCESS_TYPE,
|
StorageTile.ACCESS_TYPE
|
||||||
|
),
|
||||||
StorageTile.STORED::getValue,
|
StorageTile.STORED::getValue,
|
||||||
() -> (long) ((StorageTile) container.getTile()).getItemStorageType().getCapacity()
|
() -> (long) ((StorageTile) container.getTile()).getItemStorageType().getCapacity()
|
||||||
);
|
);
|
||||||
|
@@ -2,10 +2,8 @@ package com.refinedmods.refinedstorage.screen;
|
|||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.refinedmods.refinedstorage.RS;
|
import com.refinedmods.refinedstorage.RS;
|
||||||
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
|
||||||
import com.refinedmods.refinedstorage.apiimpl.API;
|
import com.refinedmods.refinedstorage.apiimpl.API;
|
||||||
import com.refinedmods.refinedstorage.screen.widget.sidebutton.*;
|
import com.refinedmods.refinedstorage.screen.widget.sidebutton.*;
|
||||||
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
|
||||||
import com.refinedmods.refinedstorage.util.RenderUtils;
|
import com.refinedmods.refinedstorage.util.RenderUtils;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
@@ -14,7 +12,6 @@ import net.minecraft.util.text.ITextComponent;
|
|||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.util.text.TranslationTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
||||||
@@ -24,12 +21,7 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
|||||||
private static final int BAR_HEIGHT = 70;
|
private static final int BAR_HEIGHT = 70;
|
||||||
|
|
||||||
private final String texture;
|
private final String texture;
|
||||||
private final TileDataParameter<Integer, ?> typeParameter;
|
private final StorageScreenTileDataParameters dataParameters;
|
||||||
private final TileDataParameter<Integer, ?> redstoneModeParameter;
|
|
||||||
private final TileDataParameter<Integer, ?> exactModeParameter;
|
|
||||||
private final TileDataParameter<Integer, ?> whitelistBlacklistParameter;
|
|
||||||
private final TileDataParameter<Integer, ?> priorityParameter;
|
|
||||||
private final TileDataParameter<AccessType, ?> accessTypeParameter;
|
|
||||||
private final Supplier<Long> storedSupplier;
|
private final Supplier<Long> storedSupplier;
|
||||||
private final Supplier<Long> capacitySupplier;
|
private final Supplier<Long> capacitySupplier;
|
||||||
|
|
||||||
@@ -37,51 +29,50 @@ public class StorageScreen<T extends Container> extends BaseScreen<T> {
|
|||||||
PlayerInventory inventory,
|
PlayerInventory inventory,
|
||||||
ITextComponent title,
|
ITextComponent title,
|
||||||
String texture,
|
String texture,
|
||||||
@Nullable TileDataParameter<Integer, ?> typeParameter,
|
StorageScreenTileDataParameters dataParameters,
|
||||||
@Nullable TileDataParameter<Integer, ?> redstoneModeParameter,
|
Supplier<Long> storedSupplier,
|
||||||
@Nullable TileDataParameter<Integer, ?> exactModeParameter,
|
Supplier<Long> capacitySupplier) {
|
||||||
@Nullable TileDataParameter<Integer, ?> whitelistBlacklistParameter,
|
|
||||||
TileDataParameter<Integer, ?> priorityParameter,
|
|
||||||
@Nullable TileDataParameter<AccessType, ?> accessTypeParameter,
|
|
||||||
Supplier<Long> storedSupplier, Supplier<Long> capacitySupplier) {
|
|
||||||
super(container, 176, 223, inventory, title);
|
super(container, 176, 223, inventory, title);
|
||||||
|
|
||||||
this.texture = texture;
|
this.texture = texture;
|
||||||
this.typeParameter = typeParameter;
|
this.dataParameters = dataParameters;
|
||||||
this.redstoneModeParameter = redstoneModeParameter;
|
|
||||||
this.exactModeParameter = exactModeParameter;
|
|
||||||
this.whitelistBlacklistParameter = whitelistBlacklistParameter;
|
|
||||||
this.priorityParameter = priorityParameter;
|
|
||||||
this.accessTypeParameter = accessTypeParameter;
|
|
||||||
this.storedSupplier = storedSupplier;
|
this.storedSupplier = storedSupplier;
|
||||||
this.capacitySupplier = capacitySupplier;
|
this.capacitySupplier = capacitySupplier;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPostInit(int x, int y) {
|
public void onPostInit(int x, int y) {
|
||||||
if (redstoneModeParameter != null) {
|
if (dataParameters.getRedstoneModeParameter() != null) {
|
||||||
addSideButton(new RedstoneModeSideButton(this, redstoneModeParameter));
|
addSideButton(new RedstoneModeSideButton(this, dataParameters.getRedstoneModeParameter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeParameter != null) {
|
if (dataParameters.getTypeParameter() != null) {
|
||||||
addSideButton(new TypeSideButton(this, typeParameter));
|
addSideButton(new TypeSideButton(this, dataParameters.getTypeParameter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (whitelistBlacklistParameter != null) {
|
if (dataParameters.getWhitelistBlacklistParameter() != null) {
|
||||||
addSideButton(new WhitelistBlacklistSideButton(this, whitelistBlacklistParameter));
|
addSideButton(new WhitelistBlacklistSideButton(this, dataParameters.getWhitelistBlacklistParameter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exactModeParameter != null) {
|
if (dataParameters.getExactModeParameter() != null) {
|
||||||
addSideButton(new ExactModeSideButton(this, exactModeParameter));
|
addSideButton(new ExactModeSideButton(this, dataParameters.getExactModeParameter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (accessTypeParameter != null) {
|
if (dataParameters.getAccessTypeParameter() != null) {
|
||||||
addSideButton(new AccessTypeSideButton(this, accessTypeParameter));
|
addSideButton(new AccessTypeSideButton(this, dataParameters.getAccessTypeParameter()));
|
||||||
}
|
}
|
||||||
|
|
||||||
int buttonWidth = 10 + font.getStringWidth(I18n.format("misc.refinedstorage.priority"));
|
int buttonWidth = 10 + font.getStringWidth(I18n.format("misc.refinedstorage.priority"));
|
||||||
|
|
||||||
addButton(x + 169 - buttonWidth, y + 41, buttonWidth, 20, new TranslationTextComponent("misc.refinedstorage.priority"), true, true, btn -> minecraft.displayGuiScreen(new PriorityScreen(this, priorityParameter, playerInventory)));
|
addButton(
|
||||||
|
x + 169 - buttonWidth,
|
||||||
|
y + 41, buttonWidth,
|
||||||
|
20,
|
||||||
|
new TranslationTextComponent("misc.refinedstorage.priority"),
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
btn -> minecraft.displayGuiScreen(new PriorityScreen(this, dataParameters.getPriorityParameter(), playerInventory))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -0,0 +1,58 @@
|
|||||||
|
package com.refinedmods.refinedstorage.screen;
|
||||||
|
|
||||||
|
import com.refinedmods.refinedstorage.api.storage.AccessType;
|
||||||
|
import com.refinedmods.refinedstorage.tile.data.TileDataParameter;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
public class StorageScreenTileDataParameters {
|
||||||
|
@Nullable
|
||||||
|
private final TileDataParameter<Integer, ?> typeParameter;
|
||||||
|
@Nullable
|
||||||
|
private final TileDataParameter<Integer, ?> redstoneModeParameter;
|
||||||
|
@Nullable
|
||||||
|
private final TileDataParameter<Integer, ?> exactModeParameter;
|
||||||
|
@Nullable
|
||||||
|
private final TileDataParameter<Integer, ?> whitelistBlacklistParameter;
|
||||||
|
private final TileDataParameter<Integer, ?> priorityParameter;
|
||||||
|
@Nullable
|
||||||
|
private final TileDataParameter<AccessType, ?> accessTypeParameter;
|
||||||
|
|
||||||
|
public StorageScreenTileDataParameters(@Nullable TileDataParameter<Integer, ?> typeParameter, @Nullable TileDataParameter<Integer, ?> redstoneModeParameter, @Nullable TileDataParameter<Integer, ?> exactModeParameter, @Nullable TileDataParameter<Integer, ?> whitelistBlacklistParameter, TileDataParameter<Integer, ?> priorityParameter, @Nullable TileDataParameter<AccessType, ?> accessTypeParameter) {
|
||||||
|
this.typeParameter = typeParameter;
|
||||||
|
this.redstoneModeParameter = redstoneModeParameter;
|
||||||
|
this.exactModeParameter = exactModeParameter;
|
||||||
|
this.whitelistBlacklistParameter = whitelistBlacklistParameter;
|
||||||
|
this.priorityParameter = priorityParameter;
|
||||||
|
this.accessTypeParameter = accessTypeParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public TileDataParameter<Integer, ?> getTypeParameter() {
|
||||||
|
return typeParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public TileDataParameter<Integer, ?> getRedstoneModeParameter() {
|
||||||
|
return redstoneModeParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public TileDataParameter<Integer, ?> getExactModeParameter() {
|
||||||
|
return exactModeParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public TileDataParameter<Integer, ?> getWhitelistBlacklistParameter() {
|
||||||
|
return whitelistBlacklistParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TileDataParameter<Integer, ?> getPriorityParameter() {
|
||||||
|
return priorityParameter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
public TileDataParameter<AccessType, ?> getAccessTypeParameter() {
|
||||||
|
return accessTypeParameter;
|
||||||
|
}
|
||||||
|
}
|
@@ -315,7 +315,16 @@ public class GridScreen extends BaseScreen<GridContainer> implements IScreenInfo
|
|||||||
for (int i = 0; i < rows; ++i) {
|
for (int i = 0; i < rows; ++i) {
|
||||||
yy += 18;
|
yy += 18;
|
||||||
|
|
||||||
blit(matrixStack, x, yy, 0, getTopHeight() + (i > 0 ? (i == rows - 1 ? 18 * 2 : 18) : 0), xSize - 34, 18);
|
int yTextureStart = getTopHeight();
|
||||||
|
if (i > 0) {
|
||||||
|
if (i == rows - 1) {
|
||||||
|
yTextureStart += 18 * 2;
|
||||||
|
} else {
|
||||||
|
yTextureStart += 18;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
blit(matrixStack, x, yy, 0, yTextureStart, xSize - 34, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
yy += 18;
|
yy += 18;
|
||||||
|
@@ -25,7 +25,7 @@ public abstract class SearchBoxModeSideButton extends SideButton {
|
|||||||
return MODE_ROTATION.get(MODE_ROTATION.indexOf(oldMode) + 1);
|
return MODE_ROTATION.get(MODE_ROTATION.indexOf(oldMode) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchBoxModeSideButton(BaseScreen<?> screen) {
|
protected SearchBoxModeSideButton(BaseScreen<?> screen) {
|
||||||
super(screen);
|
super(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user