From 62bdbc81e4354e4bbcf23c20c978b67aaf3d2909 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 15 Mar 2020 19:15:28 +0000 Subject: [PATCH 01/22] Prevent players from picking up items when possessing and prevent players from possessing whilst sneaking, fixes #376 --- .../electroblob/wizardry/spell/Possession.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/electroblob/wizardry/spell/Possession.java b/src/main/java/electroblob/wizardry/spell/Possession.java index d04bd5f7..e464b173 100644 --- a/src/main/java/electroblob/wizardry/spell/Possession.java +++ b/src/main/java/electroblob/wizardry/spell/Possession.java @@ -201,6 +201,8 @@ public class Possession extends SpellRay { */ public boolean possess(EntityPlayer possessor, EntityLiving target, int duration){ + if(possessor.isSneaking()) return false; + if(WizardData.get(possessor) != null){ WizardData.get(possessor).setVariable(POSSESSEE_KEY, target); @@ -683,11 +685,13 @@ public class Possession extends SpellRay { if(possessee != null){ - if(possessee.canPickUpLoot() && possessee.getHeldItemMainhand().isEmpty()){ - possessee.setHeldItem(EnumHand.MAIN_HAND, event.getItem().getItem()); - }else{ - event.setCanceled(true); - } + event.setCanceled(true); + +// if(possessee.canPickUpLoot() && possessee.getHeldItemMainhand().isEmpty()){ +// possessee.setHeldItem(EnumHand.MAIN_HAND, event.getItem().getItem()); +// }else{ +// event.setCanceled(true); +// } } } From 50f315666f63ea7cb51a6bb6eea245510255eabf Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Sun, 15 Mar 2020 19:23:50 +0000 Subject: [PATCH 02/22] Fix spanish handbook translations, fixes #365 --- .../ebwizardry/texts/handbook_es_es.json | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/resources/assets/ebwizardry/texts/handbook_es_es.json b/src/main/resources/assets/ebwizardry/texts/handbook_es_es.json index 58eb4654..a8b933ab 100644 --- a/src/main/resources/assets/ebwizardry/texts/handbook_es_es.json +++ b/src/main/resources/assets/ebwizardry/texts/handbook_es_es.json @@ -1,6 +1,6 @@ { - "bookmark_start_section": "introduccion", - + "bookmark_start_section": "introduction", + "colours": { "text": "#000000", "caption": "#666666", @@ -8,7 +8,7 @@ "highlight": "#dd4c1d", "new_section": "#ee88f7" }, - + "images": { "workbench": { "location": "ebwizardry:textures/gui/arcane_workbench_picture.png", @@ -226,26 +226,26 @@ "locations": [ "ebwizardry:spark_bomb" ] } }, - + "sections": { - + "inside_cover": { "centre": { "x": true, "y": true }, "text": [ - + "El Manual del Mago", - + "Por Electroblob" ] }, - + "introduction": { "title": "Introduccion", "text": [ - + "¡Saludos Mago! Este libro te mostrara los secretos de las artes arcanas, y de cómo usarlas. Este no es un libro común y corriente, ya que su conocimiento y sus páginas aumentarán a medida que descubres más y más sobre mundo mágico.", "Utiliza los botones en forma de flecha para pasar la página, y los botones de doble flecha para pasar de una sección a otra. Usa el botón de menú central para regresar al índice.", @@ -676,13 +676,13 @@ "ebwizardry:enchant_scroll" ], "text": [ - + "Experimentación reciente ha revelado que es posible automatizar la conjuración de @spells hechizos@, hasta cierto punto, usando nada mas que un dispensador simple. Nadie sabe porque, pero parece que las extrañas propiedades de la piedra roja se extienden hasta la conjuración de un pergamino de hechizo. Poniendo un par de estos en un dispensador y dándole poder serviría como una buena trampa…." ] } } }, - + "crafting_recipes": { "title": "Recetas para crafteos", "include_in_contents": "main_contents", @@ -714,12 +714,12 @@ "#recipe spark_bomb" ] }, - + "credits": { "title": "Creditos", "include_in_contents": "main_contents", "text": [ - + "Electroblob's Wizardry \nVersion #version \nPara Minecraft #mcversion", "Diseñado, programado y texturizado por Electroblob", @@ -745,6 +745,6 @@ "¿Te encanta este mod? ¡unete al @https://discord.gg/MTmMzMv servidor de Discord@ para las ultimas noticias,discusiones y extras!" ] } - + } } \ No newline at end of file From 9ed06c9a346ef84a07219e87c047dcb36c702b36 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 22:34:34 +0000 Subject: [PATCH 03/22] Stop wizards casting heal ally --- src/main/java/electroblob/wizardry/spell/HealAlly.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/electroblob/wizardry/spell/HealAlly.java b/src/main/java/electroblob/wizardry/spell/HealAlly.java index ffcbf274..2a31ad2e 100644 --- a/src/main/java/electroblob/wizardry/spell/HealAlly.java +++ b/src/main/java/electroblob/wizardry/spell/HealAlly.java @@ -4,6 +4,7 @@ import electroblob.wizardry.util.ParticleBuilder; import electroblob.wizardry.util.SpellModifiers; import electroblob.wizardry.util.WizardryUtilities; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumAction; import net.minecraft.util.EnumFacing; @@ -19,6 +20,11 @@ public class HealAlly extends SpellRay { addProperties(HEALTH); } + @Override + public boolean canBeCastBy(EntityLiving npc, boolean override){ + return false; + } + @Override protected boolean onEntityHit(World world, Entity target, Vec3d hit, EntityLivingBase caster, Vec3d origin, int ticksInUse, SpellModifiers modifiers){ From 5f21b565cd68a417a9a8eb6b0fc500216e0c9451 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 22:44:30 +0000 Subject: [PATCH 04/22] Make fireballs, large fireballs and iceballs respect the playerBlockDamage config option --- .../wizardry/entity/projectile/EntityIceball.java | 9 +-------- .../entity/projectile/EntityLargeMagicFireball.java | 3 ++- .../entity/projectile/EntityMagicFireball.java | 10 ++-------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceball.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceball.java index 7a34b09d..f3989ffa 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityIceball.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityIceball.java @@ -9,7 +9,6 @@ import electroblob.wizardry.util.MagicDamage.DamageType; import electroblob.wizardry.util.ParticleBuilder; import electroblob.wizardry.util.WizardryUtilities; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.init.Blocks; import net.minecraft.potion.PotionEffect; @@ -48,13 +47,7 @@ public class EntityIceball extends EntityMagicProjectile { }else{ - boolean flag = true; - - if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){ - flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower()); - } - - if(flag){ + if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){ BlockPos pos = rayTrace.getBlockPos(); diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityLargeMagicFireball.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityLargeMagicFireball.java index e78574a4..4a4d9b43 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityLargeMagicFireball.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityLargeMagicFireball.java @@ -3,6 +3,7 @@ package electroblob.wizardry.entity.projectile; import electroblob.wizardry.Wizardry; import electroblob.wizardry.registry.Spells; import electroblob.wizardry.spell.Spell; +import electroblob.wizardry.util.WizardryUtilities; import io.netty.buffer.ByteBuf; import net.minecraft.entity.projectile.EntityLargeFireball; import net.minecraft.nbt.NBTTagCompound; @@ -50,7 +51,7 @@ public class EntityLargeMagicFireball extends EntityMagicFireball { protected void onImpact(RayTraceResult rayTrace){ if(!world.isRemote){ - boolean flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.thrower); + boolean flag = this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world); this.world.newExplosion(null, this.posX, this.posY, this.posZ, getExplosionPower() * blastMultiplier, flag, flag); } diff --git a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicFireball.java b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicFireball.java index 5cd2e175..96d98607 100644 --- a/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicFireball.java +++ b/src/main/java/electroblob/wizardry/entity/projectile/EntityMagicFireball.java @@ -6,9 +6,9 @@ import electroblob.wizardry.spell.Spell; import electroblob.wizardry.util.MagicDamage; import electroblob.wizardry.util.MagicDamage.DamageType; import electroblob.wizardry.util.ParticleBuilder; +import electroblob.wizardry.util.WizardryUtilities; import io.netty.buffer.ByteBuf; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.projectile.EntitySmallFireball; import net.minecraft.init.Blocks; @@ -84,13 +84,7 @@ public class EntityMagicFireball extends EntityMagicProjectile { }else{ - boolean flag = true; - - if(this.getThrower() != null && this.getThrower() instanceof EntityLiving){ - flag = net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.world, this.getThrower()); - } - - if(flag){ + if(this.getThrower() == null || WizardryUtilities.canDamageBlocks(this.getThrower(), world)){ BlockPos blockpos = rayTrace.getBlockPos().offset(rayTrace.sideHit); From d797e724456e9315043c9665422379c444cad028 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:13:17 +0000 Subject: [PATCH 05/22] Reduce rarity of all structures a bit --- src/main/java/electroblob/wizardry/Settings.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index bfc1db4e..b4dafbab 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -94,7 +94,7 @@ public final class Settings { /** [Server-only] List of dimension ids in which to generate wizard towers. */ public int[] towerDimensions = {0}; /** [Server-only] The rarity of wizard towers, used by the world generator. Larger numbers are rarer. */ - public int towerRarity = 900; + public int towerRarity = 700; /** [Server-only] List of structure file locations for wizard towers without loot chests. */ public ResourceLocation[] towerFiles = {new ResourceLocation(Wizardry.MODID, "wizard_tower_0"), new ResourceLocation(Wizardry.MODID, "wizard_tower_1"), @@ -108,7 +108,7 @@ public final class Settings { /** [Server-only] List of dimension ids in which to generate obelisks. */ public int[] obeliskDimensions = {0, -1}; /** [Server-only] The rarity of obelisks, used by the world generator. Larger numbers are rarer. */ - public int obeliskRarity = 800; + public int obeliskRarity = 600; /** [Server-only] List of structure file locations for obelisks. */ public ResourceLocation[] obeliskFiles = {new ResourceLocation(Wizardry.MODID, "obelisk_0"), new ResourceLocation(Wizardry.MODID, "obelisk_1"), @@ -118,7 +118,7 @@ public final class Settings { /** [Server-only] List of dimension ids in which to generate shrines. */ public int[] shrineDimensions = {0, -1}; /** [Server-only] The rarity of shrines, used by the world generator. Larger numbers are rarer. */ - public int shrineRarity = 1500; + public int shrineRarity = 1100; /** [Server-only] List of structure file locations for shrines. */ public ResourceLocation[] shrineFiles = {new ResourceLocation(Wizardry.MODID, "shrine_0"), new ResourceLocation(Wizardry.MODID, "shrine_1"), From 85b49b330a40d0cfcfa0c0efd8fe9abea2501a79 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:16:04 +0000 Subject: [PATCH 06/22] Make tomes of arcana more common in obelisks, shrines and wizard towers, and make tomes generated as loot more likely to be apprentice tier --- .../resources/assets/ebwizardry/loot_tables/chests/obelisk.json | 2 +- .../resources/assets/ebwizardry/loot_tables/chests/shrine.json | 2 +- .../assets/ebwizardry/loot_tables/chests/wizard_tower.json | 2 +- .../assets/ebwizardry/loot_tables/subsets/arcane_tomes.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/assets/ebwizardry/loot_tables/chests/obelisk.json b/src/main/resources/assets/ebwizardry/loot_tables/chests/obelisk.json index 7a0a73a4..481b9c33 100644 --- a/src/main/resources/assets/ebwizardry/loot_tables/chests/obelisk.json +++ b/src/main/resources/assets/ebwizardry/loot_tables/chests/obelisk.json @@ -10,7 +10,7 @@ { "type": "loot_table", "name": "ebwizardry:subsets/arcane_tomes", - "weight": 3 + "weight": 4 }, { "type": "loot_table", diff --git a/src/main/resources/assets/ebwizardry/loot_tables/chests/shrine.json b/src/main/resources/assets/ebwizardry/loot_tables/chests/shrine.json index ac3ae19e..933e15ff 100644 --- a/src/main/resources/assets/ebwizardry/loot_tables/chests/shrine.json +++ b/src/main/resources/assets/ebwizardry/loot_tables/chests/shrine.json @@ -31,7 +31,7 @@ { "type": "loot_table", "name": "ebwizardry:subsets/arcane_tomes", - "weight": 6 + "weight": 8 }, { "type": "loot_table", diff --git a/src/main/resources/assets/ebwizardry/loot_tables/chests/wizard_tower.json b/src/main/resources/assets/ebwizardry/loot_tables/chests/wizard_tower.json index 4bb9c235..a003824c 100644 --- a/src/main/resources/assets/ebwizardry/loot_tables/chests/wizard_tower.json +++ b/src/main/resources/assets/ebwizardry/loot_tables/chests/wizard_tower.json @@ -20,7 +20,7 @@ { "type": "loot_table", "name": "ebwizardry:subsets/arcane_tomes", - "weight": 4 + "weight": 5 }, { "type": "loot_table", diff --git a/src/main/resources/assets/ebwizardry/loot_tables/subsets/arcane_tomes.json b/src/main/resources/assets/ebwizardry/loot_tables/subsets/arcane_tomes.json index 404f7402..c9629c35 100644 --- a/src/main/resources/assets/ebwizardry/loot_tables/subsets/arcane_tomes.json +++ b/src/main/resources/assets/ebwizardry/loot_tables/subsets/arcane_tomes.json @@ -8,7 +8,7 @@ "type": "item", "entryName": "apprentice_tome", "name": "ebwizardry:arcane_tome", - "weight": 3, + "weight": 4, "functions": [ { "function": "set_data", From 7f5786c28c4c4cc2cc4964be576c58826eb33e17 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:22:54 +0000 Subject: [PATCH 07/22] Override override override! --- .../java/electroblob/wizardry/client/gui/GuiSpellBook.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java index 560c3160..7fc6f7a1 100644 --- a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java +++ b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java @@ -32,9 +32,7 @@ public class GuiSpellBook extends GuiScreen { this.spell = Spell.byMetadata(stack.getItemDamage()); } - /** - * Draws the screen and all the components in it. - */ + @Override public void drawScreen(int par1, int par2, float par3){ int xPos = this.width / 2 - xSize / 2; @@ -95,6 +93,7 @@ public class GuiSpellBook extends GuiScreen { } } + @Override public void initGui(){ super.initGui(); Keyboard.enableRepeatEvents(true); @@ -103,6 +102,7 @@ public class GuiSpellBook extends GuiScreen { this.mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(WizardrySounds.MISC_BOOK_OPEN, 1)); } + @Override public void onGuiClosed(){ super.onGuiClosed(); Keyboard.enableRepeatEvents(false); From 11efe56437ef2ae4c1c79b7b0b901fe4242a4eb2 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:38:25 +0000 Subject: [PATCH 08/22] Replace old hardcoded spell book text with translation keys, fixes #368 --- .../wizardry/client/gui/GuiSpellBook.java | 23 ++++++++----------- .../assets/ebwizardry/lang/en_gb.lang | 9 +++++++- .../assets/ebwizardry/lang/en_us.lang | 7 ++++++ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java index 7fc6f7a1..2a4e3429 100644 --- a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java +++ b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java @@ -13,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; @@ -67,22 +68,18 @@ public class GuiSpellBook extends GuiScreen { 0x777777); } - //this.fontRenderer.drawString("-------------------", xPos + 17, yPos + 35, 0); + // Novice is usually white but this doesn't show up + String tier = I18n.format("gui.ebwizardry:spell_book.tier", spell.getTier() == Tier.NOVICE ? + "\u00A77" + spell.getTier().getDisplayName() : spell.getTier().getDisplayNameWithFormatting()); + this.fontRenderer.drawString(tier, xPos + 17, yPos + 45, 0); - if(spell.getTier() == Tier.NOVICE){ - // Novice is usually white but this doesn't show up. - this.fontRenderer.drawString("Tier: \u00A77" + Tier.NOVICE.getDisplayName(), xPos + 17, yPos + 45, 0); - }else{ - this.fontRenderer.drawString("Tier: " + spell.getTier().getDisplayNameWithFormatting(), xPos + 17, yPos + 45, 0); - } - - String element = "Element: " + spell.getElement().getFormattingCode() + spell.getElement().getDisplayName(); - if(!discovered) element = "Element: ?"; + String element = I18n.format("gui.ebwizardry:spell_book.tier", spell.getElement().getFormattingCode() + spell.getElement().getDisplayName()); + if(!discovered) element = I18n.format("gui.ebwizardry:spell_book.tier_undiscovered"); this.fontRenderer.drawString(element, xPos + 17, yPos + 57, 0); - String manaCost = "Mana Cost: " + spell.getCost(); - if(spell.isContinuous) manaCost = "Mana Cost: " + spell.getCost() + "/second"; - if(!discovered) manaCost = "Mana Cost: ?"; + String manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost", spell.getCost()); + if(spell.isContinuous) manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost_continuous", spell.getCost()); + if(!discovered) manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost_undiscovered"); this.fontRenderer.drawString(manaCost, xPos + 17, yPos + 69, 0); if(discovered){ diff --git a/src/main/resources/assets/ebwizardry/lang/en_gb.lang b/src/main/resources/assets/ebwizardry/lang/en_gb.lang index db9e697e..bf38dfc9 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_gb.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_gb.lang @@ -1,4 +1,4 @@ -#PARSE_ESCAPES +# PARSE_ESCAPES tile.ebwizardry\:arcane_workbench.name=Arcane Workbench tile.ebwizardry\:crystal_ore.name=Crystal Ore tile.ebwizardry\:petrified_stone.name=Petrified Stone @@ -498,6 +498,13 @@ advancement.ebwizardry\:enchant_scroll.desc=Craft a blank scroll and enchant it handbook.toast.title=New Handbook Section Unlocked! +gui.ebwizardry\:spell_book.tier=Tier: %s +gui.ebwizardry\:spell_book.element=Element: %s +gui.ebwizardry\:spell_book.element_undiscovered=Element: ? +gui.ebwizardry\:spell_book.mana_cost=Mana Cost: %s +gui.ebwizardry\:spell_book.mana_cost_continuous=Mana Cost: %s/second +gui.ebwizardry\:spell_book.mana_cost_undiscovered=Mana Cost: ? + container.ebwizardry\:arcane_workbench=Arcane Workbench container.ebwizardry\:arcane_workbench.apply=Apply container.ebwizardry\:arcane_workbench.mana=Mana\: diff --git a/src/main/resources/assets/ebwizardry/lang/en_us.lang b/src/main/resources/assets/ebwizardry/lang/en_us.lang index ca3d7a34..0a7269e9 100644 --- a/src/main/resources/assets/ebwizardry/lang/en_us.lang +++ b/src/main/resources/assets/ebwizardry/lang/en_us.lang @@ -498,6 +498,13 @@ advancement.ebwizardry\:enchant_scroll.desc=Craft a blank scroll and enchant it handbook.toast.title=New Handbook Section Unlocked! +gui.ebwizardry\:spell_book.tier=Tier: %s +gui.ebwizardry\:spell_book.element=Element: %s +gui.ebwizardry\:spell_book.element_undiscovered=Element: ? +gui.ebwizardry\:spell_book.mana_cost=Mana Cost: %s +gui.ebwizardry\:spell_book.mana_cost_continuous=Mana Cost: %s/second +gui.ebwizardry\:spell_book.mana_cost_undiscovered=Mana Cost: ? + container.ebwizardry\:arcane_workbench=Arcane Workbench container.ebwizardry\:arcane_workbench.apply=Apply container.ebwizardry\:arcane_workbench.mana=Mana\: From 6fff0e31d163d157f4327797e4d47907c6abda0e Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:45:40 +0000 Subject: [PATCH 09/22] *Facepalm* --- .../java/electroblob/wizardry/client/gui/GuiSpellBook.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java index 2a4e3429..3e26c194 100644 --- a/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java +++ b/src/main/java/electroblob/wizardry/client/gui/GuiSpellBook.java @@ -73,8 +73,8 @@ public class GuiSpellBook extends GuiScreen { "\u00A77" + spell.getTier().getDisplayName() : spell.getTier().getDisplayNameWithFormatting()); this.fontRenderer.drawString(tier, xPos + 17, yPos + 45, 0); - String element = I18n.format("gui.ebwizardry:spell_book.tier", spell.getElement().getFormattingCode() + spell.getElement().getDisplayName()); - if(!discovered) element = I18n.format("gui.ebwizardry:spell_book.tier_undiscovered"); + String element = I18n.format("gui.ebwizardry:spell_book.element", spell.getElement().getFormattingCode() + spell.getElement().getDisplayName()); + if(!discovered) element = I18n.format("gui.ebwizardry:spell_book.element_undiscovered"); this.fontRenderer.drawString(element, xPos + 17, yPos + 57, 0); String manaCost = I18n.format("gui.ebwizardry:spell_book.mana_cost", spell.getCost()); From 79b745e0055175c475a195fe493ba435c2853e64 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Tue, 17 Mar 2020 23:54:52 +0000 Subject: [PATCH 10/22] Randomise y coordinate to search from when spawning structures in 'cavern' dimensions, fixes #372 --- .../wizardry/worldgen/WorldGenSurfaceStructure.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/electroblob/wizardry/worldgen/WorldGenSurfaceStructure.java b/src/main/java/electroblob/wizardry/worldgen/WorldGenSurfaceStructure.java index 95e97840..5af256f9 100644 --- a/src/main/java/electroblob/wizardry/worldgen/WorldGenSurfaceStructure.java +++ b/src/main/java/electroblob/wizardry/worldgen/WorldGenSurfaceStructure.java @@ -144,6 +144,9 @@ public abstract class WorldGenSurfaceStructure implements IWorldGenerator { // Estimate a starting height for searching for the floor BlockPos centre = world.getTopSolidOrLiquidBlock(new BlockPos(origin.add(size.getX()/2, 0, size.getZ()/2))); + // Check if we're at the top of the world, and if so just randomise the y pos (accounts for 'cavern' dimensions) + if(centre.getY() >= world.getActualHeight()) centre = new BlockPos(centre.getX(), random.nextInt(world.getActualHeight()), centre.getZ()); + Integer startingHeight = WizardryUtilities.getNearestSurface(world, centre, EnumFacing.UP, 32, true, WizardryUtilities.SurfaceCriteria.COLLIDABLE_IGNORING_TREES); From 4816c48aa6e4cac070acb31704089c5343bab760 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 14:49:12 +0000 Subject: [PATCH 11/22] Disable replaceVanillaFallDamage by default --- src/main/java/electroblob/wizardry/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index b4dafbab..bff1bbd4 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -172,7 +172,7 @@ public final class Settings { public boolean replaceVanillaFireballs = true; /** [Server-only] Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, * velocity-based one. */ - public boolean replaceVanillaFallDamage = true; + public boolean replaceVanillaFallDamage = false; /** [Server-only] Whether using bonemeal on grass blocks has a chance to grow crystal flowers. */ public boolean bonemealGrowsCrystalFlowers = true; /** From 587ab1338e654ad32aa88df633c0c5cbb0aed291 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 14:57:04 +0000 Subject: [PATCH 12/22] Make Magic Protection protect against vanilla magic damage, closes #337 --- .../wizardry/enchantment/EnchantmentMagicProtection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/electroblob/wizardry/enchantment/EnchantmentMagicProtection.java b/src/main/java/electroblob/wizardry/enchantment/EnchantmentMagicProtection.java index c397d37b..12222480 100644 --- a/src/main/java/electroblob/wizardry/enchantment/EnchantmentMagicProtection.java +++ b/src/main/java/electroblob/wizardry/enchantment/EnchantmentMagicProtection.java @@ -68,7 +68,7 @@ public class EnchantmentMagicProtection extends Enchantment { public enum Type { - MAGIC("magic", 1, 5, 8, s -> s instanceof IElementalDamage), + MAGIC("magic", 1, 5, 8, s -> s instanceof IElementalDamage || s.isMagicDamage()), FROST("frost", 2, 10, 8, s -> s instanceof IElementalDamage && ((IElementalDamage)s).getType() == MagicDamage.DamageType.FROST), SHOCK("shock", 2, 10, 8, s -> s instanceof IElementalDamage && ((IElementalDamage)s).getType() == MagicDamage.DamageType.SHOCK); // Fire already exists, and the other types aren't used enough to be worth having From 0b56d47022f3a5d973654ed49555338792b26910 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 15:32:59 +0000 Subject: [PATCH 13/22] Replace wildcard with metadata 0 for display purposes, fixes #370 N.B. The output is still not visible for non-zero inputs when using wildcard trades, but for now this is good enough --- .../wizardry/entity/living/EntityWizard.java | 1 - .../wizardry/misc/WildcardTradeList.java | 34 ++++++++++++++++++- .../wizardry/util/WizardryUtilities.java | 15 ++++++++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java index 49206043..c5737951 100644 --- a/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java +++ b/src/main/java/electroblob/wizardry/entity/living/EntityWizard.java @@ -503,7 +503,6 @@ public class EntityWizard extends EntityCreature implements INpc, IMerchant, ISp ItemStack anySpellBook = new ItemStack(WizardryItems.spell_book, 1, OreDictionary.WILDCARD_VALUE); ItemStack crystalStack = new ItemStack(WizardryItems.magic_crystal, 5); - // NOTE: For wizardry 1.2, increase the number of uses of this trade. The default is 7, for reference. this.trades.add(new MerchantRecipe(anySpellBook, crystalStack)); this.addRandomRecipes(3); diff --git a/src/main/java/electroblob/wizardry/misc/WildcardTradeList.java b/src/main/java/electroblob/wizardry/misc/WildcardTradeList.java index 0917bcfa..991a99fd 100644 --- a/src/main/java/electroblob/wizardry/misc/WildcardTradeList.java +++ b/src/main/java/electroblob/wizardry/misc/WildcardTradeList.java @@ -1,8 +1,10 @@ package electroblob.wizardry.misc; +import electroblob.wizardry.util.WizardryUtilities; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTUtil; +import net.minecraft.network.PacketBuffer; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraftforge.oredict.OreDictionary; @@ -46,12 +48,42 @@ public class WildcardTradeList extends MerchantRecipeList { } private boolean areItemStacksExactlyEqual(ItemStack stack1, ItemStack stack2){ - // Added to allow wildcards; this line is the only actual change. + // Added to allow wildcards if((stack1.getItemDamage() == OreDictionary.WILDCARD_VALUE || stack2.getItemDamage() == OreDictionary.WILDCARD_VALUE) // Can't use ItemStack.areItemsEqualIgnoreDurability because that only works for items with durability, not subtypes. && stack1.getItem() == stack2.getItem()) return true; return ItemStack.areItemsEqual(stack1, stack2) && (!stack2.hasTagCompound() || stack1.hasTagCompound() && NBTUtil.areNBTEquals(stack2.getTagCompound(), stack1.getTagCompound(), false)); } + + @Override + public void writeToBuf(PacketBuffer buffer){ + + buffer.writeByte((byte)(this.size() & 255)); + + // Trick the client into thinking this is a normal item + for(MerchantRecipe merchantrecipe : this){ + + ItemStack itemToBuy = merchantrecipe.getItemToBuy(); + if(itemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToBuy = WizardryUtilities.copyWithMeta(itemToBuy, 0); + buffer.writeItemStack(itemToBuy); + + ItemStack itemToSell = merchantrecipe.getItemToSell(); + if(itemToSell.getMetadata() == OreDictionary.WILDCARD_VALUE) itemToSell = WizardryUtilities.copyWithMeta(itemToSell, 0); + buffer.writeItemStack(itemToSell); + + ItemStack secondItemToBuy = merchantrecipe.getSecondItemToBuy(); + buffer.writeBoolean(!secondItemToBuy.isEmpty()); + + if(!secondItemToBuy.isEmpty()){ + if(secondItemToBuy.getMetadata() == OreDictionary.WILDCARD_VALUE) secondItemToBuy = WizardryUtilities.copyWithMeta(secondItemToBuy, 0); + buffer.writeItemStack(secondItemToBuy); + } + + buffer.writeBoolean(merchantrecipe.isRecipeDisabled()); + buffer.writeInt(merchantrecipe.getToolUses()); + buffer.writeInt(merchantrecipe.getMaxTradeUses()); + } + } } diff --git a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java index 0717ad9a..6e019a5e 100644 --- a/src/main/java/electroblob/wizardry/util/WizardryUtilities.java +++ b/src/main/java/electroblob/wizardry/util/WizardryUtilities.java @@ -24,6 +24,7 @@ import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.EntityEquipmentSlot.Type; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.datasync.DataParameter; import net.minecraft.server.MinecraftServer; import net.minecraft.util.*; @@ -795,6 +796,20 @@ public final class WizardryUtilities { return false; } + /** + * Returns a new {@link ItemStack} that is identical to the supplied one, except with the metadata changed to the + * new value given. + * @param toCopy The stack to copy + * @param newMetadata The new metadata value + * @return The resulting {@link ItemStack} + */ + public static ItemStack copyWithMeta(ItemStack toCopy, int newMetadata){ + ItemStack copy = new ItemStack(toCopy.getItem(), toCopy.getCount(), newMetadata); + NBTTagCompound compound = toCopy.getTagCompound(); + if(compound != null) copy.setTagCompound(compound.copy()); + return copy; + } + /** * Checks if the given player is opped on the given server. If the server is a singleplayer or LAN server, this * means they have cheats enabled. From 74d9198522ee8b4bae1b9c4e2bb84756eb555146 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 15:50:01 +0000 Subject: [PATCH 14/22] Convert replaceVanillaFireballs to a synchronised option, fixes #351 --- src/main/java/electroblob/wizardry/Settings.java | 6 +++--- .../electroblob/wizardry/packet/PacketSyncSettings.java | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index bff1bbd4..755dff7e 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -168,8 +168,6 @@ public final class Settings { public boolean playerBlockDamage = true; /** [Server-only] Whether to revert to the old wand upgrade system, which only requires tomes of arcana. */ public boolean legacyWandLevelling = false; - /** [Server-only] Whether to replace Minecraft's own fireballs with wizardry fireballs. */ - public boolean replaceVanillaFireballs = true; /** [Server-only] Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, * velocity-based one. */ public boolean replaceVanillaFallDamage = false; @@ -272,7 +270,9 @@ public final class Settings { * effect. */ public boolean slowTimeAffectsPlayers = true; - /** [Synchronised] Chance of 'misreading' an undiscovered spell and triggering a forfeit instead. */ + /** [Synchronised] Whether to replace Minecraft's own fireballs with wizardry fireballs. */ + public boolean replaceVanillaFireballs = true; + /** [Synchronised] Chance of 'misreading' an undiscovered spell and triggering a forfeit instead. */ public double forfeitChance = 0.2; // Client-only settings. These settings only affect client-side code and hence are not synced. Each client obeys diff --git a/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java b/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java index 9fc16ac5..6a408b81 100644 --- a/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java +++ b/src/main/java/electroblob/wizardry/packet/PacketSyncSettings.java @@ -56,6 +56,7 @@ public class PacketSyncSettings implements IMessageHandler { settings.discoveryMode = buf.readBoolean(); settings.creativeBypassesArcaneLock = buf.readBoolean(); settings.slowTimeAffectsPlayers = buf.readBoolean(); + settings.replaceVanillaFireballs = buf.readBoolean(); settings.forfeitChance = buf.readFloat(); } @@ -64,6 +65,7 @@ public class PacketSyncSettings implements IMessageHandler { buf.writeBoolean(settings.discoveryMode); buf.writeBoolean(settings.creativeBypassesArcaneLock); buf.writeBoolean(settings.slowTimeAffectsPlayers); + buf.writeBoolean(settings.replaceVanillaFireballs); buf.writeFloat((float)settings.forfeitChance); // Configs don't have floats but this can only be 0-1 anyway } } From d68f968632f47361f7e1457b7c7176b2bc7d4066 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 16:00:23 +0000 Subject: [PATCH 15/22] Make sure fall damage stuff is processed on the server only, and reactivate the config option by default --- src/main/java/electroblob/wizardry/Settings.java | 2 +- src/main/java/electroblob/wizardry/WizardryEventHandler.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/electroblob/wizardry/Settings.java b/src/main/java/electroblob/wizardry/Settings.java index 755dff7e..bafabf8f 100644 --- a/src/main/java/electroblob/wizardry/Settings.java +++ b/src/main/java/electroblob/wizardry/Settings.java @@ -170,7 +170,7 @@ public final class Settings { public boolean legacyWandLevelling = false; /** [Server-only] Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, * velocity-based one. */ - public boolean replaceVanillaFallDamage = false; + public boolean replaceVanillaFallDamage = true; /** [Server-only] Whether using bonemeal on grass blocks has a chance to grow crystal flowers. */ public boolean bonemealGrowsCrystalFlowers = true; /** diff --git a/src/main/java/electroblob/wizardry/WizardryEventHandler.java b/src/main/java/electroblob/wizardry/WizardryEventHandler.java index e4614881..bdac3b8b 100644 --- a/src/main/java/electroblob/wizardry/WizardryEventHandler.java +++ b/src/main/java/electroblob/wizardry/WizardryEventHandler.java @@ -420,7 +420,7 @@ public final class WizardryEventHandler { @SubscribeEvent // Priority doesn't matter here, we're only setting event fields so if it's cancelled it won't matter public static void onLivingFallEvent(LivingFallEvent event){ // Why is fall damage based on distance fallen? Why? Who on earth came up with that? It makes no sense whatsoever! - if(Wizardry.settings.replaceVanillaFallDamage && !Loader.isModLoaded("speedbasedfalldamage")){ + if(!event.getEntity().world.isRemote && Wizardry.settings.replaceVanillaFallDamage && !Loader.isModLoaded("speedbasedfalldamage")){ // We want to keep the fall damage EXACTLY THE SAME for free, uninterrupted falls, but fix the weirdness // caused when something else changes the entity's velocity // All living entities have a gravity of 0.08b/t^2 From 3151d7d6268edbd1728524b38923e24853a4997d Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Wed, 18 Mar 2020 17:18:41 +0000 Subject: [PATCH 16/22] Require Antique Atlas 4.6 or newer --- src/main/java/electroblob/wizardry/Wizardry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index 5a0d885c..2549ab2d 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -46,7 +46,7 @@ import java.util.Calendar; */ @Mod(modid = Wizardry.MODID, name = Wizardry.NAME, version = Wizardry.VERSION, acceptedMinecraftVersions = "[1.12.2]", - guiFactory = "electroblob.wizardry.WizardryGuiFactory", dependencies = "required-after:forge@[14.23.5.2814,)") + guiFactory = "electroblob.wizardry.WizardryGuiFactory", dependencies = "required-after:forge@[14.23.5.2814,);after:antiqueatlas@[4.6,)") public class Wizardry { From 9c29142e6ad1f9142ffd427fb701547568e34fc6 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 13:33:34 +0000 Subject: [PATCH 17/22] Maven-ify all the things and update Antique Atlas --- build.gradle | 42 +++++++----------------------------------- gradle.properties | 5 ++++- 2 files changed, 11 insertions(+), 36 deletions(-) diff --git a/build.gradle b/build.gradle index 6ebcef05..e4be675b 100644 --- a/build.gradle +++ b/build.gradle @@ -31,15 +31,10 @@ repositories { name = "ModMaven" url = "modmaven.k-4u.nl" } - flatDir { - // evErYthINg hAS tO Be a mAVeN rEPoSiTOrY... (to use deobfProvided, for some reason) - // The lack of documentation is actually quite impressive, see the following threads: - // http://www.minecraftforge.net/forum/topic/44262-solved-how-to-build-mod-with-dependencies/ - // https://www.minecraftforum.net/forums/mapping-and-modding-java-edition/mapping-and-modding-tutorials/2866817-setting-up-dependencies-in-minecraft-forge-with - // http://www.minecraftforge.net/forum/topic/44534-adding-dependencies-to-a-forge-project/ - dirs "libsfordeobf" // Don't put src jars in libs or forge will think you have duplicate mods + maven { + name = "Curseforge Maven" + url = "https://minecraft.curseforge.com/api/maven/" } - } minecraft { @@ -56,37 +51,14 @@ minecraft { } dependencies { - // you may put jars on which you depend on in ./libs - // or you may define them like so.. - //compile "some.group:artifact:version:classifier" - //compile "some.group:artifact:version" - // compile against the JEI API but do not include it at runtime + // Compile against the JEI API but do not include it at runtime deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api" - // at runtime, use the full JEI jar + // At runtime, use the full JEI jar runtime "mezz.jei:jei_${mc_version}:${jei_version}" - //deobfProvided "baubles:baubles-1.12:1.5.2:api" // #ihavenoideawhatimdoing #itjustworks - //runtime "baubles:baubles-1.12:1.5.2" // If in doubt, copy what already works - - //deobfProvided "antiqueatlas:antiqueatlas-1.12.2:4.5.1:src" - //runtime "antiqueatlas:antiqueatlas-1.12.2:4.5.1" - - // real examples - //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env - //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env - - // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. - //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided, - // except that these dependencies get remapped to your current MCP mappings - //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev' - //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev' - - // for more info... - // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html - // http://www.gradle.org/docs/current/userguide/dependency_management.html + deobfCompile "baubles:Baubles:${mc_version_short}:${baubles_version}" + deobfCompile "antique-atlas:antiqueatlas:${mc_version}:${antique_atlas_version}" } diff --git a/gradle.properties b/gradle.properties index b4ec0fb3..a4e7eb14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,4 +2,7 @@ # This is required to provide enough memory for the Minecraft decompilation process. org.gradle.jvmargs=-Xmx3G mc_version=1.12.2 -jei_version=4.13.1.225 \ No newline at end of file +mc_version_short=1.12 +jei_version=4.13.1.225 +baubles_version=1.5.2 +antique_atlas_version=4.6.3 \ No newline at end of file From 81bba5e7e0f262f9dba8d6b1e8ae6db21e9d137f Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 13:35:36 +0000 Subject: [PATCH 18/22] Add null check to ice spikes, fixes #371 --- .../wizardry/entity/construct/EntityIceSpike.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/entity/construct/EntityIceSpike.java b/src/main/java/electroblob/wizardry/entity/construct/EntityIceSpike.java index 638d6c24..d79ac809 100644 --- a/src/main/java/electroblob/wizardry/entity/construct/EntityIceSpike.java +++ b/src/main/java/electroblob/wizardry/entity/construct/EntityIceSpike.java @@ -10,6 +10,7 @@ import electroblob.wizardry.util.WizardryUtilities; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.MoverType; import net.minecraft.potion.PotionEffect; +import net.minecraft.util.DamageSource; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.Vec3d; @@ -61,10 +62,9 @@ public class EntityIceSpike extends EntityMagicConstruct { if(!this.world.isRemote){ for(Object entity : this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox())){ if(entity instanceof EntityLivingBase && this.isValidTarget((EntityLivingBase)entity)){ + DamageSource source = this.getCaster() == null ? DamageSource.MAGIC : MagicDamage.causeDirectMagicDamage(this.getCaster(), DamageType.FROST); // Potion effect only gets added if the damage succeeded. - if(((EntityLivingBase)entity).attackEntityFrom( - MagicDamage.causeDirectMagicDamage(this.getCaster(), DamageType.FROST), - Spells.ice_spikes.getProperty(Spell.DAMAGE).floatValue() * this.damageMultiplier)) + if(((EntityLivingBase)entity).attackEntityFrom(source, Spells.ice_spikes.getProperty(Spell.DAMAGE).floatValue() * this.damageMultiplier)) ((EntityLivingBase)entity).addPotionEffect(new PotionEffect(WizardryPotions.frost, Spells.ice_spikes.getProperty(Spell.EFFECT_DURATION).intValue(), Spells.ice_spikes.getProperty(Spell.EFFECT_STRENGTH).intValue())); From 4dbe24c8ea60d769b145b8359a69819680957cff Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:13:25 +0000 Subject: [PATCH 19/22] This is the problem with everything being a string... --- .../antiqueatlas/WizardryAntiqueAtlasIntegration.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java index 8816224b..69e25efe 100644 --- a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java +++ b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java @@ -38,7 +38,7 @@ public class WizardryAntiqueAtlasIntegration { * {@link electroblob.wizardry.Settings#autoTowerMarkers} is enabled. Server side only! */ public static void markTower(World world, int x, int z){ if(enabled() && Wizardry.settings.autoTowerMarkers){ - AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, TOWER_MARKER.toString().replace(':', '.'), "integration.antiqueatlas.marker." + TOWER_MARKER.toString(), x, z); + AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, TOWER_MARKER.toString(), "integration.antiqueatlas.marker." + TOWER_MARKER.toString().replace(':', '.'), x, z); } } @@ -46,7 +46,7 @@ public class WizardryAntiqueAtlasIntegration { * {@link electroblob.wizardry.Settings#autoObeliskMarkers} is enabled. Server side only! */ public static void markObelisk(World world, int x, int z){ if(enabled() && Wizardry.settings.autoObeliskMarkers){ - AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, OBELISK_MARKER.toString().replace(':', '.'), "integration.antiqueatlas.marker." + OBELISK_MARKER.toString(), x, z); + AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, OBELISK_MARKER.toString(), "integration.antiqueatlas.marker." + OBELISK_MARKER.toString().replace(':', '.'), x, z); } } @@ -54,7 +54,7 @@ public class WizardryAntiqueAtlasIntegration { * {@link electroblob.wizardry.Settings#autoShrineMarkers} is enabled. Server side only! */ public static void markShrine(World world, int x, int z){ if(enabled() && Wizardry.settings.autoShrineMarkers){ - AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, SHRINE_MARKER.toString().replace(':', '.'), "integration.antiqueatlas.marker." + SHRINE_MARKER.toString(), x, z); + AtlasAPI.getMarkerAPI().putGlobalMarker(world, false, SHRINE_MARKER.toString(), "integration.antiqueatlas.marker." + SHRINE_MARKER.toString().replace(':', '.'), x, z); } } From 0a5527f3d4ea9948d7c22bfbb97994e5fc79bec8 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:35:09 +0000 Subject: [PATCH 20/22] Add backwards compatibility to convert old-format atlas markers to new ones --- .../WizardryAntiqueAtlasIntegration.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java index 69e25efe..1d35f9f0 100644 --- a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java +++ b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java @@ -1,11 +1,17 @@ package electroblob.wizardry.integration.antiqueatlas; import electroblob.wizardry.Wizardry; +import hunternif.mc.atlas.AntiqueAtlasMod; import hunternif.mc.atlas.api.AtlasAPI; +import hunternif.mc.atlas.marker.GlobalMarkersData; +import hunternif.mc.atlas.marker.Marker; import hunternif.mc.atlas.registry.MarkerType; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import net.minecraftforge.event.world.WorldEvent; import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; /** * This class handles all of wizardry's integration with the Antique Atlas mod. This class contains only the code @@ -15,6 +21,7 @@ import net.minecraftforge.fml.common.Loader; * @since Wizardry 4.2 * @author Electroblob */ +@Mod.EventBusSubscriber public class WizardryAntiqueAtlasIntegration { public static final String ANTIQUE_ATLAS_MOD_ID = "antiqueatlas"; @@ -68,4 +75,18 @@ public class WizardryAntiqueAtlasIntegration { AtlasAPI.getMarkerAPI().registerMarker(new MarkerType(OBELISK_MARKER, new ResourceLocation(Wizardry.MODID, "textures/integration/antiqueatlas/obelisk.png"))); } + @SubscribeEvent + public static void onWorldLoadEvent(WorldEvent.Load event){ + // Backwards compatibility for existing markers using the old translation key format (with colons) + GlobalMarkersData data = AntiqueAtlasMod.globalMarkersData.getData(); + for(Marker marker : data.getMarkersInDimension(event.getWorld().provider.getDimension())){ + if(marker.getLabel().contains(":")){ + // Remove old-format markers and replace them with new ones + data.removeMarker(marker.getId()); + AtlasAPI.getMarkerAPI().putGlobalMarker(event.getWorld(), marker.isVisibleAhead(), marker.getType(), + marker.getLabel().replace(':', '.'), marker.getX(), marker.getZ()); + } + } + } + } From 306137a026309cf1369110b247a2abfa2440e7fb Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:38:19 +0000 Subject: [PATCH 21/22] Update version number --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- .github/ISSUE_TEMPLATE/question.md | 2 +- CREDITS.md | 2 +- ISSUE_TEMPLATE.md | 2 +- build.gradle | 2 +- src/main/java/electroblob/wizardry/Wizardry.java | 2 +- src/main/resources/mcmod.info | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 930ecd4e..182b1c1a 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -10,7 +10,7 @@ assignees: '' Please read the [guide for contributing](https://github.com/Electroblob77/Wizardry/blob/1.12.2/CONTRIBUTING.md) before posting. Minecraft version: 1.12.2 [change as necessary] -Wizardry version: 4.2.9 [change as necessary] +Wizardry version: 4.2.10 [change as necessary] Environment: Singleplayer/LAN game/Server [delete as necessary] Issue details: [describe what you were doing when the issue occurred, what went wrong, what you expected to happen, etc.] diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index b0a09776..ff92dd20 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -10,7 +10,7 @@ assignees: '' Please read the [guide for contributing](https://github.com/Electroblob77/Wizardry/blob/1.12.2/CONTRIBUTING.md) before posting. Minecraft version: 1.12.2 [change as necessary] -Wizardry version: 4.2.9 [change as necessary] +Wizardry version: 4.2.10 [change as necessary] Question details: [explain your question here] diff --git a/CREDITS.md b/CREDITS.md index f84ba0b6..fdbc9f24 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -1,7 +1,7 @@ # Credits Electroblob's Wizardry -Version 4.2.9 +Version 4.2.10 For Minecraft 1.12.2 Designed, coded and textured by Electroblob diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index a6901be9..3c47b45d 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,7 +1,7 @@ Please read the [guide for contributing](https://github.com/Electroblob77/Wizardry/blob/1.12.2/guide_for_contributing.md) before posting. Minecraft version: 1.12.2 [change as necessary] -Wizardry version: 4.2.9 [change as necessary] +Wizardry version: 4.2.10 [change as necessary] Environment: Singleplayer/LAN game/Server [delete as necessary] Issue details: [describe what you were doing when the issue occurred, what went wrong, what you expected to happen, etc.] diff --git a/build.gradle b/build.gradle index e4be675b..7aadf522 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ apply plugin: 'net.minecraftforge.gradle.forge' //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. -version = "4.2.9" // There, it matches semver, happy now? +version = "4.2.10" // There, it matches semver, happy now? group= "electroblob.wizardry"// http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = "ElectroblobsWizardry" diff --git a/src/main/java/electroblob/wizardry/Wizardry.java b/src/main/java/electroblob/wizardry/Wizardry.java index 2549ab2d..091ee65a 100644 --- a/src/main/java/electroblob/wizardry/Wizardry.java +++ b/src/main/java/electroblob/wizardry/Wizardry.java @@ -64,7 +64,7 @@ public class Wizardry { * 1.x.x represents Minecraft 1.7.x versions, 2.x.x represents Minecraft 1.10.x versions, 3.x.x represents Minecraft * 1.11.x versions, and so on. */ - public static final String VERSION = "4.2.9"; + public static final String VERSION = "4.2.10"; // IDEA: Triggering of inbuilt Forge events in relevant places? // IDEA: Abstract the vanilla particles behind the particle builder diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index ab386d32..741e2e8e 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -2,7 +2,7 @@ { "modid" : "ebwizardry", "name" : "Electroblob's Wizardry", - "version" : "4.2.9", + "version" : "4.2.10", "mcversion" : "1.12.2", "url" : "https://minecraft.curseforge.com/projects/electroblobs-wizardry", "credits" : "\nDesigned, coded and textured by Electroblob.\nCode contributed by: Corail31, 12foo, Shadows-of-Fire, Tora-B, Avatair, Aeronica, UltraHex, Azim-Palmer, raoulvdberge.\nTranslators: MadWrist (Spanish, Mexican Spanish), VilagVil, kellixon & bigenergy (Russian), Hahdrim (French), lorrampi (Brazilian Portuguese), ZHENGLOC & dragon-evol (Chinese), shejery & rewi_wire (Korean), Trozuu (Polish), chesterccj305 (Taiwanese).", From a490168fa22c5c2433c3e29e148de3229994faf9 Mon Sep 17 00:00:00 2001 From: Electroblob77 <35599699+Electroblob77@users.noreply.github.com> Date: Thu, 19 Mar 2020 15:46:42 +0000 Subject: [PATCH 22/22] Derp --- .../antiqueatlas/WizardryAntiqueAtlasIntegration.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java index 1d35f9f0..5eabb205 100644 --- a/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java +++ b/src/main/java/electroblob/wizardry/integration/antiqueatlas/WizardryAntiqueAtlasIntegration.java @@ -77,6 +77,9 @@ public class WizardryAntiqueAtlasIntegration { @SubscribeEvent public static void onWorldLoadEvent(WorldEvent.Load event){ + + if(!enabled()) return; + // Backwards compatibility for existing markers using the old translation key format (with colons) GlobalMarkersData data = AntiqueAtlasMod.globalMarkersData.getData(); for(Marker marker : data.getMarkersInDimension(event.getWorld().provider.getDimension())){