use of net.minecraft.world.IServerWorld in project bioplethora by AquexTheSeal.
the class AlphemEntity method finalizeSpawn.
@Nullable
public ILivingEntityData finalizeSpawn(IServerWorld iServerWorld, DifficultyInstance difficultyInstance, SpawnReason spawnReason, @Nullable ILivingEntityData iLivingEntityData, @Nullable CompoundNBT compoundNBT) {
iLivingEntityData = super.finalizeSpawn(iServerWorld, difficultyInstance, spawnReason, iLivingEntityData, compoundNBT);
if (iServerWorld instanceof ServerWorld && BioplethoraConfig.COMMON.hellMode.get()) {
this.getAttribute(Attributes.ATTACK_DAMAGE).setBaseValue(10 * BioplethoraConfig.COMMON.mobMeeleeDamageMultiplier.get());
this.getAttribute(Attributes.ARMOR).setBaseValue(6.5 * BioplethoraConfig.COMMON.mobArmorMultiplier.get());
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(40 * BioplethoraConfig.COMMON.mobHealthMultiplier.get());
this.setHealth(40 * BioplethoraConfig.COMMON.mobHealthMultiplier.get());
}
if (BioplethoraConfig.COMMON.hellMode.get()) {
if (Math.random() < 0.5) {
if (!this.level.isClientSide())
if (Math.random() < 0.5) {
this.setItemSlot(EquipmentSlotType.OFFHAND, new ItemStack(Items.TOTEM_OF_UNDYING));
}
this.setItemSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.DIAMOND_SWORD));
} else {
if (!this.level.isClientSide())
if (Math.random() < 0.5) {
this.setItemSlot(EquipmentSlotType.OFFHAND, new ItemStack(Items.TOTEM_OF_UNDYING));
}
this.setItemSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.IRON_AXE));
}
} else {
if (Math.random() < 0.5) {
if (!this.level.isClientSide())
this.setItemSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.STONE_SWORD));
} else {
if (!this.level.isClientSide())
this.setItemSlot(EquipmentSlotType.MAINHAND, new ItemStack(Items.WOODEN_AXE));
}
}
return iLivingEntityData;
}
use of net.minecraft.world.IServerWorld in project bioplethora by AquexTheSeal.
the class PrimordialStaffItem method releaseUsing.
public void releaseUsing(ItemStack stack, World worldIn, LivingEntity entity, int value) {
super.releaseUsing(stack, worldIn, entity, value);
if (entity instanceof PlayerEntity) {
PlayerEntity playerIn = (PlayerEntity) entity;
BlockPos blockpos = playerIn.blockPosition().offset(worldIn.getRandom().nextBoolean() ? -2 : 2, 0, worldIn.getRandom().nextBoolean() ? 2 : -2);
int i = this.getUseDuration(stack) - value;
if (i >= 10) {
if (worldIn instanceof ServerWorld) {
PrimordialRingEntity ring = BioplethoraEntities.PRIMORDIAL_RING.get().create(worldIn);
ring.moveTo(blockpos, 0.0F, 0.0F);
ring.setOwner(playerIn);
ring.finalizeSpawn((IServerWorld) worldIn, worldIn.getCurrentDifficultyAt(blockpos), SpawnReason.MOB_SUMMONED, null, null);
ring.setHasLimitedLife(true);
ring.setLifeLimitBeforeDeath(hellConfig ? 1000 : 850 + playerIn.getRandom().nextInt(200));
worldIn.addFreshEntity(ring);
PrimordialRingEntity ring2 = BioplethoraEntities.PRIMORDIAL_RING.get().create(worldIn);
ring2.moveTo(blockpos, 0.0F, 0.0F);
ring2.setOwner(playerIn);
ring2.finalizeSpawn((IServerWorld) worldIn, worldIn.getCurrentDifficultyAt(blockpos), SpawnReason.MOB_SUMMONED, null, null);
ring2.setHasLimitedLife(true);
ring2.setLifeLimitBeforeDeath(hellConfig ? 1000 : 850 + playerIn.getRandom().nextInt(200));
worldIn.addFreshEntity(ring2);
}
worldIn.playSound(null, blockpos, SoundEvents.GHAST_SHOOT, SoundCategory.PLAYERS, 1, 1);
if (worldIn instanceof ServerWorld) {
((ServerWorld) worldIn).sendParticles(ParticleTypes.POOF, (playerIn.getX()), (playerIn.getY()), (playerIn.getZ()), 100, 0.65, 0.65, 0.65, 0.01);
}
if (!playerIn.isCreative()) {
playerIn.getCooldowns().addCooldown(stack.getItem(), hellConfig ? 500 : 450 + playerIn.getRandom().nextInt(200));
}
}
}
}
use of net.minecraft.world.IServerWorld in project ChaosAwakens by ChaosAwakens.
the class EntEntity method finalizeSpawn.
@Override
public ILivingEntityData finalizeSpawn(IServerWorld worldIn, DifficultyInstance difficultyIn, SpawnReason reason, @Nullable ILivingEntityData spawnDataIn, @Nullable CompoundNBT dataTag) {
// Only allow the ENT to wander when spawned outside the tree
if (worldIn instanceof ServerWorld) {
BlockPos pos = this.getOnPos();
StructureManager strucManager = worldIn.getLevel().structureFeatureManager();
boolean inDungeon = strucManager.getStructureAt(pos, false, CAStructures.ACACIA_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.BIRCH_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.CRIMSON_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.DARK_OAK_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.JUNGLE_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.OAK_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.SPRUCE_ENT_TREE.get()).isValid() || strucManager.getStructureAt(pos, false, CAStructures.WARPED_ENT_TREE.get()).isValid();
if (!inDungeon || reason != SpawnReason.STRUCTURE) {
this.goalSelector.addGoal(4, new RandomWalkingGoal(this, 1.6));
}
}
return super.finalizeSpawn(worldIn, difficultyIn, reason, spawnDataIn, dataTag);
}
Aggregations