Add blindness tweak and stop smoke bombs giving the mind trick effect
This commit is contained in:
@@ -179,6 +179,8 @@ public final class Settings {
|
|||||||
* velocity-based one.
|
* velocity-based one.
|
||||||
*/
|
*/
|
||||||
public boolean replaceVanillaFallDamage = true; // TODO: This should be synced
|
public boolean replaceVanillaFallDamage = true; // TODO: This should be synced
|
||||||
|
/** <b>[Server-only]</b> Whether to tweak the blindness effect to reduce follow distance when used on non-players. */
|
||||||
|
public boolean blindnessTweak = true;
|
||||||
/** <b>[Server-only]</b> Whether using bonemeal on grass blocks has a chance to grow crystal flowers. */
|
/** <b>[Server-only]</b> Whether using bonemeal on grass blocks has a chance to grow crystal flowers. */
|
||||||
public boolean bonemealGrowsCrystalFlowers = true;
|
public boolean bonemealGrowsCrystalFlowers = true;
|
||||||
/**
|
/**
|
||||||
@@ -704,6 +706,13 @@ public final class Settings {
|
|||||||
replaceVanillaFallDamage = property.getBoolean();
|
replaceVanillaFallDamage = property.getBoolean();
|
||||||
propOrder.add(property.getName());
|
propOrder.add(property.getName());
|
||||||
|
|
||||||
|
property = config.get(TWEAKS_CATEGORY, "blindnessTweak", true,
|
||||||
|
"Whether to tweak the blindness effect to reduce follow distance when used on non-players. This automatically disables itself in favour of Potion Core's implementation if installed.");
|
||||||
|
property.setLanguageKey("config." + Wizardry.MODID + ".blindness_tweak");
|
||||||
|
Wizardry.proxy.setToNamedBooleanEntry(property);
|
||||||
|
blindnessTweak = property.getBoolean();
|
||||||
|
propOrder.add(property.getName());
|
||||||
|
|
||||||
property = config.get(TWEAKS_CATEGORY, "mobLootTableWhitelist", new String[0], "Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.");
|
property = config.get(TWEAKS_CATEGORY, "mobLootTableWhitelist", new String[0], "Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.");
|
||||||
property.setLanguageKey("config." + Wizardry.MODID + ".mob_loot_table_whitelist");
|
property.setLanguageKey("config." + Wizardry.MODID + ".mob_loot_table_whitelist");
|
||||||
property.setRequiresMcRestart(true);
|
property.setRequiresMcRestart(true);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.projectile.EntityArrow;
|
import net.minecraft.entity.projectile.EntityArrow;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
@@ -192,16 +193,27 @@ public final class WizardryEventHandler {
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onLivingSetAttackTargetEvent(LivingSetAttackTargetEvent event){
|
public static void onLivingSetAttackTargetEvent(LivingSetAttackTargetEvent event){
|
||||||
|
|
||||||
if(event.getTarget() != null && event.getEntityLiving() instanceof EntityLiving
|
if(event.getEntityLiving() instanceof EntityLiving && event.getTarget() != null){
|
||||||
&& event.getTarget().isPotionActive(WizardryPotions.muffle)){
|
|
||||||
|
|
||||||
Vec3d vec = event.getTarget().getPositionEyes(1).subtract(event.getEntity().getPositionEyes(1));
|
// Muffle
|
||||||
// Find the angle between the direction the mob is looking and the direction the player is in
|
if(event.getTarget().isPotionActive(WizardryPotions.muffle)){
|
||||||
// Angle between a and b = acos((a.b) / (|a|*|b|))
|
|
||||||
double angle = Math.acos(vec.dotProduct(event.getEntity().getLookVec()) / vec.length());
|
Vec3d vec = event.getTarget().getPositionEyes(1).subtract(event.getEntity().getPositionEyes(1));
|
||||||
System.out.println(angle);
|
// Find the angle between the direction the mob is looking and the direction the player is in
|
||||||
// If the player is not within the 144-degree arc in front of the mob, it won't detect them
|
// Angle between a and b = acos((a.b) / (|a|*|b|))
|
||||||
if(angle > 0.4 * Math.PI){
|
double angle = Math.acos(vec.dotProduct(event.getEntity().getLookVec()) / vec.length());
|
||||||
|
System.out.println(angle);
|
||||||
|
// If the player is not within the 144-degree arc in front of the mob, it won't detect them
|
||||||
|
if(angle > 0.4 * Math.PI){
|
||||||
|
((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Blindness tweak
|
||||||
|
// I'm not going as far as potion core's implementation, this is just so it does *something* to mobs
|
||||||
|
if(event.getEntityLiving().isPotionActive(MobEffects.BLINDNESS) && !Loader.isModLoaded("potioncore")
|
||||||
|
&& Wizardry.settings.blindnessTweak && event.getTarget().getDistanceSq(event.getEntity()) > 2.5 * 2.5){
|
||||||
|
// Can't detect anything more than 2.5 blocks away (roughly the player's view distance when blinded)
|
||||||
((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
|
((EntityLiving)event.getEntityLiving()).setAttackTarget(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
package electroblob.wizardry.entity.projectile;
|
package electroblob.wizardry.entity.projectile;
|
||||||
|
|
||||||
import electroblob.wizardry.registry.Spells;
|
import electroblob.wizardry.registry.Spells;
|
||||||
import electroblob.wizardry.registry.WizardryPotions;
|
|
||||||
import electroblob.wizardry.registry.WizardrySounds;
|
import electroblob.wizardry.registry.WizardrySounds;
|
||||||
import electroblob.wizardry.spell.Spell;
|
import electroblob.wizardry.spell.Spell;
|
||||||
import electroblob.wizardry.util.EntityUtils;
|
import electroblob.wizardry.util.EntityUtils;
|
||||||
import electroblob.wizardry.util.ParticleBuilder;
|
import electroblob.wizardry.util.ParticleBuilder;
|
||||||
import electroblob.wizardry.util.ParticleBuilder.Type;
|
import electroblob.wizardry.util.ParticleBuilder.Type;
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.init.MobEffects;
|
import net.minecraft.init.MobEffects;
|
||||||
import net.minecraft.potion.PotionEffect;
|
import net.minecraft.potion.PotionEffect;
|
||||||
@@ -64,14 +62,7 @@ public class EntitySmokeBomb extends EntityBomb {
|
|||||||
|
|
||||||
for(EntityLivingBase target : targets){
|
for(EntityLivingBase target : targets){
|
||||||
if(target != this.getThrower()){
|
if(target != this.getThrower()){
|
||||||
// Gives the target blindness, and mind trick if it's not a player (since this has the desired
|
|
||||||
// effect of preventing targeting)
|
|
||||||
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0));
|
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, duration, 0));
|
||||||
|
|
||||||
if(target instanceof EntityLiving){
|
|
||||||
((EntityLiving)target).setAttackTarget(null);
|
|
||||||
target.addPotionEffect(new PotionEffect(WizardryPotions.mind_trick, duration, 0));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1359,6 +1359,8 @@ config.ebwizardry.replace_vanilla_fall_damage=Replace Vanilla Fall Damage
|
|||||||
config.ebwizardry.replace_vanilla_fall_damage.tooltip=Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, velocity-based one. This is done such that mobs in freefall will take exactly the same damage as normal, so it will not break falling-based mob farms. Disable this if you experience falling-related weirdness! If this is disabled, some spells revert to a more simplistic method of resetting the player's fall damage in certain cases.
|
config.ebwizardry.replace_vanilla_fall_damage.tooltip=Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, velocity-based one. This is done such that mobs in freefall will take exactly the same damage as normal, so it will not break falling-based mob farms. Disable this if you experience falling-related weirdness! If this is disabled, some spells revert to a more simplistic method of resetting the player's fall damage in certain cases.
|
||||||
config.ebwizardry.replace_vanilla_fall_damage.true=Yes - it's parkour time
|
config.ebwizardry.replace_vanilla_fall_damage.true=Yes - it's parkour time
|
||||||
config.ebwizardry.replace_vanilla_fall_damage.false=No - break my legs normally
|
config.ebwizardry.replace_vanilla_fall_damage.false=No - break my legs normally
|
||||||
|
config.ebwizardry.blindness_tweak=Blindness Tweak
|
||||||
|
config.ebwizardry.blindness_tweak.tooltip=Whether to tweak the blindness effect to reduce follow distance when used on non-players. This automatically disables itself in favour of Potion Core's implementation if installed.
|
||||||
config.ebwizardry.mob_loot_table_whitelist=Mob Loot Table Whitelist
|
config.ebwizardry.mob_loot_table_whitelist=Mob Loot Table Whitelist
|
||||||
config.ebwizardry.mob_loot_table_whitelist.tooltip=Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.
|
config.ebwizardry.mob_loot_table_whitelist.tooltip=Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.
|
||||||
config.ebwizardry.mob_loot_table_blacklist=Mob Loot Table Blacklist
|
config.ebwizardry.mob_loot_table_blacklist=Mob Loot Table Blacklist
|
||||||
|
|||||||
@@ -1359,6 +1359,8 @@ config.ebwizardry.replace_vanilla_fall_damage=Replace Vanilla Fall Damage
|
|||||||
config.ebwizardry.replace_vanilla_fall_damage.tooltip=Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, velocity-based one. This is done such that mobs in freefall will take exactly the same damage as normal, so it will not break falling-based mob farms. Disable this if you experience falling-related weirdness! If this is disabled, some spells revert to a more simplistic method of resetting the player's fall damage in certain cases.
|
config.ebwizardry.replace_vanilla_fall_damage.tooltip=Whether to replace Minecraft's distance-based fall damage calculation with an equivalent, velocity-based one. This is done such that mobs in freefall will take exactly the same damage as normal, so it will not break falling-based mob farms. Disable this if you experience falling-related weirdness! If this is disabled, some spells revert to a more simplistic method of resetting the player's fall damage in certain cases.
|
||||||
config.ebwizardry.replace_vanilla_fall_damage.true=Yes - it's parkour time
|
config.ebwizardry.replace_vanilla_fall_damage.true=Yes - it's parkour time
|
||||||
config.ebwizardry.replace_vanilla_fall_damage.false=No - break my legs normally
|
config.ebwizardry.replace_vanilla_fall_damage.false=No - break my legs normally
|
||||||
|
config.ebwizardry.blindness_tweak=Blindness Tweak
|
||||||
|
config.ebwizardry.blindness_tweak.tooltip=Whether to tweak the blindness effect to reduce follow distance when used on non-players. This automatically disables itself in favour of Potion Core's implementation if installed.
|
||||||
config.ebwizardry.mob_loot_table_whitelist=Mob Loot Table Whitelist
|
config.ebwizardry.mob_loot_table_whitelist=Mob Loot Table Whitelist
|
||||||
config.ebwizardry.mob_loot_table_whitelist.tooltip=Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.
|
config.ebwizardry.mob_loot_table_whitelist.tooltip=Whitelist for loot tables to inject additional mob drops (as specified in loot_tables/entities/mob_additions.json) into. Wizardry makes a best guess as to which loot tables belong to hostile mobs, but this may not always be correct or appropriate; add loot table locations (not entity IDs) to this list to manually include them.
|
||||||
config.ebwizardry.mob_loot_table_blacklist=Mob Loot Table Blacklist
|
config.ebwizardry.mob_loot_table_blacklist=Mob Loot Table Blacklist
|
||||||
|
|||||||
Reference in New Issue
Block a user