
skullywag
Members-
Posts
102 -
Joined
-
Last visited
Everything posted by skullywag
-
ok after some more debugging and backtracing ive discovered that one of my blocks is actually in the world (I have no idea why, i didnt put it there), doing this: public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) { System.out.println("META -" + par1IBlockAccess.getBlockMetadata(par2, par3, par4)); System.out.println("pos - " + par2 + "," + par3 + "," + par4); return this.getIcon(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4)); } results in 2014-01-21 01:27:46 [iNFO] [sTDOUT] META -15 2014-01-21 01:27:46 [iNFO] [sTDOUT] pos - -194,69,240 (I also printed out the blockID in another test and it is my custom blockID) which I take to mean one of my custom blocks has entered the world somehow, now as they are mob spawners im guessing theres a mob spawner at those coords, however my block/TE doesnt even mention blockMobSpawner or its tileentity and it shouldnt be referencing mine so how on earth did it get there, this is gonna end up being such a silly error by me I know it.
-
test world will not start after adding block
skullywag replied to chasingfire_hpps's topic in Modder Support
so if theres nothing in those logs were gonna need to see some code. Paste your mods main class and block classes and anything else you have. -
test world will not start after adding block
skullywag replied to chasingfire_hpps's topic in Modder Support
Check in your forge modloader log and also double check theres no crash log, they can be found at: mcp\jars and mcp\jars\crash-reports -
umm what version of MC are you running? im on 1.6.4 and my packages go under src/ none of that java com stuff.
-
Ok I will, im guessing by your statement you think the icons = new Icon[13]; should be icons = new Icon[15]; youd be wrong. Ive learned that this icon array needs to be the same number as you have of metadata block. Changing it to 15 causes the reverse error: arrayindexoutofbounds 13. Doing this also crashes the client mode. As stated this ONLY crashed on the server its fine on just the client as is.
-
Hey all, Not sure what wrong here but im getting a crash when trying to join the server I start from eclipse with my mod loaded. The crash: java.lang.ArrayIndexOutOfBoundsException: 15 at spawnCrystals.BlockCustomSpawner.getIcon(BlockCustomSpawner.java:47) now that method is literally 1 line, ill add the relevant parts from my block class below: private Icon[] icons; public void registerIcons(IconRegister par1IconRegister) { icons = new Icon[13]; for(int i = 0; i < icons.length; i++) { icons[i] = par1IconRegister.registerIcon(spawnCrystals.modid + ":" + (this.getUnlocalizedName().substring(5)) + i); } } public Icon getIcon(int par1, int par2) { return icons[par2]; } anyone have any idea why this crashes on the getIcon method? Ive also made sure there are 13 metadata blocks in this block ID all numbered correctly when registered in my main class. edit - hmm par2 does seem to be 15 for some reason on loading into the world....how strange...but only on a server???
-
[1.6.4]Disabling particles in updateSpawner() based on outside info
skullywag replied to skullywag's topic in Modder Support
ok so it turns out that doing the below when it gets a redstone signal: TileEntityCustomSpawner spawner = (TileEntityCustomSpawner)world.getBlockTileEntity(x, y, z); spawner.getSpawnerLogic().spawnDelay = -1; then, putting this in the canRun of the spawner logic class: if(this.spawnDelay == -1) { return false; } makes everything work perfectly, I just set the spawn delay back to 20 when the redstone signal goes off. Now to test how it holds up on a server, I have a feeling it might not work so well... -
Where is this mod file located, is it in its own package?
-
This is just a guess from my limited time spent modding but I would say that most of this would be handled in entity player not the bed itself, go have a hunt around that area.
-
[1.6.4]Disabling particles in updateSpawner() based on outside info
skullywag replied to skullywag's topic in Modder Support
ok, so i think my problem is down to desynch between server and client (ive done some digging and a lot of people hit this snag when first playing with tile entities it seems). Just so im sure this is the case I placed a print statement inside the updateSpawner method and printed the spawnDelay. This is the printout from my mobspawner: 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 20 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 20 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 19 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 19 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 20 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 18 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 19 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 17 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 16 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 18 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 15 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 17 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 14 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 16 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 13 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 15 2014-01-20 21:29:27 [iNFO] [sTDOUT] Delay 12 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 11 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 14 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 10 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 13 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 9 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 12 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 8 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 11 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 7 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 6 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 10 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 5 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 9 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 4 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 8 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 3 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 7 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 2 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 1 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 6 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 5 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 465 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 4 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 464 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 3 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 463 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 462 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 2 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 461 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 1 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 460 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 459 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:29:28 [iNFO] [sTDOUT] Delay 458 now I guessed one of those is client and 1 is server. So I put the print inside the "if (this.getSpawnerWorld().isRemote)", the result was this: 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 20 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 19 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 20 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 19 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 18 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 17 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 16 2014-01-20 21:31:44 [iNFO] [sTDOUT] Delay 15 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 14 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 13 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 12 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 11 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 10 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 9 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 8 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 7 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 6 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 5 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 4 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 3 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 2 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 1 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:45 [iNFO] [sTDOUT] Delay 0 2014-01-20 21:31:46 [iNFO] [sTDOUT] Delay 0 and it stayed at 0 even though the mobspawner was still spawning. Now I have: public Packet getDescriptionPacket() { NBTTagCompound nbttagcompound = new NBTTagCompound(); this.writeToNBT(nbttagcompound); return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, nbttagcompound); } public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt) { NBTTagCompound tag = pkt.data; readFromNBT(tag); } in my Tile Entity class and I believe they are structured correctly, is there a piece to this puzzle im missing? or something im not understanding (probably the case). -
throw your code in here, im sure someone will spot the problem.
-
Hey all, this seems simple enough but ive tried multiple ways to no avail. In a mob spawners base logic class in the updateSpawner() method there are some particles that are always running: public void updateSpawner() { if (this.canRun()) { double d0; if (this.getSpawnerWorld().isRemote) { double d1 = (double)((float)this.getSpawnerX() + this.getSpawnerWorld().rand.nextFloat()); double d2 = (double)((float)this.getSpawnerY() + this.getSpawnerWorld().rand.nextFloat()); d0 = (double)((float)this.getSpawnerZ() + this.getSpawnerWorld().rand.nextFloat()); this.getSpawnerWorld().spawnParticle("smoke", d1, d2, d0, 0.0D, 0.0D, 0.0D); this.getSpawnerWorld().spawnParticle("flame", d1, d2, d0, 0.0D, 0.0D, 0.0D); Ive managed to get spawning to stop on redstone signal but the particles still continue. I want them to stop as well. So far I have: public void onNeighborBlockChange(World world, int par2, int par3, int par4, int par5) { TileEntityCustomSpawner te = (TileEntityCustomSpawner)world.getBlockTileEntity(par2, par3, par4); if (world.isBlockIndirectlyGettingPowered(par2, par3, par4)) { te.signal = true; } else { te.signal = false; } } in my Block class and my TE class has this: public void updateEntity() { if(this.signal == false) { this.field_98050_a.updateSpawner(); super.updateEntity(); } } As stated this stops spawning but particles still continue, can someone explain how this is the case and what I can do to stop it, ive got code blindness from staring at this problem for hours. Thanks.
-
[1.6.4]Forge Block Event Handler and Tile entities
skullywag replied to skullywag's topic in Modder Support
I went about it another way, i was piggybacking the normal mob spawner block so didnt have metadata available, as thats available in the event i added my custom block extending BlockMobSpawner so I could assign meta based on mob type, then I can just use: @ForgeSubscribe public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) { if (event.block.equals(mymod.mycustomspawnblock)) { ItemStack spawnerDrop = new ItemStack(mymod.myitem, 1, event.blockMetadata); event.drops.add(spawnerDrop); event.dropChance = 1.0F; } } -
[1.6.4]Forge Block Event Handler and Tile entities
skullywag replied to skullywag's topic in Modder Support
Darn, ok gonna have to rethink this, can anyone think of another way of detecting the type of a mob spawner and changing drops accordingly? -
[1.7.2] Item name displaying wrong - no texture
skullywag replied to mission712's topic in Modder Support
When you start your client from within eclipse, the console will tell you where its trying to find your textures, just use that to adjust as necessary. -
Hey all, Im trying to grab info about a tile entity using forges event handler: @ForgeSubscribe public void onBlockHarvest(BlockEvent.HarvestDropsEvent event) { if (event.block.equals(Block.mobSpawner)) { TileEntity te = event.world.getBlockTileEntity(event.x, event.y, event.z); String eName = null; if(te != null) { System.out.println("wooooooooo"); eName = ((TileEntityMobSpawner) te).getSpawnerLogic().getEntityNameToSpawn(); } System.out.println(eName); ItemStack spawnerDrop = new ItemStack(mymod.myitem, 1, 1); event.drops.add(spawnerDrop); event.dropChance = 1.0F; } } If i remove the IF statement and just add a drop it works, but I want a different drop per mob spawner type. im a little confused as to why the tile entity is null, I never get inside the IF. Any clues or a better way of achieving the same result.
-
Im back again. Im creating some custom slabs and have them doing all the jazzy connecting to make double slabs, dropping the single slabs when the double slab is broken and stuff I seem to be hitting the same issue that a lot of people have hit in regards to registering half slabs into the language registry (based on my looking around) but no one seems to have the answer. The normal way of: LanguageRegistry.addName(new ItemStack(CustomSingleSlabBlock, 1, 0), "Oak Slab(custom)"); LanguageRegistry.addName(new ItemStack(CustomSingleSlabBlock, 1, 1), "Spruce Slab(custom)"); doesnt work. I did find some references to using: LanguageRegistry.instance().addStringLocalization(); but i cant make metadata blocks work in this. I always get tile.blah blah.name ingame, its getting this from getFullSlabName in the blocks class, so my question is what is the correct way of registering a metadata halfslab into the language registry. LOL never mind just figured it out: LanguageRegistry.instance().addStringLocalization((myMod.CustomSingleSlabBlock).getFullSlabName(0)+".name", "My Custom Slab"); LanguageRegistry.instance().addStringLocalization((myMod.CustomSingleSlabBlock).getFullSlabName(1)+".name", "My Other Custom Slab");
-
getBlockTextureFromSide and metadata question
skullywag replied to skullywag's topic in Modder Support
God dammit, I know this and I always trip up on it.....thank you. -
getBlockTextureFromSide and metadata question
skullywag replied to skullywag's topic in Modder Support
ok that makes sense and I can see how that would work, however this: public Icon getIcon(int par1, int par2) { if(this.getUnlocalizedName().substring(5) == "SpruceFenceGate") { return Block.planks.getIcon(par1,par2); } else { System.out.println(this.getUnlocalizedName().substring(5)); return Block.planks.getBlockTextureFromSide(par1); } } always returns in the "else" and i can see from the debug in there that "SpruceFenceGate" is the unlocalized name, any clues as to why the IF statement is failing, it wasnt working before as I forgot the "tile." thing with unlocalized names. -
getBlockTextureFromSide and metadata question
skullywag replied to skullywag's topic in Modder Support
but as im already in getIcon doing this, thats gonna loop forever...Im a little lost here. Ive managed to do everything else I wanted including metadata blocks with multisided textures..thats easy compared to this it seems. I just need a way of grabbing an icon based on a blockID and metadata passed. I can see there used to be a "getBlockTextureFromSideAndMetadata" does this not exist anymore or was it renamed to one of the ones im using...im guessing getIcon... -
getBlockTextureFromSide and metadata question
skullywag replied to skullywag's topic in Modder Support
But doing that gives me: The method getBlockTextureFromSide(int) in the type Block is not applicable for the arguments (int, int) -
getBlockTextureFromSide and metadata question
skullywag replied to skullywag's topic in Modder Support
par2 is on getIcon, I need to specify in the line ive marked that I want the spruce texture. This is a BlockCustomFenceGate.class that is shared by a metadata block, I want to say if this is the spruce fencegate use the spruce planks texture, birch fencegate use the birch planks etc.. The second part of my OP pertains to the above is this the right way to achieve this outcome? -
Hi all, How does one specify the metadata in a method such as: public Icon getIcon(int par1, int par2) { if(this.getUnlocalizedName() == "SpruceFenceGate") { return Block.planks.getBlockTextureFromSide(par1); <-----I want spruce planks texture here } else { return Block.planks.getBlockTextureFromSide(par1); } } and also is this the best way of doing such a thing? baring in mind that I have more "ifs" to add to this block. I could case switch it but still is looping here the right way?
-
Huh turns out it was the world I was in, works fine in another one, must of screwed up an ID or something while testing...Ah well. Thanks again. Now to figure out how to texture fencegates as they dont take the same args as fences do...
-
Thats made the code neater and a lot easier to read so thanks for that, it hasnt however solved my problem, recipe still doesnt work ingame. Cant understand how it can work shaped but not shapeless... edit - does the same for fencegates as well...It has to be something to do with registering blocks as already existing types.