mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-13 08:44:02 +00:00
Added the Narslimmus.
This commit is contained in:
1 parent
978b20e5b5
commit
fadb96c009
8 files changed
+99
No files matched your search
@@ -70,6 +70,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
|
||||
LibBlockNames.SUBTILE_ENTROPINNYUM,
|
||||
LibBlockNames.SUBTILE_KEKIMURUS,
|
||||
LibBlockNames.SUBTILE_GOURMARYLLIS,
|
||||
LibBlockNames.SUBTILE_NARSLIMMUS,
|
||||
|
||||
// Functional
|
||||
LibBlockNames.SUBTILE_JADED_AMARANTHUS,
|
||||
|
||||
@@ -90,6 +90,7 @@ import vazkii.botania.common.block.subtile.generating.SubTileGourmaryllis;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileHydroangeas;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileKekimurus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileMunchdew;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNightshade;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
|
||||
import vazkii.botania.common.block.tile.TileAlfPortal;
|
||||
@@ -328,6 +329,7 @@ public final class ModBlocks {
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_ENTROPINNYUM, SubTileEntropinnyum.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_KEKIMURUS, SubTileKekimurus.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_GOURMARYLLIS, SubTileGourmaryllis.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_NARSLIMMUS, SubTileNarslimmus.class);
|
||||
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class);
|
||||
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DREADTHORN, SubTileDreadthorn.class);
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*
|
||||
* File Created @ [Jan 29, 2015, 10:43:54 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.block.subtile.generating;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.EntitySlime;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
|
||||
import vazkii.botania.api.subtile.SubTileGenerating;
|
||||
import cpw.mods.fml.common.eventhandler.Event.Result;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class SubTileNarslimmus extends SubTileGenerating {
|
||||
|
||||
public static final String TAG_WORLD_SPAWNED = "Botania:WorldSpawned";
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
|
||||
if(ticksExisted % 5 == 0) {
|
||||
float range = 2F;
|
||||
List<EntitySlime> slimes = supertile.getWorldObj().getEntitiesWithinAABB(EntitySlime.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
|
||||
for(EntitySlime slime : slimes) {
|
||||
if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED)) {
|
||||
int size = slime.getSlimeSize();
|
||||
int mul = (int) Math.pow(2, size);
|
||||
int mana = 160 * mul;
|
||||
int remain = getMaxMana() - this.mana;
|
||||
if(!slime.worldObj.isRemote) {
|
||||
slime.setDead();
|
||||
slime.worldObj.playSoundAtEntity(slime, "mob.slime." + (size > 1 ? "big" : "small"), 1F, 0.02F);
|
||||
this.mana = Math.min(getMaxMana(), this.mana + mana);
|
||||
sync();
|
||||
}
|
||||
|
||||
for (int j = 0; j < mul * 8; ++j) {
|
||||
float f = slime.worldObj.rand.nextFloat() * (float)Math.PI * 2.0F;
|
||||
float f1 = slime.worldObj.rand.nextFloat() * 0.5F + 0.5F;
|
||||
float f2 = MathHelper.sin(f) * (float) size * 0.5F * f1;
|
||||
float f3 = MathHelper.cos(f) * (float) size * 0.5F * f1;
|
||||
float f4 = slime.worldObj.rand.nextFloat() * (float) size * 0.5F * f1;
|
||||
slime.worldObj.spawnParticle("slime", slime.posX + (double)f2, slime.boundingBox.minY + f4, slime.posZ + (double)f3, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxMana() {
|
||||
return 5000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0x71C373;
|
||||
}
|
||||
|
||||
public static class SpawnIntercepter {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
|
||||
if(event.entityLiving instanceof EntitySlime && event.getResult() != Result.DENY && isSlimeChunk(event.entityLiving.worldObj, MathHelper.floor_double(event.x), MathHelper.floor_double(event.z)))
|
||||
event.entityLiving.getEntityData().setBoolean(TAG_WORLD_SPAWNED, true);
|
||||
}
|
||||
|
||||
public boolean isSlimeChunk(World world, int x, int z) {
|
||||
Chunk chunk = world.getChunkFromBlockCoords(x, z);
|
||||
return chunk.getRandomWithSeed(987234911L).nextInt(10) == 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
|
||||
import vazkii.botania.common.brew.ModBrews;
|
||||
import vazkii.botania.common.brew.ModPotions;
|
||||
import vazkii.botania.common.core.command.CommandDownloadLatest;
|
||||
@@ -93,6 +94,7 @@ public class CommonProxy {
|
||||
MinecraftForge.EVENT_BUS.register(new PixieHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SheddingHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SpawnerChangingHandler());
|
||||
MinecraftForge.EVENT_BUS.register(new SubTileNarslimmus.SpawnIntercepter());
|
||||
|
||||
FMLInterModComms.sendMessage("ProjectE", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
|
||||
|
||||
|
||||
@@ -85,6 +85,8 @@ public final class LibBlockNames {
|
||||
public static final String SUBTILE_ENTROPINNYUM = "entropinnyum";
|
||||
public static final String SUBTILE_KEKIMURUS = "kekimurus";
|
||||
public static final String SUBTILE_GOURMARYLLIS = "gourmaryllis";
|
||||
public static final String SUBTILE_NARSLIMMUS = "narslimmus";
|
||||
public static final String SUBTILE_SPECTROLUS = "spectrolus";
|
||||
|
||||
public static final String SUBTILE_BELLETHORN = "bellethorn";
|
||||
public static final String SUBTILE_DREADTHORN = "dreadthorn";
|
||||
|
||||
Reference in new issue
Block a user