Skip to content

Commit

Permalink
port in some fixes from 1.6.x
Browse files Browse the repository at this point in the history
  • Loading branch information
progwml6 committed Feb 5, 2014
1 parent cd9e0f6 commit 9fce66a
Show file tree
Hide file tree
Showing 15 changed files with 453 additions and 59 deletions.
Binary file modified resources/assets/tinker/textures/gui/newhearts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 40 additions & 10 deletions src/main/java/tconstruct/common/TRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
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;
Expand Down Expand Up @@ -249,11 +251,9 @@ protected static void addRecipesForToolBuilder ()
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);
Expand Down Expand Up @@ -290,6 +290,15 @@ protected static void addRecipesForToolBuilder ()
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());
}

Expand Down Expand Up @@ -494,6 +503,8 @@ protected static void addRecipesForCraftingTable ()
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
Expand All @@ -516,11 +527,29 @@ protected static void addRecipesForCraftingTable ()
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
Expand Down Expand Up @@ -660,8 +689,8 @@ protected static void addRecipesForCraftingTable ()
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));
Expand Down Expand Up @@ -1076,7 +1105,8 @@ protected static void addRecipesForBasinCasting ()
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

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/tconstruct/items/Jerky.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -51,11 +51,11 @@ protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
{
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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/tconstruct/items/OreBerries.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer pl
{
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--;
Expand Down
54 changes: 26 additions & 28 deletions src/main/java/tconstruct/items/armor/ExoArmor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,32 @@
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;

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)
{
Expand All @@ -43,36 +41,36 @@ public String getArmorTexture (ItemStack stack, Entity entity, int slot, String
{
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 + "%");
}
}
4 changes: 1 addition & 3 deletions src/main/java/tconstruct/items/blocks/LavaTankItemBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ public LavaTankItemBlock(Block b)
setHasSubtypes(true);
}



public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
{
if (stack.hasTagCompound())
{
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");
}
}
Expand Down
32 changes: 25 additions & 7 deletions src/main/java/tconstruct/library/armor/ArmorCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public ItemStack onItemRightClick (ItemStack par1ItemStack, World par2World, Ent
@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)
Expand All @@ -71,14 +75,28 @@ public ArmorProperties getProperties (EntityLivingBase player, ItemStack armor,

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
Expand All @@ -93,9 +111,7 @@ public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource
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);

Expand All @@ -114,7 +130,7 @@ public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource
tags.setInteger("Energy", 0);
int dmg = data.getInteger("Damage");
dmg += damage;
data.setInteger("Damage", dmg);
data.setDouble("Damage", dmg);
}

}
Expand Down Expand Up @@ -192,6 +208,7 @@ public int getEnergyStored (ItemStack container)
}
return tags.getInteger("Energy");
}

@Override
public int getMaxEnergyStored (ItemStack container)
{
Expand All @@ -200,6 +217,7 @@ public int getMaxEnergyStored (ItemStack container)
return 0;
return capacity;
}

//end of TE support section

// Vanilla overrides
Expand Down
Loading

0 comments on commit 9fce66a

Please sign in to comment.