Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dependencies {
compileOnly('curse.maven:cofh-lib-220333:2388748')
compileOnly('curse.maven:minefactory-reloaded-66672:2366150')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")


compileOnly("com.github.GTNewHorizons:StructureLib:1.4.24:dev")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@

import java.util.List;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.world.ExplosionEvent;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
Expand All @@ -23,6 +28,10 @@

public class SubTileEntropinnyum extends SubTileGenerating {

public SubTileEntropinnyum() {
MinecraftForge.EVENT_BUS.register(new EventHandler());
}

private static final int RANGE = 12;

@Override
Expand Down Expand Up @@ -70,4 +79,38 @@ public LexiconEntry getEntry() {
return LexiconData.entropinnyum;
}

public class EventHandler {

@SubscribeEvent
public void consumeExplosion(ExplosionEvent.Start event) {
if(processExplosion(event.world, event.explosion.exploder, event.explosion.explosionX, event.explosion.explosionY, event.explosion.explosionZ)) {
event.setCanceled(true);
}
}

@SubscribeEvent
public void consumeExplosionIC2(ic2.api.event.ExplosionEvent event) {
if(processExplosion(event.world, event.entity, event.x, event.y, event.z)) {
event.setCanceled(true);
}
}

private boolean processExplosion(World world, Entity explosionSource, double posX, double posY, double posZ) {
if (world.isRemote || mana != 0 || !(Math.abs(supertile.xCoord - posX) <= RANGE && Math.abs(supertile.yCoord - posY) <= RANGE && Math.abs(supertile.zCoord - posZ) <= RANGE)) {
return false;
}

explosionSource.setDead();
mana += getMaxMana();
supertile.getWorldObj().playSoundEffect(posX, posY, posZ, "random.explode", 0.2F, (1F + (supertile.getWorldObj().rand.nextFloat() - supertile.getWorldObj().rand.nextFloat()) * 0.2F) * 0.7F);
sync();

for(int i = 0; i < 50; i++) {
Botania.proxy.sparkleFX(world, posX + Math.random() * 4 - 2, posY + Math.random() * 4 - 2, posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
}

supertile.getWorldObj().spawnParticle("hugeexplosion", posX, posY, posZ, 1D, 0D, 0D);
return true;
}
}
}