mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 16:54:06 +00:00
This commit is contained in:
1 parent
8c5c51e6fa
commit
014cbb2116
1 file changed
+1
-47
+1
-47
@@ -12,15 +12,9 @@ package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
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;
|
||||
@@ -29,10 +23,6 @@ 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
|
||||
@@ -73,47 +63,11 @@ public class SubTileEntropinnyum extends SubTileGenerating {
|
||||
@Override
|
||||
public RadiusDescriptor getRadius() {
|
||||
return new RadiusDescriptor.Square(toChunkCoordinates(), RANGE);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
@Optional.Method(modid = "IC2")
|
||||
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;
|
||||
}
|
||||
if (explosionSource == null) 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