Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Yagoki

Members
  • Joined

  • Last visited

Everything posted by Yagoki

  1. what do you mean by "it doesn't work"? Is the effect not being applied, or is the damage acting oddly?
  2. there we go, did this in the project I use to test stuff package mods.gaspoweredstick.code.item; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; import net.minecraftforge.common.EnumHelper; public class ItemModArmor extends ItemArmor { public static final EnumArmorMaterial ModArmor = EnumHelper .addArmorMaterial("ModArmor", 9001, new int[]{1,2,3,4}, 42); public ItemModArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); } //put all you stuff that was in the player tick handler here. @Override public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) { player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 21, 0)); itemStack.damageItem(1, player); } } should all work fine, and you should be able to figure out what to do in the method. This will also give better performance than the tick handler.
  3. I'm working on it. I'm not even sure you need a tick handler here (almost definite) please don't pm me like that, If i don't reply to a post I commented on, it's ether because a.) I can't think of a solution yet. b.) I am working on a solution and it's taking me time. c.) I have no more to contribute to the thread. d.) I'm away from my laptop for real life reasons. in this case I was AFK and will reply with my solution in a minute.
  4. *Face-palm* why do I always forget that exists...
  5. it would help if you gave it an actual argb color... so get a signed value for FF FF FF FF = white = -1 by only putting FFFF (guessing you thought colors were 4 bit rather than 8 bit per part... 32 overall) you are omitting the alpha and the red, alpha is all that matters here in terms of why it's not showing. your alpha is 0, so it's fully transparent. how minecraft handles colours: this.alpha = (float)(par4 >> 24 & 255) / 255.0F; // takes the first 8 binary digits, then converts to a float between 0 and 1 this.red = (float)(par4 >> 16 & 255) / 255.0F; //second 8, then converts to a float between 0 and 1 this.blue = (float)(par4 >> 8 & 255) / 255.0F; // 3rd set of 8, then converts to a float between 0 and 1 this.green = (float)(par4 & 255) / 255.0F; // last 8, then converts to a float between 0 and 1
  6. glad you got it to work assuming you still have the bug with fall damage, just change the code to the following (just an extra if) @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { super.onUpdate(stack, world, entity, par4, par5); entity.fallDistance = 0; double x = entity.posX, y = entity.posY, z = entity.posZ; if(!(entity instanceof EntityPlayer)||entity.motionX*entity.motionX + entity.motionY*entity.motionY + entity.motionZ*entity.motionZ < 0.01)/*you may want to play with this number*/ return; //ADD THIS LINE HERE if(((EntityPlayer)entity).getItemInUse() != stack) return; AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x - 0.5D, y-1.0D, z-0.5D, x + 0.5D, y+1.0D, z+0.5D); List<Entity> entList = world.getEntitiesWithinAABBExcludingEntity(null, box); for(Entity ent: entList) { if(ent instanceof EntityLiving) { /*may need an if(!world.isRemote) here*/ ((EntityLiving)ent).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)entity), 1); } } } sorry was a bit sleepy when I first wrote that last night
  7. the replacement for hitEntity appears to be hitEntity public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving) { if(!Config.infinate) par1ItemStack.damageItem(1, par3EntityLiving); return true; } that's a snip from some of my 1.6.2 code, don't recall having to change it when I updated
  8. given you pass it an object instance of the runnable class, can you not pass the required variables through the constructor for that then use them in the generation methods? I will repeat that I suck with threading and you will probably have to be careful with de-synchronizing the world variable (so two different ones exist as one was changed in the thread and the other remained the same) but I can't think how to fix this (lots of synchronization at points possibly???) I'll look into how to fix that in a bit I'm probably being as useless as a... well.... as s sleep deprived me... you did all i was just typing, looks like my knowledge isn't as bad as I thought it was I'll look through your classes, but I probably won't be to much use in this state... why is England so hot all of a sudden???
  9. I suck at threading so I'm probably not much help, but to create a new thread do you not just call (new Thread(Runnable runnable)).start() at the point in the game loop where you want the thread to start? this causes the run method to be called in your Runnable class, so form there call your methods to generate the structure
  10. can probably do this in the onUpdate(...) method I showed you earlier. @Override public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) { super.onUpdate(stack, world, entity, par4, par5); entity.fallDistance = 0; double x = entity.posX, y = entity.posY, z = entity.posZ; if(!(entity instanceof EntityPlayer)||entity.motionX*entity.motionX + entity.motionY*entity.motionY + entity.motionZ*entity.motionZ < 0.01)/*you may want to play with this number*/ return; AxisAlignedBB box = AxisAlignedBB.getBoundingBox(x - 0.5D, y-1.0D, z-0.5D, x + 0.5D, y+1.0D, z+0.5D); List<Entity> entList = world.getEntitiesWithinAABBExcludingEntity(null, box); for(Entity ent: entList) { if(ent instanceof EntityLiving) { /*may need an if(!world.isRemote) here*/ ((EntityLiving)ent).attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer)entity), 1); } } } I check for speed to see if the player is dashing, as it seems easier. Alternatively you could do a boolean which is true when you initiate the dash then sets to false after so many ticks (set this to false here too, would have to be done as NBT data on the itemStack)
  11. I made this mistake the first time I played with making tick handlers @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER, TickType.SERVER); } should be @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.PLAYER); } give that a go now, and tell me if it works (you only need the one think in there in most cases, I've not come across any cases yet where I've needed 2)
  12. do you mean when they mouse over it in the inventory? not definite but you could try public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {} in your item class looking through the GuiContainer code this gets called whenever the player mouses over the item (but possibly other places too so look out for that) If you didn't mean that then please clarify.
  13. As you've not given me any of the code I'd like to look at (I'd preferably see your whole class for each of those) I can only speculate based on the evidence. Make sure that you are using your tick handler on both the client and server sides, so make sure it is registered in the client and common proxies. As only the server world is saved, if it is only decremented on the client the server wil think it's full when loading the player, so the damage will be full.
  14. hardly anything complicated, it's overriding a single vanilla method and adding a single line of code... I would take a look at learning a bit more basic coding before you continue with modding. If you want to make anything worthwhile you will need a lot more knowledge
  15. like this: if you are doing this in the Minecraft project (provided by default by MCP), just put the assets folder in the main source folder (so the folder with net. and cpw. and ibxm. and so on)
  16. Put it in mcp>src>minecraft>assets>(lowercase mod ID)>textures>items Make new folders if they don't exists already. nope not in the minecraft assets. nope nope nope. just create a package called assets.*moddid*.textures.items and put Item textures in there, similarly for blocks. It hasn't changes at all since 1.5.2, other than "mods" was changes to "assets" so the old tutorials mostly still work.
  17. put this in your item class, It gets called every tick on both sides so should work: @Override public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) { super.onUpdate(par1ItemStack, par2World, par3Entity, par4, par5); par3Entity.fallDistance = 0; } have fun
  18. Why would you come here on holiday, that seems like a terrible idea. Luckily for you the weather is great at the moment, was too hot to program today!
  19. yes good sir you remember that correctly damn GL11 I would say it's useful if you just want to see the bare minimum for that type display, and the rest is easy from that point, just extra graphics on top of it.
  20. haha, that's awesome Mazetar! From my experience with the people asking for help on MCF you may just want to copy paste that to all (well most) of them. I did something like this in my mod, not for achievements, but if you want to look at something for a reference you can look at the altar gui on my github, But the vanilla achievements page will help you out too (It's where most of my code came from, I just stripped out a lot of the unnecessary stuff). But do ALL the things Mazetar said first, that's probably your best bet if you don't have much of a background in programming. Also make sure you understand any code FULLY before copying or recreating it, otherwise you WILL get errors and WILL NOT progress, should seem obvious but it's amazing how many people do it.
  21. then change ITickHandler to IScheduledTickHandler, That would work better for you, you can specify the time between the ticks in that, you don't need to change any of the methods I put, It will just add 1, simply make that return 6000 form that for every 5 minutes.
  22. GameRegistry.registerTileEntity(MyTileEntity.class, "My Tile Entity")
  23. It appears to me that you are checking the block metadata as soon as it is placed, then setting the rotation from the players look vector. As the metadata is 0 when you place it, and you use the metadata from when it is placed, this will always be 0. try this instead: @Override public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack itemStack) { int meta = world.getBlockMetadata(x, y, z); int blockSet = meta / 4; int direction = MathHelper.floor_double((double)(entityliving.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3; int newMeta = (blockSet * 4) + direction; world.setBlockMetadataWithNotify(x, y, z, newMeta, 0); if (newMeta == 0) { world.setBlock(x + 1, y, z, Roads.blockGag1.blockID); world.setBlock(x + 2, y, z, Roads.blockGag2.blockID); world.setBlock(x + 3, y, z, Roads.blockGag3.blockID); } else if (newMeta == 1) { world.setBlock(x - 1, y, z, Roads.blockGag1.blockID); world.setBlock(x - 2, y, z, Roads.blockGag2.blockID); world.setBlock(x - 3, y, z, Roads.blockGag3.blockID); } else if (newMeta == 2) { world.setBlock(x, y, z + 1, Roads.blockGag1.blockID); world.setBlock(x, y, z + 2, Roads.blockGag2.blockID); world.setBlock(x, y, z + 3, Roads.blockGag3.blockID); } else if (newMeta == 3) { world.setBlock(x, y, z - 1, Roads.blockGag1.blockID); world.setBlock(x, y, z - 2, Roads.blockGag2.blockID); world.setBlock(x, y, z - 3, Roads.blockGag3.blockID); } } no promise but worth a shot.
  24. surely you could just do something as simple as this import java.util.EnumSet; import net.minecraft.world.World; import cpw.mods.fml.common.ITickHandler; import cpw.mods.fml.common.TickType; public class WorldTickHandler implements ITickHandler { @Override public void tickStart(EnumSet<TickType> type, Object... tickData) { World world = (World) tickData[0]; long time = System.currentTimeMillis(); //<--- returns the time since UNIX started in 1970 time %= 86400000; //<--- gets the time passed since midnight today (in milliseconds) //Logic to scale 1 minecraft day (20000 ticks) up to 1 real day //not doing to write this, but you sohuld be able to figure it out //after all that just: world.setWorldTime(time); } @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) {} @Override public EnumSet<TickType> ticks() { return EnumSet.of(TickType.WORLD); } @Override public String getLabel() { return "wordTickTest"; } } register this on the server and client sides using the relevant proxies and proxy.registerTickHandlers() in your main class
  25. One way of doing this is by creating an invisible block with a set light level, and then having this block be created by the item every few ticks (don't do it too often, lighting eats memory like there's no tomorrow) and have the block remove itself after the same number of ticks. This isn't too hard to implement, but there are probably many more efficient ways of doing this (in terms of memory usage) but this method is fairly easy to do.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.