CraftTweaker

CraftTweaker

186M Downloads

(1.12) Explosions created with performExplosion are directed towards the negative X and Z coordinates

Closed this issue ยท 4 comments

commented

Issue description

When creating an explosion using performExplosion, the blast is directed towards the negative X and Z axes, rather than centered around the position of the explosion. Attached are the explosions produced by tnt compared to a custom block that produces an explosion on placement. The player cam is directly centered on the explosion's position in both.

Image Image

Steps to reproduce

No response

Script used

https://gist.github.com/Girouxdudes/186e640438d6789beb8f717e9c175d52

The crafttweaker.log file

https://gist.github.com/Girouxdudes/d5ef934b29806c94b4c8aad7f356c714

Minecraft version

1.12

Modloader

Forge

Modloader version

14.23.5.2860

CraftTweaker version

4.1.20.709

Other relevant information

No response

The latest.log file

https://gist.github.com/Girouxdudes/89549a95bb03d944bdac236b83bc6f06

commented

If you did:

#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;

var explodingMagma = VanillaFactory.createBlock("eruption_debris", <blockmaterial:rock>);
explodingMagma.setBlockHardness(1.5);
explodingMagma.setBlockResistance(6.0);
explodingMagma.setToolClass("pickaxe");
explodingMagma.setToolLevel(0);
explodingMagma.setBlockSoundType(<soundtype:stone>);

explodingMagma.onBlockPlace = function(world, blockPos, blockState){
world.performExplosion(<entity:minecraft:blaze>.createEntity(world), blockPos.x + 0.5, blockPos.y, blockPos.z + 0.5, 4.0, true, true);
};
explodingMagma.register();

does it work as intended?

commented

So it shifts it slightly, but the explosion is still not centered. I made a script to turn the "outline" of an explosion into obsidian to better show the issue, look at the asymmetry:

Image

It doesn't look like a mere issue of centering, but rather than the entire explosion shape is incorrect

commented

can you humour me and run this script:

#loader contenttweaker
import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;

var explodingMagma = VanillaFactory.createBlock("eruption_debris", <blockmaterial:rock>);
explodingMagma.setBlockHardness(1.5);
explodingMagma.setBlockResistance(6.0);
explodingMagma.setToolClass("pickaxe");
explodingMagma.setToolLevel(0);
explodingMagma.setBlockSoundType(<soundtype:stone>);

explodingMagma.onBlockPlace = function(world, blockPos, blockState){
world.performExplosion(<entity:minecraft:blaze>.createEntity(world), blockPos.x + 10.5, blockPos.y, blockPos.z + 0.5, 4.0, true, true);
};
explodingMagma.register();

Which will make the explosion at x + 10 blocks instead, make sure that the block that gets exploded is empty.
I think what is happening is that the explosion is being created inside of your block, so it behaves differently, whereas tnt is an entity and doesn't affect the explosion.

commented

you were correct, setting the explosive block's resistance to 0 fixed this. Should have thought of that myself, sorry! Thanks for the help