Jump to content
Search In
  • More options...
Find results that contain...
Find results in...


  • Posts

  • Joined

  • Last visited

Everything posted by StrangeOne101

  1. As Draco said, you need to call setTextureName in order for this.getTextureName() to get the right texture. Use this.setTextureName(YourMod.modID + ":yourCustomCakeTexture"); to set the texture, but be sure not to include .png on the end. Forge does that by itself
  2. Haha, hey dude I tried what you said but it seemed to make everything stop working completely. Still was stuck so I posted here in hope of getting a solution. As diesieben said, there may not be a way without some really clever stuff so I might just settle on testing for TileEntities and some other blocks. Thanks anyway.
  3. That means that it will not spawn when they right click on any block. So if they click on grass even, it won't spawn. I don't want that. I know that. I don't have a certain block I'm trying to check for though. I'm trying to check for all blocks that interact only so I can spawn my entity if it doesn't interact.
  4. As I said, it is causing me issues as it is still spawning when the player is interacting with a block like crafting tables, chests, doors, etc. I don't want it to spawn when they interact with blocks like these, I want it like the item interact code.
  5. The item is can be any item that fits the standard of what I need. I don't have an item file for it.
  6. I'm trying to spawn a custom entity when a player right clicks with an item. The only thing is that it still spawns when I interact with blocks like crafting tables, chests, etc
  7. I need an event that either triggers on right click AFTER block interaction or for some way to do that with the PlayerInteractEvent. I want it to be like the onItemUse method in items that triggers after block interaction or if the player is holding shift. I did originally have the code in an item, but the item is meant to override a vanilla item with a new function and that's not possible with 1.7. The following code it what I currently have for my PlayerInteractEvent. I've tried manually triggering the activation then canceling the event after (to prevent activation from happening twice, too) but it seems to cause other problems like no more chest animations or sound. If anyone could help me with this, that'd be great. Thanks Code: @SubscribeEvent public void onRightClick(PlayerInteractEvent e) { if (e.isCanceled()) { return; } if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_AIR ) { this.throwBrickEvent(e.entityPlayer); //New item function. Just easier in once line and place. } else if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && e.entityPlayer.getHeldItem() != null && this.canThrow(e.entityPlayer.getHeldItem())) { Block block = e.world.getBlock(e.x, e.y, e.z); if (!block.onBlockActivated(e.world, e.x, e.y, e.z, e.entityPlayer, e.face, e.x, e.y, e.z)) //Don't know what the last 3 parameters are { e.setResult(Result.DEFAULT); this.throwBrickEvent(e.entityPlayer); } e.setCanceled(true); } }
  8. The thing is, I don't really want to create a whole new crafting table and recipes. I've thought about it but it doesn't suit my mod. Thanks anyway.
  9. I know that this is an old post but I'm still having this problem. Hopefully I'm not breaking any rules by doing this, but please let me know if I am. It's just a real serious problem and I can't seem to find any solution.
  10. No, just make sure your doing it client side. That's what the if (!world.isRemote) is for. If isRemote returns true, it's running the code from the server (it runs from both client and server though). So the code only runs when the client runs the code. And I have no idea about GUIs. There's bound to be a method for when you close them though.
  11. Only modify blocks from the client. if (!world.isRemote) { world.editBlocks = true; world.setBlockWithNotify(x, y, z, Block.stone.blockID); world.editBlocks = false; }
  12. More infomation: I redid the code, same result. I follow thistutorial. http://www.minecraftforum.net/topic/1797143-152-16-forge-dimension-tutorial-multi-biome-dimension-ore-gen-basic-house-gen-tree-gen-skyrenderer-githubsrc-code/ And a screenshot is attached as well, showing the terrain and null biome. http://i1327.photobucket.com/albums/u678/StrangeOne101/2013-08-18_124724_zpsb7a6db9f.png Cheers.
  13. Hello all. Whenever I have tried to make a simple new dimension with even just one biome, it never ever generates. All I see is stone, and the odd patches of dirt. It seems that the biome hasn't been generated, but the world has. And when I look in F3, the biome is null. I would post the huge amount of code here, but when I tried to fix it, I kind of screwed it up and now it doesn't even work. Any help on the situation would be great. Thanks.
  14. If you make a new instance of a DamageSource, you can add a custom death message for it via the LanguageRegistry. DamageSourceSword class: In your mod file, preferably in @PreInit():
  15. It says we should replace them with @EventHandler. But you should still keep the current ones. They work, and @EventHandler seems to be bugged (crashes on startup ).
  16. I think it would be nice if there was something like how dispensers handle their dispensing, but with flower pots. So BlockFlowerPot.addFlower(BlockFlower flower) or something. It's not too much to ask for. I'm sure it would only take a few minutes to add.
  17. I tried it, but it didn't work. Thanks for still trying to help me.
  18. Thank you so much. I understand now. I had it completely wrong before. Anyway, basicly all aspects of my mod work apart from this one thing. My staff, when right click, should also summon the event, but doesn't. It says "Hidding Eggs" (which is in the event code, not the item's code), but does nothing else. [spoiler=Staff Code] package so101.eastersurprise.eggs; import java.util.List; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.world.World; import cpw.mods.fml.relauncher.*; import so101.eastersurprise.Main; import so101.eastersurprise.client.ConfigEasterSurprise; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; public class ItemEasterStaff extends Item { private Random rand = new Random(); private ConfigEasterSurprise ces = Main.ces; private RandomEasterHuntEvent rehe = new RandomEasterHuntEvent(); private int randItem; private boolean lock = false; protected int[] items; public ItemEasterStaff(int par1) { super(par1); setCreativeTab(CreativeTabs.tabMisc); setMaxStackSize(1); this.bFull3D = true; } public void onUsingItemTick(ItemStack stack, EntityPlayer player, int count) { //par1ItemStack.damageItem(rehe.getHuntProgress(), null); //for (int i=0;i<10;i++) player.worldObj.spawnParticle("smoke", player.posX-1+rand.nextInt(2)+rand.nextDouble(), player.posY-1+rand.nextDouble(), player.posZ-1+rand.nextInt(2)+rand.nextDouble(), 0.0D, 0.0D, 0.0D); if (!lock) { Main.startHunt(player); lock = true; } } /**Adds the texture from the directory stated**/ @Override public void updateIcons(IconRegister ir) { iconIndex = ir.registerIcon("EasterSurpriseMod:staff"); } public String getItemDisplayName(ItemStack is) { return "Easter Staff"; } public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { par3EntityPlayer.setItemInUse(par1ItemStack, 5); return par1ItemStack; } } [spoiler=Event Code] package so101.eastersurprise.eggs; import java.util.Random; import net.minecraft.client.Minecraft; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; import net.minecraft.src.ModLoader; import net.minecraft.world.World; import so101.eastersurprise.Main; import so101.eastersurprise.client.ConfigEasterSurprise; public class RandomEasterHuntEvent { private Random rand = new Random(); private ConfigEasterSurprise ces = Main.ces; private int radius; private int amount; int i = 0; int j = 0; private EntityItem[] item; private double[] x; private double[] z; private String message = ""; public RandomEasterHuntEvent() { radius = ces.huntRadius; amount = ces.huntAmount; item = new EntityItem[amount]; x = new double[amount]; z = new double[amount]; } public void startEasterHunt(World world, EntityPlayer player) { player.addChatMessage(message+"§7Hidding eggs..."); if (!world.isRemote) { for (i = 0; i<amount/2;i++) { int randomChange = world.rand.nextInt(50); int damageValue; if (randomChange < 3) { damageValue = 4; } else if (randomChange < 20) { damageValue = 2 + rand.nextInt(2); } else { damageValue = 0 + rand.nextInt(2); } double x = player.posX-(float)radius+(float)world.rand.nextInt(radius*2); double z = player.posZ-(float)radius+(float)world.rand.nextInt(radius*2); item[i] = new EntityItem(world, x, world.getTopSolidOrLiquidBlock((int)x, (int)z)+ rand.nextInt(16), z, new ItemStack(Main.EasterEgg, 1, damageValue)); item[i].delayBeforeCanPickup = 0; item[i].age = -24000*3; world.spawnEntityInWorld(item[i]); } for (j = 0; j<amount/2;j++) { int randomChange2 = rand.nextInt(50); int damageValue2; if (randomChange2 < 3) { damageValue2 = 4; } else if (randomChange2 < 20) { damageValue2 = 2 + rand.nextInt(2); } else { damageValue2 = 0 + rand.nextInt(2); } double x = player.posX-(float)radius+(float)rand.nextInt(radius*2); double z = player.posZ-(float)radius+(float)rand.nextInt(radius*2); item[i+j] = new EntityItem(world, x, world.getFirstUncoveredBlock((int)x, (int)z), z, new ItemStack(Main.EasterEgg, 1, damageValue2+world.rand.nextInt(1))); item[i+j].delayBeforeCanPickup = 0; item[i+j].age = -24000*3; world.spawnEntityInWorld(item[i+j]); } player.addChatMessage("§7The eggs have been hidden. Let the Easter Hunt... BEGIN!"); } } public boolean getIsHuntActive() { if (item[0] == null) { return false; } return true; } public void setHuntCancel(boolean messageUserOfCancel, EntityPlayer entityplayer) { for (int k = 0; k<amount;k++) { item[k].setDead(); } i = 0; j = 0; if (messageUserOfCancel) { entityplayer.addChatMessage("§7Current Easter Hunt canceled."); } } public void setHuntCancelIfActive(boolean messageUserOfCancel, EntityPlayer entityplayer) { if (this.getIsHuntActive()) { for (int k = 0; k<amount;k++) { item[k].setDead(); } i = 0; j = 0; if (messageUserOfCancel) { entityplayer.addChatMessage("§7Easter hunt is already active. Cancelling..."); } } } public void setHuntCancelIfActiveWithNew(boolean messageUserOfCancel, EntityPlayer entityplayer) { if (this.getIsHuntActive()) { for (int k = 0; k<amount;k++) { item[k].setDead(); } i = 0; j = 0; if (messageUserOfCancel) { entityplayer.addChatMessage("§7Easter hunt is already active. Cancelling..."); } message = "§7Starting new Easter Hunt. "; this.startEasterHunt(entityplayer.worldObj, entityplayer); message = ""; } else { this.startEasterHunt(entityplayer.worldObj, entityplayer); } } public int getHuntProgress() { return i+j; } } [spoiler=Mod Class Hunt Method] public static void startHunt(EntityPlayer entityplayer) { hunt.setHuntCancelIfActiveWithNew(true, entityplayer); } Everything else works, so thank you guys so much. I will credit you in the official thread.
  19. I don't know how to use this. When I load the data, what am I meant to be expecting from it? I can't say that I've got it working though. I tried to load the data in my onPlayerLogin method and it crashed.
  20. Thank you. All I need now is the help with the world data thing and I can release my mod. Easter has almost been and gone so I don't want it to be too late
  21. That is a typo, just not in my code. I tried to clear up my variables, sorry. As for the second thing, I'll try it. Edit: That didn't seem to do what I want. I want the item to spawn smoke while the tight mouse button is held down but run an event once released.
  22. I've also had some other small problems over the last day or so with my mod. I've been spawning in items with different damage values, but some damage values aren't spawned. It will make no sense, so here: int randomChange = rand.nextInt(50); int damageValue; if (randomChange < 3) { damageValue = 4; //rare item damage value } else if (randomChange < 20) { damageValue2 = 2 + rand.nextInt(1); //uncommon items, either damage value of 2 or 3. only difference is texture } else { damageValue2 = 0 + rand.nextInt(1); //same as above, but for common items. } EntityItem item = new EntityItem(world, x, y, z, new ItemStack(Main.CustomItem, 1, damageValue)); world.spawnEntityInWorld(item); So basicly it only spawns the items with damage values of 0, 2 and 4. I want 1 and 3 also in there. This used to work though! I don't know what has changed since it did. And second basic problem: @Override public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { //stuff here } This isn't getting called, even though it recognizes the method (it has a javadoc). Other big problem: I still can't get the WorldData thingy to work. I need help on this. A PM would be great.
  23. Thank you all for your help! I've got the player joining event sorted, just not the data thing sorted. I've registered the data class in my load method and I've tried loading it in my event class but I don't know how to access the specific variables in the data class. So how do I do this?
  24. Thank you. That's exactly what I need. However, for my event, I need the world instance. I don't know how to get it. Once you created it (note: you must only do this once per world!) you use loadItemData() to get your data back. Then modify it and use markDirty() to notify minecraft it has changed. What do you mean by "get your data back"?
  • Create New...

Important Information

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