mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-24 05:54:27 +00:00
Added spoon upgrade.
This commit is contained in:
1 parent
253e856768
commit
c975bdeac5
6 files changed
+101
-17
No files matched your search
@@ -182,7 +182,8 @@ public final class Config {
|
||||
public static int darkSteelSoundLocatorRange = 40;
|
||||
public static int darkSteelSoundLocatorLifespan = 40;
|
||||
|
||||
public static int darkSteelTravelCost = 30;
|
||||
public static int darkSteelTravelCost = 30;
|
||||
public static int darkSteelSpoonCost = 15;
|
||||
|
||||
public static int hootchPowerPerCycle = 6;
|
||||
public static int hootchPowerTotalBurnTime = 6000;
|
||||
@@ -567,8 +568,11 @@ public final class Config {
|
||||
darkSteelSoundLocatorLifespan = config.get(sectionDarkSteel.name, "darkSteelSoundLocatorLifespan", darkSteelSoundLocatorLifespan,
|
||||
"Number of ticks the 'Sound Locator' icons are displayed for.").getInt(darkSteelSoundLocatorLifespan);
|
||||
|
||||
darkSteelTravelCost= config.get(sectionDarkSteel.name, "darkSteelTravelCost", darkSteelTravelCost,
|
||||
darkSteelTravelCost = config.get(sectionDarkSteel.name, "darkSteelTravelCost", darkSteelTravelCost,
|
||||
"Number of levels required for the 'Travel' upgrade.").getInt(darkSteelTravelCost);
|
||||
|
||||
darkSteelSpoonCost = config.get(sectionDarkSteel.name, "darkSteelSpoonCost", darkSteelSpoonCost,
|
||||
"Number of levels required for the 'Spoon' upgrade.").getInt(darkSteelSpoonCost);
|
||||
|
||||
darkSteelSwordSkullChance = (float) config.get(sectionDarkSteel.name, "darkSteelSwordSkullChance", darkSteelSwordSkullChance,
|
||||
"The base chance that a skull will be dropped when using a powered dark steel sword (0 = no chance, 1 = 100% chance)").getDouble(
|
||||
|
||||
@@ -39,6 +39,7 @@ public class DarkSteelRecipeManager {
|
||||
upgrades.add(SwimUpgrade.INSTANCE);
|
||||
upgrades.add(NightVisionUpgrade.INSTANCE);
|
||||
upgrades.add(TravelUpgrade.INSTANCE);
|
||||
upgrades.add(SpoonUpgrade.INSTANCE);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
@@ -31,6 +34,10 @@ import crazypants.util.Lang;
|
||||
|
||||
public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContainerItem, IAdvancedTooltipProvider, IDarkSteelItem, IItemOfTravel {
|
||||
|
||||
private static final Set SHOVEL_BLOCKS = Sets.newHashSet(new Block[] {
|
||||
Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow,
|
||||
Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium });
|
||||
|
||||
public static boolean isEquipped(EntityPlayer player) {
|
||||
if(player == null) {
|
||||
return false;
|
||||
@@ -69,21 +76,22 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
ItemStack is = new ItemStack(this);
|
||||
ItemStack is = new ItemStack(this);
|
||||
par3List.add(is);
|
||||
|
||||
is = new ItemStack(this);
|
||||
is = new ItemStack(this);
|
||||
EnergyUpgrade.EMPOWERED_FOUR.writeToItem(is);
|
||||
EnergyUpgrade.setPowerFull(is);
|
||||
EnergyUpgrade.setPowerFull(is);
|
||||
TravelUpgrade.INSTANCE.writeToItem(is);
|
||||
SpoonUpgrade.INSTANCE.writeToItem(is);
|
||||
par3List.add(is);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getIngotsRequiredForFullRepair() {
|
||||
return 3;
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isDamaged(ItemStack stack) {
|
||||
return false;
|
||||
@@ -137,15 +145,25 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float func_150893_a(ItemStack item, Block block) {
|
||||
if(block == Blocks.obsidian && getEnergyStored(item) > 0) {
|
||||
int energy = getEnergyStored(item);
|
||||
if(block == Blocks.obsidian && energy > 0) {
|
||||
return super.func_150893_a(item, block) + Config.darkSteelPickEffeciencyObsidian;
|
||||
}
|
||||
}
|
||||
if(energy > 0 && hasSpoonUpgrade(item)) {
|
||||
if(SHOVEL_BLOCKS.contains(block)) {
|
||||
return efficiencyOnProperMaterial;
|
||||
}
|
||||
}
|
||||
return super.func_150893_a(item, block);
|
||||
}
|
||||
|
||||
private boolean hasSpoonUpgrade(ItemStack item) {
|
||||
return SpoonUpgrade.loadFromItem(item) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDigSpeed(ItemStack stack, Block block, int meta) {
|
||||
if(ForgeHooks.isToolEffective(stack, block, meta)) {
|
||||
@@ -230,13 +248,13 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
|
||||
public void extractInternal(ItemStack equipped, int power) {
|
||||
extractEnergy(equipped, power, false);
|
||||
}
|
||||
|
||||
|
||||
private boolean isTravelUpgradeActive(EntityPlayer ep, ItemStack equipped) {
|
||||
return isEquipped(ep) && ep.isSneaking() && TravelUpgrade.loadFromItem(equipped) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
if(isTravelUpgradeActive(player, stack)) {
|
||||
if(world.isRemote) {
|
||||
if(TravelController.instance.activateTravelAccessable(stack, world, player, TravelSource.STAFF)) {
|
||||
@@ -244,7 +262,7 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
long ticksSinceBlink = player.worldObj.getTotalWorldTime() - lastBlickTick;
|
||||
if(ticksSinceBlink < 0) {
|
||||
lastBlickTick = -1;
|
||||
@@ -254,11 +272,11 @@ public class ItemDarkSteelPickaxe extends ItemPickaxe implements IEnergyContaine
|
||||
player.swingItem();
|
||||
lastBlickTick = player.worldObj.getTotalWorldTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
|
||||
return super.onItemRightClick(stack, world, player);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
import crazypants.enderio.material.Material;
|
||||
|
||||
public class SpoonUpgrade extends AbstractUpgrade {
|
||||
|
||||
private static String UPGRADE_NAME = "spoon";
|
||||
|
||||
public static final SpoonUpgrade INSTANCE = new SpoonUpgrade();
|
||||
|
||||
public static SpoonUpgrade loadFromItem(ItemStack stack) {
|
||||
if(stack == null) {
|
||||
return null;
|
||||
}
|
||||
if(stack.stackTagCompound == null) {
|
||||
return null;
|
||||
}
|
||||
if(!stack.stackTagCompound.hasKey(KEY_UPGRADE_PREFIX + UPGRADE_NAME)) {
|
||||
return null;
|
||||
}
|
||||
return new SpoonUpgrade((NBTTagCompound) stack.stackTagCompound.getTag(KEY_UPGRADE_PREFIX + UPGRADE_NAME));
|
||||
}
|
||||
|
||||
|
||||
public SpoonUpgrade(NBTTagCompound tag) {
|
||||
super(UPGRADE_NAME, tag);
|
||||
}
|
||||
|
||||
public SpoonUpgrade() {
|
||||
super(UPGRADE_NAME, "enderio.darksteel.upgrade.spoon", new ItemStack(Items.diamond_shovel), Config.darkSteelSpoonCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddToItem(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != EnderIO.itemDarkSteelPickaxe || !EnergyUpgrade.itemHasAnyPowerUpgrade(stack)) {
|
||||
return false;
|
||||
}
|
||||
SpoonUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user