Everything posted by TehStoneMan
-
[1.8.9] [1.9] Rendering fullbright texture
Hello. I am trying to update a mod from 1.7.10 to 1.8.9, and beyond that to 1.9. The problem is, I have a block that renders with full brightness, but does not emit light itself. This was previously done with ISimpleBlockRenderingHandler, but this method does not seem to be supported in 1.8.9. I am guessing that I will need to use IBlockSmartModel, but I don't understand how this works. Can somebody help me here, or am I on the wrong track? Also, will this need to be changed again for 1.9?
-
[1.8.9] Problem building with API
What jar? It's all my own code.
-
[1.8.9] Problem building with API
I am trying to update one of my mods to 1.8.9, and part of the update includes an API that wasn't present in previous builds, but it keeps failing with a package not found error. Error log: This set of MCP mappings was designed for MC 1.8.8. Use at your own peril. ################################################# ForgeGradle 2.1-SNAPSHOT-75bb646 https://github.com/MinecraftForge/ForgeGradle ################################################# Powered by MCP unknown http://modcoderpack.com by: Searge, ProfMobius, Fesh0r, R4wk, ZeuX, IngisKahn, bspkrs ################################################# :deobfCompileDummyTask :deobfProvidedDummyTask :sourceApiJava UP-TO-DATE :compileApiJava C:\Minecraft Dev\CashCraft\build\sources\api\java\io\github\tehstoneman\cashcraft\api\IEcomomy.java:3: error: package io.github.tehstoneman.cashcraft.economy does not exist import io.github.tehstoneman.cashcraft.economy.PlayerWallet; ^ C:\Minecraft Dev\CashCraft\build\sources\api\java\io\github\tehstoneman\cashcraft\api\IEcomomy.java:31: error: cannot find symbol public PlayerWallet getWallet( EntityPlayer player ); ^ symbol: class PlayerWallet location: interface IEcomomy 2 errors :compileApiJava FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileApiJava'. > Compilation failed; see the compiler error output for details. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 8.709 secs It seems that for some reason, during the build process, it copies the API source files into the build folder, but not the rest of the source. build.gradle: buildscript { repositories { jcenter() maven { name = "forge" url = "http://files.minecraftforge.net/maven" //url "https://plugins.gradle.org/m2" } } dependencies { classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT' } } apply plugin: "net.minecraftforge.gradle.forge" archivesBaseName = "CashCraft" group = "io.github.tehstoneman.cashcraft" // http://maven.apache.org/guides/mini/guide-naming-conventions.html version = "mc1.8.9-2.0.0" // java version sourceCompatibility = 1.7 targetCompatibility = 1.7 minecraft { version = "1.8.9-11.15.1.1722" if( file('../run').exists() ) { runDir = "../run/assets" } else { runDir = "assets" } mappings = "stable_20" } sourceSets { main { //java { srcDirs = ["src/main/java","src/api/java"] } java { srcDir "src/main/java" } resources { srcDir "src/main/resources" } } api { java { srcDir "src/api/java" } } } processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' // replace version and mcversion expand 'version':project.version, 'mcversion':project.minecraft.version } // copy everything else, thats not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' exclude '*.xcf' exclude '*.wav' } } Can anybody help?
-
[1.8] Trouble with ore dictionary and recipes
Thanks GreyGhost. Your post showed me where I went wrong following your "MinecraftByExample" I had started by making a regular crafting recipe for initial testing, but didn't see that the function call had changed when looking at the ore dictionary version. It all works now.
-
[1.8] Trouble with ore dictionary and recipes
No, the item is defined and working, testing in creative mode. I am now adding the crafting recipe, and I only get the error when trying to include an ore dictionary entry as one of the ingrediants.
-
[1.8] Trouble with ore dictionary and recipes
Hello. I am trying to create a recipe that uses an ore dictionary entry, but I keep getting "Null pointer exception" on the recipe definition GameRegistry.addRecipe( new ItemStack( ModItems.itemWheelHub ), new Object[] { "SWS", "WIW", "SWS", 'S', Items.stick, 'W', "woodPlank", 'I', Items.iron_ingot } ); Everywhere I look tells me that this is the correct way of using the ore dictionary, but it doesn't seem to be working. If I replace "woodPlank" with Blocks.planks, it will compile and run fine. Doing a debug trace, it looks to me as if the CraftingManager does not recognise a string as a valid entry. Is this correct or can somebody help me please? Using Forge 1.8-11.14.3.1486
-
How to make API for mod?
After some study on this, I have come to the conclusion that an API on it's own is insufficient for what I want to do, and may need to supply an optional library to go along with it. What would I need to do to create a library as opposed to a regular mod?
-
How to make API for mod?
So it would simple be making a project with just my API functions, and nothing else? Any specific Minecraft / Forge specific classes I need to import, or just the ones the API uses?
-
How to make API for mod?
I'm sorry, but that still doesn't explain how to actually make one. I don't think that would be a problem. NOT using the API myself didn't even occur to me. That would be should be some very useful information, too. What could be good if there was an easy to follow tutorial on making a mod API.
-
How to make API for mod?
I was wondering how do you make an API for your mod? I would like to be able to supply an API for my mod that other mod could use to supply a set of optional properties for their blocks, and to assume a set of default properties if not supplied, or for vanilla blocks. Also, if possible, I would like to have these properties available for other mods that may be interested in these properties to query, without needing my mod installed, just by including the API. Thank you for any help.
-
Block scanning
I was hoping for a way to do it without having to iterate through all the blocks.
-
Block scanning
I would like to crate a custom mining mob, and was wondering if anybody could suggest an efficient method of scanning nearby blocks ( like in a 5 block radius ) for ores, and at longer range ( 16 block radius ) for only visible ores. The basic concept is that the mob can "smell" buried ores within a limited range, but can still "see" surface ores from a distance. I would like something that is quick running, not likely to introduce lag, and can be adapted for other similar tasks. Thanks for any help.
-
[1.7.10] Custom particles not rendering
There doesn't seem to be a way to register particles. You almost need to build your own particle system to have custom particles. The problem is, even though my code seems to be running, having run it through a debug trace, it just doesn't seem to render my particles.
-
[1.7.10] Custom particles not rendering
Hello. I am trying to create a custom blue flame particle, but I am unable to get it to render. My code appears to work, but nothing comes up in game. Can somebody help? package io.github.tehstoneman.zombiebrains.block; .... public class BlockLapisTorch extends Block { .... /** * A randomly called display update to be able to add particles or other * items for display */ @Override @SideOnly( Side.CLIENT ) public void randomDisplayTick( World world, int x, int y, int z, Random rand ) { final int l = world.getBlockMetadata( x, y, z ); final double d0 = x + 0.5F; final double d1 = y + 0.7F; final double d2 = z + 0.5F; final double d3 = 0.2199999988079071D; final double d4 = 0.27000001072883606D; if( l == 1 ) { world.spawnParticle( "smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D ); //RenderParticle.spawnParticle( "blueFlame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D ); world.spawnParticle( "flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D ); } else if( l == 2 ) { world.spawnParticle( "smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D ); RenderParticle.spawnParticle( "blueFlame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D ); } else if( l == 3 ) { world.spawnParticle( "smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D ); RenderParticle.spawnParticle( "blueFlame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D ); } else if( l == 4 ) { world.spawnParticle( "smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D ); RenderParticle.spawnParticle( "blueFlame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D ); } else { world.spawnParticle( "smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D ); RenderParticle.spawnParticle( "blueFlame", d0, d1, d2, 0.0D, 0.0D, 0.0D ); } } } package io.github.tehstoneman.zombiebrains.client.renderer; import io.github.tehstoneman.zombiebrains.client.particle.EntityBlueFlameFX; .... public class RenderParticle { private static Minecraft mc = Minecraft.getMinecraft(); private static World theWorld = mc.theWorld; private static TextureManager renderEngine = mc.getTextureManager(); /** * Spawns a particle. Arg: particleType, x, y, z, velX, velY, velZ */ public static void spawnParticle( String particleType, double x, double y, double z, double velX, double velY, double velZ ) { try { doSpawnParticle( particleType, x, y, z, velX, velY, velZ ); } catch( final Throwable throwable ) { final CrashReport crashreport = CrashReport.makeCrashReport( throwable, "Exception while adding particle" ); final CrashReportCategory crashreportcategory = crashreport.makeCategory( "Particle being added" ); crashreportcategory.addCrashSection( "Name", particleType ); crashreportcategory.addCrashSectionCallable( "Position", new Callable() { @Override public String call() { return CrashReportCategory.func_85074_a( x, y, z ); } } ); throw new ReportedException( crashreport ); } } /** * Spawns a particle. Arg: particleType, x, y, z, velX, velY, velZ */ public static EntityFX doSpawnParticle( String particleType, double x, double y, double z, double velX, double velY, double velZ ) { if( mc != null && mc.renderViewEntity != null && mc.effectRenderer != null ) { int particleLevel = mc.gameSettings.particleSetting; if( particleLevel == 1 && theWorld.rand.nextInt( 3 ) == 0 ) particleLevel = 2; final double viewX = mc.renderViewEntity.posX - x; final double viewY = mc.renderViewEntity.posY - y; final double viewZ = mc.renderViewEntity.posZ - z; EntityFX entityfx = null; final double distance = 16.0D; if( viewX * viewX + viewY * viewY + viewZ * viewZ > distance * distance ) return null; else if( particleLevel > 1 ) return null; else { if( particleType.equals( "blueFlame" ) ) entityfx = new EntityBlueFlameFX( theWorld, x, y, z, velX, velY, velZ ); if( entityfx != null ) mc.effectRenderer.addEffect( entityfx ); return entityfx; } } else return null; } } package io.github.tehstoneman.zombiebrains.client.particle; import io.github.tehstoneman.zombiebrains.ModInfo; .... @SideOnly( Side.CLIENT ) public class EntityBlueFlameFX extends ZombieEntityFX { /** the scale of the flame FX */ private final float flameScale; public EntityBlueFlameFX( World p_i1209_1_, double p_i1209_2_, double p_i1209_4_, double p_i1209_6_, double p_i1209_8_, double p_i1209_10_, double p_i1209_12_ ) { super( p_i1209_1_, p_i1209_2_, p_i1209_4_, p_i1209_6_, p_i1209_8_, p_i1209_10_, p_i1209_12_ ); motionX = motionX * 0.009999999776482582D + p_i1209_8_; motionY = motionY * 0.009999999776482582D + p_i1209_10_; motionZ = motionZ * 0.009999999776482582D + p_i1209_12_; double d6 = p_i1209_2_ + ( rand.nextFloat() - rand.nextFloat() ) * 0.05F; d6 = p_i1209_4_ + ( rand.nextFloat() - rand.nextFloat() ) * 0.05F; d6 = p_i1209_6_ + ( rand.nextFloat() - rand.nextFloat() ) * 0.05F; flameScale = particleScale; particleRed = particleGreen = particleBlue = 1.0F; particleMaxAge = (int)( 8.0D / ( Math.random() * 0.8D + 0.2D ) ) + 4; noClip = true; this.particleTextureIndexX = 0; this.particleTextureIndexY = 0; } @Override public void renderParticle( Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, float p_70539_5_, float p_70539_6_, float p_70539_7_ ) { final float f6 = ( particleAge + p_70539_2_ ) / particleMaxAge; particleScale = flameScale * ( 1.0F - f6 * f6 * 0.5F ); //Minecraft.getMinecraft().getTextureManager().bindTexture( new ResourceLocation( ModInfo.MODID + ":textures/particle/particles.png" ) ); super.renderParticle( p_70539_1_, p_70539_2_, p_70539_3_, p_70539_4_, p_70539_5_, p_70539_6_, p_70539_7_ ); } @Override public int getBrightnessForRender( float p_70070_1_ ) { float f1 = ( particleAge + p_70070_1_ ) / particleMaxAge; if( f1 < 0.0F ) f1 = 0.0F; if( f1 > 1.0F ) f1 = 1.0F; final int i = super.getBrightnessForRender( p_70070_1_ ); int j = i & 255; final int k = i >> 16 & 255; j += (int)( f1 * 15.0F * 16.0F ); if( j > 240 ) j = 240; return j | k << 16; } /** * Gets how bright this entity is. */ @Override public float getBrightness( float p_70013_1_ ) { float f1 = ( particleAge + p_70013_1_ ) / particleMaxAge; if( f1 < 0.0F ) f1 = 0.0F; if( f1 > 1.0F ) f1 = 1.0F; final float f2 = super.getBrightness( p_70013_1_ ); return f2 * f1 + ( 1.0F - f1 ); } /** * Called to update the entity's position/logic. */ @Override public void onUpdate() { prevPosX = posX; prevPosY = posY; prevPosZ = posZ; if( particleAge++ >= particleMaxAge ) setDead(); moveEntity( motionX, motionY, motionZ ); motionX *= 0.9599999785423279D; motionY *= 0.9599999785423279D; motionZ *= 0.9599999785423279D; if( onGround ) { motionX *= 0.699999988079071D; motionZ *= 0.699999988079071D; } } @Override public int getFXLayer() { return 3; } } package io.github.tehstoneman.zombiebrains.client.particle; import io.github.tehstoneman.zombiebrains.ModInfo; .... public class ZombieEntityFX extends EntityFX { .... @Override public void renderParticle( Tessellator tess, float par2, float par3, float par4, float par5, float par6, float par7 ) { Minecraft.getMinecraft().getTextureManager().bindTexture( new ResourceLocation( ModInfo.MODID + ":textures/particle/particles.png" ) ); //Minecraft.getMinecraft().getTextureManager().bindTexture( new ResourceLocation( "textures/particle/particles.png" ) ); //super.renderParticle( tess, par2, par3, par4, par5, par6, par7 ); float f6 = (float)this.particleTextureIndexX / 16.0F; float f7 = f6 + 0.0624375F; float f8 = (float)this.particleTextureIndexY / 16.0F; float f9 = f8 + 0.0624375F; float f10 = 0.1F * this.particleScale; float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX); float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY); float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ); tess.setColorRGBA_F(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha); tess.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9); tess.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8); tess.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8); tess.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9); } /** * Public method to set private field particleTextureIndex. */ @Override public void setParticleTextureIndex( int index ) { particleTextureIndexX = index % 16; particleTextureIndexY = index / 16; } @Override public int getFXLayer() { return 3; } } If it helps, full source is available on GitHub - https://github.com/TehStoneMan/ZombieBrains
-
[1.8] Help with fullbright texture
Hello. I am trying to update my mod to 1.8, but with the new rendering code, I don't know how to draw my texture as full bright. I previously had a custom ISBRH, but that option does not seem to exist in the new version. Can somebody help me?
-
[1.7.10] Loot Mob
Hello. I am trying to create a mob that, on death, drops a bunch of dungeon loot items (like what you would find in a regular dungeon chest), but I'm kind of stuck on the get loot/drop loot part. I figure something like : - Mob death - Get random dungeon loot (DungeonHooks ?) - Convert to inventory (ItemStack[] ?) - Scatter loot like in player death I am not sure how to go about coding the middle two steps. Can somebody help me?
-
[1.7.10] Custom creeper model
I would like to make a custom creeper mob, and I would like this mob to be wearing a hat. What would be the best approach for this? I already have the hat model (in .obj format), and a custom creeper renderer class that is currently just a direct copy of the regular creeper, but not sure where, or how, if possible, to render the hat model.
-
[1.7.10] Help - Changeable texture per face
I am trying to make a block where you can change the texture on each face by right-clicking on the face to change. I can detect which face the player clicked on, a tile entity to store the texture info in NBT, and a list of registered textures. What I can't work out is how to get the texture info from the NBT to the block for rendering. Can anybody help with suggestions?
-
Help with full bright block
Hehehe, seems like I commented out the call to my render initialize function for some reason, and forgot to uncomment it. Thanks for the help - I may not have noticed that otherwise.
-
Help with full bright block
Hello. I would like to have a block that is fully illuminated, but does not produce light itself. I have looked at using ISimpleBlockRenderingHandler as one possible solution, but I am not sure how to get that working, as my custom render code does not seem to get called. Is anybody able to give me any pointers, or maybe a different solution?
-
Custom save file location
No, it's not a config file. It's a set of waypoint data to be saved as an XML file. Personal waypoints, or waypoints for a server without my mod installed, are to be saved client side, and I would like to have the filename the same as the server or map name, if I could find out how to get that information. I would also like to have publicly shared waypoints, to be saved server side. I'm just wondering what the suggested file location to save these files (like in a subfolder under the "Mods" folder?) and the recomended way of getting / setting this filepath in Forge. Also, as already mentioned, I would like to now how to get the server info (or the map name in single player) for use in generating the filename.
-
Custom save file location
I would like to save a file related to my mod. This file would be client side to provide for private data related to the mod, as well as another version server side for public data. I would like to know where would be the best place / filepath to save this file, and also how to get the map name / server info for the current game. Thank you.
-
[1.7.2] Client / Server side seperation
Can you explain a bit more? I couldn't find anything that seemed to relate to this.
-
[1.7.2] Client / Server side seperation
In my current WIP mod, I would like to have the server side and client somewhat independent of each other, in the sense that the client side does not require the server side to function (although only in a limited way), and the server side does not require the client to allow a player to connect. With the changes following the 1.7 update, I'm not really sure how things work now, so was wondering if anyboady had any suggestion on how to do this.
-
Sync container inventory
Well, I seem to have it mostly working now, but there is still one problem I am having. I have a full container item, and an empty one. I can take one out of the "equip" slot, and place the other in, and the "contents" slots work as expected. But if I were to directly swap containers by clicking on the occupied slot with the other container, the GUI doesn't update with the change of contents. Through various tests, I have checked that the inventory slots themselves update, but not the GUI, and any interactions with "contents" slots can result in copying the contents of one container to the other. Closing and re-opening the GUI does update properly, though. Suggestions?
IPS spam blocked by CleanTalk.