Shulk Me Not

This commit is contained in:
Vasco Lavos committed 2017-09-30 16:25:13 +01:00
1 parent 06134d2acf
commit 459be17a00
7 files changed
+89

No files matched your search

@@ -40,6 +40,7 @@ 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.SubTileRafflowsia;
import vazkii.botania.common.block.subtile.generating.SubTileShulkMeNot;
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
import vazkii.botania.common.lib.LibBlockNames;
@@ -96,6 +97,7 @@ public final class ModelHandler {
BotaniaAPIClient.registerSubtileModel(SubTileSpectrolus.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SPECTROLUS));
BotaniaAPIClient.registerSubtileModel(SubTileDandelifeon.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_DANDELIFEON));
BotaniaAPIClient.registerSubtileModel(SubTileRafflowsia.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_RAFFLOWSIA));
BotaniaAPIClient.registerSubtileModel(SubTileShulkMeNot.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_SHULK_ME_NOT));
BotaniaAPIClient.registerSubtileModel(SubTileBellethorn.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BELLETHORN));
BotaniaAPIClient.registerSubtileModel(SubTileBellethorn.Mini.class, new ModelResourceLocation("botania:" + LibBlockNames.SUBTILE_BELLETHORN + "Chibi"));
@@ -84,6 +84,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
LibBlockNames.SUBTILE_NARSLIMMUS,
LibBlockNames.SUBTILE_SPECTROLUS,
LibBlockNames.SUBTILE_RAFFLOWSIA,
LibBlockNames.SUBTILE_SHULK_ME_NOT,
LibBlockNames.SUBTILE_DANDELIFEON,
// Functional
@@ -86,6 +86,7 @@ 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.SubTileRafflowsia;
import vazkii.botania.common.block.subtile.generating.SubTileShulkMeNot;
import vazkii.botania.common.block.subtile.generating.SubTileSpectrolus;
import vazkii.botania.common.block.subtile.generating.SubTileThermalily;
import vazkii.botania.common.block.tile.*;
@@ -493,6 +494,7 @@ public final class ModBlocks {
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_SPECTROLUS, SubTileSpectrolus.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DANDELIFEON, SubTileDandelifeon.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_RAFFLOWSIA, SubTileRafflowsia.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_SHULK_ME_NOT, SubTileShulkMeNot.class);
registerSubTileWithMini(LibBlockNames.SUBTILE_BELLETHORN, SubTileBellethorn.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_DREADTHORN, SubTileDreadthorn.class);
@@ -0,0 +1,81 @@
package vazkii.botania.common.block.subtile.generating;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityShulker;
import net.minecraft.entity.monster.IMob;
import net.minecraft.init.MobEffects;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import vazkii.botania.api.subtile.RadiusDescriptor;
import vazkii.botania.api.subtile.SubTileGenerating;
public class SubTileShulkMeNot extends SubTileGenerating {
private static final int RADIUS = 8;
@Override
public void onUpdate() {
super.onUpdate();
int generate = getMaxMana();
World world = getWorld();
BlockPos pos = getPos();
List<EntityShulker> shulkers = world.getEntitiesWithinAABB(EntityShulker.class, new AxisAlignedBB(pos).grow(RADIUS));
if(!world.isRemote)
for(EntityShulker shulker : shulkers) {
if(getMaxMana() - mana < generate)
break;
if(!shulker.isDead && shulker.getDistanceSq(pos) < RADIUS * RADIUS) {
EntityLivingBase target = shulker.getAttackTarget();
if(target != null && target instanceof IMob && !target.isDead
&& target.getDistanceSq(pos) < RADIUS * RADIUS && target.getActivePotionEffect(MobEffects.LEVITATION) != null) {
target.setDead();
shulker.setDead();
for(int i = 0; i < 10; i++) // so it's really loud >_>
world.playSound(null, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.ENTITY_SHULKER_DEATH, SoundCategory.BLOCKS, 10F, 0.1F);
particles(world, pos, target);
particles(world, pos, shulker);
mana += generate;
sync();
}
}
}
}
private void particles(World world, BlockPos pos, Entity entity) {
float f = 0.01F;
if(world instanceof WorldServer) {
WorldServer ws = (WorldServer) world;
ws.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, entity.posX + entity.width / 2, entity.posY + entity.height / 2, entity.posZ + entity.width / 2, 100, entity.width, entity.height, entity.width, 0.05);
ws.spawnParticle(EnumParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 40, 0, 0, 0, 0.6);
}
}
@Override
public int getColor() {
return 0x815598;
}
@Override
public RadiusDescriptor getRadius() {
return new RadiusDescriptor.Circle(getPos(), RADIUS);
}
@Override
public int getMaxMana() {
return 75000;
}
}
@@ -121,6 +121,7 @@ public final class LibBlockNames {
public static final String SUBTILE_SPECTROLUS = "spectrolus";
public static final String SUBTILE_DANDELIFEON = "dandelifeon";
public static final String SUBTILE_RAFFLOWSIA = "rafflowsia";
public static final String SUBTILE_SHULK_ME_NOT = "shulk_me_not";
public static final String SUBTILE_BELLETHORN = "bellethorn";
public static final String SUBTILE_BERGAMUTE = "bergamute";
@@ -1184,6 +1184,8 @@ tile.botania:flower.dandelifeon.name=Dandelifeon
tile.botania:flower.dandelifeon.reference=C'est la vie
tile.botania:flower.rafflowsia.name=Rafflowsia
tile.botania:flower.rafflowsia.reference=Trap Hole Nightmare
tile.botania:flower.shulk_me_not.name=Shulk Me Not
tile.botania:flower.shulk_me_not.reference=Really feeling it
# - FUNCTIONAL
tile.botania:flower.bellethorn.name=Bellethorne