mirror of
https://github.com/GTNewHorizons/Tainted-Magic.git
synced 2026-11-22 12:59:56 +00:00
Event handler cleanup & Warping Fertilizer changes
This commit is contained in:
1 parent
48a990a28f
commit
76e3af8e99
1 file changed
+183
-132
@@ -1,5 +1,7 @@
|
||||
package taintedmagic.common.handler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -24,7 +26,9 @@ import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||
@@ -36,8 +40,7 @@ import taintedmagic.common.items.wand.foci.ItemFocusMageMace;
|
||||
import taintedmagic.common.registry.BlockRegistry;
|
||||
import taintedmagic.common.registry.ItemRegistry;
|
||||
import thaumcraft.api.ThaumcraftApiHelper;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.wands.ItemFocusBasic;
|
||||
import thaumcraft.api.wands.StaffRod;
|
||||
import thaumcraft.api.wands.WandRod;
|
||||
import thaumcraft.client.fx.ParticleEngine;
|
||||
@@ -45,6 +48,7 @@ import thaumcraft.client.fx.particles.FXSparkle;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumcraft.common.blocks.BlockCustomPlant;
|
||||
import thaumcraft.common.config.Config;
|
||||
import thaumcraft.common.config.ConfigBlocks;
|
||||
import thaumcraft.common.items.ItemEssence;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import thaumcraft.common.lib.network.playerdata.PacketResearchComplete;
|
||||
@@ -58,88 +62,90 @@ public class TMEventHandler
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) event.entity;
|
||||
|
||||
repairItems(player);
|
||||
createLumos(player);
|
||||
modifyAttackDamage(player);
|
||||
|
||||
for (int i = 0; i < saps.size(); i++)
|
||||
saps.get(i).doWarpSap(player.worldObj, i);
|
||||
|
||||
// DELETE THIS UPON RELEASE
|
||||
if (Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.isKeyDown(Keyboard.KEY_DELETE))
|
||||
Minecraft.getMinecraft().refreshResources();
|
||||
|
||||
EntityPlayer p = (EntityPlayer) event.entity;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates lumos lightsource blocks.
|
||||
* Repair "Voidtouched" items
|
||||
*/
|
||||
public void createLumos (EntityPlayer p, int meta)
|
||||
public void repairItems (EntityPlayer player)
|
||||
{
|
||||
int x = (int) Math.floor(p.posX);
|
||||
int y = (int) Math.floor(p.posY + 1);
|
||||
int z = (int) Math.floor(p.posZ);
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = player.inventory.getStackInSlot(i);
|
||||
if (!player.worldObj.isRemote && stack != null && stack.stackTagCompound != null
|
||||
&& stack.stackTagCompound.getBoolean("voidtouched") && stack.isItemDamaged())
|
||||
{
|
||||
if (player.ticksExisted % 20 == 0) stack.setItemDamage(stack.getItemDamage() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (p.worldObj.getBlock(x, y, z) == Blocks.air) p.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, meta, 3);
|
||||
/**
|
||||
* Create Lumos lightsource blocks when the player is holding a wand or staff
|
||||
* with the Lumos focus equipped or when the Lumos ring is equipped.
|
||||
*/
|
||||
public void createLumos (EntityPlayer player)
|
||||
{
|
||||
int x = (int) Math.floor(player.posX);
|
||||
int y = (int) Math.floor(player.posY + 1);
|
||||
int z = (int) Math.floor(player.posZ);
|
||||
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack held = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
|
||||
if (wand.getFocus(held) != null && wand.getFocus(held) == ItemRegistry.ItemFocusLumos && !player.worldObj.isRemote
|
||||
&& player.worldObj.getBlock(x, y, z) == Blocks.air)
|
||||
player.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, 1, 3);
|
||||
}
|
||||
|
||||
IInventory baub = BaublesApi.getBaubles(player);
|
||||
if ( (baub.getStackInSlot(1) != null && baub.getStackInSlot(1).getItem() instanceof ItemLumosRing)
|
||||
|| (baub.getStackInSlot(2) != null && baub.getStackInSlot(2).getItem() instanceof ItemLumosRing)
|
||||
&& player.worldObj.getBlock(x, y, z) == Blocks.air)
|
||||
player.worldObj.setBlock(x, y, z, BlockRegistry.BlockLumos, 2, 3);
|
||||
}
|
||||
|
||||
/*
|
||||
* Some hacky code to make the mage's mace work...
|
||||
* Some hacky code to make the Mage's Mace work...
|
||||
*/
|
||||
public void modifyAttackDamage (EntityPlayer p)
|
||||
public void modifyAttackDamage (EntityPlayer player)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
IInventory inv = p.inventory;
|
||||
IInventory inv = player.inventory;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = inv.getStackInSlot(i);
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
ItemWandCasting wand = (ItemWandCasting) inv.getStackInSlot(i).getItem();
|
||||
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(s) instanceof WandRod)
|
||||
if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(stack) instanceof WandRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
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);
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
@@ -148,26 +154,26 @@ public class TMEventHandler
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
stack.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof WandRod)
|
||||
else if (wand.getRod(stack) instanceof WandRod)
|
||||
{
|
||||
if (!s.hasTagCompound())
|
||||
if (!stack.hasTagCompound())
|
||||
{
|
||||
s.setTagCompound(new NBTTagCompound());
|
||||
stack.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
s.stackTagCompound.removeTag("AttributeModifiers");
|
||||
stack.stackTagCompound.removeTag("AttributeModifiers");
|
||||
}
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(s) instanceof StaffRod)
|
||||
if (wand.getFocus(stack) != null && wand.getFocus(stack) == ItemRegistry.ItemFocusMageMace
|
||||
&& wand.getRod(stack) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
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);
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier",
|
||||
5.0D + ConfigHandler.MAGE_MACE_DMG_INC_BASE + wand.getFocusPotency(stack), 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
@@ -176,16 +182,16 @@ public class TMEventHandler
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
stack.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
else if (wand.getRod(s) instanceof StaffRod)
|
||||
else if (wand.getRod(stack) instanceof StaffRod)
|
||||
{
|
||||
NBTTagList tags = new NBTTagList();
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("AttributeName", SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName());
|
||||
|
||||
UUID u = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(u, "Weapon modifier", 6.0D, 0);
|
||||
UUID uuid = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
|
||||
AttributeModifier am = new AttributeModifier(uuid, "Weapon modifier", 6.0D, 0);
|
||||
|
||||
tag.setString("Name", am.getName());
|
||||
tag.setDouble("Amount", am.getAmount());
|
||||
@@ -194,43 +200,81 @@ public class TMEventHandler
|
||||
tag.setLong("UUIDLeast", am.getID().getLeastSignificantBits());
|
||||
|
||||
tags.appendTag(tag);
|
||||
s.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
stack.stackTagCompound.setTag("AttributeModifiers", tags);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turn Silverwood Saplings into Warpwood Saplings using Warping Fertilizer
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void playerInteract (PlayerInteractEvent event)
|
||||
public void createWarpSap (PlayerInteractEvent event)
|
||||
{
|
||||
EntityPlayer p = event.entityPlayer;
|
||||
if (p != null)
|
||||
EntityPlayer player = event.entityPlayer;
|
||||
if (player != null)
|
||||
{
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemMaterial
|
||||
&& p.getHeldItem().getItemDamage() == 12 && event.action == event.action.RIGHT_CLICK_BLOCK
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemMaterial
|
||||
&& player.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 (event.world.isRemote) warpSapParticles(event);
|
||||
if (player.worldObj.isRemote) player.swingItem();
|
||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
event.world.playSoundAtEntity(player, "thaumcraft:roots", 2.0F, 1.0F);
|
||||
saps.add(new WarpSapHandler(event.x, event.y, event.z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void warpSapParticles (PlayerInteractEvent event)
|
||||
List<WarpSapHandler> saps = new ArrayList<WarpSapHandler>();
|
||||
|
||||
private class WarpSapHandler
|
||||
{
|
||||
for (int a = 0; a < 9; a++)
|
||||
int time = 0;
|
||||
int sapX, sapY, sapZ;
|
||||
|
||||
public WarpSapHandler (int x, int y, int z)
|
||||
{
|
||||
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);
|
||||
sapX = x;
|
||||
sapY = y;
|
||||
sapZ = z;
|
||||
}
|
||||
|
||||
public void doWarpSap (World world, int index)
|
||||
{
|
||||
if (world.getBlock(sapX, sapY, sapZ) == ConfigBlocks.blockCustomPlant
|
||||
&& world.getBlockMetadata(sapX, sapY, sapZ) == 1)
|
||||
{
|
||||
time++;
|
||||
|
||||
if (world.isRemote && world.rand.nextBoolean())
|
||||
warpSapParticles(world, sapX, sapY, sapZ, world.rand.nextInt(2) + 1);
|
||||
|
||||
if (time == 100)
|
||||
{
|
||||
warpSapParticles(world, sapX, sapY, sapZ, 25);
|
||||
world.setBlock(sapX, sapY, sapZ, BlockRegistry.BlockWarpwoodSapling);
|
||||
time = 0;
|
||||
saps.remove(index);
|
||||
}
|
||||
}
|
||||
else saps.remove(index);
|
||||
}
|
||||
|
||||
@SideOnly (Side.CLIENT)
|
||||
public void warpSapParticles (World world, int x, int y, int z, int count)
|
||||
{
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
FXSparkle fx = new FXSparkle(world, x + world.rand.nextFloat(), y + world.rand.nextFloat(),
|
||||
z + world.rand.nextFloat(), 1.75F, 5, 3 + world.rand.nextInt(3));
|
||||
fx.setGravity(0.1F);
|
||||
|
||||
ParticleEngine.instance.addEffect(world, fx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,90 +283,94 @@ public class TMEventHandler
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
EntityPlayer p = (EntityPlayer) event.source.getEntity();
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
/**
|
||||
* Consume vis for Mage's Mace hits
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWandCasting)
|
||||
{
|
||||
ItemStack s = p.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) s.getItem();
|
||||
ItemStack held = player.getHeldItem();
|
||||
ItemWandCasting wand = (ItemWandCasting) held.getItem();
|
||||
ItemFocusBasic focus = wand.getFocus(held);
|
||||
|
||||
if (wand.getFocus(s) != null && wand.getFocus(s) instanceof ItemFocusMageMace)
|
||||
if (focus != null && focus 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 (wand.consumeAllVis(held, player, focus.getVisCost(held), true, false));
|
||||
else event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fill phials with blood when an entity is hit with the Hollow
|
||||
* Dagger
|
||||
* Fill phials with blood when an entity is hit using the Hollow Dagger
|
||||
*/
|
||||
if (p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemHollowDagger)
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemHollowDagger)
|
||||
{
|
||||
for (int i = 0; i < p.inventory.getSizeInventory(); i++)
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++)
|
||||
{
|
||||
if (p.inventory.getStackInSlot(i) != null && p.inventory.getStackInSlot(i).getItem() instanceof ItemEssence
|
||||
&& p.inventory.getStackInSlot(i).getItemDamage() == 0)
|
||||
if (player.inventory.getStackInSlot(i) != null
|
||||
&& player.inventory.getStackInSlot(i).getItem() instanceof ItemEssence
|
||||
&& player.inventory.getStackInSlot(i).getItemDamage() == 0)
|
||||
{
|
||||
p.inventory.decrStackSize(i, 1);
|
||||
player.inventory.decrStackSize(i, 1);
|
||||
|
||||
if (p.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemCrimsonBlood)) == false)
|
||||
if (!p.worldObj.isRemote) p.entityDropItem(new ItemStack(ItemRegistry.ItemCrimsonBlood), 2.0F);
|
||||
if (player.inventory.addItemStackToInventory(new ItemStack(ItemRegistry.ItemCrimsonBlood)) == false)
|
||||
if (!player.worldObj.isRemote)
|
||||
player.entityDropItem(new ItemStack(ItemRegistry.ItemCrimsonBlood), 2.0F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update notifications
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onPlayerLogin (PlayerEvent.PlayerLoggedInEvent event)
|
||||
public void playerLoggedIn (PlayerEvent.PlayerLoggedInEvent event)
|
||||
{
|
||||
if (UpdateHandler.show) event.player.addChatMessage(new ChatComponentText(UpdateHandler.updateStatus));
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect when the player crafts a Shard of Creation
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void onCrafting (ItemCraftedEvent event)
|
||||
public void itemCrafted (ItemCraftedEvent event)
|
||||
{
|
||||
if (event.crafting.getItem() == ItemRegistry.ItemMaterial && event.crafting.getItemDamage() == 5)
|
||||
giveResearch(event.player);
|
||||
}
|
||||
|
||||
public void giveResearch (EntityPlayer p)
|
||||
/**
|
||||
* Give the player the Creation research upon crafting the Shard of Creation
|
||||
*/
|
||||
public void giveResearch (EntityPlayer player)
|
||||
{
|
||||
if (!p.worldObj.isRemote)
|
||||
if (!player.worldObj.isRemote)
|
||||
{
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATIONSHARD"))
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATIONSHARD"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "CREATION");
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "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);
|
||||
(EntityPlayerMP) player);
|
||||
player.addChatMessage(new ChatComponentText(
|
||||
EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.creation")));
|
||||
player.playSound("thaumcraft:wind", 1.0F, 5.0F);
|
||||
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "OUTERREV")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(p.getCommandSenderName(), "CREATION"))
|
||||
if (!ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "OUTERREV")
|
||||
&& ThaumcraftApiHelper.isResearchComplete(player.getCommandSenderName(), "CREATION"))
|
||||
{
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(p, "OUTERREV");
|
||||
Thaumcraft.proxy.getResearchManager().completeResearch(player, "OUTERREV");
|
||||
thaumcraft.common.lib.network.PacketHandler.INSTANCE.sendTo(new PacketResearchComplete("OUTERREV"),
|
||||
(EntityPlayerMP) p);
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
p.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
p.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 80, 0));
|
||||
player.addPotionEffect(new PotionEffect(Config.potionBlurredID, 200, 0));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -332,8 +380,11 @@ public class TMEventHandler
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify certain tooltips
|
||||
*/
|
||||
@SubscribeEvent
|
||||
public void tooltipEvent (ItemTooltipEvent event)
|
||||
public void itemTooltip (ItemTooltipEvent event)
|
||||
{
|
||||
if (event.itemStack.getItem() instanceof ItemFocusMageMace)
|
||||
{
|
||||
@@ -345,6 +396,6 @@ public class TMEventHandler
|
||||
}
|
||||
|
||||
if (event.itemStack.stackTagCompound != null && event.itemStack.stackTagCompound.getBoolean("voidtouched"))
|
||||
event.toolTip.add("\u00A75" + StatCollector.translateToLocal("text.voidtouched"));
|
||||
event.toolTip.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("text.voidtouched"));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user