Exemplo n.º 1
0
  private void dropBlocks(World world, int x, int y, int z) {
    Block drop = world.getBlock(x, y, z);
    if (drop == Blocks.air) return;
    int dropmeta = world.getBlockMetadata(x, y, z);
    ItemStack sapling = tree.getSapling();
    Block logID = tree.getTreeType().getLogID();

    Collection<ItemStack> drops = this.getDrops(world, x, y, z, drop, dropmeta);
    if (drop == logID && logID != null) {
      if (rand.nextInt(3) == 0) {
        drops.add(
            ReikaItemHelper.getSizedItemStack(ItemStacks.sawdust.copy(), 1 + rand.nextInt(4)));
      }
    }

    for (ItemStack todrop : drops) {
      if (ReikaItemHelper.matchStacks(todrop, sapling)) {
        if (inv[0] != null && inv[0].stackSize >= inv[0].getMaxStackSize()) {
          if (!this.chestCheck(todrop))
            ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
        } else ReikaInventoryHelper.addOrSetStack(todrop, inv, 0);
      } else {
        if (!this.chestCheck(todrop))
          ReikaItemHelper.dropItem(world, dropx, yCoord - 0.25, dropz, todrop);
      }
    }
  }
  @Override
  protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    ReikaTextureHelper.bindFontTexture();

    int j = (width - xSize) / 2;
    int k = (height - ySize) / 2;
    ReikaGuiAPI.instance.drawCenteredStringNoShadow(
        fontRendererObj,
        StatCollector.translateToLocal("chroma.routerfilter"),
        xSize / 2,
        5,
        0xffffff);

    for (int i = 0; i < 9; i++) {
      ItemRule ir = tile.getFilter(i);
      if (ir != null) {
        int x = 8 + i * 18;
        int y = 33;
        ReikaGuiAPI.instance.drawItemStack(
            itemRender, fontRendererObj, ReikaItemHelper.getSizedItemStack(ir.getItem(), 1), x, y);
        GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        ReikaGuiAPI.instance.drawRectFrame(x - 1, y - 1, 18, 18, 0xff000000 | ir.mode.color);
        GL11.glPopAttrib();
      }
    }
  }
Exemplo n.º 3
0
 @SubscribeEvent
 public void meatGrinding(LivingDropsEvent ev) {
   if (ev.source instanceof GrinderDamage) {
     ItemStack food = ReikaEntityHelper.getFoodItem(ev.entityLiving);
     ev.drops.clear();
     if (food != null) {
       World world = ev.entityLiving.worldObj;
       Random rand = RotaryCraft.rand;
       int num = 4 + rand.nextInt(4) + rand.nextInt(4) + rand.nextInt(4);
       ItemStack is = ReikaItemHelper.getSizedItemStack(food, num);
       ReikaItemHelper.dropItem(
           world, ev.entityLiving.posX, ev.entityLiving.posY, ev.entityLiving.posZ, is);
     }
     ev.setCanceled(true);
   }
 }
Exemplo n.º 4
0
 private void sortItems(World world, int x, int y, int z, List<EntityItem> li) {
   for (EntityItem ei : li) {
     ItemStack is = ei.getEntityItem();
     if (is.stackSize <= 1) ei.setDead();
     else {
       is.stackSize--;
     }
     ForgeDirection dir = this.getSideForItem(is);
     double dx = x + 0.5 + dir.offsetX * 0.75;
     double dy = y + 0.5 + dir.offsetY * 0.75;
     double dz = z + 0.5 + dir.offsetZ * 0.75;
     EntityItem e = new EntityItem(world, dx, dy, dz, ReikaItemHelper.getSizedItemStack(is, 1));
     double v = 0.1;
     e.motionX = dir.offsetX * v;
     e.motionY = dir.offsetY * v;
     e.motionZ = dir.offsetZ * v;
     world.spawnEntityInWorld(e);
   }
 }
  @Override
  public void onDeath(DamageSource src) {
    ChromaSounds.DISCHARGE.playSound(this, 1F, 2F);
    if (!worldObj.isRemote) {
      Entity e = src.getEntity();
      if (e instanceof EntityPlayer) {
        EntityPlayer ep = (EntityPlayer) e;
        if (doDrops && !ReikaPlayerAPI.isFakeOrNotInteractable(ep, posX, posY, posZ, 8)) {
          int looting = EnchantmentHelper.getLootingModifier((EntityPlayer) src.getEntity());
          ReikaItemHelper.dropItem(
              this,
              ReikaItemHelper.getSizedItemStack(
                  ChromaStacks.beaconDust, rand.nextInt(1 + looting * 2)));
          if (looting > 1) {
            if (color.isPrimary()) ReikaItemHelper.dropItem(this, ChromaStacks.purityDust);
            else ReikaItemHelper.dropItem(this, ChromaStacks.auraDust);
          }
        }
        ProgressStage.BALLLIGHTNING.stepPlayerTo(ep);
      }

      this.sendDeathParticles();
    }
  }
Exemplo n.º 6
0
 private PulseJetRecipe(ItemStack in) {
   input = ReikaItemHelper.getSizedItemStack(in, 1);
 }
Exemplo n.º 7
0
 public void addSizedOreRecipe(int size, Object... o) {
   ShapedOreRecipe ir =
       new ShapedOreRecipe(ReikaItemHelper.getSizedItemStack(this.getItem(), size), o);
   GameRegistry.addRecipe(ir);
 }
Exemplo n.º 8
0
 public void addSizedRecipe(int size, Object... o) {
   GameRegistry.addRecipe(ReikaItemHelper.getSizedItemStack(this.getItem(), size), o);
 }
 private void setContents(int num) {
   inv[0] = ReikaItemHelper.getSizedItemStack(ItemStacks.bedrockdust, num);
 }
 private ItemStack getDrops(World world, int x, int y, int z) {
   ItemStack dust =
       ReikaItemHelper.getSizedItemStack(
           ItemStacks.bedrockdust, this.getNumberDust(world, x, y, z));
   return dust;
 }
Exemplo n.º 11
0
 @Override
 public PositionedStack getIngredient() {
   return new PositionedStack(ReikaItemHelper.getSizedItemStack(input, 1), 21, 28);
 }