mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-25 22:44:44 +00:00
Allow more explosion sources to generate mana via Entropinnyum (#117)
This commit is contained in:
1 parent
bba06bcf46
commit
1516aa495e
2 files changed
+45
No files matched your search
@@ -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")
|
||||
}
|
||||
|
||||
@@ -12,9 +12,14 @@ package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
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;
|
||||
@@ -23,6 +28,10 @@ import vazkii.botania.common.lexicon.LexiconData;
|
||||
|
||||
public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
|
||||
public SubTileEntropinnyum() {
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandler());
|
||||
}
|
||||
|
||||
private static final int RANGE = 12;
|
||||
|
||||
@Override
|
||||
@@ -70,4 +79,38 @@ public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user