Initial set of fixes
This commit is contained in:
@@ -54,6 +54,7 @@ public abstract class BlockMachine extends BlockBase {
|
||||
super.neighborChanged(state, world, pos, block);
|
||||
|
||||
if (!world.isRemote) {
|
||||
System.out.println("NeighbourChange");
|
||||
((TileMachine) world.getTileEntity(pos)).searchController(world);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GuiCraftingSettings extends GuiBase {
|
||||
if (keyCode == Keyboard.KEY_RETURN) {
|
||||
startRequest();
|
||||
} else if (keyCode == Keyboard.KEY_ESCAPE) {
|
||||
FMLClientHandler.instance().showGuiScreen(gridGui);
|
||||
close();
|
||||
} else {
|
||||
super.keyTyped(character, keyCode);
|
||||
}
|
||||
@@ -84,7 +84,11 @@ public class GuiCraftingSettings extends GuiBase {
|
||||
if (quantity != null && quantity > 0 && quantity <= TileController.MAX_CRAFTING_QUANTITY_PER_REQUEST) {
|
||||
gridGui.getGrid().onCraftingRequested(id, quantity);
|
||||
|
||||
FMLClientHandler.instance().showGuiScreen(gridGui);
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
private void close() {
|
||||
FMLClientHandler.instance().showGuiScreen(gridGui);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,12 +56,20 @@ public class GuiGrid extends GuiBase {
|
||||
addSideButton(new SideButtonRedstoneMode(grid.getRedstoneModeSetting()));
|
||||
}
|
||||
|
||||
searchField = new GuiTextField(0, fontRendererObj, x + 80 + 1, y + 6 + 1, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
||||
searchField.setEnableBackgroundDrawing(false);
|
||||
searchField.setVisible(true);
|
||||
searchField.setTextColor(16777215);
|
||||
searchField.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
int sx = x + 80 + 1;
|
||||
int sy = y + 6 + 1;
|
||||
|
||||
if (searchField == null) {
|
||||
searchField = new GuiTextField(0, fontRendererObj, sx, sy, 88 - 6, fontRendererObj.FONT_HEIGHT);
|
||||
searchField.setEnableBackgroundDrawing(false);
|
||||
searchField.setVisible(true);
|
||||
searchField.setTextColor(16777215);
|
||||
searchField.setCanLoseFocus(!TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
searchField.setFocused(TileGrid.isSearchBoxModeWithAutoselection(grid.getSearchBoxMode()));
|
||||
} else {
|
||||
searchField.xPosition = sx;
|
||||
searchField.yPosition = sy;
|
||||
}
|
||||
|
||||
addSideButton(new SideButtonGridSortingDirection(grid));
|
||||
addSideButton(new SideButtonGridSortingType(grid));
|
||||
@@ -300,13 +308,12 @@ public class GuiGrid extends GuiBase {
|
||||
boolean clickedClear = clickedButton == 0 && isHoveringOverClear(mouseX - guiLeft, mouseY - guiTop);
|
||||
boolean clickedCreatePattern = clickedButton == 0 && isHoveringOverCreatePattern(mouseX - guiLeft, mouseY - guiTop);
|
||||
|
||||
boolean playClickSound = clickedClear || clickedCreatePattern;
|
||||
if (clickedCreatePattern) {
|
||||
BlockPos gridPos = ((TileGrid) grid).getPos();
|
||||
|
||||
if (grid.isConnected()) {
|
||||
if (clickedCreatePattern) {
|
||||
BlockPos gridPos = ((TileGrid) grid).getPos();
|
||||
RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ()));
|
||||
} else if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) {
|
||||
RefinedStorage.NETWORK.sendToServer(new MessageGridPatternCreate(gridPos.getX(), gridPos.getY(), gridPos.getZ()));
|
||||
} else if (grid.isConnected()) {
|
||||
if (isHoveringOverSlot() && container.getPlayer().inventory.getItemStack() != null && (clickedButton == 0 || clickedButton == 1)) {
|
||||
grid.onItemPush(-1, clickedButton == 1);
|
||||
} else if (isHoveringOverItemInSlot() && container.getPlayer().inventory.getItemStack() == null) {
|
||||
if (items.get(hoveringSlot).getQuantity() == 0 || (GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown())) {
|
||||
@@ -328,7 +335,7 @@ public class GuiGrid extends GuiBase {
|
||||
|
||||
grid.onItemPull(hoveringItemId, flags);
|
||||
}
|
||||
} else if (clickedClear && grid.isConnected()) {
|
||||
} else if (clickedClear) {
|
||||
RefinedStorage.NETWORK.sendToServer(new MessageGridCraftingClear((TileGrid) grid));
|
||||
} else {
|
||||
for (Slot slot : container.getPlayerInventorySlots()) {
|
||||
@@ -351,7 +358,7 @@ public class GuiGrid extends GuiBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (playClickSound) {
|
||||
if (clickedClear || clickedCreatePattern) {
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,32 +8,29 @@ import refinedstorage.tile.autocrafting.CraftingPattern;
|
||||
public class CraftingTaskScheduler {
|
||||
public static String NBT_SCHEDULED = "CraftingTaskScheduled";
|
||||
|
||||
private ItemStack scheduledFor;
|
||||
private ItemStack scheduledItem;
|
||||
|
||||
public boolean canSchedule(int compare, ItemStack item) {
|
||||
// We can only reschedule if:
|
||||
// - we didn't schedule anything before
|
||||
// - the item we can't to schedule is another item
|
||||
return scheduledFor == null || !RefinedStorageUtils.compareStack(scheduledFor, item, compare);
|
||||
return scheduledItem == null || !RefinedStorageUtils.compareStack(scheduledItem, item, compare);
|
||||
}
|
||||
|
||||
public void schedule(TileController controller, int compare, ItemStack item) {
|
||||
CraftingPattern pattern = controller.getPattern(item, compare);
|
||||
|
||||
if (pattern != null) {
|
||||
scheduledFor = item;
|
||||
scheduledItem = item;
|
||||
|
||||
controller.addCraftingTask(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetSchedule() {
|
||||
this.scheduledFor = null;
|
||||
this.scheduledItem = null;
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound tag) {
|
||||
if (scheduledFor != null) {
|
||||
tag.setTag(NBT_SCHEDULED, scheduledFor.serializeNBT());
|
||||
if (scheduledItem != null) {
|
||||
tag.setTag(NBT_SCHEDULED, scheduledItem.serializeNBT());
|
||||
} else {
|
||||
tag.removeTag(NBT_SCHEDULED);
|
||||
}
|
||||
@@ -41,7 +38,7 @@ public class CraftingTaskScheduler {
|
||||
|
||||
public void read(NBTTagCompound tag) {
|
||||
if (tag.hasKey(NBT_SCHEDULED)) {
|
||||
scheduledFor = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_SCHEDULED));
|
||||
scheduledItem = ItemStack.loadItemStackFromNBT(tag.getCompoundTag(NBT_SCHEDULED));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,6 +78,7 @@ public abstract class TileBase extends TileEntity implements ITickable {
|
||||
public void readFromNBT(NBTTagCompound tag) {
|
||||
super.readFromNBT(tag);
|
||||
|
||||
System.out.println("READ FROM NBT " + pos);
|
||||
if (tag.hasKey(NBT_UPDATE)) {
|
||||
readUpdate(tag);
|
||||
} else {
|
||||
|
||||
@@ -261,7 +261,7 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
||||
this.type = (EnumControllerType) worldObj.getBlockState(pos).getValue(BlockController.TYPE);
|
||||
}
|
||||
|
||||
return type;
|
||||
return type == null ? EnumControllerType.NORMAL : type;
|
||||
}
|
||||
|
||||
public int getWirelessGridRange() {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class TileStorage extends TileMachine implements IStorageProvider, IStora
|
||||
this.type = ((EnumStorageType) worldObj.getBlockState(pos).getValue(BlockStorage.TYPE));
|
||||
}
|
||||
|
||||
return type;
|
||||
return type == null ? EnumStorageType.TYPE_1K : type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -83,7 +83,7 @@ public class TileGrid extends TileMachine implements IGrid {
|
||||
this.type = (EnumGridType) worldObj.getBlockState(pos).getValue(BlockGrid.TYPE);
|
||||
}
|
||||
|
||||
return type;
|
||||
return type == null ? EnumGridType.NORMAL : type;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user