public ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemstack) {
    EnumFacing facing = EnumFacing.func_82600_a(blockSource.func_82620_h());
    World world = blockSource.getWorld();
    int targetX = blockSource.getXInt() + facing.func_82601_c();
    int targetY = blockSource.getYInt();
    int targetZ = blockSource.getZInt() + facing.func_82599_e();

    TileEntity te = world.getBlockTileEntity(targetX, targetY, targetZ);
    if (te != null && te instanceof ITankContainer) {
      return fillOrEmptyContainer((ITankContainer) te, itemstack, facing);
    }
    if (world.isAirBlock(targetX, targetY, targetZ)) {
      TileEntity tileabove = world.getBlockTileEntity(targetX, targetY + 1, targetZ);
      TileEntity tilebelow = world.getBlockTileEntity(targetX, targetY - 1, targetZ);
      if (tileabove != null && LiquidContainerRegistry.isEmptyContainer(itemstack)) {
        return fillContainer((ITankContainer) tileabove, itemstack, EnumFacing.UP);
      }
      if (tilebelow != null && LiquidContainerRegistry.isFilledContainer(itemstack)) {
        return emptyContainer((ITankContainer) tilebelow, itemstack, EnumFacing.DOWN);
      }
    }
    System.out.println("Not matched");

    return null;
  }
示例#2
0
 public static IPosition func_82525_a(IBlockSource p_82525_0_) {
   EnumFacing var1 = func_100009_j_(p_82525_0_.func_82620_h());
   double var2 = p_82525_0_.func_82615_a() + 0.7D * (double) var1.func_82601_c();
   double var4 = p_82525_0_.func_82617_b() + 0.7D * (double) var1.func_96559_d();
   double var6 = p_82525_0_.func_82616_c() + 0.7D * (double) var1.func_82599_e();
   return new PositionImpl(var2, var4, var6);
 }
  public int findPathOptions(
      PathPoint[] pathOptions,
      Entity entityIn,
      PathPoint currentPoint,
      PathPoint targetPoint,
      float maxDistance) {
    int i = 0;

    for (EnumFacing enumfacing : EnumFacing.values()) {
      PathPoint pathpoint =
          this.getSafePoint(
              entityIn,
              currentPoint.xCoord + enumfacing.getFrontOffsetX(),
              currentPoint.yCoord + enumfacing.getFrontOffsetY(),
              currentPoint.zCoord + enumfacing.getFrontOffsetZ());

      if (pathpoint != null
          && !pathpoint.visited
          && pathpoint.distanceTo(targetPoint) < maxDistance) {
        pathOptions[i++] = pathpoint;
      }
    }

    return i;
  }
示例#4
0
  public boolean onBlockActivated(
      World worldIn,
      BlockPos pos,
      IBlockState state,
      EntityPlayer playerIn,
      EnumHand hand,
      @Nullable ItemStack heldItem,
      EnumFacing side,
      float hitX,
      float hitY,
      float hitZ) {
    if (((Boolean) state.getValue(OPEN)).booleanValue()) {
      state = state.withProperty(OPEN, Boolean.valueOf(false));
      worldIn.setBlockState(pos, state, 10);
    } else {
      EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw);

      if (state.getValue(FACING) == enumfacing.getOpposite()) {
        state = state.withProperty(FACING, enumfacing);
      }

      state = state.withProperty(OPEN, Boolean.valueOf(true));
      worldIn.setBlockState(pos, state, 10);
    }

    worldIn.playEvent(
        playerIn, ((Boolean) state.getValue(OPEN)).booleanValue() ? 1008 : 1014, pos, 0);
    return true;
  }
示例#5
0
 public byte getOutputOutsideClient(EnumFacing side) {
   if (isSideInverted(side)) {
     return outputClient[side.ordinal() - 2] != 0 ? 0 : (byte) 15;
   } else {
     return outputClient[side.ordinal() - 2];
   }
 }
示例#6
0
  @Override
  public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumBlockMultiType type = (EnumBlockMultiType) state.getValue(MULTI_TYPE);
    int renderType = 0;

    switch (type) {
      case CRYO_CHAMBER:
        IBlockState stateAbove = worldIn.getBlockState(pos.up());
        TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos);
        if (stateAbove.getBlock() == this
            && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) {
          renderType = 0;
        } else {
          renderType = 4;
        }
        if (tile != null && tile.mainBlockPosition != null) {
          IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition);
          if (stateMain.getBlock() == MarsBlocks.machine
              && stateMain.getValue(BlockMachineMars.TYPE)
                  == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
            EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING);
            renderType += dir.getHorizontalIndex();
          }
        }
        break;
      default:
        break;
    }

    return state.withProperty(RENDER_TYPE, renderType);
  }
  public void eventHandler(PipeEventItem.FindDest event) {
    LinkedList<EnumFacing> newOris = new LinkedList<EnumFacing>();

    for (int o = 0; o < 6; ++o) {
      EnumFacing orientation = EnumFacing.VALUES[o];

      // commented out during port from BC 4.2 to 6.1
      // I don't know what the equivalent to the Position argument to filterPossibleMovements() is
      // in the new eventHandler system
      // if(orientation != pos.orientation.getOpposite())
      {
        TileEntity entity = container.getTile(orientation);
        if (entity instanceof IInventory) {
          IInventory inventory = (IInventory) entity;

          if (InventoryUtils.containsItem(true, false, event.item.getItemStack(), inventory)) {
            ITransactor transactor = Transactor.getTransactorFor(entity, orientation.getOpposite());
            if (transactor.add(event.item.getItemStack(), false).stackSize > 0) {
              newOris.add(orientation);
            }
          } else {
            event.destinations.remove(orientation);
          }
        }
      }
    }

    if (!newOris.isEmpty()) {
      event.destinations.clear();
      event.destinations.addAll(newOris);
    } else {

    }
  }
示例#8
0
  private void func_174856_o() {
    if (this.field_174860_b != null) {
      double var1 = (double) this.field_174861_a.getX() + 0.5D;
      double var3 = (double) this.field_174861_a.getY() + 0.5D;
      double var5 = (double) this.field_174861_a.getZ() + 0.5D;
      double var7 = 0.46875D;
      double var9 = this.func_174858_a(this.getWidthPixels());
      double var11 = this.func_174858_a(this.getHeightPixels());
      var1 -= (double) this.field_174860_b.getFrontOffsetX() * 0.46875D;
      var5 -= (double) this.field_174860_b.getFrontOffsetZ() * 0.46875D;
      var3 += var11;
      EnumFacing var13 = this.field_174860_b.rotateYCCW();
      var1 += var9 * (double) var13.getFrontOffsetX();
      var5 += var9 * (double) var13.getFrontOffsetZ();
      this.posX = var1;
      this.posY = var3;
      this.posZ = var5;
      double var14 = (double) this.getWidthPixels();
      double var16 = (double) this.getHeightPixels();
      double var18 = (double) this.getWidthPixels();

      if (this.field_174860_b.getAxis() == EnumFacing.Axis.Z) {
        var18 = 1.0D;
      } else {
        var14 = 1.0D;
      }

      var14 /= 32.0D;
      var16 /= 32.0D;
      var18 /= 32.0D;
      this.func_174826_a(
          new AxisAlignedBB(
              var1 - var14, var3 - var16, var5 - var18, var1 + var14, var3 + var16, var5 + var18));
    }
  }
 @Override
 public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
   if (side != null) return ImmutableList.of();
   IExtendedBlockState exState = (IExtendedBlockState) state;
   int len = cubeSize * 5 + 1;
   List<BakedQuad> ret = new ArrayList<BakedQuad>();
   for (EnumFacing f : EnumFacing.values()) {
     ret.add(createSidedBakedQuad(0, 1, 0, 1, 1, base, f));
     if (state != null) {
       for (int i = 0; i < cubeSize; i++) {
         for (int j = 0; j < cubeSize; j++) {
           Integer value = exState.getValue(properties[f.ordinal()]);
           if (value != null && (value & (1 << (i * cubeSize + j))) != 0) {
             ret.add(
                 createSidedBakedQuad(
                     (float) (1 + i * 5) / len,
                     (float) (5 + i * 5) / len,
                     (float) (1 + j * 5) / len,
                     (float) (5 + j * 5) / len,
                     1.0001f,
                     overlay,
                     f));
           }
         }
       }
     }
   }
   return ret;
 }
 static {
   for (EnumFacing f : EnumFacing.values()) {
     properties[f.ordinal()] =
         Properties.toUnlisted(
             PropertyInteger.create(f.getName(), 0, (1 << (cubeSize * cubeSize)) - 1));
   }
 }
示例#11
0
  public static void placeDoor(World worldIn, BlockPos pos, EnumFacing facing, Block door) {
    BlockPos blockpos = pos.offset(facing.rotateY());
    BlockPos blockpos1 = pos.offset(facing.rotateYCCW());
    int i =
        (worldIn.getBlockState(blockpos1).getBlock().isNormalCube() ? 1 : 0)
            + (worldIn.getBlockState(blockpos1.up()).getBlock().isNormalCube() ? 1 : 0);
    int j =
        (worldIn.getBlockState(blockpos).getBlock().isNormalCube() ? 1 : 0)
            + (worldIn.getBlockState(blockpos.up()).getBlock().isNormalCube() ? 1 : 0);
    boolean flag =
        worldIn.getBlockState(blockpos1).getBlock() == door
            || worldIn.getBlockState(blockpos1.up()).getBlock() == door;
    boolean flag1 =
        worldIn.getBlockState(blockpos).getBlock() == door
            || worldIn.getBlockState(blockpos.up()).getBlock() == door;
    boolean flag2 = false;

    if (flag && !flag1 || j > i) {
      flag2 = true;
    }

    BlockPos blockpos2 = pos.up();
    IBlockState iblockstate =
        door.getDefaultState()
            .withProperty(BlockDoor.FACING, facing)
            .withProperty(
                BlockDoor.HINGE,
                flag2 ? BlockDoor.EnumHingePosition.RIGHT : BlockDoor.EnumHingePosition.LEFT);
    worldIn.setBlockState(
        pos, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.LOWER), 2);
    worldIn.setBlockState(
        blockpos2, iblockstate.withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2);
    worldIn.notifyNeighborsOfStateChange(pos, door);
    worldIn.notifyNeighborsOfStateChange(blockpos2, door);
  }
    public void iterate(Coord4D from, EnumFacing fromDirection) {
      if (iterated.contains(from)) {
        return;
      }

      iterated.add(from);

      if (orphanTransmitters.containsKey(from)) {
        IGridTransmitter<A, N> transmitter = orphanTransmitters.get(from);

        if (transmitter.isValid() && transmitter.isOrphan()) {
          connectedTransmitters.add(transmitter);
          transmitter.setOrphan(false);

          for (EnumFacing direction : EnumFacing.VALUES) {
            if (direction != fromDirection) {
              Coord4D directionCoord =
                  transmitter.getAdjacentConnectableTransmitterCoord(direction);

              if (!(directionCoord == null || iterated.contains(directionCoord))) {
                iterate(directionCoord, direction.getOpposite());
              }
            }
          }
        }
      } else {
        addNetworkToIterated(from);
      }
    }
 protected ItemStack fillOrEmptyContainer(
     ITankContainer tank, ItemStack itemstack, EnumFacing facing) {
   for (LiquidContainerData data : LiquidContainerRegistry.getRegisteredLiquidContainerData()) {
     if (data.container.isItemEqual(itemstack)) {
       int amount = data.stillLiquid.amount;
       LiquidStack liquid =
           tank.drain(
               ForgeDirection.getOrientation(facing.ordinal()).getOpposite(), amount, false);
       if (liquid != null && liquid.isLiquidEqual(data.stillLiquid) && liquid.amount == amount) {
         tank.drain(ForgeDirection.getOrientation(facing.ordinal()).getOpposite(), amount, true);
         itemstack.stackSize--;
         ItemStack result = data.filled.copy();
         result.stackSize = 1;
         return result;
       }
     } else if (data.filled.isItemEqual(itemstack)) {
       LiquidStack liquid = data.stillLiquid;
       int amount =
           tank.fill(ForgeDirection.getOrientation(facing.ordinal()).getOpposite(), liquid, false);
       if (liquid.amount == amount) {
         tank.fill(ForgeDirection.getOrientation(facing.ordinal()).getOpposite(), liquid, true);
         ItemStack result = itemstack.getItem().getContainerItemStack(itemstack);
         itemstack.stackSize--;
         if (result == null) {
           result = data.container.copy();
           result.stackSize = 0;
         }
         return result;
       } else {
         return null;
       }
     }
   }
   return null;
 }
示例#14
0
  public BlockPattern.PatternHelper func_177681_a(World p_177681_1_, BlockPos p_177681_2_) {
    LoadingCache var3 = CacheBuilder.newBuilder().build(new BlockPattern.CacheLoader(p_177681_1_));
    int var4 = Math.max(Math.max(this.field_177686_d, this.field_177688_c), this.field_177687_b);
    Iterator var5 =
        BlockPos.func_177980_a(p_177681_2_, p_177681_2_.func_177982_a(var4 - 1, var4 - 1, var4 - 1))
            .iterator();

    while (var5.hasNext()) {
      BlockPos var6 = (BlockPos) var5.next();
      EnumFacing[] var7 = EnumFacing.values();
      int var8 = var7.length;

      for (int var9 = 0; var9 < var8; ++var9) {
        EnumFacing var10 = var7[var9];
        EnumFacing[] var11 = EnumFacing.values();
        int var12 = var11.length;

        for (int var13 = 0; var13 < var12; ++var13) {
          EnumFacing var14 = var11[var13];
          if (var14 != var10 && var14 != var10.func_176734_d()) {
            BlockPattern.PatternHelper var15 = this.func_177682_a(var6, var10, var14, var3);
            if (var15 != null) {
              return var15;
            }
          }
        }
      }
    }

    return null;
  }
示例#15
0
 protected byte getInputInside(EnumFacing side) {
   if (isSideInverted(side)) {
     return inputs[side.ordinal() - 2] != 0 ? 0 : (byte) 15;
   } else {
     return inputs[side.ordinal() - 2];
   }
 }
示例#16
0
  private static EnumFacing getFlippedFacing(final EnumFacing axis, final EnumFacing side) {
    if (axis.getAxis() == side.getAxis()) {
      return side.getOpposite();
    }

    return side;
  }
 protected int func_176407_c(
     IBlockAccess p_176407_1_, BlockPos p_176407_2_, IBlockState p_176407_3_) {
   EnumFacing var4 = (EnumFacing) p_176407_3_.func_177229_b(field_176387_N);
   EnumFacing var5 = var4.func_176746_e();
   EnumFacing var6 = var4.func_176735_f();
   return Math.max(
       this.func_176401_c(p_176407_1_, p_176407_2_.func_177972_a(var5), var5),
       this.func_176401_c(p_176407_1_, p_176407_2_.func_177972_a(var6), var6));
 }
  @Override
  protected void onImpact(@Nonnull RayTraceResult pos) {
    if (isReturning()) return;

    switch (pos.typeOfHit) {
      case BLOCK:
        {
          Block block = worldObj.getBlockState(pos.getBlockPos()).getBlock();
          if (block instanceof BlockBush || block instanceof BlockLeaves) return;

          int bounces = getTimesBounced();
          if (bounces < MAX_BOUNCES) {
            Vector3 currentMovementVec = new Vector3(motionX, motionY, motionZ);
            EnumFacing dir = pos.sideHit;
            Vector3 normalVector =
                new Vector3(dir.getFrontOffsetX(), dir.getFrontOffsetY(), dir.getFrontOffsetZ())
                    .normalize();
            Vector3 movementVec =
                normalVector
                    .multiply(-2 * currentMovementVec.dotProduct(normalVector))
                    .add(currentMovementVec);

            motionX = movementVec.x;
            motionY = movementVec.y;
            motionZ = movementVec.z;
            bounced = true;

            if (!worldObj.isRemote) setTimesBounced(getTimesBounced() + 1);
          }

          break;
        }
      case ENTITY:
        {
          if (!worldObj.isRemote
              && pos.entityHit != null
              && pos.entityHit instanceof EntityLivingBase
              && pos.entityHit != getThrower()) {
            EntityLivingBase thrower = getThrower();
            pos.entityHit.attackEntityFrom(
                thrower != null
                    ? thrower instanceof EntityPlayer
                        ? DamageSource.causeThrownDamage(this, thrower)
                        : DamageSource.causeMobDamage(thrower)
                    : DamageSource.generic,
                12);
            if (isFire()) pos.entityHit.setFire(5);
            else if (worldObj.rand.nextInt(3) == 0)
              ((EntityLivingBase) pos.entityHit)
                  .addPotionEffect(new PotionEffect(MobEffects.POISON, 60, 0));
          }

          break;
        }
    }
  }
示例#19
0
  /** Convert the given metadata into a BlockState for this Block */
  @Override
  public IBlockState getStateFromMeta(int meta) {
    EnumFacing enumfacing = EnumFacing.getFront(meta % 6);

    if (enumfacing.getAxis() == EnumFacing.Axis.Y) {
      enumfacing = EnumFacing.NORTH;
    }
    // System.out.println("getState");
    return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ACTIVE, meta > 5);
  }
示例#20
0
 @Override
 public boolean canConnectRedstone(EnumFacing direction) {
   if (side.getAxis() != direction.getAxis()) {
     EnumFacing dir = realToGate(direction);
     if (isSideOpen(dir)) {
       return getType(dir).isRedstone();
     }
   }
   return false;
 }
  @Override
  public boolean onItemUse(
      ItemStack stack,
      EntityPlayer player,
      World world,
      BlockPos pos,
      EnumFacing side,
      float hitX,
      float hitY,
      float hitZ) {
    IBlockState iblockstate = world.getBlockState(pos);
    Block localBlock = iblockstate.getBlock();
    BlockPos posThere = pos;
    BlockPos posOffset = pos.offset(side);

    if (localBlock == Blocks.snow_layer && localBlock.isReplaceable(world, pos))
      side = EnumFacing.UP;
    else if (!localBlock.isReplaceable(world, pos)) pos = pos.offset(side);

    TileEntityIESlab stackSlab = null;
    if (side.getAxis().isVertical()
        && this.block.equals(world.getBlockState(posThere).getBlock())
        && world.getBlockState(posThere).getBlock().getMetaFromState(world.getBlockState(posThere))
            == stack.getItemDamage()) {
      TileEntity te = world.getTileEntity(posThere);
      if (te instanceof TileEntityIESlab && ((TileEntityIESlab) te).slabType + side.ordinal() == 1)
        stackSlab = ((TileEntityIESlab) te);
    } else if (this.block.equals(world.getBlockState(posOffset).getBlock())
        && world
                .getBlockState(posOffset)
                .getBlock()
                .getMetaFromState(world.getBlockState(posOffset))
            == stack.getItemDamage()) {
      TileEntity te = world.getTileEntity(posOffset);
      if (te instanceof TileEntityIESlab) {
        int type = ((TileEntityIESlab) te).slabType;
        if ((type == 0 && (side == EnumFacing.DOWN || hitY >= .5))
            || (type == 1 && (side == EnumFacing.UP || hitY <= .5)))
          stackSlab = ((TileEntityIESlab) te);
      }
    } else return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
    if (stackSlab != null) {
      stackSlab.slabType = 2;
      world.markBlockForUpdate(stackSlab.getPos());
      world.playSoundEffect(
          stackSlab.getPos().getX() + .5,
          stackSlab.getPos().getY() + .5,
          stackSlab.getPos().getZ() + .5,
          this.block.stepSound.getPlaceSound(),
          (this.block.stepSound.getVolume() + 1.0F) / 2.0F,
          this.block.stepSound.getFrequency() * 0.8F);
      --stack.stackSize;
      return true;
    } else return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ);
  }
示例#22
0
  public Marker(final BlockPos pos, final int spacing, final int rgb) {
    this.pos = new MBlockPos(pos);
    this.enabled = true;
    this.spacing = spacing;
    this.rgb = rgb;
    this.markerLength = Constants.Rendering.DEFAULT_LENGTH;

    for (final EnumFacing side : EnumFacing.VALUES) {
      this.sides[side.ordinal()] = true;
    }
  }
示例#23
0
 @Override
 public void writeUpdatePacket(PacketBuffer buf) {
   buf.writeByte((mirrored ? 0x40 : 0) | (side.ordinal() << 3) | top.ordinal());
   buf.writeByte(enabledSides | (invertedSides << 4));
   for (int i = 0; i <= 3; i++) {
     EnumFacing dir = EnumFacing.getFront(i + 2);
     if (getType(dir) != Connection.NONE) {
       buf.writeByte(getType(dir).isInput() ? inputs[i] : getOutputInside(dir));
     }
   }
 }
示例#24
0
 /**
  * Whether it is connected on the specified side
  *
  * @param world The World
  * @param pos The Block pos
  * @param facing The Side
  * @return Whether it is connected
  */
 public static boolean isConnected(IBlockAccess world, BlockPos pos, EnumFacing facing) {
   return blockStatesEqual(
       getBlockOrFacade(world, pos, facing),
       getBlockOrFacade(
           world,
           pos(
               pos.getX() + facing.getFrontOffsetX(),
               pos.getY() + facing.getFrontOffsetY(),
               pos.getZ() + facing.getFrontOffsetZ()),
           facing));
 }
 protected void spawnDispenseParticles(IBlockSource blockSource) {
   EnumFacing facing = EnumFacing.func_82600_a(blockSource.func_82620_h());
   blockSource
       .getWorld()
       .playAuxSFX(
           2000,
           blockSource.getXInt(),
           blockSource.getYInt(),
           blockSource.getZInt(),
           facing.func_82601_c() + 1 + (facing.func_82599_e() + 1) * 3);
 }
示例#26
0
 @Override
 public boolean rotatePart(EnumFacing axis) {
   if (axis.getAxis() == side.getAxis()) {
     if (axis.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE) {
       top = top.rotateY();
     } else {
       top = top.rotateYCCW();
     }
     return true;
   }
   return false;
 }
示例#27
0
 @Override
 public void writeToNBT(NBTTagCompound tag) {
   tag.setByteArray("in", inputs);
   tag.setByte("f", (byte) side.ordinal());
   tag.setByte("t", (byte) top.ordinal());
   tag.setByte("e", enabledSides);
   tag.setByte("i", invertedSides);
   tag.setBoolean("m", mirrored);
   if (pendingTick != 0) {
     tag.setByte("p", (byte) pendingTick);
   }
 }
示例#28
0
 private void putVertex(
     UnpackedBakedQuad.Builder builder,
     EnumFacing side,
     float x,
     float y,
     float z,
     float u,
     float v) {
   for (int e = 0; e < format.getElementCount(); e++) {
     switch (format.getElement(e).getUsage()) {
       case POSITION:
         float[] data =
             new float[] {
               x - side.getDirectionVec().getX() * eps,
               y,
               z - side.getDirectionVec().getZ() * eps,
               1
             };
         if (transformation.isPresent()
             && transformation.get() != TRSRTransformation.identity()) {
           Vector4f vec = new Vector4f(data);
           transformation.get().getMatrix().transform(vec);
           vec.get(data);
         }
         builder.put(e, data);
         break;
       case COLOR:
         builder.put(
             e,
             ((color >> 16) & 0xFF) / 255f,
             ((color >> 8) & 0xFF) / 255f,
             (color & 0xFF) / 255f,
             ((color >> 24) & 0xFF) / 255f);
         break;
       case UV:
         if (format.getElement(e).getIndex() == 0) {
           builder.put(e, u, v, 0f, 1f);
           break;
         }
       case NORMAL:
         builder.put(
             e,
             (float) side.getFrontOffsetX(),
             (float) side.getFrontOffsetY(),
             (float) side.getFrontOffsetZ(),
             0f);
         break;
       default:
         builder.put(e);
         break;
     }
   }
 }
  @Override
  public Object execute(SpellContext context) throws SpellRuntimeException {
    Entity e = this.<Entity>getParamValue(context, target);

    if (e == null) throw new SpellRuntimeException(SpellRuntimeException.NULL_TARGET);
    Vec3d look = e.getLook(1F);
    EnumFacing facing =
        EnumFacing.getFacingFromVector(
            (float) look.xCoord, (float) look.yCoord, (float) look.zCoord);

    return new Vector3(
        facing.getFrontOffsetX(), facing.getFrontOffsetY(), facing.getFrontOffsetZ());
  }
示例#30
0
 @Override
 public IBlockState onBlockPlaced(
     World worldIn,
     BlockPos pos,
     EnumFacing facing,
     float hitX,
     float hitY,
     float hitZ,
     int meta,
     EntityLivingBase placer) {
   EnumFacing f = TomsModUtils.getDirectionFacing(placer, false);
   return this.getDefaultState().withProperty(FACING, f.getOpposite()).withProperty(ACTIVE, false);
 }