From 106148fd9ee8cb758f272d59792b8198d1aaad17 Mon Sep 17 00:00:00 2001 From: Electroblob <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 20 Jun 2018 23:28:56 +0100 Subject: [PATCH] Miscellaneous cleanup and commenting --- .../java/electroblob/wizardry/WizardData.java | 3 +-- .../wizardry/client/ClientProxy.java | 24 +++++++++---------- .../wizardry/entity/EntityMeteor.java | 3 +-- .../wizardry/entity/living/EntityWizard.java | 2 +- .../electroblob/wizardry/item/ItemScroll.java | 1 - .../wizardry/util/ParticleBuilder.java | 9 +++++-- .../wizardry/util/WizardryUtilities.java | 4 ++-- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/src/main/java/electroblob/wizardry/WizardData.java b/src/main/java/electroblob/wizardry/WizardData.java index 03ef8f86..bd779fef 100644 --- a/src/main/java/electroblob/wizardry/WizardData.java +++ b/src/main/java/electroblob/wizardry/WizardData.java @@ -526,8 +526,7 @@ public class WizardData implements INBTSerializable { // THIS is why I wrote the list/map <-> NBT methods. Look how neat this is! properties.setTag("allies", WizardryUtilities.listToNBT(this.allies, WizardryUtilities::UUIDtoTagCompound)); properties.setTag("allyNames", WizardryUtilities.listToNBT(this.allyNames, NBTTagString::new)); - properties.setTag("soulboundCreatures", - WizardryUtilities.listToNBT(this.soulboundCreatures, WizardryUtilities::UUIDtoTagCompound)); + properties.setTag("soulboundCreatures", WizardryUtilities.listToNBT(this.soulboundCreatures, WizardryUtilities::UUIDtoTagCompound)); // Might be worth converting this over to WizardryUtilities.listToNBT. int[] spells = new int[this.spellsDiscovered.size()]; diff --git a/src/main/java/electroblob/wizardry/client/ClientProxy.java b/src/main/java/electroblob/wizardry/client/ClientProxy.java index 411fdc59..5e978c33 100644 --- a/src/main/java/electroblob/wizardry/client/ClientProxy.java +++ b/src/main/java/electroblob/wizardry/client/ClientProxy.java @@ -277,18 +277,18 @@ public class ClientProxy extends CommonProxy { factories = new HashMap<>(); - factories.put(Type.BLIZZARD, (world, x, y, z) -> new ParticleBlizzard(world, x, y, z)); - factories.put(Type.DARK_MAGIC, (world, x, y, z) -> new ParticleDarkMagic(world, x, y, z)); - factories.put(Type.DUST, (world, x, y, z) -> new ParticleDust(world, x, y, z)); - factories.put(Type.FLASH, (world, x, y, z) -> new ParticleFlash(world, x, y, z)); - factories.put(Type.ICE, (world, x, y, z) -> new ParticleIce(world, x, y, z)); - factories.put(Type.LEAF, (world, x, y, z) -> new ParticleLeaf(world, x, y, z)); - factories.put(Type.MAGIC_BUBBLE, (world, x, y, z) -> new ParticleMagicBubble(world, x, y, z)); - factories.put(Type.MAGIC_FIRE, (world, x, y, z) -> new ParticleMagicFlame(world, x, y, z)); - factories.put(Type.PATH, (world, x, y, z) -> new ParticlePath(world, x, y, z)); - factories.put(Type.SNOW, (world, x, y, z) -> new ParticleSnow(world, x, y, z)); - factories.put(Type.SPARK, (world, x, y, z) -> new ParticleSpark(world, x, y, z)); - factories.put(Type.SPARKLE, (world, x, y, z) -> new ParticleSparkle(world, x, y, z)); + factories.put(Type.BLIZZARD, (world, x, y, z) -> new ParticleBlizzard(world, x, y, z)); + factories.put(Type.DARK_MAGIC, (world, x, y, z) -> new ParticleDarkMagic(world, x, y, z)); + factories.put(Type.DUST, (world, x, y, z) -> new ParticleDust(world, x, y, z)); + factories.put(Type.FLASH, (world, x, y, z) -> new ParticleFlash(world, x, y, z)); + factories.put(Type.ICE, (world, x, y, z) -> new ParticleIce(world, x, y, z)); + factories.put(Type.LEAF, (world, x, y, z) -> new ParticleLeaf(world, x, y, z)); + factories.put(Type.MAGIC_BUBBLE, (world, x, y, z) -> new ParticleMagicBubble(world, x, y, z)); + factories.put(Type.MAGIC_FIRE, (world, x, y, z) -> new ParticleMagicFlame(world, x, y, z)); + factories.put(Type.PATH, (world, x, y, z) -> new ParticlePath(world, x, y, z)); + factories.put(Type.SNOW, (world, x, y, z) -> new ParticleSnow(world, x, y, z)); + factories.put(Type.SPARK, (world, x, y, z) -> new ParticleSpark(world, x, y, z)); + factories.put(Type.SPARKLE, (world, x, y, z) -> new ParticleSparkle(world, x, y, z)); factories.put(Type.SPARKLE_ROTATING, (world, x, y, z) -> new ParticleRotatingSparkle(world, x, y, z)); } diff --git a/src/main/java/electroblob/wizardry/entity/EntityMeteor.java b/src/main/java/electroblob/wizardry/entity/EntityMeteor.java index 53e3a87d..14784b3f 100644 --- a/src/main/java/electroblob/wizardry/entity/EntityMeteor.java +++ b/src/main/java/electroblob/wizardry/entity/EntityMeteor.java @@ -17,8 +17,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; public class EntityMeteor extends EntityFallingBlock { /** - * The entity blast multiplier. Only some projectiles cause a blast, which is why this isn't in - * EntityMagicProjectile. + * The entity blast multiplier. */ public float blastMultiplier; diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java index 339e6f41..9c3a474f 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java @@ -134,7 +134,7 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp this.tasks.addTask(0, new EntityAISwimming(this)); // Why would you go to the effort of making the IMerchant interface and then have the AI classes only accept - // EntityVillager? N + // EntityVillager? this.tasks.addTask(1, new EntityAITradePlayer(this)); this.tasks.addTask(1, new EntityAILookAtTradePlayer(this)); this.tasks.addTask(4, new EntityAIRestrictOpenDoor(this)); diff --git a/src/main/java/electroblob/wizardry/item/ItemScroll.java b/src/main/java/electroblob/wizardry/item/ItemScroll.java index 079927d5..e70f730e 100644 --- a/src/main/java/electroblob/wizardry/item/ItemScroll.java +++ b/src/main/java/electroblob/wizardry/item/ItemScroll.java @@ -60,7 +60,6 @@ public class ItemScroll extends Item { * server side, but the result to then be sent to the client, which means broken discovery system. Simply put, I * can't predict that, and it's not my job to cater for other people's incorrect usage of code, especially when * that might compromise some perfectly reasonable use (think Bibliocraft's 'best guess' book detection). */ - // TODO: Backport this proxy-based fix. return Wizardry.proxy.getScrollDisplayName(stack); } diff --git a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java index 0b7e7c10..a4ea6725 100644 --- a/src/main/java/electroblob/wizardry/util/ParticleBuilder.java +++ b/src/main/java/electroblob/wizardry/util/ParticleBuilder.java @@ -32,7 +32,7 @@ import net.minecraft.world.World; *

* ParticleBuilder.create(Type.SPARKLE).pos(x, y, z).vel(vx, vy, vz).colour(r, g, b).spawn(world); * @author Electroblob - * @since Wizardry 4.2.0 + * @since Wizardry 4.2 */ public final class ParticleBuilder { @@ -58,7 +58,7 @@ public final class ParticleBuilder { private Entity entity; /** Enum constants representing the different types of particle added by wizardry. As of 4.2.0, this has been moved - * from its own file {@code Type} to inside {@link ParticleBuilder}. This allowed its name to be + * from its own file {@code WizardryParticleType} to inside {@link ParticleBuilder}. This allowed its name to be * shortened to simply {@code Type}, making most references more concise. References in classes where another * {@code Type} is also used can simply refer to the full name, {@code ParticleBuilder.Type}, which is no more verbose * than before. @@ -87,6 +87,11 @@ public final class ParticleBuilder { // Convenience methods + // These may seem to go against the whole point of this class, but of course they return the ParticleBuilder instance + // so anything else can still be chained onto them - centralising commonly-used particle spawning patterns without + // losing any of the flexibility of the particle builder. In addition, callers of these methods are still free to + // change any of the parameters that were set within them afterwards. + /** * Starts building a particle of the given type. Static convenience version of * {@link ParticleBuilder#particle(Type)}; makes code more concise. diff --git a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java index 6fc8622d..d9578fd6 100644 --- a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java +++ b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java @@ -464,7 +464,7 @@ public final class WizardryUtilities { /** * Returns a list of the itemstacks in the given player's hotbar and offhand, sorted into the following order: main - * hand, offhand, rest of hotbar left-to-right. The returned list is a modifiable copy of part of the player's + * hand, offhand, rest of hotbar left-to-right. The returned list is a modifiable shallow copy of part of the player's * inventory stack list; as such, changes to the list are not written through to the player's inventory. * However, the ItemStack instances themselves are not copied, so changes to any of their fields (size, metadata...) * will change those in the player's inventory. @@ -983,7 +983,7 @@ public final class WizardryUtilities { *

* As of wizardry 4.1.2, this method now returns true instead of false if the attacker is null. This * is because in the vast majority of cases, it makes more sense this way: if a construct has no caster, it - * should affect all entities; if a minion has no caster is should target all entities; etc. + * should affect all entities; if a minion has no caster it should target all entities; etc. */ public static boolean isValidTarget(Entity attacker, Entity target){