Miscellaneous cleanup and commenting
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ItemSpellBook extends Item {
|
||||
|
||||
@Override
|
||||
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> 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++){
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
@@ -72,7 +72,8 @@ public final class ParticleBuilder {
|
||||
/** Single pixel particle.<p><b>Defaults:</b><p>Lifetime: 16-80 ticks<br>Colour: white */ DUST,
|
||||
/** Rapid flash, like fireworks.<p><b>Defaults:</b><p>Lifetime: 4 ticks<br>Colour: white */ FLASH,
|
||||
/** Small shard of ice.<p><b>Defaults:</b><p>Lifetime: 8-40 ticks<br>Gravity: true */ ICE,
|
||||
/** Single green/brown leaf.<p><b>Defaults:</b><p>Lifetime: 10-15 ticks<br>Velocity: (0, -0.03, 0) */ LEAF,
|
||||
/** Single leaf.<p><b>Defaults:</b><p>Lifetime: 10-15 ticks<br>Velocity: (0, -0.03, 0)
|
||||
* <br>Colour: green/brown */ LEAF,
|
||||
/** Bubble that doesn't burst in air.<p><b>Defaults:</b><p>Lifetime: 8-40 ticks */ MAGIC_BUBBLE,
|
||||
/** Scaleable, moving flame.<p><b>Defaults:</b><p>Lifetime: 8-40 ticks<br> */ MAGIC_FIRE,
|
||||
/** Soft-edged round particle.<p><b>Defaults:</b><p>Lifetime: 8-40 ticks<br>Colour: white */ PATH,
|
||||
|
||||
@@ -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 <b>not</b> account for the individual or total upgrade stack limits.
|
||||
* does <b>not</b> 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){
|
||||
|
||||
|
||||
@@ -545,6 +545,7 @@ public final class WizardryUtilities {
|
||||
* private. (You <i>could</i> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user