Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 ?

  • 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.

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.

  • 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 ?

 

  • 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 ?

  • 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.

 

  • 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 ?

  • 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 ?

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

  • Author

How should the code be modified ? The first parameter is "event.entity" instead of "splosion", right ?

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.

  • 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 ?

  • 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 ?

  • 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);

    }

 

  • 1 month later...
  • 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 ?

  • 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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.