package assets.talecraft.src;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class TCRuneFeu extends Item
{
public TCRuneFeu(int par1)
{
super(par1);
this.setCreativeTab(TaleCraft.TCCreativeTabII);
}
@Override
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(ModInfo.MODID + ":tcRuneFeu");
}
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack par1ItemStack)
{
return true;
}
// ---------------------[ For Rune ]---------------------------//
public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
if (!par2World.isRemote)
{
par3EntityPlayer.curePotionEffects(par1ItemStack);
}
return par1ItemStack.stackSize ‹= 0 ? new ItemStack(TaleCraft.tcRuneFeu) : par1ItemStack;
}
/**
* How long it takes to use or consume an item
*/
public int getMaxItemUseDuration(ItemStack par1ItemStack)
{
return 32;
}
/**
* returns the action that specifies what animation to play when the items is being used
*/
public EnumAction getItemUseAction(ItemStack par1ItemStack)
{
return EnumAction.bow;
}
/**
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
*/
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
return par1ItemStack;
}
}
package assets.talecraft.src;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import cpw.mods.fml.relauncher.*;
public class TCCreativeTabI extends CreativeTabs {
public TCCreativeTabI(int position, String tabID)
{
super(position, tabID);
}
@SideOnly(Side.CLIENT)
public int getTabIconItemIndex()
{
return Block.enchantmentTable.blockID;
}
public String getTranslatedTabLabel()
{
return "Tale Craft - стадия I";
}
}
package assets.talecraft.src;
import java.util.Random;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.feature.WorldGenMinable;
import cpw.mods.fml.common.IWorldGenerator;
public class TCGen implements IWorldGenerator {
@Override
public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
switch(world.provider.dimensionId) {
case -1:
generateNether();
break;
case 0:
generateSurface(world, random, chunkX*16, chunkZ*16);
break;
case 1:
generateEnd();
break;
}
}
public void generateNether() {
//were not doing ore ore in the nether
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
for (int i = 0; i ‹ 30; i++) {
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(TaleCraft.tcStoneOre.blockID, 10)).generate(world, rand,
randPosX, randPosY, randPosZ);
}
//
for (int i = 0; i ‹ 30; i++) {
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(TaleCraft.tcCrystalOre.blockID, 10)).generate(world, rand,
randPosX, randPosY, randPosZ);
}
}
public void generateEnd() {
//were not going to generate in the end either
}
}
[size=9]--- Добавлено в 2014-01-12 23:29:44[/size]
Если тут есть админы, которые разбираются в коде Java, они поймут, что я написал.
Достижения
Биржа 



Поиск
Твинки
Друзья
Администрация