Skip to content

Commit f6c0f39

Browse files
committed
Forgot to add all modifications.
1 parent 6156dda commit f6c0f39

83 files changed

Lines changed: 342 additions & 645 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ buildscript {
1717

1818
apply plugin: 'forge'
1919

20-
version = "2.0.1-1.7.x"
20+
version = "1.0.0"
2121
group= "de.eydamos.backpack" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
22-
archivesBaseName = "backpack"
22+
archivesBaseName = "QMXBackpacks"
2323

2424
minecraft {
2525
version = "1.7.2-10.12.2.1147"

src/main/java/de/eydamos/backpack/Backpack.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
import de.eydamos.backpack.proxy.CommonProxy;
2121
import de.eydamos.backpack.recipes.RecipeHelper;
2222

23+
// TODO: Fix bug with 'disallowItems' filter.
24+
// TODO: Fix bug causing backpacks to drop when being picked up from hotbar while open (e.g. lock to hotbar while open).
25+
// TODO: Fix bug causing player's current number of carried backpacks to update incorrectly ('maxBackpackAmount').
26+
// TODO: Fix bug causing backpack SHIFT info to not properly display slot usage.
27+
2328
@Mod(modid = Constants.MOD_ID, name = Constants.MOD_NAME, version = Constants.MOD_VERSION, certificateFingerprint = Constants.FINGERPRINT, guiFactory = Constants.CLASS_GUI_FACTORY)
2429
public class Backpack {
2530
@Instance(Constants.MOD_ID)
@@ -54,7 +59,7 @@ public void preInit(FMLPreInitializationEvent event) {
5459
// key bindings
5560
proxy.registerKeybindings();
5661

57-
FMLInterModComms.sendRuntimeMessage(Constants.MOD_ID, "VersionChecker", "addVersionCheck", Constants.UPDATE_FILE);
62+
//FMLInterModComms.sendRuntimeMessage(Constants.MOD_ID, "VersionChecker", "addVersionCheck", Constants.UPDATE_FILE);
5863
}
5964
}
6065

@@ -74,3 +79,4 @@ public void postInit(FMLPostInitializationEvent event) {
7479
proxy.addNeiSupport();
7580
}
7681
}
82+

src/main/java/de/eydamos/backpack/factory/FactoryBackpackNormal.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import de.eydamos.backpack.inventory.container.Boundaries;
1313
import de.eydamos.backpack.inventory.container.ContainerAdvanced;
1414
import de.eydamos.backpack.inventory.slot.SlotBackpack;
15+
import de.eydamos.backpack.misc.ConfigurationBackpack;
1516
import de.eydamos.backpack.saves.BackpackSave;
1617
import de.eydamos.guiadvanced.form.Label;
1718
import de.eydamos.guiadvanced.subpart.GuiSlot;
@@ -109,10 +110,11 @@ public GuiContainer getGuiContainer(BackpackSave backpack, IInventory[] inventor
109110
guiBackpack.addSubPart(guiSlot);
110111
}
111112

112-
guiBackpack.addSubPart(new Label(X_SPACING, 6, 0x404040, inventories[1].getInventoryName()));
113-
guiBackpack.addSubPart(new Label(X_SPACING, textPositionY, 0x404040, "container.inventory"));
113+
guiBackpack.addSubPart(new Label(X_SPACING, 6, ConfigurationBackpack.GUITextColor, inventories[1].getInventoryName()));
114+
guiBackpack.addSubPart(new Label(X_SPACING, textPositionY, ConfigurationBackpack.GUITextColor, "container.inventory"));
114115

115116
return guiBackpack;
116117
}
117118

118119
}
120+

src/main/java/de/eydamos/backpack/factory/FactoryPersonalSlot.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import de.eydamos.backpack.inventory.container.ContainerPersonalSlot;
1717
import de.eydamos.backpack.inventory.slot.SlotBackpackOnly;
1818
import de.eydamos.backpack.inventory.slot.SlotPhantom;
19+
import de.eydamos.backpack.misc.ConfigurationBackpack;
1920
import de.eydamos.backpack.misc.Localizations;
2021
import de.eydamos.backpack.saves.PlayerSave;
2122
import de.eydamos.backpack.util.BackpackUtil;
@@ -108,10 +109,11 @@ public GuiContainer getGuiContainer(PlayerSave player, IInventory[] inventories,
108109
guiBackpack.addSubPart(guiSlot);
109110
}
110111

111-
guiBackpack.addSubPart(new Label(X_SPACING, 6, 0x404040, container.getInventoryToSave().getInventoryName()));
112-
guiBackpack.addSubPart(new Label(X_SPACING, 38, 0x404040, container.getInventoryPickup().getInventoryName()));
112+
guiBackpack.addSubPart(new Label(X_SPACING, 6, ConfigurationBackpack.GUITextColor, container.getInventoryToSave().getInventoryName()));
113+
guiBackpack.addSubPart(new Label(X_SPACING, 38, ConfigurationBackpack.GUITextColor, container.getInventoryPickup().getInventoryName()));
113114

114115
return guiBackpack;
115116
}
116117

117118
}
119+

src/main/java/de/eydamos/backpack/factory/FactoryWorkbenchBackpack.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import de.eydamos.backpack.inventory.slot.SlotBackpack;
1717
import de.eydamos.backpack.inventory.slot.SlotCraftingAdvanced;
1818
import de.eydamos.backpack.inventory.slot.SlotPhantom;
19+
import de.eydamos.backpack.misc.ConfigurationBackpack;
1920
import de.eydamos.backpack.saves.BackpackSave;
2021
import de.eydamos.guiadvanced.form.Button;
2122
import de.eydamos.guiadvanced.form.Label;
@@ -199,10 +200,11 @@ public GuiContainer getGuiContainer(BackpackSave backpack, IInventory[] inventor
199200
int inventoryRows = (int) Math.ceil(inventories[1].getSizeInventory() / (float) slotsPerRow);
200201
int textPositionY2 = textPositionY + inventoryRows * SLOT + 3 * SLOT + 19;
201202

202-
guiBackpack.addSubPart(new Label(textPositionX, textPositionY, 0x404040, "container.crafting", alignment));
203-
guiBackpack.addSubPart(new Label(X_SPACING, textPositionY2, 0x404040, "container.inventory"));
203+
guiBackpack.addSubPart(new Label(textPositionX, textPositionY, ConfigurationBackpack.GUITextColor, "container.crafting", alignment));
204+
guiBackpack.addSubPart(new Label(X_SPACING, textPositionY2, ConfigurationBackpack.GUITextColor, "container.inventory"));
204205

205206
return guiBackpack;
206207
}
207208

208209
}
210+

src/main/java/de/eydamos/backpack/gui/GuiBackpackRename.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import cpw.mods.fml.client.FMLClientHandler;
99
import de.eydamos.backpack.helper.GuiHelper;
10+
import de.eydamos.backpack.misc.ConfigurationBackpack;
1011
import de.eydamos.backpack.misc.Localizations;
1112
import de.eydamos.guiadvanced.Window;
1213
import de.eydamos.guiadvanced.form.Button;
@@ -39,10 +40,10 @@ public GuiBackpackRename() {
3940

4041
// create "Rename your Backpack" label at the top in the middle
4142
int posX = xSize / 2 - fontRendererObj.getStringWidth(TITLE) / 2;
42-
addSubPart(new Label(posX, 10, 0x000000, TITLE));
43+
addSubPart(new Label(posX, 10, ConfigurationBackpack.GUITextColor, TITLE));
4344

44-
// create "New name:" label at the left site above the GuiTextField
45-
addSubPart(new Label(20, 30, 0x404040, NEW_NAME));
45+
// create "New Name:" label at the left site above the GuiTextField
46+
addSubPart(new Label(20, 30, ConfigurationBackpack.GUITextColor, NEW_NAME));
4647

4748
// create text field
4849
txt_backpackName = new Textbox(fontRendererObj, 20, 40, 200, 20);

src/main/java/de/eydamos/backpack/helper/InventoryHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void readInventory(BackpackSave backpackSave, String name, ItemSta
2424

2525
/**
2626
* This method will read the ItemStacks from the given ItemStack's
27-
* NBTCompount with the given key and load them into the given inventory.
27+
* NBTCompound with the given key and load them into the given inventory.
2828
*
2929
* @param backpackSave
3030
* The BackpackSave with the NBTCompound to read from.

src/main/java/de/eydamos/backpack/item/ItemBackpack.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ public void registerIcons(IIconRegister iconRegister) {
2929

3030
String name;
3131
for(int tier = 0; tier < 3; tier++) {
32-
// TODO remove when tier 1 added
33-
if(tier == 1) continue;
3432
for(int meta = 0; meta < 17; meta++) {
3533
name = "backpack:backpack";
34+
name += '_' + ItemsBackpack.BACKPACK_TIERS[tier];
3635
name += (meta == 0 ? "" : '_') + ItemsBackpack.BACKPACK_COLORS[meta];
37-
name += (tier == 0 ? "" : '_') + ItemsBackpack.BACKPACK_TIERS[tier];
3836
icons[tier * 17 + meta] = iconRegister.registerIcon(name);
3937
}
4038
}
@@ -59,3 +57,4 @@ public IIcon getIconFromDamage(int damage) {
5957
return icons[tier * 17 + meta];
6058
}
6159
}
60+

src/main/java/de/eydamos/backpack/item/ItemBackpackBase.java

Lines changed: 13 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public void getSubItems(Item item, CreativeTabs tab, List subItems) {
5555
subItems.add(new ItemStack(item, 1, ItemsBackpack.ENDERBACKPACK));
5656
} else if(item == ItemsBackpack.workbenchBackpack) {
5757
subItems.add(new ItemStack(item, 1, 17));
58+
subItems.add(new ItemStack(item, 1, 117));
5859
subItems.add(new ItemStack(item, 1, 217));
5960
}
6061
}
@@ -87,63 +88,6 @@ public void getSubItems(Item item, CreativeTabs tab, List subItems) {
8788
*/
8889
@Override
8990
public boolean onItemUse(ItemStack stack, EntityPlayer player, World worldObj, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
90-
/*
91-
TileEntity te = worldObj.getTileEntity(x, y, z);
92-
if(te != null && (te instanceof IInventory || te instanceof TileEntityEnderChest)) {
93-
boolean openGui = false;
94-
if(te instanceof TileEntityChest) {
95-
openGui = true;
96-
}
97-
if(te instanceof TileEntityEnderChest && !BackpackUtil.isEnderBackpack(stack)) {
98-
openGui = true;
99-
}
100-
if(te instanceof TileEntityFurnace) {
101-
openGui = true;
102-
}
103-
if(te instanceof TileEntityHopper) {
104-
openGui = true;
105-
}
106-
if(te instanceof TileEntityBrewingStand) {
107-
openGui = true;
108-
}
109-
if(te instanceof TileEntityDispenser) {
110-
openGui = true;
111-
}
112-
if(te instanceof TileEntityDropper) {
113-
openGui = true;
114-
}
115-
116-
if(te.getClass().getSimpleName().equals("TileEntityDirtChest")) {
117-
openGui = true;
118-
}
119-
if(te.getClass().getSimpleName().equals("TileEntityCopperChest")) {
120-
openGui = true;
121-
}
122-
if(te.getClass().getSimpleName().equals("TileEntityIronChest")) {
123-
openGui = true;
124-
}
125-
if(te.getClass().getSimpleName().equals("TileEntitySilverChest")) {
126-
openGui = true;
127-
}
128-
if(te.getClass().getSimpleName().equals("TileEntityGoldChest")) {
129-
openGui = true;
130-
}
131-
if(te.getClass().getSimpleName().equals("TileEntityDiamondChest")) {
132-
openGui = true;
133-
}
134-
if(te.getClass().getSimpleName().equals("TileEntityCrystalChest")) {
135-
openGui = true;
136-
}
137-
if(te.getClass().getSimpleName().equals("TileEntityObsidianChest")) {
138-
openGui = true;
139-
}
140-
141-
if(openGui) {
142-
//player.openGui(Backpack.instance, Constants.GUI_ID_COMBINED, worldObj, x, y, z);
143-
return true;
144-
}
145-
}
146-
*/
14791
return false;
14892
}
14993

@@ -173,7 +117,7 @@ public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer
173117
}
174118

175119
// when the player is not sneaking
176-
if(!entityPlayer.isSneaking() && !ConfigurationBackpack.OPEN_ONLY_PERSONAL_BACKPACK) {
120+
if(!entityPlayer.isSneaking() && !ConfigurationBackpack.OPEN_ONLY_WORN_BACKPACK) {
177121
GuiHelper.displayBackpack(new BackpackSave(itemStack), getInventory(itemStack, entityPlayer), (EntityPlayerMP) entityPlayer);
178122
}
179123
return itemStack;
@@ -189,15 +133,17 @@ public String getUnlocalizedName(ItemStack itemStack) {
189133
String name = super.getUnlocalizedName();
190134

191135
int damage = itemStack.getItemDamage();
192-
int tier = damage / 100 < 3 ? damage / 100 : 0;
136+
int tier = ( ( damage / 100 ) < 3 ) ? ( damage / 100 ) : 0;
193137
int meta = damage % 100;
194-
name += (tier == 0 ? "" : '.') + ItemsBackpack.BACKPACK_TIERS[tier];
195-
if(meta > 0 && meta < 17) { // add color
196-
name += (tier == 0 ? '.' : '_') + ItemsBackpack.BACKPACK_COLORS[damage % 100];
197-
}
198-
if(meta == 99) { // ender backpack
199-
name += (tier == 0 ? '.' : '_') + ItemsBackpack.BACKPACK_COLORS[17];
138+
139+
if((meta >= 0) && (meta <= 17)) {
140+
// standard or workbench backpack
141+
name += '.' + ItemsBackpack.BACKPACK_TIERS[tier] + (((meta > 0) && (meta < 17)) ? ( '_' + ItemsBackpack.BACKPACK_COLORS[damage % 100] ) : "" );
142+
} else if(meta == 99) {
143+
// ender backpack
144+
name += '.' + ItemsBackpack.BACKPACK_COLORS[17];
200145
}
146+
201147
return name;
202148
}
203149

@@ -214,6 +160,7 @@ public String getItemStackDisplayName(ItemStack itemStack) {
214160
if(NBTItemStackUtil.hasTag(itemStack, Constants.NBT.CUSTOM_NAME)) {
215161
return NBTItemStackUtil.getString(itemStack, Constants.NBT.CUSTOM_NAME);
216162
}
163+
217164
return StatCollector.translateToLocal(getUnlocalizedName(itemStack) + ".name");
218165
}
219166

@@ -262,3 +209,4 @@ public static IInventory getInventory(ItemStack itemStack, EntityPlayer entityPl
262209
return inventory;
263210
}
264211
}
212+

src/main/java/de/eydamos/backpack/item/ItemWorkbenchBackpack.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ public ItemWorkbenchBackpack() {
2626
@Override
2727
@SideOnly(Side.CLIENT)
2828
public void registerIcons(IIconRegister iconRegister) {
29-
icons = new IIcon[2];
30-
icons[0] = iconRegister.registerIcon("backpack:backpack_workbench");
31-
icons[1] = iconRegister.registerIcon("backpack:backpack_workbench_big");
29+
icons = new IIcon[3];
30+
icons[0] = iconRegister.registerIcon("backpack:backpack_workbench_small");
31+
icons[1] = iconRegister.registerIcon("backpack:backpack_workbench_medium");
32+
icons[2] = iconRegister.registerIcon("backpack:backpack_workbench_large");
3233
}
3334

3435
/**
@@ -41,13 +42,16 @@ public void registerIcons(IIconRegister iconRegister) {
4142
@Override
4243
@SideOnly(Side.CLIENT)
4344
public IIcon getIconFromDamage(int damage) {
44-
if(damage == 17) {
45-
return icons[0];
45+
IIcon result = icons[0];
46+
47+
if(damage == 117) {
48+
result = icons[1];
4649
}
4750
if(damage == 217) {
48-
return icons[1];
51+
result = icons[2];
4952
}
50-
return icons[0];
53+
54+
return result;
5155
}
5256

5357
@Override
@@ -60,3 +64,4 @@ public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List
6064
}
6165
}
6266
}
67+

0 commit comments

Comments
 (0)