Jump to content

hotrods20

Members
  • Posts

    197
  • Joined

  • Last visited

Everything posted by hotrods20

  1. I think you mean onBlockActivated. I don't know what it is in 1.7.2 but in 1.6.4: public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { par1World.getWorldInfo().setRaining(true); } That seems to work.
  2. Do what coolAlias says, it's faster and you don't muck around with events. If you wanted to break normal pickaxes and replace them with a broken pickaxe item, then you should use the event.
  3. A good thing to look into is events. One event that may have interest to you is, PlayerDestroyItemEvent.
  4. As one of my previous questions was answered with creating a fake EntityPlayer that my real player could use, how would I go about making/using a fake player? If you need to access a container from a long distance away, there's an event for that.
  5. In the load() of your main class, add the EntityRegistry code with your entities information.
  6. Have you tried testing in an actual client? My textures don't show up in my modding environment but show up in normal MC.
  7. In your core, when is the PlayerUtil initialized/referenced? You should declare your entities in your pre-init and then try using your PlayerUtil in post-init.
  8. Alright, I'll cache the block information. If on the TileEntity it detects this, then how come workbenches and anvils still won't let me use it? They do not have TileEntities attached.
  9. Did you try adding a @Override over the addInformation method to make sure you are using the right method?
  10. Well, you don't need the @SideOnly and have you tried a straight String? Try: list.add("This is Test");
  11. Question, what is the problem? I'm not going to dig through your code unless a problem is presented. Alright, have you tried to see if it is attempting to check for the new EntityPlayer classes before they are even declared?
  12. Can you provide your entity and gun source code along with how you are initializing your items. My first guess is you're not registering your entity. If that is the case then in your Init put: EntityRegistry.registerModEntity(MyEntity.class, "MyEntityName", 230, this, 64, 1, true); The first field is your entities class, the next is its name, the third is tracking range(the range MC will send tracking updates), an instance of your mod.class, update frequency, and just set last to true.
  13. Did all you do is copy TileEntityFurnace and just rename it? I don't think you'll accomplish much doing that. You need to reference the TileEntityFurnace code and make your own TileEntity. Blatant copy and paste won't work. You have to actually learn the code.
  14. Anyone have any ideas on how to go about this?
  15. Well yes. You can change it if you wish but it is needed if you want it to successfully chop down the entire tree. If I just broke the loop, then it would only chop one log every time. That would then cause you to barely cut down jungle trees. The code lets you start your chop from the middle of a tree if needed and then removes everything below and above it that share the blockID of wood. EDIT: Somewhat misunderstood what you said. Well, no code is perfect. If you find a way to optimize it tell me.
  16. public static void addCapes() { String capeURL = "URL_TO_CAPE.com/cape.png"; String[] owners = {"hotrods20", "OtherUsernames"}; ThreadDownloadImageData image = new ThreadDownloadImageData(capeURL, null, null); for(String username : owners) { Minecraft.getMinecraft().renderEngine.loadTexture(new ResourceLocation("cloaks/" + username), (TextureObject)image); } } Put that in your client side proxy. Don't forget to put this.addCapes(); to your load method. Sources of info: http://www.minecraftforum.net/topic/2254009-164-forge-darkhaxs-modding-tutorials-how-to-add-capes/ EDIT: Learn to Google a bit before asking.
  17. setBlockTextureName(MainClass.modid + ":GreenLampIdle"); You are setting the texture to be GreenLampIdle. You need to have the texture be based on the lamps state. Do what the redstone lamp does, .setTextureName("redstone_lamp_off") .setTextureName("redstone_lamp_on") You set the texture names when you initialize the redstone lamp variables. So, public static Block myLampOn = new BlockMyLamp(var...).setTextureName(modid + ":GreenLampIdle"); public static Block myLampOff = new BlockMyLamp(var...).setTextureName(modid + ":GreenLampActive"); Quick Edit: Remove setBlockTextureName(MainClass.modid + ":GreenLampIdle"); from your BlockLamp class.
  18. Your problem is you're turning them into the other objects which are incapable of turning into lamps. You need to declare two(2) lamps in your MainClass. IdleLamp and ActiveLamp. Change the code based on that.
  19. Taking a quick look at the redstone lamp code, check the onBlockAdded, onNeighborChange, and updateTick code. You will see it is changing it to a different lamp object. Change that to your active lamp object and everything will be all good.
  20. @Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World par2World, int par3, int x, int y, int z, EntityLivingBase par7EntityLivingBase) { super.onBlockDestroyed(par1ItemStack, par2World, par3, x, y, z, par7EntityLivingBase); if(!par7EntityLivingBase.isSneaking()) //Checks if the entity is not sneaking. You don't need if you don't want. { if(world.getBlockId(x, y, z) == Block.wood.blockID) { this.repeatChop(par2World, x, y, z); } } return true; } public void repeatChop(World world, int x, int y, int z) { for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { for(int k = -1; k <= 1; k++) { if(world.getBlockId(x + i, y + j, z + k) == Block.wood.blockID) { world.destroyBlock(x + i, y + j, z + k, true); this.repeatChop(world, x + i, y + j, z + k); } } } } } This is some personal code that I've worked on for an item in my mod that does the same thing. You can use it if you wish. I've removed bits that aren't needed for you. EDIT: Fixed some code I messed up. All is good.
  21. I've been trying to get it so I can open a GUI from anywhere. I attach my itemstack to a chest or furnace or whatever and then have it go through blockList and do the onBlockActivated action. This should in theory open the GUI or do whatever is intended for the block to do but it doesn't. The only blocks that work are ones that do not open GUIs. So levers, switches, repeaters, etc... How would I go about opening the GUI of a block from any distance away? Some code from my Item: @Override public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) { if(itemstack.getTagCompound() == null) { itemstack.setTagCompound(new NBTTagCompound()); return true; } else if(itemstack.getTagCompound().getBoolean("hasSet") == false) { itemstack.getTagCompound().setInteger("BlockX", x); itemstack.getTagCompound().setInteger("BlockY", y); itemstack.getTagCompound().setInteger("BlockZ", z); itemstack.getTagCompound().setBoolean("hasSet", true); itemstack.getTagCompound().setString("BlockName", Block.blocksList[world.getBlockId(x, y, z)].getLocalizedName()); return true; } else { if(Block.blocksList[world.getBlockId(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"))] != null) { if(world.getBlockTileEntity(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ")) != null && world.getBlockTileEntity(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ")) instanceof ISidedInventory) { ((ISidedInventory)world.getBlockTileEntity(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"))).openChest(); } if(Block.blocksList[world.getBlockId(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"))].onBlockActivated(world, itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"), player, par7, par8, par9, par10) == false) { itemstack.getTagCompound().setBoolean("hasSet", false); itemstack.getTagCompound().setInteger("BlockX", 0); itemstack.getTagCompound().setInteger("BlockY", 0); itemstack.getTagCompound().setInteger("BlockZ", 0); itemstack.getTagCompound().setString("BlockName", ""); return false; } } else itemstack.getTagCompound().setBoolean("hasSet", false); return true; } } public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player) { if(itemstack.getTagCompound() != null) { if(Block.blocksList[world.getBlockId(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"))] != null) { if(Block.blocksList[world.getBlockId(itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"))].onBlockActivated(world, itemstack.getTagCompound().getInteger("BlockX"), itemstack.getTagCompound().getInteger("BlockY"), itemstack.getTagCompound().getInteger("BlockZ"), player, 0, 0.0F, 0.0F, 0.0F) == false) { itemstack.getTagCompound().setBoolean("hasSet", false); } } else itemstack.getTagCompound().setBoolean("hasSet", false); } return itemstack; }
  22. Thank you. Makes it easier to figure this out.
  23. I have the problem of wanting to make "efficient" code. I want to set a custom variable on a new plant block. This variable would allow the custom plant to know what it will produce when it is fully grown and broken. The problem is there seems to be no way to set this on the block because there is no way to get the block object itself. Anyone know a way of setting this variable without getting the exact block from the world, with the world, or if I should just code individual crop blocks?
  24. Then make it so a different block that isn't the same as a block used in the golem is the "core."
  25. No. It means you look at the source code of the BlockPumpkin class and you go off of that to create yours. You don't need to overwrite anything. Just read the code and understand it. Then you write your own class that works in the same way.
×
×
  • Create New...

Important Information

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