Cocoons can now be forced to spawn rare mobs with gaia spirits

Tweaks to cocoon emerald particles to reduce overlap
This commit is contained in:
Hubry committed 2020-03-14 12:50:34 +01:00
1 parent d14fba628b
commit cacb5121b3
3 files changed
+26 -6

No files matched your search

@@ -28,7 +28,10 @@ import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.block.tile.TileCocoon;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
@@ -74,18 +77,25 @@ public class BlockCocoon extends BlockMod {
TileCocoon cocoon = (TileCocoon) world.getTileEntity(pos);
Item item = stack.getItem();
if(cocoon != null && (item == Items.EMERALD || item == Items.CHORUS_FRUIT)) {
if(cocoon != null && (item == Items.EMERALD || item == Items.CHORUS_FRUIT || item == ModItems.lifeEssence)) {
if(!world.isRemote) {
if(item == Items.EMERALD && cocoon.emeraldsGiven < TileCocoon.MAX_EMERALDS) {
if(!creative)
stack.shrink(1);
cocoon.emeraldsGiven++;
((ServerWorld) world).spawnParticle(ParticleTypes.HAPPY_VILLAGER, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.5);
((ServerWorld) world).spawnParticle(ParticleTypes.HAPPY_VILLAGER, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0.05, 0.1, 0.5);
} else if(item == Items.CHORUS_FRUIT && cocoon.chorusFruitGiven < TileCocoon.MAX_CHORUS_FRUITS) {
if(!creative)
stack.shrink(1);
cocoon.chorusFruitGiven++;
((ServerWorld) world).spawnParticle(ParticleTypes.PORTAL, pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5, 32, 0, 0, 0, 0.5);
} else if (item == ModItems.lifeEssence && !cocoon.gaiaSpiritGiven) {
if(!creative) {
stack.shrink(1);
}
cocoon.forceRare();
WispParticleData data = WispParticleData.wisp(0.6F, 0F, 1F, 0F);
((ServerWorld) world).spawnParticle(data, pos.getX() + 0.5, pos.getY() + 0.7, pos.getZ() + 0.5, 8, 0.1, 0.1, 0.1, 0.04);
}
}