Posted September 11, 201411 yr With Forge 1.6.4, I could easily change TNTPrimed source code and make bigger TNT explosions. I downloaded/configured Forge 1.7.10 and tried the sample mod bundled with it. How would I go about making the bigger TNT explosion with it ?
September 11, 201411 yr Author Just getting started with 1.7.10 ... How would I get world in the sample mod ? Is the associated source code for Minecraft available somewhere ? Ability to read the source in 1.6.4 was a huge benefit.
September 11, 201411 yr Sources can be located at /build/tmp/recompSrc. Or you can browse forge-1.7.10-*.jar lib in your IDE. In IDEA you can press Ctrl+N and enter EntityTNTPrimed.
September 11, 201411 yr Author "build" directory had only the following files: build build/.gitignore build/natives build/natives/libjinput-osx.jnilib build/natives/liblwjgl.jnilib build/natives/libtwitchsdk.dylib build/natives/openal.dylib build/tmp build/tmp/makeStart build/tmp/makeStart/GradleStart.java build/tmp/makeStart/GradleStartServer.java Are the classes generated and then cleaned up ? Found some sources in forge-1.7.10-userdev.jar but no EntityTNTPrimed. Also found some sources in .gradle/caches/minecraft as well, but not this one. Eclipse can show the class. Where can I find the associated source so that can attach with it ?
September 11, 201411 yr Author Agreed. In Forge 1.6.4, I was changing the source code, recompiling and showing the effects. But would like to build real plugins in 1.7.10. And so looking at the source code would be handy. For example, I don't know how to get "world" in my plugin so that bigger explosions can be created. Clues ?
September 11, 201411 yr Author Alright, this was very helpful. So I created my first mod as: @EventHandler public void init(EntityJoinWorldEvent event) { World world = event.world; event.world.createExplosion(event.entity, event.entity.posX, event.entity.posY, event.entity.posZ, 40, true); } I clicked on the "Run" button to run the client profile. But still not seeing the bigger TNT explosion size.
September 12, 201411 yr Author So I updated the method to: @EventHandler public void init(EntityJoinWorldEvent event) { if (!(event.entity instanceof EntityTNTPrimed)) return; event.setCanceled(true); event.world.createExplosion(event.entity, event.entity.posX, event.entity.posY, event.entity.posZ, 40, true); } But still not seeing bigger explosions, any suggestions ?
September 12, 201411 yr Author This will be shown in Minecraft workshops and boys love bigger explosions. The question being I'm not seeing the bigger size though. What needs to be different in the code to make the explosion bigger ?
September 12, 201411 yr world.createExplosion(splosion, (double)x, (double)y, (double)z, 15.0F, true); the 15.0F is what determined the explosion size, when you reach 50 and higher the explosion lags and starts looking utter shite
September 12, 201411 yr Author How should the code be modified ? The first parameter is "event.entity" instead of "splosion", right ?
September 12, 201411 yr EntityItem splosion = new EntityItem(world,(double)((float)x),(double)((float)y),(double)((float)z), new ItemStack(Blocks.dirt,1,0)); world.spawnEntityInWorld(splosion); world.createExplosion(splosion, (double)x, (double)y, (double)z, 15.0F, true); world.removeEntity(splosion); This is the code I use for random explosions I want, create an entity of some blkock (here dirt) in the world at x,y,z. then creates the entity, explodes and then removes it quickly.
September 12, 201411 yr Author The following code still does not work: @EventHandler public void init(EntityJoinWorldEvent event) { if (!(event.entity instanceof EntityTNTPrimed)) return; EntityItem splosion = new EntityItem(event.world, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(Blocks.dirt,1,0)); event.world.spawnEntityInWorld(splosion); event.world.createExplosion(splosion, event.entity.posX, event.entity.posY, event.entity.posZ, 25.0F, true); event.world.removeEntity(splosion); } Thoughts ?
September 13, 201411 yr Author Didn't work. Here is my complete class: package org.devoxx4kids.forge.plugins.biggertnt; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityTNTPrimed; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @Mod(name = BiggerTNTExplosion.NAME, modid = BiggerTNTExplosion.MODID, version = BiggerTNTExplosion.VERSION) public class BiggerTNTExplosion { public static final String MODID = "examplemod"; public static final String VERSION = "1.0"; public static final String NAME = "1.7.10"; @EventHandler public void init(FMLInitializationEvent event) { // world.createExplosion(exploderEntity, x, y, z, radius, spawnParticles); // some example code System.out.println(NAME + " mod loaded"); // System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName()); } // @EventHandler // public void init(EntityJoinWorldEvent event) // { // if (!(event.entity instanceof EntityTNTPrimed)) // return; // // event.setCanceled(true); // event.world.createExplosion(event.entity, // event.entity.posX, // event.entity.posY, // event.entity.posZ, // 15.0F, // true); // } @SubscribeEvent public void init(EntityJoinWorldEvent event) { if (!(event.entity instanceof EntityTNTPrimed)) return; EntityItem splosion = new EntityItem(event.world, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(Blocks.dirt,1,0)); event.world.spawnEntityInWorld(splosion); event.world.createExplosion(splosion, event.entity.posX, event.entity.posY, event.entity.posZ, 25.0F, true); event.world.removeEntity(splosion); } } Suggestions ?
September 13, 201411 yr Author Oh yeah, that was it, thanks a lot! What's the purpose of spawning a new entity instead of using event.entity ? The following code, as opposed to the one given above, worked as well: @SubscribeEvent public void init(EntityJoinWorldEvent event) { if (!(event.entity instanceof EntityTNTPrimed)) return; event.world.createExplosion(event.entity, event.entity.posX, event.entity.posY, event.entity.posZ, 25.0F, true); }
November 5, 201410 yr Author By default, TNT explodes 4 seconds after being lit. In this case, it blows up right away. How do I implement the "wait" behavior with the bigger explosion mod ?
November 5, 201410 yr Author Didn't mean to hijack the thread, was just asking a follow up question Anyway, will start a new thread for a specific question.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.