Convert lock upgrade to reusable drawer key.

This commit is contained in:
Justin Aquadro committed 2015-04-16 23:54:42 -04:00
1 parent 6208dc758d
commit 731f8699f2
5 files changed
+24 -22

No files matched your search

@@ -222,25 +222,10 @@ public class BlockDrawers extends BlockContainer implements IExtendedBlockClickH
return true;
}
else if (item.getItem() == ModItems.upgradeLock && !tileDrawers.isLocked()) {
tileDrawers.setIsLocked(true);
else if (item.getItem() == ModItems.upgradeLock) {
tileDrawers.setIsLocked(!tileDrawers.isLocked());
world.markBlockForUpdate(x, y, z);
if (player != null && !player.capabilities.isCreativeMode) {
if (--item.stackSize <= 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
return true;
}
}
else if (item == null && player.isSneaking()) {
if (tileDrawers.isLocked()) {
tileDrawers.setIsLocked(false);
if (player != null && !player.capabilities.isCreativeMode)
dropBlockAsItem(world, x, y, z, new ItemStack(ModItems.upgradeLock));
world.markBlockForUpdate(x, y, z);
return true;
}
}
@@ -78,8 +78,8 @@ public class ModRecipes
}
if (config.cache.enableLockUpgrades) {
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeLock), " y ", "xzx", "yxy",
'x', Items.stick, 'y', Items.gold_nugget, 'z', ModItems.upgradeTemplate);
GameRegistry.addRecipe(new ItemStack(ModItems.upgradeLock), "xy ", " y ", " z ",
'x', Items.gold_nugget, 'y', Items.gold_ingot, 'z', ModItems.upgradeTemplate);
}
}
}
@@ -1,9 +1,13 @@
package com.jaquadro.minecraft.storagedrawers.item;
import com.google.common.collect.Multimap;
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
import com.jaquadro.minecraft.storagedrawers.core.ModCreativeTabs;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -16,7 +20,7 @@ public class ItemUpgradeLock extends Item
public ItemUpgradeLock (String name) {
setUnlocalizedName(name);
setCreativeTab(ModCreativeTabs.tabStorageDrawers);
setTextureName(StorageDrawers.MOD_ID + ":upgrade_lock");
setTextureName(StorageDrawers.MOD_ID + ":drawer_key");
setMaxDamage(0);
}
@@ -26,4 +30,17 @@ public class ItemUpgradeLock extends Item
String name = getUnlocalizedName(itemStack);
list.add(StatCollector.translateToLocalFormatted(name + ".description"));
}
@SideOnly(Side.CLIENT)
public boolean isFull3D()
{
return true;
}
@Override
public Multimap getAttributeModifiers (ItemStack item) {
Multimap multimap = super.getAttributeModifiers(item);
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double)1, 0));
return multimap;
}
}