Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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,43 @@ public LexiconEntry getEntry() {
return LexiconData.entropinnyum;
}

public class EventHandler {

@SubscribeEvent
public void consumeExplosion(ExplosionEvent.Start event) {
if (mana == 0) {
if (Math.abs(supertile.xCoord - event.explosion.explosionX) <= RANGE && Math.abs(supertile.yCoord - event.explosion.explosionY) <= RANGE && Math.abs(supertile.zCoord - event.explosion.explosionZ) <= RANGE) {
if (!event.world.isRemote) {
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 (mana == 0) {
if (Math.abs(supertile.xCoord - event.x) <= RANGE && Math.abs(supertile.yCoord - event.y) <= RANGE && Math.abs(supertile.zCoord - event.z) <= RANGE) {
if (!event.world.isRemote) {
processExplosion(event.world, event.entity, event.x, event.y, event.z);
event.setCanceled(true);
}
}
}
}

private void processExplosion(World world, Entity explosionSource, double posX, double posY, double posZ) {
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);
}
}
}