mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-26 06:53:24 +00:00
Fix bad merge, re-add new DS Armor modules
This commit is contained in:
1 parent
4872486aec
commit
6cb240f90a
2 files changed
+116
No files matched your search
@@ -0,0 +1,62 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.PotionHelper;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class NightVisionUpgrade extends AbstractUpgrade {
|
||||
|
||||
private static String UPGRADE_NAME = "nightVision";
|
||||
|
||||
public static final NightVisionUpgrade INSTANCE = new NightVisionUpgrade();
|
||||
|
||||
public static NightVisionUpgrade 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 NightVisionUpgrade((NBTTagCompound) stack.stackTagCompound.getTag(KEY_UPGRADE_PREFIX + UPGRADE_NAME));
|
||||
}
|
||||
|
||||
private static ItemStack createUpgradeItem() {
|
||||
ItemStack pot = new ItemStack(Items.potionitem, 1, 0);
|
||||
int res = PotionHelper.applyIngredient(0, Items.nether_wart.getPotionEffect(new ItemStack(Items.nether_wart)));
|
||||
res = PotionHelper.applyIngredient(res, PotionHelper.goldenCarrotEffect);
|
||||
pot.setItemDamage(res);
|
||||
return pot;
|
||||
}
|
||||
|
||||
|
||||
public NightVisionUpgrade(NBTTagCompound tag) {
|
||||
super(UPGRADE_NAME, tag);
|
||||
}
|
||||
|
||||
public NightVisionUpgrade() {
|
||||
super(UPGRADE_NAME, "enderio.darksteel.upgrade.nightVision", createUpgradeItem(), Config.darkSteelNightVisionCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddToItem(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != EnderIO.itemDarkSteelHelmet) {
|
||||
return false;
|
||||
}
|
||||
NightVisionUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class SwimUpgrade extends AbstractUpgrade {
|
||||
|
||||
private static String UPGRADE_NAME = "swim";
|
||||
|
||||
public static final SwimUpgrade INSTANCE = new SwimUpgrade();
|
||||
|
||||
public static SwimUpgrade 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 SwimUpgrade((NBTTagCompound) stack.stackTagCompound.getTag(KEY_UPGRADE_PREFIX + UPGRADE_NAME));
|
||||
}
|
||||
|
||||
|
||||
public SwimUpgrade(NBTTagCompound tag) {
|
||||
super(UPGRADE_NAME, tag);
|
||||
}
|
||||
|
||||
public SwimUpgrade() {
|
||||
super(UPGRADE_NAME, "enderio.darksteel.upgrade.swim", new ItemStack(Blocks.waterlily), Config.darkSteelSwimCost);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddToItem(ItemStack stack) {
|
||||
if(stack == null || stack.getItem() != EnderIO.itemDarkSteelBoots) {
|
||||
return false;
|
||||
}
|
||||
SwimUpgrade up = loadFromItem(stack);
|
||||
if(up == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeUpgradeToNBT(NBTTagCompound upgradeRoot) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user