mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-12-22 19:39:24 +01:00
Changed the TeleStaff's Behavior
This commit is contained in:
parent
e9d706f127
commit
3fe11c88ce
5 changed files with 23 additions and 11 deletions
|
@ -61,7 +61,7 @@ public class ItemCrafting{
|
|||
" E", " S ", "SB ",
|
||||
'E', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDERPEARL_BLOCK.ordinal()),
|
||||
'S', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ENDER_CASING.ordinal()),
|
||||
'B', new ItemStack(InitItems.itemBattery)));
|
||||
'B', new ItemStack(InitItems.itemBattery, 1, Util.WILDCARD)));
|
||||
|
||||
//Drill Speed
|
||||
if(ConfigCrafting.DRILL_SPEED.isEnabled()){
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -199,7 +198,7 @@ public class ItemDrill extends ItemEnergy implements INameableItem{
|
|||
int yRange = radius;
|
||||
int zRange = 0;
|
||||
|
||||
MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance());
|
||||
MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player);
|
||||
|
||||
if(pos != null){
|
||||
int side = pos.sideHit;
|
||||
|
|
|
@ -25,7 +25,7 @@ public class ItemTeleStaff extends ItemEnergy implements INameableItem{
|
|||
private static final int waitTime = ConfigIntValues.TELE_STAFF_WAIT_TIME.getValue();
|
||||
|
||||
public ItemTeleStaff(){
|
||||
super(500000, 10000, 1);
|
||||
super(500000, 10000, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,8 +74,8 @@ public class ItemTeleStaff extends ItemEnergy implements INameableItem{
|
|||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
|
||||
if(!world.isRemote){
|
||||
if(this.getWaitTime(stack) <= 0){
|
||||
MovingObjectPosition pos = WorldUtil.getMovingObjectPosWithReachDistance(world, player, (double)reach);
|
||||
if(pos != null){
|
||||
MovingObjectPosition pos = WorldUtil.getNearestPositionWithAir(world, player, reach);
|
||||
if(pos != null && (pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK || player.rotationPitch >= -5)){
|
||||
int side = pos.sideHit;
|
||||
if(side != -1){
|
||||
ForgeDirection forgeSide = ForgeDirection.getOrientation(side);
|
||||
|
@ -86,13 +86,16 @@ public class ItemTeleStaff extends ItemEnergy implements INameableItem{
|
|||
int use = energyUsedPerBlock+(int)(energyUsedPerBlock*pos.hitVec.distanceTo(player.getPosition(1.0F)));
|
||||
if(this.getEnergyStored(stack) >= use){
|
||||
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
|
||||
player.mountEntity(null);
|
||||
world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F);
|
||||
if(!player.capabilities.isCreativeMode) this.extractEnergy(stack, use, false);
|
||||
if(!player.capabilities.isCreativeMode){
|
||||
this.extractEnergy(stack, use, false);
|
||||
this.setWaitTime(stack, waitTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.setWaitTime(stack, waitTime);
|
||||
}
|
||||
}
|
||||
player.swingItem();
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -213,7 +214,15 @@ public class WorldUtil{
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance){
|
||||
public static MovingObjectPosition getNearestPositionWithAir(World world, EntityPlayer player, int reach){
|
||||
return getMovingObjectPosWithReachDistance(world, player, reach, false, false, true);
|
||||
}
|
||||
|
||||
public static MovingObjectPosition getNearestBlockWithDefaultReachDistance(World world, EntityPlayer player){
|
||||
return getMovingObjectPosWithReachDistance(world, player, player instanceof EntityPlayerMP ? ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance() : 5.0D, false, true, false);
|
||||
}
|
||||
|
||||
private static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean p1, boolean p2, boolean p3){
|
||||
float f = 1.0F;
|
||||
float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*f;
|
||||
float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*f;
|
||||
|
@ -228,6 +237,6 @@ public class WorldUtil{
|
|||
float f7 = f4*f5;
|
||||
float f8 = f3*f5;
|
||||
Vec3 vec31 = vec3.addVector((double)f7*distance, (double)f6*distance, (double)f8*distance);
|
||||
return world.func_147447_a(vec3, vec31, false, true, false);
|
||||
return world.func_147447_a(vec3, vec31, p1, p2, p3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,7 +282,8 @@ item.actuallyadditions.itemMiscBlackQuartz.name=Black Quartz
|
|||
item.actuallyadditions.itemMiscRing.name=Ring
|
||||
|
||||
item.actuallyadditions.itemTeleStaff.name=Teleport Staff
|
||||
tooltip.actuallyadditions.itemTeleStaff.desc=Teleports you to where you're looking when you right-click.
|
||||
tooltip.actuallyadditions.itemTeleStaff.desc.1=Teleports you to where you're looking when you right-click.
|
||||
tooltip.actuallyadditions.itemTeleStaff.desc.2=Only works on Blocks or if you don't look upwards.
|
||||
|
||||
item.actuallyadditions.itemJamCuBaRa.name=CuBaRa-Jam
|
||||
item.actuallyadditions.itemJamGraKiBa.name=GraKiBa-Jam
|
||||
|
|
Loading…
Reference in a new issue