diff --git a/resources/assets/enderio/config/SAGMillRecipes_Core.xml b/resources/assets/enderio/config/SAGMillRecipes_Core.xml
index 121282a1..82173b68 100644
--- a/resources/assets/enderio/config/SAGMillRecipes_Core.xml
+++ b/resources/assets/enderio/config/SAGMillRecipes_Core.xml
@@ -936,6 +936,94 @@ addOreDictionaryTooltips=true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/resources/assets/enderio/lang/de_DE.lang b/resources/assets/enderio/lang/de_DE.lang
index cead18f8..2dbca7d0 100644
--- a/resources/assets/enderio/lang/de_DE.lang
+++ b/resources/assets/enderio/lang/de_DE.lang
@@ -562,6 +562,10 @@ enderio.gui.conduit.item.roundRobinEnabled=Round-Robin Aktiviert
enderio.gui.conduit.item.roundRobinDisabled=Round-Robin Deaktiviert
enderio.gui.conduit.item.priority=Priorität
+enderio.gui.conduit.item.filterupgrade=Item-Filter einsetzen
+enderio.gui.conduit.item.speedupgrade=Leitungsgeschwindigkeits-Upgrade oder -Downgrade einsetzen
+enderio.gui.conduit.item.speedupgrade2=Maximum der Upgrades ist 15; Maximum der Downgrades ist 1
+
enderio.gui.conduit.redstone.signalColor=Signalfarbe
enderio.gui.conduit.redstone.color=Farbe
diff --git a/resources/assets/enderio/lang/en_US.lang b/resources/assets/enderio/lang/en_US.lang
index 895c644d..4101063b 100644
--- a/resources/assets/enderio/lang/en_US.lang
+++ b/resources/assets/enderio/lang/en_US.lang
@@ -245,7 +245,7 @@ tile.blockAlloySmelter.tooltip.detailed.line5=speed and energy storage
tile.blockSolarPanel.name=Photovoltaic Cell
tile.blockSolarPanel.advanced.name=Advanced Photovoltaic Cell
-tile.blockSolarPanel.tooltip.common.line1=Solar power!
+tile.blockSolarPanel.tooltip.common.line1=Solar Power!
tile.blockSolarPanel.tooltip.detailed.line1=Produces power during daylight hours
tile.blockSolarPanel.tooltip.detailed.line2=Must have a clear line of sight to
tile.blockSolarPanel.tooltip.detailed.line3=the sky
@@ -592,9 +592,11 @@ item.darkSteel_axe.name=Dark Axe
enderio.item.tooltip.showDetails=
enderio.item.darkSteel.tooltip.durability=Durability:
+enderio.item.darkSteel.tooltip.lvs=lvs
enderio.item.darkSteel_pickaxe.tooltip.effPowered=Efficiency when powered
enderio.item.darkSteel_pickaxe.tooltip.effObs=Efficiency breaking obsidian
+enderio.item.darkSteel_pickaxe.tooltip.cost=cost
enderio.item.darkSteel_axe.tooltip.multiHarvest=Sneak to harvest multiple logs
@@ -828,6 +830,12 @@ enderio.gui.alloy.mode.all=All Smelting
enderio.gui.alloy.mode.alloy=Alloys Only
enderio.gui.alloy.mode.furnace=Furnace Only
+//Vacuum chest
+enderio.gui.vacuum.range=Suction strength
+enderio.gui.vacuum.header.chest=Vacuum Chest
+enderio.gui.vacuum.header.filter=Item filter
+enderio.gui.vacuum.header.range=Range
+
//Vat
enderio.vat.outputTank=Output Tank
enderio.vat.inputTank=Input Tank
@@ -844,6 +852,7 @@ enderio.stirlingGenerator.output=Generating:
enderio.stirlingGenerator.burnRate=Burn Rate:
enderio.stirlingGenerator.upgradeslot=Upgrade slot
enderio.stirlingGenerator.upgrades={0} gives {2}{1,number,#.#}x{3} efficiency
+enderio.stirlingGenerator.remaining=Remaining {0,number,percent}|{1,choice,0#|0<{1}m }{2,number}s|{3,number,#,###} RF
//Travel Blocks
enderio.gui.travelAccessable.privateBlock1=Only
@@ -896,7 +905,7 @@ enderio.gui.conduit.item.roundRobinDisabled=Round Robin Disabled
enderio.gui.conduit.item.priority=Priority
enderio.gui.conduit.item.filterupgrade=Insert Item Filter
-enderio.gui.conduit.item.speedupgrade=Insert Item Conduit Speed Up-/ Downgrade
+enderio.gui.conduit.item.speedupgrade=Insert Item Conduit Speed Upgrades/Downgrade
enderio.gui.conduit.item.speedupgrade2=Max upgrades is 15; Max downgrades is 1
enderio.gui.conduit.redstone.signalColor=Signal Color
diff --git a/resources/assets/enderio/lang/ru_RU.lang b/resources/assets/enderio/lang/ru_RU.lang
index 0a1f53be..57dee477 100644
--- a/resources/assets/enderio/lang/ru_RU.lang
+++ b/resources/assets/enderio/lang/ru_RU.lang
@@ -21,11 +21,13 @@ item.enderio.itemEnderface.name=Лицо Края
enderio.blockConduitBundle=Связка труб
enderio.blockConduitFacade=Фасад для труб
item.enderio.itemConduitFacade.name=Фасад для труб
+item.enderio.itemConduitFacade.hardened.name=Закалённый фасад для труб
enderio.item.itemConduitFacade.tooltip.notpainted=Не покрашен
item.enderio.itemConduitFacade.tooltip.detailed.line1=Окрашивается в покрасочном механизме
item.enderio.itemConduitFacade.tooltip.detailed.line2=ПКМ по трубе, чтобы поставить
item.enderio.itemConduitFacade.tooltip.detailed.line3=Скрыт, когда гаечный ключ или труба
item.enderio.itemConduitFacade.tooltip.detailed.line4=экипированы
+item.enderio.itemConduitFacade.hardened.tooltip=Закалён: Выдерживает удары и взрывы
enderio.itemPowerConduit.name=Энергетическая труба
enderio.itemPowerConduitEnhanced.name=Расширенная энергетическая труба
@@ -156,6 +158,7 @@ enderio.pulsatingCrystal.name=Пульсирующий кристалл
enderio.vibrantCrystal.name=Вибрирующий кристалл
enderio.enderCrystal.name=Кристалл Края
enderio.attractorCrystal.name=Привлекающий кристалл
+enderio.weatherCrystal.name=Погодный кристалл
enderio.darkGrindingBall.name=Шарик тёмной стали
enderio.darkGrindingBall.tooltip.detailed.line1=Измельчающий шарик для дробилки
enderio.darkGrindingBall.tooltip.detailed.line2=Основной выход
@@ -205,6 +208,7 @@ enderio.powderGold.name=Золотой порошок
enderio.powderCopper.name=Медный порошок
enderio.powderTin.name=Оловянный порошок
enderio.powderEnder.name=Порошок из жемчуга Края
+enderio.powderObsidian.name=Обсидиановый порошок
enderio.ingotEnderiumBase.name=Основа Края
//Capacitors
@@ -241,6 +245,7 @@ tile.blockAlloySmelter.tooltip.detailed.line5=скорость и хранили
tile.blockSolarPanel.name=Фотовольтовая ячейка
tile.blockSolarPanel.advanced.name=Продвинутая фотовольтовая ячейка
+tile.blockSolarPanel.tooltip.common.line1=Солнечная энергия!
tile.blockSolarPanel.tooltip.detailed.line1=Производит энергию в светлое время суток
tile.blockSolarPanel.tooltip.detailed.line2=Должна иметь чистое пространство
tile.blockSolarPanel.tooltip.detailed.line3=к небу
@@ -446,6 +451,11 @@ tile.blockExperienceObelisk.tooltip.detailed.line1=Содержит опыт
tile.blockExperienceObelisk.tooltip.detailed.line2=Может отдавать жидкий опыт
tile.blockExperienceObelisk.tooltip.detailed.line3=присоединённым резервуарам
+tile.blockWeatherObelisk.name=Погодный обелиск
+tile.blockWeatherObelisk.tooltip.detailed.line1=Изменяет текущую погоду
+tile.blockWeatherObelisk.tooltip.detailed.line2=Требует много энергии и
+tile.blockWeatherObelisk.tooltip.detailed.line3=предмет в качестве катализатора
+
tile.blockBuffer.item.name=Предметный буфер
tile.blockBuffer.power.name=Энергобуфер
tile.blockBuffer.omni.name=Универсальный буфер
@@ -572,9 +582,11 @@ item.darkSteel_axe.name=Тёмный топор
enderio.item.tooltip.showDetails=<Зажмите Shift>
enderio.item.darkSteel.tooltip.durability=Прочность:
+enderio.item.darkSteel.tooltip.lvs=уровней
enderio.item.darkSteel_pickaxe.tooltip.effPowered=Эффективность при питании
enderio.item.darkSteel_pickaxe.tooltip.effObs=Эффективность уничтожения обсидиана
+enderio.item.darkSteel_pickaxe.tooltip.cost=стоит
enderio.item.darkSteel_axe.tooltip.multiHarvest=Присядьте, чтобы срубить несколько брёвен
@@ -719,6 +731,8 @@ enderio.gui.machine.button.retrievelevels=Забрать 10
enderio.gui.machine.tooltip.retrievelevels=уровней опыта игрока
enderio.gui.machine.button.retrieveall=Забрать весь опыт
enderio.gui.machine.ioMode.overlay.tooltip=Настроить вход/выход
+enderio.gui.machine.ioMode.overlay.tooltip.visible.line1=Shift-клик, чтобы сбросить все стороны
+enderio.gui.machine.ioMode.overlay.tooltip.visible.line2=на настройки по-умолчанию
enderio.gui.machine.ioMode.none=Нет
enderio.gui.machine.ioMode.pull=Тянуть
enderio.gui.machine.ioMode.push=Толкать
@@ -870,6 +884,10 @@ enderio.gui.conduit.item.roundRobinEnabled=Цикл включён
enderio.gui.conduit.item.roundRobinDisabled=Цикл отключен
enderio.gui.conduit.item.priority=Приоритет
+enderio.gui.conduit.item.filterupgrade=Вставить предметный фильтр
+enderio.gui.conduit.item.speedupgrade=Вставить улучшения скорости/понижение скорости
+enderio.gui.conduit.item.speedupgrade2=Макс. кол-во улучшений 15; Макс. кол-во понижений 1
+
enderio.gui.conduit.redstone.signalColor=Цвет сигнала
enderio.gui.conduit.redstone.color=Цвет
enderio.gui.conduit.redstone.signalStrengh=Сильный сигнал
@@ -882,6 +900,12 @@ enderio.gui.conduit.fluid.blacklist=Чёрный список
enderio.gui.conduit.gas.autoExtract=Авто-извлечение
+//Weather
+enderio.gui.weather.task.clear=Ясная погода
+enderio.gui.weather.task.rain=Дождливая погода
+enderio.gui.weather.task.storm=Гроза
+enderio.gui.weather.requireditem=Требуется предмет: %s
+
//Enchants
enchantment.enderio.soulBound=Печать души
description.enchantment.enderio.soulBound=Это зачарование оставляет предмет в инвентаре после смерти
diff --git a/resources/assets/enderio/textures/gui/vacumChest.png b/resources/assets/enderio/textures/gui/vacumChest.png
index 71d73ed4..387fb944 100644
Binary files a/resources/assets/enderio/textures/gui/vacumChest.png and b/resources/assets/enderio/textures/gui/vacumChest.png differ
diff --git a/src/main/java/crazypants/enderio/conduit/gui/item/ItemSettings.java b/src/main/java/crazypants/enderio/conduit/gui/item/ItemSettings.java
index 67b016b4..18e9f9ec 100644
--- a/src/main/java/crazypants/enderio/conduit/gui/item/ItemSettings.java
+++ b/src/main/java/crazypants/enderio/conduit/gui/item/ItemSettings.java
@@ -75,6 +75,8 @@ public class ItemSettings extends BaseSettingsPanel {
private int priWidth = 32;
private GuiToolTip priorityTooltip;
+ private GuiToolTip speedUpgradeTooltip;
+ private GuiToolTip filterUpgradeTooltip;
private IItemFilterGui filterGui;
@@ -96,6 +98,9 @@ public class ItemSettings extends BaseSettingsPanel {
channelB.setColorIndex(0);
channelB.setToolTipHeading(Lang.localize("gui.conduit.item.channel"));
+ filterUpgradeTooltip = new GuiToolTip(new Rectangle(x - 21 - 18 * 2, customTop + 3 + 16, 18, 18), Lang.localize("gui.conduit.item.filterupgrade"));
+ speedUpgradeTooltip = new GuiToolTip(new Rectangle(x - 21 - 18, customTop + 3 + 16, 18, 18), Lang.localize("gui.conduit.item.speedupgrade"), Lang.localize("gui.conduit.item.speedupgrade2"));
+
x += channelB.getWidth() + 4;
priLeft = x - 8;
@@ -293,6 +298,8 @@ public class ItemSettings extends BaseSettingsPanel {
colorB.setColorIndex(itemConduit.getExtractionSignalColor(gui.getDir()).ordinal());
}
+ gui.addToolTip(filterUpgradeTooltip);
+
if(mode == ConnectionMode.IN_OUT && !outputActive) {
loopB.onGuiInit();
loopB.setSelected(itemConduit.isSelfFeedEnabled(gui.getDir()));
@@ -301,6 +308,7 @@ public class ItemSettings extends BaseSettingsPanel {
if((mode == ConnectionMode.IN_OUT && !outputActive) || mode == ConnectionMode.INPUT) {
roundRobinB.onGuiInit();
roundRobinB.setSelected(itemConduit.isRoundRobinEnabled(gui.getDir()));
+ gui.addToolTip(speedUpgradeTooltip);
}
if((mode == ConnectionMode.IN_OUT && outputActive) || mode == ConnectionMode.OUTPUT) {
@@ -410,7 +418,6 @@ public class ItemSettings extends BaseSettingsPanel {
String str = itemConduit.getOutputPriority(gui.getDir()) + "";
int sw = fr.getStringWidth(str);
fr.drawString(str, left + priLeft + priWidth - sw - gap, top, ColorUtil.getRGB(Color.black));
-
} else {
//draw speed upgrade slot
GL11.glColor3f(1, 1, 1);
@@ -442,6 +449,8 @@ public class ItemSettings extends BaseSettingsPanel {
priUpB.detach();
priDownB.detach();
gui.removeToolTip(priorityTooltip);
+ gui.removeToolTip(speedUpgradeTooltip);
+ gui.removeToolTip(filterUpgradeTooltip);
channelB.detach();
if(filterGui != null) {
diff --git a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java
index e95c4628..25f30209 100644
--- a/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java
+++ b/src/main/java/crazypants/enderio/conduit/item/filter/ItemFilter.java
@@ -66,6 +66,10 @@ public class ItemFilter implements IInventory, IItemFilter {
@Override
public boolean doesItemPassFilter(NetworkedInventory inv, ItemStack item) {
+ return doesItemPassFilter(item);
+ }
+
+ public boolean doesItemPassFilter(ItemStack item) {
if(!isValid()) {
return true;
}
@@ -88,7 +92,7 @@ public class ItemFilter implements IInventory, IItemFilter {
matched = false;
}
}
- if(!matched && isOreDicMatch(i, item)) {
+ if(!matched && useOreDict && isOreDicMatch(i, item)) {
matched = true;
}
if(matched) {
@@ -99,10 +103,7 @@ public class ItemFilter implements IInventory, IItemFilter {
return matched;
}
- private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
- if(!useOreDict || item == null) {
- return false;
- }
+ private boolean isOreDicMatch(int filterItemIndex, ItemStack item) {
int[] ids1 = getCachedIds(filterItemIndex);
if(ids1 == null || ids1.length == 0) {
return false;
diff --git a/src/main/java/crazypants/enderio/config/Config.java b/src/main/java/crazypants/enderio/config/Config.java
index eddbaf41..9c6ec817 100644
--- a/src/main/java/crazypants/enderio/config/Config.java
+++ b/src/main/java/crazypants/enderio/config/Config.java
@@ -325,7 +325,7 @@ public final class Config {
public static int painterEnergyPerTaskRF = 2000;
- public static double vacuumChestRange = 6;
+ public static int vacuumChestRange = 6;
public static boolean useModMetals = true;
@@ -647,7 +647,7 @@ public final class Config {
"'line of sight' distance rather than conduit path distance is used to calculate priorities.")
.getBoolean(itemConduitUsePhyscialDistance);
- vacuumChestRange = config.get(sectionEfficiency.name, "vacumChestRange", vacuumChestRange, "The range of the vacuum chest").getDouble(vacuumChestRange);
+ vacuumChestRange = config.get(sectionEfficiency.name, "vacumChestRange", vacuumChestRange, "The range of the vacuum chest").getInt(vacuumChestRange);
if(!useSneakMouseWheelYetaWrench && !useSneakRightClickYetaWrench) {
Log.warn("Both useSneakMouseWheelYetaWrench and useSneakRightClickYetaWrench are set to false. Enabling mouse wheel.");
diff --git a/src/main/java/crazypants/enderio/item/PacketConduitProbe.java b/src/main/java/crazypants/enderio/item/PacketConduitProbe.java
index 3363f046..f3888fc2 100644
--- a/src/main/java/crazypants/enderio/item/PacketConduitProbe.java
+++ b/src/main/java/crazypants/enderio/item/PacketConduitProbe.java
@@ -173,7 +173,7 @@ public class PacketConduitProbe implements IMessage, IMessageHandler 0) {
+ if(energy > Config.darkSteelPickPowerUseObsidian) {
useObsidianSpeed = block == Blocks.obsidian;
if(!useObsidianSpeed && Config.darkSteelPickApplyObsidianEffeciencyAtHardess > 0) {
try {
@@ -284,8 +284,8 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
+ Lang.localize("item.darkSteel_pickaxe.tooltip.effPowered"));
list.add(EnumChatFormatting.WHITE + "+" + Config.darkSteelPickEffeciencyObsidian + " "
+ Lang.localize("item.darkSteel_pickaxe.tooltip.effObs") + " ");
- list.add(EnumChatFormatting.WHITE + " (cost "
- + PowerDisplayUtil.formatPower(Config.darkSteelPickPowerUseObsidian / 10) + " "
+ list.add(EnumChatFormatting.WHITE + " " + "(" + Lang.localize("item.darkSteel_pickaxe.tooltip.cost") + " "
+ + PowerDisplayUtil.formatPower(Config.darkSteelPickPowerUseObsidian) + " "
+ PowerDisplayUtil.abrevation() + ")");
}
DarkSteelRecipeManager.instance.addAdvancedTooltipEntries(itemstack, entityplayer, list, flag);
diff --git a/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java b/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java
index 7882fb70..d005f674 100644
--- a/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java
+++ b/src/main/java/crazypants/enderio/machine/generator/stirling/GuiStirlingGenerator.java
@@ -39,6 +39,8 @@ public class GuiStirlingGenerator extends GuiPoweredMachineBase 0) {
+ if(shouldRenderProgress()) {
scaled = getTileEntity().getProgressScaled(12);
drawTexturedModalRect(sx + 80, sy + 64 - scaled, 176, 12 - scaled, 14, scaled + 2);
}
diff --git a/src/main/java/crazypants/enderio/machine/gui/GuiMachineBase.java b/src/main/java/crazypants/enderio/machine/gui/GuiMachineBase.java
index 7704128a..78fb07d8 100644
--- a/src/main/java/crazypants/enderio/machine/gui/GuiMachineBase.java
+++ b/src/main/java/crazypants/enderio/machine/gui/GuiMachineBase.java
@@ -153,33 +153,42 @@ public abstract class GuiMachineBase extends Gu
addToolTip(tt);
}
- private void updateProgressTooltips(int progress) {
- if(lastProgressTooltipValue == progress || progressTooltips == null) {
+ private void updateProgressTooltips(int scaledProgress, float progress) {
+ if(lastProgressTooltipValue == scaledProgress || progressTooltips == null) {
return;
}
- lastProgressTooltipValue = progress;
+ lastProgressTooltipValue = scaledProgress;
- if(progress < 0) {
+ if(scaledProgress < 0) {
for(GuiToolTip tt : progressTooltips) {
tt.setVisible(false);
}
return;
}
- String msg = MessageFormat.format(Lang.localize("gui.progress"), progress);
+ String msg = formatProgressTooltip(scaledProgress, progress);
+ String[] tooltip = msg.split("\\|");
for(GuiToolTip tt : progressTooltips) {
- tt.setToolTipText(msg);
+ tt.setToolTipText(tooltip);
tt.setVisible(true);
}
}
+ protected String formatProgressTooltip(int scaledProgress, float progress) {
+ return MessageFormat.format(Lang.localize("gui.progress"), scaledProgress);
+ }
+
+ protected int scaleProgressForTooltip(float progress) {
+ return (int)(progress * 100);
+ }
+
protected boolean shouldRenderProgress() {
float progress = tileEntity.getProgress();
if(progress > 0 && progress < 1) {
- updateProgressTooltips((int)(progress * 100));
+ updateProgressTooltips(scaleProgressForTooltip(progress), progress);
return true;
} else {
- updateProgressTooltips(-1);
+ updateProgressTooltips(-1, -1);
return false;
}
}
diff --git a/src/main/java/crazypants/enderio/machine/vacuum/BlockVacuumChest.java b/src/main/java/crazypants/enderio/machine/vacuum/BlockVacuumChest.java
index cfc231eb..eff0430e 100644
--- a/src/main/java/crazypants/enderio/machine/vacuum/BlockVacuumChest.java
+++ b/src/main/java/crazypants/enderio/machine/vacuum/BlockVacuumChest.java
@@ -1,23 +1,28 @@
package crazypants.enderio.machine.vacuum;
+import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
import cpw.mods.fml.common.network.IGuiHandler;
+import cpw.mods.fml.relauncher.Side;
import crazypants.enderio.BlockEio;
import crazypants.enderio.EnderIO;
import crazypants.enderio.GuiHandler;
import crazypants.enderio.ModObject;
import crazypants.enderio.TileEntityEio;
+import crazypants.enderio.api.redstone.IRedstoneConnectable;
import crazypants.enderio.gui.IResourceTooltipProvider;
-import crazypants.enderio.tool.ToolUtil;
+import crazypants.enderio.network.PacketHandler;
-public class BlockVacuumChest extends BlockEio implements IGuiHandler, IResourceTooltipProvider {
+public class BlockVacuumChest extends BlockEio implements IGuiHandler, IResourceTooltipProvider, IRedstoneConnectable {
public static BlockVacuumChest create() {
+ PacketHandler.INSTANCE.registerMessage(PacketVaccumChest.class,PacketVaccumChest.class,PacketHandler.nextID(), Side.SERVER);
BlockVacuumChest res = new BlockVacuumChest();
res.init();
return res;
@@ -30,6 +35,19 @@ public class BlockVacuumChest extends BlockEio implements IGuiHandler, IResource
setBlockTextureName("enderio:blockVacuumChest");
}
+ @Override
+ public boolean shouldRedstoneConduitConnect(World world, int x, int y, int z, ForgeDirection from) {
+ return true;
+ }
+
+ @Override
+ public void onNeighborBlockChange(World world, int x, int y, int z, Block blockId) {
+ TileEntity ent = world.getTileEntity(x, y, z);
+ if(ent instanceof TileVacuumChest) {
+ ((TileVacuumChest) ent).onNeighborBlockChange(blockId);
+ }
+ }
+
@Override
protected void init() {
super.init();
diff --git a/src/main/java/crazypants/enderio/machine/vacuum/ContainerVacuumChest.java b/src/main/java/crazypants/enderio/machine/vacuum/ContainerVacuumChest.java
index 303a9799..14f027d7 100644
--- a/src/main/java/crazypants/enderio/machine/vacuum/ContainerVacuumChest.java
+++ b/src/main/java/crazypants/enderio/machine/vacuum/ContainerVacuumChest.java
@@ -8,20 +8,20 @@ import net.minecraft.item.ItemStack;
public class ContainerVacuumChest extends Container {
- private int numRows = 3;
-
- public ContainerVacuumChest(EntityPlayer player, InventoryPlayer inventory, TileVacuumChest te) {
+ final Slot filterSlot;
+ Runnable filterChangedCB;
+ public ContainerVacuumChest(EntityPlayer player, InventoryPlayer inventory, final TileVacuumChest te) {
int x = 8;
- int y = 17;
+ int y = 18;
int index = -1;
- for (int i = 0; i < 3; ++i) {
+ for (int i = 0; i < TileVacuumChest.ITEM_ROWS; ++i) {
for (int j = 0; j < 9; ++j) {
addSlotToContainer(new Slot(te, ++index, x + j * 18, y + i * 18));
}
}
- y = 84;
+ y = 124;
// add players inventory
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
@@ -31,6 +31,9 @@ public class ContainerVacuumChest extends Container {
for (int i = 0; i < 9; ++i) {
addSlotToContainer(new Slot(inventory, i, x + i * 18, y + 58));
}
+
+ filterSlot = new FilterSlot(new InventoryFilterUpgrade(te));
+ addSlotToContainer(filterSlot);
}
@Override
@@ -38,6 +41,7 @@ public class ContainerVacuumChest extends Container {
return true;
}
+ @Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
ItemStack itemstack = null;
Slot slot = (Slot) this.inventorySlots.get(par2);
@@ -46,11 +50,11 @@ public class ContainerVacuumChest extends Container {
ItemStack itemstack1 = slot.getStack();
itemstack = itemstack1.copy();
- if(par2 < this.numRows * 9) {
- if(!this.mergeItemStack(itemstack1, this.numRows * 9, this.inventorySlots.size(), true)) {
+ if(par2 < TileVacuumChest.ITEM_SLOTS) {
+ if(!this.mergeItemStack(itemstack1, TileVacuumChest.ITEM_SLOTS, this.inventorySlots.size()-1, true)) {
return null;
}
- } else if(!this.mergeItemStack(itemstack1, 0, this.numRows * 9, false)) {
+ } else if(!this.mergeItemStack(itemstack1, 0, TileVacuumChest.ITEM_SLOTS, false)) {
return null;
}
@@ -63,4 +67,32 @@ public class ContainerVacuumChest extends Container {
return itemstack;
}
+ void setFilterChangedCB(Runnable filterChangedCB) {
+ this.filterChangedCB = filterChangedCB;
+ }
+
+ void filterChanged() {
+ if(filterChangedCB != null) {
+ filterChangedCB.run();
+ }
+ }
+
+ class FilterSlot extends Slot {
+ InventoryFilterUpgrade inv;
+
+ FilterSlot(InventoryFilterUpgrade inv) {
+ super(inv, 0, 8, 86);
+ this.inv = inv;
+ }
+
+ @Override
+ public void onSlotChanged() {
+ filterChanged();
+ }
+
+ @Override
+ public boolean isItemValid(ItemStack stack) {
+ return inv.isItemValidForSlot(0, stack);
+ }
+ }
}
diff --git a/src/main/java/crazypants/enderio/machine/vacuum/GuiVacuumChest.java b/src/main/java/crazypants/enderio/machine/vacuum/GuiVacuumChest.java
index 5273ca4f..8c0f1d16 100644
--- a/src/main/java/crazypants/enderio/machine/vacuum/GuiVacuumChest.java
+++ b/src/main/java/crazypants/enderio/machine/vacuum/GuiVacuumChest.java
@@ -2,24 +2,224 @@ package crazypants.enderio.machine.vacuum;
import org.lwjgl.opengl.GL11;
+import crazypants.enderio.conduit.item.filter.ItemFilter;
+import crazypants.enderio.gui.IconButtonEIO;
+import crazypants.enderio.gui.IconEIO;
+import crazypants.enderio.gui.RedstoneModeButton;
+import crazypants.enderio.gui.ToggleButtonEIO;
+import crazypants.enderio.network.PacketHandler;
+import crazypants.gui.GhostSlot;
+import crazypants.gui.GuiContainerBase;
+import crazypants.gui.GuiToolTip;
+import crazypants.render.ColorUtil;
import crazypants.render.RenderUtil;
-import net.minecraft.client.gui.inventory.GuiContainer;
+import crazypants.util.BlockCoord;
+import crazypants.util.Lang;
+import java.awt.Color;
+import java.awt.Rectangle;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.item.ItemStack;
-public class GuiVacuumChest extends GuiContainer {
+public class GuiVacuumChest extends GuiContainerBase {
+
+ private static final int RANGE_LEFT = 145;
+ private static final int RANGE_TOP = 86;
+ private static final int RANGE_WIDTH = 16;
+
+ private static final int FILTER_LEFT = 29;
+ private static final int FILTER_TOP = 85;
+
+ private static final int ID_RANGE_UP = 4711;
+ private static final int ID_RANGE_DOWN = 4712;
+ private static final int ID_WHITELIST = 4713;
+ private static final int ID_MATCHMETA = 4714;
+ private static final int ID_REDSTONE = 4715;
+
+ private final TileVacuumChest te;
+
+ private final GuiToolTip rangeTooltip;
+ private final IconButtonEIO rangeUpB;
+ private final IconButtonEIO rangeDownB;
+ private final ToggleButtonEIO whiteListB;
+ private final ToggleButtonEIO useMetaB;
+ private final RedstoneModeButton rsB;
+ private final String headerChest;
+ private final String headerFilter;
+ private final String headerRange;
+ private final String headerInventory;
public GuiVacuumChest(EntityPlayer player, InventoryPlayer inventory, TileVacuumChest te) {
super(new ContainerVacuumChest(player, inventory, te));
+ this.te = te;
+
+ ySize = 206;
+
+ int x = RANGE_LEFT;
+ int y = RANGE_TOP;
+
+ rangeTooltip = new GuiToolTip(new Rectangle(x, y, RANGE_WIDTH, 16), Lang.localize("gui.vacuum.range"));
+
+ x += RANGE_WIDTH;
+ rangeUpB = new IconButtonEIO(this, ID_RANGE_UP, x, y, IconEIO.ADD_BUT);
+ rangeUpB.setSize(8, 8);
+
+ y += 8;
+ rangeDownB = new IconButtonEIO(this, ID_RANGE_DOWN, x, y, IconEIO.MINUS_BUT);
+ rangeDownB.setSize(8, 8);
+
+ x = xSize - 16 - 7;
+ y = 104;
+ rsB = new RedstoneModeButton(this, ID_REDSTONE, x, y, te, new BlockCoord(te));
+
+ x = FILTER_LEFT + TileVacuumChest.FILTER_SLOTS*18 + 2;
+ y = 86;
+ whiteListB = new ToggleButtonEIO(this, ID_WHITELIST, x, y, IconEIO.FILTER_WHITELIST, IconEIO.FILTER_BLACKLIST);
+ whiteListB.setUnselectedToolTip(Lang.localize("gui.conduit.item.whitelist"));
+ whiteListB.setSelectedToolTip(Lang.localize("gui.conduit.item.blacklist"));
+ whiteListB.setPaintSelectedBorder(false);
+
+ y += 18;
+ useMetaB = new ToggleButtonEIO(this, ID_MATCHMETA, x, y, IconEIO.FILTER_META_OFF, IconEIO.FILTER_META);
+ useMetaB.setSelectedToolTip(Lang.localize("gui.conduit.item.matchMetaData"));
+ useMetaB.setUnselectedToolTip(Lang.localize("gui.conduit.item.ignoreMetaData"));
+ useMetaB.setPaintSelectedBorder(false);
+
+ for(int i=0 ; i= current.stackSize) {
+ result = current.copy();
+ remaining = null;
+ } else {
+ result = current.copy();
+ result.stackSize = num;
+ remaining = current.copy();
+ remaining.stackSize -= num;
+ }
+ te.setFilterItem(remaining);
+ return result;
+ }
+
+ return null;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int i) {
+ return null;
+ }
+
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack is) {
+ if(slot == 0) {
+ te.setFilterItem(is);
+ }
+ }
+
+ @Override
+ public String getInventoryName() {
+ return "FilterUpgrade";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return false;
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public void markDirty() {
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer ep) {
+ return true;
+ }
+
+ @Override
+ public void openInventory() {
+ }
+
+ @Override
+ public void closeInventory() {
+ }
+
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack is) {
+ return slot == 0 && te.isItemValidForFilter(is);
+ }
+}
diff --git a/src/main/java/crazypants/enderio/machine/vacuum/PacketVaccumChest.java b/src/main/java/crazypants/enderio/machine/vacuum/PacketVaccumChest.java
new file mode 100644
index 00000000..c18057af
--- /dev/null
+++ b/src/main/java/crazypants/enderio/machine/vacuum/PacketVaccumChest.java
@@ -0,0 +1,96 @@
+package crazypants.enderio.machine.vacuum;
+
+import cpw.mods.fml.common.network.ByteBufUtils;
+import cpw.mods.fml.common.network.simpleimpl.IMessage;
+import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
+import cpw.mods.fml.common.network.simpleimpl.MessageContext;
+import crazypants.enderio.network.MessageTileEntity;
+import io.netty.buffer.ByteBuf;
+import net.minecraft.item.ItemStack;
+
+public class PacketVaccumChest extends MessageTileEntity implements IMessageHandler {
+
+ public static final int CMD_SET_RANGE = 0;
+ public static final int CMD_SET_SLOT = 1;
+ public static final int CMD_SET_BLACKLIST = 2;
+ public static final int CMD_SET_MATCHMETA = 3;
+
+ private int cmd;
+ private int value;
+ private ItemStack stack;
+
+ public PacketVaccumChest() {
+ }
+
+ private PacketVaccumChest(TileVacuumChest tile, int cmd) {
+ super(tile);
+ this.cmd = cmd;
+ }
+
+ public static PacketVaccumChest setRange(TileVacuumChest tile, int range) {
+ PacketVaccumChest msg = new PacketVaccumChest(tile, CMD_SET_RANGE);
+ msg.value = range;
+ tile.setRange(range);
+ return msg;
+ }
+
+ public static PacketVaccumChest setFilterSlot(TileVacuumChest tile, int slot, ItemStack stack) {
+ PacketVaccumChest msg = new PacketVaccumChest(tile, CMD_SET_SLOT);
+ msg.value = slot;
+ msg.stack = stack;
+ tile.setItemFilterSlot(slot, stack);
+ return msg;
+ }
+
+ public static PacketVaccumChest setFilterBlacklist(TileVacuumChest tile, boolean isBlacklist) {
+ PacketVaccumChest msg = new PacketVaccumChest(tile, CMD_SET_BLACKLIST);
+ msg.value = isBlacklist ? 1 : 0;
+ tile.setFilterBlacklist(isBlacklist);
+ return msg;
+ }
+
+ public static PacketVaccumChest setFilterMatchMeta(TileVacuumChest tile, boolean matchMeta) {
+ PacketVaccumChest msg = new PacketVaccumChest(tile, CMD_SET_MATCHMETA);
+ msg.value = matchMeta ? 1 : 0;
+ tile.setFilterMatchMeta(matchMeta);
+ return msg;
+ }
+
+ @Override
+ public void fromBytes(ByteBuf buf) {
+ super.fromBytes(buf);
+ cmd = buf.readByte() & 255;
+ value = buf.readInt();
+ stack = ByteBufUtils.readItemStack(buf);
+ }
+
+ @Override
+ public void toBytes(ByteBuf buf) {
+ super.toBytes(buf);
+ buf.writeByte(cmd);
+ buf.writeInt(value);
+ ByteBufUtils.writeItemStack(buf, stack);
+ }
+
+ @Override
+ public IMessage onMessage(PacketVaccumChest msg, MessageContext ctx) {
+ TileVacuumChest te = msg.getTileEntity(ctx.getServerHandler().playerEntity.worldObj);
+ if (te != null) {
+ switch (msg.cmd) {
+ case CMD_SET_RANGE:
+ te.setRange(msg.value);
+ break;
+ case CMD_SET_SLOT:
+ te.setItemFilterSlot(msg.value, msg.stack);
+ break;
+ case CMD_SET_BLACKLIST:
+ te.setFilterBlacklist(msg.value != 0);
+ break;
+ case CMD_SET_MATCHMETA:
+ te.setFilterMatchMeta(msg.value != 0);
+ break;
+ }
+ }
+ return null;
+ }
+}
diff --git a/src/main/java/crazypants/enderio/machine/vacuum/TileVacuumChest.java b/src/main/java/crazypants/enderio/machine/vacuum/TileVacuumChest.java
index 4219f7c6..8f60abde 100644
--- a/src/main/java/crazypants/enderio/machine/vacuum/TileVacuumChest.java
+++ b/src/main/java/crazypants/enderio/machine/vacuum/TileVacuumChest.java
@@ -12,25 +12,58 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.AxisAlignedBB;
+import crazypants.enderio.EnderIO;
import crazypants.enderio.ModObject;
import crazypants.enderio.TileEntityEio;
+import crazypants.enderio.conduit.item.FilterRegister;
+import crazypants.enderio.conduit.item.filter.IItemFilter;
+import crazypants.enderio.conduit.item.filter.ItemFilter;
import crazypants.enderio.config.Config;
+import crazypants.enderio.machine.IRedstoneModeControlable;
+import crazypants.enderio.machine.RedstoneControlMode;
import crazypants.render.BoundingBox;
import crazypants.util.BlockCoord;
import crazypants.util.ItemUtil;
+import net.minecraft.block.Block;
-public class TileVacuumChest extends TileEntityEio implements IEntitySelector, IInventory {
+public class TileVacuumChest extends TileEntityEio implements IEntitySelector, IInventory, IRedstoneModeControlable {
- private static final double RANGE = Config.vacuumChestRange;
- private ItemStack[] inv = new ItemStack[27];
+ public static final int ITEM_ROWS = 3;
+ public static final int ITEM_SLOTS = 9*ITEM_ROWS;
+ public static final int FILTER_SLOTS = 5;
+
+ private final ItemStack[] inv = new ItemStack[ITEM_SLOTS];
+ private int range = Config.vacuumChestRange;
+ private ItemFilter filter;
+ private ItemStack filterItem;
+
+ protected RedstoneControlMode redstoneControlMode = RedstoneControlMode.IGNORE;
+ protected boolean redstoneCheckPassed;
+ private boolean redstoneStateDirty = true;
@Override
public void updateEntity() {
- if(!isFull()) {
+ if(redstoneStateDirty) {
+ updateRedstoneStatus();
+ }
+ if(redstoneCheckPassed && !isFull()) {
doHoover();
}
}
+ private void updateRedstoneStatus() {
+ boolean prevRedstoneCheckPassed = redstoneCheckPassed;
+ redstoneCheckPassed = RedstoneControlMode.isConditionMet(redstoneControlMode, this);
+ redstoneStateDirty = false;
+ if(redstoneCheckPassed != prevRedstoneCheckPassed) {
+ updateBlock();
+ }
+ }
+
+ public void onNeighborBlockChange(Block blockId) {
+ redstoneStateDirty = true;
+ }
+
@Override
public boolean isEntityApplicable(Entity entity) {
if(entity.isDead) {
@@ -48,29 +81,31 @@ public class TileVacuumChest extends TileEntityEio implements IEntitySelector, I
private void doHoover() {
+ int rangeSqr = range*range;
BoundingBox bb = new BoundingBox(getLocation());
AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
- aabb = aabb.expand(RANGE, RANGE, RANGE);
+ aabb = aabb.expand(range, range, range);
List interestingItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, aabb, this);
for (EntityItem entity : interestingItems) {
- double x = (xCoord + 0.5D - entity.posX);
- double y = (yCoord + 0.5D - entity.posY);
- double z = (zCoord + 0.5D - entity.posZ);
+ if(filter == null || filter.doesItemPassFilter(entity.getEntityItem())) {
+ double x = (xCoord + 0.5D - entity.posX);
+ double y = (yCoord + 0.5D - entity.posY);
+ double z = (zCoord + 0.5D - entity.posZ);
- double distance = Math.sqrt(x * x + y * y + z * z);
- if(distance < 1.25) {
- hooverEntity(entity);
- } else {
- double speed = 0.06;
- double distScale = 1.0 - Math.min(0.9, distance / (RANGE * RANGE));
- distScale *= distScale;
+ double distance = Math.sqrt(x * x + y * y + z * z);
+ if(distance < 1.25) {
+ hooverEntity(entity);
+ } else {
+ double speed = 0.06;
+ double distScale = 1.0 - Math.min(0.9, distance / rangeSqr);
+ distScale *= distScale;
- entity.motionX += x / distance * distScale * speed;
- entity.motionY += y / distance * distScale * 0.2;
- entity.motionZ += z / distance * distScale * speed;
+ entity.motionX += x / distance * distScale * speed;
+ entity.motionY += y / distance * distScale * 0.2;
+ entity.motionZ += z / distance * distScale * speed;
+ }
}
-
}
}
@@ -191,9 +226,86 @@ public class TileVacuumChest extends TileEntityEio implements IEntitySelector, I
return true;
}
+ public boolean isItemValidForFilter(ItemStack itemstack) {
+ return itemstack != null && itemstack.getItem() == EnderIO.itemBasicFilterUpgrade && itemstack.getItemDamage() == 0;
+ }
+
+ public int getRange() {
+ return range;
+ }
+
+ private int limitRange(int range) {
+ return Math.max(1, Math.min(Config.vacuumChestRange, range));
+ }
+
+ public void setRange(int range) {
+ this.range = limitRange(range);
+ updateBlock();
+ }
+
+ public ItemStack getFilterItem() {
+ return filterItem;
+ }
+
+ public void setFilterItem(ItemStack filterItem) {
+ IItemFilter newFilter = FilterRegister.getFilterForUpgrade(filterItem);
+ if(newFilter == null || newFilter instanceof ItemFilter) {
+ this.filterItem = filterItem;
+ this.filter = (ItemFilter)newFilter;
+ updateBlock();
+ }
+ }
+
+ public void setFilterBlacklist(boolean isBlacklist) {
+ if(filter != null) {
+ filter.setBlacklist(isBlacklist);
+ updateFilterItem();
+ }
+ }
+
+ public void setFilterMatchMeta(boolean matchMeta) {
+ if(filter != null) {
+ filter.setMatchMeta(matchMeta);
+ updateFilterItem();
+ }
+ }
+
+ public boolean hasItemFilter() {
+ return filter != null;
+ }
+
+ public ItemFilter getItemFilter() {
+ return filter;
+ }
+
+ public void setItemFilterSlot(int slot, ItemStack stack) {
+ if(slot >= 0 && slot < FILTER_SLOTS && filter != null) {
+ filter.setInventorySlotContents(slot, stack);
+ updateFilterItem();
+ }
+ }
+
+ private void updateFilterItem() {
+ FilterRegister.writeFilterToStack(filter, filterItem);
+ updateBlock();
+ }
+
+ @Override
+ public RedstoneControlMode getRedstoneControlMode() {
+ return redstoneControlMode;
+ }
+
+ @Override
+ public void setRedstoneControlMode(RedstoneControlMode redstoneControlMode) {
+ this.redstoneControlMode = redstoneControlMode;
+ redstoneStateDirty = true;
+ updateBlock();
+ }
+
@Override
public void readCustomNBT(NBTTagCompound nbtRoot) {
readContentsFromNBT(nbtRoot);
+ redstoneCheckPassed = nbtRoot.getBoolean("redstoneCheckPassed");
}
public void readContentsFromNBT(NBTTagCompound nbtRoot) {
@@ -207,11 +319,36 @@ public class TileVacuumChest extends TileEntityEio implements IEntitySelector, I
}
}
}
+ if(nbtRoot.hasKey("range")) {
+ range = limitRange(nbtRoot.getInteger("range"));
+ } else {
+ range = Config.vacuumChestRange;
+ }
+ if(nbtRoot.hasKey("filter")) {
+ NBTTagCompound filterTag = (NBTTagCompound) nbtRoot.getTag("filter");
+ filterItem = ItemStack.loadItemStackFromNBT(filterTag);
+ IItemFilter flt = FilterRegister.getFilterForUpgrade(filterItem);
+ if(flt instanceof ItemFilter) {
+ filter = (ItemFilter)flt;
+ } else {
+ filterItem = null;
+ }
+ } else {
+ filterItem = null;
+ filter = null;
+ }
+
+ int rsContr = nbtRoot.getInteger("redstoneControlMode");
+ if(rsContr < 0 || rsContr >= RedstoneControlMode.values().length) {
+ rsContr = 0;
+ }
+ redstoneControlMode = RedstoneControlMode.values()[rsContr];
}
@Override
public void writeCustomNBT(NBTTagCompound nbtRoot) {
writeContentsToNBT(nbtRoot);
+ nbtRoot.setBoolean("redstoneCheckPassed", redstoneCheckPassed);
}
public void writeContentsToNBT(NBTTagCompound nbtRoot) {
@@ -225,6 +362,13 @@ public class TileVacuumChest extends TileEntityEio implements IEntitySelector, I
}
}
nbtRoot.setTag("Items", itemList);
+ nbtRoot.setInteger("range", range);
+ if(filterItem != null) {
+ NBTTagCompound filterNBT = new NBTTagCompound();
+ filterItem.writeToNBT(filterNBT);
+ nbtRoot.setTag("filter", filterNBT);
+ }
+ nbtRoot.setInteger("redstoneControlMode", redstoneControlMode.ordinal());
}
}
diff --git a/src/main/java/crazypants/gui/GhostSlot.java b/src/main/java/crazypants/gui/GhostSlot.java
new file mode 100644
index 00000000..d9889788
--- /dev/null
+++ b/src/main/java/crazypants/gui/GhostSlot.java
@@ -0,0 +1,26 @@
+package crazypants.gui;
+
+import net.minecraft.item.ItemStack;
+
+public class GhostSlot {
+
+ public int x;
+ public int y;
+ public boolean visible = true;
+ public ItemStack stack;
+
+ public boolean isMouseOver(int mx, int my) {
+ return mx >= x && mx < (x+16) && my >= y && my < (y+16);
+ }
+
+ public boolean isVisible() {
+ return visible;
+ }
+
+ protected ItemStack getStack() {
+ return stack;
+ }
+
+ protected void putStack(ItemStack stack) {
+ }
+}
diff --git a/src/main/java/crazypants/gui/GuiContainerBase.java b/src/main/java/crazypants/gui/GuiContainerBase.java
index f3485b30..42f91b5c 100644
--- a/src/main/java/crazypants/gui/GuiContainerBase.java
+++ b/src/main/java/crazypants/gui/GuiContainerBase.java
@@ -19,11 +19,12 @@ import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
-import com.google.common.collect.Lists;
-
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
+
+import com.google.common.collect.Lists;
+
import cpw.mods.fml.common.Optional;
import crazypants.enderio.gui.IGuiOverlay;
import crazypants.enderio.gui.TextFieldEIO;
@@ -38,6 +39,9 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
protected ToolTipManager ttMan = new ToolTipManager();
protected List overlays = new ArrayList();
protected List textFields = Lists.newArrayList();
+ protected List ghostSlots = new ArrayList();
+
+ protected GhostSlot hoverGhostSlot;
protected GuiContainerBase(Container par1Container) {
super(par1Container);
@@ -137,10 +141,18 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
@Override
protected void mouseClicked(int x, int y, int p_73864_3_) {
- super.mouseClicked(x, y, p_73864_3_);
for (GuiTextField f : textFields) {
f.mouseClicked(x, y, p_73864_3_);
}
+ if(!ghostSlots.isEmpty()) {
+ GhostSlot slot = getGhostSlot(x, y);
+ if(slot != null) {
+ ItemStack st = Minecraft.getMinecraft().thePlayer.inventory.getItemStack();
+ slot.putStack(st);
+ return;
+ }
+ }
+ super.mouseClicked(x, y, p_73864_3_);
}
public void addOverlay(IGuiOverlay overlay) {
@@ -154,7 +166,7 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
private int realMx, realMy;
@Override
- public final void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
+ protected final void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
drawForegroundImpl(mouseX, mouseY);
Timer t = RenderUtil.getTimer();
@@ -176,15 +188,16 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
}
@Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
+ protected void drawGuiContainerBackgroundLayer(float par1, int mouseX, int mouseY) {
for (GuiTextField f : textFields) {
f.drawTextBox();
}
+ drawGhostSlots(mouseX, mouseY);
}
@Override
public void drawScreen(int par1, int par2, float par3) {
-
+ hoverGhostSlot = null;
int mx = realMx = par1;
int my = realMy = par2;
for (IGuiOverlay overlay : overlays) {
@@ -196,6 +209,13 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
}
super.drawScreen(mx, my, par3);
+
+ if(hoverGhostSlot != null && mc.thePlayer.inventory.getItemStack() == null) {
+ ItemStack stack = hoverGhostSlot.getStack();
+ if(stack != null) {
+ renderToolTip(stack, par1, par2);
+ }
+ }
}
// copied from super with hate
@@ -217,13 +237,80 @@ public abstract class GuiContainerBase extends GuiContainer implements ToolTipRe
itemRender.zLevel = 0.0F;
}
+ protected void drawFakeItemsStart() {
+ zLevel = 100.0F;
+ itemRender.zLevel = 100.0F;
+ GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL12.GL_RESCALE_NORMAL);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ RenderHelper.enableGUIStandardItemLighting();
+ }
+
+ protected void drawFakeItemStack(int x, int y, ItemStack stack) {
+ itemRender.renderItemAndEffectIntoGUI(fontRendererObj, mc.renderEngine, stack, x, y);
+ }
+
+ protected void drawFakeItemHover(int x, int y) {
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glDisable(GL11.GL_DEPTH_TEST);
+ GL11.glColorMask(true, true, true, false);
+ drawGradientRect(x, y, x + 16, y + 16, 0x80FFFFFF, 0x80FFFFFF);
+ GL11.glColorMask(true, true, true, true);
+ GL11.glEnable(GL11.GL_DEPTH_TEST);
+ GL11.glEnable(GL11.GL_LIGHTING);
+ }
+
+ protected void drawFakeItemsEnd() {
+ GL11.glPopAttrib();
+ itemRender.zLevel = 0.0F;
+ zLevel = 0.0F;
+ }
+
+ protected void drawGhostSlots(int mouseX, int mouseY) {
+ if(ghostSlots.isEmpty()) {
+ return;
+ }
+ int sx = getGuiLeft();
+ int sy = getGuiTop();
+ drawFakeItemsStart();
+ try {
+ hoverGhostSlot = null;
+ for(GhostSlot slot : ghostSlots) {
+ ItemStack stack = slot.getStack();
+ if(slot.isVisible()) {
+ if(stack != null) {
+ drawFakeItemStack(slot.x + sx, slot.y + sy, stack);
+ }
+ if(slot.isMouseOver(mouseX - sx, mouseY - sy)) {
+ hoverGhostSlot = slot;
+ }
+ }
+ }
+ if(hoverGhostSlot != null) {
+ // draw hover last to prevent it from affecting rendering of other slots ...
+ drawFakeItemHover(hoverGhostSlot.x + sx, hoverGhostSlot.y + sy);
+ }
+ } finally {
+ drawFakeItemsEnd();
+ }
+ }
+
+ protected GhostSlot getGhostSlot(int mouseX, int mouseY) {
+ mouseX -= getGuiLeft();
+ mouseY -= getGuiTop();
+ for(GhostSlot slot : ghostSlots) {
+ if(slot.isVisible() && slot.isMouseOver(mouseX, mouseY)) {
+ return slot;
+ }
+ }
+ return null;
+ }
+
private boolean isMouseInOverlay(int mouseX, int mouseY, IGuiOverlay overlay) {
int x = mouseX - getGuiLeft();
int y = mouseY - getGuiTop();
- if(overlay.getBounds().contains(x, y)) {
- return true;
- }
- return false;
+ return overlay.getBounds().contains(x, y);
}
@Override