mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
Reorganize folders for modules
This commit is contained in:
1 parent
2c14f315de
commit
e2f0558b6f
370 files changed
+4274
-4788
No files matched your search
@@ -0,0 +1,209 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.blocks.DryingRack;
|
||||
import tconstruct.armor.items.ArmorBasic;
|
||||
import tconstruct.armor.items.DiamondApple;
|
||||
import tconstruct.armor.items.ExoArmor;
|
||||
import tconstruct.armor.items.HeartCanister;
|
||||
import tconstruct.armor.items.Jerky;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.items.GoldenHead;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = "TinkerArmor", name = "TinkerArmor", version = "${tinkerarmorversion}")
|
||||
public class TinkerArmor
|
||||
{
|
||||
@Instance("TinkerArmor")
|
||||
public static TinkerArmor instance;
|
||||
public static Item diamondApple;
|
||||
public static Item jerky;
|
||||
// public static Item stonePattern;
|
||||
// public static Item netherPattern;
|
||||
public static Block dryingRack;
|
||||
// Wearables
|
||||
public static Item heavyHelmet;
|
||||
public static Item heavyChestplate;
|
||||
public static Item heavyPants;
|
||||
public static Item heavyBoots;
|
||||
public static Item glove;
|
||||
public static Item knapsack;
|
||||
public static Item heartCanister;
|
||||
// Armor - basic
|
||||
public static Item helmetWood;
|
||||
public static Item chestplateWood;
|
||||
public static Item leggingsWood;
|
||||
// Armor - exosuit
|
||||
public static Item exoGoggles;
|
||||
public static Item exoChest;
|
||||
public static Item exoPants;
|
||||
public static Item exoShoes;
|
||||
public static Item bootsWood;
|
||||
public static ArmorMaterial materialWood;
|
||||
|
||||
@EventHandler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
|
||||
|
||||
TinkerArmor.dryingRack = new DryingRack().setBlockName("Armor.DryingRack");
|
||||
TinkerArmor.diamondApple = new DiamondApple().setUnlocalizedName("tconstruct.apple.diamond");
|
||||
GameRegistry.registerItem(TinkerArmor.diamondApple, "diamondApple");
|
||||
boolean foodOverhaul = false;
|
||||
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food"))
|
||||
{
|
||||
foodOverhaul = true;
|
||||
}
|
||||
|
||||
TinkerArmor.jerky = new Jerky(foodOverhaul).setUnlocalizedName("tconstruct.jerky");
|
||||
GameRegistry.registerItem(TinkerArmor.jerky, "jerky");
|
||||
|
||||
// Wearables
|
||||
// heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet,
|
||||
// 0).setUnlocalizedName("tconstruct.HeavyHelmet");
|
||||
TinkerArmor.heartCanister = new HeartCanister().setUnlocalizedName("tconstruct.canister");
|
||||
// heavyBoots = new TArmorBase(PHConstruct.heavyBoots,
|
||||
// 3).setUnlocalizedName("tconstruct.HeavyBoots");
|
||||
// glove = new
|
||||
// Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove");
|
||||
TinkerArmor.knapsack = new Knapsack().setUnlocalizedName("tconstruct.storage");
|
||||
TinkerTools.goldHead = new GoldenHead(4, 1.2F, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 10, 0, 1.0F).setUnlocalizedName("goldenhead");
|
||||
// GameRegistry.registerItem(TRepo.heavyHelmet, "heavyHelmet");
|
||||
GameRegistry.registerItem(TinkerArmor.heartCanister, "heartCanister");
|
||||
// GameRegistry.registerItem(TRepo.heavyBoots, "heavyBoots");
|
||||
// GameRegistry.registerItem(TRepo.glove, "glove");
|
||||
GameRegistry.registerItem(TinkerArmor.knapsack, "knapsack");
|
||||
|
||||
LiquidCasting basinCasting = TConstruct.getBasinCasting();
|
||||
TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] { 1, 2, 2, 1 }, 3);
|
||||
TinkerArmor.helmetWood = new ArmorBasic(TinkerArmor.materialWood, 0, "wood").setUnlocalizedName("tconstruct.helmetWood");
|
||||
TinkerArmor.chestplateWood = new ArmorBasic(TinkerArmor.materialWood, 1, "wood").setUnlocalizedName("tconstruct.chestplateWood");
|
||||
TinkerArmor.leggingsWood = new ArmorBasic(TinkerArmor.materialWood, 2, "wood").setUnlocalizedName("tconstruct.leggingsWood");
|
||||
TinkerArmor.bootsWood = new ArmorBasic(TinkerArmor.materialWood, 3, "wood").setUnlocalizedName("tconstruct.bootsWood");
|
||||
GameRegistry.registerItem(TinkerArmor.helmetWood, "helmetWood");
|
||||
GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
|
||||
GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
|
||||
GameRegistry.registerItem(TinkerArmor.bootsWood, "bootsWood");
|
||||
|
||||
TinkerArmor.exoGoggles = new ExoArmor(EnumArmorPart.HELMET, "exosuit").setUnlocalizedName("tconstruct.exoGoggles");
|
||||
TinkerArmor.exoChest = new ExoArmor(EnumArmorPart.CHEST, "exosuit").setUnlocalizedName("tconstruct.exoChest");
|
||||
TinkerArmor.exoPants = new ExoArmor(EnumArmorPart.PANTS, "exosuit").setUnlocalizedName("tconstruct.exoPants");
|
||||
TinkerArmor.exoShoes = new ExoArmor(EnumArmorPart.SHOES, "exosuit").setUnlocalizedName("tconstruct.exoShoes");
|
||||
|
||||
GameRegistry.registerItem(TinkerArmor.exoGoggles, "helmetExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoChest, "chestplateExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoPants, "leggingsExo");
|
||||
GameRegistry.registerItem(TinkerArmor.exoShoes, "bootsExo");
|
||||
|
||||
TConstructRegistry.addItemStackToDirectory("diamondApple", new ItemStack(TinkerArmor.diamondApple, 1, 0));
|
||||
|
||||
TConstructRegistry.addItemStackToDirectory("canisterEmpty", new ItemStack(TinkerArmor.heartCanister, 1, 0));
|
||||
TConstructRegistry.addItemStackToDirectory("miniRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
TConstructRegistry.addItemStackToDirectory("canisterRedHeart", new ItemStack(TinkerArmor.heartCanister, 1, 2));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
craftingTableRecipes();
|
||||
addRecipesForDryingRack();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit (FMLPostInitializationEvent evt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void craftingTableRecipes ()
|
||||
{
|
||||
|
||||
// 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(TinkerArmor.helmetWood, helm, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.chestplateWood, chest, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));
|
||||
|
||||
ItemStack exoGoggleStack = new ItemStack(TinkerArmor.exoGoggles);
|
||||
ItemStack exoChestStack = new ItemStack(TinkerArmor.exoChest);
|
||||
ItemStack exoPantsStack = new ItemStack(TinkerArmor.exoPants);
|
||||
ItemStack exoShoesStack = new ItemStack(TinkerArmor.exoShoes);
|
||||
if (PHConstruct.exoCraftingEnabled)
|
||||
{
|
||||
ToolBuilder.instance.addArmorTag(exoGoggleStack);
|
||||
ToolBuilder.instance.addArmorTag(exoChestStack);
|
||||
ToolBuilder.instance.addArmorTag(exoPantsStack);
|
||||
ToolBuilder.instance.addArmorTag(exoShoesStack);
|
||||
GameRegistry.addShapedRecipe(exoGoggleStack, helm, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoChestStack, chest, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoPantsStack, pants, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
GameRegistry.addShapedRecipe(exoShoesStack, shoes, 'w', new ItemStack(TinkerTools.largePlate, 1, 14));
|
||||
}
|
||||
|
||||
// Accessories
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
// GameRegistry.addRecipe(new ShapedOreRecipe(new
|
||||
// ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#',
|
||||
// "ingotNaturalAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone));
|
||||
|
||||
GameRegistry.addRecipe(new ItemStack(TinkerArmor.diamondApple), " d ", "d#d", " d ", 'd', new ItemStack(Items.diamond), '#', new ItemStack(Items.apple));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.diamondApple), new ItemStack(TinkerTools.materials, 1, 8), new ItemStack(
|
||||
TinkerArmor.heartCanister, 1, 0), new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 4), new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.heartCanister, 1, 3), new ItemStack(
|
||||
Items.golden_apple, 1, 1));
|
||||
//GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2),
|
||||
'm', "ingotGold"));
|
||||
ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
|
||||
GameRegistry.addRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2), 'm', aluBrass);
|
||||
// Drying Rack Recipes
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));
|
||||
}
|
||||
|
||||
protected static void addRecipesForDryingRack ()
|
||||
{
|
||||
// Drying rack
|
||||
DryingRackRecipes.addDryingRecipe(Items.beef, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 0));
|
||||
DryingRackRecipes.addDryingRecipe(Items.chicken, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 1));
|
||||
DryingRackRecipes.addDryingRecipe(Items.porkchop, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 2));
|
||||
// DryingRackRecipes.addDryingRecipe(Item.muttonRaw, 20 * 60 * 5, new
|
||||
// ItemStack(TRepo.jerky, 1, 3));
|
||||
DryingRackRecipes.addDryingRecipe(Items.fish, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 4));
|
||||
DryingRackRecipes.addDryingRecipe(Items.rotten_flesh, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 5));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 6));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
|
||||
// DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5),
|
||||
// 20 * 60 * 10, Item.leather);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,316 @@
|
||||
package tconstruct.armor.blocks;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.blocks.abstracts.InventoryBlock;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.modelblock.DryingRackRender;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DryingRack extends InventoryBlock
|
||||
{
|
||||
|
||||
public DryingRack()
|
||||
{
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(2.0f);
|
||||
stepSound = soundTypeMetal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
|
||||
{
|
||||
if (side > 1)
|
||||
return side;
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving living, ItemStack stack)
|
||||
{
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
int l = MathHelper.floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int direction = l % 2;
|
||||
if (direction == 1)
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Activation */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
return activateDryingRack(world, x, y, z, player);
|
||||
}
|
||||
|
||||
boolean activateDryingRack (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
DryingRackLogic logic = (DryingRackLogic) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!logic.isStackInSlot(0))
|
||||
{
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null)
|
||||
{
|
||||
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
logic.setInventorySlotContents(0, stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (logic.isStackInSlot(0))
|
||||
{
|
||||
ItemStack decrStack = logic.decrStackSize(0, 1);
|
||||
if (decrStack != null)
|
||||
addItemToInventory(player, world, x, y, z, decrStack);
|
||||
}
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addItemToInventory (EntityPlayer player, World world, int x, int y, int z, ItemStack stack)
|
||||
{
|
||||
AbilityHelper.spawnItemAtPlayer(player, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
float zMin = 0F;
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
return AxisAlignedBB.getAABBPool().getAABB((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
float zMin = 0F;
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
this.setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity)
|
||||
{
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
return DryingRackRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "castingtable_top", "castingtable_side", "castingtable_bottom", "faucet", "blockcast_top", "blockcast_side", "blockcast_bottom" };
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
return Blocks.planks.getIcon(side, 0);
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public boolean shouldSideBeRendered (IBlockAccess
|
||||
* par1IBlockAccess, int par2, int par3, int par4, int par5) { return true;
|
||||
* }
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Override public void getSubBlocks (int id, CreativeTabs tab, List list)
|
||||
* { for (int iter = 0; iter < 3; iter++) { list.add(new ItemStack(id, 1,
|
||||
* iter)); } }
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Override public void setBlockBoundsBasedOnState (IBlockAccess world, int
|
||||
* x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); if (meta
|
||||
* != 1) { this.setBlockBounds(0, 0, 0, 1, 1, 1); } else { FaucetLogic logic
|
||||
* = (FaucetLogic) world.getBlockTileEntity(x, y, z); float xMin = 0.25F;
|
||||
* float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
* this.setBlockBounds(xMin, 0.25F, zMin, xMax, 0.625F, zMax); } }
|
||||
*/
|
||||
|
||||
/*
|
||||
* @Override public AxisAlignedBB getCollisionBoundingBoxFromPool (World
|
||||
* world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z);
|
||||
* if (meta != 1) { return AxisAlignedBB.getAABBPool().getAABB(x, y, z, x +
|
||||
* 1, y + 1, z + 1); } else { FaucetLogic logic = (FaucetLogic)
|
||||
* world.getBlockTileEntity(x, y, z); if (logic != null) { float xMin =
|
||||
* 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
* return AxisAlignedBB.getAABBPool().getAABB((double) ((float) x + xMin),
|
||||
* (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x +
|
||||
* xMax), (double) y + 0.625, (double) ((float) z + zMax)); } }
|
||||
*
|
||||
* return super.getCollisionBoundingBoxFromPool(world, x, y, z); }
|
||||
*/
|
||||
|
||||
/* Redstone */
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
|
||||
public class ArmorExtendedContainer extends ActiveContainer
|
||||
{
|
||||
public InventoryPlayer invPlayer;
|
||||
public ArmorExtended armor;
|
||||
|
||||
public ArmorExtendedContainer(InventoryPlayer inventoryplayer, ArmorExtended armor)
|
||||
{
|
||||
invPlayer = inventoryplayer;
|
||||
this.armor = armor;
|
||||
|
||||
this.addSlotToContainer(new SlotUnused(armor, 0, 80, 17));
|
||||
this.addSlotToContainer(new SlotUnused(armor, 1, 80, 35));
|
||||
this.addSlotToContainer(new SlotKnapsack(armor, 2, 116, 17));
|
||||
this.addSlotToContainer(new SlotUnused(armor, 3, 116, 35));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 4, 152, 53));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 5, 152, 35));
|
||||
this.addSlotToContainer(new SlotCanister(armor, 6, 152, 17)); /* Player inventory */
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor)
|
||||
{
|
||||
this.addSlotToContainer(new SlotArmorCopy(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - playerArmor, 98, 8 + playerArmor * 18, playerArmor));
|
||||
}
|
||||
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer var1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.util.player.KnapsackInventory;
|
||||
|
||||
public class KnapsackContainer extends Container
|
||||
{
|
||||
public KnapsackInventory backpack;
|
||||
public int progress = 0;
|
||||
public int fuel = 0;
|
||||
public int fuelGague = 0;
|
||||
|
||||
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack)
|
||||
{
|
||||
backpack = knapsack;
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(knapsack, row + column * 9, 8 + row * 18, 17 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
return backpack.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < backpack.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class SlotArmorCopy extends Slot
|
||||
{
|
||||
/**
|
||||
* The armor type that can be placed on that slot, it uses the same values
|
||||
* of armorType field on ItemArmor.
|
||||
*/
|
||||
final int armorType;
|
||||
|
||||
/**
|
||||
* The parent class of this clot, ContainerPlayer, SlotArmor is a Anon inner
|
||||
* class.
|
||||
*/
|
||||
final Container parent;
|
||||
|
||||
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.parent = container;
|
||||
this.armorType = par6;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
boolean isValidArmor = false;
|
||||
if (item instanceof ItemArmor)
|
||||
{
|
||||
isValidArmor = (((ItemArmor) item).armorType == armorType);
|
||||
}
|
||||
return item != null && (isValidArmor || (item instanceof ItemBlock && armorType == 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* Returns the icon index on items.png that is used as background image of the slot.
|
||||
*/
|
||||
public IIcon getBackgroundIconIndex ()
|
||||
{
|
||||
return ItemArmor.func_94602_b(this.armorType);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
|
||||
public class SlotBehavedOnly extends Slot
|
||||
{
|
||||
|
||||
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
|
||||
|
||||
if (b == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int stackL = b.getStackLimit(par1ItemStack);
|
||||
|
||||
if (b != null && this.inventory.getStackInSlot(this.slotNumber) != null && !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack))
|
||||
{
|
||||
ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
|
||||
if (is.stackSize + par1ItemStack.stackSize <= stackL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return par1ItemStack.stackSize <= stackL;
|
||||
}
|
||||
|
||||
return false;
|
||||
// return b != null;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit (ItemStack par1ItemStack)
|
||||
{
|
||||
return Behavior.getBehaviorFromStack(par1ItemStack) != null ? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack) : 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class SlotBlocksOnly extends Slot
|
||||
{
|
||||
|
||||
public SlotBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
return par1ItemStack.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.armor.IHealthAccessory;
|
||||
|
||||
public class SlotCanister extends Slot
|
||||
{
|
||||
private final int slotID;
|
||||
|
||||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipItem(par1ItemStack, this.slotID);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
|
||||
public class SlotKnapsack extends Slot
|
||||
{
|
||||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof Knapsack);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotOnlyTake extends Slot
|
||||
{
|
||||
|
||||
public SlotOnlyTake(IInventory builder, int par3, int par4, int par5)
|
||||
{
|
||||
super(builder, par3, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import mantle.blocks.BlockUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*/
|
||||
public class SlotOpaqueBlocksOnly extends SlotBlocksOnly
|
||||
{
|
||||
|
||||
public SlotOpaqueBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
if (super.isItemValid(par1ItemStack))
|
||||
{
|
||||
Block b = BlockUtils.getBlockFromItemStack(par1ItemStack);
|
||||
return b.isOpaqueCube() && b.renderAsNormalBlock();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tconstruct.armor.inventory;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotUnused extends Slot
|
||||
{
|
||||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the maximum stack size for a given slot (usually the same as
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ArmorBasic extends ItemArmor
|
||||
{
|
||||
|
||||
public String textureName;
|
||||
|
||||
public ArmorBasic(ArmorMaterial par2EnumArmorMaterial, int par3, String textureName)
|
||||
{
|
||||
super(par2EnumArmorMaterial, 0, par3);
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
|
||||
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/" + textureName + "_" + suffix + ".png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.ItemBlocklike;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ArmorPattern extends CraftingItem implements ItemBlocklike
|
||||
{
|
||||
|
||||
private IIcon baseIcon;
|
||||
|
||||
public ArmorPattern(int id, String patternType, String folder)
|
||||
{
|
||||
super(patternName, getPatternNames(patternType), folder, "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.setContainerItem(this);
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
public IIcon getBaseIcon ()
|
||||
{
|
||||
return baseIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
super.registerIcons(iconRegister);
|
||||
baseIcon = iconRegister.registerIcon("tinker:" + folder + "armor_cast");
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" };
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item block, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
{
|
||||
list.add(new ItemStack(block, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class ArmorStandard extends ArmorCore
|
||||
{
|
||||
|
||||
public ArmorStandard(int baseProtection, EnumArmorPart armorPart)
|
||||
{
|
||||
super(baseProtection, armorPart);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/wood_helmet");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/wood_" + suffix + ".png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class DiamondApple extends ItemFood
|
||||
{
|
||||
public IIcon[] icons;
|
||||
public String[] textureNames = new String[] { "food/apple_diamond" };
|
||||
public String[] itemNames = new String[] { "apple.diamond" };
|
||||
|
||||
public DiamondApple()
|
||||
{
|
||||
super(4, 2.0F, false);
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
this.setAlwaysEdible();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
int duration = 0;
|
||||
PotionEffect potion;
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, duration + 60 * 40, 4));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.digSpeed);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.damageBoost);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 60 * 20, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Name override */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[itemstack.getItemDamage()]).toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ExoArmor extends ArmorCore
|
||||
{
|
||||
String textureName;
|
||||
|
||||
public ExoArmor(EnumArmorPart part, String texture)
|
||||
{
|
||||
super(0, part);
|
||||
this.textureName = texture;
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
|
||||
+ (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/" + textureName + "_" + suffix + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor (EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot)
|
||||
{
|
||||
// Deimplemented for now
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems (Item b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
ItemStack armor = new ItemStack(b, 1, 0);
|
||||
NBTTagCompound baseTag = new NBTTagCompound();
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
NBTTagCompound armorTag = new NBTTagCompound();
|
||||
armorTag.setInteger("Modifiers", 30);
|
||||
baseTag.setTag(SET_NAME, armorTag);
|
||||
|
||||
armor.setTagCompound(baseTag);
|
||||
par3List.add(armor);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
NBTTagCompound tags = stack.getTagCompound().getCompoundTag(SET_NAME);
|
||||
double protection = tags.getDouble("protection");
|
||||
if (protection > 0)
|
||||
list.add("\u00a7aProtection: " + protection + "%");
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.hasKey(tooltip))
|
||||
{
|
||||
String tipName = tags.getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class Glove extends Item
|
||||
{
|
||||
public Glove()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
itemIcon = iconRegister.registerIcon("tinker:armor/dirthand");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.armor.IHealthAccessory;
|
||||
import tconstruct.util.player.ArmorExtended;
|
||||
import tconstruct.util.player.TPlayerStats;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
{
|
||||
|
||||
public HeartCanister()
|
||||
{
|
||||
super(new String[] { "empty", "miniheart.red", "red", "miniheart.yellow", "yellow", "miniheart.green", "green" }, new String[] { "canister_empty", "miniheart_red", "canister_red",
|
||||
"miniheart_yellow", "canister_yellow", "miniheart_green", "canister_green" }, "", "tinker", TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 1 || meta == 3 || meta == 5)
|
||||
{
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
if (!world.isRemote && meta == 2)
|
||||
{
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (stats != null)
|
||||
{
|
||||
ArmorExtended armor = stats.armor;
|
||||
ItemStack slotStack = armor.getStackInSlot(6);
|
||||
if (slotStack == null)// || slotStack.getItem() == this)
|
||||
{
|
||||
armor.setInventorySlotContents(6, new ItemStack(this, 1, 2));
|
||||
stack.stackSize--;
|
||||
}
|
||||
else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize)
|
||||
{
|
||||
slotStack.stackSize++;
|
||||
stack.stackSize--;
|
||||
}
|
||||
armor.recalculateHealth(player, stats);
|
||||
}
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
--stack.stackSize;
|
||||
player.heal((meta + 1) * 10);
|
||||
world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
return EnumAction.eat;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 0 || meta % 2 == 1)
|
||||
list.add(StatCollector.translateToLocal("item.crafting.tooltip"));
|
||||
else
|
||||
{
|
||||
list.add(StatCollector.translateToLocal("item.accessory.tooltip"));
|
||||
list.add(StatCollector.translateToLocal("canister.tooltip"));
|
||||
}
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip2"));
|
||||
break;
|
||||
case 2:
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip2"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipItem (ItemStack item, int slot)
|
||||
{
|
||||
int type = item.getItemDamage();
|
||||
return ((type == 2 && slot == 6) || (type == 4 && slot == 5) || (type == 6 && slot == 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthBoost (ItemStack item)
|
||||
{
|
||||
return item.stackSize * 2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import tconstruct.world.items.SpecialFood;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
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.4f };
|
||||
public static int[] overhaulHunger = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
|
||||
public Jerky(boolean hungerOverhaul)
|
||||
{
|
||||
super(hungerOverhaul ? overhaulHunger : hunger, saturation, itemNames, textureNames);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:food/jerky_" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return "item.tconstruct." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (stack.getItemDamage() == 7)
|
||||
{
|
||||
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 * 60, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
int type = stack.getItemDamage();
|
||||
switch (type)
|
||||
{
|
||||
case 6:
|
||||
list.add("\u00a7b" + StatCollector.translateToLocal("strangefood5.tooltip"));
|
||||
break;
|
||||
case 7:
|
||||
list.add("\u00a74" + StatCollector.translateToLocal("strangefood6.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Knapsack extends CraftingItem
|
||||
{
|
||||
|
||||
public Knapsack()
|
||||
{
|
||||
super(new String[] { "knapsack" }, new String[] { "knapsack" }, "armor/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO feel fix this so that stuff ticks in backpacks
|
||||
/*
|
||||
* @Override public void onArmorTickUpdate (World world, EntityPlayer
|
||||
* player, ItemStack itemStack) { TPlayerStats stats =
|
||||
* TConstruct.playerTracker.getPlayerStats(player.getDisplayName());
|
||||
* KnapsackInventory inv = stats.knapsack;
|
||||
*
|
||||
* if (stats != null && inv != null) { for (int i = 0; i <
|
||||
* inv.getSizeInventory(); i++) { if (inv.getStackInSlot(i) != null) {
|
||||
* inv.getStackInSlot(i).getItem().onUpdate(inv.getStackInSlot(i),
|
||||
* player.worldObj, player, i, false); } } } }
|
||||
*/
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TArmorBase extends ItemArmor
|
||||
// implements ISpecialArmor
|
||||
{
|
||||
IIcon[] icons;
|
||||
String[] iconNames = { "wood_boots" };
|
||||
|
||||
// static Minecraft mc = Minecraft.getMinecraft();
|
||||
// private ModelBiped modelArmor;
|
||||
|
||||
public TArmorBase(int armorSlot)
|
||||
{
|
||||
super(ArmorMaterial.CLOTH, 0, armorSlot);
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(100);
|
||||
setNoRepair();
|
||||
canRepair = false;
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
// this.modelArmor = new ModelBiped(0.75F);
|
||||
// this.setCreativeTab(TConstructRegistry.toolTab);
|
||||
}
|
||||
|
||||
public void onArmorTickUpdate (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by RenderBiped and RenderPlayer to determine the armor texture
|
||||
* that should be use for the currently equiped item. This will only be
|
||||
* called on instances of ItemArmor.
|
||||
*
|
||||
* Returning null from this function will use the default value.
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack for the equpt armor
|
||||
* @param entity
|
||||
* The entity wearing the armor
|
||||
* @param slot
|
||||
* The slot the armor is in
|
||||
* @param layer
|
||||
* The render layer, either 1 or 2, 2 is only used for CLOTH
|
||||
* armor by default
|
||||
* @return Path of texture to bind, or null to use default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
return "/mods/tinker/textures/armor/wood_1.png";
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to have an item handle its own armor rendering.
|
||||
*
|
||||
* @param entityLiving
|
||||
* The entity wearing the armor
|
||||
* @param itemStack
|
||||
* The itemStack to render the model of
|
||||
* @param armorSlot
|
||||
* 0=head, 1=torso, 2=legs, 3=feet
|
||||
*
|
||||
* @return A ModelBiped to render instead of the default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:armor/" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @Override public ArmorProperties getProperties (EntityLiving player,
|
||||
* ItemStack armor, DamageSource source, double damage, int slot) { // TODO
|
||||
* Auto-generated method stub return null; }
|
||||
*
|
||||
* @Override public int getArmorDisplay (EntityPlayer player, ItemStack
|
||||
* armor, int slot) { // TODO Auto-generated method stub return 0; }
|
||||
*
|
||||
* @Override public void damageArmor (EntityLiving entity, ItemStack stack,
|
||||
* DamageSource source, int damage, int slot) { // TODO Auto-generated
|
||||
* method stub
|
||||
*
|
||||
* }
|
||||
*/
|
||||
}
|
||||
@@ -0,0 +1,248 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.armor.items.ArmorPattern;
|
||||
|
||||
public class RenderArmorCast implements IItemRenderer
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
switch (helper)
|
||||
{
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.renderBlocksRg;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
|
||||
GL11.glPushMatrix();
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
|
||||
renderCube(tessellator, renderer, baseIcon);
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F);
|
||||
ArrayList<ForgeDirection> sides = new ArrayList<ForgeDirection>();
|
||||
sides.add(ForgeDirection.NORTH);
|
||||
sides.add(ForgeDirection.SOUTH);
|
||||
sides.add(ForgeDirection.EAST);
|
||||
sides.add(ForgeDirection.WEST);
|
||||
renderSelectedCube(tessellator, renderer, baseIcon, sides);
|
||||
renderCastTop(item, type);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender)
|
||||
{
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST))
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST))
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN))
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.UP))
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH))
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH))
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
IIcon icon = par1ItemStack.getIconIndex();
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(par1ItemStack.getItemSpriteNumber()));
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f = icon.getMinU();
|
||||
float f1 = icon.getMaxU();
|
||||
float f2 = icon.getMinV();
|
||||
float f3 = icon.getMaxV();
|
||||
float f4 = 0.0F;
|
||||
float f5 = 0.3F;
|
||||
GL11.glTranslatef(-f4, -f5, 0.0F);
|
||||
float f6 = 1.5F;
|
||||
GL11.glRotatef(90F, 90F, 0F, 0F);
|
||||
GL11.glScalef(0.9F, 0.9F, 2F);
|
||||
GL11.glTranslatef(0.05F, 0.05F, -0.6F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
GL11.glScalef(0.8F, 0.8F, 0.9F);
|
||||
GL11.glTranslatef(0.125F, 0.125F, 0.05F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
GL11.glScalef(0.6F, 0.6F, 0.6F);
|
||||
GL11.glTranslatef(0.335F, 0.335F, 0.05F);
|
||||
renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2);
|
||||
par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4);
|
||||
par0Tessellator.draw();
|
||||
float f5 = 0.5F * (par1 - par3) / (float) par5;
|
||||
float f6 = 0.5F * (par4 - par2) / (float) par6;
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
|
||||
int k;
|
||||
float f7;
|
||||
float f8;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
float f9;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
f9 = f7 + 1.0F / (float) par5;
|
||||
par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4);
|
||||
par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
f9 = f7 + 1.0F / (float) par6;
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8);
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8);
|
||||
}
|
||||
|
||||
par0Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class WingModel extends ModelBase
|
||||
{
|
||||
ModelRenderer WingBaseRight;
|
||||
ModelRenderer WingEdgeRight;
|
||||
ModelRenderer WingInsetRight;
|
||||
ModelRenderer WingCenterRight;
|
||||
ModelRenderer WingFlangeRight;
|
||||
ModelRenderer WingAuxRight;
|
||||
ModelRenderer WingBaseLeft;
|
||||
ModelRenderer WingEdgeLeft;
|
||||
ModelRenderer WingInsetLeft;
|
||||
ModelRenderer WingCenterLeft;
|
||||
ModelRenderer WingFlangeLeft;
|
||||
ModelRenderer WingAuxLeft;
|
||||
|
||||
public WingModel()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
// Right Wing
|
||||
WingBaseRight = new ModelRenderer(this, 0, 41);
|
||||
WingBaseRight.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseRight.setRotationPoint(-1F, 1F, 0F);
|
||||
setRotation(WingBaseRight, 0.5235988F, -0.5235988F, 0F);
|
||||
|
||||
WingEdgeRight = new ModelRenderer(this, 0, 53); // Texture position
|
||||
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); // Offset, Size
|
||||
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); // Negative x, y - 1,
|
||||
// Position
|
||||
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); // Angle in radians
|
||||
|
||||
WingInsetRight = new ModelRenderer(this, 6, 53);
|
||||
WingInsetRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingInsetRight.setRotationPoint(-0.504F, 0F, 7.8F);
|
||||
setRotation(WingInsetRight, 0.3490659F, 0F, 0F);
|
||||
|
||||
WingCenterRight = new ModelRenderer(this, 12, 53);
|
||||
WingCenterRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingCenterRight.setRotationPoint(-0.506F, 0.3F, 6.3F);
|
||||
setRotation(WingCenterRight, 0.1745329F, 0F, 0F);
|
||||
|
||||
WingFlangeRight = new ModelRenderer(this, 18, 53);
|
||||
WingFlangeRight.addBox(0F, 0F, -1F, 1, 8, 2);
|
||||
WingFlangeRight.setRotationPoint(-0.508F, 0.3F, 5.1F);
|
||||
setRotation(WingFlangeRight, 0F, 0F, 0F);
|
||||
|
||||
WingAuxRight = new ModelRenderer(this, 24, 53);
|
||||
WingAuxRight.addBox(0F, 0F, -1F, 1, 7, 2);
|
||||
WingAuxRight.setRotationPoint(-0.51F, 0.1F, 4F);
|
||||
setRotation(WingAuxRight, -0.1745329F, 0F, 0F);
|
||||
|
||||
WingBaseRight.addChild(WingEdgeRight);
|
||||
WingBaseRight.addChild(WingInsetRight);
|
||||
WingBaseRight.addChild(WingCenterRight);
|
||||
WingBaseRight.addChild(WingFlangeRight);
|
||||
WingBaseRight.addChild(WingAuxRight);
|
||||
|
||||
// Left Wing
|
||||
WingBaseLeft = new ModelRenderer(this, 42, 41);
|
||||
WingBaseLeft.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseLeft.setRotationPoint(1F, 1F, 0F);
|
||||
setRotation(WingBaseLeft, 0.5235988F, 0.5235988F, 0F);
|
||||
|
||||
WingEdgeLeft = new ModelRenderer(this, 58, 53);
|
||||
WingEdgeLeft.addBox(0F, 0F, -2F, 1, 9, 2);
|
||||
WingEdgeLeft.setRotationPoint(-0.502F, -1F, 10F);
|
||||
setRotation(WingEdgeLeft, 0.5235988F, 0F, 0F);
|
||||
|
||||
WingInsetLeft = new ModelRenderer(this, 52, 53);
|
||||
WingInsetLeft.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingInsetLeft.setRotationPoint(-0.504F, 0F, 7.8F);
|
||||
setRotation(WingInsetLeft, 0.3490659F, 0F, 0F);
|
||||
|
||||
WingCenterLeft = new ModelRenderer(this, 46, 53);
|
||||
WingCenterLeft.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
WingCenterLeft.setRotationPoint(-0.506F, 0.3F, 6.3F);
|
||||
setRotation(WingCenterLeft, 0.1745329F, 0F, 0F);
|
||||
|
||||
WingFlangeLeft = new ModelRenderer(this, 40, 53);
|
||||
WingFlangeLeft.addBox(0F, 0F, -1F, 1, 8, 2);
|
||||
WingFlangeLeft.setRotationPoint(-0.508F, 0.3F, 5.1F);
|
||||
setRotation(WingFlangeLeft, 0F, 0F, 0F);
|
||||
|
||||
WingAuxLeft = new ModelRenderer(this, 34, 53);
|
||||
WingAuxLeft.addBox(0F, 0F, -1F, 1, 7, 2);
|
||||
WingAuxLeft.setRotationPoint(-0.51F, 0.1F, 4F);
|
||||
setRotation(WingAuxLeft, -0.1745329F, 0F, 0F);
|
||||
|
||||
WingBaseLeft.addChild(WingEdgeLeft);
|
||||
WingBaseLeft.addChild(WingInsetLeft);
|
||||
WingBaseLeft.addChild(WingCenterLeft);
|
||||
WingBaseLeft.addChild(WingFlangeLeft);
|
||||
WingBaseLeft.addChild(WingAuxLeft);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
WingBaseRight.render(f5);
|
||||
WingBaseLeft.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
|
||||
{
|
||||
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package tconstruct.armor.modelblock;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.client.TProxyClient;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
public class DryingRackRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
TProxyClient.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
if (metadata == 0)
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.0, 0.375F, 1.0F, 0.25F, 0.625F);
|
||||
}
|
||||
if (metadata == 1)
|
||||
{
|
||||
renderer.setRenderBounds(0.375F, 0.0, 0.0f, 0.625F, 0.25F, 1F);
|
||||
}
|
||||
|
||||
if (metadata == 2)
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0.75F, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 3)
|
||||
{
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0F, 1F, 1.0F, 0.25F);
|
||||
}
|
||||
if (metadata == 4)
|
||||
{
|
||||
renderer.setRenderBounds(0.75F, 0.75F, 0.0f, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 5)
|
||||
{
|
||||
renderer.setRenderBounds(0F, 0.75F, 0.0f, 0.25F, 1.0F, 1F);
|
||||
}
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
renderblocks.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(0, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
renderblocks.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(1, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, -1F);
|
||||
renderblocks.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(2, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
renderblocks.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(3, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, block.getIcon(4, meta));
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderblocks.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, block.getIcon(5, meta));
|
||||
tessellator.draw();
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package tconstruct.armor.modelblock;
|
||||
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.tools.entity.FancyEntityItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
/* Special renderer, only used for drawing tools */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
{
|
||||
|
||||
public void render (DryingRackLogic logic, double posX, double posY, double posZ, float var8)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
float var10 = (float) (posX - 0.5F);
|
||||
float var11 = (float) (posY - 0.5F);
|
||||
float var12 = (float) (posZ - 0.5F);
|
||||
GL11.glTranslatef(var10, var11, var12);
|
||||
this.func_82402_b(logic);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void func_82402_b (DryingRackLogic logic)
|
||||
{
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
}
|
||||
|
||||
void renderItem (DryingRackLogic logic, ItemStack stack)
|
||||
{
|
||||
FancyEntityItem entityitem = new FancyEntityItem(logic.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
int meta = logic.getWorldObj().getBlockMetadata(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
if (meta <= 1)
|
||||
GL11.glTranslatef(1F, -0.375F, 0.905F);
|
||||
else
|
||||
{
|
||||
GL11.glTranslatef(1F, 0.375F, 0.905F);
|
||||
|
||||
if (meta / 2 == 2)
|
||||
{
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-0.0625F, 0F, 0F);
|
||||
}
|
||||
if (meta == 2)
|
||||
GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3)
|
||||
GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
if (meta == 4)
|
||||
GL11.glTranslatef(0F, 0F, 0.2875F);
|
||||
if (meta == 5)
|
||||
GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
}
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
// GL11.glRotatef(90F, -1, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0.2125F, 0.0375F);
|
||||
}
|
||||
|
||||
RenderItem.renderInFrame = true;
|
||||
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F);
|
||||
RenderItem.renderInFrame = false;
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
this.render((DryingRackLogic) logic, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
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.ArmorModTypeFilter;
|
||||
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.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(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,73 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.AModInteger;
|
||||
import tconstruct.library.armor.ArmorCore;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class AModDoubleJump extends AModInteger
|
||||
{
|
||||
public AModDoubleJump(ItemStack[] items)
|
||||
{
|
||||
super(6, "Double-Jump", EnumSet.of(EnumArmorPart.SHOES), items, 5, 1, "\u00a7a", StatCollector.translateToLocal("modifier.armour.jump.double"));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canModify (ItemStack armor, ItemStack[] input)
|
||||
{
|
||||
ArmorCore item = (ArmorCore) armor.getItem();
|
||||
if (armorTypes.contains(item.armorPart))
|
||||
{
|
||||
NBTTagCompound tags = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
return tags.getInteger("Modifiers") >= modifyCount && tags.getInteger("Double-Jump") < 3;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addToolTip (ItemStack tool, String tooltip, String modifierTip)
|
||||
{
|
||||
NBTTagCompound tags = tool.getTagCompound().getCompoundTag(getTagName());
|
||||
int tipNum = 0;
|
||||
while (true)
|
||||
{
|
||||
tipNum++;
|
||||
String tip = "Tooltip" + tipNum;
|
||||
if (!tags.hasKey(tip))
|
||||
{
|
||||
tags.setString(tip, tooltip);
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tags.setString(modTip, modifierTip);
|
||||
return tipNum;
|
||||
}
|
||||
else
|
||||
{
|
||||
String tag = tags.getString(tip);
|
||||
if (tag.contains("Double-Jump") || tag.contains("Triple-Jump"))
|
||||
{
|
||||
tags.setString(tip, getProperName(tooltip, tag));
|
||||
String modTip = "ModifierTip" + tipNum;
|
||||
tag = tags.getString(modTip);
|
||||
tags.setString(modTip, getProperName(modifierTip, tag));
|
||||
return tipNum;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getProperName (String tooltip, String tag)
|
||||
{
|
||||
if (tag.contains("Double-Jump"))
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.triple");
|
||||
|
||||
if (tag.contains("Triple-Jump"))
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.quad");
|
||||
|
||||
return color + StatCollector.translateToLocal("modifier.armour.jump.double");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
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.ArmorModTypeFilter;
|
||||
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.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(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,6 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
public class AModJumpBoost
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
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.ArmorModTypeFilter;
|
||||
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.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(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,88 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
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.ArmorModTypeFilter;
|
||||
import tconstruct.library.armor.EnumArmorPart;
|
||||
|
||||
public class AModMoveSpeed extends ArmorModTypeFilter
|
||||
{
|
||||
final boolean modifierType;
|
||||
|
||||
public AModMoveSpeed(int effect, EnumSet<EnumArmorPart> armorTypes, ItemStack[] items, int[] values, boolean type)
|
||||
{
|
||||
super(effect, "ExoSpeed" + (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 = matchingAmount(input);
|
||||
return tags.getInteger("Modifiers") >= amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modify (ItemStack[] input, ItemStack armor)
|
||||
{
|
||||
NBTTagCompound baseTag = armor.getTagCompound();
|
||||
NBTTagCompound armorTag = armor.getTagCompound().getCompoundTag(getTagName());
|
||||
|
||||
int amount = matchingAmount(input);
|
||||
int modifiers = armorTag.getInteger("Modifiers");
|
||||
modifiers -= amount;
|
||||
armorTag.setInteger("Modifiers", modifiers);
|
||||
|
||||
if (armorTag.hasKey(key))
|
||||
{
|
||||
amount += armorTag.getInteger(key);
|
||||
}
|
||||
armorTag.setInteger(key, amount);
|
||||
|
||||
NBTTagList attributes;
|
||||
if (baseTag.hasKey("AttributeModifiers"))
|
||||
{
|
||||
attributes = baseTag.getTagList("AttributeModifiers", 10);
|
||||
for (int iter = 0; iter < attributes.tagCount(); iter++)
|
||||
{
|
||||
NBTTagCompound tag = (NBTTagCompound) attributes.getCompoundTagAt(iter);
|
||||
if (tag.getString("AttributeName").equals(key))
|
||||
attributes.removeTag(iter);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributes = new NBTTagList();
|
||||
baseTag.setTag("AttributeModifiers", attributes);
|
||||
}
|
||||
attributes.appendTag(getAttributeTag("generic.movementSpeed", key, amount / 100d, modifierType, getUUIDFromItem(armor)));
|
||||
}
|
||||
|
||||
private static final UUID head = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c730");
|
||||
private static final UUID chest = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c731");
|
||||
private static final UUID pants = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c732");
|
||||
private static final UUID shoes = UUID.fromString("2ba6c8ae-4a19-49c6-aab4-ca3a5eb7c733");
|
||||
|
||||
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,42 @@
|
||||
package tconstruct.armor.modifiers;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import tconstruct.library.armor.ArmorModTypeFilter;
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user