mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
port in some fixes from 1.6.x
This commit is contained in:
1 parent
cd9e0f6452
commit
9fce66a827
15 files changed
+453
-59
No files matched your search
@@ -34,6 +34,8 @@ import tconstruct.library.crafting.*;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import tconstruct.modifiers.armor.AModMoveSpeed;
|
||||
import tconstruct.modifiers.tools.*;
|
||||
import tconstruct.modifiers.armor.*;
|
||||
|
||||
import tconstruct.util.RecipeRemover;
|
||||
import tconstruct.util.TDispenserBehaviorArrow;
|
||||
import tconstruct.util.TDispenserBehaviorSpawnEgg;
|
||||
@@ -249,11 +251,9 @@ public class TRecipes
|
||||
TRepo.modFlux = new ModFlux();
|
||||
tb.registerToolMod(TRepo.modFlux);
|
||||
|
||||
EnumSet<EnumArmorPart> allArmors = EnumSet.of(EnumArmorPart.HELMET, EnumArmorPart.CHEST, EnumArmorPart.PANTS, EnumArmorPart.SHOES);
|
||||
ItemStack redstoneItem = new ItemStack(Items.redstone);
|
||||
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
|
||||
tb.registerToolMod(new ModRedstone(2, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
|
||||
tb.registerArmorMod(new AModMoveSpeed(2, allArmors, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }, false));
|
||||
|
||||
ItemStack lapisItem = new ItemStack(Items.dye, 1, 4);
|
||||
ItemStack lapisBlock = new ItemStack(Blocks.lapis_block);
|
||||
@@ -290,6 +290,15 @@ public class TRecipes
|
||||
ItemStack obsidianPlate = new ItemStack(TRepo.largePlate, 1, 6);
|
||||
tb.registerToolMod(new ModReinforced(new ItemStack[] { obsidianPlate }, 16, 1));
|
||||
|
||||
EnumSet<EnumArmorPart> allArmors = EnumSet.of(EnumArmorPart.HELMET, EnumArmorPart.CHEST, EnumArmorPart.PANTS, EnumArmorPart.SHOES);
|
||||
EnumSet<EnumArmorPart> chest = EnumSet.of(EnumArmorPart.CHEST);
|
||||
tb.registerArmorMod(new AModMoveSpeed(0, allArmors, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }, false));
|
||||
tb.registerArmorMod(new AModKnockbackResistance(1, allArmors, new ItemStack[] { new ItemStack(Items.gold_ingot), new ItemStack(Blocks.gold_block) }, new int[] { 1, 9 }, false));
|
||||
tb.registerArmorMod(new AModHealthBoost(2, allArmors, new ItemStack[] { new ItemStack(TRepo.heartCanister, 1, 2) }, new int[] { 2 }, true));
|
||||
tb.registerArmorMod(new AModDamageBoost(3, allArmors, new ItemStack[] { new ItemStack(Items.diamond), new ItemStack(Blocks.diamond_block) }, new int[] { 1, 9 }, false, 3, 0.05));
|
||||
tb.registerArmorMod(new AModDamageBoost(4, chest, new ItemStack[] { new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1 }, true, 5, 1));
|
||||
tb.registerArmorMod(new AModProtection(5, allArmors, new ItemStack[] { new ItemStack(TRepo.largePlate, 1, 2) }, new int[] { 2 }));
|
||||
|
||||
TConstructRegistry.registerActiveToolMod(new TActiveOmniMod());
|
||||
}
|
||||
|
||||
@@ -494,6 +503,8 @@ public class TRecipes
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TRepo.manualBook, 1, 3), new ItemStack(TRepo.manualBook, 1, 2));
|
||||
// alternative Vanilla Book Recipe
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(Items.book), Items.paper, Items.paper, Items.paper, Items.string, TRepo.blankPattern, TRepo.blankPattern);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.name_tag), "P~ ", "~O ", " ~", '~', Items.string, 'P', Items.paper, 'O', "slimeball"));
|
||||
|
||||
// Paperstack Recipe
|
||||
GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 0), "pp", "pp", 'p', Items.paper);
|
||||
// Mossball Recipe
|
||||
@@ -516,11 +527,29 @@ public class TRecipes
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.materials, 1, 25), patSurround, 'm', "nuggetGold", '#', new ItemStack(Items.string)));
|
||||
// Silky Jewel Recipes
|
||||
GameRegistry.addRecipe(new ItemStack(TRepo.materials, 1, 26), " c ", "cec", " c ", 'c', new ItemStack(TRepo.materials, 1, 25), 'e', new ItemStack(Items.emerald));
|
||||
// Wooden Armor Recipes
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.helmetWood, new Object[] { "www", "w w", 'w', "logWood" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.chestplateWood, new Object[] { "w w", "www", "www", 'w', "logWood" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.leggingsWood, new Object[] { "www", "w w", "w w", 'w', "logWood" }));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.bootsWood, new Object[] { "w w", "w w", 'w', "logWood" }));
|
||||
// Armor Recipes
|
||||
Object[] helm = new String[] { "www", "w w" };
|
||||
Object[] chest = new String[] { "w w", "www", "www" };
|
||||
Object[] pants = new String[] { "www", "w w", "w w" };
|
||||
Object[] shoes = new String[] { "w w", "w w" };
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.helmetWood, helm, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.chestplateWood, chest, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.leggingsWood, pants, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TRepo.bootsWood, shoes, 'w', "logWood"));
|
||||
|
||||
ItemStack exoGoggleStack = new ItemStack(TRepo.exoGoggles);
|
||||
ItemStack exoChestStack = new ItemStack(TRepo.exoChest);
|
||||
ItemStack exoPantsStack = new ItemStack(TRepo.exoPants);
|
||||
ItemStack exoShoesStack = new ItemStack(TRepo.exoShoes);
|
||||
ToolBuilder.instance.addArmorTag(exoGoggleStack);
|
||||
ToolBuilder.instance.addArmorTag(exoChestStack);
|
||||
ToolBuilder.instance.addArmorTag(exoPantsStack);
|
||||
ToolBuilder.instance.addArmorTag(exoShoesStack);
|
||||
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TRepo.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TRepo.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TRepo.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TRepo.largePlate, 1, 14));
|
||||
|
||||
// Metal conversion Recipes
|
||||
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 3), patBlock, '#', new ItemStack(TRepo.materials, 1, 9)); // Copper
|
||||
GameRegistry.addRecipe(new ItemStack(TRepo.metalBlock, 1, 5), patBlock, '#', new ItemStack(TRepo.materials, 1, 10)); // Tin
|
||||
@@ -660,8 +689,8 @@ public class TRecipes
|
||||
Blocks.stone_pressure_plate));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 2), "mcm", "rpr", 'm', Blocks.obsidian, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p',
|
||||
Blocks.stone_pressure_plate));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone,
|
||||
'p', Blocks.stone_pressure_plate));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TRepo.landmine, 1, 3), "mcm", "rpr", 'm', Items.repeater, 'c', new ItemStack(TRepo.blankPattern, 1, 1), 'r', Items.redstone, 'p',
|
||||
Blocks.stone_pressure_plate));
|
||||
|
||||
//Ultra hardcore recipes
|
||||
GameRegistry.addRecipe(new ItemStack(TRepo.goldHead), patSurround, '#', new ItemStack(Items.gold_ingot), 'm', new ItemStack(Items.skull, 1, 3));
|
||||
@@ -1076,7 +1105,8 @@ public class TRecipes
|
||||
basinCasting.addCastingRecipe(new ItemStack(TRepo.smeltery, 1, 5), new FluidStack(TRepo.moltenStoneFluid, TConstruct.chunkLiquidValue), new ItemStack(Blocks.cobblestone), true, 100);
|
||||
basinCasting.addCastingRecipe(new ItemStack(Blocks.emerald_block), new FluidStack(TRepo.moltenEmeraldFluid, 640 * 9), null, true, 100); //emerald
|
||||
basinCasting.addCastingRecipe(new ItemStack(TRepo.speedBlock, 1, 0), new FluidStack(TRepo.moltenTinFluid, TConstruct.nuggetLiquidValue), new ItemStack(Blocks.gravel), true, 100); //brownstone
|
||||
basinCasting.addCastingRecipe(new ItemStack(Blocks.end_stone), new FluidStack(TRepo.moltenEnderFluid, TConstruct.chunkLiquidValue), new ItemStack(Blocks.obsidian), true, 100); //endstone
|
||||
if (PHConstruct.craftEndstone)
|
||||
basinCasting.addCastingRecipe(new ItemStack(Blocks.end_stone), new FluidStack(TRepo.moltenEnderFluid, TConstruct.chunkLiquidValue), new ItemStack(Blocks.obsidian), true, 100); //endstone
|
||||
basinCasting.addCastingRecipe(new ItemStack(TRepo.metalBlock, 1, 10), new FluidStack(TRepo.moltenEnderFluid, 1000), null, true, 100); //ender
|
||||
basinCasting.addCastingRecipe(new ItemStack(TRepo.glueBlock), new FluidStack(TRepo.glueFluid, TConstruct.blockLiquidValue), null, true, 100); //glue
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ public class Jerky extends SpecialFood
|
||||
public static String[] textureNames = new String[] { "beef", "chicken", "pork", "mutton", "fish", "monster", "blueslime", "blood" };
|
||||
public static String[] itemNames = new String[] { "jerky.beef", "jerky.chicken", "jerky.pig", "jerky.sheep", "jerky.fish", "jerky.zombie", "jerky.blueslime", "jerky.blood" };
|
||||
public static int[] hunger = new int[] { 8, 6, 8, 6, 5, 4, 6, 4 };
|
||||
public static float[] saturation = new float[] { 1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.25f };
|
||||
public static float[] saturation = new float[] { 1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.4f };
|
||||
public static int[] overhaulHunger = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
|
||||
public Jerky(boolean hungerOverhaul)
|
||||
@@ -51,11 +51,11 @@ public class Jerky extends SpecialFood
|
||||
{
|
||||
if (stack.getItemDamage() == 7)
|
||||
{
|
||||
int duration = 20 * 30;
|
||||
PotionEffect potion = player.getActivePotionEffect(Potion.regeneration);
|
||||
int duration = 0;
|
||||
PotionEffect potion = player.getActivePotionEffect(Potion.field_76434_w);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, duration + 20 * 30, 0));
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, duration + 20 * 60, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ public class OreBerries extends CraftingItem
|
||||
{
|
||||
if (stack.getItemDamage() == 5)
|
||||
{
|
||||
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(4) + 3);
|
||||
EntityXPOrb entity = new EntityXPOrb(world, player.posX, player.posY + 1, player.posZ, itemRand.nextInt(14) + 6);
|
||||
spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player);
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize--;
|
||||
|
||||
@@ -3,16 +3,17 @@ package tconstruct.items.armor;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
@@ -20,17 +21,14 @@ import tconstruct.library.armor.EnumArmorPart;
|
||||
public class ExoArmor extends ArmorCore
|
||||
{
|
||||
String textureName;
|
||||
protected static final UUID speed = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CF"); //These are temporary. Do not use them in release
|
||||
protected static final UUID attack = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CE");
|
||||
protected static final UUID health = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CD");
|
||||
protected static final UUID knockback = UUID.fromString("CB3F55A9-629C-4F38-A497-9C13A33DB5CC");
|
||||
|
||||
public ExoArmor(EnumArmorPart part, String texture)
|
||||
{
|
||||
super(0, part);
|
||||
this.textureName = texture;
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
@@ -43,36 +41,36 @@ public class ExoArmor extends ArmorCore
|
||||
{
|
||||
return "tinker:textures/armor/" + textureName + "_" + layer + ".png";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||
{
|
||||
//Deimplemented for now
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Block b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
ItemStack armor = new ItemStack(b, 1, 0);
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
//list.appendTag(getAttributeTag("generic.attackDamage", "ExoAttack", 10.0, true, knockback));
|
||||
//list.appendTag(getAttributeTag("generic.movementSpeed", "ExoSpeed", 1.5, false, speed));
|
||||
//list.appendTag(getAttributeTag("generic.maxHealth", "ExoHealth", 10.0, true, health));
|
||||
//list.appendTag(getAttributeTag("generic.knockbackResistance", "ExoKnockback", 0.5, false, knockback));
|
||||
//baseTag.setTag("AttributeModifiers", list);
|
||||
|
||||
|
||||
NBTTagCompound armorTag = new NBTTagCompound();
|
||||
armorTag.setInteger("Modifiers", 30);
|
||||
baseTag.setTag(SET_NAME, armorTag);
|
||||
|
||||
|
||||
armor.setTagCompound(baseTag);
|
||||
par3List.add(armor);
|
||||
}
|
||||
|
||||
private NBTTagCompound getAttributeTag(String attributeType, String modifierName, double amount, boolean flat, UUID uuid)
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
NBTTagCompound knockbackTag = new NBTTagCompound();
|
||||
knockbackTag.setString("AttributeName", attributeType);
|
||||
knockbackTag.setString("Name", modifierName);
|
||||
knockbackTag.setDouble("Amount", amount);
|
||||
knockbackTag.setInteger("Operation", flat ? 0 : 1);//0 = flat increase, 1 = % increase
|
||||
knockbackTag.setLong("UUIDMost", uuid.getMostSignificantBits());
|
||||
knockbackTag.setLong("UUIDLeast", uuid.getLeastSignificantBits());
|
||||
return knockbackTag;
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double protection = tag.getDouble("protection");
|
||||
if (protection > 0)
|
||||
list.add("\u00a7aProtection: " + protection + "%");
|
||||
}
|
||||
}
|
||||
@@ -22,8 +22,6 @@ public class LavaTankItemBlock extends MultiItemBlock
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
@@ -31,7 +29,7 @@ public class LavaTankItemBlock extends MultiItemBlock
|
||||
NBTTagCompound liquidTag = stack.getTagCompound().getCompoundTag("Fluid");
|
||||
if (liquidTag != null)
|
||||
{
|
||||
list.add(StatCollector.translateToLocal("searedtank1.tooltip") + StatCollector.translateToLocal(liquidTag.getString("FluidName")));
|
||||
list.add(StatCollector.translateToLocal("searedtank1.tooltip") + " " + StatCollector.translateToLocal(liquidTag.getString("FluidName")));
|
||||
list.add(liquidTag.getInteger("Amount") + " mB");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
@Override
|
||||
public ArmorProperties getProperties (EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot)
|
||||
{
|
||||
if (player.worldObj.isRemote)
|
||||
{
|
||||
return new ArmorProperties(0, 0, baseProtection);
|
||||
}
|
||||
NBTTagCompound tags = armor.getTagCompound();
|
||||
|
||||
if (tags == null)
|
||||
@@ -71,14 +75,28 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
|
||||
NBTTagCompound data = tags.getCompoundTag(SET_NAME);
|
||||
|
||||
return new ArmorProperties(0, data.getInteger("damageReduction") / damage, data.getInteger("maxAbsorb"));
|
||||
double amount = (data.getInteger("defense") / damage) + (data.getDouble("protection") / 100);
|
||||
if (source.isUnblockable())
|
||||
amount = 0;
|
||||
clamp_double(amount, 0, 1);
|
||||
return new ArmorProperties(0, amount, 100);
|
||||
}
|
||||
|
||||
public static double clamp_double (double par0, double par1, double par2)
|
||||
{
|
||||
return par0 < par1 ? par1 : (par0 > par2 ? par2 : par0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay (EntityPlayer player, ItemStack armor, int slot)
|
||||
{
|
||||
return armor.getTagCompound() != null && armor.getTagCompound().getCompoundTag(SET_NAME) != null ? armor.getTagCompound().getCompoundTag(SET_NAME).getInteger("maxAbsorb")
|
||||
: this.baseProtection;
|
||||
if (!armor.hasTagCompound())
|
||||
return this.baseProtection;
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double amount = armorTag.getDouble("protection") / 4;
|
||||
if (amount > 0 && amount < 1)
|
||||
amount = 1;
|
||||
return (int) (Math.floor(amount));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -93,9 +111,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
stack.setTagCompound(tags);
|
||||
data = new NBTTagCompound();
|
||||
tags.setTag(SET_NAME, data);
|
||||
data.setInteger("damageReduction", baseProtection);
|
||||
data.setInteger("maxAbsorb", baseProtection);
|
||||
}
|
||||
data.setDouble("damageReduction", baseProtection); }
|
||||
|
||||
data = tags.getCompoundTag(SET_NAME);
|
||||
|
||||
@@ -114,7 +130,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
tags.setInteger("Energy", 0);
|
||||
int dmg = data.getInteger("Damage");
|
||||
dmg += damage;
|
||||
data.setInteger("Damage", dmg);
|
||||
data.setDouble("Damage", dmg);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,6 +208,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
}
|
||||
return tags.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored (ItemStack container)
|
||||
{
|
||||
@@ -200,6 +217,7 @@ public abstract class ArmorCore extends ItemArmor implements IEnergyContainerIte
|
||||
return 0;
|
||||
return capacity;
|
||||
}
|
||||
|
||||
//end of TE support section
|
||||
|
||||
// Vanilla overrides
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
@@ -384,6 +385,8 @@ public class ToolBuilder
|
||||
public ItemStack modifyArmor (ItemStack input, ItemStack[] slots, String name)
|
||||
{
|
||||
ItemStack armor = input.copy();
|
||||
if (!armor.hasTagCompound())
|
||||
addArmorTag(input);
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
tags.removeTag("Built");
|
||||
|
||||
@@ -449,6 +452,18 @@ public class ToolBuilder
|
||||
return null;
|
||||
}
|
||||
|
||||
public void addArmorTag (ItemStack armor) //Not sure if temporary or not
|
||||
{
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
NBTTagCompound armorTag = new NBTTagCompound();
|
||||
armorTag.setInteger("Modifiers", 30);
|
||||
baseTag.setTag("TinkerArmor", armorTag);
|
||||
|
||||
armor.setTagCompound(baseTag);
|
||||
}
|
||||
|
||||
int buildReinforced (TToolMaterial headMat, TToolMaterial handleMat, TToolMaterial accessoryMat, TToolMaterial extraMat)
|
||||
{
|
||||
int reinforced = 0;
|
||||
@@ -499,8 +514,8 @@ public class ToolBuilder
|
||||
throw new NullPointerException("Tool modifier cannot be null.");
|
||||
instance.toolMods.add(mod);
|
||||
}
|
||||
|
||||
public static void registerArmorMod(ArmorMod mod)
|
||||
|
||||
public static void registerArmorMod (ArmorMod mod)
|
||||
{
|
||||
if (mod == null)
|
||||
throw new NullPointerException("Armor modifier cannot be null.");
|
||||
|
||||
@@ -455,7 +455,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IBa
|
||||
}
|
||||
if (getPartAmount() >= 4)
|
||||
{
|
||||
current = extraMat.reinforced();
|
||||
current = extraMat.reinforced();
|
||||
if (current > 0 && current > reinforced)
|
||||
{
|
||||
style = extraMat.style();
|
||||
@@ -546,7 +546,7 @@ public abstract class ToolCore extends Item implements IEnergyContainerItem, IBa
|
||||
boolean supress = false;
|
||||
try
|
||||
{
|
||||
clazz = Class.forName(tconstruct.common.TContent.class.getName());
|
||||
clazz = Class.forName("tconstruct.common.TRepo"); //TODO: Make sure this is still working in 1.7.
|
||||
fld = clazz.getField("supressMissingToolLogs");
|
||||
supress = fld.getBoolean(fld);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModDamageBoost extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount;
|
||||
final double scaleAmount;
|
||||
|
||||
public AModDamageBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type, int modifiers, double scale)
|
||||
{
|
||||
super(effect, "ExoAttack" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
this.modifyAmount = modifiers;
|
||||
this.scaleAmount = scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingAmount(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.func_150295_c("AttributeModifiers", 9);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.func_150305_b(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.attackDamage"))
|
||||
{
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.attackDamage", key, amount * scaleAmount, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID headScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c10");
|
||||
private static final UUID chestScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c11");
|
||||
private static final UUID pantsScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c12");
|
||||
private static final UUID shoesScale = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c13");
|
||||
private static final UUID headFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c14");
|
||||
private static final UUID chestFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c15");
|
||||
private static final UUID pantsFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c16");
|
||||
private static final UUID shoesFlat = UUID.fromString("8d39e761-c100-4f81-853d-12dc8b424c17");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return modifierType ? headScale : headFlat;
|
||||
case CHEST:
|
||||
return modifierType ? chestScale : chestFlat;
|
||||
case PANTS:
|
||||
return modifierType ? pantsScale : pantsFlat;
|
||||
case SHOES:
|
||||
return modifierType ? shoesScale : pantsFlat;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModHealthBoost extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount = 3;
|
||||
|
||||
public AModHealthBoost(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoHealth" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input)*modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input)*modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.func_150295_c("AttributeModifiers",9);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.func_150305_b(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.maxHealth"))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.maxHealth", key, amount, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab8");
|
||||
private static final UUID chest = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dab9");
|
||||
private static final UUID pants = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6daba");
|
||||
private static final UUID shoes = UUID.fromString("a2eac357-cae3-4a8f-994c-a8bcbbd6dabb");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return head;
|
||||
case CHEST:
|
||||
return chest;
|
||||
case PANTS:
|
||||
return pants;
|
||||
case SHOES:
|
||||
return shoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
//TODO: Condense attribute modifiers into one class
|
||||
public class AModKnockbackResistance extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
final int modifyAmount = 2;
|
||||
|
||||
public AModKnockbackResistance(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoKnockback" + (type ? "Percent" : "Flat"), armorTypes, items, values);
|
||||
this.modifierType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingAmount(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.func_150295_c("AttributeModifiers", 9);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.func_150305_b(iter);
|
||||
if (tag.getString("AttributeName").equals("generic.knockbackResistance"))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.knockbackResistance", key, amount*0.01, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c44");
|
||||
private static final UUID chest = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c45");
|
||||
private static final UUID pants = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c46");
|
||||
private static final UUID shoes = UUID.fromString("4188779d-69d4-487c-b307-c4c182522c47");
|
||||
|
||||
UUID getUUIDFromItem (ItemStack stack)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) stack.getItem();
|
||||
switch (item.armorPart)
|
||||
{
|
||||
case HELMET:
|
||||
return head;
|
||||
case CHEST:
|
||||
return chest;
|
||||
case PANTS:
|
||||
return pants;
|
||||
case SHOES:
|
||||
return shoes;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package tconstruct.modifiers.armor;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModProtection extends ArmorModTypeFilter
|
||||
{
|
||||
int modifyAmount = 3;
|
||||
public AModProtection(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values)
|
||||
{
|
||||
super(effect, "ExoProtection", armorTypes, items, values);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack tool, ItemStack[] input)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int amount = matchingItems(input) * modifyAmount;
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= matchingItems(input) * modifyAmount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
double absorb = armorTag.getDouble("protection");
|
||||
absorb += amount;
|
||||
armorTag.setDouble("protection", absorb);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public abstract class ArmorModTypeFilter extends ArmorMod
|
||||
}
|
||||
if (!match)
|
||||
return false;
|
||||
|
||||
|
||||
minimumMatch = true;
|
||||
}
|
||||
return minimumMatch;
|
||||
@@ -93,6 +93,17 @@ public abstract class ArmorModTypeFilter extends ArmorMod
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int matchingItems (ItemStack[] input)
|
||||
{
|
||||
int amount = 0;
|
||||
for (ItemStack inputStack : input)
|
||||
{
|
||||
if (inputStack != null)
|
||||
amount++;
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
/** Adds a new itemstack to the list for increases
|
||||
*
|
||||
* @param stack ItemStack to compare against
|
||||
|
||||
@@ -7,6 +7,7 @@ import cpw.mods.fml.common.Loader;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.common.TRepo;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
public class PHConstruct
|
||||
@@ -21,6 +22,7 @@ public class PHConstruct
|
||||
config.load();
|
||||
|
||||
superfunWorld = config.get("Superfun", "All the world is Superfun", false).getBoolean(false);
|
||||
TRepo.supressMissingToolLogs = config.get("Logging", "Disable tool build messages", false).getBoolean(false);
|
||||
|
||||
keepHunger = config.get("Difficulty Changes", "Keep hunger on death", true).getBoolean(true);
|
||||
keepLevels = config.get("Difficulty Changes", "Keep levels on death", true).getBoolean(true);
|
||||
@@ -43,9 +45,11 @@ public class PHConstruct
|
||||
stencilTableCrafting = config.get("Difficulty Changes", "Craft Stencil Tables", true).getBoolean(true);
|
||||
miningLevelIncrease = config.get("Difficulty Changes", "Modifiers increase Mining Level", true).getBoolean(true);
|
||||
denyMattock = config.get("Difficulty Changes", "Deny creation of non-metal mattocks", false).getBoolean(false);
|
||||
craftEndstone = config.get("Difficulty Changes", "Allow creation of endstone", true).getBoolean(true);
|
||||
|
||||
|
||||
ingotsPerOre = config.get("Smeltery Output Modification", "Ingots per ore", 2, "Number of ingots returned from smelting ores in the smeltery").getDouble(2);
|
||||
ingotsBronzeAlloy = config.get("Smeltery Output Modification", "Bronze ingot return", 3, "Number of ingots returned from smelting Bronze in the smeltery").getDouble(3);
|
||||
ingotsBronzeAlloy = config.get("Smeltery Output Modification", "Bronze ingot return", 4, "Number of ingots returned from smelting Bronze in the smeltery").getDouble(4);
|
||||
ingotsAluminumBrassAlloy = config.get("Smeltery Output Modification", "Aluminum Brass ingot return", 4, "Number of ingots returned from smelting Aluminum Brass in the smeltery").getDouble(4);
|
||||
ingotsAlumiteAlloy = config.get("Smeltery Output Modification", "Alumite ingot return", 3, "Number of ingots returned from smelting Alumite in the smeltery").getDouble(3);
|
||||
ingotsManyullynAlloy = config.get("Smeltery Output Modification", "Manyullyn ingot return", 1, "Number of ingots returned from smelting Manyullyn in the smeltery").getDouble(1);
|
||||
@@ -284,6 +288,7 @@ public class PHConstruct
|
||||
public static double ingotsManyullynAlloy;
|
||||
public static double ingotsPigironAlloy;
|
||||
|
||||
public static boolean craftEndstone;
|
||||
//Ultra Hardcore modifiers
|
||||
public static boolean enableHealthRegen;
|
||||
public static boolean goldAppleRecipe;
|
||||
|
||||
Reference in new issue
Block a user