mirror of
https://github.com/GTNewHorizons/ThaumicTinkerer.git
synced 2026-10-26 14:33:48 +00:00
Added the effect for the Recall Focus.
This commit is contained in:
1 parent
f15c9bae24
commit
f6f030df73
2 files changed
+84
-21
No files matched your search
@@ -27,6 +27,7 @@ import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.Packet132TileEntityData;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import vazkii.tinkerer.common.ThaumicTinkerer;
|
||||
import vazkii.tinkerer.common.item.ModItems;
|
||||
import vazkii.tinkerer.common.item.kami.ItemSkyPearl;
|
||||
@@ -60,28 +61,42 @@ public class TileWarpGate extends TileEntity implements IInventory {
|
||||
int x = ItemSkyPearl.getX(stack);
|
||||
int y = ItemSkyPearl.getY(stack);
|
||||
int z = ItemSkyPearl.getZ(stack);
|
||||
|
||||
TileEntity tile = worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tile != null && tile instanceof TileWarpGate) {
|
||||
TileWarpGate destGate = (TileWarpGate) tile;
|
||||
if(!destGate.locked) {
|
||||
worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
|
||||
teleportedThisTick = true;
|
||||
} else player.addChatMessage("ttmisc.noTeleport");
|
||||
} else player.addChatMessage("ttmisc.noDest");
|
||||
if(teleportPlayer(player, new ChunkCoordinates(x, y, z)))
|
||||
teleportedThisTick = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean teleportPlayer(EntityPlayer player, ChunkCoordinates coords) {
|
||||
int x = coords.posX;
|
||||
int y = coords.posY;
|
||||
int z = coords.posZ;
|
||||
|
||||
TileEntity tile = player.worldObj.getBlockTileEntity(x, y, z);
|
||||
if(tile != null && tile instanceof TileWarpGate) {
|
||||
TileWarpGate destGate = (TileWarpGate) tile;
|
||||
if(!destGate.locked) {
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 1F);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
if(player instanceof EntityPlayerMP)
|
||||
((EntityPlayerMP) player).playerNetServerHandler.setPlayerLocation(x + 0.5, y + 1.6, z + 0.5, player.rotationYaw, player.rotationPitch);
|
||||
|
||||
for(int i = 0; i < 20; i++)
|
||||
ThaumicTinkerer.tcProxy.sparkle((float)player.posX + player.worldObj.rand.nextFloat() - 0.5F, (float)player.posY + player.worldObj.rand.nextFloat(), (float)player.posZ + player.worldObj.rand.nextFloat() - 0.5F, 6);
|
||||
|
||||
player.worldObj.playSoundAtEntity(player, "thaumcraft:wand", 1F, 0.1F);
|
||||
return true;
|
||||
} else if(!player.worldObj.isRemote)
|
||||
player.addChatMessage("ttmisc.noTeleport");
|
||||
} else if(!player.worldObj.isRemote)
|
||||
player.addChatMessage("ttmisc.noDest");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
|
||||
super.readFromNBT(par1NBTTagCompound);
|
||||
|
||||
@@ -14,15 +14,21 @@
|
||||
*/
|
||||
package vazkii.tinkerer.common.item.kami.foci;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.Icon;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import scala.annotation.meta.param;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.common.items.wands.ItemWandCasting;
|
||||
import vazkii.tinkerer.common.block.tile.kami.TileWarpGate;
|
||||
import vazkii.tinkerer.common.item.foci.ItemModFocus;
|
||||
import vazkii.tinkerer.common.item.kami.ItemSkyPearl;
|
||||
|
||||
public class ItemFocusRecall extends ItemModFocus {
|
||||
|
||||
AspectList cost = new AspectList().add(Aspect.AIR, 40).add(Aspect.EARTH, 40).add(Aspect.ORDER, 40);
|
||||
AspectList cost = new AspectList().add(Aspect.AIR, 4000).add(Aspect.EARTH, 4000).add(Aspect.ORDER, 4000);
|
||||
|
||||
public ItemFocusRecall(int par1) {
|
||||
super(par1);
|
||||
@@ -32,6 +38,48 @@ public class ItemFocusRecall extends ItemModFocus {
|
||||
protected boolean hasDepth() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseItem() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
ItemWandCasting wand = (ItemWandCasting) par1ItemStack.getItem();
|
||||
|
||||
return wand.consumeAllVis(par1ItemStack, par3EntityPlayer, cost, false) ? super.onItemRightClick(par1ItemStack, par2World, par3EntityPlayer) : par1ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUsingFocusTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) {
|
||||
ItemWandCasting wand = (ItemWandCasting) paramItemStack.getItem();
|
||||
|
||||
if(Integer.MAX_VALUE - paramInt > 60) {
|
||||
ItemStack stackToCount = null;
|
||||
for(int i = 0; i < 9; i++) {
|
||||
ItemStack stackInSlot = paramEntityPlayer.inventory.getStackInSlot(i);
|
||||
if(stackInSlot != null && stackInSlot.getItem() instanceof ItemSkyPearl && ItemSkyPearl.isAttuned(stackInSlot)) {
|
||||
stackToCount = stackInSlot;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(stackToCount != null) {
|
||||
int dim = ItemSkyPearl.getDim(stackToCount);
|
||||
if(dim == paramEntityPlayer.dimension) {
|
||||
int x = ItemSkyPearl.getX(stackToCount);
|
||||
int y = ItemSkyPearl.getY(stackToCount);
|
||||
int z = ItemSkyPearl.getZ(stackToCount);
|
||||
|
||||
if(TileWarpGate.teleportPlayer(paramEntityPlayer, new ChunkCoordinates(x, y, z)))
|
||||
wand.consumeAllVis(paramItemStack, paramEntityPlayer, getVisCost(), true);
|
||||
}
|
||||
}
|
||||
|
||||
paramEntityPlayer.clearItemInUse();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFocusColor() {
|
||||
|
||||
Reference in new issue
Block a user