
Frepo
Members-
Posts
41 -
Joined
-
Last visited
Everything posted by Frepo
-
Say I make a core mod using ASM and want to run it on a SMP server, are there any requirements for the other players that wants to join the server? Any sort of plugin or library that they need to install before joining?
-
Yeah I've read some about it, the code injection part really caught my attention. I'm considering learning it since it seems to offer some really neat soultions to many of my problems. Hell I've even considered skipping API's like Forge altogether and learn how to purely do coremodding. But then again, I think it would be too time consuming working with obfuscated code, having no help in getting my code into minecraft and so on. There's simply not enough time when you're working 5 days a week. Anyway, haha slipping off topic here I'm gonna look into this! Thanks for the tip bro!
-
Oh hi GotoLink! Haha this is the second time I have you pointing your finger at me ... last time being (if recall) on a similar topic but in 1.6 involving the furnace I believe. Sure, events are great! Whenever I can I use them of course. But surely you understand that they do not cover all of ones needs. If we encounter a situation where there is no hook to save us, we'll simply have to find alternate ways. Not recommended to replace blocks? I was hoping my "second thoughts" earlier would hint that I'm aware of that. I'm not gonna try to have my mod in any FTB packs or anything, it's going all solo! Don't you worry about that. Now, whats recommended or not is not helping me here. Come on guys, let's work together here! Time to replace them blocks! (in complete awareness of what is recommended or not for YOUR mod of course)
-
Indeed I could. Only problem being that I want to replace dirt. I'm afraid there simply is no workaround here. Replacing vanilla blocks is something I MUST be able to do to have my mod become what I want it to be. There is sooooo much you can do with the ability to replace blocks. I see questions like i.e. "how do I add particles to this block?", "how do I remove gravity from that block?", "how do I make cacti do more damage?"... the answer to sooo much is replace the block (or item) with your custom block/item, copy paste or extend the vanilla block/item and have it do whatever you please! make a rose squeal like a pig for all I care!
-
On second thoughts, I guess I understand that there is no hook for this. Replacing a vanilla block is (in a sense) a coremod, and conflicts with the basic principles of Forge. So the jury may ignore my last statement.
-
I'm very surprised that there are no solutions, or hooks, or whatever.. not even discussions on the topic (none that I can find anyway). So here we go.. Has anyone found a way to replace vanilla blocks? As most of us know by now that the block registry system has changed dramatically. In 1.6.x you just wrote Block.blocksList[id] = null; myBlock = new MyBlockClass(666); Block.blocksList[id] = myBlock; and the vanilla block had magically changed to myBlock! Now we have the Block.blockRegistry to play around with, but its no fun playmate! I've been tinkering with putObject and addObject (in an attempt to overwrite the block listed at the specific index)... sadly with no success. Shouldn't there be a hook in the SimpleRegistry class "overwriteObject(int, object)" or something, that simply replaces the object at specified index with the object passed in)? There must be many many modders out there who (like me) don't just want to add new stuff. I mean why bother with i.e. new food stuff, isn't it easy enough already to stay well fed in minecraft? That my friends is some FOOD for thoughts! errm.. (pardon my low sense of humor). Anyway....is there a way?
-
Thanks for the clarification Ghost. I got the particles to spawn as long as the heat is > 0. And render a fire animation inside the campfire as long as something is burning. But now the currentItemBurnTime is out of sync The actual time each item is burning seems to be fine... it's just the progressbar is behaving strange. AND, I get not fire animation when I first start cooking something, I must close the GUI and open it again to get the fire to render. My oh my... this is so frustrating! BlockCampfire TileEntityCampfire TileEntityCampfireRenderer
-
Haha these charts make me even more confused Updating variables in TileEntities (such as cookTim, burnTime etc) should be done server-side right? Another thing, what happens in all functions that don't have a .isRemote statement? Is that code executed on both server and client?
-
Thanks for the tip! I'll do some research with that in mind. Are you familiar with the isRemote-check? I know what it does, and why it is used. I'm just not sure where to place it. Have I misplaced it in updateEntity? I've tried to place it in several locations, ending up with different results. Heat and cook timers start bugging out, the progress bars stops and stuff like that.
-
Yeah, you'll have to take care of the errors one at a time. this.blockAccess, remove "this." and only have blockAccess (the 1st in-parameter of renderWorldBlock should be a blockAccess). You will also have to change the name of the in-parameters x,y, and z. x = par2, y = par3, z = par4. Also change block to par1Block. You must match the in-parameters so they correspond to the names used in the code you copied from renderBlockStem. The very fist line BlockStem blockstem = (BlockStem)par1Block; needs to be your customBlock. renderMaxY i guess you don't have either. Perhaps you'll have to write a little method in your customBlockStem class that returns the bounding box's maxY-value. and replace renderMaxY with something like blockStem.getBoundingBoxY(). In your ClientProxy, declare myRenderID and add the following lines in the registerRenderers() method: myRenderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(myRenderID , new MyRenderer());
-
When you place the block in the world, slot 6 is empty. So this.electrolysisItemStacks[6].getItem() is NULL. Make a check that there is an actual item in the slot before trying to compare it with anything. if(this.electrolysisItemStacks[6].getItem() != null && this.electrolysisItemStacks[6].getItem() == Elementum.upgradeSpeed){ finishTime = 1200 /(this.electrolysisItemStacks[6].stackSize + 1); } else { finishTime = 1200; }
-
So I have my BlockCampfire, together with it's TileEntityCampfire. Which is basically a furnace. But I have added a new heat parameter to the tileentity. As the vanilla furnace does, my campfire switches between campfireIdle and campfireBurning depending if there is fuel burning inside, with the exception that the campire should remain in the burning state as long as there is any heat left (so it emits light during dark creepy nights). And that works fine. Now I only want it to generate the flame & smoke particles when something (fuel) is burning (furnaceBurnTime > 0). Here is where my problem emerges. As soon as the burn time is up (the coal lump is used up) it stops spawning the flame particles, EVEN if I have more coal that keeps the campfire going. If I right-click and opens up the GUI it starts spawning again, only to stop again when the burn time is up. The campfire works perfectly (burn, heat, and cook timers, as well as the counters). It's just the damn particles that stops spawning when the currently burning fuel source is consumed. It must be something with the server and the client that goes out of synch or something In BlockCampfire I have moved the spawn particles code to the TileEntityCampfire... (for some reason that I can't remember) @SideOnly(Side.CLIENT) public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random) { TileEntityCampfire tileentity = (TileEntityCampfire)par1World.getBlockTileEntity(par2, par3, par4); if (tileentity != null && tileentity instanceof TileEntityCampfire) { tileentity.validate(); tileentity.generateCampfireFlames(par1World, par2, par3, par4, par5Random); } } Here are the relevant methods from the TileEntityCampfire class public boolean isBurning() { return this.furnaceBurnTime > 0; } @SideOnly(Side.CLIENT) /** Generate flame animation while fuel is still burning */ public void generateCampfireFlames(World par1World, int par2, int par3, int par4, Random par5Random) { if (this.isBurning()) { float f = (float)par2 + 0.5F; float f1 = (float)par3 + 0.0F + par5Random.nextFloat() * 4.0F / 16.0F; float f2 = (float)par4 + 0.5F; float f3 = par5Random.nextFloat() * 0.6F - 0.3F; float f4 = par5Random.nextFloat() * 0.6F - 0.3F; par1World.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); par1World.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } } /** * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count * ticks and creates a new spawn inside its implementation. */ public void updateEntity() { boolean flag1 = false; boolean flag2 = this.currentHeat > 0; if (this.furnaceBurnTime > 0){ --this.furnaceBurnTime; if(this.currentHeat > this.maxFuelHeat) this.decreaseHeat(); else this.increaseHeat(); } else{ this.decreaseHeat(); } if (!this.worldObj.isRemote) { // *** isRemote bracket if (this.furnaceBurnTime == 0 && this.canSmelt()) { this.maxFuelHeat = getMaxFuelHeat(this.furnaceItemStacks[1]); this.currentItemBurnTime = this.furnaceBurnTime = getItemBurnTime(this.furnaceItemStacks[1]); if (this.furnaceBurnTime > 0) { flag1 = true; if (this.furnaceItemStacks[1] != null) { --this.furnaceItemStacks[1].stackSize; if (this.furnaceItemStacks[1].stackSize == 0) { this.furnaceItemStacks[1] = this.furnaceItemStacks[1].getItem().getContainerItemStack(furnaceItemStacks[1]); } } } } if (this.canSmelt() && this.currentHeat >= this.getHeatNeeded()) //this.isBurning() && { ++this.furnaceCookTime; if (this.furnaceCookTime == this.cookSpeed) { this.furnaceCookTime = 0; this.smeltItem(); flag1 = true; } } else { this.furnaceCookTime = 0; } if (flag2 != this.currentHeat > 0) { flag1 = true; BlockCampfire.updateFurnaceBlockState(this.currentHeat > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } // *** isRemote ending bracket if (flag1) { this.onInventoryChanged(); } } why WHY WHYYYYY does the particles stop spawning!? /Thanks in advance for any help
-
Yeah hehe it's kinda good to have at least a basic understanding of the proxies. Check this out for some explanation and writing the basic shell code: http://www.minecraftforge.net/wiki/Proxies This one is good as well for setting up your proxies: http://www.minecraftforum.net/topic/1891086-162-minecraft-forge-modding-3-reference-and-proxy-files/ And in your ClientProxy class you add the following method: @Override public void registerRenderers() { } Here is where you put the stuff i mentioned earlier. Well, the declaration of your custom renderTypeID don't need to be inside this method, put it above (as public).
-
1. Create a class MyRenderer which implements ISimpleBlockRenderingHandler. Add the auto-generated methods needed for this class. Copy and paste the rendering code from RenderBlocks (renderBlockStem) to the renderWorldBlock() method in MyRenderer. You might also want to copy renderBlockStemSmall and renderBlockStemBig to MyRenderer to get it to work (not sure). You'll get errors when pasting the code, e.g. "this." is the renderer parameter passed into renderWorldBlock(), so be sure to replace all (and anything else that does not match). 2. Assign it a myRenderID (your custom render ID) and link it to MyRenderer. In your ClientProxy, declare myRenderID and add the following lines in the registerRenderers() method: myRenderID = RenderingRegistry.getNextAvailableRenderId(); RenderingRegistry.registerBlockHandler(myRenderID , new MyRenderer()); 3. Ensure your myBlock.getRenderType() returns myRenderID. Hope I did'nt miss anything... but thats about it, I think
-
Ok. Thank you for your help! I'll figure this out somehow.
-
Ok, now it shows just fine. It was the UV-coords that were messed up. But now I get the hang of it! Now I'm clueless of how to get the fire to animate. You said something that it was taken care of already? EXPLAIN YOURSELF! please
-
Haha since nothing is rendered I guess I DON'T understand the UV-coords! Seemed simple enough, as you said 0,0 being one corner and 1,1 being the opposite. But it feels like I've missed out on something with the texture. Perhaps I can't use a resource location like this. Maybe I need to bind it somehow to the tessellator. But there is nothing like tessellator.bindTexture("texture") or anything like that.
-
Yeah I was thinking exacly the same on using 2 quads in a X-shape. So far I've researched my way to add the vertexes and understand the UV-coords. But how do I "grab" the texture? This is as far as I've come. Just testing to se if I can render 1 frame of the fire private static final ResourceLocation texFireFlame = new ResourceLocation("fc_images:textures/blocks/fire_0.png"); .... Tessellator tessellator = Tessellator.instance; this.func_110628_a(texCampfire); GL11.glPushMatrix(); tessellator.startDrawingQuads(); tessellator.addVertexWithUV((double)x+0.3D, (double)y , (double)z+0.3F, 0, 0); tessellator.addVertexWithUV((double)x+0.7D, (double)y , (double)z+0.7F, 1D/16D, 1D/16D); tessellator.addVertexWithUV((double)x+0.3D, (double)y+0.6D, (double)z+0.3F, 0, 0); tessellator.addVertexWithUV((double)x+0.7D, (double)y+0.6D, (double)z+0.7F, 1D/16D, 1D/16D); tessellator.draw(); GL11.glPopMatrix(); It doesn't crash. But nothing is rendered.
-
This looks great! How do I implement this now? Is it ok to just copy and paste all the green code? (and remove the red code I guess) Will this work when I reobuscate and export the code? Will it work on a server? As you might have guessed, I'm not so familiar with this ForgeHookFactory. Can I make additions like this in there?
-
Ah thanks! Sounds like a smart thing to do. Only problem being I'm not so hot as writing the openGL code, and the fire being animated doesn't make things easier. So I have to choose either to try to copy and implement the code from BlockFire, or learn how to animate stuff in openGL. Initially it just sounds easier to figure out how to get it to render a fire block inside the campfire. But your suggestion sounds much more... well.. professional. So now I want to try that out instead. So the fire texture is 16x512 pixels = 32 frames. And it has 2 layers. 1. How do I define the box? 2. How do I set the UV-coords for each frame? 3. How do set a framerate? 4. Where is the actual openGL code for BlockFire. I don't understand the tessellator in renderBlockFire. It seems to be setting the coordinates for rendering the fire animation. But where is the G11.blablabla code?
-
The renderType for BlockStem is 19. Notable for the pumpkin and melon stalks is that the bounding box is set based on how much of the stalk that is rendered. As the plant grows, for each "stage" more of the stem is rendered. So there is only 1 frame in the melon_stem_disconnected.png, where the wheat, potatoes, and carrots have several frames (one for each stage the plant has grown). If you look in BlockCrops, you'll see that GetRenderType returns 6. This is how wheat is rendered (as 4 copies of the texture in a #-form). Potatoes and carrots extends BlockCrops, so they render the same way (since they don't have their own GetRenderType method). Return 1 if you want your plant to render as e.g. TallGrass and Flowers.
-
Hi ya all! So I've made myself a custom block called "Campfire". Which is basically a small ring of stones (model made in Techne). I'm rendering it with my TileEntityCampfireRenderer class that extends TileEntitySpecialRenderer. And it works fine. Now I want to add fire when something is cooking in it. I was thinking of rendering a smaller BlockFire inside the stone ring. Does anyone have a suggestion on how to approach this? I would like to copy the code from renderBlockFire (in the RenderBlocks class)... but is uses a RenderBlocks instance that I don't have in my render function. Seems like I have to implement ISimpleBlockRenderingHandler to get it, but then I don't know how to call the renderWorldBlock method. If I change the getRenderType method from -1 to return a custom value it would only render the fire, and not the model, right? BlockCampfire TileEntityCampfireRenderer
-
Solved it (I think)! I removed GL11.glDisable(GL12.GL_RESCALE_NORMAL);
-
So I tried GL11.glDisable(GL11.GL_LIGHTING); Made my chest render without any shadows. But still, all other blocks in the inventory (that are rendered after the chest) were shaded. Does anyone know what renderBlocks.useInventoryTint is used for? I'm suspecting it has something to do with that, but I can't get my head around what it is used for, or how it works. Or perhaps it's something weird with the renderHelper? ItemCustomChestRenderer
-
And how do I disable lightning calculations? (I'm not much of a pro in openGL) Btw. Here is the code for my renderTileEntityCustomChestAt :