mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-22 21:09:47 +00:00
Content update (continued)
This commit is contained in:
1 parent
9028d32b6e
commit
29eee40824
92 files changed
+3233
-2211
No files matched your search
@@ -2,15 +2,18 @@ package taintedmagic.common.handler;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import taintedmagic.common.TaintedMagic;
|
||||
import thaumcraft.api.wands.FocusUpgradeType;
|
||||
|
||||
public class ConfigHandler
|
||||
{
|
||||
public static Configuration config;
|
||||
|
||||
public static boolean useUpdateHandler = true;
|
||||
public static boolean researchTags = true;
|
||||
public static boolean useCustomResearchTabBackground = false;
|
||||
public static double baseMaceDamageIncrease = 8.0D;
|
||||
public static boolean UPDATE_HANDLER = true;
|
||||
public static boolean RESEARCH_TAGS = true;
|
||||
public static boolean CUSTOM_RESEARCH_TAB_BACK = false;
|
||||
public static double MAGE_MACE_DMG_INC_BASE = 8.0D;
|
||||
public static float WARP_WAND_REFRESH_BASE = 10000.0F;
|
||||
public static int FOCUS_UPGRADES_START_ID = 64;
|
||||
|
||||
public static void init ()
|
||||
{
|
||||
@@ -18,11 +21,20 @@ public class ConfigHandler
|
||||
|
||||
config.load();
|
||||
|
||||
useUpdateHandler = config.getBoolean("use_update_handler", "misc", true, "Should update notifications be enabled?");
|
||||
researchTags = config.getBoolean("research_tags", "research", true, "Setting this to false will disable the '[TaintedMagic]' tag on the research");
|
||||
useCustomResearchTabBackground = config.getBoolean("use_custom_research_tab_background", "research", false, "Setting this to true will enable the old custom tab background");
|
||||
baseMaceDamageIncrease = (double) config
|
||||
.getFloat("mage_mace_damage_increase_base", "misc", 8.0F, 1.0F, 100.0F, "Defines the base amount of damage to increase wand / staff attack damage by when the Mage's Mace focus is equipped.");
|
||||
UPDATE_HANDLER = config.getBoolean("UPDATE_HANDLER", "misc", true, "Setting this to false will disable ingame chat Tainted Magic update notifications.");
|
||||
|
||||
RESEARCH_TAGS = config.getBoolean("RESEARCH_TAGS", "research", true, "Setting this to false will disable the '[categoryTM]' tag on Tainted Magic research items.");
|
||||
|
||||
CUSTOM_RESEARCH_TAB_BACK = config.getBoolean("CUSTOM_RESEARCH_TAB_BACK", "research", false, "Setting this to true will bring back the old Tainted Magic research tab background.");
|
||||
|
||||
MAGE_MACE_DMG_INC_BASE = (double) config
|
||||
.getFloat("MAGE_MACE_DMG_INC_BASE", "misc", 8.0F, 1.0F, 100.0F, "Defines the base amount of damage to increase wand / staff attack damage by when the Mage's Mace focus is equipped.");
|
||||
|
||||
WARP_WAND_REFRESH_BASE = config
|
||||
.getFloat("WARP_WAND_REFRESH_BASE", "misc", 10000.0F, 100.0F, 100000.0F, "Defines the base refresh period in ticks for the Warpwood Wand. The delay period between refreshs is calculated by dividing this number by the amount of permanant warp the player has accumulated.");
|
||||
|
||||
FOCUS_UPGRADES_START_ID = config.getInt("FOCUS_UPGRADES_START_ID", "misc", 64, FocusUpgradeType.types.length + 1, Short.MAX_VALUE
|
||||
- 1, "Defines the starting ID for categoryTM focus upgrades. The first upgrade will be registered under this ID, the next under this ID +1, etc.");
|
||||
|
||||
config.save();
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@ package taintedmagic.common.handler;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import baubles.api.BaublesApi;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -22,9 +26,10 @@ import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingDropsEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import taintedmagic.common.items.ItemMaterial;
|
||||
import taintedmagic.common.items.equipment.ItemLumosRing;
|
||||
import taintedmagic.common.items.tools.ItemHollowDagger;
|
||||
import taintedmagic.common.items.wand.foci.ItemFocusMageMace;
|
||||
@@ -35,7 +40,10 @@ import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.StaffRod;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.blocks.BlockCustomPlant;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
@@ -43,268 +51,300 @@ import thaumcraft.common.lib.network.playerdata.PacketResearchComplete;
|
||||
|
||||
public class TMEventHandler
|
||||
{
|
||||
Random randy = new Random();
|
||||
Random random = new Random();
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
modifyAttackDamage(p);
|
||||
@SubscribeEvent
|
||||
public void playerTick (LivingEvent.LivingUpdateEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.isKeyDown(Keyboard.KEY_DELETE))
|
||||
Minecraft.getMinecraft().refreshResources();
|
||||
|
||||
/**
|
||||
* Repair voidtouched items
|
||||
*/
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack s = p.inventory.getStackInSlot(i);
|
||||
if (s != null)
|
||||
{
|
||||
if (s.stackTagCompound != null && s.stackTagCompound.getBoolean("voidtouched"))
|
||||
{
|
||||
if (!p.worldObj.isRemote && s.isItemDamaged() && p.ticksExisted % 20 == 0)
|
||||
{
|
||||
s.setItemDamage(s.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
|
||||
/**
|
||||
* Create lumos blocks when the player is holding a wand or staff
|
||||
* with the lumos focus equipped or when the Lumos ring is equipped.
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = p.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
modifyAttackDamage(p);
|
||||
|
||||
/**
|
||||
* Repair voidtouched items
|
||||
*/
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack s = p.inventory.getStackInSlot(i);
|
||||
if (s != null)
|
||||
{
|
||||
if (s.stackTagCompound != null && s.stackTagCompound.getBoolean("voidtouched"))
|
||||
{
|
||||
if (!p.worldObj.isRemote && s.isItemDamaged() && p.ticksExisted % 20 == 0)
|
||||
{
|
||||
s.setItemDamage(s.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusLumos && !p.worldObj.isRemote) createLumos(p, 1);
|
||||
}
|
||||
IInventory baub = BaublesApi.getBaubles(p);
|
||||
if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
|| (baub.getStackInSlot(2) != null && baub.getStackInSlot(2).getItem() instanceof ItemLumosRing))
|
||||
createLumos(p, 2);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Create lumos blocks when the player is holding a wand or staff
|
||||
* with the lumos focus equipped or when the Lumos ring is equipped.
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = p.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
|
||||
/**
|
||||
* Creates lumos lightsource blocks.
|
||||
*/
|
||||
public void createLumos (EntityPlayer p, int meta)
|
||||
{
|
||||
int x = Math.round((float) p.posX);
|
||||
int y = Math.round((float) p.posY) + 1;
|
||||
int z = Math.round((float) p.posZ);
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusLumos && !p.worldObj.isRemote)
|
||||
createLumos(p, 1);
|
||||
}
|
||||
IInventory baub = BaublesApi.getBaubles(p);
|
||||
if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
|| (baub.getStackInSlot(2) != null && baub.getStackInSlot(2).getItem() instanceof ItemLumosRing))
|
||||
createLumos(p, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if (p.worldObj.getBlock(x, y, z) == Blocks.air) p.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, meta, 3);
|
||||
}
|
||||
/**
|
||||
* Creates lumos lightsource blocks.
|
||||
*/
|
||||
public void createLumos (EntityPlayer p, int meta)
|
||||
{
|
||||
int x = (int) Math.floor(p.posX);
|
||||
int y = (int) Math.floor(p.posY + 1);
|
||||
int z = (int) Math.floor(p.posZ);
|
||||
|
||||
/*
|
||||
* Some hacky code to make the mage's mace work...
|
||||
*/
|
||||
public void modifyAttackDamage (EntityPlayer p)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
IInventory inv = p.inventory;
|
||||
if (p.worldObj.getBlock(x, y, z) == Blocks.air) p.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, meta, 3);
|
||||
}
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = inv.getStackInSlot(i);
|
||||
ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem();
|
||||
/*
|
||||
* Some hacky code to make the mage's mace work...
|
||||
*/
|
||||
public void modifyAttackDamage (EntityPlayer p)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
IInventory inv = p.inventory;
|
||||
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace && wand.getRod(s) instanceof WandRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = inv.getStackInSlot(i);
|
||||
ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem();
|
||||
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier", ConfigHandler.baseMaceDamageIncrease + wand.getFocusPotency(s), 0);
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(s) instanceof WandRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier",
|
||||
ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(s), 0);
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof WandRod)
|
||||
{
|
||||
if (!s.hasTagCompound())
|
||||
{
|
||||
s.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
s.stackTagCompound.removeTag("AttributeModifiers");
|
||||
}
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace && wand.getRod(s) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier", 6.0D + ConfigHandler.baseMaceDamageIncrease + wand.getFocusPotency(s), 0);
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof WandRod)
|
||||
{
|
||||
if (!s.hasTagCompound())
|
||||
{
|
||||
s.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
s.stackTagCompound.removeTag("AttributeModifiers");
|
||||
}
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(s) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier",
|
||||
5.0D + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(s), 0);
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier", 6.0D, 0);
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier", 6.0D, 0);
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
tag.setInteger("Operation", am.getOperation());
|
||||
tag.setLong("UUIDMost", am.getID().getMostSignificantBits());
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
@SubscribeEvent
|
||||
public void entityAttacked (LivingAttackEvent event)
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) event.source.getEntity();
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Consume vis for Mage's Mace hits
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = p.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
@SubscribeEvent
|
||||
public void playerInteract (PlayerInteractEvent event)
|
||||
{
|
||||
EntityPlayer p = event.entityPlayer;
|
||||
if (p != null)
|
||||
{
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemMaterial
|
||||
&& p.getHeldItem().getItemDamage() == 12 && event.action == event.action.RIGHT_CLICK_BLOCK
|
||||
&& event.world.getBlock(event.x, event.y, event.z) instanceof BlockCustomPlant
|
||||
&& event.world.getBlockMetadata(event.x, event.y, event.z) == 1)
|
||||
{
|
||||
p.inventory.decrStackSize(p.inventory.currentItem, 1);
|
||||
event.world.setBlock(event.x, event.y, event.z, BlockRegistry.BlockWarpwoodSapling);
|
||||
event.world.playSoundAtEntity(p, "thaumcraft:ice", 0.5F + ((float) Math.random() * 0.5F), 1.0F);
|
||||
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) instanceof ItemFocusMageMace)
|
||||
{
|
||||
final AspectList aspects = new AspectList().add(Aspect.EARTH, 20).add(Aspect.ENTROPY, 20).add(Aspect.ORDER, 20);
|
||||
if (wand.consumeAllVis(s, p, aspects, true, false))
|
||||
{
|
||||
wand.consumeAllVis(s, p, aspects, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.world.isRemote) warpSapParticles(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill phials with blood when an entity is hit with the Hollow
|
||||
* Dagger
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemHollowDagger)
|
||||
{
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
if (p.inventory.getStackInSlot(i) != null && p.inventory.getStackInSlot(i).getItem() instanceof ItemEssence && p.inventory.getStackInSlot(i).getItemDamage() == 0)
|
||||
{
|
||||
p.inventory.decrStackSize(i, 1);
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void warpSapParticles (PlayerInteractEvent event)
|
||||
{
|
||||
for (int a = 0; a < 9; a++)
|
||||
{
|
||||
FXSparkle fx =
|
||||
new FXSparkle(event.world, event.x + event.world.rand.nextFloat(), event.y + event.world.rand.nextFloat(),
|
||||
event.z + event.world.rand.nextFloat(), 1.75F, 6, 3 + event.world.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
ParticleEngine.instance.addEffect(event.world, fx);
|
||||
}
|
||||
}
|
||||
|
||||
if (p.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemMaterial, 1, 7)) == false)
|
||||
if (!p.worldObj.isRemote) p.entityDropItem(new ItemStack(ItemRegistry.ItemMaterial, 1, 7), 2.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void entityAttacked (LivingAttackEvent event)
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin (PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
if (UpdateHandler.show) event.player.addChatMessage(new ChatComponentText(UpdateHandler.updateStatus));
|
||||
}
|
||||
/**
|
||||
* Consume vis for Mage's Mace hits
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = p.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
|
||||
@SubscribeEvent
|
||||
public void onCrafting (ItemCraftedEvent event)
|
||||
{
|
||||
if (event.crafting.getItem() == ItemRegistry.ItemMaterial && event.crafting.getItemDamage() == 5) giveResearch(event.player);
|
||||
}
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) instanceof ItemFocusMageMace)
|
||||
{
|
||||
final AspectList aspects =
|
||||
new AspectList().add(Aspect.EARTH, 20).add(Aspect.ENTROPY, 20).add(Aspect.ORDER, 20);
|
||||
if (wand.consumeAllVis(s, p, aspects, true, false))
|
||||
{
|
||||
wand.consumeAllVis(s, p, aspects, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void giveResearch (EntityPlayer p)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION") && ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATIONSHARD"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "CREATION");
|
||||
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("CREATION"), (EntityPlayerMP) p);
|
||||
p.addChatMessage(new ChatComponentText("\u00A75" + StatCollector.translateToLocal("text.creation")));
|
||||
p.playSound("thaumcraft:wind", 1.0F, 5.0F);
|
||||
/**
|
||||
* Fill phials with blood when an entity is hit with the Hollow
|
||||
* Dagger
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemHollowDagger)
|
||||
{
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
if (p.inventory.getStackInSlot(i) != null && p.inventory.getStackInSlot(i).getItem() instanceof ItemEssence
|
||||
&& p.inventory.getStackInSlot(i).getItemDamage() == 0)
|
||||
{
|
||||
p.inventory.decrStackSize(i, 1);
|
||||
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "OUTERREV") && ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "OUTERREV");
|
||||
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"), (EntityPlayerMP) p);
|
||||
}
|
||||
if (p.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemCrimsonBlood)) == false)
|
||||
if (!p.worldObj.isRemote) p.entityDropItem(new ItemStack(ItemRegistry.ItemCrimsonBlood), 2.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
p.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
p.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin (PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
if (UpdateHandler.show) event.player.addChatMessage(new ChatComponentText(UpdateHandler.updateStatus));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void livingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) event.source.getEntity();
|
||||
@SubscribeEvent
|
||||
public void onCrafting (ItemCraftedEvent event)
|
||||
{
|
||||
if (event.crafting.getItem() == ItemRegistry.ItemMaterial && event.crafting.getItemDamage() == 5)
|
||||
giveResearch(event.player);
|
||||
}
|
||||
|
||||
// Currently unused
|
||||
}
|
||||
}
|
||||
public void giveResearch (EntityPlayer p)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
{
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATIONSHARD"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "CREATION");
|
||||
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("CREATION"),
|
||||
(EntityPlayerMP) p);
|
||||
p.addChatMessage(new ChatComponentText("\u00A75" + StatCollector.translateToLocal("text.creation")));
|
||||
p.playSound("thaumcraft:wind", 1.0F, 5.0F);
|
||||
|
||||
public void addDropItem (LivingDropsEvent event, ItemStack drop)
|
||||
{
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, drop);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "OUTERREV")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "OUTERREV");
|
||||
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"),
|
||||
(EntityPlayerMP) p);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tooltipEvent (ItemTooltipEvent event)
|
||||
{
|
||||
if (event.itemStack.getItem() instanceof ItemFocusMageMace)
|
||||
{
|
||||
if (event.toolTip.contains(StatCollector.translateToLocal("item.Focus.cost1")))
|
||||
{
|
||||
event.toolTip.remove(StatCollector.translateToLocal("item.Focus.cost1"));
|
||||
event.toolTip.add(1, StatCollector.translateToLocal("item.Focus.cost3"));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
p.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
p.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched")) event.toolTip.add("\u00A75" + StatCollector.translateToLocal("text.voidtouched"));
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void tooltipEvent (ItemTooltipEvent event)
|
||||
{
|
||||
if (event.itemStack.getItem() instanceof ItemFocusMageMace)
|
||||
{
|
||||
if (event.toolTip.contains(StatCollector.translateToLocal("item.Focus.cost1")))
|
||||
{
|
||||
event.toolTip.remove(StatCollector.translateToLocal("item.Focus.cost1"));
|
||||
event.toolTip.add(1, StatCollector.translateToLocal("item.Focus.cost3"));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched"))
|
||||
event.toolTip.add("\u00A75" + StatCollector.translateToLocal("text.voidtouched"));
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,7 @@ import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
|
||||
public class WandHandler implements IWandRodOnUpdate
|
||||
{
|
||||
Aspect aspect;
|
||||
Aspect primals[] = Aspect.getPrimalAspects().toArray(new Aspect[0]);
|
||||
private static final String TAG_PERIOD = "period";
|
||||
|
||||
public void onUpdate (ItemStack s, EntityPlayer p)
|
||||
{
|
||||
@@ -21,29 +19,16 @@ public class WandHandler implements IWandRodOnUpdate
|
||||
{
|
||||
int permwarp = Thaumcraft.proxy.getPlayerKnowledge().getWarpPerm(p.getCommandSenderName());
|
||||
|
||||
if (permwarp == 0)
|
||||
{
|
||||
if (s.stackTagCompound == null) s.stackTagCompound = new NBTTagCompound();
|
||||
s.getTagCompound().setInteger(TAG_PERIOD, 0);
|
||||
return;
|
||||
}
|
||||
if (permwarp == 0) return;
|
||||
|
||||
// exponential decay at rate of mul / warp (1 / x)
|
||||
float mul = 10000.0F;
|
||||
float T = mul / (float) permwarp;
|
||||
// refresh period of base/warp (1/x type relationship)
|
||||
float base = ConfigHandler.WARP_WAND_REFRESH_BASE;
|
||||
float T = base / (float) permwarp;
|
||||
|
||||
int rT = Math.round(T);
|
||||
int rT = (T < 1.0F) ? 1 : Math.round(T);
|
||||
|
||||
if (s.stackTagCompound == null) s.stackTagCompound = new NBTTagCompound();
|
||||
s.getTagCompound().setInteger(TAG_PERIOD, rT);
|
||||
|
||||
if (p.ticksExisted % rT == 0)
|
||||
{
|
||||
for (int i = 0; i < primals.length; i++)
|
||||
{
|
||||
((ItemWandCasting) s.getItem()).addVis(s, this.primals[i], 1, true);
|
||||
}
|
||||
}
|
||||
if (p.ticksExisted % rT == 0) for (int i = 0; i < primals.length; i++)
|
||||
((ItemWandCasting) s.getItem()).addVis(s, this.primals[i], 1, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user