Jump to content

Jacknoshima

Members
  • Posts

    142
  • Joined

  • Last visited

Everything posted by Jacknoshima

  1. Okay, so, I'm making a 2 block high block. Don't really know how to add in dummy blocks (if anyone knows how to do this or can point me in the direction of a tutorial I'd be greatful to know) so I just copied over my customer door code and was going to work through it to alter it. Wanted to test it first. In theory, it should be a regular door completely black, as that's the texture I made for it. I updated all references that I can see to point to this new block. The Item I made to place the block is told to place my custom block. Yet, when I use the Item in the game, it still places my custom door. In another world, it places a custome fence post that I made. I genuinely can't understand why it's doing this. I can't see any references at all to any other blocks and it's all registered the same way as my 5 customer doors and they all work perfectly. Can anyone help? Block Code http://pastebin.com/g2gDZcPv Item Code http://pastebin.com/uV3wf7MZ
  2. I've not actually got anything I'm adding for this yet, I just wanna know the basis for it, if it's possible or what sort of thing I'd have to do But, basically, I wanna know if there's a way to create some sort of configuration file (or any sort of file really) that you can change world by world rather than just having a single config file for the whole mod So like, when you create/load a new world, it creates the file inside the world folder, and you can change fields in there so it's that for one world but the default for all others If that makes sense... I'm pretty sure it is possible, but I'm not sure where exactly I'd look to find out...
  3. Nevermind, the issue seems to be resolved
  4. So, I've been using the public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axis, List list, Entity entity) method to make a chair and changing where the collision boxes are based on metadata to move the direction it worked fine for 2 of them (each having 1 base collision box that doesn't change and 3 that do) facing in 2 directions but I'm onto the third one and now the collision boxes aren't... well... colliding anymore I can mouse over them and they highlight, but I'm just walking straight through them so, is there a limit to how many you can add in? because the ones I can walk through are literally the same as the others that actually collide full method is
  5. Ooohh I see Thanks That does explain why it unlocked every one haha I was wondering why nothing changed when I changed the locked variable from static to non-static because I did think that might work So I shall remember that for the future
  6. Right, I'll look into using metadata on it then it does sound quite a bit easier haha thanks
  7. Okay, so, I realised what I was doing wrong with the tile entity implementation I was forgetting to put in null checks which was stupid of me however now that it's not giving null pointer exceptions it's just... not doing anything at all public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); TileEntityLockedDoor tileentitynote = (TileEntityLockedDoor)world.getTileEntity(x, y, z); if(tileentitynote != null) { tileentitynote.setLocked(true); } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if(world.isRemote) { return true; } else { TileEntityLockedDoor tileentitynote = (TileEntityLockedDoor)world.getTileEntity(x, y, z); if(player.getHeldItem() != null && player.getHeldItem().getItem() == BaseItem.smallKey) { if(tileentitynote != null && tileentitynote.getLocked() == true) { tileentitynote.setLocked(false); if(!player.capabilities.isCreativeMode) { player.inventory.consumeInventoryItem(BaseItem.smallKey); return true; } return true; } } if(tileentitynote != null && tileentitynote.getLocked() == false) { int i1 = this.func_150012_g(world, x, y, z); int j1 = i1 & 7; j1 ^= 4; if ((i1 & == 0) { world.setBlockMetadataWithNotify(x, y, z, j1, 2); world.markBlockRangeForRenderUpdate(x, y, z, x, y, z); } else { world.setBlockMetadataWithNotify(x, y - 1, z, j1, 2); world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z); } world.playAuxSFXAtEntity(player, 1003, x, y, z, 0); return true; } else return false; } } is what I've got so far with the tile entity stuff
  8. Okay, so, I'm not entirely sure how best to describe this. I'm making a custom door that's locked and becomes unlocked when a key is used on it. That much I've done no problem, but when I unlock one door, it unlocks every door. I used a boolean (locked) and when the block is activated with a key it sets the boolean to false. When the block is added to the world, it sets it true. However, whenever I use a key on one door, every door becomes unlocked. When I add a new locked door, every door in the world becomes locked. here is my code public boolean locked; public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) { super.onBlockAdded(p_149726_1_, p_149726_2_, p_149726_3_, p_149726_4_); locked = true; } /** * Called upon block activation (right click on the block.) */ public boolean onBlockActivated(World world, int p_149727_2_, int p_149727_3_, int p_149727_4_, EntityPlayer player, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { if(world.isRemote) { return true; } else { if(player.getHeldItem() != null && player.getHeldItem().getItem() == BaseItem.smallKey) { locked = false; if(!player.capabilities.isCreativeMode) { player.inventory.consumeInventoryItem(BaseItem.smallKey); } } if(!locked) { int i1 = this.func_150012_g(world, p_149727_2_, p_149727_3_, p_149727_4_); int j1 = i1 & 7; j1 ^= 4; if ((i1 & == 0) { world.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_, p_149727_4_, j1, 2); world.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_); } else { world.setBlockMetadataWithNotify(p_149727_2_, p_149727_3_ - 1, p_149727_4_, j1, 2); world.markBlockRangeForRenderUpdate(p_149727_2_, p_149727_3_ - 1, p_149727_4_, p_149727_2_, p_149727_3_, p_149727_4_); } world.playAuxSFXAtEntity(player, 1003, p_149727_2_, p_149727_3_, p_149727_4_, 0); return true; } else return false; } } I tried making a tile entity and doing it through that, but whenever I did anything to do with the tile entity it threw back a null pointer exception. I'm not very good with tile entities, so I'm not really surprised, but if I do need to use a tile entity I'd love some pointers on how exactly to go about using it. This was the Tile Entity I tried to make package com.noshmod.block.tileentity; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; public class TileEntityLockedDoor extends TileEntity { public boolean locked; public TileEntityLockedDoor() { } public void writeToNBT(NBTTagCompound p_145841_1_) { super.writeToNBT(p_145841_1_); p_145841_1_.setBoolean("locked", this.locked);; } public void readFromNBT(NBTTagCompound p_145839_1_) { super.readFromNBT(p_145839_1_); this.locked = p_145839_1_.getBoolean("note"); } public void setLocked(boolean par1) { par1 = this.locked; } public boolean getLocked() { return this.locked; } } obviously the door code above hasn't got this implemented but it was basically just replacing the boolean "locked" in the door with the get and set methods in the tile entity and the tile entity is definitely registered correctly So... can anyone tell me what exactly is going wrong? I get a feeling it's something really simple... I just can't see it
  9. Ahh okay So it was just that I was using an older version then Awesome Thanks
  10. Use StatCollector.translateToLocal("triforce.tooltip.strangeEnergy")).trim(); so it would be par3List.add(StatCollector.translateToLocal("triforce.tooltip.strangeEnergy")).trim(); that's how they translate display names from unlocalised to localised (the name in the lang file) and I've used it in addInformation myself in some of my items
  11. You don't call items like that. GameRegistry.addRecipe(new ItemStack(dyeblock1, 1), new Object[] {" ","BB ","BB ", 'B', new ItemStack(Items.dye, 1, 15)}); Would be how you do it. From what I know, the Item class is what contains all the methods that you'll use and it initialises the items, but the Items class is where you call the items from when using the item objects in code. When you need metadata for something you use an ItemStack call it using "new ItemStack(Block/Item, amount, metadata)" so yours would be new ItemStack(Items.dye, 1, 15) where Items.dye is the dye item 1 is the amount (which is irrelevant really, because it sorta defaults to 1 and nothing higher really works as far as I know) and 15 would be the metadata
  12. *shrugs* it's how it's done in the TileEntityEnderChestRenderer and the texture is working fine I'm not great at renders, but it seems to be working Apart from the aforementioned error of course
  13. I'm on 1047 apparently... I probably should update anyway though. So is this/was just a bug in Forge? Or is it something in my code.
  14. I keep getting this error. It prints to my console continuously until I stop the game. It doesn't crash anything and everything is rendered properly, and it only seems to happen at random. Like, I can load the game fine, be around my custom blocks, with no error. I mention my custom blocks because it only started happening after I made them. the full error thing is literally just [18:29:07] [Client thread/ERROR]: ########## GL ERROR ########## [18:29:07] [Client thread/ERROR]: @ Post render [18:29:07] [Client thread/ERROR]: 1286: Invalid framebuffer operation here's my block render file package com.noshzeldamod.block.render; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.noshzeldamod.block.model.ModelZeldaPot; import com.noshzeldamod.block.tileentity.TileEntityZeldaPot; import com.noshzeldamod.lib.Strings; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderZeldaPot extends TileEntitySpecialRenderer { private static final ResourceLocation field_147520_b = new ResourceLocation(Strings.modid + ":textures/blocks/zeldaPot.png"); private ModelZeldaPot field_147521_c = new ModelZeldaPot(); public void renderTileEntityAt(TileEntityZeldaPot p_147519_1_, double p_147519_2_, double p_147519_4_, double p_147519_6_, float p_147519_8_) { this.bindTexture(field_147520_b); GL11.glPushMatrix(); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glTranslatef((float)p_147519_2_, (float)p_147519_4_ + 1.0F, (float)p_147519_6_ + 1.0F); GL11.glScalef(1.0F, -1.0F, -1.0F); GL11.glTranslatef(0.5F, -0.5F, 0.5F); this.field_147521_c.render(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); } public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, float p_147500_8_) { this.renderTileEntityAt((TileEntityZeldaPot)p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); } } I mean, I'm not THAT bothered, because, apart from maybe slowing it down a bit, it's causing no real problems, but for the sake of it being done properly, I would like to know what's causing or what I did wrong. Or if it's not something I did and it's because of something else.
  15. I can't be sure what's wrong but I believe "public static Item Plasma_Rifle;" should be "public static Item plasma_Rifle;" field names need to be lower case to start (unless I'm wrong) your ItemInfo fields are also upper case to start, which could be causing the error
  16. Ya know those things where the answer is just glaringly obvious but for some reason it just escapes your attention completely, then you see it and you just feel monumentally stupid? Yeah, this was that. Thanks haha
  17. Okay, I know full well that this is an incredibly nooby and stupid question, but it's just one of those things I've never really properly known how to implement which is the Random.nextInt(int) my code is int i = par1.rand.nextInt(3); if(i == 1); { ItemStack drop1 = new ItemStack(BaseItem.rupee); EntityItem item = new EntityItem(par1, (double)x, (double)y, (double)z, drop1); par1.spawnEntityInWorld(item); } my intention is that "i" generates a random number between 0 and 3 (which, I believe, is what Random.nextInt(int) does) and when that "i" equals 1, the Rupee is spawned my problem is that it's spawning the rupee every time, not 1 in 3 can someone quickly just explain exactly how Random.nextInt(int) is meant to be used in this context?
  18. Doesn't matter now I fixed it I reformatted it so it wasn't a series of individual if's but a series linked together and then used an else if(this.getZuboraType() == 1) { if((itemstack != itemstack2) || (itemstack != itemstack3)) { if(par1EntityPlayer.inventory.hasItem(BaseWeapon.kokiriSword)) { Strings.addChatMessage("Zubora: I see you've got a Kokiri Sword there"); Strings.addChatMessage("Zubora: If you pay me 64 rupees, I can forge it for you."); } else { Strings.addChatMessage("Zubora: If you bring me a Kokiri Sword and 64 rupees,"); Strings.addChatMessage("Zubora: I can reforge your sword for you."); } } } like so I don't know exactly why it wasn't working properly, but I've got a work-around for it now at least
  19. Well, the first one is marked as outdated, so I'd ignore that. It looks to be 1.6 or 1.5, but could be earlier. Second one is 1.4 so DEFINITELY ignore that Third one looks right to me Fourth... couldn't really be bothered looking through that one all that much tbh, but it seemed more focused on other things and wasn't exactly a tutorial
  20. It's just if it's in the inventory And ahh right, I'll make sure to format it like that in future then haha
  21. Okay, so, I'm trying to set up something that uses hasItem or hasItemStack in an if statement, but my if statement seems to be ignoring that bit my code is ItemStack itemstack4 = new ItemStack(BaseWeapon.kokiriSword); if(this.getZuboraType() == 1 && itemstack != itemstack2 && !par1EntityPlayer.inventory.hasItemStack(itemstack4)) { Strings.addChatMessage("Zubora: If you bring me a Kokiri Sword and 64 rupees,"); Strings.addChatMessage("Zubora: I can reforge your sword for you."); } if(this.getZuboraType() == 1 && itemstack != itemstack2 && par1EntityPlayer.inventory.hasItemStack(itemstack4)); { Strings.addChatMessage("Zubora: I see you've got a Kokiri Sword there"); Strings.addChatMessage("Zubora: If you pay me 64 rupees, I can forge it for you."); } And it's being put in the Interact method of an entity When I click the entity, it displays the text from both if statements I've tried with par1EntityPlayer.inventory.hasItem(BaseWeapon.kokiriSword) And it's the same result Is there something I'm missing here? Am I supposed to use a different method? (I've also tried using == true and == false, but, from my understanding of booleans, the code should be sound as it is in the bit posted)
  22. Tried that but I can't seem to get it to work... I'll just have to work on it over time. Thanks though
  23. Okay, so, I'm trying to use the consumeInventoryItem method (or something like it), but I wanna use it with an item that has subtypes (like dye) how would I go about doing that? consumeInventoryItem only uses the Item, so it consumes ones from other subtypes I can't find any method that does the same thing but using metadata or itemstacks clearInventory destroys the whole stack, I just wanna reduce it by one I tried just using ItemStack.stacksize-- but that doesn't work when you're using one item to reduce the size of another item (like a bow reducing arrows) if all of that makes any sense at all, can anyone point me in the direction of something that will do this... if there is anything that can do this?
×
×
  • Create New...

Important Information

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