Jump to content

Recommended Posts

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 ?

Posted

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.

Posted

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

 

Posted

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 ?

Posted

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.

 

Posted

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 ?

Posted

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 ?

Posted

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.

Posted

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 ?

Posted

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 ?

Posted

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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