diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index dea4cf36..42b156ca 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -63,6 +63,7 @@ public class Wizardry { // IDEA: Improve the algorithm that finds a place to summon creatures to take walls into account. // IDEA: Replace all uses of Math.cos and Math.sin with MathHelper versions // IDEA: Triggering of inbuilt Forge events in relevant places? + // IDEA: Abstract the vanilla particles behind the particle builder /* Minor bugs that need fixing at some point: * - Player skin hat layer shows through wizard hats - Wizard armour breaks rather than just running out of mana (I @@ -78,6 +79,15 @@ public class Wizardry { // TODO: Switch from IInventory to IItemHandler (Or don't. It's only useful for automation really.) // TODO: Have particles obey Minecraft's particle setting where appropriate // (see https://github.com/RootsTeam/Embers/blob/master/src/main/java/teamroots/embers/particle/ParticleUtil.java) + // TODO: Interfaces for various things, like 'stuff that can be put in the central slot of an arcane workbench' + // TODO: Go over all the worldgen code, use IWorldGenerator + // TODO: Implement a continuous sound system using MovingSoundEntity, allowing continuous spells to have a long sound + // loop as well as a start and end sound + // TODO: EntityMagicArrow needs attention + // TODO: Go over particle spawning on projectile impact and make sure hitvec is used wherever appropriate + // TODO: Replace spell IDs in packets with ResourceLocation strings + // TODO: Forcefield needs looking at, esp. with regards to projectiles and explosions + // TODO: TileEntityArcaneWorkbench needs looking at, esp. regarding inventory and markDirty // NOTE: Add melee upgrades to loot tables when they are added. diff --git a/src/main/java/electroblob/wizardry/constants/Tier.java b/src/main/java/electroblob/wizardry/constants/Tier.java index 6c7d8958..8d9c0e77 100644 --- a/src/main/java/electroblob/wizardry/constants/Tier.java +++ b/src/main/java/electroblob/wizardry/constants/Tier.java @@ -10,10 +10,10 @@ import net.minecraftforge.fml.relauncher.SideOnly; public enum Tier { - BASIC(700, 3, 12, new Style().setColor(TextFormatting.WHITE), "basic"), APPRENTICE(1000, 4, 5, - new Style().setColor(TextFormatting.AQUA), "apprentice"), ADVANCED(1500, 5, 2, - new Style().setColor(TextFormatting.DARK_BLUE), - "advanced"), MASTER(2500, 6, 1, new Style().setColor(TextFormatting.DARK_PURPLE), "master"); + BASIC(700, 3, 12, new Style().setColor(TextFormatting.WHITE), "basic"), + APPRENTICE(1000, 5, 5, new Style().setColor(TextFormatting.AQUA), "apprentice"), + ADVANCED(1500, 7, 2, new Style().setColor(TextFormatting.DARK_BLUE), "advanced"), + MASTER(2500, 9, 1, new Style().setColor(TextFormatting.DARK_PURPLE), "master"); /** Maximum mana a wand of this tier can store. */ public final int maxCharge; diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java index 02eafdb6..cec42cf3 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityDart.java @@ -15,7 +15,7 @@ public class EntityDart extends EntityMagicArrow { super(world); } - @Override public double getDamage(){ return 4.0d; } + @Override public double getDamage(){ return 4; } @Override public boolean doGravity(){ return true; } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java index 483d1c55..936acacc 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceShard.java @@ -17,7 +17,7 @@ public class EntityIceShard extends EntityMagicArrow { super(world); } - @Override public double getDamage(){ return 6.0d; } + @Override public double getDamage(){ return 6; } @Override public DamageType getDamageType(){ return DamageType.FROST; } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java index 64091a91..bf2e5166 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicArrow.java @@ -252,6 +252,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE this.ticksInGround = 0; ++this.ticksInAir; + + // Does a ray trace to determine whether the projectile will hit a block in the next tick + Vec3d vec3d1 = new Vec3d(this.posX, this.posY, this.posZ); Vec3d vec3d = new Vec3d(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); RayTraceResult raytraceresult = this.world.rayTraceBlocks(vec3d1, vec3d, false, true, false); @@ -262,6 +265,9 @@ public abstract class EntityMagicArrow extends Entity implements IProjectile, IE vec3d = new Vec3d(raytraceresult.hitVec.x, raytraceresult.hitVec.y, raytraceresult.hitVec.z); } + + // Uses bounding boxes to determine whether the projectile will hit an entity in the next tick, and if so + // overwrites the block hit with an entity Entity entity = null; List list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox() diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicMissile.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicMissile.java index e2ccd32b..60a3e60b 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicMissile.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicMissile.java @@ -13,7 +13,7 @@ public class EntityMagicMissile extends EntityMagicArrow { super(world); } - @Override public double getDamage(){ return 4.0d; } + @Override public double getDamage(){ return 4; } @Override public boolean doGravity(){ return false; } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java index 0045eb34..93e5b9ef 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicProjectile.java @@ -70,6 +70,7 @@ public abstract class EntityMagicProjectile extends EntityThrowable implements I // Depends on the horizontal distance between the two entities and accounts for bullet drop, // but of course if gravity is ignored this should be 0 since there is no bullet drop. float bulletDropCompensation = !this.hasNoGravity() ? (float)horizontalDistance * 0.2f : 0; + // It turns out that this method normalises the input (x, y, z) anyway this.shoot(dx, dy + (double)bulletDropCompensation, dz, speed, aimingError); } } diff --git a/src/main/java/electroblob/wizardry/item/ItemSpellBook.java b/src/main/java/electroblob/wizardry/item/ItemSpellBook.java index eb785366..b43d5889 100644 --- a/src/main/java/electroblob/wizardry/item/ItemSpellBook.java +++ b/src/main/java/electroblob/wizardry/item/ItemSpellBook.java @@ -36,7 +36,7 @@ public class ItemSpellBook extends Item { @Override public void getSubItems(CreativeTabs tab, NonNullList list){ - if (isInCreativeTab(tab)) { + if(isInCreativeTab(tab)) { // In this particular case, getTotalSpellCount() is a more efficient way of doing this since the spell instance // is not required, only the id. for(int i = 0; i < Spell.getTotalSpellCount(); i++){ diff --git a/src/main/java/electroblob/wizardry/item/ItemWand.java b/src/main/java/electroblob/wizardry/item/ItemWand.java index bdc1d183..d772ad55 100644 --- a/src/main/java/electroblob/wizardry/item/ItemWand.java +++ b/src/main/java/electroblob/wizardry/item/ItemWand.java @@ -167,7 +167,7 @@ public class ItemWand extends Item implements IWorkbenchItem { text.add("\u00A77" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":wand.spell", discovered ? "\u00A77" + spell.getDisplayNameWithFormatting() - : "#\u00A79" + SpellGlyphData.getGlyphName(spell, player.world))); + : "#\u00A79" + SpellGlyphData.getGlyphName(spell, player.world))); text.add("\u00A79" + net.minecraft.client.resources.I18n.format("item." + Wizardry.MODID + ":wand.mana", (this.getMaxDamage(itemstack) - this.getDamage(itemstack)), this.getMaxDamage(itemstack))); @@ -208,7 +208,7 @@ public class ItemWand extends Item implements IWorkbenchItem { // Conditions for the spell to be attempted. The tier check is a failsafe; it should never be false unless the // NBT is modified directly. if(!spell.isContinuous && spell.tier.level <= this.tier.level - // Checks that the wand has enough mana to cast the spell + // Checks that the wand has enough mana to cast the spell && spell.cost <= (stack.getMaxDamage() - stack.getItemDamage()) // Checks that the spell is not in cooldown or that the player is in creative mode && (WandHelper.getCurrentCooldown(stack) == 0 || player.capabilities.isCreativeMode)){ @@ -238,7 +238,7 @@ public class ItemWand extends Item implements IWorkbenchItem { float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(stack, WizardryItems.cooldown_upgrade) - * Constants.COOLDOWN_REDUCTION_PER_LEVEL; + * Constants.COOLDOWN_REDUCTION_PER_LEVEL; if(player.isPotionActive(WizardryPotions.font_of_mana)){ // Dividing by this rather than setting it takes upgrades and font of mana into account diff --git a/src/main/java/electroblob/wizardry/spell/Wither.java b/src/main/java/electroblob/wizardry/spell/Wither.java index bd356785..3cacf432 100644 --- a/src/main/java/electroblob/wizardry/spell/Wither.java +++ b/src/main/java/electroblob/wizardry/spell/Wither.java @@ -23,6 +23,7 @@ import net.minecraft.world.World; public class Wither extends SpellRay { private static final int BASE_DURATION = 200; + private static final int BASE_DAMAGE = 1; public Wither(){ super("wither", Tier.APPRENTICE, Element.NECROMANCY, SpellType.ATTACK, 10, 20, false, 10, SoundEvents.ENTITY_WITHER_HURT); @@ -40,7 +41,7 @@ public class Wither extends SpellRay { this.getNameForTranslationFormatted())); }else{ target.attackEntityFrom(MagicDamage.causeDirectMagicDamage(caster, DamageType.WITHER), - 1.0f * modifiers.get(SpellModifiers.POTENCY)); + BASE_DAMAGE * modifiers.get(SpellModifiers.POTENCY)); ((EntityLivingBase)target).addPotionEffect(new PotionEffect(MobEffects.WITHER, (int)(BASE_DURATION * modifiers.get(WizardryItems.duration_upgrade)), 1)); } diff --git a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java index 880b437f..d88cd00f 100644 --- a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java +++ b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java @@ -72,7 +72,8 @@ public final class ParticleBuilder { /** Single pixel particle.

Defaults:

Lifetime: 16-80 ticks
Colour: white */ DUST, /** Rapid flash, like fireworks.

Defaults:

Lifetime: 4 ticks
Colour: white */ FLASH, /** Small shard of ice.

Defaults:

Lifetime: 8-40 ticks
Gravity: true */ ICE, - /** Single green/brown leaf.

Defaults:

Lifetime: 10-15 ticks
Velocity: (0, -0.03, 0) */ LEAF, + /** Single leaf.

Defaults:

Lifetime: 10-15 ticks
Velocity: (0, -0.03, 0) + *
Colour: green/brown */ LEAF, /** Bubble that doesn't burst in air.

Defaults:

Lifetime: 8-40 ticks */ MAGIC_BUBBLE, /** Scaleable, moving flame.

Defaults:

Lifetime: 8-40 ticks
*/ MAGIC_FIRE, /** Soft-edged round particle.

Defaults:

Lifetime: 8-40 ticks
Colour: white */ PATH, diff --git a/src/main/java/electroblob/wizardry/util/WandHelper.java b/src/main/java/electroblob/wizardry/util/WandHelper.java index 6c47c18a..a98788fb 100644 --- a/src/main/java/electroblob/wizardry/util/WandHelper.java +++ b/src/main/java/electroblob/wizardry/util/WandHelper.java @@ -260,7 +260,8 @@ public final class WandHelper { /** * Applies the given upgrade to the given wand, or in other words increases the level for that upgrade by 1. This - * does not account for the individual or total upgrade stack limits. + * does not account for the individual or total upgrade stack limits or any special behaviour; it only deals + * with the NBT data. */ public static void applyUpgrade(ItemStack wand, Item upgrade){ diff --git a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java index d334e2a2..6cb52655 100644 --- a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java +++ b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java @@ -545,6 +545,7 @@ public final class WizardryUtilities { * private. (You could call {@link EntityCreeper#onStruckByLightning(...)} and then heal it and extinguish * it, but that's a bit awkward.) */ + // The reflection here only gets done once to initialise the POWERED field, so it's not a performance issue at all. public static void chargeCreeper(EntityCreeper creeper){ creeper.getDataManager().set(POWERED, true); }