Compare commits

..
13 Commits
Author SHA1 Message Date
Martin Robertz db504c19bf Merge pull request #5 from D-Cysteine/add-view-cell
Add view cell support
2021-08-07 20:44:10 +02:00
D-Cysteine fe387220ba Add view cell support 2021-08-06 20:12:15 -06:00
repo-alt 9098efd2bf Merge pull request #4 from repo-alt/master
Extended tooltip added to the crafting CPU GUI
2021-07-15 17:01:05 +03:00
repo_alt d0b2c6a118 Extended tooltip added to the crafting CPU GUI
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/8187
2021-07-12 20:15:10 +03:00
repo_alt 299cf1887a Merge branch 'master' of https://github.com/GTNewHorizons/WirelessCraftingTerminal 2021-01-01 18:02:04 +03:00
repo-alt cad0646a2a Wireless crafting terminal crash game when placed inside own crafting grid (#3)
* Wireless crafting terminal crash game when placed inside own crafting grid
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6296
2021-01-01 18:01:46 +03:00
repo_alt de05046f38 Wireless crafting terminal crash game when placed inside own crafting grid
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/6296
2021-01-01 17:59:49 +03:00
repo_alt a0e5119ea5 Merge branch 'master' of https://github.com/GTNewHorizons/WirelessCraftingTerminal 2021-01-01 17:57:56 +03:00
repo-alt b7adec99d0 Baubles support (#2)
* Added baubles support
2020-11-05 21:56:17 +03:00
repo_alt 60b17db02f version bumped after merge conflict 2020-11-05 21:53:49 +03:00
repo_alt 8d69577ff5 Merge branch 'master' of https://github.com/GTNewHorizons/WirelessCraftingTerminal 2020-11-05 21:52:53 +03:00
repo_alt b16d5f8e62 Version bump 2020-11-05 21:50:19 +03:00
repo_alt 37fc3c22eb Added baubles support 2020-11-05 21:48:08 +03:00
13 changed files with 402 additions and 53 deletions

No files matched your search

+6 -2
View File
@@ -66,8 +66,10 @@ repositories {
name 'tterrag Repo'
url "http://maven.tterrag.com"
}
maven { // AE2
name 'ae2 repo'
maven {
url = "http://gregtech.overminddl1.com/"
}
maven {
url "http://downloads.gtnewhorizons.com/Mods_for_Jenkins/"
}
}
@@ -81,7 +83,9 @@ dependencies {
}
compile "codechicken:NotEnoughItems:1.7.10-1.0.5.120:dev"
compile "codechicken:CodeChickenCore:1.7.10-1.0.7.47:dev"
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.140:dev"
compile "com.enderio.core:EnderCore:1.7.10-0.1.0.25_beta:dev"
compile "com.azanor.baubles:Baubles:1.7.10-1.0.1.10:deobf"
}
sourceSets {
+1 -1
View File
@@ -1,6 +1,6 @@
aeversion=rv3
wctchannel=
wctbuild=1.8.7.5
wctbuild=1.8.7.9-GTNH
wctgroup=net.p455w0rd.wirelesscraftingterminal
wctbasename=WirelessCraftingTerminal
@@ -311,6 +311,7 @@ public class GuiCraftConfirm extends WCTBaseGui {
dspToolTip = Platform.getItemDisplayName(is);
if (lineList.size() > 0) {
addItemTooltip(is, lineList);
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
}
@@ -293,6 +293,7 @@ public class GuiCraftingCPU extends WCTBaseGui implements ISortSource
if( lineList.size() > 0 )
{
addItemTooltip(is, lineList);
dspToolTip = dspToolTip + '\n' + Joiner.on( "\n" ).join( lineList );
}
@@ -53,6 +53,8 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiScrollbar;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTabButton;
import net.p455w0rd.wirelesscraftingterminal.client.gui.widgets.GuiTrashButton;
@@ -92,7 +94,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
private float xSize_lo;
private float ySize_lo;
public static int tick = 0, GUI_HEIGHT = 240, GUI_WIDTH = 198, AE_ROW_HEIGHT = 18, AE_NUM_ROWS = 0,
public static int tick = 0, GUI_HEIGHT = 240, GUI_WIDTH = 230, AE_ROW_HEIGHT = 18, AE_NUM_ROWS = 0,
GUI_UPPER_HEIGHT = 35, GUI_SEARCH_ROW = 35, SEARCH_X = 81, SEARCH_Y = 5, SEARCH_WIDTH = 88,
SEARCH_HEIGHT = 12, SEARCH_MAXCHARS = 15, GUI_LOWER_HEIGHT, AE_TOTAL_ROWS_HEIGHT,
BUTTON_SEARCH_MODE_POS_X = -18, BUTTON_SEARCH_MODE_POS_Y = 68, BUTTON_SIZE = 16, NEI_EXTRA_SPACE = 30,
@@ -100,7 +102,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
protected static final int BUTTON_SEARCH_MODE_ID = 5;
protected static final long TOOLTIP_UPDATE_INTERVAL = 3000L;
private int currScreenWidth, currScreenHeight;
private static final String bgTexturePath = "gui/crafting.png";
private static final String bgTexturePath = "gui/crafting_viewcell.png";
private final ContainerWirelessCraftingTerminal containerWCT;
private boolean isFullScreen, init = true, reInit, wasResized = false;
public static GuiWirelessCraftingTerminal INSTANCE;
@@ -140,6 +142,7 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
private int standardSize;
private final int lowerTextureOffset = 0;
private int rows = 0;
private final ItemStack[] myCurrentViewCells = new ItemStack[5];
public GuiWirelessCraftingTerminal(Container container) {
super(container);
@@ -672,19 +675,36 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
this.bindTexture(bgTexturePath);
final int x_width = 199;
//draw "over inventory area"
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
for( int x = 0; x < this.rows; x++ )
{
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
}
//draw player inv
this.drawTexturedModalRect( offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + this.reservedSpace - this.lowerTextureOffset );
//draw view cells
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
if (Reference.WCT_BOOSTER_ENABLED) {
this.drawTexturedModalRect(this.guiLeft + 132, (this.guiTop + this.rows * 18) + 83, 237, 237, 19, 19);
}
GuiInventory.func_147046_a(this.guiLeft + 51, (this.guiTop + this.rows * 18) + 94, 32, (float) (this.guiLeft + 51) - this.xSize_lo, (float) ((this.guiTop + this.rows * 18) + 50) - this.ySize_lo, this.mc.thePlayer);
boolean update = false;
for (int i = 0; i < 5; i++) {
if (myCurrentViewCells[i] != containerWCT.getCellViewSlot(i).getStack()) {
update = true;
myCurrentViewCells[i] = containerWCT.getCellViewSlot(i).getStack();
}
}
if (update) {
repo.setViewCell(myCurrentViewCells);
}
}
@@ -922,9 +942,12 @@ public class GuiWirelessCraftingTerminal extends GuiContainer implements ISortSo
final List<Slot> slots = this.getInventorySlots();
for (final Slot s : slots) {
if (s.getSlotIndex() == j && s.inventory == ((ContainerWirelessCraftingTerminal) this.inventorySlots).getPlayerInv()) {
if (!s.canTakeStack(((ContainerWirelessCraftingTerminal) this.inventorySlots).getPlayerInv().player)) {
if (s.getStack() != null && s.getStack().getItem() == WCTApi.instance().items().WirelessCraftingTerminal.getItem())
return false;
if (!s.canTakeStack(((ContainerWirelessCraftingTerminal) this.inventorySlots).getPlayerInv().player))
return false;
}
else
break;
}
}
@@ -21,6 +21,7 @@ import com.google.common.base.Stopwatch;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.ITooltip;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.localization.GuiText;
import appeng.helpers.InventoryAction;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ObfuscationReflectionHelper;
@@ -771,4 +772,19 @@ public abstract class WCTBaseGui extends GuiContainer {
public static final synchronized void setSwitchingGuis(final boolean switchingGuis) {
WCTBaseGui.switchingGuis = switchingGuis;
}
protected void addItemTooltip(ItemStack is, List<String> lineList)
{
if (isShiftKeyDown())
{
List l = is.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
if (!l.isEmpty())
l.remove(0);
lineList.addAll(l);
}
else
{
// TODO: update AE2 on maven and dependency in build gradle
// lineList.add(GuiText.HoldShiftForTooltip.getLocal());
}
}
}
@@ -13,6 +13,7 @@ import java.util.List;
import javax.annotation.Nonnull;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
@@ -96,10 +97,12 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerHotBar;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotPlayerInv;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryBooster;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryCrafting;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryMagnet;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryTrash;
import net.p455w0rd.wirelesscraftingterminal.common.inventory.WCTInventoryViewCell;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.common.utils.WCTLog;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
@@ -111,10 +114,12 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.helpers.WirelessTerminalGuiObject;
public class ContainerWirelessCraftingTerminal extends Container implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory, IContainerCraftingPacket {
public class ContainerWirelessCraftingTerminal extends Container implements IConfigManagerHost, IConfigurableObject,
IMEMonitorHandlerReceiver<IAEItemStack>, IAEAppEngInventory, IContainerCraftingPacket, IViewCellStorage {
private final ItemStack containerstack;
public WCTInventoryCrafting craftingGrid;
public final WCTInventoryCrafting craftingGrid;
public final WCTInventoryViewCell viewCellInventory;
public final WCTInventoryBooster boosterInventory;
public final WCTInventoryMagnet magnetInventory;
public final WCTInventoryTrash trashInventory;
@@ -126,7 +131,8 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
private static final int HOTBAR_START = 1, HOTBAR_END = HOTBAR_START + 8, INV_START = HOTBAR_END + 1,
INV_END = INV_START + 26, ARMOR_START = INV_END + 1, ARMOR_END = ARMOR_START + 3,
CRAFT_GRID_START = ARMOR_END + 1, CRAFT_GRID_END = CRAFT_GRID_START + 8, CRAFT_RESULT = CRAFT_GRID_END + 1,
BOOSTER_INDEX = 0, MAGNET_INDEX = CRAFT_RESULT + 1;
VIEW_CELL_START = CRAFT_RESULT + 1, VIEW_CELL_END = VIEW_CELL_START + 4,
BOOSTER_INDEX = 0, MAGNET_INDEX = VIEW_CELL_END + 1;
public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83;
private SlotBooster boosterSlot;
private SlotMagnet magnetSlot;
@@ -136,6 +142,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
private SlotArmor[] armorSlot;
private SlotCraftingMatrix[] craftMatrixSlot;
private SlotCraftingTerm craftingSlot;
private SlotViewCell[] viewCellSlot;
public SlotTrash trashSlot;
private int firstCraftingSlotNumber = -1, lastCraftingSlotNumber = -1;
@@ -188,6 +195,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
this.thisItem = (IWirelessCraftingTerminalItem) this.containerstack.getItem();
this.worldObj = player.worldObj;
this.craftingGrid = new WCTInventoryCrafting(this, 3, 3, containerstack);
this.viewCellInventory = new WCTInventoryViewCell(RandomUtils.getWirelessTerm(inventoryPlayer));
this.inventoryPlayer = inventoryPlayer;
this.player = player;
craftMatrixInventory = new ItemStack[9];
@@ -195,6 +203,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
inventorySlot = new Slot[27];
armorSlot = new SlotArmor[4];
craftMatrixSlot = new SlotCraftingMatrix[9];
viewCellSlot = new SlotViewCell[5];
this.obj = getGuiObject(containerstack, player, worldObj, (int) player.posX, (int) player.posY, (int) player.posZ);
this.civ = (IPortableCell) this.obj;
@@ -270,6 +279,12 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
// Add crafting result slot
this.addSlotToContainer(craftingSlot);
// Add view cell slots
for (int i = 0; i < 5; i++) {
viewCellSlot[i] = new SlotViewCell(getViewCellStorage(), i, 207, (i * 18) + 8);
addSlotToContainer(viewCellSlot[i]);
}
magnetSlot = new SlotMagnet(this.magnetInventory, 152, -20);
this.addSlotToContainer(magnetSlot);
@@ -695,9 +710,24 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
return null;
}
@Override
public IInventory getViewCellStorage() {
return viewCellInventory;
}
@Override
public ItemStack[] getViewCells() {
return null;
final ItemStack[] list = new ItemStack[viewCellSlot.length];
for (int x = 0; x < viewCellSlot.length; x++) {
list[x] = viewCellSlot[x].getStack();
}
return list;
}
public SlotViewCell getCellViewSlot(final int index) {
return viewCellSlot[index];
}
private WirelessTerminalGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w, final int x, final int y, final int z) {
@@ -1289,6 +1319,9 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
case "crafting":
((WCTInventoryCrafting) craftingGrid).writeNBT(this.containerstack.getTagCompound());
break;
case "viewCell":
((WCTInventoryViewCell) viewCellInventory).writeNBT(this.containerstack.getTagCompound());
break;
case "magnet":
((WCTInventoryMagnet) magnetInventory).writeNBT(this.containerstack.getTagCompound());
break;
@@ -1299,6 +1332,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
default:
((WCTInventoryBooster) boosterInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryCrafting) craftingGrid).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryViewCell) viewCellInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryMagnet) magnetInventory).writeNBT(this.containerstack.getTagCompound());
((WCTInventoryTrash) trashInventory).writeNBT(this.containerstack.getTagCompound());
break;
@@ -1312,7 +1346,7 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
if (tis == null) {
return null;
}
// Try to place armor in armor slot/booster in booster lost first
// Try to place armor in armor slot/booster in booster slot first
if (isInInventory(idx) || isInHotbar(idx)) {
if (tis.getItem() instanceof ItemArmor) {
int type = ((ItemArmor) tis.getItem()).armorType;
@@ -1327,12 +1361,21 @@ public class ContainerWirelessCraftingTerminal extends Container implements ICon
return null;
}
}
else {
if (tis.getItem() instanceof ItemMagnet) {
if (this.mergeItemStack(tis, MAGNET_INDEX, MAGNET_INDEX + 1, false)) {
clickSlot.clearStack();
return null;
else if (tis.getItem() instanceof ItemMagnet) {
if (this.mergeItemStack(tis, MAGNET_INDEX, MAGNET_INDEX + 1, false)) {
clickSlot.clearStack();
return null;
}
}
else if (AEApi.instance().definitions().items().viewCell().isSameAs( tis )) {
if (mergeItemStack(tis.copy(), VIEW_CELL_START, VIEW_CELL_END + 1, false)) {
if (tis.stackSize > 1) {
tis.stackSize--;
}
else {
clickSlot.clearStack();
}
return null;
}
}
}
@@ -0,0 +1,21 @@
package net.p455w0rd.wirelesscraftingterminal.common.container.slot;
import appeng.api.AEApi;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class SlotViewCell extends AppEngSlot {
public SlotViewCell(IInventory inv, int index, int xPos, int yPos) {
super(inv, index, xPos, yPos);
}
@Override
public boolean isItemValid(ItemStack is) {
if( is == null || is.getItem() == null) {
return false;
}
return AEApi.instance().definitions().items().viewCell().isSameAs( is );
}
}
@@ -0,0 +1,137 @@
package net.p455w0rd.wirelesscraftingterminal.common.inventory;
import appeng.api.AEApi;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class WCTInventoryViewCell implements IInventory {
private final String name = "ViewCells";
private final ItemStack invItem;
private ItemStack[] inventory;
public WCTInventoryViewCell(ItemStack stack) {
super();
inventory = new ItemStack[5];
invItem = stack;
if (stack != null) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
readFromNBT(stack.getTagCompound());
}
}
@Override
public int getSizeInventory() {
return 5;
}
@Override
public ItemStack getStackInSlot(int slot) {
return inventory[slot];
}
@Override
public String getInventoryName() {
return name;
}
@Override
public boolean hasCustomInventoryName() {
return name.length() > 0;
}
@Override
public int getInventoryStackLimit() {
return 1;
}
@Override
public ItemStack decrStackSize(int slot, int amount) {
ItemStack stack = getStackInSlot(slot);
if (stack != null) {
if (stack.stackSize > amount) {
stack = stack.splitStack(amount);
markDirty();
}
else {
setInventorySlotContents(slot, null);
}
}
return stack;
}
@Override
public ItemStack getStackInSlotOnClosing(int slot) {
if (inventory[slot] != null) {
ItemStack itemStack = inventory[slot];
inventory[slot] = null;
return itemStack;
}
else {
return null;
}
}
@Override
public void setInventorySlotContents(int slot, ItemStack stack) {
inventory[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
stack.stackSize = getInventoryStackLimit();
}
markDirty();
}
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
return true;
}
@Override
public void markDirty() {
writeNBT(invItem.getTagCompound());
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
return (AEApi.instance().definitions().items().viewCell().isSameAs( itemstack ));
}
public void readFromNBT(NBTTagCompound nbtTagCompound) {
NBTTagList tagList = nbtTagCompound.getTagList(this.name, 10);
inventory = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound tagCompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
int slot = tagCompound.getInteger("Slot");
if (slot >= 0 && slot < inventory.length) {
inventory[slot] = ItemStack.loadItemStackFromNBT(tagCompound);
}
}
}
public void writeNBT(NBTTagCompound nbtTagCompound) {
NBTTagList tagList = new NBTTagList();
for (int currentIndex = 0; currentIndex < inventory.length; ++currentIndex) {
if (inventory[currentIndex] != null) {
NBTTagCompound tagCompound = new NBTTagCompound();
tagCompound.setInteger("Slot", currentIndex);
inventory[currentIndex].writeToNBT(tagCompound);
tagList.appendTag(tagCompound);
}
}
nbtTagCompound.setTag(this.name, tagList);
}
@Override
public void openInventory() {
}
@Override
public void closeInventory() {
}
}
@@ -1,8 +1,10 @@
package net.p455w0rd.wirelesscraftingterminal.common.utils;
import baubles.api.BaublesApi;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -58,6 +60,21 @@ public class RandomUtils {
break;
}
}
IInventory handler = BaublesApi.getBaubles(playerInv.player);
if (handler != null)
{
invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
}
}
}
return wirelessTerm;
}
@@ -18,11 +18,14 @@ import appeng.items.tools.powered.powersink.AERootPoweredItem;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.IBauble;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
@@ -38,7 +41,7 @@ import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.integration.EnderIO;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements IWirelessCraftingTerminalItem {
public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements IWirelessCraftingTerminalItem, IBauble {
public static final String LINK_KEY_STRING = "key";
public static double GLOBAL_POWER_MULTIPLIER = PowerMultiplier.CONFIG.multiplier;
@@ -82,7 +85,70 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem implements I
return false;
}
private boolean isMagnetInstalled(final ItemStack wirelessTerminal) {
/**
* This method return the type of bauble this is.
* Type is used to determine the slots it can go into.
*
* @param itemstack
*/
@Override
public BaubleType getBaubleType(ItemStack itemstack) {
return BaubleType.RING;
}
/**
* This method is called once per tick if the bauble is being worn by a player
*
* @param itemstack
* @param player
*/
@Override
public void onWornTick(ItemStack itemstack, EntityLivingBase player) {
}
/**
* This method is called when the bauble is equipped by a player
*
* @param itemstack
* @param player
*/
@Override
public void onEquipped(ItemStack itemstack, EntityLivingBase player) {
}
/**
* This method is called when the bauble is unequipped by a player
*
* @param itemstack
* @param player
*/
@Override
public void onUnequipped(ItemStack itemstack, EntityLivingBase player) {
}
/**
* can this bauble be placed in a bauble slot
*
* @param itemstack
* @param player
*/
@Override
public boolean canEquip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
/**
* Can this bauble be removed from a bauble slot
*
* @param itemstack
* @param player
*/
@Override
public boolean canUnequip(ItemStack itemstack, EntityLivingBase player) {
return true;
}
private boolean isMagnetInstalled(final ItemStack wirelessTerminal) {
if (wirelessTerminal.hasTagCompound()) {
NBTTagList magnetNBTList = wirelessTerminal.getTagCompound().getTagList(MAGNET_SLOT_NBT, 10);
if (magnetNBTList != null) {
@@ -6,6 +6,7 @@ import java.util.Random;
import appeng.api.AEApi;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.data.IAEItemStack;
import baubles.api.BaublesApi;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
@@ -82,39 +83,55 @@ public class CommonProxy {
else {
playerInv = player.inventory;
}
int invSize = playerInv.getSizeInventory();
if (invSize <= 0) {
return;
}
for (int i = 0; i < invSize; ++i) {
ItemStack item = playerInv.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
}
if (wirelessTerm == null) {
continue;
}
if (wirelessTerm.hasTagCompound()) {
NBTTagCompound nbtTC = wirelessTerm.getTagCompound();
NBTTagList tagList = nbtTC.getTagList("MagnetSlot", 10);
if (tagList != null) {
NBTTagCompound magCompound = tagList.getCompoundTagAt(0);
if (magCompound != null) {
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magCompound);
if (magnetItem != null) {
((ItemMagnet) magnetItem.getItem()).setItemStack(magnetItem);
if (magnetItem.getItem() instanceof ItemMagnet) {
((ItemMagnet) magnetItem.getItem()).doMagnet(magnetItem, e.player.worldObj, e.player, wirelessTerm);
continue;
}
}
}
}
}
}
IInventory handler = BaublesApi.getBaubles(player);
if (handler != null)
{
for (int i = 0; i < handler.getSizeInventory(); ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
}
}
}
if (wirelessTerm == null) {
int invSize = playerInv.getSizeInventory();
if (invSize <= 0) {
return;
}
for (int i = 0; i < invSize; ++i) {
ItemStack item = playerInv.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = item;
break;
}
}
}
if (wirelessTerm == null) {
return;
}
if (wirelessTerm.hasTagCompound()) {
NBTTagCompound nbtTC = wirelessTerm.getTagCompound();
NBTTagList tagList = nbtTC.getTagList("MagnetSlot", 10);
if (tagList != null) {
NBTTagCompound magCompound = tagList.getCompoundTagAt(0);
if (magCompound != null) {
ItemStack magnetItem = ItemStack.loadItemStackFromNBT(magCompound);
if (magnetItem != null) {
((ItemMagnet) magnetItem.getItem()).setItemStack(magnetItem);
if (magnetItem.getItem() instanceof ItemMagnet) {
((ItemMagnet) magnetItem.getItem()).doMagnet(magnetItem, e.player.worldObj, e.player, wirelessTerm);
}
}
}
}
}
}
@SubscribeEvent
@@ -148,12 +165,15 @@ public class CommonProxy {
* AchievementHandler.addAchievementToPage(AchievementHandler.
* boosterAch, true, e.player); }
*/
/* NH fork definitely does not need version checking
if ((Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment")) {
WCTLog.info("Dev environment detected, skipping version check");
}
else {
new VersionCheckHandler();
}
*/
}
else {
final PacketConfigSync p = new PacketConfigSync(Reference.WCT_MAX_POWER, Reference.WCT_EASYMODE_ENABLED, Reference.WCT_BOOSTER_ENABLED, Reference.WCT_BOOSTER_DROPCHANCE, Reference.WCT_MINETWEAKER_OVERRIDE);
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB