mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-16 10:34:53 +00:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bbb374cd5e | ||
|
|
3470c6c7d1 |
No files matched your search
+1
-1
@@ -6,7 +6,7 @@ dependencies {
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.19:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.8.93-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.59:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
compileOnly('curse.maven:craftguide-75557:2459320')
|
||||
devOnlyNonPublishable('net.xonich.mc:NoHotbarNeeded:0.0.3:dev')
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainVersion=25
|
||||
@@ -8,7 +8,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.gui;
|
||||
|
||||
import static forestry.core.inventory.ItemLocation.TYPE.PLAYER_INVENTORY;
|
||||
import static forestry.core.inventory.ItemLocation.Type.PLAYER_INVENTORY;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -53,6 +53,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
* @param invSlotIdx Index or slot in player inventory should be in range [0, 40).
|
||||
*/
|
||||
public static void openGui(EntityPlayer entityPlayer, IGuiHandlerItem guiHandler, short data, int invSlotIdx) {
|
||||
assert invSlotIdx >= 0 && invSlotIdx < 40 : "Incorrect inventory index is used: " + invSlotIdx;
|
||||
int guiData = encodeGuiData(guiHandler, data, invSlotIdx);
|
||||
entityPlayer.openGui(ForestryAPI.instance, guiData, entityPlayer.worldObj, 0, 0, 0);
|
||||
}
|
||||
@@ -88,7 +89,7 @@ public class GuiHandler implements IGuiHandler {
|
||||
*/
|
||||
private static int encodeGuiData(IGuiHandlerForestry guiHandler, short data, int invSlotIdx) {
|
||||
// inventory slot idx will be encoded in third byte
|
||||
// player have 40 different inventory which means that we need 6 bits to encode all values.
|
||||
// player inventory has 40 slots which means that we need 6 bits to encode all values.
|
||||
// first 2 bits are reserved for type currently values 0(heldItem) and 1(item inventory) have meaning,
|
||||
// 2 and 3 are reserved for possible extension.
|
||||
if (invSlotIdx < -1 || invSlotIdx >= 40) {
|
||||
|
||||
@@ -5,24 +5,24 @@ package forestry.core.inventory;
|
||||
*/
|
||||
public class ItemLocation {
|
||||
|
||||
public enum TYPE {
|
||||
public enum Type {
|
||||
UNKNOWN,
|
||||
HELD_BY_PLAYER,
|
||||
PLAYER_INVENTORY
|
||||
}
|
||||
|
||||
public static final ItemLocation UNKNOWN = new ItemLocation(TYPE.UNKNOWN, -1);
|
||||
public static final ItemLocation HELD_BY_PLAYER = new ItemLocation(TYPE.HELD_BY_PLAYER, -1);
|
||||
public static final ItemLocation UNKNOWN = new ItemLocation(Type.UNKNOWN, -1);
|
||||
public static final ItemLocation HELD_BY_PLAYER = new ItemLocation(Type.HELD_BY_PLAYER, -1);
|
||||
|
||||
private final TYPE type;
|
||||
private final Type type;
|
||||
private final int slotIdx;
|
||||
|
||||
public ItemLocation(TYPE type, int slotIdx) {
|
||||
public ItemLocation(Type type, int slotIdx) {
|
||||
this.type = type;
|
||||
this.slotIdx = slotIdx;
|
||||
}
|
||||
|
||||
public TYPE type() {
|
||||
public Type type() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.xonich.mc.nohotbarneeded.api.ActivatableFromInventoryServerSide;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.common.eventhandler.Event;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -47,6 +48,9 @@ import forestry.storage.gui.GuiBackpack;
|
||||
import forestry.storage.gui.GuiBackpackT2;
|
||||
import forestry.storage.inventory.ItemInventoryBackpack;
|
||||
|
||||
@Optional.Interface(
|
||||
iface = "net.xonich.mc.nohotbarneeded.api.ActivatableFromInventoryServerSide",
|
||||
modid = "nohotbarneeded")
|
||||
public class ItemBackpack extends ItemWithGui implements ActivatableFromInventoryServerSide {
|
||||
|
||||
private final IBackpackDefinition definition;
|
||||
@@ -322,7 +326,7 @@ public class ItemBackpack extends ItemWithGui implements ActivatableFromInventor
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
if (data > EnumBackpackType.values().length) {
|
||||
if (data >= EnumBackpackType.values().length) {
|
||||
return null;
|
||||
}
|
||||
EnumBackpackType type = EnumBackpackType.values()[data];
|
||||
@@ -338,7 +342,7 @@ public class ItemBackpack extends ItemWithGui implements ActivatableFromInventor
|
||||
|
||||
@Override
|
||||
public Object getContainer(EntityPlayer player, ItemStack heldItem, int data, ItemLocation loc) {
|
||||
if (data > EnumBackpackType.values().length) {
|
||||
if (data >= EnumBackpackType.values().length) {
|
||||
return null;
|
||||
}
|
||||
EnumBackpackType type = EnumBackpackType.values()[data];
|
||||
@@ -366,6 +370,7 @@ public class ItemBackpack extends ItemWithGui implements ActivatableFromInventor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "nohotbarneeded")
|
||||
public void activateFromInventory(EntityPlayerMP player, int slotIdx) {
|
||||
GuiHandler.openGui(player, this, (short) type.ordinal(), slotIdx);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
package forestry.storage.items;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
@@ -57,4 +59,10 @@ public class ItemBackpackNaturalist extends ItemBackpack {
|
||||
loc);
|
||||
return new ContainerNaturalistBackpack(player, inventory, page);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "nohotbarneeded")
|
||||
public void activateFromInventory(EntityPlayerMP player, int slotIdx) {
|
||||
GuiHandler.openGui(player, this, /* page */(short) 0, slotIdx);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user