mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
Added the Charm of the Diva, I'll document it later :<
This commit is contained in:
1 parent
24e17eefb9
commit
d9d9af4e6b
8 files changed
+112
-25
No files matched your search
@@ -41,38 +41,44 @@ public class SubTileHeiseiDream extends SubTileFunctional {
|
||||
for(IMob mob : mobs) {
|
||||
if(mob instanceof EntityLiving) {
|
||||
EntityLiving entity = (EntityLiving) mob;
|
||||
EntityLivingBase target = entity.getAttackTarget();
|
||||
if(target == null || !(target instanceof IMob)) {
|
||||
IMob newTarget;
|
||||
do newTarget = mobs.get(supertile.getWorldObj().rand.nextInt(mobs.size()));
|
||||
while(newTarget == mob);
|
||||
brainwashEntity(entity, mobs);
|
||||
|
||||
if(newTarget instanceof EntityLivingBase) {
|
||||
entity.setAttackTarget((EntityLivingBase) newTarget);
|
||||
mana -= cost;
|
||||
sync();
|
||||
break;
|
||||
|
||||
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
|
||||
entries.addAll(new ArrayList(entity.targetTasks.taskEntries));
|
||||
|
||||
for(EntityAITaskEntry entry : entries)
|
||||
if(entry.action instanceof EntityAINearestAttackableTarget)
|
||||
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action);
|
||||
else if(entry.action instanceof EntityAIAttackOnCollide)
|
||||
messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action);
|
||||
|
||||
mana -= cost;
|
||||
sync();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) {
|
||||
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, IMob.class, LibObfuscation.TARGET_CLASS);
|
||||
public static void brainwashEntity(EntityLiving entity, List<IMob> mobs) {
|
||||
EntityLivingBase target = entity.getAttackTarget();
|
||||
if(target == null || !(target instanceof IMob)) {
|
||||
IMob newTarget;
|
||||
do newTarget = mobs.get(entity.worldObj.rand.nextInt(mobs.size()));
|
||||
while(newTarget == entity);
|
||||
|
||||
if(newTarget instanceof EntityLiving) {
|
||||
entity.setAttackTarget((EntityLiving) newTarget);
|
||||
|
||||
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
|
||||
entries.addAll(new ArrayList(entity.targetTasks.taskEntries));
|
||||
|
||||
for(EntityAITaskEntry entry : entries)
|
||||
if(entry.action instanceof EntityAINearestAttackableTarget)
|
||||
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action, (EntityLiving) newTarget);
|
||||
else if(entry.action instanceof EntityAIAttackOnCollide)
|
||||
messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void messWithAttackOnCollideAI(EntityAIAttackOnCollide aiEntry) {
|
||||
private static void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry, EntityLivingBase target) {
|
||||
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, IMob.class, LibObfuscation.TARGET_CLASS);
|
||||
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, target, LibObfuscation.TARGET_ENTITY);
|
||||
}
|
||||
|
||||
private static void messWithAttackOnCollideAI(EntityAIAttackOnCollide aiEntry) {
|
||||
ReflectionHelper.setPrivateValue(EntityAIAttackOnCollide.class, aiEntry, IMob.class, LibObfuscation.CLASS_TARGET);
|
||||
}
|
||||
|
||||
|
||||
@@ -107,6 +107,8 @@ public final class BotaniaCreativeTab extends CreativeTabs {
|
||||
addItem(ModItems.icePendant);
|
||||
addItem(ModItems.lavaPendant);
|
||||
addItem(ModItems.goldLaurel);
|
||||
addItem(ModItems.divaCharm);
|
||||
|
||||
addItem(ModItems.manaTablet);
|
||||
addItem(ModItems.manaMirror);
|
||||
addBlock(ModBlocks.pool);
|
||||
|
||||
@@ -24,6 +24,7 @@ import vazkii.botania.common.item.equipment.armor.ItemTerrasteelChest;
|
||||
import vazkii.botania.common.item.equipment.armor.ItemTerrasteelHelm;
|
||||
import vazkii.botania.common.item.equipment.armor.ItemTerrasteelLegs;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemAuraRing;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemDivaCharm;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemGoldenLaurel;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemGreaterAuraRing;
|
||||
import vazkii.botania.common.item.equipment.bauble.ItemGreaterManaRing;
|
||||
@@ -94,6 +95,7 @@ public final class ModItems {
|
||||
public static Item waterRing;
|
||||
public static Item miningRing;
|
||||
public static Item terraPick;
|
||||
public static Item divaCharm;
|
||||
|
||||
public static void init() {
|
||||
lexicon = new ItemLexicon();
|
||||
@@ -143,6 +145,7 @@ public final class ModItems {
|
||||
waterRing = new ItemWaterRing();
|
||||
miningRing = new ItemMiningRing();
|
||||
terraPick = new ItemTerraPick();
|
||||
divaCharm = new ItemDivaCharm();
|
||||
|
||||
OreDictionary.registerOre(LibOreDict.LEXICON, lexicon);
|
||||
for(int i = 0; i < 16; i++) {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/**
|
||||
* This class was created by <Vazkii>. It's distributed as
|
||||
* part of the Botania Mod. Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under a
|
||||
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
|
||||
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
|
||||
*
|
||||
* File Created @ [May 25, 2014, 10:30:39 PM (GMT)]
|
||||
*/
|
||||
package vazkii.botania.common.item.equipment.bauble;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.EntityLiving;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.block.subtile.functional.SubTileHeiseiDream;
|
||||
import vazkii.botania.common.core.helper.MathHelper;
|
||||
import vazkii.botania.common.core.helper.Vector3;
|
||||
import vazkii.botania.common.lib.LibItemNames;
|
||||
import baubles.api.BaubleType;
|
||||
import baubles.common.lib.PlayerHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ItemDivaCharm extends ItemBauble {
|
||||
|
||||
public ItemDivaCharm() {
|
||||
super(LibItemNames.DIVA_CHARM);
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityDamaged(LivingHurtEvent event) {
|
||||
if(event.source.getEntity() instanceof EntityPlayer && event.entityLiving instanceof EntityLiving && Math.random() < 0.3333F) {
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
ItemStack amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);
|
||||
if(amulet != null && amulet.getItem() == this) {
|
||||
final int cost = 250;
|
||||
if(ManaItemHandler.requestManaExact(amulet, player, cost, false)) {
|
||||
final int range = 20;
|
||||
|
||||
List<IMob> mobs = player.worldObj.getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(event.entity.posX - range, event.entity.posY - range, event.entity.posZ - range, event.entity.posX + range, event.entity.posY + range, event.entity.posZ + range));
|
||||
if(mobs.size() > 1) {
|
||||
SubTileHeiseiDream.brainwashEntity((EntityLiving) event.entityLiving, mobs);
|
||||
event.entityLiving.heal(event.entityLiving.getMaxHealth());
|
||||
ManaItemHandler.requestManaExact(amulet, player, cost, true);
|
||||
player.worldObj.playSoundAtEntity(player, "random.levelup", 1F, 1F);
|
||||
|
||||
double x = event.entityLiving.posX;
|
||||
double y = event.entityLiving.posY;
|
||||
double z = event.entityLiving.posZ;
|
||||
|
||||
for(int i = 0; i < 50; i++)
|
||||
Botania.proxy.sparkleFX(event.entityLiving.worldObj, x + Math.random() * event.entityLiving.width, y + Math.random() * event.entityLiving.height, z + Math.random() * event.entityLiving.width, 1F, 1F, 0.25F, 1F, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaubleType getBaubleType(ItemStack arg0) {
|
||||
return BaubleType.AMULET;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
package vazkii.botania.common.lib;
|
||||
|
||||
|
||||
public final class LibItemNames {
|
||||
|
||||
public static final String LEXICON = "lexicon";
|
||||
@@ -61,6 +60,7 @@ public final class LibItemNames {
|
||||
public static final String WATER_RING = "waterRing";
|
||||
public static final String MINING_RING = "miningRing";
|
||||
public static final String TERRA_PICK = "terraPick";
|
||||
public static final String DIVA_CHARM = "divaCharm";
|
||||
|
||||
public static final String[] LENS_NAMES = new String[] {
|
||||
"lensNormal",
|
||||
|
||||
@@ -18,6 +18,7 @@ public final class LibObfuscation {
|
||||
|
||||
// EntityAINearestAttackableTarget
|
||||
public static final String[] TARGET_CLASS = new String[] { "targetClass", "field_75307_b", "a" };
|
||||
public static final String[] TARGET_ENTITY = new String[] { "targetEntity", "field_75309_a", "g" };
|
||||
|
||||
// EntityAIAttackOnCollide
|
||||
public static final String[] CLASS_TARGET = new String[] { "classTarget", "field_75444_h", "g" };
|
||||
|
||||
@@ -336,6 +336,7 @@ item.botania:magnetRing.name=Ring of Magnetization
|
||||
item.botania:waterRing.name=Ring of Chordata
|
||||
item.botania:miningRing.name=Ring of the Mantle
|
||||
item.botania:terraPick.name=Terra Shatterer
|
||||
item.botania:divaCharm.name=Charm of the Diva
|
||||
|
||||
# GUI TEXT
|
||||
botania.gui.lexicon.header=Lexica Botania Index - Pick which category you would like to study:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 379 B |
Reference in new issue
Block a user