示例#1
0
 public IChatComponent getDeathMessage(EntityLivingBase aPlayer, EntityLivingBase aEntity) {
   return new ChatComponentText(
       EnumChatFormatting.RED
           + aEntity.getCommandSenderName()
           + EnumChatFormatting.WHITE
           + " got stuck trying to escape through a Pipe while fighting "
           + EnumChatFormatting.GREEN
           + aPlayer.getCommandSenderName()
           + EnumChatFormatting.WHITE);
 }
  @Override
  public void onBlockPlacedBy(
      World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
    if (world.isRemote) return;
    if (stack.hasTagCompound()) {
      TileEntity te = world.getTileEntity(x, y, z);
      if (te instanceof TileVendorBlock) {
        TileVendorBlock tentity = (TileVendorBlock) te;
        NBTTagCompound tagCompound = stack.getTagCompound();
        if (tagCompound == null) {
          return;
        }
        NBTTagList tagList = tagCompound.getTagList("Inventory", Constants.NBT.TAG_COMPOUND);
        for (int i = 0; i < tagList.tagCount(); i++) {
          NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i);
          byte slot = tag.getByte("Slot");
          if (slot >= 0 && slot < tentity.getSizeInventory()) {
            tentity.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tag));
          }
        }
        tentity.coinSum = tagCompound.getInteger("CoinSum");
        tentity.userCoinSum = tagCompound.getInteger("UserCoinSum");
        tentity.itemPrice = tagCompound.getInteger("ItemPrice");
        tentity.blockOwner = tagCompound.getString("BlockOwner");
        tentity.infiniteMode = tagCompound.getBoolean("Infinite");
      }
      world.markBlockForUpdate(x, y, z);

    } else {
      // item has no owner so we'll set one and get out of here
      ((TileVendorBlock) world.getTileEntity(x, y, z)).blockOwner = entity.getCommandSenderName();
    }
    int meta = stack.getItemDamage();
    world.setBlockMetadataWithNotify(x, y, z, meta, 2);
  }
 @Override
 public IChatComponent func_151519_b(EntityLivingBase entity) {
   String locTag =
       "death."
           + ModUtil.MOD_ID_LOWER
           + "."
           + this.damageType
           + "."
           + (Util.RANDOM.nextInt(this.messageCount) + 1);
   return new ChatComponentText(
       StringUtil.localizeFormatted(locTag, entity.getCommandSenderName()));
 }
 /** Called when the block is placed in the world. */
 public void onBlockPlacedBy(
     World par1World,
     int par2,
     int par3,
     int par4,
     EntityLivingBase par5EntityLivingBase,
     ItemStack par6ItemStack) {
   if (par1World.isRemote) {
     return;
   } else {
     if (par5EntityLivingBase instanceof EntityPlayer) {
       ((TileEntityOwnable) par1World.getTileEntity(par2, par3, par4))
           .setOwner(
               ((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(),
               par5EntityLivingBase.getCommandSenderName());
     }
   }
 }
 @Override
 public IChatComponent func_151519_b(EntityLivingBase entity) {
   String locTag =
       "death.railcraft." + damageType + "." + (MiscTools.getRand().nextInt(numMessages) + 1);
   return ChatPlugin.chatComp(locTag, entity.getCommandSenderName());
 }
 @Override
 public void setLinkedEntity(EntityLivingBase entity) {
   throwerName = entity.getCommandSenderName();
 }