
ashtonr12
Members-
Posts
479 -
Joined
-
Last visited
Everything posted by ashtonr12
-
ok so this has been up for about two days, so clearly this is not a common topic, does anyone know a workaround like increaseing the resistance whilst block with a specific item or something like this?
-
can you tell me how i fudged up so i can avoid it next time?
-
as in restart eclipse or reinstall all of it?
-
i havnt even touched this class but when i opened eclipse today minecraft wont start saying theres an error with the start.java theres tonees or red error lines all over this package import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import net.minecraft.client.Minecraft; public class Start { public static void main(String[] args) { try { Field f = Minecraft.class.getDeclaredField("minecraftDir"); Field.setAccessible(new Field[] { f }, true); f.set(null, new File(".")); } catch (Exception e) { e.printStackTrace(); return; } if (args.length != 2) { Minecraft.main(args); } else { try { String parameters = "http://login.minecraft.net/?user=" + URLEncoder.encode(args[0], "UTF-8") + "&password=" + URLEncoder.encode(args[1], "UTF-8") + "&version=" + 13; String result = openUrl(parameters); if (result == null) { System.out.println("Can't connect to minecraft.net"); return; } if (!result.contains(":")) { System.out.println("Login Failed: " + result); return; } String[] values = result.split(":"); Minecraft.main(new String[] {values[2].trim(), values[3].trim()}); } catch (Exception e) { e.printStackTrace(); } } } private static String openUrl(String addr) { try { URL url = new URL(addr); java.io.InputStream is; is = url.openConnection().getInputStream(); java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(is)); String buf = ""; String line = null; while ((line = reader.readLine()) != null) { buf += "\n" + line; } reader.close(); return buf; } catch (IOException e) { e.printStackTrace(); } return null; } } here is the error code Exception in thread "main" java.lang.Error: Unresolved compilation problems: String cannot be resolved to a type Field cannot be resolved to a type Class<Minecraft> cannot be resolved to a type Field cannot be resolved Field cannot be resolved to a type File cannot be resolved to a type Exception cannot be resolved to a type String cannot be resolved to a type URLEncoder cannot be resolved URLEncoder cannot be resolved String cannot be resolved to a type System cannot be resolved System cannot be resolved String cannot be resolved to a type String cannot be resolved to a type Exception cannot be resolved to a type at Start.main(Start.java:13)
-
i assume i have to change the time value for something like onRighMouseButtonHold but i cannot find anyhing like this.
-
ok so i fixed the damage on right click but i cant make the duration of the potion effect equal the length of the player holding right click. updated code; package ashtonsmod.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; 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.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class DarkShield extends Item { public DarkShield(int par1) { super(par1); this.maxStackSize = 1; this.setMaxDamage(200); } @Override public String getTextureFile(){ return CommonProxy.items_png; } @SideOnly(Side.CLIENT) /** * Returns True is the item is renderer in full 3D when hold. */ public boolean isFull3D() { return true; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 72000; } /** * 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)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 10, 5)); par1ItemStack.damageItem(1, par3EntityPlayer); return par1ItemStack; } }
-
you can also use servertick, eg package modname.common; import java.util.EnumSet; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class ServerTickHandler implements ITickHandler { private void onPlayerTick(EntityPlayer player) { if (player.getCurrentItemOrArmor(4) != null ) { ItemStack helmet = player.getCurrentItemOrArmor(4); ItemStack chest = player.getCurrentItemOrArmor(3); ItemStack legs = player.getCurrentItemOrArmor(2); if (plate.getItem() == modname.platename ) { player.fallDistance = 0; } } } @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { if (type.equals(EnumSet.of(TickType.PLAYER))) { onPlayerTick((EntityPlayer)tickData[0]); } } @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER, TickType.SERVER); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { } @Override public String getLabel() { return null; } }
-
I have my shield that you can currently block with it and take reduced damage, i would like my shield to take damage when right clicked but i cant find out how anywhere in the existing code, i would alos like th resitance potion effect to last as long as i hold down right click and again i couldn't find any similar or same code in the existing code, so if anyone could show me some ways of doing this i would be very grateful. package ashtonsmod.common; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; 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.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class DarkShield extends Item { public DarkShield(int par1) { super(par1); this.maxStackSize = 1; this.setMaxDamage(200); } @Override public String getTextureFile(){ return CommonProxy.items_png; } @SideOnly(Side.CLIENT) /** * Returns True is the item is renderer in full 3D when hold. */ public boolean isFull3D() { return true; } /** * returns the action that specifies what animation to play when the items is being used */ public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.block; } /** * How long it takes to use or consume an item */ public int getMaxItemUseDuration(ItemStack par1ItemStack) { return 72000; } /** * 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)); par3EntityPlayer.addPotionEffect(new PotionEffect(Potion.resistance.id, 10, 5)); return par1ItemStack; } }
-
you have extended itemsoup with your food class and that can only have a stack of one and is programmed when eaten to replace the soup stack(1) with a bowl stack(1) so you just have to make your food item a single stack or just extend itemfood instead but then you might have to change some of your classes code.
-
ok so can someone correct me or just tell me how because ^ doesnt work.
-
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { if(player.getCurrentItemOrArmor(0) != null){ ItemStack hand = player.getCurrentItemOrArmor(0); if(hand.getItem() == ashtonsmod.DarkShard){ if(stack.getItemDamage() > 1 ){ (What is the break an item code?) else stack.setItemDamage(stack.getItemDamage() +1);
-
great thanks your definitely one of my favourite forge forums peeps
-
so something like public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { if(player.getCurrentItemOrArmor(0) != null){ ItemStack hand = player.getCurrentItemOrArmor(0); if(hand.getItem() == ashtonsmod.DarkShard){ if(stack.getItemDamage() < 1 ){ (What is the break an item code?) else stack.setItemDamage(stack.getItemDamage() +1); (probably wrong i know but its my best effort )
-
check if itemselected = Item.shard.shiftedindex if true check health of item, if health = 0 then destroy item else -1 health of item. closer
-
i do not no, i know it should take one damage from it per tick and when it reaches zero it should brake.
-
this awesome guy does tonnnes of tutorials from how to install to how to add your own mob http://www.youtube.com/user/TheGrovesyProject101/videos?view=0
-
then you have done it wrong
-
you add it as a normal block adding nightium or nightium ore is exactly the same the only difference comes later when you put one into world generation.
-
is it this part? }else{ stack.setItemDamage(20);
-
http://lmgtfy.com/?q=minecraft+forge+modding+tutorials+ore+generation&l=1
-
what you need for a block is main class package examplePackage.common; imports; @Mod(modid = "examplemod", name = "ExampleCraft!", version = "1.00") @NetworkMod(clientSideRequired = true, serverSideRequired = false) public class examplemod public static Block exampleblock; @SidedProxy(clientSide = "examplemodpackage.client.ClientProxyexamplemod", serverSide = "examplepackage.common.CommonProxy") public static CommonProxy proxy; @PreInit public void registerMyEvents(FMLPreInitializationEvent e){ } @Init public void load(FMLInitializationEvent event) { } exampleblock = new Blockexampleblock(blockid).setUnlocalisedName("EXAMPLE BLOCK!").setStepSound(Block.soundClothFootstep).setHardness(0.8F).setCreativeTab(tabBlocks); GameRegistry.registerBlock(exampleblockl); LanguageRegistry.addName(exmpleblock, "Example Block!!!"); MinecraftForge.setBlockHarvestLevel(exampleblock, "shovel", 3); ItemStack reed = new ItemStack(Block.Reed); GameRegistry.addRecipe(new ItemStack(exampleblock),"SSS", "SSS", "SSS",'S', reed); }}} then you need a exampleblock class package examplepackage.common; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.world.World; public class Blockexampleblock extends Block { public Blockexampleblock(int id, int texture) { super(id, texture, Material.cloth); this.setCreativeTab(CreativeTabs.tabBlock); } public int quantityDropped(int par1, int par2) { return 1; } public int idDropped (int par1, Random random, int par2) { return ashtonsmod.exampleblock.blockID; } @Override public String getTextureFile(){ return CommonProxy.blocks_png; } }