Add icarus medallion and void opal

This commit is contained in:
Electroblob77
2020-05-22 12:49:45 +01:00
parent dd137c68f6
commit 5a57e8341a
12 changed files with 95 additions and 9 deletions
@@ -9,6 +9,7 @@ import electroblob.wizardry.data.WizardData;
import electroblob.wizardry.item.ISpellCastingItem;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.item.ItemSpectralBow;
import electroblob.wizardry.item.ItemWand;
import electroblob.wizardry.potion.PotionSlowTime;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
@@ -173,6 +174,14 @@ public final class WizardryClientEventHandler {
event.getMovementInput().jump = false;
event.getMovementInput().sneak = false;
}
if(ItemArtefact.isArtefactActive(event.getEntityPlayer(), WizardryItems.charm_move_speed)
&& event.getEntityPlayer().isHandActive()
&& event.getEntityPlayer().getActiveItemStack().getItem() instanceof ItemWand){
// Normally speed is set to 20% when using items, this makes it 80%
event.getMovementInput().moveStrafe *= 4;
event.getMovementInput().moveForward *= 4;
}
}
@SubscribeEvent
@@ -279,6 +279,7 @@ public final class WizardryModels {
registerItemModel(WizardryItems.charm_haggler);
registerItemModel(WizardryItems.charm_experience_tome);
registerItemModel(WizardryItems.charm_move_speed);
registerItemModel(WizardryItems.charm_auto_smelt);
registerItemModel(WizardryItems.charm_lava_walking);
registerItemModel(WizardryItems.charm_storm);
@@ -291,6 +292,7 @@ public final class WizardryModels {
registerItemModel(WizardryItems.charm_stop_time);
registerItemModel(WizardryItems.charm_light);
registerItemModel(WizardryItems.charm_transportation);
registerItemModel(WizardryItems.charm_black_hole);
registerItemModel(WizardryItems.charm_feeding);
}
@@ -1,19 +1,25 @@
package electroblob.wizardry.entity.construct;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.EntityLevitatingBlock;
import electroblob.wizardry.item.ItemArtefact;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardrySounds;
import electroblob.wizardry.util.MagicDamage;
import electroblob.wizardry.util.MagicDamage.DamageType;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.SPacketEntityVelocity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -82,10 +88,42 @@ public class EntityBlackHole extends EntityMagicConstruct {
if(!this.world.isRemote){
List<EntityLivingBase> targets = WizardryUtilities.getEntitiesWithinRadius(6.0d, this.posX, this.posY,
this.posZ, this.world);
double radius = 6; // TODO: Support for spell properties and modifiers
for(EntityLivingBase target : targets){
boolean suckInBlocks = getCaster() instanceof EntityPlayer && WizardryUtilities.canDamageBlocks(getCaster(), world)
&& ItemArtefact.isArtefactActive((EntityPlayer)getCaster(), WizardryItems.charm_black_hole);
if(suckInBlocks){
List<BlockPos> sphere = WizardryUtilities.getBlockSphere(new BlockPos(this), radius);
for(BlockPos pos : sphere){
if(rand.nextInt(Math.max(1, (int)this.getDistanceSq(pos) * 3)) == 0){
if(!WizardryUtilities.isBlockUnbreakable(world, pos) && !world.isAirBlock(pos)
&& world.isBlockNormalCube(pos, false)){
// Checks that the block above is not solid, since this causes the falling block to vanish.
// && !world.isBlockNormalCube(pos.up(), false)){
EntityFallingBlock fallingBlock = new EntityLevitatingBlock(world, pos.getX() + 0.5,
pos.getY() + 0.5, pos.getZ() + 0.5, world.getBlockState(pos));
// fallingBlock.noClip = true;
fallingBlock.fallTime = 1; // Prevent it from trying to delete the block itself
world.spawnEntity(fallingBlock);
world.setBlockToAir(pos);
}
}
}
}
List<Entity> targets = WizardryUtilities.getEntitiesWithinRadius(radius, this.posX, this.posY,
this.posZ, this.world, Entity.class);
targets.removeIf(t -> !(t instanceof EntityLivingBase || (suckInBlocks && t instanceof EntityFallingBlock)));
for(Entity target : targets){
if(this.isValidTarget(target)){
@@ -94,6 +132,7 @@ public class EntityBlackHole extends EntityMagicConstruct {
|| ItemArtefact.isArtefactActive((EntityPlayer)target, WizardryItems.amulet_anchoring)))){
WizardryUtilities.undoGravity(target);
if(target instanceof EntityLevitatingBlock) ((EntityLevitatingBlock)target).suspend();
// Sucks the target in
if(this.posX > target.posX && target.motionX < 1){
@@ -121,13 +160,22 @@ public class EntityBlackHole extends EntityMagicConstruct {
}
if(this.getDistance(target) <= 2){
// Damages the target if it is close enough
if(this.getCaster() != null){
target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
2 * damageMultiplier);
// Damages the target if it is close enough, or destroys it if it's a block
if(target instanceof EntityFallingBlock){
target.playSound(WizardrySounds.ENTITY_BLACK_HOLE_BREAK_BLOCK, 0.5f,
(rand.nextFloat() - rand.nextFloat()) * 0.2f + 1);
IBlockState state = ((EntityFallingBlock)target).getBlock();
if(state != null) world.playEvent(2001, new BlockPos(target), Block.getStateId(state));
target.setDead();
}else{
target.attackEntityFrom(DamageSource.MAGIC, 2 * damageMultiplier);
if(this.getCaster() != null){
target.attackEntityFrom(
MagicDamage.causeIndirectMagicDamage(this, getCaster(), DamageType.MAGIC),
2 * damageMultiplier);
}else{
target.attackEntityFrom(DamageSource.MAGIC, 2 * damageMultiplier);
}
}
}
}
@@ -262,6 +262,7 @@ public final class WizardryItems {
public static final Item charm_haggler = placeholder();
public static final Item charm_experience_tome = placeholder();
public static final Item charm_move_speed = placeholder();
public static final Item charm_auto_smelt = placeholder();
public static final Item charm_lava_walking = placeholder();
public static final Item charm_storm = placeholder();
@@ -274,6 +275,7 @@ public final class WizardryItems {
public static final Item charm_stop_time = placeholder();
public static final Item charm_light = placeholder();
public static final Item charm_transportation = placeholder();
public static final Item charm_black_hole = placeholder();
public static final Item charm_feeding = placeholder();
private static final Map<Pair<Tier, Element>, Item> WAND_MAP = new HashMap<>();
@@ -612,6 +614,7 @@ public final class WizardryItems {
registerItem(registry, "charm_haggler", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_experience_tome", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_move_speed", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_auto_smelt", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_lava_walking", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_storm", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
@@ -624,6 +627,7 @@ public final class WizardryItems {
registerItem(registry, "charm_stop_time", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_light", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_transportation", new ItemArtefact(EnumRarity.RARE, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_black_hole", new ItemArtefact(EnumRarity.EPIC, ItemArtefact.Type.CHARM));
registerItem(registry, "charm_feeding", new ItemArtefact(EnumRarity.UNCOMMON, ItemArtefact.Type.CHARM));
}
@@ -41,6 +41,7 @@ public final class WizardrySounds {
public static final SoundEvent ENTITY_BLACK_HOLE_AMBIENT = createSound("entity.black_hole.ambient");
public static final SoundEvent ENTITY_BLACK_HOLE_VANISH = createSound("entity.black_hole.vanish");
public static final SoundEvent ENTITY_BLACK_HOLE_BREAK_BLOCK = createSound("entity.black_hole.break_block");
public static final SoundEvent ENTITY_BUBBLE_POP = createSound("entity.bubble.pop");
public static final SoundEvent ENTITY_BLIZZARD_AMBIENT = createSound("entity.blizzard.ambient");
public static final SoundEvent ENTITY_DECAY_AMBIENT = createSound("entity.decay.ambient");
@@ -176,6 +177,7 @@ public final class WizardrySounds {
event.getRegistry().register(ENTITY_BLACK_HOLE_AMBIENT);
event.getRegistry().register(ENTITY_BLACK_HOLE_VANISH);
event.getRegistry().register(ENTITY_BLACK_HOLE_BREAK_BLOCK);
event.getRegistry().register(ENTITY_BUBBLE_POP);
event.getRegistry().register(ENTITY_BLIZZARD_AMBIENT);
event.getRegistry().register(ENTITY_DECAY_AMBIENT);