Oredict toggle on grids
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
# Refined Storage Changelog
|
# Refined Storage Changelog
|
||||||
|
|
||||||
### 1.2
|
### 1.2
|
||||||
- Added new autocrafting system (raoulvdberge, way2muchnoise)
|
- Added new autocrafting system (way2muchnoise, raoulvdberge)
|
||||||
- Added ore dictionary autocrafting (raoulvdberge)
|
- Added ore dictionary autocrafting (way2muchnoise, raoulvdberge)
|
||||||
- Added recipe transfer handler for Processing Pattern Encoder (way2muchnoise)
|
- Added recipe transfer handler for Processing Pattern Encoder (way2muchnoise)
|
||||||
- Added void excess items functionality to storage blocks (geldorn, raoulvdberge, InusualZ)
|
- Added void excess items functionality to storage blocks (geldorn, raoulvdberge, InusualZ)
|
||||||
- Added config option to configure RS to EU conversion rates (InusualZ)
|
- Added config option to configure RS to EU conversion rates (InusualZ)
|
||||||
|
|||||||
@@ -19,18 +19,22 @@ import com.raoulvdberge.refinedstorage.gui.sidebutton.*;
|
|||||||
import com.raoulvdberge.refinedstorage.integration.jei.IntegrationJEI;
|
import com.raoulvdberge.refinedstorage.integration.jei.IntegrationJEI;
|
||||||
import com.raoulvdberge.refinedstorage.integration.jei.RSJEIPlugin;
|
import com.raoulvdberge.refinedstorage.integration.jei.RSJEIPlugin;
|
||||||
import com.raoulvdberge.refinedstorage.network.*;
|
import com.raoulvdberge.refinedstorage.network.*;
|
||||||
|
import com.raoulvdberge.refinedstorage.tile.data.TileDataManager;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.IGrid;
|
||||||
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
import com.raoulvdberge.refinedstorage.tile.grid.TileGrid;
|
||||||
import net.minecraft.client.audio.PositionedSoundRecord;
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.Fluid;
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fml.client.config.GuiCheckBox;
|
||||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
@@ -52,6 +56,7 @@ public class GuiGrid extends GuiBase {
|
|||||||
private boolean wasConnected;
|
private boolean wasConnected;
|
||||||
|
|
||||||
private GuiTextField searchField;
|
private GuiTextField searchField;
|
||||||
|
private GuiCheckBox oredictPattern;
|
||||||
|
|
||||||
private ContainerGrid container;
|
private ContainerGrid container;
|
||||||
private IGrid grid;
|
private IGrid grid;
|
||||||
@@ -100,6 +105,9 @@ public class GuiGrid extends GuiBase {
|
|||||||
int sx = x + 80 + 1;
|
int sx = x + 80 + 1;
|
||||||
int sy = y + 6 + 1;
|
int sy = y + 6 + 1;
|
||||||
|
|
||||||
|
int ox = x + 64;
|
||||||
|
int oy = y + 138;
|
||||||
|
|
||||||
if (searchField == null) {
|
if (searchField == null) {
|
||||||
searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
||||||
searchField.setEnableBackgroundDrawing(false);
|
searchField.setEnableBackgroundDrawing(false);
|
||||||
@@ -112,6 +120,13 @@ public class GuiGrid extends GuiBase {
|
|||||||
searchField.yPosition = sy;
|
searchField.yPosition = sy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (oredictPattern == null) {
|
||||||
|
oredictPattern = addCheckBox(ox, oy, I18n.format("misc.refinedstorage:oredict"), TileGrid.OREDICT_PATTERN.getValue());
|
||||||
|
} else {
|
||||||
|
oredictPattern.xPosition = ox;
|
||||||
|
oredictPattern.yPosition = oy;
|
||||||
|
}
|
||||||
|
|
||||||
if (grid.getType() != EnumGridType.FLUID) {
|
if (grid.getType() != EnumGridType.FLUID) {
|
||||||
addSideButton(new SideButtonGridViewType(this, grid));
|
addSideButton(new SideButtonGridViewType(this, grid));
|
||||||
}
|
}
|
||||||
@@ -363,6 +378,15 @@ public class GuiGrid extends GuiBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void actionPerformed(GuiButton button) throws IOException {
|
||||||
|
super.actionPerformed(button);
|
||||||
|
|
||||||
|
if (button == oredictPattern) {
|
||||||
|
TileDataManager.setParameter(TileGrid.OREDICT_PATTERN, oredictPattern.isChecked());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
public void mouseClicked(int mouseX, int mouseY, int clickedButton) throws IOException {
|
||||||
super.mouseClicked(mouseX, mouseY, clickedButton);
|
super.mouseClicked(mouseX, mouseY, clickedButton);
|
||||||
@@ -459,4 +483,10 @@ public class GuiGrid extends GuiBase {
|
|||||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(mode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateOredictPattern(boolean checked) {
|
||||||
|
if (oredictPattern != null) {
|
||||||
|
oredictPattern.setIsChecked(checked);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ public class SideButtonCompare extends SideButton {
|
|||||||
ty = 80;
|
ty = 80;
|
||||||
} else if (mask == IComparer.COMPARE_NBT) {
|
} else if (mask == IComparer.COMPARE_NBT) {
|
||||||
ty = 48;
|
ty = 48;
|
||||||
|
} else if (mask == IComparer.COMPARE_OREDICT) {
|
||||||
|
ty = -100; // Temporary
|
||||||
}
|
}
|
||||||
|
|
||||||
int tx = (parameter.getValue() & mask) == mask ? 0 : 16;
|
int tx = (parameter.getValue() & mask) == mask ? 0 : 16;
|
||||||
|
|||||||
@@ -107,10 +107,29 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
public static final TileDataParameter<Boolean> OREDICT_PATTERN = new TileDataParameter<>(DataSerializers.BOOLEAN, false, new ITileDataProducer<Boolean, TileGrid>() {
|
||||||
|
@Override
|
||||||
|
public Boolean getValue(TileGrid tile) {
|
||||||
|
return tile.oredictPattern;
|
||||||
|
}
|
||||||
|
}, new ITileDataConsumer<Boolean, TileGrid>() {
|
||||||
|
@Override
|
||||||
|
public void setValue(TileGrid tile, Boolean value) {
|
||||||
|
tile.oredictPattern = value;
|
||||||
|
|
||||||
|
tile.markDirty();
|
||||||
|
}
|
||||||
|
}, parameter -> {
|
||||||
|
if (Minecraft.getMinecraft().currentScreen instanceof GuiGrid) {
|
||||||
|
((GuiGrid) Minecraft.getMinecraft().currentScreen).updateOredictPattern(parameter.getValue());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public static final String NBT_VIEW_TYPE = "ViewType";
|
public static final String NBT_VIEW_TYPE = "ViewType";
|
||||||
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
public static final String NBT_SORTING_DIRECTION = "SortingDirection";
|
||||||
public static final String NBT_SORTING_TYPE = "SortingType";
|
public static final String NBT_SORTING_TYPE = "SortingType";
|
||||||
public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode";
|
public static final String NBT_SEARCH_BOX_MODE = "SearchBoxMode";
|
||||||
|
public static final String NBT_OREDICT_PATTERN = "OredictPattern";
|
||||||
|
|
||||||
public static final int SORTING_DIRECTION_ASCENDING = 0;
|
public static final int SORTING_DIRECTION_ASCENDING = 0;
|
||||||
public static final int SORTING_DIRECTION_DESCENDING = 1;
|
public static final int SORTING_DIRECTION_DESCENDING = 1;
|
||||||
@@ -152,11 +171,14 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
private int sortingType = SORTING_TYPE_QUANTITY;
|
private int sortingType = SORTING_TYPE_QUANTITY;
|
||||||
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;
|
private int searchBoxMode = SEARCH_BOX_MODE_NORMAL;
|
||||||
|
|
||||||
|
private boolean oredictPattern = false;
|
||||||
|
|
||||||
public TileGrid() {
|
public TileGrid() {
|
||||||
dataManager.addWatchedParameter(VIEW_TYPE);
|
dataManager.addWatchedParameter(VIEW_TYPE);
|
||||||
dataManager.addWatchedParameter(SORTING_DIRECTION);
|
dataManager.addWatchedParameter(SORTING_DIRECTION);
|
||||||
dataManager.addWatchedParameter(SORTING_TYPE);
|
dataManager.addWatchedParameter(SORTING_TYPE);
|
||||||
dataManager.addWatchedParameter(SEARCH_BOX_MODE);
|
dataManager.addWatchedParameter(SEARCH_BOX_MODE);
|
||||||
|
dataManager.addWatchedParameter(OREDICT_PATTERN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -314,6 +336,8 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
|
|
||||||
ItemStack pattern = new ItemStack(RSItems.PATTERN);
|
ItemStack pattern = new ItemStack(RSItems.PATTERN);
|
||||||
|
|
||||||
|
ItemPattern.setOredict(pattern, oredictPattern);
|
||||||
|
|
||||||
for (int i = 0; i < 9; ++i) {
|
for (int i = 0; i < 9; ++i) {
|
||||||
ItemStack ingredient = matrix.getStackInSlot(i);
|
ItemStack ingredient = matrix.getStackInSlot(i);
|
||||||
|
|
||||||
@@ -467,6 +491,10 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
if (tag.hasKey(NBT_SEARCH_BOX_MODE)) {
|
if (tag.hasKey(NBT_SEARCH_BOX_MODE)) {
|
||||||
searchBoxMode = tag.getInteger(NBT_SEARCH_BOX_MODE);
|
searchBoxMode = tag.getInteger(NBT_SEARCH_BOX_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (tag.hasKey(NBT_OREDICT_PATTERN)) {
|
||||||
|
oredictPattern = tag.getBoolean(NBT_OREDICT_PATTERN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -482,6 +510,8 @@ public class TileGrid extends TileNode implements IGrid {
|
|||||||
tag.setInteger(NBT_SORTING_TYPE, sortingType);
|
tag.setInteger(NBT_SORTING_TYPE, sortingType);
|
||||||
tag.setInteger(NBT_SEARCH_BOX_MODE, searchBoxMode);
|
tag.setInteger(NBT_SEARCH_BOX_MODE, searchBoxMode);
|
||||||
|
|
||||||
|
tag.setBoolean(NBT_OREDICT_PATTERN, oredictPattern);
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ misc.refinedstorage:start=Start
|
|||||||
misc.refinedstorage:clear=Clear
|
misc.refinedstorage:clear=Clear
|
||||||
misc.refinedstorage:cancel_all=Cancel All
|
misc.refinedstorage:cancel_all=Cancel All
|
||||||
misc.refinedstorage:priority=Priority
|
misc.refinedstorage:priority=Priority
|
||||||
|
misc.refinedstorage:oredict=Oredict
|
||||||
|
|
||||||
sidebutton.refinedstorage:compare.1=Compare damage
|
sidebutton.refinedstorage:compare.1=Compare damage
|
||||||
sidebutton.refinedstorage:compare.2=Compare NBT
|
sidebutton.refinedstorage:compare.2=Compare NBT
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Reference in New Issue
Block a user