Jump to content

PlatonCraft

Members
  • Posts

    114
  • Joined

  • Last visited

Everything posted by PlatonCraft

  1. There is an error. i dont know what should i do [spoiler=Block] package platon.mods.unenchant; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.inventory.IInventory; import net.minecraft.src.ModLoader; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class BlockUnEnchTbl extends BlockContainer { public BlockUnEnchTbl(int par1) { super(par1, Material.rock); this.setHardness(3.0F); this.setCreativeTab(CreativeTabs.tabDecorations); this.setResistance(5.0F); this.setLightValue(0.0F); } @Override public void registerIcons(IconRegister reg){ this.blockIcon = reg.registerIcon("unenchant:BlockUnEnchTbl"); } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c) { TileEntityUnEnchTbl unenchtbl = (TileEntityUnEnchTbl) world.getBlockTileEntity(x, y, z); if(player instanceof EntityPlayerMP && unenchtbl !=null) { ModLoader.serverOpenWindow((EntityPlayerMP) player, new ContainerUnEnchTbl(player, world, x, y, z), 1, x, y, z); } else { ModLoader.openGUI((EntityPlayerSP) player, new GuiUnEnchTbl(player, world, x, y, z)); } return true; } public TileEntity createNewTileEntity(World par1World) { return new TileEntityUnEnchTbl(); } } [spoiler=TileEntity] package platon.mods.unenchant; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; public class TileEntityUnEnchTbl extends TileEntity implements ISidedInventory { ItemStack[] itemslots = new ItemStack[2]; private String localizedName; public int playersCurrentlyUsingTbl; private String StuffName; public int getSizeInventory() { return this.itemslots.length; } public ItemStack getStackInSlot(int j) { return this.itemslots[j]; } public ItemStack decrStackSize(int i, int j) { return null; } public ItemStack getStackInSlotOnClosing(int i) { return null; } public void setInventorySlotContents(int i, ItemStack itemstack) { } @Override public void writeToNBT(NBTTagCompound nbt){ super.writeToNBT(nbt); NBTTagList nbttaglist = new NBTTagList(); for(int i = 0; i < this.itemslots.length; i++){ if(this.itemslots[i] !=null){ NBTTagCompound tag = new NBTTagCompound(); tag.setByte("Slot", (byte) i); this.itemslots[i].writeToNBT(tag); nbttaglist.appendTag(tag); } } nbt.setTag("Stuff", nbttaglist); if(this.isInvNameLocalized()){ nbt.setString("StuffName", this.StuffName); } } @Override public void readFromNBT(NBTTagCompound nbt){ super.readFromNBT(nbt); NBTTagList nbttaglist = nbt.getTagList("Stuff"); this.itemslots = new ItemStack[this.getSizeInventory()]; for(int i = 0; i < nbttaglist.tagCount(); i++){ int var1 = nbt.getByte("Slot") & 255; if(var1 <= 0 && var1 < this.itemslots.length){ this.itemslots[var1] = ItemStack.loadItemStackFromNBT(nbt); } } if(nbt.hasKey("StuffName")){ this.StuffName = nbt.getString("StuffName"); } } public String getInvName() { return this.isInvNameLocalized() ? this.localizedName : "container.UnEnchTbl"; } public boolean isInvNameLocalized() { return this.localizedName != null && this.localizedName.length() > 0; } /** * Setting the localizedName Variable * @param localizedName */ public void func_94043_a(String par1Str){ this.localizedName = par1Str; } public int getInventoryStackLimit() { return 64; } public boolean isUseableByPlayer(EntityPlayer entityplayer) { return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : entityplayer.getDistanceSq((double)xCoord+0.5D, (double)yCoord+0.5D, (double)zCoord+0.5D) <= 64.0D ; } public void openChest() { } public void closeChest() { } public boolean isItemValidForSlot(int i, ItemStack itemstack) { return true; } public int[] getAccessibleSlotsFromSide(int var1) { return null; } public boolean canInsertItem(int i, ItemStack itemstack, int j) { return false; } public boolean canExtractItem(int i, ItemStack itemstack, int j) { return false; } } [spoiler=Container] package platon.mods.unenchant; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ContainerUnEnchTbl extends Container { private IInventory itemSlot; public ContainerUnEnchTbl(EntityPlayer player, World world, int x, int y, int z){ TileEntityUnEnchTbl unenchtbl = (TileEntityUnEnchTbl) world.getBlockTileEntity(x, y, z); IInventory inv = player.inventory; for(int j = 0; j < unenchtbl.getSizeInventory();j++){ inv.setInventorySlotContents(j, null); } for(int j = 0; j < unenchtbl.getSizeInventory();j++) { inv.setInventorySlotContents(j, unenchtbl.getStackInSlot(j)); } this.itemSlot = unenchtbl; int var3; this.addSlotToContainer(new Slot(unenchtbl, 1, 14, 15)); this.addSlotToContainer(new Slot(unenchtbl, 2, 14, 10)); for (var3 = 0; var3 < 3; ++var3) { for (int var4 = 0; var4 < 9; ++var4) { this.addSlotToContainer(new Slot(inv, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18)); } } for (var3 = 0; var3 < 9; ++var3) { this.addSlotToContainer(new Slot(inv, var3, 8 + var3 * 18, 142)); } } public boolean canInteractWith(EntityPlayer entityplayer) { return this.itemSlot.isUseableByPlayer(entityplayer); } @Override public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack var3 = null; Slot var4 = (Slot)this.inventorySlots.get(par2); if (var4 != null && var4.getHasStack()) { ItemStack var5 = var4.getStack(); var3 = var5.copy(); if (par2 == 2) { if (!this.mergeItemStack(var5, 3, 39, true)) { return null; } var4.onSlotChange(var5, var3); } else if (par2 != 1 && par2 != 0) { if (par2 >= 3 && par2 < 30) { if (!this.mergeItemStack(var5, 30, 39, false)) { return null; } } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(var5, 3, 30, false)) { return null; } } else if (!this.mergeItemStack(var5, 3, 39, false)) { return null; } if (var5.stackSize == 0) { var4.putStack((ItemStack)null); } else { var4.onSlotChanged(); } if (var5.stackSize == var3.stackSize) { return null; } var4.onPickupFromSlot(par1EntityPlayer, var5); } return var3; } } [spoiler=Gui] package platon.mods.unenchant; import org.lwjgl.opengl.GL11; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiUnEnchTbl extends GuiContainer{ public GuiUnEnchTbl(EntityPlayer player, World world, int x, int y, int z) { super(new ContainerUnEnchTbl(player, world, x, y, z)); } @Override protected void drawGuiContainerForegroundLayer(int par1, int par2) { this.fontRenderer.drawString("Стол Снятия Зачарований", 0, 0, 4210752); this.fontRenderer.drawString("Инвентарь", 0, 0, 4210752); } protected void drawGuiContainerBackgroundLayer(float f, int i, int j) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.func_110577_a(new ResourceLocation("unenchant", "gui/unenchtblgui.png")); this.xSize=176; this.ySize=166; int var1 = (this.width-this.xSize)/2; int var2 = (this.height-this.ySize)/2; this.drawTexturedModalRect(var1, var2, 0, 0, this.xSize, this.ySize); } }
  2. So, what about adding me to your team? pleeeeease!!!
  3. Your mod writed FULLY wrong. There are MEGATONS of errors. Just follow tutorials.
  4. I really very low experienced in java, but i want to learn it, and if you would add me to you team it would a big experience to me. If you want your team to fix errors (mod crashes) i will try to fix it, but no promises. I would be VERY grateful if you add me to your team. p.s. all my experience in mod, that adds flint tools which can set blocks on fire. Simle mod, right?
  5. YEAH!!! I fixed it. I put the sound in mcp/eclipse folder. My sound is very bad. I need the sound of flint scratching stone. Can anyone help me with that? at least give me a link to site with different sounds.
  6. In a sence? I just copied this sound to src. I tried to create package and folder named assets.flintstonetools.sound but the result is same - error
  7. @Gotolink Just another error, and as I said if i compiling mod and put it to minecraft mods folder, all works
  8. If you mean code - yes, all the code here, too. in mcp/src/minecraft
  9. I just copied all i need to the src folder which in the mcp's home (where is files recomp and reobf). And it doesn't works and gives me an error described upper
  10. I already get mod works but not in eclipse. Where must assets/modname/sound directory must to be in eclipse, say please. I would be glad to some screenshot.
  11. I already tried this and its wasnt work but now i guessed that this is eclipse's problem i compiled my code and put it to minecraft mods folder and all get work but now in eclipse it doesn't works anyway. When i use my tool, all sounds are disappearing and minecraft writes the error code: 2013-08-18 22:00:04 [iNFO] [sTDERR] Exception in thread "Thread-15" java.lang.NullPointerException 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.codecs.CodecJOrbis.readHeader(CodecJOrbis.java:448) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.codecs.CodecJOrbis.initialize(CodecJOrbis.java:301) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.libraries.LibraryLWJGLOpenAL.loadSound(LibraryLWJGLOpenAL.java:392) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.libraries.LibraryLWJGLOpenAL.newSource(LibraryLWJGLOpenAL.java:640) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.SoundSystem.CommandNewSource(SoundSystem.java:1800) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.SoundSystem.CommandQueue(SoundSystem.java:2415) 2013-08-18 22:00:04 [iNFO] [sTDERR] at paulscode.sound.CommandThread.run(CommandThread.java:121) In what package in eclipe my sound must to be?
  12. Hello there! I want to add my custom sound to game and then play it. I have .ogg file (vorbis 2.0 codec) in assets.flintstonetools.sound folder in project. [spoiler=My Base of mod] package platon.mods.flintstonetools; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.network.NetServerHandler; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.MinecraftForge; 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.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod (modid = FlintBase.modid, name = "Flintstone Tools", version = "1.1.1a") @NetworkMod (clientSideRequired = true, serverSideRequired = false) public class FlintBase { public static final String modid = "flintstonetools"; @Instance(FlintBase.modid) public static FlintBase instance; public static Item flintpickaxe; static int flintpickaxeid; public static Item flintshovel; static int flintshovelid; public static Item flintaxe; static int flintaxeid; public static Item flinthoe; static int flinthoeid; public static Item flintsword; static int flintswordid; @EventHandler public void reg(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(new SoundLoader()); } @EventHandler public void preLoad(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); config.defaultEncoding="windows-1251"; flintpickaxeid = config.get("Mod IDs", "flintpickaxeid", 650).getInt(); flintshovelid = config.get("Mod IDs", "flintshovelid", 651).getInt(); flintaxeid = config.get("Mod IDs", "flintaxeid", 652).getInt(); flinthoeid = config.get("Mod IDs", "flinthoeid", 653).getInt(); flintswordid = config.get("Mod IDs", "flintswordid", 654).getInt(); SetBlockOnFire.fireableids = config.get("flintstonetools", "fireableids", SetBlockOnFire.deffireableids).getIntList(); config.addCustomCategoryComment("flintstonetools", "Here is the list of IDs of blocks that can be setted on fire by the flint pickaxe.\nThat list can be modified. Just add the Ids you want in column.\n\nЗдесь в столбик указаны ID блоков, которые можно поджигать кремневой киркой.\nВы можете изменять его. Просто добавьте свои ID в колонку с новой строки"); config.save(); } @EventHandler public void load(FMLInitializationEvent event) { flintpickaxe = new ItemFlintPickAxe(flintpickaxeid).setUnlocalizedName("flintpickaxe"); GameRegistry.addRecipe(new ItemStack(FlintBase.flintpickaxe, 1), new Object[]{ "XXX", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintpickaxe, "en_US", "Flint Pickaxe"); LanguageRegistry.instance().addNameForObject(flintpickaxe, "ru_RU", "Кремневая Кирка"); flintshovel = new ItemFlintShovel(flintshovelid).setUnlocalizedName("flintshovel"); GameRegistry.addRecipe(new ItemStack(FlintBase.flintshovel, 1), new Object[]{ " X ", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintshovel, "en_US", "Flint Shovel"); LanguageRegistry.instance().addNameForObject(flintshovel, "ru_RU", "Кремневая Лопата"); flintaxe = new ItemFlintAxe(flintaxeid).setUnlocalizedName("flintaxe"); GameRegistry.addRecipe(new ItemStack(FlintBase.flintaxe, 1), new Object[]{ " XX", " #X", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintaxe, "en_US", "Flint Axe"); LanguageRegistry.instance().addNameForObject(flintaxe, "ru_RU", "Кремневый Топор"); flinthoe = new ItemFlintHoe(flinthoeid).setUnlocalizedName("flinthoe"); GameRegistry.addRecipe(new ItemStack(FlintBase.flinthoe, 1), new Object[]{ " XX", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flinthoe, "en_US", "Flint Hoe"); LanguageRegistry.instance().addNameForObject(flinthoe, "ru_RU", "Кремневая Мотыга"); flintsword = new ItemFlintSword(flintswordid).setUnlocalizedName("flintsword"); GameRegistry.addRecipe(new ItemStack(FlintBase.flintsword, 1), new Object[]{ " X ", " X ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintsword, "en_US", "Flint Sword"); LanguageRegistry.instance().addNameForObject(flintsword, "ru_RU", "Кремневый Меч"); } static EnumToolMaterial FLINT = EnumHelper.addToolMaterial("FLINT", 2, 150, 5.0F, 2.0F, 10); } [spoiler=SoundLoader] package platon.mods.flintstonetools; import net.minecraft.client.audio.SoundManager; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; public class SoundLoader { @ForgeSubscribe public void onSoundsLoaded(SoundLoadEvent event) { event.manager.soundPoolSounds.addSound("flintstonetools/sound/stonestrike.ogg"); } } [spoiler=My item i want to play this sound] package platon.mods.flintstonetools; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.Property; import java.util.Random; public class ItemFlintPickAxe extends ItemPickaxe{ public ItemFlintPickAxe(int par1) { super(par1,FlintBase.FLINT); this.setCreativeTab(CreativeTabs.tabTools); } @Override public void registerIcons(IconRegister reg){ this.itemIcon = reg.registerIcon("flintstonetools:ItemFlintPickAxe"); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { par3World.playSoundAtEntity(par2EntityPlayer, "flintstonetools.sound.stonestrike", 1.0F, 1.0F); return true; } } Please help me!!! What should i do to make it work??? Minecraft 1.6.2 Forge 804
  13. YES!!! Thank you man!! and you too, gotolink!! Now its works. I have comletely forgot about the real ids. It is the best minecraft modding forum. If I would go to some our russian forums, I likely would not get some help Thank you!!
  14. itemID is not static. but you gave me one thing, real ids is id + 256. I ll try to write new ids
  15. Listen, once i had the same problem, I had a problem with calling blockID, it returned me 0, too. And i fixed this error with this forum's help. http://www.minecraftforge.net/forum/index.php/topic,9557.msg48255.html#msg48255 This is that topic. Read it, because I dont understand what did i done.
  16. still not work. I want to call flintpickaxe id from class ItemFlintPickAxe with something like this.itemID. And from class ItemFlintShovel flintshovel id by the same string. I dont want to write something like FlintBase.instance.flintpickaxe.itemID. And itemID still undefined and returns 0 after your changes. int flintshovelid is just my error
  17. I didn't completly understood you. If you want me to delete flintshovelid variable it will not help. I replaced this var in the bounds by integer 650 and it wasn't helped. Or have I misunderstood you?
  18. also i have question: what means this string? public static FlintBase instance = new FlintBase();
  19. if i define id by another way, all works.
  20. Oh sorry i am wrong, itemID is integer but this is final integer And this is my project: [spoiler=ItemFlintPickAxe] package platon.mods.flintstonetools; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.Property; import java.util.Random; public class ItemFlintPickAxe extends ItemPickaxe{ public ItemFlintPickAxe(int par1) { super(par1,FlintBase.FLINT); this.setCreativeTab(CreativeTabs.tabTools); } @Override public void registerIcons(IconRegister reg){ this.itemIcon = reg.registerIcon("flintstonetools:ItemFlintPickAxe"); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { float rand = itemRand.nextFloat(); return SetBlockOnFire.SBOF(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, rand, this.itemID); } } [spoiler=ItemFlintShovel] package platon.mods.flintstonetools; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemSpade; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class ItemFlintShovel extends ItemSpade { public ItemFlintShovel(int par1) { super(par1,FlintBase.FLINT); this.setCreativeTab(CreativeTabs.tabTools); } @Override public void registerIcons(IconRegister reg){ this.itemIcon = reg.registerIcon("flintstonetools:ItemFlintShovel"); } public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { float rand = itemRand.nextFloat(); return SetBlockOnFire.SBOF(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10, rand, this.itemID); } } [spoiler=SetBlockOnFire] package platon.mods.flintstonetools; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class SetBlockOnFire extends FlintBase{ private static int getRandom(int min, int max) { Random random = new Random(); int res = random.nextInt(max); res = res < min ? res + min : res; return res; } static boolean a; public static int[] fireableids = new int[200]; public static boolean isblockfireable(World par3World, int par4, int par5, int par6) { for (int i = 0;i<fireableids.length;i++){if (par3World.getBlockId(par4, par5-1, par6)==fireableids[i]) {a = true; break;} else {a = false;}} return a; } static int tooldmg; public static boolean SBOF(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10, float rand, int id) { if (par7 == 0) { --par5; } if (par7 == 1) { ++par5; } if (par7 == 2) { --par6; } if (par7 == 3) { ++par6; } if (par7 == 4) { --par4; } if (par7 == 5) { ++par4; } if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack)) { return false; } else { if (par3World.isAirBlock(par4, par5, par6) && getRandom(1,100)<=30 && SetBlockOnFire.isblockfireable(par3World, par4, par5, par6)) { par3World.playSoundEffect((double)par4 + 0.5D, (double)par5 + 0.5D, (double)par6 + 0.5D, "fire.ignite", 1.0F, rand * 0.4F + 0.8F); par3World.setBlock(par4, par5, par6, Block.fire.blockID); } switch(id){ case 650: SetBlockOnFire.tooldmg = 1; break; case 651: SetBlockOnFire.tooldmg = 2; break; } par1ItemStack.damageItem(tooldmg, par2EntityPlayer); return true; } } static int[] deffireableids = {1,4,14,15,16,21,23,41,42,45,48,49,56,57,61,73,87,97,98,112,129,153,158,173}; } [spoiler=FlintBase] package platon.mods.flintstonetools; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.Configuration; import net.minecraftforge.common.EnumHelper; import net.minecraftforge.common.Property; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod (modid = FlintBase.modid, name = "Flintstone Tools", version = "1.0.1a") @NetworkMod (clientSideRequired = true, serverSideRequired = false) public class FlintBase { public static final String modid = "flintstonetools"; public static FlintBase instance = new FlintBase(); public static Item flintpickaxe; static int flintpickaxeid; public static Item flintshovel; static int flintshovelid; @EventHandler public void preLoad(FMLPreInitializationEvent event) { Configuration config = new Configuration(event.getSuggestedConfigurationFile()); config.load(); config.defaultEncoding="windows-1251"; flintpickaxeid = config.get("Mod IDs", "flintpickaxeid", 650).getInt(); flintshovelid = config.get("Mod IDs", "flintshovelid", 651).getInt(); SetBlockOnFire.fireableids = config.get("flintpickaxe", "fireableids", SetBlockOnFire.deffireableids).getIntList(); config.addCustomCategoryComment("flintpickaxe", "Here is the list of IDs of blocks that can be setted on fire by the flint pickaxe.\nThat list can be modified. Just add the Ids you want in column.\n\nЗдесь в столбик указаны ID блоков, которые можно поджигать кремневой киркой.\nВы можете изменять его. Просто добавьте свои ID в колонку с новой строки"); config.save(); } @EventHandler public void load(FMLInitializationEvent event) { flintpickaxe = new ItemFlintPickAxe(flintpickaxeid).setUnlocalizedName("flintpickaxe"); GameRegistry.addRecipe(new ItemStack(FlintBase.flintpickaxe, 1), new Object[]{ "XXX", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintpickaxe, "en_US", "Flint Pickaxe"); LanguageRegistry.instance().addNameForObject(flintpickaxe, "ru_RU", "Кремневая Кирка"); flintshovel = new ItemFlintShovel(flintshovelid).setUnlocalizedName("flintshovel"); int flintshovelid; GameRegistry.addRecipe(new ItemStack(FlintBase.flintshovel, 1), new Object[]{ " X ", " # ", " # ", Character.valueOf('X'), Item.flint, ('#'), Item.stick}); LanguageRegistry.instance().addNameForObject(flintshovel, "en_US", "Flint Shovel"); LanguageRegistry.instance().addNameForObject(flintshovel, "ru_RU", "Кремневая Лопата"); } static EnumToolMaterial FLINT = EnumHelper.addToolMaterial("FLINT", 2, 150, 5.0F, 2.0F, 10); }
  21. itemID maybe not an integer. I not at home actually. I release the code tomorrow. In the top of class is a string "Public static Item flintpickaxe". flintpickaxe is an Item. I know that integer cant return null. You are didnt helped me. How can i call the ID of this block from bouns, i cant create new variable. say me please if itemID is integer, how can i define its value?
  22. itemInstance.itemID can't return null. At worse, it returns 0. That is, if your custom item extends Item class. flintpickaxe is not instance, this is Item. Once i tested it. and it returned null. but im not sure. anyway, when i calling flintpickaxe.itemID or calling itemID from anywhere it don't returns 650. I am sure. please help, haw can i call this int from the bounds?
  23. flintpickaxe = new ItemFlintPickAxe(650).setUnlocalizedName("flintpickaxe"); this string in the mod means that the item flintpickaxe got id 650, and it sends to class ItemFlintPickAxe. How can i call that id from the bounds from somewhere? if i calling flintpickaxe.itemID nothing happens. whereever i call itemID it alway equals null. Help please!!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.