mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 04:09:40 +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,55 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class Bowstring extends CraftingItem implements IToolPart
|
||||
{
|
||||
public Bowstring()
|
||||
{
|
||||
super(toolMaterialNames, buildTextureNames("_bowstring"), "parts/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "string", "enchantedfabric", "flamestring" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "string", "magicfabric", "flamestring" };
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
list.add(new ItemStack(b, 1, 0));
|
||||
if (TinkerTools.thaumcraftAvailable)
|
||||
list.add(new ItemStack(b, 1, 1));
|
||||
if (Loader.isModLoaded("Natura"))
|
||||
list.add(new ItemStack(b, 1, 2));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.ToolBuilder;
|
||||
import tconstruct.library.crafting.ToolRecipe;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class CreativeModifier extends Item
|
||||
{
|
||||
|
||||
public CreativeModifier()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
/**
|
||||
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
|
||||
*/
|
||||
@Override
|
||||
public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
|
||||
for (ToolRecipe recipe : ToolBuilder.instance.combos)
|
||||
{
|
||||
ToolCore tool = recipe.getType();
|
||||
ItemStack item = new ItemStack(par1, 1, 0);
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setString("TargetLock", tool.getToolName());
|
||||
|
||||
item.setTagCompound(compound);
|
||||
par3List.add(item);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:skull_char_gold");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
String targetLock = "None";
|
||||
targetLock = stack.getTagCompound().getString("TargetLock");
|
||||
list.add(StatCollector.translateToLocal("creativeModLock.tooltip") + targetLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
|
||||
public class Fletching extends CraftingItem implements IToolPart
|
||||
{
|
||||
public Fletching()
|
||||
{
|
||||
super(toolMaterialNames, buildTextureNames("_fletching"), "parts/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "feather", "leaf", "slime", "blueslime" };
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.books.BookData;
|
||||
import mantle.client.gui.GuiManual;
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Manual extends CraftingItem
|
||||
{
|
||||
static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" };
|
||||
static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue" };
|
||||
|
||||
public Manual()
|
||||
{
|
||||
super(name, textureName, "", "tinker", TConstructRegistry.materialTab);
|
||||
setUnlocalizedName("tconstruct.manual");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
player.addStat(TAchievements.achievements.get("tconstruct:beginner"), 1);
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
player.openGui(TConstruct.instance, mantle.client.MProxyClient.manualGuiID, world, 0, 0, 0);
|
||||
FMLClientHandler.instance().displayGuiScreen(player, new GuiManual(stack, getData(stack)));
|
||||
return stack;
|
||||
}
|
||||
|
||||
private BookData getData (ItemStack stack)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
return TProxyClient.manualData.beginner;
|
||||
case 1:
|
||||
return TProxyClient.manualData.toolStation;
|
||||
case 2:
|
||||
return TProxyClient.manualData.smeltery;
|
||||
default:
|
||||
return TProxyClient.manualData.diary;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add("\u00a7o" + StatCollector.translateToLocal("manual1.tooltip"));
|
||||
break;
|
||||
case 1:
|
||||
list.add("\u00a7o" + StatCollector.translateToLocal("manual2.tooltip"));
|
||||
break;
|
||||
case 2:
|
||||
list.add("\u00a7o" + StatCollector.translateToLocal("manual3.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import mantle.books.BookData;
|
||||
import mantle.books.BookDataStore;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import tconstruct.client.TProxyClient;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
public class ManualInfo
|
||||
{
|
||||
// static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" };
|
||||
// static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue" };
|
||||
|
||||
BookData beginner = new BookData();
|
||||
BookData toolStation = new BookData();
|
||||
BookData smeltery = new BookData();
|
||||
BookData diary = new BookData();
|
||||
|
||||
/* diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory);
|
||||
volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory);
|
||||
volume2 = readManual("/assets/tinker/manuals/materials.xml", dbFactory);
|
||||
smelter = readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);*/
|
||||
|
||||
public ManualInfo()
|
||||
{
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
beginner = initManual(beginner, "tconstruct.manual.beginner", "\u00a7o" + StatCollector.translateToLocal("manual1.tooltip"), side == Side.CLIENT ? TProxyClient.volume1 : null,
|
||||
"tinker:tinkerbook_diary");
|
||||
toolStation = initManual(toolStation, "tconstruct.manual.toolstation", "\u00a7o" + StatCollector.translateToLocal("manual2.tooltip"), side == Side.CLIENT ? TProxyClient.volume2 : null,
|
||||
"tinker:tinkerbook_toolstation");
|
||||
smeltery = initManual(smeltery, "tconstruct.manual.smeltery", "\u00a7o" + StatCollector.translateToLocal("manual3.tooltip"), side == Side.CLIENT ? TProxyClient.smelter : null,
|
||||
"tinker:tinkerbook_smeltery");
|
||||
diary = initManual(diary, "tconstruct.manual.diary", "\u00a7o" + StatCollector.translateToLocal("manual4.tooltip"), side == Side.CLIENT ? TProxyClient.diary : null, "tinker:tinkerbook_blue");
|
||||
|
||||
}
|
||||
|
||||
public BookData initManual (BookData data, String unlocName, String toolTip, Document xmlDoc, String itemImage)
|
||||
{
|
||||
//proxy.readManuals();
|
||||
data.unlocalizedName = unlocName;
|
||||
data.toolTip = unlocName;
|
||||
data.modID = "TConstruct";
|
||||
data.itemImage = new ResourceLocation(data.modID, itemImage);
|
||||
data.doc = xmlDoc;
|
||||
BookDataStore.addBook(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class MaterialItem extends CraftingItem
|
||||
{
|
||||
|
||||
public MaterialItem()
|
||||
{
|
||||
super(materialNames, getTextures(), "materials/", "tinker", TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
private static String[] getTextures ()
|
||||
{
|
||||
String[] names = new String[craftingTextures.length];
|
||||
for (int i = 0; i < craftingTextures.length; i++)
|
||||
{
|
||||
if (craftingTextures[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = "material_" + craftingTextures[i];
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
static String[] materialNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot", "ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone",
|
||||
"CopperIngot", "TinIngot", "AluminumIngot", "RawAluminum", "BronzeIngot", "AluBrassIngot", "AlumiteIngot", "SteelIngot", "BlueSlimeCrystal", "ObsidianIngot", "IronNugget", "CopperNugget",
|
||||
"TinNugget", "AluminumNugget", "EssenceCrystal", "AluBrassNugget", "SilkyCloth", "SilkyJewel", "ObsidianNugget", "CobaltNugget", "ArditeNugget", "ManyullynNugget", "BronzeNugget",
|
||||
"AlumiteNugget", "SteelNugget", "PigIronIngot", "PigIronNugget", "GlueBall", "SearedBrick", "ArditeDust", "CobaltDust", "AluminumDust", "ManyullynDust", "AluBrassDust" };
|
||||
|
||||
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot", "arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone",
|
||||
"copperingot", "tiningot", "aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot", "blueslimecrystal", "obsidianingot", "nugget_iron",
|
||||
"nugget_copper", "nugget_tin", "nugget_aluminum", "", "nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite", "nugget_manyullyn",
|
||||
"nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron", "glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminium_dust", "manyullyn_dust",
|
||||
"alubrass_dust" };
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.crafting.PatternBuilder.MaterialSet;
|
||||
import tconstruct.library.util.IPattern;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class Pattern extends CraftingItem implements IPattern
|
||||
{
|
||||
public Pattern(String patternType, String folder)
|
||||
{
|
||||
this(patternName, getPatternNames(patternType), folder);
|
||||
}
|
||||
|
||||
public Pattern(String[] names, String[] patternTypes, String folder)
|
||||
{
|
||||
super(names, patternTypes, 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;
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade", "largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign",
|
||||
"knifeblade", "chisel", "largerod", "toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard", "bowstring", "fletching", "arrowhead" };
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < patternName.length; i++)
|
||||
{
|
||||
// if (i != 23)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem (ItemStack stack)
|
||||
{
|
||||
if (stack.stackSize <= 0)
|
||||
return null;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesContainerItemLeaveCraftingGrid (ItemStack stack)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Tags and information about the pattern */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
float cost = getPatternCost(stack) / 2f;
|
||||
if (cost > 0)
|
||||
{
|
||||
if (cost - (int) cost < 0.1)
|
||||
list.add(StatCollector.translateToLocal("pattern1.tooltip") + (int) cost);
|
||||
else
|
||||
list.add(StatCollector.translateToLocal("pattern2.tooltip") + cost);
|
||||
}
|
||||
}
|
||||
|
||||
// 2 for full material, 1 for half.
|
||||
@Override
|
||||
public int getPatternCost (ItemStack pattern)
|
||||
{
|
||||
switch (pattern.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
return 2;
|
||||
case 1:
|
||||
return 1;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 2;
|
||||
case 4:
|
||||
return 2;
|
||||
case 5:
|
||||
return 2;
|
||||
case 6:
|
||||
return 1;
|
||||
case 7:
|
||||
return 1;
|
||||
case 8:
|
||||
return 1;
|
||||
case 9:
|
||||
return 1;
|
||||
case 10:
|
||||
return 2;
|
||||
case 11:
|
||||
return 2;
|
||||
case 12:
|
||||
return 1;
|
||||
case 13:
|
||||
return 1;
|
||||
case 14:
|
||||
return 6;
|
||||
case 15:
|
||||
return 6;
|
||||
case 16:
|
||||
return 16;
|
||||
case 17:
|
||||
return 16;
|
||||
case 18:
|
||||
return 16;
|
||||
case 19:
|
||||
return 16;
|
||||
case 20:
|
||||
return 16;
|
||||
case 21:
|
||||
return 16;
|
||||
case 22:
|
||||
return 6;
|
||||
case 23:
|
||||
return 6;
|
||||
case 24:
|
||||
return 2;
|
||||
case 25:
|
||||
return 2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPatternOutput (ItemStack stack, ItemStack input, MaterialSet set)
|
||||
{
|
||||
return TConstructRegistry.getPartMapping((Item) this, stack.getItemDamage(), set.materialID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.IEntityLivingData;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Facing;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.client.TProxyClient;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TitleIcon extends Item
|
||||
{
|
||||
int[] primaryColor = { 0x66BBE8, 0x66BBE8 };
|
||||
int[] secondaryColor = { 0x1567BF, 0xFFEC6E };
|
||||
String[] mobNames = { "TConstruct.EdibleSlime", "TConstruct.KingSlime" };
|
||||
|
||||
String[] achievementIconNames = new String[] { "tinkerer", "preparedFight", "proTinkerer", "enemySlayer", "dualConvenience" };
|
||||
IIcon[] achievementIcons = new IIcon[achievementIconNames.length];
|
||||
|
||||
public TitleIcon()
|
||||
{
|
||||
super();
|
||||
this.setCreativeTab(CreativeTabs.tabMisc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
ToolCore.blankSprite = iconRegister.registerIcon("tinker:blanksprite");
|
||||
TProxyClient.metalBall = iconRegister.registerIcon("tinker:metalball");
|
||||
itemIcon = iconRegister.registerIcon("tinker:tparts");
|
||||
for (int i = 0; i < achievementIcons.length; i++)
|
||||
{
|
||||
achievementIcons[i] = iconRegister.registerIcon("tinker:achievementIcons/" + (i < achievementIconNames.length ? achievementIconNames[i] : ""));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamageForRenderPass (int par1, int par2)
|
||||
{
|
||||
if (par1 == 255)
|
||||
return itemIcon;
|
||||
if (par1 >= 4096)
|
||||
{
|
||||
return getIconFromDamage(par1);
|
||||
}
|
||||
return new ItemStack(Blocks.mob_spawner).getItem().getIconFromDamageForRenderPass(par1, par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage (int par1)
|
||||
{
|
||||
if (par1 >= 4096)
|
||||
{
|
||||
int index = par1 - 4096;
|
||||
if (index < achievementIcons.length)
|
||||
{
|
||||
return achievementIcons[index];
|
||||
}
|
||||
}
|
||||
// Not returning null to prevent crashes
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName (ItemStack par1ItemStack)
|
||||
{
|
||||
String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim();
|
||||
String s1 = mobNames[par1ItemStack.getItemDamage()];
|
||||
|
||||
if (s1 != null)
|
||||
{
|
||||
s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name");
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < mobNames.length; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack (ItemStack stack, int pass)
|
||||
{
|
||||
int damage = stack.getItemDamage();
|
||||
if (damage == 255)
|
||||
return 0xffffff;
|
||||
if (damage >= 4096)
|
||||
return 0xffffff;
|
||||
return pass == 0 ? primaryColor[damage] : secondaryColor[damage];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int posX, int posY, int posZ, int par7, float par8, float par9, float par10)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
Block b = world.getBlock(posX, posY, posZ);
|
||||
posX += Facing.offsetsXForSide[par7];
|
||||
posY += Facing.offsetsYForSide[par7];
|
||||
posZ += Facing.offsetsZForSide[par7];
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (par7 == 1 && b != null && b.getRenderType() == 11)
|
||||
{
|
||||
d0 = 0.5D;
|
||||
}
|
||||
|
||||
int damage = stack.getItemDamage();
|
||||
switch (damage)
|
||||
{
|
||||
case 0:
|
||||
spawnEntity(posX, posY, posZ, new BlueSlime(world), world, player);
|
||||
break;
|
||||
case 1:
|
||||
spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world, player);
|
||||
break;
|
||||
}
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
--stack.stackSize;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static EntityLiving activateSpawnEgg (ItemStack stack, World world, double posX, double posY, double posZ, int par7)
|
||||
{
|
||||
Block b = world.getBlock((int) posX, (int) posY, (int) posZ);
|
||||
posX += Facing.offsetsXForSide[par7];
|
||||
posY += Facing.offsetsYForSide[par7];
|
||||
posZ += Facing.offsetsZForSide[par7];
|
||||
double d0 = 0.0D;
|
||||
|
||||
if (par7 == 1 && b != null && b.getRenderType() == 11)
|
||||
{
|
||||
d0 = 0.5D;
|
||||
}
|
||||
|
||||
int damage = stack.getItemDamage();
|
||||
EntityLiving entity = null;
|
||||
switch (damage)
|
||||
{
|
||||
case 0:
|
||||
entity = new BlueSlime(world);
|
||||
spawnEntity(posX, posY, posZ, entity, world);
|
||||
break;
|
||||
case 1:
|
||||
entity = new BlueSlime(world);
|
||||
spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world);
|
||||
break;
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
|
||||
public static void spawnEntity (double x, double y, double z, Entity entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
((EntityLiving) entity).onSpawnWithEgg((IEntityLivingData) null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnEntity (double x, double y, double z, Entity entity, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
entity.setAngles(player.cameraYaw, player.cameraYaw);
|
||||
((EntityLiving) entity).onSpawnWithEgg((IEntityLivingData) null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnBossSlime (double x, double y, double z, BlueSlime entity, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.setSlimeSize(8);
|
||||
entity.onSpawnWithEgg((IEntityLivingData) null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
|
||||
public static void spawnBossSlime (double x, double y, double z, BlueSlime entity, World world)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
entity.setPosition(x, y, z);
|
||||
entity.setSlimeSize(8);
|
||||
entity.onSpawnWithEgg((IEntityLivingData) null);
|
||||
world.spawnEntityInWorld(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mantle.items.abstracts.CraftingItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.util.IToolPart;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class ToolPart extends CraftingItem implements IToolPart
|
||||
{
|
||||
public String partName;
|
||||
|
||||
public ToolPart(String textureType, String name)
|
||||
{
|
||||
super(toolMaterialNames, buildTextureNames(textureType), "parts/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setCreativeTab(TConstructRegistry.partTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
this.partName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName (ItemStack par1ItemStack)
|
||||
{
|
||||
String material = StatCollector.translateToLocal("parttype." + toolTextureNames[par1ItemStack.getItemDamage()]);
|
||||
String name = StatCollector.translateToLocal("toolpart." + partName);
|
||||
name = name.replaceAll("%%material", material);
|
||||
|
||||
return name;
|
||||
|
||||
/*
|
||||
* StringBuilder builder = new StringBuilder();
|
||||
* builder.append(StatCollector.translateToLocal("parttype." +
|
||||
* toolTextureNames
|
||||
* [par1ItemStack.getItemDamage()])).append(" ").append(StatCollector
|
||||
* .translateToLocal("toolpart." + partName)); return
|
||||
* builder.toString(); -- String s = ("" +
|
||||
* StatCollector.translateToLocal("toolpart."+partName)).trim(); String
|
||||
* s1 = toolMaterialNames[par1ItemStack.getItemDamage()];
|
||||
*
|
||||
* if (s1 != null) { s = s + " " + StatCollector.translateToLocal(s1); }
|
||||
*
|
||||
* return s;
|
||||
*/
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (toolTextureNames[i].equals(""))
|
||||
names[i] = "";
|
||||
else
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone", "Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn",
|
||||
"Copper", "Bronze", "Alumite", "Steel", "Blue Slime", "Pig Iron", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
|
||||
|
||||
public static final String[] toolTextureNames = new String[] { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn",
|
||||
"copper", "bronze", "alumite", "steel", "blueslime", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < 19; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
|
||||
if (TinkerTools.thaumcraftAvailable)
|
||||
list.add(new ItemStack(b, 1, 31));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaterialID (ItemStack stack)
|
||||
{
|
||||
return stack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ToolPartHidden extends ToolPart
|
||||
{
|
||||
|
||||
public ToolPartHidden(String textureType, String name)
|
||||
{
|
||||
super(textureType, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package tconstruct.tools.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.tools.TinkerTools;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ToolShard extends ToolPart
|
||||
{
|
||||
|
||||
public ToolShard(String tex)
|
||||
{
|
||||
super(tex, "ToolShard");
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
private static String[] buildTextureNames (String textureType)
|
||||
{
|
||||
String[] names = new String[toolMaterialNames.length];
|
||||
for (int i = 0; i < toolMaterialNames.length; i++)
|
||||
{
|
||||
if (!toolTextureNames[i].equals(""))
|
||||
names[i] = toolTextureNames[i] + textureType;
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
icons[5] = icons[4];
|
||||
for (int i = 6; i < 9; ++i)
|
||||
{
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
icons[9] = icons[8];
|
||||
for (int i = 10; i < icons.length; ++i)
|
||||
{
|
||||
if (!toolTextureNames[i].equals(""))
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 1; i < 5; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
for (int i = 6; i < 9; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
for (int i = 10; i < 19; i++)
|
||||
list.add(new ItemStack(b, 1, i));
|
||||
|
||||
if (TinkerTools.thaumcraftAvailable)
|
||||
list.add(new ItemStack(b, 1, 31));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user