Everything posted by GravityWolf
-
Help with telling if a swing is in progress
If I did this though: public void onUpdate(ItemStack itemStack, World world, Entity entity, EntityLivingBase entityLiving) { if(entityLiving.isSwingInProgress) { Minecraft.getMinecraft().thePlayer.swingItem(); } } Then if I clicked, wouldn't swings just go on forever?
-
Help with telling if a swing is in progress
Um, is Find Call Hierarchy the same as Open Call Hierarchy? If so, It doesn't tell me much...just says: onLeftClickEntity(EntityLivingBase) : boolean - NoctusRealmItemsBlock.Items.ItemDagger (Which is where my class is) But anyway, back to coding. How would I tell when the player left clicks in onUpdate? I don't see how I could do that...
-
New Dimension
Well, for the dimension, maybe look at this tutorial: http://www.minecraftforum.net/topic/1797143-152-16-forge-dimension-tutorial-multi-biome-dimension-ore-gen-basic-house-gen-tree-gen-skyrenderer-githubsrc-code/ But for making you teleport at the top, create a new block that acts like a portal, and in the plant spawning method thing, make it spawn at the top of the plant.
-
Help with telling if a swing is in progress
Ah, I think I got it. Just need to restart my computer so I have enough memory to run Minecraft to test it xP Here it is: public boolean onLeftClickEntity(EntityLivingBase entityLiving) { if(entityLiving.isSwingInProgress) { Minecraft.getMinecraft().thePlayer.swingItem(); } return false; } So, I think how it works is, umm, when the Entity left clicks, it checks if another swing is in progress, then sends out another swing. If not it just sends out a normal swing like usual. I think.
-
Help with telling if a swing is in progress
Thank you! But the only problem is that LivingAttackEvent is only called when I attack an entity. I need this to work whenever. If that's possible. Also, when I right click on LivingAttackEvent, it just shows the things that are methods that are using it.
-
Help with telling if a swing is in progress
Ah, thank you! I love learning more about Java!(not being sarcastic) But, umm, how would I call EntityPlayerBase? Also, just to let you know I'm not completely a n00b, I did make this attempt at it, but it is very buggy and it only works if you're hitting a mob. public static class DaggerSwing { @ForgeSubscribe public boolean onEntitySwing(LivingAttackEvent event) { if(FMLClientHandler.instance().getClient().thePlayer.isSwingInProgress = true) { Minecraft.getMinecraft().thePlayer.swingItem(); } return false; } }
-
Bow Drawback Speed?
I got it to work, but thanks.
-
Help with telling if a swing is in progress
Sorry, but what is a static call? And instance dependent isSwingInProgress means would be in an if statement, right? Also, what kind of parameter does a method tagged with the @ForgeSubscribe annotation require?
-
Bow Drawback Speed?
Icon[] myIcons = new Icon[5]; myIcons[0] = iconRegister.registerIcon(ModMain.modid+":"+"myItem"); myIcons[1] = iconRegister.registerIcon(ModMain.modid+":"+"myItem2"); myIcons[2] = iconRegister.registerIcon(ModMain.modid+":"+"myItem3"); etc Yay, thank you! But I am getting an error. Here is my code: Icon[] iconArray = new Icon[5]; iconArray[0] = iconRegister.registerIcon("nrbi" + ":" + "diamonderBow_0"); iconArray[1] = iconRegister.registerIcon("nrbi" + ":" + "diamonderBow_1"); iconArray[2] = iconRegister.registerIcon("nrbi" + ":" + "diamonderBow_2"); I am getting it under the semicolons. If anyone could help, that would be great! Thanks!
-
Bow Drawback Speed?
I don't know what type of array to make, how to assign the pics to the slots in the elements, etc.
-
Bow Drawback Speed?
Yes, I know...
-
Bow Drawback Speed?
Aah, thank you! But...um...iconArray?? Does that require me to have an icon, or is that an array you made?
-
Bow Drawback Speed?
Sorry, but where would I put this.getMaxItemUseDuration() Sorry for my noobishness xP
-
Bow Drawback Speed?
I am curious as to how I could change bow drawback speed. I've seen a few posts on this, but none has got resolved. I've looked through bow code, arrow code, (couldn't find EnumAction), and I saw nothing on speed. If anyone knows how to do this, it would be great if you could let me know. Thanks!
-
Help with telling if a swing is in progress
Hello! I am trying to create a weapon, where if you are swinging, and you click again, it cancels the current swing and calls another one. So it basically makes it swing faster. So I got the on click method, and here is the code I have so far: public boolean onEntitySwing(EntityLiving entityLiving, ItemStack stack) { if(EntityPlayerBase.isSwingInProgress) { } return true; } } I am getting errors EntityPlayerBase.isSwingInProgress, but that's most likely because i'm not importing it correctly...also, does anyone know of a swing method that does damage? If someone could have that would be great
-
Calling a swing?
Sorry guys, but all I need right now is the armor ignoring.
-
Calling a swing?
Still need help, just for adding the armor piercing to a weapon.
-
Setting Creative Tab
Got it to work, take a look at some Natura source. Look at Natura.java, NaturaTab.java, and any item. Basically making a new class for the tab.b https://github.com/mDiyo/Natura/tree/master/mods/natura
-
Setting Creative Tab
Still can't resolve NoctusRealm.tabNoctusRealm
-
Setting Creative Tab
Hi, I am having setting items in my creative tab using the tutorial on the wiki. I define my tab, then when I try to set it in my item class, it can't recognize it. Here is my mod file: package NoctusRealm; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import NoctusRealm.Items.ItemDragonSword; import NoctusRealm.Items.Items; import NoctusRealm.References.CommonProxy; import NoctusRealm.References.ModInfo; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.SidedProxy; 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.network.NetworkMod; @Mod(modid = ModInfo.ID, name = ModInfo.NAME, version = ModInfo.VERSION) @NetworkMod(channels = {ModInfo.CHANNEL}, clientSideRequired = true, serverSideRequired = true) public class NoctusRealm { public static CreativeTabs tabNoctusRealm = new CreativeTabs("NoctusRealm") { public ItemStack getIconItemStack() { return new ItemStack(Items.DragonSword, 1, 0); } }; @SidedProxy(clientSide = ModInfo.PROXYLOCATION + ".ClientProxy", serverSide = ModInfo.PROXYLOCATION + ".CommonProxy") public static CommonProxy proxy; @EventHandler public static void preInit(FMLPreInitializationEvent event) { proxy.initRenders(); proxy.initSounds(); Items.init(); MinecraftForge.EVENT_BUS.register(new ItemDragonSword.DragonFallEvent()); } @EventHandler public static void init(FMLInitializationEvent event) { } @EventHandler public static void postInit(FMLPostInitializationEvent event) { } } And my item file package NoctusRealm.Items; import java.util.List; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingFallEvent; import NoctusRealm.References.Names; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class ItemDragonSword extends ItemSword { public ItemDragonSword(int id, EnumToolMaterial material) { super(id, material); this.setUnlocalizedName(Names.DragonSwordUnlocalizedName); this.setCreativeTabs(NoctusRealm.tabNoctusRealm); } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { double calculatedX = 5 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedZ = 5 * (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedY = 2.5 * (double) (-MathHelper.sin((player.rotationPitch)/ 180.0F * (float) Math.PI) * 0.4f); player.motionY = calculatedY; player.motionX = calculatedX; player.motionZ = calculatedZ; return itemStack; } public static class DragonFallEvent { @ForgeSubscribe public void fallEvent(LivingFallEvent event) { EntityLivingBase player = event.entityLiving; ItemStack stack = player.getHeldItem(); if(stack != null && stack.getItem() == Items.DragonSword) event.setCanceled(true); } } @Override @SideOnly(Side.CLIENT) public void registerIcons(IconRegister icon) { itemIcon = icon.registerIcon("nr" + ":" + "dragonsword"); } public boolean hasEffect(ItemStack itemstack) { return true; } @Override @SideOnly(Side.CLIENT) public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add("Two-Handed"); } } I get the error under this.setCreativeTabs(NoctusRealm.tabNoctusRealm);
-
Calling a swing?
Thanks, but I get an error under mc
-
Calling a swing?
Thanks, but how/where do I apply this to my weapon? And for MyMod.xxx do I change MyMod to the package I am in?
-
Calling a swing?
Hello? Anyone know how to do this?
-
Calling a swing?
Oh, it's ok. I'm a huge noob too
-
Calling a swing?
Pretty sure I got the code right now, but I am having trouble registering it with Forge. Here is my attempt at registering: MinecraftForge.EVENT_BUS.register(new ItemKatana.EntityInteractEvent()); And here is my ItemKatana class: package NoctusRealm.Items; import net.minecraft.client.Minecraft; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemSword; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.player.EntityInteractEvent; public class ItemKatana extends ItemSword { public ItemKatana(int id, EnumToolMaterial material) { super(id, material); setMaxStackSize(1); setCreativeTab(CreativeTabs.tabCombat); } @Override public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { Minecraft.getMinecraft().thePlayer.swingItem(); double calculatedX = 0.2 * (double) (-MathHelper.sin(player.rotationYaw/ 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); double calculatedZ = 0.2 * (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)* MathHelper.cos(player.rotationPitch / 180.0F* (float) Math.PI) * 0.4f); player.motionX = calculatedX; player.motionZ = calculatedZ; player.motionY = 0.1; return itemStack; } @ForgeSubscribe public void EntityInteractEvent(EntityInteractEvent event, Entity entity) { if(entity instanceof EntityLiving) { ((EntityLiving)entity).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)entity), 1); } } } Anyone know why I am getting this error? It is: ItemKatana.EntityInteractEvent cannot be resolved to a type
IPS spam blocked by CleanTalk.